Add UI elements for part tax and improve calculations.

This commit is contained in:
Patrick Fic
2023-09-12 14:16:01 -07:00
parent 6a9e871b08
commit 536f8d9cb9
5 changed files with 587 additions and 57 deletions

View File

@@ -389,6 +389,18 @@ export function JobsDetailPage({
export default connect(mapStateToProps, mapDispatchToProps)(JobsDetailPage);
const transormJobToForm = (job) => {
Object.keys(job.parts_tax_rates).forEach((parttype) => {
Object.keys(job.parts_tax_rates[parttype]).forEach((key) => {
if (key.includes("tx_in")) {
if (job.parts_tax_rates[parttype][key] === "Y") {
job.parts_tax_rates[parttype][key] = true;
} else {
job.parts_tax_rates[parttype][key] = false;
}
}
});
});
return {
...job,
loss_date: job.loss_date ? moment(job.loss_date) : null,