Renamed ATP to ATS and updated totals calculation logic. Logic is still WIP
This commit is contained in:
@@ -22,7 +22,6 @@ export function JobCalculateTotals({ bodyshop, job }) {
|
||||
const newTotals = (
|
||||
await Axios.post("/job/totals", {
|
||||
job: job,
|
||||
shoprates: bodyshop.shoprates,
|
||||
})
|
||||
).data;
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@ const colSpan = {
|
||||
export function JobsTotalsTableComponent({ bodyshop, job }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
console.log("job", job);
|
||||
|
||||
if (!!!job.job_totals) {
|
||||
return (
|
||||
<Result
|
||||
@@ -168,15 +166,6 @@ export function JobsTotalsTableComponent({ bodyshop, job }) {
|
||||
job.job_totals.rates.la4.rate
|
||||
})`}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{t("jobs.fields.rate_atp")}</td>
|
||||
<td className="currency">
|
||||
{Dinero(job.job_totals.rates.atp.total).toFormat()}
|
||||
</td>
|
||||
<td>{`(${job.job_totals.rates.atp.hours.toFixed(2)} @ ${
|
||||
job.job_totals.rates.atp.rate
|
||||
})`}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{t("jobs.labels.rates_subtotal")}</td>
|
||||
|
||||
@@ -66,7 +66,6 @@ export function JobsAvailableContainer({
|
||||
...estData.data.available_jobs_by_pk.est_data,
|
||||
joblines: estData.data.available_jobs_by_pk.est_data.joblines.data,
|
||||
},
|
||||
shoprates: bodyshop.shoprates,
|
||||
})
|
||||
).data;
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@ export function JobsAvailableSupplementContainer({
|
||||
...estData.data.available_jobs_by_pk.est_data,
|
||||
joblines: estData.data.available_jobs_by_pk.est_data.joblines.data,
|
||||
},
|
||||
shoprates: bodyshop.shoprates,
|
||||
})
|
||||
).data;
|
||||
|
||||
|
||||
@@ -276,10 +276,6 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) {
|
||||
<Form.Item label={t("jobs.fields.rate_lag")} name="rate_lag">
|
||||
<InputNumber />
|
||||
</Form.Item>
|
||||
Note //TODO Remove ATP rate?
|
||||
<Form.Item label={t("jobs.fields.rate_atp")} name="rate_atp">
|
||||
<InputNumber />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("jobs.fields.rate_lau")} name="rate_lau">
|
||||
<InputNumber />
|
||||
</Form.Item>
|
||||
|
||||
@@ -92,9 +92,6 @@ export default function JobsDetailRates({ job, form }) {
|
||||
<Form.Item label={t("jobs.fields.rate_la4")} name="rate_la4">
|
||||
<CurrencyInput />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("jobs.fields.rate_atp")} name="rate_atp">
|
||||
<CurrencyInput />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("jobs.fields.rate_lau")} name="rate_lau">
|
||||
<CurrencyInput />
|
||||
</Form.Item>
|
||||
|
||||
@@ -40,8 +40,10 @@ export function JobsDetailTotals({
|
||||
}, [job.payments]);
|
||||
|
||||
const balance = useMemo(() => {
|
||||
return Dinero(job.job_totals.totals.total_repairs).subtract(total);
|
||||
}, [job.job_totals.totals.total_repairs, total]);
|
||||
if (job && job.job_totals && job.job_totals.totals.total_repairs)
|
||||
return Dinero(job.job_totals.totals.total_repairs).subtract(total);
|
||||
return Dinero({ amount: 0 }).subtract(total);
|
||||
}, [job, total]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -109,7 +111,7 @@ export function JobsDetailTotals({
|
||||
/>
|
||||
<Statistic
|
||||
title={t("payments.labels.balance")}
|
||||
valueStyle={{ color: balance.getAmount() > 0 ? "red" : "green" }}
|
||||
valueStyle={{ color: balance.getAmount() !== 0 ? "red" : "green" }}
|
||||
value={balance.toFormat()}
|
||||
/>
|
||||
</Space>
|
||||
|
||||
@@ -272,14 +272,14 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
|
||||
<SelectorDiv>
|
||||
Costs
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenters.atp")}
|
||||
label={t("bodyshop.fields.responsibilitycenters.ats")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "defaults", "costs", "ATP"]}
|
||||
name={["md_responsibility_centers", "defaults", "costs", "ATS"]}
|
||||
>
|
||||
<Select>
|
||||
{costOptions.map((item, idx) => (
|
||||
@@ -671,14 +671,14 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
|
||||
<SelectorDiv>
|
||||
Profits
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenters.atp")}
|
||||
label={t("bodyshop.fields.responsibilitycenters.ats")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "defaults", "profits", "ATP"]}
|
||||
name={["md_responsibility_centers", "defaults", "profits", "ATS"]}
|
||||
>
|
||||
<Select>
|
||||
{profitOptions.map((item, idx) => (
|
||||
|
||||
Reference in New Issue
Block a user