Refactored capturing of resp. centers. + added auto allocate BOD-131
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user