Fixed bugs on parts allocations + added totals BOD-131

This commit is contained in:
Patrick Fic
2020-05-20 10:03:03 -07:00
parent 94777bf661
commit 0dbacf0b9e
8 changed files with 118 additions and 32 deletions

View File

@@ -22,10 +22,12 @@ export function JobsCloseLabmatAllocationButton({
const [visible, setVisible] = useState(false);
const [state, setState] = useState({ center: "", amount: 0 });
const { t } = useTranslation();
const handleAllocate = () => {
const existingIndex = allocation.allocations.findIndex(
(e) => e.center === state.center
);
console.log("handleAllocate -> existingIndex", existingIndex);
const newAllocations = allocation.allocations.slice(0);
if (existingIndex > -1) {
@@ -41,6 +43,7 @@ export function JobsCloseLabmatAllocationButton({
amount: Dinero({ amount: state.amount * 100 }),
});
}
setAllocations((labMatState) => {
return {
...labMatState,