diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index ce53bf8a7..18694dcff 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -1340,6 +1340,48 @@ + + mapa + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + mash + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + paa false @@ -1508,6 +1550,27 @@ + + pas + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + tow false @@ -1828,6 +1891,27 @@ + + default_returned + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + default_scheduled false @@ -6640,6 +6724,27 @@ + + autoallocate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + changestatus false @@ -7889,6 +7994,132 @@ + + la1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + la2 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + la3 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + la4 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + laa + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + lab + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + labor_rate_desc false @@ -7910,6 +8141,174 @@ + + lad + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + lae + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + laf + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + lag + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + lam + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + lar + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + las + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + lau + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + loss_date false @@ -7952,6 +8351,48 @@ + + mapa + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + mash + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + other_amount_payable false @@ -8057,6 +8498,174 @@ + + paa + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + pal + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + pam + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + pan + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + pao + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + pap + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + par + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + pas + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + pay_date false @@ -10109,6 +10718,27 @@ + + suspense + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + total_repairs false diff --git a/client/src/components/job-totals-table/job-totals-table.component.jsx b/client/src/components/job-totals-table/job-totals-table.component.jsx index a5d8f4320..3c0c29818 100644 --- a/client/src/components/job-totals-table/job-totals-table.component.jsx +++ b/client/src/components/job-totals-table/job-totals-table.component.jsx @@ -28,165 +28,167 @@ export function JobsTotalsTableComponent({ bodyshop, job }) { + title={t("jobs.labels.rates")} + > - + + label={t("jobs.labels.rates_subtotal")} + > @@ -195,9 +197,10 @@ export function JobsTotalsTableComponent({ bodyshop, job }) { + title={t("jobs.labels.partssubletstotal")} + > + title={t("jobs.labels.totals")} + > diff --git a/client/src/components/job-totals-table/job-totals.utility.js b/client/src/components/job-totals-table/job-totals.utility.js index 818d8c3c7..e5376554c 100644 --- a/client/src/components/job-totals-table/job-totals.utility.js +++ b/client/src/components/job-totals-table/job-totals.utility.js @@ -23,7 +23,7 @@ function CalculateTaxesTotals(job, otherTotals) { if (!!!val.tax_part) return acc; if (!!job.parts_tax_rates[val.part_type]) { return acc.add( - Dinero({ amount: val.act_price * 100 }) + Dinero({ amount: Math.round(val.act_price * 100) }) .multiply(val.part_qty) .percentage( (job.parts_tax_rates[val.part_type].prt_tax_rt || 0) * 100 @@ -43,18 +43,18 @@ function CalculateTaxesTotals(job, otherTotals) { otherTotals.rates.rates_subtotal.percentage((job.tax_lbr_rt || 0) * 100) ) .add( - Dinero({ amount: (job.towing_payable || 0) * 100 }).percentage( - (job.tax_tow_rt || 0) * 100 - ) + Dinero({ + amount: Math.round((job.towing_payable || 0) * 100), + }).percentage((job.tax_tow_rt || 0) * 100) ) .add( - Dinero({ amount: (job.storage_payable || 0) * 100 }).percentage( - (job.tax_str_rt || 0) * 100 - ) + Dinero({ + amount: Math.round((job.storage_payable || 0) * 100), + }).percentage((job.tax_str_rt || 0) * 100) ) .add( - otherTotals.rates.paint_mat.total - .add(otherTotals.rates.shop_mat.total) + otherTotals.rates.mapa.total + .add(otherTotals.rates.mash.total) .percentage((job.tax_paint_mat_rt || 0) * 100) ), local_tax: subtotal.percentage((job.local_tax_rate || 0) * 100), @@ -74,91 +74,91 @@ function CalculateRatesTotals(ratesList, shoprates) { const jobLines = ratesList.joblines; let ret = { - rate_la1: { + la1: { hours: jobLines .filter((item) => item.mod_lbr_ty === "LA1") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), rate: ratesList.rate_la1 || 0, }, - rate_la2: { + la2: { hours: jobLines .filter((item) => item.mod_lbr_ty === "LA2") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), rate: ratesList.rate_la2 || 0, }, - rate_la3: { + la3: { rate: ratesList.rate_la3 || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LA3") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_la4: { + la4: { rate: ratesList.rate_la4 || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LA4") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_laa: { + laa: { rate: ratesList.rate_laa || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LAA") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_lab: { + lab: { rate: ratesList.rate_lab || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LAB") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_lad: { + lad: { rate: ratesList.rate_lad || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LAD") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_lae: { + lae: { rate: ratesList.rate_lae || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LAE") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_laf: { + laf: { rate: ratesList.rate_laf || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LAF") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_lag: { + lag: { rate: ratesList.rate_lag || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LAG") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_lam: { + lam: { rate: ratesList.rate_lam || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LAM") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_lar: { + lar: { rate: ratesList.rate_lar || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LAR") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_las: { + las: { rate: ratesList.rate_las || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LAS") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_lau: { + lau: { rate: ratesList.rate_lau || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LAU") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - rate_atp: { + atp: { rate: shoprates.rate_atp || 0, hours: jobLines.filter((item) => item.line_desc.includes("ATS Amount")) @@ -178,13 +178,13 @@ function CalculateRatesTotals(ratesList, shoprates) { .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0) : 0, }, - paint_mat: { + mapa: { rate: ratesList.rate_mapa || 0, hours: jobLines .filter((item) => item.mod_lbr_ty === "LAR") .reduce((acc, value) => acc + value.mod_lb_hrs * 10, 0), }, - shop_mat: { + mash: { rate: ratesList.rate_mash || 0, hours: jobLines .filter((item) => item.mod_lbr_ty !== "LAR") @@ -200,8 +200,8 @@ function CalculateRatesTotals(ratesList, shoprates) { .divide(10); subtotal = subtotal.add(ret[property].total); if ( - property !== "paint_mat" && - property !== "shop_mat" + property !== "mapa" && + property !== "mash" //&& property !== "rate_atp" ) rates_subtotal = rates_subtotal.add(ret[property].total); @@ -236,19 +236,19 @@ function CalculatePartsTotals(jobLines) { acc.parts.list[value.part_type].total ? { total: acc.parts.list[value.part_type].total.add( - Dinero({ amount: value.act_price * 100 }).multiply( - value.part_qty - ) + Dinero({ + amount: Math.round((value.act_price || 0) * 100), + }).multiply(value.part_qty || 1) ), } : { total: Dinero({ - amount: (value.act_price || 0) * 100, - }).multiply(value.part_qty), + amount: Math.round((value.act_price || 0) * 100), + }).multiply(value.part_qty || 1), }, }, subtotal: acc.parts.subtotal.add( - Dinero({ amount: value.act_price * 100 }).multiply( + Dinero({ amount: Math.round(value.act_price * 100) }).multiply( value.part_qty ) ), @@ -262,7 +262,7 @@ function CalculatePartsTotals(jobLines) { sublets: { ...acc.sublets, subtotal: acc.sublets.subtotal.add( - Dinero({ amount: value.act_price * 100 }) + Dinero({ amount: Math.round(value.act_price * 100) }) ), //TODO Add Adjustments in }, diff --git a/client/src/components/jobs-close-allocation-button/jobs-close-allocation-button.component.jsx b/client/src/components/jobs-close-allocation-button/jobs-close-allocation-button.component.jsx index 30f606b5a..a0d48dfef 100644 --- a/client/src/components/jobs-close-allocation-button/jobs-close-allocation-button.component.jsx +++ b/client/src/components/jobs-close-allocation-button/jobs-close-allocation-button.component.jsx @@ -1,7 +1,7 @@ import { PlusCircleFilled, CloseCircleFilled } from "@ant-design/icons"; import { Button, InputNumber, Select } from "antd"; import Dinero from "dinero.js"; -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; @@ -14,6 +14,7 @@ const mapStateToProps = createStructuredSelector({ const { Option } = Select; export function JobsCloseLabmatAllocationButton({ + remainingAmount, allocationKey, allocation, setAllocations, @@ -27,20 +28,19 @@ export function JobsCloseLabmatAllocationButton({ const existingIndex = allocation.allocations.findIndex( (e) => e.center === state.center ); - console.log("handleAllocate -> existingIndex", existingIndex); const newAllocations = allocation.allocations.slice(0); if (existingIndex > -1) { newAllocations[existingIndex] = { center: state.center, amount: newAllocations[existingIndex].amount.add( - Dinero({ amount: state.amount * 100 }) + Dinero({ amount: (state.amount || 0) * 100 }) ), }; } else { newAllocations.push({ center: state.center, - amount: Dinero({ amount: state.amount * 100 }), + amount: Dinero({ amount: (state.amount || 0) * 100 }), }); } @@ -56,7 +56,11 @@ export function JobsCloseLabmatAllocationButton({ setState({ center: "", amount: 0 }); }; + const showAllocation = allocation.total.getAmount() > 0; + useEffect(() => { + if (remainingAmount === 0) setVisible(false); + }, [remainingAmount, setVisible]); if (!showAllocation) return null; return ( @@ -78,11 +82,13 @@ export function JobsCloseLabmatAllocationButton({ min={0} value={state.amount} onChange={(val) => setState({ ...state, amount: val })} - max={allocation.total.getAmount() / 100} + max={remainingAmount / 100} /> diff --git a/client/src/components/jobs-close-allocation-tags/jobs-close-allocation-tags.component.jsx b/client/src/components/jobs-close-allocation-tags/jobs-close-allocation-tags.component.jsx index c7de11be9..2c2091f44 100644 --- a/client/src/components/jobs-close-allocation-tags/jobs-close-allocation-tags.component.jsx +++ b/client/src/components/jobs-close-allocation-tags/jobs-close-allocation-tags.component.jsx @@ -11,6 +11,7 @@ export default function JobsCloseLabMatAllocationTags({ { setAllocations((state) => { return { diff --git a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx new file mode 100644 index 000000000..1392a6a96 --- /dev/null +++ b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx @@ -0,0 +1,67 @@ +import React from "react"; +import { Button } from "antd"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { useTranslation } from "react-i18next"; +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); + +export function JobsCloseAutoAllocate({ + bodyshop, + labmatAllocations, + setLabmatAllocations, + partsAllocations, + setPartsAllocations, +}) { + const { t } = useTranslation(); + const handleAllocate = () => { + const { defaults } = bodyshop.md_responsibility_centers; + + Object.keys(labmatAllocations).forEach((i) => { + const defaultProfitCenter = defaults.profits[i.toUpperCase()]; + + if (!!defaultProfitCenter && labmatAllocations[i].total.getAmount() > 0) { + setLabmatAllocations((st) => { + return { + ...st, + [i]: { + ...labmatAllocations[i], + allocations: [ + { + center: defaultProfitCenter, + amount: labmatAllocations[i].total, + }, + ], + }, + }; + }); + } + }); + + Object.keys(partsAllocations).forEach((i) => { + const defaultProfitCenter = defaults.profits[i.toUpperCase()]; + + if (!!defaultProfitCenter && partsAllocations[i].total.getAmount() > 0) { + setPartsAllocations((st) => { + return { + ...st, + [i]: { + ...partsAllocations[i], + allocations: [ + { + center: defaultProfitCenter, + amount: partsAllocations[i].total, + }, + ], + }, + }; + }); + } + }); + }; + + return ; +} +export default connect(mapStateToProps, null)(JobsCloseAutoAllocate); diff --git a/client/src/components/jobs-close-labmat-allocation/jobs-close-labmat-allocation.component.jsx b/client/src/components/jobs-close-labmat-allocation/jobs-close-labmat-allocation.component.jsx index d325fe7aa..0b7be1c01 100644 --- a/client/src/components/jobs-close-labmat-allocation/jobs-close-labmat-allocation.component.jsx +++ b/client/src/components/jobs-close-labmat-allocation/jobs-close-labmat-allocation.component.jsx @@ -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 (
@@ -53,6 +50,18 @@ export default function JobCloseLabMatAllocation({ + + - -
{ + return acc + val.amount.getAmount(); + }, + 0 + ), + }) + ) + .getAmount()} allocation={labmatAllocations[alloc]} setAllocations={setLabmatAllocations} /> @@ -71,9 +80,9 @@ export default function JobCloseLabMatAllocation({
{labmatAllocations.subtotal.toFormat()} {labMatTotalAllocation.toFormat()}
diff --git a/client/src/components/jobs-close-parts-allocation/jobs-close-parts-allocation.component.jsx b/client/src/components/jobs-close-parts-allocation/jobs-close-parts-allocation.component.jsx index 13a040fcb..bbe4fad4e 100644 --- a/client/src/components/jobs-close-parts-allocation/jobs-close-parts-allocation.component.jsx +++ b/client/src/components/jobs-close-parts-allocation/jobs-close-parts-allocation.component.jsx @@ -28,7 +28,7 @@ export default function JobsClosePartsAllocation({ {Object.keys(partsAllocations).map((alloc, idx) => { return ( - {t(`jobs.fields.${alloc}`)} + {t(`jobs.fields.${alloc.toLowerCase()}`)} {partsAllocations[alloc].total && partsAllocations[alloc].total.toFormat()} @@ -50,6 +50,18 @@ export default function JobsClosePartsAllocation({ { + return acc + val.amount.getAmount(); + }, + 0 + ), + }) + ) + .getAmount()} allocation={partsAllocations[alloc]} setAllocations={setPartsAllocations} /> @@ -74,9 +86,9 @@ export default function JobsClosePartsAllocation({ }, 0), }).toFormat()} + + {partsAllocatedTotal.toFormat()} - - diff --git a/client/src/components/jobs-close-totals/jobs-close-totals.component.jsx b/client/src/components/jobs-close-totals/jobs-close-totals.component.jsx index eb778c8c9..0c7f05f02 100644 --- a/client/src/components/jobs-close-totals/jobs-close-totals.component.jsx +++ b/client/src/components/jobs-close-totals/jobs-close-totals.component.jsx @@ -50,6 +50,13 @@ export default function JobsCloseTotals({ /> i.name) || []), + ] || [] + ); + + const [profitOptions, setProfitOptions] = useState( + [ ...(form .getFieldValue(["md_responsibility_centers", "profits"]) .map((i) => i.name) || []), @@ -25,10 +30,12 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { ); const handleBlur = () => { - setOptions([ + setCostOptions([ ...(form .getFieldValue(["md_responsibility_centers", "costs"]) .map((i) => i.name) || []), + ]); + setProfitOptions([ ...(form .getFieldValue(["md_responsibility_centers", "profits"]) .map((i) => i.name) || []), @@ -57,7 +64,8 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { required: true, message: t("general.validation.required"), }, - ]}> + ]} + > + ]} + > + ]} + > @@ -132,7 +143,8 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { required: true, message: t("general.validation.required"), }, - ]}> + ]} + > + ]} + > + ]} + > @@ -188,8 +203,9 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { }}
-
+
+ Costs + name={["md_responsibility_centers", "defaults", "costs", "ATP"]} + > @@ -213,10 +232,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "LAB"]}> + name={["md_responsibility_centers", "defaults", "costs", "LAB"]} + > @@ -228,10 +250,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "LAD"]}> + name={["md_responsibility_centers", "defaults", "costs", "LAD"]} + > @@ -243,10 +268,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "LAE"]}> + name={["md_responsibility_centers", "defaults", "costs", "LAE"]} + > @@ -258,10 +286,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "LAF"]}> + name={["md_responsibility_centers", "defaults", "costs", "LAF"]} + > @@ -273,10 +304,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "LAG"]}> + name={["md_responsibility_centers", "defaults", "costs", "LAG"]} + > @@ -288,10 +322,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "LAM"]}> + name={["md_responsibility_centers", "defaults", "costs", "LAM"]} + > @@ -303,10 +340,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "LAR"]}> + name={["md_responsibility_centers", "defaults", "costs", "LAR"]} + > @@ -318,10 +358,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "LAS"]}> + name={["md_responsibility_centers", "defaults", "costs", "LAS"]} + > @@ -333,10 +376,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "LAU"]}> + name={["md_responsibility_centers", "defaults", "costs", "LAU"]} + > @@ -348,10 +394,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "PAA"]}> + name={["md_responsibility_centers", "defaults", "costs", "PAA"]} + > @@ -363,10 +412,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "PAC"]}> + name={["md_responsibility_centers", "defaults", "costs", "PAC"]} + > @@ -378,10 +430,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "PAL"]}> + name={["md_responsibility_centers", "defaults", "costs", "PAL"]} + > @@ -393,10 +448,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "PAM"]}> + name={["md_responsibility_centers", "defaults", "costs", "PAM"]} + > @@ -408,10 +466,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "PAN"]}> + name={["md_responsibility_centers", "defaults", "costs", "PAN"]} + > @@ -423,10 +484,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "PAO"]}> + name={["md_responsibility_centers", "defaults", "costs", "PAO"]} + > @@ -438,10 +502,13 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "PAP"]}> + name={["md_responsibility_centers", "defaults", "costs", "PAP"]} + > @@ -453,10 +520,31 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "PAR"]}> + name={["md_responsibility_centers", "defaults", "costs", "PAR"]} + > + + + @@ -468,14 +556,598 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) { message: t("general.validation.required"), }, ]} - name={["md_responsibility_centers", "defaults", "TOW"]}> + name={["md_responsibility_centers", "defaults", "costs", "TOW"]} + > + + + + + + + + Profits + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + +
+
+ + + + + + + + + +
+
+ + + + + + + + + +
+
); diff --git a/client/src/pages/jobs-close/jobs-close.component.jsx b/client/src/pages/jobs-close/jobs-close.component.jsx index 47efb52cc..b72cf3c30 100644 --- a/client/src/pages/jobs-close/jobs-close.component.jsx +++ b/client/src/pages/jobs-close/jobs-close.component.jsx @@ -6,9 +6,9 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; import JobsClosePartsAllocation from "../../components/jobs-close-parts-allocation/jobs-close-parts-allocation.component"; import Dinero from "dinero.js"; import JobsCloseTotals from "../../components/jobs-close-totals/jobs-close-totals.component"; +import JobsCloseAutoAllocate from "../../components/jobs-close-auto-allocate/jobs-close-auto-allocate.component"; const mapStateToProps = createStructuredSelector({ - //currentUser: selectCurrentUser bodyshop: selectBodyshop, }); @@ -22,7 +22,6 @@ export function JobsCloseComponent({ job, bodyshop, jobTotals }) { return acc; }, {}) ); - console.log("JobsCloseComponent -> labmatAllocations", labmatAllocations); const [partsAllocations, setPartsAllocations] = useState({ ...Object.keys(jobTotals.parts.parts.list).reduce((acc, val) => { @@ -30,14 +29,12 @@ export function JobsCloseComponent({ job, bodyshop, jobTotals }) { return acc; }, {}), - sublet: { + pas: { ...jobTotals.parts.sublets, allocations: [], }, }); - console.log("JobsCloseComponent -> partsAllocations", partsAllocations); - const labmatAllocatedTotalsArray = Object.keys(labmatAllocations) .filter((i) => !i.includes("subtotal")) .map((i) => labmatAllocations[i].allocations) @@ -66,6 +63,12 @@ export function JobsCloseComponent({ job, bodyshop, jobTotals }) { labMatTotal={labmatAllocatedTotal} partsTotal={partsAllocatedTotal} /> +