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) => (
|
||||
|
||||
@@ -148,7 +148,6 @@ export const QUERY_JOB_COSTING_DETAILS = gql`
|
||||
parts_tax_rates
|
||||
job_totals
|
||||
labor_rate_desc
|
||||
rate_atp
|
||||
rate_la1
|
||||
rate_la2
|
||||
rate_la3
|
||||
@@ -306,6 +305,7 @@ export const GET_JOB_BY_PK = gql`
|
||||
tax_tow_rt
|
||||
tax_str_rt
|
||||
tax_paint_mat_rt
|
||||
tax_shop_mat_rt
|
||||
tax_sub_rt
|
||||
tax_lbr_rt
|
||||
tax_levies_rt
|
||||
@@ -335,7 +335,6 @@ export const GET_JOB_BY_PK = gql`
|
||||
ownr_ph1
|
||||
}
|
||||
labor_rate_desc
|
||||
rate_atp
|
||||
rate_la1
|
||||
rate_la2
|
||||
rate_la3
|
||||
@@ -397,6 +396,7 @@ export const GET_JOB_BY_PK = gql`
|
||||
status
|
||||
notes
|
||||
location
|
||||
tax_part
|
||||
parts_order_lines {
|
||||
id
|
||||
parts_order {
|
||||
@@ -872,7 +872,6 @@ export const QUERY_ALL_JOB_FIELDS = gql`
|
||||
plate_st
|
||||
po_number
|
||||
policy_no
|
||||
rate_atp
|
||||
rate_la1
|
||||
rate_la2
|
||||
rate_la3
|
||||
@@ -1107,7 +1106,6 @@ export const QUERY_JOB_CLOSE_DETAILS = gql`
|
||||
ownr_zip
|
||||
ownr_ctry
|
||||
ownr_ph1
|
||||
rate_atp
|
||||
rate_la1
|
||||
rate_la2
|
||||
rate_la3
|
||||
|
||||
@@ -104,7 +104,6 @@ export function JobsDetailPage({
|
||||
const newTotals = (
|
||||
await Axios.post("/job/totals", {
|
||||
job: { ...job, ...values },
|
||||
shoprates: bodyshop.shoprates,
|
||||
})
|
||||
).data;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { GET_JOB_BY_PK, UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
import {
|
||||
addRecentItem,
|
||||
setBreadcrumbs,
|
||||
setSelectedHeader,
|
||||
} from "../../redux/application/application.actions";
|
||||
import { CreateRecentItem } from "../../utils/create-recent-item";
|
||||
import JobsDetailPage from "./jobs-detail.page.component";
|
||||
@@ -17,9 +18,15 @@ import JobsDetailPage from "./jobs-detail.page.component";
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
addRecentItem: (item) => dispatch(addRecentItem(item)),
|
||||
setSelectedHeader: (key) => dispatch(setSelectedHeader(key)),
|
||||
});
|
||||
|
||||
function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) {
|
||||
function JobsDetailPageContainer({
|
||||
match,
|
||||
setBreadcrumbs,
|
||||
addRecentItem,
|
||||
setSelectedHeader,
|
||||
}) {
|
||||
const { jobId } = match.params;
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -30,6 +37,7 @@ function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) {
|
||||
const [mutationUpdateJob] = useMutation(UPDATE_JOB);
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedHeader("activejobs");
|
||||
document.title = loading
|
||||
? t("titles.app")
|
||||
: error
|
||||
@@ -62,12 +70,25 @@ function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) {
|
||||
jobId,
|
||||
"job",
|
||||
`${data.jobs_by_pk.est_number || ""} | ${
|
||||
data.jobs_by_pk.ro_number || ""
|
||||
data.jobs_by_pk.ownr_fn || ""
|
||||
} ${data.jobs_by_pk.ownr_ln || ""} ${
|
||||
data.jobs_by_pk.ownr_co_nm || ""
|
||||
}${
|
||||
data.jobs_by_pk.ro_number ? ` | ${data.jobs_by_pk.ro_number}` : ""
|
||||
}`,
|
||||
`/manage/jobs/${jobId}`
|
||||
)
|
||||
);
|
||||
}, [loading, data, t, error, setBreadcrumbs, jobId, addRecentItem]);
|
||||
}, [
|
||||
loading,
|
||||
data,
|
||||
t,
|
||||
error,
|
||||
setBreadcrumbs,
|
||||
jobId,
|
||||
addRecentItem,
|
||||
setSelectedHeader,
|
||||
]);
|
||||
|
||||
if (loading) return <SpinComponent />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
@@ -886,7 +886,6 @@
|
||||
"phoneshort": "PH",
|
||||
"policy_no": "Policy #",
|
||||
"ponumber": "PO Number",
|
||||
"rate_atp": "ATP",
|
||||
"rate_la1": "LA1",
|
||||
"rate_la2": "LA2",
|
||||
"rate_la3": "LA3",
|
||||
|
||||
@@ -886,7 +886,6 @@
|
||||
"phoneshort": "PH",
|
||||
"policy_no": "Política #",
|
||||
"ponumber": "numero postal",
|
||||
"rate_atp": "ATP",
|
||||
"rate_la1": "Tarifa LA1",
|
||||
"rate_la2": "Tarifa LA2",
|
||||
"rate_la3": "Tarifa LA3",
|
||||
|
||||
@@ -886,7 +886,6 @@
|
||||
"phoneshort": "PH",
|
||||
"policy_no": "Politique #",
|
||||
"ponumber": "Numéro de bon de commande",
|
||||
"rate_atp": "ATP",
|
||||
"rate_la1": "Taux LA1",
|
||||
"rate_la2": "Taux LA2",
|
||||
"rate_la3": "Taux LA3",
|
||||
|
||||
@@ -25,7 +25,7 @@ export const MockBodyshop = {
|
||||
"Completed",
|
||||
"Delivered",
|
||||
"Invoiced",
|
||||
"Exported"
|
||||
"Exported",
|
||||
],
|
||||
open_statuses: [
|
||||
"Open",
|
||||
@@ -35,7 +35,7 @@ export const MockBodyshop = {
|
||||
"Parts",
|
||||
"Body",
|
||||
"Prep",
|
||||
"Paint"
|
||||
"Paint",
|
||||
],
|
||||
default_arrived: "Arrived",
|
||||
default_exported: "Exported",
|
||||
@@ -43,14 +43,14 @@ export const MockBodyshop = {
|
||||
default_invoiced: "Invoiced",
|
||||
default_completed: "Completed",
|
||||
default_delivered: "Delivered",
|
||||
default_scheduled: "Scheduled"
|
||||
default_scheduled: "Scheduled",
|
||||
},
|
||||
md_order_statuses: {
|
||||
statuses: ["Ordered", "Received", "Canceled", "Backordered"],
|
||||
default_bo: "Backordered",
|
||||
default_ordered: "Ordered",
|
||||
default_canceled: "Canceled",
|
||||
default_received: "Received"
|
||||
default_received: "Received",
|
||||
},
|
||||
shopname: "Testing Collision",
|
||||
state: "BC",
|
||||
@@ -61,7 +61,7 @@ export const MockBodyshop = {
|
||||
md_responsibility_centers: {
|
||||
costs: [
|
||||
"Aftermarket",
|
||||
"ATP",
|
||||
"ATS",
|
||||
"Body",
|
||||
"Detail",
|
||||
"Daignostic",
|
||||
@@ -80,11 +80,11 @@ export const MockBodyshop = {
|
||||
"Remanufactured",
|
||||
"Other",
|
||||
"Sublet",
|
||||
"Towing"
|
||||
"Towing",
|
||||
],
|
||||
profits: [
|
||||
"Aftermarket",
|
||||
"ATP",
|
||||
"ATS",
|
||||
"Body",
|
||||
"Detail",
|
||||
"Daignostic",
|
||||
@@ -103,10 +103,10 @@ export const MockBodyshop = {
|
||||
"Remanufactured",
|
||||
"Other",
|
||||
"Sublet",
|
||||
"Towing"
|
||||
"Towing",
|
||||
],
|
||||
defaults: {
|
||||
ATP: "ATP",
|
||||
ATS: "ATS",
|
||||
LAB: "Body",
|
||||
LAD: "Diagnostic",
|
||||
LAE: "Electrical",
|
||||
@@ -124,8 +124,8 @@ export const MockBodyshop = {
|
||||
PAO: "Other",
|
||||
PAP: "OEM Partial",
|
||||
PAR: "16",
|
||||
TOW: "Towing"
|
||||
}
|
||||
TOW: "Towing",
|
||||
},
|
||||
},
|
||||
employees: [
|
||||
{
|
||||
@@ -134,7 +134,7 @@ export const MockBodyshop = {
|
||||
last_name: "BODY123",
|
||||
employee_number: "101",
|
||||
cost_center: "Body",
|
||||
__typename: "employees"
|
||||
__typename: "employees",
|
||||
},
|
||||
{
|
||||
id: "8cc787d3-1cfe-49d3-8a15-8469cd5c2e41",
|
||||
@@ -142,7 +142,7 @@ export const MockBodyshop = {
|
||||
last_name: "Painter",
|
||||
employee_number: "10211",
|
||||
cost_center: "REFINISH",
|
||||
__typename: "employees"
|
||||
}
|
||||
]
|
||||
__typename: "employees",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user