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

@@ -28,7 +28,7 @@ export default function JobsClosePartsAllocation({
{Object.keys(partsAllocations).map((alloc, idx) => {
return (
<tr key={idx}>
<td>{t(`jobs.fields.${alloc}`)}</td>
<td>{t(`jobs.fields.${alloc.toLowerCase()}`)}</td>
<td>
{partsAllocations[alloc].total &&
partsAllocations[alloc].total.toFormat()}
@@ -50,6 +50,18 @@ export default function JobsClosePartsAllocation({
<td>
<AllocationButton
allocationKey={alloc}
remainingAmount={partsAllocations[alloc].total
.subtract(
Dinero({
amount: partsAllocations[alloc].allocations.reduce(
(acc, val) => {
return acc + val.amount.getAmount();
},
0
),
})
)
.getAmount()}
allocation={partsAllocations[alloc]}
setAllocations={setPartsAllocations}
/>
@@ -74,9 +86,9 @@ export default function JobsClosePartsAllocation({
}, 0),
}).toFormat()}
</td>
<td></td>
<td></td>
<td>{partsAllocatedTotal.toFormat()}</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>