Refactored capturing of resp. centers. + added auto allocate BOD-131

This commit is contained in:
Patrick Fic
2020-05-20 16:21:17 -07:00
parent 0dbacf0b9e
commit d8a4c87d3a
24 changed files with 3251 additions and 203 deletions

View File

@@ -4,16 +4,13 @@ import { useTranslation } from "react-i18next";
import AllocationButton from "../jobs-close-allocation-button/jobs-close-allocation-button.component";
import AllocationTags from "../jobs-close-allocation-tags/jobs-close-allocation-tags.component";
export default function JobCloseLabMatAllocation({
labmatAllocations,
setLabmatAllocations,
labMatTotalAllocation
labMatTotalAllocation,
}) {
const { t } = useTranslation();
return (
<div style={{ display: "flex" }}>
<table>
@@ -53,6 +50,18 @@ export default function JobCloseLabMatAllocation({
<td>
<AllocationButton
allocationKey={alloc}
remainingAmount={labmatAllocations[alloc].total
.subtract(
Dinero({
amount: labmatAllocations[alloc].allocations.reduce(
(acc, val) => {
return acc + val.amount.getAmount();
},
0
),
})
)
.getAmount()}
allocation={labmatAllocations[alloc]}
setAllocations={setLabmatAllocations}
/>
@@ -71,9 +80,9 @@ export default function JobCloseLabMatAllocation({
<tr>
<td></td>
<td>{labmatAllocations.subtotal.toFormat()}</td>
<td></td>
<td></td>
<td>{labMatTotalAllocation.toFormat()}</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>