@@ -1,6 +1,5 @@
|
|||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, Card, Form, Input, notification, Switch } from "antd";
|
import { Button, Card, Form, Input, notification, Switch } from "antd";
|
||||||
import dayjs from "../../../../utils/day";
|
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -14,6 +13,7 @@ import { UPDATE_OWNER } from "../../../../graphql/owners.queries";
|
|||||||
import { insertAuditTrail } from "../../../../redux/application/application.actions";
|
import { insertAuditTrail } from "../../../../redux/application/application.actions";
|
||||||
import { selectBodyshop, selectCurrentUser } from "../../../../redux/user/user.selectors";
|
import { selectBodyshop, selectCurrentUser } from "../../../../redux/user/user.selectors";
|
||||||
import AuditTrailMapping from "../../../../utils/AuditTrailMappings";
|
import AuditTrailMapping from "../../../../utils/AuditTrailMappings";
|
||||||
|
import dayjs from "../../../../utils/day";
|
||||||
import ConfigFormComponents from "../../../config-form-components/config-form-components.component";
|
import ConfigFormComponents from "../../../config-form-components/config-form-components.component";
|
||||||
import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component";
|
import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component";
|
||||||
|
|
||||||
@@ -275,7 +275,19 @@ export function JobChecklistForm({ insertAuditTrail, formItems, bodyshop, curren
|
|||||||
>
|
>
|
||||||
<DateTimePicker disabled={readOnly} />
|
<DateTimePicker disabled={readOnly} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item name="actual_delivery" label={t("jobs.fields.actual_delivery")} disabled={readOnly}>
|
<Form.Item
|
||||||
|
name="actual_delivery"
|
||||||
|
label={t("jobs.fields.actual_delivery")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: bodyshop.deliverchecklist.actual_delivery
|
||||||
|
? bodyshop.deliverchecklist.actual_delivery
|
||||||
|
: false
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
disabled={readOnly}
|
||||||
|
>
|
||||||
<DateTimePicker disabled={readOnly} />
|
<DateTimePicker disabled={readOnly} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { Button, Space, notification } from "antd";
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { DELETE_DELIVERY_CHECKLIST, DELETE_INTAKE_CHECKLIST } from "../../graphql/jobs.queries";
|
import { DELETE_DELIVERY_CHECKLIST, DELETE_INTAKE_CHECKLIST } from "../../graphql/jobs.queries";
|
||||||
|
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||||
|
|
||||||
export default function JobAdminDeleteIntake({ job }) {
|
export default function JobAdminDeleteIntake({ job }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -47,16 +48,22 @@ export default function JobAdminDeleteIntake({ job }) {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
const InstanceRender = InstanceRenderManager({
|
||||||
|
imex: true,
|
||||||
|
rome: "USE_IMEX",
|
||||||
|
promanager: false
|
||||||
|
});
|
||||||
|
|
||||||
|
return InstanceRender ? (
|
||||||
<>
|
<>
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<Button loading={loading} onClick={handleDelete} disabled={!job.intakechecklist}>
|
<Button loading={loading} onClick={handleDelete} disabled={!job.intakechecklist}>
|
||||||
{t("jobs.labels.deleteintake")}
|
{t("jobs.labels.deleteintake")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button loading={loading} onClick={handleDeleteDelivery} disabled={!job.deliverychecklist}>
|
<Button loading={loading} onClick={handleDeleteDelivery} disabled={!job.deliverchecklist}>
|
||||||
{t("jobs.labels.deletedelivery")}
|
{t("jobs.labels.deletedelivery")}
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
</>
|
</>
|
||||||
);
|
) : null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -319,6 +319,18 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
|
|||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
name={["deliverchecklist", "actual_delivery"]}
|
||||||
|
label={t("bodyshop.fields.deliver.require_actual_delivery_date")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Switch />
|
||||||
|
</Form.Item>
|
||||||
</SelectorDiv>
|
</SelectorDiv>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Button, Result, Space, Steps } from "antd";
|
|
||||||
import { PageHeader } from "@ant-design/pro-layout";
|
import { PageHeader } from "@ant-design/pro-layout";
|
||||||
|
import { Button, Result, Space, Steps } from "antd";
|
||||||
|
|
||||||
import React, { useContext, useState } from "react";
|
import React, { useContext, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -9,7 +9,6 @@ import JobsCreateJobsInfo from "../../components/jobs-create-jobs-info/jobs-crea
|
|||||||
import JobsCreateOwnerInfoContainer from "../../components/jobs-create-owner-info/jobs-create-owner-info.container";
|
import JobsCreateOwnerInfoContainer from "../../components/jobs-create-owner-info/jobs-create-owner-info.container";
|
||||||
import JobsCreateVehicleInfoContainer from "../../components/jobs-create-vehicle-info/jobs-create-vehicle-info.container";
|
import JobsCreateVehicleInfoContainer from "../../components/jobs-create-vehicle-info/jobs-create-vehicle-info.container";
|
||||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||||
import FormsFieldChanged from "../../components/form-fields-changed-alert/form-fields-changed-alert.component";
|
|
||||||
|
|
||||||
export default function JobsCreateComponent({ form }) {
|
export default function JobsCreateComponent({ form }) {
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
@@ -41,10 +40,11 @@ export default function JobsCreateComponent({ form }) {
|
|||||||
|
|
||||||
const next = () => {
|
const next = () => {
|
||||||
setPageIndex(pageIndex + 1);
|
setPageIndex(pageIndex + 1);
|
||||||
console.log("NExt");
|
console.log("Next");
|
||||||
};
|
};
|
||||||
const prev = () => {
|
const prev = () => {
|
||||||
setPageIndex(pageIndex - 1);
|
setPageIndex(pageIndex - 1);
|
||||||
|
console.log("Previous");
|
||||||
};
|
};
|
||||||
const { Step } = Steps;
|
const { Step } = Steps;
|
||||||
|
|
||||||
@@ -53,26 +53,26 @@ export default function JobsCreateComponent({ form }) {
|
|||||||
<PageHeader
|
<PageHeader
|
||||||
extra={
|
extra={
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
{pageIndex > 0 && <Button onClick={() => prev()}>Previous</Button>}
|
{pageIndex > 0 && <Button onClick={() => prev()}>{t("general.actions.previous")}</Button>}
|
||||||
{pageIndex < steps.length - 1 && (
|
{pageIndex < steps.length - 1 && (
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
next();
|
next();
|
||||||
// form
|
form
|
||||||
// .validateFields()
|
.validateFields()
|
||||||
// .then((r) => {
|
.then((r) => {
|
||||||
// if (steps[pageIndex].validation) {
|
if (steps[pageIndex].validation) {
|
||||||
// setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
// next();
|
next();
|
||||||
// } else {
|
} else {
|
||||||
// setErrorMessage(steps[pageIndex].error);
|
setErrorMessage(steps[pageIndex].error);
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// .catch((error) => console.log("error", error));
|
.catch((error) => console.log("error", error));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Next
|
{t("general.actions.next")}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{pageIndex === steps.length - 1 && (
|
{pageIndex === steps.length - 1 && (
|
||||||
@@ -104,17 +104,17 @@ export default function JobsCreateComponent({ form }) {
|
|||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setPageIndex(idx);
|
setPageIndex(idx);
|
||||||
// form
|
form
|
||||||
// .validateFields()
|
.validateFields()
|
||||||
// .then((r) => {
|
.then((r) => {
|
||||||
// if (steps[pageIndex].validation) {
|
if (steps[pageIndex].validation) {
|
||||||
// setErrorMessage(null);
|
setErrorMessage(null);
|
||||||
// setPageIndex(idx);
|
setPageIndex(idx);
|
||||||
// } else {
|
} else {
|
||||||
// setErrorMessage(steps[pageIndex].error);
|
setErrorMessage(steps[pageIndex].error);
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// .catch((error) => console.log("error", error));
|
.catch((error) => console.log("error", error));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@@ -144,7 +144,7 @@ export default function JobsCreateComponent({ form }) {
|
|||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
<ProgressButtons top />
|
<ProgressButtons top />
|
||||||
<FormsFieldChanged form={form} />
|
|
||||||
{errorMessage ? (
|
{errorMessage ? (
|
||||||
<div>
|
<div>
|
||||||
<AlertComponent message={errorMessage} type="error" />
|
<AlertComponent message={errorMessage} type="error" />
|
||||||
|
|||||||
@@ -295,7 +295,8 @@
|
|||||||
"dailypainttarget": "Scoreboard - Daily Paint Target",
|
"dailypainttarget": "Scoreboard - Daily Paint Target",
|
||||||
"default_adjustment_rate": "Default Labor Deduction Adjustment Rate",
|
"default_adjustment_rate": "Default Labor Deduction Adjustment Rate",
|
||||||
"deliver": {
|
"deliver": {
|
||||||
"templates": "Delivery Templates"
|
"templates": "Delivery Templates",
|
||||||
|
"require_actual_delivery_date": "Require Actual Delivery"
|
||||||
},
|
},
|
||||||
"dms": {
|
"dms": {
|
||||||
"apcontrol": "AP Control Number",
|
"apcontrol": "AP Control Number",
|
||||||
@@ -1139,6 +1140,8 @@
|
|||||||
"download": "Download",
|
"download": "Download",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"login": "Login",
|
"login": "Login",
|
||||||
|
"next": "Next",
|
||||||
|
"previous": "Previous",
|
||||||
"print": "Print",
|
"print": "Print",
|
||||||
"refresh": "Refresh",
|
"refresh": "Refresh",
|
||||||
"remove": "Remove",
|
"remove": "Remove",
|
||||||
|
|||||||
@@ -295,7 +295,8 @@
|
|||||||
"dailypainttarget": "",
|
"dailypainttarget": "",
|
||||||
"default_adjustment_rate": "",
|
"default_adjustment_rate": "",
|
||||||
"deliver": {
|
"deliver": {
|
||||||
"templates": ""
|
"templates": "",
|
||||||
|
"require_actual_delivery_date": ""
|
||||||
},
|
},
|
||||||
"dms": {
|
"dms": {
|
||||||
"apcontrol": "",
|
"apcontrol": "",
|
||||||
@@ -1139,6 +1140,8 @@
|
|||||||
"download": "",
|
"download": "",
|
||||||
"edit": "Editar",
|
"edit": "Editar",
|
||||||
"login": "",
|
"login": "",
|
||||||
|
"next": "",
|
||||||
|
"previous": "",
|
||||||
"print": "",
|
"print": "",
|
||||||
"refresh": "",
|
"refresh": "",
|
||||||
"remove": "",
|
"remove": "",
|
||||||
|
|||||||
@@ -295,7 +295,8 @@
|
|||||||
"dailypainttarget": "",
|
"dailypainttarget": "",
|
||||||
"default_adjustment_rate": "",
|
"default_adjustment_rate": "",
|
||||||
"deliver": {
|
"deliver": {
|
||||||
"templates": ""
|
"templates": "",
|
||||||
|
"require_actual_delivery_date": ""
|
||||||
},
|
},
|
||||||
"dms": {
|
"dms": {
|
||||||
"apcontrol": "",
|
"apcontrol": "",
|
||||||
@@ -1139,6 +1140,8 @@
|
|||||||
"download": "",
|
"download": "",
|
||||||
"edit": "modifier",
|
"edit": "modifier",
|
||||||
"login": "",
|
"login": "",
|
||||||
|
"next": "",
|
||||||
|
"previous": "",
|
||||||
"print": "",
|
"print": "",
|
||||||
"refresh": "",
|
"refresh": "",
|
||||||
"remove": "",
|
"remove": "",
|
||||||
|
|||||||
@@ -318,7 +318,9 @@ function GenerateCostingData(job) {
|
|||||||
if (!partsProfitCenter)
|
if (!partsProfitCenter)
|
||||||
console.log("Unknown cost/profit center mapping for parts.", val.line_desc, val.part_type);
|
console.log("Unknown cost/profit center mapping for parts.", val.line_desc, val.part_type);
|
||||||
const partsAmount = Dinero({
|
const partsAmount = Dinero({
|
||||||
amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
|
amount: val.act_price_before_ppc
|
||||||
|
? Math.round(val.act_price_before_ppc * 100)
|
||||||
|
: Math.round(val.act_price * 100)
|
||||||
})
|
})
|
||||||
.multiply(val.part_qty || 1)
|
.multiply(val.part_qty || 1)
|
||||||
.add(
|
.add(
|
||||||
@@ -327,7 +329,9 @@ function GenerateCostingData(job) {
|
|||||||
? val.prt_dsmk_m
|
? val.prt_dsmk_m
|
||||||
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
||||||
: Dinero({
|
: Dinero({
|
||||||
amount: val.act_price_before_ppc ? Math.round(val.act_price_before_ppc * 100) : Math.round(val.act_price * 100)
|
amount: val.act_price_before_ppc
|
||||||
|
? Math.round(val.act_price_before_ppc * 100)
|
||||||
|
: Math.round(val.act_price * 100)
|
||||||
})
|
})
|
||||||
.multiply(val.part_qty || 0)
|
.multiply(val.part_qty || 0)
|
||||||
.percentage(Math.abs(val.prt_dsmk_p || 0))
|
.percentage(Math.abs(val.prt_dsmk_p || 0))
|
||||||
@@ -368,7 +372,10 @@ function GenerateCostingData(job) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Additional Profit Center
|
//Additional Profit Center
|
||||||
if ((!val.part_type && !val.mod_lbr_ty) || (!val.part_type && val.mod_lbr_ty)) {
|
if (
|
||||||
|
(!val.part_type && !val.mod_lbr_ty) ||
|
||||||
|
(!val.part_type && val.mod_lbr_ty && val.act_price > 0 && val.lbr_op !== "OP14")
|
||||||
|
) {
|
||||||
//Does it already have a defined profit center?
|
//Does it already have a defined profit center?
|
||||||
//If so, use it, otherwise try to use the same from the auto-allocate logic in IO app jobs-close-auto-allocate.
|
//If so, use it, otherwise try to use the same from the auto-allocate logic in IO app jobs-close-auto-allocate.
|
||||||
const partsProfitCenter = val.profitcenter_part || getAdditionalCostCenter(val, defaultProfits) || "Unknown";
|
const partsProfitCenter = val.profitcenter_part || getAdditionalCostCenter(val, defaultProfits) || "Unknown";
|
||||||
|
|||||||
@@ -909,6 +909,25 @@ function CalculateTaxesTotals(job, otherTotals) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (job.adjustment_bottom_line) {
|
||||||
|
const subtotal_before_adjustment = subtotal.add(Dinero({ amount: Math.round(job.adjustment_bottom_line * -100) }));
|
||||||
|
const percent_of_adjustment =
|
||||||
|
Math.round(
|
||||||
|
subtotal_before_adjustment.toUnit() /
|
||||||
|
(job.adjustment_bottom_line > 0 ? job.adjustment_bottom_line : job.adjustment_bottom_line * -1)
|
||||||
|
) / 100;
|
||||||
|
|
||||||
|
Object.keys(taxableAmountsByTier).forEach((taxTierKey) => {
|
||||||
|
taxable_adjustment = taxableAmountsByTier[taxTierKey].multiply(percent_of_adjustment);
|
||||||
|
console.log("🚀 ~ taxableAmountsByTier ~ taxable_adjustment:", taxable_adjustment)
|
||||||
|
if (job.adjustment_bottom_line > 0) {
|
||||||
|
taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].add(taxable_adjustment);
|
||||||
|
} else {
|
||||||
|
taxableAmountsByTier[taxTierKey] = taxableAmountsByTier[taxTierKey].subtract(taxable_adjustment);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const remainingTaxableAmounts = taxableAmountsByTier;
|
const remainingTaxableAmounts = taxableAmountsByTier;
|
||||||
console.log("*** Taxable Amounts by Tier***");
|
console.log("*** Taxable Amounts by Tier***");
|
||||||
console.table(JSON.parse(JSON.stringify(taxableAmountsByTier)));
|
console.table(JSON.parse(JSON.stringify(taxableAmountsByTier)));
|
||||||
|
|||||||
Reference in New Issue
Block a user