ui(admin): add allocation table, implement allocation creator
This commit is contained in:
parent
6b746440fc
commit
3c01dbbcc5
14 changed files with 397 additions and 87 deletions
27
resources/scripts/state/admin/allocations.ts
Normal file
27
resources/scripts/state/admin/allocations.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { action, Action } from 'easy-peasy';
|
||||
|
||||
export interface AdminAllocationStore {
|
||||
selectedAllocations: number[];
|
||||
|
||||
setSelectedAllocations: Action<AdminAllocationStore, number[]>;
|
||||
appendSelectedAllocation: Action<AdminAllocationStore, number>;
|
||||
removeSelectedAllocation: Action<AdminAllocationStore, number>;
|
||||
}
|
||||
|
||||
const allocations: AdminAllocationStore = {
|
||||
selectedAllocations: [],
|
||||
|
||||
setSelectedAllocations: action((state, payload) => {
|
||||
state.selectedAllocations = payload;
|
||||
}),
|
||||
|
||||
appendSelectedAllocation: action((state, payload) => {
|
||||
state.selectedAllocations = state.selectedAllocations.filter(id => id !== payload).concat(payload);
|
||||
}),
|
||||
|
||||
removeSelectedAllocation: action((state, payload) => {
|
||||
state.selectedAllocations = state.selectedAllocations.filter(id => id !== payload);
|
||||
}),
|
||||
};
|
||||
|
||||
export default allocations;
|
Loading…
Add table
Add a link
Reference in a new issue