@@ -1,6 +1,5 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Card, Form, Input, notification, Switch } from "antd";
|
||||
import dayjs from "../../../../utils/day";
|
||||
import queryString from "query-string";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -14,6 +13,7 @@ import { UPDATE_OWNER } from "../../../../graphql/owners.queries";
|
||||
import { insertAuditTrail } from "../../../../redux/application/application.actions";
|
||||
import { selectBodyshop, selectCurrentUser } from "../../../../redux/user/user.selectors";
|
||||
import AuditTrailMapping from "../../../../utils/AuditTrailMappings";
|
||||
import dayjs from "../../../../utils/day";
|
||||
import ConfigFormComponents from "../../../config-form-components/config-form-components.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} />
|
||||
</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} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Button, Space, notification } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { DELETE_DELIVERY_CHECKLIST, DELETE_INTAKE_CHECKLIST } from "../../graphql/jobs.queries";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
|
||||
export default function JobAdminDeleteIntake({ job }) {
|
||||
const { t } = useTranslation();
|
||||
@@ -47,16 +48,22 @@ export default function JobAdminDeleteIntake({ job }) {
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return (
|
||||
const InstanceRender = InstanceRenderManager({
|
||||
imex: true,
|
||||
rome: "USE_IMEX",
|
||||
promanager: false
|
||||
});
|
||||
|
||||
return InstanceRender ? (
|
||||
<>
|
||||
<Space wrap>
|
||||
<Button loading={loading} onClick={handleDelete} disabled={!job.intakechecklist}>
|
||||
{t("jobs.labels.deleteintake")}
|
||||
</Button>
|
||||
<Button loading={loading} onClick={handleDeleteDelivery} disabled={!job.deliverychecklist}>
|
||||
<Button loading={loading} onClick={handleDeleteDelivery} disabled={!job.deliverchecklist}>
|
||||
{t("jobs.labels.deletedelivery")}
|
||||
</Button>
|
||||
</Space>
|
||||
</>
|
||||
);
|
||||
) : null;
|
||||
}
|
||||
|
||||
@@ -319,6 +319,18 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
|
||||
))}
|
||||
</Select>
|
||||
</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>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Button, Result, Space, Steps } from "antd";
|
||||
import { PageHeader } from "@ant-design/pro-layout";
|
||||
import { Button, Result, Space, Steps } from "antd";
|
||||
|
||||
import React, { useContext, useState } from "react";
|
||||
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 JobsCreateVehicleInfoContainer from "../../components/jobs-create-vehicle-info/jobs-create-vehicle-info.container";
|
||||
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 }) {
|
||||
const [pageIndex, setPageIndex] = useState(0);
|
||||
@@ -41,10 +40,11 @@ export default function JobsCreateComponent({ form }) {
|
||||
|
||||
const next = () => {
|
||||
setPageIndex(pageIndex + 1);
|
||||
console.log("NExt");
|
||||
console.log("Next");
|
||||
};
|
||||
const prev = () => {
|
||||
setPageIndex(pageIndex - 1);
|
||||
console.log("Previous");
|
||||
};
|
||||
const { Step } = Steps;
|
||||
|
||||
@@ -53,26 +53,26 @@ export default function JobsCreateComponent({ form }) {
|
||||
<PageHeader
|
||||
extra={
|
||||
<Space wrap>
|
||||
{pageIndex > 0 && <Button onClick={() => prev()}>Previous</Button>}
|
||||
{pageIndex > 0 && <Button onClick={() => prev()}>{t("general.actions.previous")}</Button>}
|
||||
{pageIndex < steps.length - 1 && (
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
next();
|
||||
// form
|
||||
// .validateFields()
|
||||
// .then((r) => {
|
||||
// if (steps[pageIndex].validation) {
|
||||
// setErrorMessage(null);
|
||||
// next();
|
||||
// } else {
|
||||
// setErrorMessage(steps[pageIndex].error);
|
||||
// }
|
||||
// })
|
||||
// .catch((error) => console.log("error", error));
|
||||
form
|
||||
.validateFields()
|
||||
.then((r) => {
|
||||
if (steps[pageIndex].validation) {
|
||||
setErrorMessage(null);
|
||||
next();
|
||||
} else {
|
||||
setErrorMessage(steps[pageIndex].error);
|
||||
}
|
||||
})
|
||||
.catch((error) => console.log("error", error));
|
||||
}}
|
||||
>
|
||||
Next
|
||||
{t("general.actions.next")}
|
||||
</Button>
|
||||
)}
|
||||
{pageIndex === steps.length - 1 && (
|
||||
@@ -104,17 +104,17 @@ export default function JobsCreateComponent({ form }) {
|
||||
}}
|
||||
onClick={() => {
|
||||
setPageIndex(idx);
|
||||
// form
|
||||
// .validateFields()
|
||||
// .then((r) => {
|
||||
// if (steps[pageIndex].validation) {
|
||||
// setErrorMessage(null);
|
||||
// setPageIndex(idx);
|
||||
// } else {
|
||||
// setErrorMessage(steps[pageIndex].error);
|
||||
// }
|
||||
// })
|
||||
// .catch((error) => console.log("error", error));
|
||||
form
|
||||
.validateFields()
|
||||
.then((r) => {
|
||||
if (steps[pageIndex].validation) {
|
||||
setErrorMessage(null);
|
||||
setPageIndex(idx);
|
||||
} else {
|
||||
setErrorMessage(steps[pageIndex].error);
|
||||
}
|
||||
})
|
||||
.catch((error) => console.log("error", error));
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
@@ -144,7 +144,7 @@ export default function JobsCreateComponent({ form }) {
|
||||
) : (
|
||||
<div>
|
||||
<ProgressButtons top />
|
||||
<FormsFieldChanged form={form} />
|
||||
|
||||
{errorMessage ? (
|
||||
<div>
|
||||
<AlertComponent message={errorMessage} type="error" />
|
||||
|
||||
@@ -295,7 +295,8 @@
|
||||
"dailypainttarget": "Scoreboard - Daily Paint Target",
|
||||
"default_adjustment_rate": "Default Labor Deduction Adjustment Rate",
|
||||
"deliver": {
|
||||
"templates": "Delivery Templates"
|
||||
"templates": "Delivery Templates",
|
||||
"require_actual_delivery_date": "Require Actual Delivery"
|
||||
},
|
||||
"dms": {
|
||||
"apcontrol": "AP Control Number",
|
||||
@@ -1139,6 +1140,8 @@
|
||||
"download": "Download",
|
||||
"edit": "Edit",
|
||||
"login": "Login",
|
||||
"next": "Next",
|
||||
"previous": "Previous",
|
||||
"print": "Print",
|
||||
"refresh": "Refresh",
|
||||
"remove": "Remove",
|
||||
|
||||
@@ -295,7 +295,8 @@
|
||||
"dailypainttarget": "",
|
||||
"default_adjustment_rate": "",
|
||||
"deliver": {
|
||||
"templates": ""
|
||||
"templates": "",
|
||||
"require_actual_delivery_date": ""
|
||||
},
|
||||
"dms": {
|
||||
"apcontrol": "",
|
||||
@@ -1139,6 +1140,8 @@
|
||||
"download": "",
|
||||
"edit": "Editar",
|
||||
"login": "",
|
||||
"next": "",
|
||||
"previous": "",
|
||||
"print": "",
|
||||
"refresh": "",
|
||||
"remove": "",
|
||||
|
||||
@@ -295,7 +295,8 @@
|
||||
"dailypainttarget": "",
|
||||
"default_adjustment_rate": "",
|
||||
"deliver": {
|
||||
"templates": ""
|
||||
"templates": "",
|
||||
"require_actual_delivery_date": ""
|
||||
},
|
||||
"dms": {
|
||||
"apcontrol": "",
|
||||
@@ -1139,6 +1140,8 @@
|
||||
"download": "",
|
||||
"edit": "modifier",
|
||||
"login": "",
|
||||
"next": "",
|
||||
"previous": "",
|
||||
"print": "",
|
||||
"refresh": "",
|
||||
"remove": "",
|
||||
|
||||
@@ -318,7 +318,9 @@ function GenerateCostingData(job) {
|
||||
if (!partsProfitCenter)
|
||||
console.log("Unknown cost/profit center mapping for parts.", val.line_desc, val.part_type);
|
||||
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)
|
||||
.add(
|
||||
@@ -327,7 +329,9 @@ function GenerateCostingData(job) {
|
||||
? val.prt_dsmk_m
|
||||
? Dinero({ amount: Math.round(val.prt_dsmk_m * 100) })
|
||||
: 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)
|
||||
.percentage(Math.abs(val.prt_dsmk_p || 0))
|
||||
@@ -368,7 +372,10 @@ function GenerateCostingData(job) {
|
||||
}
|
||||
|
||||
//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?
|
||||
//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";
|
||||
|
||||
@@ -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;
|
||||
console.log("*** Taxable Amounts by Tier***");
|
||||
console.table(JSON.parse(JSON.stringify(taxableAmountsByTier)));
|
||||
|
||||
Reference in New Issue
Block a user