Further merge resolutions of RO into IO.
This commit is contained in:
@@ -1,11 +1,22 @@
|
|||||||
import {DeleteFilled, DollarCircleFilled} from "@ant-design/icons";
|
import { DeleteFilled, DollarCircleFilled } from "@ant-design/icons";
|
||||||
import {useSplitTreatments} from "@splitsoftware/splitio-react";
|
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||||
import {Button, Checkbox, Form, Input, InputNumber, Select, Space, Switch, Table, Tooltip,} from "antd";
|
import {
|
||||||
|
Button,
|
||||||
|
Checkbox,
|
||||||
|
Form,
|
||||||
|
Input,
|
||||||
|
InputNumber,
|
||||||
|
Select,
|
||||||
|
Space,
|
||||||
|
Switch,
|
||||||
|
Table,
|
||||||
|
Tooltip,
|
||||||
|
} from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {connect} from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import {createStructuredSelector} from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CiecaSelect from "../../utils/Ciecaselect";
|
import CiecaSelect from "../../utils/Ciecaselect";
|
||||||
import BillLineSearchSelect from "../bill-line-search-select/bill-line-search-select.component";
|
import BillLineSearchSelect from "../bill-line-search-select/bill-line-search-select.component";
|
||||||
import BilllineAddInventory from "../billline-add-inventory/billline-add-inventory.component";
|
import BilllineAddInventory from "../billline-add-inventory/billline-add-inventory.component";
|
||||||
@@ -21,25 +32,26 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export function BillEnterModalLinesComponent({
|
export function BillEnterModalLinesComponent({
|
||||||
bodyshop,
|
bodyshop,
|
||||||
disabled,
|
disabled,
|
||||||
lineData,
|
lineData,
|
||||||
discount,
|
discount,
|
||||||
form,
|
form,
|
||||||
responsibilityCenters,
|
responsibilityCenters,
|
||||||
billEdit,
|
billEdit,
|
||||||
billid,
|
billid,
|
||||||
}) {
|
}) {
|
||||||
const {t} = useTranslation();
|
const { t } = useTranslation();
|
||||||
const {setFieldsValue, getFieldsValue, getFieldValue} = form;
|
const { setFieldsValue, getFieldsValue, getFieldValue } = form;
|
||||||
|
|
||||||
const {treatments: {Simple_Inventory, Enhanced_Payroll}} = useSplitTreatments({
|
const {
|
||||||
|
treatments: { Simple_Inventory, Enhanced_Payroll },
|
||||||
|
} = useSplitTreatments({
|
||||||
attributes: {},
|
attributes: {},
|
||||||
names: ["Simple_Inventory", "Enhanced_Payroll"],
|
names: ["Simple_Inventory", "Enhanced_Payroll"],
|
||||||
splitKey: bodyshop && bodyshop.imexshopid,
|
splitKey: bodyshop && bodyshop.imexshopid,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const columns = (remove) => {
|
const columns = (remove) => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@@ -76,35 +88,39 @@ export function BillEnterModalLinesComponent({
|
|||||||
<BillLineSearchSelect
|
<BillLineSearchSelect
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
options={lineData}
|
options={lineData}
|
||||||
style={{width: "100%", minWidth: "10rem"}}
|
style={{ width: "100%", minWidth: "10rem" }}
|
||||||
allowRemoved={form.getFieldValue("is_credit_memo") || false}
|
allowRemoved={
|
||||||
|
form.getFieldValue("is_credit_memo") || false
|
||||||
|
}
|
||||||
onSelect={(value, opt) => {
|
onSelect={(value, opt) => {
|
||||||
setFieldsValue({
|
setFieldsValue({
|
||||||
billlines: getFieldsValue(["billlines"]).billlines.map(
|
billlines: getFieldsValue([
|
||||||
(item, idx) => {
|
"billlines",
|
||||||
if (idx === index) {
|
]).billlines.map((item, idx) => {
|
||||||
return {
|
if (idx === index) {
|
||||||
...item,
|
return {
|
||||||
line_desc: opt.line_desc,
|
...item,
|
||||||
quantity: opt.part_qty || 1,
|
line_desc: opt.line_desc,
|
||||||
actual_price: opt.cost,
|
quantity: opt.part_qty || 1,
|
||||||
original_actual_price: opt.cost,
|
actual_price: opt.cost,
|
||||||
cost_center: opt.part_type
|
original_actual_price: opt.cost,
|
||||||
? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid
|
cost_center: opt.part_type
|
||||||
? opt.part_type !== "PAE"
|
? bodyshop.pbs_serialnumber ||
|
||||||
? opt.part_type
|
bodyshop.cdk_dealerid
|
||||||
: null
|
? opt.part_type !== "PAE"
|
||||||
: responsibilityCenters.defaults &&
|
? opt.part_type
|
||||||
(responsibilityCenters.defaults.costs[
|
: null
|
||||||
opt.part_type
|
: responsibilityCenters.defaults &&
|
||||||
] ||
|
(responsibilityCenters
|
||||||
null)
|
.defaults.costs[
|
||||||
: null,
|
opt.part_type
|
||||||
};
|
] ||
|
||||||
}
|
null)
|
||||||
return item;
|
: null,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
),
|
return item;
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -128,7 +144,7 @@ export function BillEnterModalLinesComponent({
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
formInput: (record, index) => <Input disabled={disabled}/>,
|
formInput: (record, index) => <Input disabled={disabled} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("billlines.fields.quantity"),
|
title: t("billlines.fields.quantity"),
|
||||||
@@ -145,19 +161,24 @@ export function BillEnterModalLinesComponent({
|
|||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
({getFieldValue}) => ({
|
({ getFieldValue }) => ({
|
||||||
validator(rule, value) {
|
validator(rule, value) {
|
||||||
if (
|
if (
|
||||||
value &&
|
value &&
|
||||||
getFieldValue("billlines")[field.fieldKey]?.inventories
|
getFieldValue("billlines")[
|
||||||
?.length > value
|
field.fieldKey
|
||||||
|
]?.inventories?.length > value
|
||||||
) {
|
) {
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
t("bills.validation.inventoryquantity", {
|
t(
|
||||||
number:
|
"bills.validation.inventoryquantity",
|
||||||
getFieldValue("billlines")[field.fieldKey]
|
{
|
||||||
?.inventories?.length,
|
number: getFieldValue(
|
||||||
})
|
"billlines"
|
||||||
|
)[field.fieldKey]
|
||||||
|
?.inventories?.length,
|
||||||
|
}
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
@@ -167,7 +188,7 @@ export function BillEnterModalLinesComponent({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
formInput: (record, index) => (
|
formInput: (record, index) => (
|
||||||
<InputNumber precision={0} min={1} disabled={disabled}/>
|
<InputNumber precision={0} min={1} disabled={disabled} />
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -194,67 +215,87 @@ export function BillEnterModalLinesComponent({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onBlur={(e) => {
|
onBlur={(e) => {
|
||||||
setFieldsValue({
|
setFieldsValue({
|
||||||
billlines: getFieldsValue("billlines").billlines.map(
|
billlines: getFieldsValue(
|
||||||
(item, idx) => {
|
"billlines"
|
||||||
if (idx === index) {
|
).billlines.map((item, idx) => {
|
||||||
return {
|
if (idx === index) {
|
||||||
...item,
|
return {
|
||||||
actual_cost: !!item.actual_cost
|
...item,
|
||||||
? item.actual_cost
|
actual_cost: !!item.actual_cost
|
||||||
: Math.round(
|
? item.actual_cost
|
||||||
(parseFloat(e.target.value) * (1 - discount) +
|
: Math.round(
|
||||||
Number.EPSILON) *
|
(parseFloat(
|
||||||
100
|
e.target.value
|
||||||
) / 100,
|
) *
|
||||||
};
|
(1 - discount) +
|
||||||
}
|
Number.EPSILON) *
|
||||||
return item;
|
100
|
||||||
|
) / 100,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
),
|
return item;
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
additional: (record, index) => (
|
additional: (record, index) =>
|
||||||
InstanceRenderManager({rome: <Form.Item
|
InstanceRenderManager({
|
||||||
dependencies={["billlines", record.name, "actual_price"]}
|
rome: (
|
||||||
noStyle
|
<Form.Item
|
||||||
>
|
dependencies={[
|
||||||
{() => {
|
"billlines",
|
||||||
const billLine = getFieldValue(["billlines", record.name]);
|
record.name,
|
||||||
const jobLine = lineData.find(
|
"actual_price",
|
||||||
(line) => line.id === billLine?.joblineid
|
]}
|
||||||
);
|
noStyle
|
||||||
|
>
|
||||||
|
{() => {
|
||||||
|
const billLine = getFieldValue([
|
||||||
|
"billlines",
|
||||||
|
record.name,
|
||||||
|
]);
|
||||||
|
const jobLine = lineData.find(
|
||||||
|
(line) =>
|
||||||
|
line.id === billLine?.joblineid
|
||||||
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!billEdit &&
|
!billEdit &&
|
||||||
billLine &&
|
billLine &&
|
||||||
jobLine &&
|
jobLine &&
|
||||||
billLine?.actual_price !== jobLine?.act_price
|
billLine?.actual_price !==
|
||||||
) {
|
jobLine?.act_price
|
||||||
return (
|
) {
|
||||||
<Space size="small">
|
return (
|
||||||
<Form.Item
|
<Space size="small">
|
||||||
noStyle
|
<Form.Item
|
||||||
label={t("joblines.fields.create_ppc")}
|
noStyle
|
||||||
key={`${index}ppc`}
|
label={t(
|
||||||
valuePropName="checked"
|
"joblines.fields.create_ppc"
|
||||||
name={[record.name, "create_ppc"]}
|
)}
|
||||||
>
|
key={`${index}ppc`}
|
||||||
<Checkbox/>
|
valuePropName="checked"
|
||||||
</Form.Item>
|
name={[
|
||||||
{t("joblines.fields.create_ppc")}
|
record.name,
|
||||||
</Space>
|
"create_ppc",
|
||||||
);
|
]}
|
||||||
} else {
|
>
|
||||||
return null;
|
<Checkbox />
|
||||||
}
|
</Form.Item>
|
||||||
}}
|
{t(
|
||||||
</Form.Item>
|
"joblines.fields.create_ppc"
|
||||||
//Do not need to set for promanager as it will default to Rome.
|
)}
|
||||||
})
|
</Space>
|
||||||
|
);
|
||||||
),
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
</Form.Item>
|
||||||
|
),
|
||||||
|
//Do not need to set for promanager as it will default to Rome.
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("billlines.fields.actual_cost"),
|
title: t("billlines.fields.actual_cost"),
|
||||||
@@ -283,17 +324,30 @@ export function BillEnterModalLinesComponent({
|
|||||||
addonAfter={
|
addonAfter={
|
||||||
<Form.Item shouldUpdate noStyle>
|
<Form.Item shouldUpdate noStyle>
|
||||||
{() => {
|
{() => {
|
||||||
const line = getFieldsValue(["billlines"]).billlines[index];
|
const line = getFieldsValue(["billlines"])
|
||||||
|
.billlines[index];
|
||||||
if (!!!line) return null;
|
if (!!!line) return null;
|
||||||
let lineDiscount = 1 - line.actual_cost / line.actual_price;
|
let lineDiscount =
|
||||||
|
1 -
|
||||||
|
line.actual_cost / line.actual_price;
|
||||||
if (isNaN(lineDiscount)) lineDiscount = 0;
|
if (isNaN(lineDiscount)) lineDiscount = 0;
|
||||||
return (
|
return (
|
||||||
<Tooltip title={`${(lineDiscount * 100).toFixed(2) || 0}%`}>
|
<Tooltip
|
||||||
|
title={`${
|
||||||
|
(lineDiscount * 100).toFixed(
|
||||||
|
2
|
||||||
|
) || 0
|
||||||
|
}%`}
|
||||||
|
>
|
||||||
<DollarCircleFilled
|
<DollarCircleFilled
|
||||||
style={{
|
style={{
|
||||||
color:
|
color:
|
||||||
Math.abs(lineDiscount - discount) > 0.005
|
Math.abs(
|
||||||
? lineDiscount > discount
|
lineDiscount -
|
||||||
|
discount
|
||||||
|
) > 0.005
|
||||||
|
? lineDiscount >
|
||||||
|
discount
|
||||||
? "orange"
|
? "orange"
|
||||||
: "red"
|
: "red"
|
||||||
: "green",
|
: "green",
|
||||||
@@ -349,40 +403,48 @@ export function BillEnterModalLinesComponent({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
formInput: (record, index) => (
|
formInput: (record, index) => (
|
||||||
<Select showSearch style={{minWidth: "3rem"}} disabled={disabled}>
|
<Select
|
||||||
|
showSearch
|
||||||
|
style={{ minWidth: "3rem" }}
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
{bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
{bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||||
? CiecaSelect(true, false)
|
? CiecaSelect(true, false)
|
||||||
: responsibilityCenters.costs.map((item) => (
|
: responsibilityCenters.costs.map((item) => (
|
||||||
<Select.Option key={item.name}>{item.name}</Select.Option>
|
<Select.Option key={item.name}>
|
||||||
))}
|
{item.name}
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
...(billEdit
|
...(billEdit
|
||||||
? []
|
? []
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
title: t("billlines.fields.location"),
|
title: t("billlines.fields.location"),
|
||||||
dataIndex: "location",
|
dataIndex: "location",
|
||||||
editable: true,
|
editable: true,
|
||||||
label: t("billlines.fields.location"),
|
label: t("billlines.fields.location"),
|
||||||
formItemProps: (field) => {
|
formItemProps: (field) => {
|
||||||
return {
|
return {
|
||||||
key: `${field.index}location`,
|
key: `${field.index}location`,
|
||||||
name: [field.name, "location"],
|
name: [field.name, "location"],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
formInput: (record, index) => (
|
formInput: (record, index) => (
|
||||||
<Select disabled={disabled}>
|
<Select disabled={disabled}>
|
||||||
{bodyshop.md_parts_locations.map((loc, idx) => (
|
{bodyshop.md_parts_locations.map(
|
||||||
<Select.Option key={idx} value={loc}>
|
(loc, idx) => (
|
||||||
{loc}
|
<Select.Option key={idx} value={loc}>
|
||||||
</Select.Option>
|
{loc}
|
||||||
))}
|
</Select.Option>
|
||||||
</Select>
|
)
|
||||||
),
|
)}
|
||||||
},
|
</Select>
|
||||||
]),
|
),
|
||||||
|
},
|
||||||
|
]),
|
||||||
{
|
{
|
||||||
title: t("billlines.labels.deductedfromlbr"),
|
title: t("billlines.labels.deductedfromlbr"),
|
||||||
dataIndex: "deductedfromlbr",
|
dataIndex: "deductedfromlbr",
|
||||||
@@ -394,9 +456,13 @@ export function BillEnterModalLinesComponent({
|
|||||||
name: [field.name, "deductedfromlbr"],
|
name: [field.name, "deductedfromlbr"],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
formInput: (record, index) => <Switch disabled={disabled}/>,
|
formInput: (record, index) => <Switch disabled={disabled} />,
|
||||||
additional: (record, index) => (
|
additional: (record, index) => (
|
||||||
<Form.Item shouldUpdate noStyle style={{display: "inline-block"}}>
|
<Form.Item
|
||||||
|
shouldUpdate
|
||||||
|
noStyle
|
||||||
|
style={{ display: "inline-block" }}
|
||||||
|
>
|
||||||
{() => {
|
{() => {
|
||||||
const price = getFieldValue([
|
const price = getFieldValue([
|
||||||
"billlines",
|
"billlines",
|
||||||
@@ -411,91 +477,150 @@ export function BillEnterModalLinesComponent({
|
|||||||
"rate",
|
"rate",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const billline = getFieldValue(["billlines", record.name]);
|
const billline = getFieldValue([
|
||||||
|
"billlines",
|
||||||
|
record.name,
|
||||||
|
]);
|
||||||
|
|
||||||
const jobline = lineData.find(
|
const jobline = lineData.find(
|
||||||
(line) => line.id === billline?.joblineid
|
(line) => line.id === billline?.joblineid
|
||||||
);
|
);
|
||||||
|
|
||||||
const employeeTeamName = bodyshop.employee_teams.find(
|
const employeeTeamName =
|
||||||
(team) => team.id === jobline?.assigned_team
|
bodyshop.employee_teams.find(
|
||||||
);
|
(team) => team.id === jobline?.assigned_team
|
||||||
|
);
|
||||||
|
|
||||||
if (getFieldValue(["billlines", record.name, "deductedfromlbr"]))
|
if (
|
||||||
|
getFieldValue([
|
||||||
|
"billlines",
|
||||||
|
record.name,
|
||||||
|
"deductedfromlbr",
|
||||||
|
])
|
||||||
|
)
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{Enhanced_Payroll.treatment === "on" ?
|
{Enhanced_Payroll.treatment === "on" ? (
|
||||||
<Space>
|
<Space>
|
||||||
{t("joblines.fields.assigned_team", {
|
{t(
|
||||||
name: employeeTeamName?.name,
|
"joblines.fields.assigned_team",
|
||||||
})}
|
{
|
||||||
{`${jobline.mod_lb_hrs} units/${t(
|
name: employeeTeamName?.name,
|
||||||
`joblines.fields.lbr_types.${jobline.mod_lbr_ty}`
|
}
|
||||||
)}`}
|
)}
|
||||||
</Space> :
|
{`${
|
||||||
null}
|
jobline.mod_lb_hrs
|
||||||
|
} units/${t(
|
||||||
|
`joblines.fields.lbr_types.${jobline.mod_lbr_ty}`
|
||||||
|
)}`}
|
||||||
|
</Space>
|
||||||
|
) : null}
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("joblines.fields.mod_lbr_ty")}
|
label={t(
|
||||||
|
"joblines.fields.mod_lbr_ty"
|
||||||
|
)}
|
||||||
key={`${index}modlbrty`}
|
key={`${index}modlbrty`}
|
||||||
initialValue={jobline ? jobline.mod_lbr_ty : null}
|
initialValue={
|
||||||
|
jobline
|
||||||
|
? jobline.mod_lbr_ty
|
||||||
|
: null
|
||||||
|
}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={[record.name, "lbr_adjustment", "mod_lbr_ty"]}
|
name={[
|
||||||
|
record.name,
|
||||||
|
"lbr_adjustment",
|
||||||
|
"mod_lbr_ty",
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<Select allowClear>
|
<Select allowClear>
|
||||||
<Select.Option value="LAA">
|
<Select.Option value="LAA">
|
||||||
{t("joblines.fields.lbr_types.LAA")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LAA"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LAB">
|
<Select.Option value="LAB">
|
||||||
{t("joblines.fields.lbr_types.LAB")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LAB"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LAD">
|
<Select.Option value="LAD">
|
||||||
{t("joblines.fields.lbr_types.LAD")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LAD"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LAE">
|
<Select.Option value="LAE">
|
||||||
{t("joblines.fields.lbr_types.LAE")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LAE"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LAF">
|
<Select.Option value="LAF">
|
||||||
{t("joblines.fields.lbr_types.LAF")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LAF"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LAG">
|
<Select.Option value="LAG">
|
||||||
{t("joblines.fields.lbr_types.LAG")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LAG"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LAM">
|
<Select.Option value="LAM">
|
||||||
{t("joblines.fields.lbr_types.LAM")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LAM"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LAR">
|
<Select.Option value="LAR">
|
||||||
{t("joblines.fields.lbr_types.LAR")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LAR"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LAS">
|
<Select.Option value="LAS">
|
||||||
{t("joblines.fields.lbr_types.LAS")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LAS"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LAU">
|
<Select.Option value="LAU">
|
||||||
{t("joblines.fields.lbr_types.LAU")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LAU"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LA1">
|
<Select.Option value="LA1">
|
||||||
{t("joblines.fields.lbr_types.LA1")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LA1"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LA2">
|
<Select.Option value="LA2">
|
||||||
{t("joblines.fields.lbr_types.LA2")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LA2"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LA3">
|
<Select.Option value="LA3">
|
||||||
{t("joblines.fields.lbr_types.LA3")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LA3"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
<Select.Option value="LA4">
|
<Select.Option value="LA4">
|
||||||
{t("joblines.fields.lbr_types.LA4")}
|
{t(
|
||||||
|
"joblines.fields.lbr_types.LA4"
|
||||||
|
)}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{Enhanced_Payroll.treatment === "on" ? (
|
{Enhanced_Payroll.treatment === "on" ? (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("billlines.labels.mod_lbr_adjustment")}
|
label={t(
|
||||||
name={[record.name, "lbr_adjustment", "mod_lb_hrs"]}
|
"billlines.labels.mod_lbr_adjustment"
|
||||||
|
)}
|
||||||
|
name={[
|
||||||
|
record.name,
|
||||||
|
"lbr_adjustment",
|
||||||
|
"mod_lb_hrs",
|
||||||
|
]}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@@ -506,14 +631,26 @@ export function BillEnterModalLinesComponent({
|
|||||||
<InputNumber
|
<InputNumber
|
||||||
precision={5}
|
precision={5}
|
||||||
min={0.01}
|
min={0.01}
|
||||||
max={jobline ? jobline.mod_lb_hrs : 0}
|
max={
|
||||||
|
jobline
|
||||||
|
? jobline.mod_lb_hrs
|
||||||
|
: 0
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
) : (
|
) : (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("jobs.labels.adjustmentrate")}
|
label={t(
|
||||||
name={[record.name, "lbr_adjustment", "rate"]}
|
"jobs.labels.adjustmentrate"
|
||||||
initialValue={bodyshop.default_adjustment_rate}
|
)}
|
||||||
|
name={[
|
||||||
|
record.name,
|
||||||
|
"lbr_adjustment",
|
||||||
|
"rate",
|
||||||
|
]}
|
||||||
|
initialValue={
|
||||||
|
bodyshop.default_adjustment_rate
|
||||||
|
}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@@ -521,14 +658,19 @@ export function BillEnterModalLinesComponent({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber precision={2} min={0.01}/>
|
<InputNumber
|
||||||
|
precision={2}
|
||||||
|
min={0.01}
|
||||||
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Space>
|
<Space>
|
||||||
{price &&
|
{price &&
|
||||||
adjustmentRate &&
|
adjustmentRate &&
|
||||||
`${(price / adjustmentRate).toFixed(1)} hrs`}
|
`${(
|
||||||
|
price / adjustmentRate
|
||||||
|
).toFixed(1)} hrs`}
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -538,23 +680,32 @@ export function BillEnterModalLinesComponent({
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
...InstanceRenderManager({
|
||||||
|
imex: [
|
||||||
|
{
|
||||||
|
title: t("billlines.fields.federal_tax_applicable"),
|
||||||
|
dataIndex: "applicable_taxes.federal",
|
||||||
|
editable: true,
|
||||||
|
|
||||||
...InstanceRenderManager({imex: { title: t("billlines.fields.federal_tax_applicable"),
|
formItemProps: (field) => {
|
||||||
dataIndex: "applicable_taxes.federal",
|
return {
|
||||||
editable: true,
|
key: `${field.index}fedtax`,
|
||||||
|
valuePropName: "checked",
|
||||||
|
// initialValue: true,
|
||||||
|
name: [
|
||||||
|
field.name,
|
||||||
|
"applicable_taxes",
|
||||||
|
"federal",
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
formInput: (record, index) => (
|
||||||
|
<Switch disabled={disabled} />
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
|
||||||
formItemProps: (field) => {
|
|
||||||
return {
|
|
||||||
key: `${field.index}fedtax`,
|
|
||||||
valuePropName: "checked",
|
|
||||||
// initialValue: true,
|
|
||||||
name: [field.name, "applicable_taxes", "federal"],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
formInput: (record, index) => <Switch disabled={disabled} />,}})
|
|
||||||
|
|
||||||
|
|
||||||
,
|
|
||||||
{
|
{
|
||||||
title: t("billlines.fields.state_tax_applicable"),
|
title: t("billlines.fields.state_tax_applicable"),
|
||||||
dataIndex: "applicable_taxes.state",
|
dataIndex: "applicable_taxes.state",
|
||||||
@@ -567,24 +718,29 @@ export function BillEnterModalLinesComponent({
|
|||||||
name: [field.name, "applicable_taxes", "state"],
|
name: [field.name, "applicable_taxes", "state"],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
formInput: (record, index) => <Switch disabled={disabled}/>,
|
formInput: (record, index) => <Switch disabled={disabled} />,
|
||||||
},
|
},
|
||||||
|
|
||||||
...InstanceRenderManager({imex: {
|
...InstanceRenderManager({
|
||||||
title: t("billlines.fields.local_tax_applicable"),
|
imex: [
|
||||||
dataIndex: "applicable_taxes.local",
|
{
|
||||||
editable: true,
|
title: t("billlines.fields.local_tax_applicable"),
|
||||||
|
dataIndex: "applicable_taxes.local",
|
||||||
|
editable: true,
|
||||||
|
|
||||||
formItemProps: (field) => {
|
formItemProps: (field) => {
|
||||||
return {
|
return {
|
||||||
key: `${field.index}localtax`,
|
key: `${field.index}localtax`,
|
||||||
valuePropName: "checked",
|
valuePropName: "checked",
|
||||||
name: [field.name, "applicable_taxes", "local"],
|
name: [field.name, "applicable_taxes", "local"],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
formInput: (record, index) => <Switch disabled={disabled} />,
|
formInput: (record, index) => (
|
||||||
}})
|
<Switch disabled={disabled} />
|
||||||
,
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
{
|
{
|
||||||
title: t("general.labels.actions"),
|
title: t("general.labels.actions"),
|
||||||
|
|
||||||
@@ -596,12 +752,13 @@ export function BillEnterModalLinesComponent({
|
|||||||
<Button
|
<Button
|
||||||
disabled={
|
disabled={
|
||||||
disabled ||
|
disabled ||
|
||||||
getFieldValue("billlines")[record.fieldKey]?.inventories
|
getFieldValue("billlines")[
|
||||||
?.length > 0
|
record.fieldKey
|
||||||
|
]?.inventories?.length > 0
|
||||||
}
|
}
|
||||||
onClick={() => remove(record.name)}
|
onClick={() => remove(record.name)}
|
||||||
>
|
>
|
||||||
<DeleteFilled/>
|
<DeleteFilled />
|
||||||
</Button>
|
</Button>
|
||||||
{Simple_Inventory.treatment === "on" && (
|
{Simple_Inventory.treatment === "on" && (
|
||||||
<BilllineAddInventory
|
<BilllineAddInventory
|
||||||
@@ -610,7 +767,11 @@ export function BillEnterModalLinesComponent({
|
|||||||
form.isFieldsTouched() ||
|
form.isFieldsTouched() ||
|
||||||
form.getFieldValue("is_credit_memo")
|
form.getFieldValue("is_credit_memo")
|
||||||
}
|
}
|
||||||
billline={getFieldValue("billlines")[record.fieldKey]}
|
billline={
|
||||||
|
getFieldValue("billlines")[
|
||||||
|
record.fieldKey
|
||||||
|
]
|
||||||
|
}
|
||||||
jobid={getFieldValue("jobid")}
|
jobid={getFieldValue("jobid")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -653,7 +814,7 @@ export function BillEnterModalLinesComponent({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{(fields, {add, remove, move}) => {
|
{(fields, { add, remove, move }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Table
|
<Table
|
||||||
@@ -666,7 +827,7 @@ export function BillEnterModalLinesComponent({
|
|||||||
bordered
|
bordered
|
||||||
dataSource={fields}
|
dataSource={fields}
|
||||||
columns={mergedColumns(remove)}
|
columns={mergedColumns(remove)}
|
||||||
scroll={{x: true}}
|
scroll={{ x: true }}
|
||||||
pagination={false}
|
pagination={false}
|
||||||
rowClassName="editable-row"
|
rowClassName="editable-row"
|
||||||
/>
|
/>
|
||||||
@@ -676,7 +837,7 @@ export function BillEnterModalLinesComponent({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
add();
|
add();
|
||||||
}}
|
}}
|
||||||
style={{width: "100%"}}
|
style={{ width: "100%" }}
|
||||||
>
|
>
|
||||||
{t("billlines.actions.newline")}
|
{t("billlines.actions.newline")}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -694,28 +855,29 @@ export default connect(
|
|||||||
)(BillEnterModalLinesComponent);
|
)(BillEnterModalLinesComponent);
|
||||||
|
|
||||||
const EditableCell = ({
|
const EditableCell = ({
|
||||||
dataIndex,
|
dataIndex,
|
||||||
title,
|
title,
|
||||||
inputType,
|
inputType,
|
||||||
record,
|
record,
|
||||||
index,
|
index,
|
||||||
children,
|
children,
|
||||||
formInput,
|
formInput,
|
||||||
formItemProps,
|
formItemProps,
|
||||||
additional,
|
additional,
|
||||||
wrapper,
|
wrapper,
|
||||||
...restProps
|
...restProps
|
||||||
}) => {
|
}) => {
|
||||||
if (additional)
|
if (additional)
|
||||||
return (
|
return (
|
||||||
<td {...restProps}>
|
<td {...restProps}>
|
||||||
<div size="small">
|
<div size="small">
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={dataIndex}
|
name={dataIndex}
|
||||||
labelCol={{span: 0}}
|
labelCol={{ span: 0 }}
|
||||||
{...(formItemProps && formItemProps(record))}
|
{...(formItemProps && formItemProps(record))}
|
||||||
>
|
>
|
||||||
{(formInput && formInput(record, record.name)) || children}
|
{(formInput && formInput(record, record.name)) ||
|
||||||
|
children}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{additional && additional(record, record.name)}
|
{additional && additional(record, record.name)}
|
||||||
</div>
|
</div>
|
||||||
@@ -726,11 +888,12 @@ const EditableCell = ({
|
|||||||
<wrapper>
|
<wrapper>
|
||||||
<td {...restProps}>
|
<td {...restProps}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
labelCol={{span: 0}}
|
labelCol={{ span: 0 }}
|
||||||
name={dataIndex}
|
name={dataIndex}
|
||||||
{...(formItemProps && formItemProps(record))}
|
{...(formItemProps && formItemProps(record))}
|
||||||
>
|
>
|
||||||
{(formInput && formInput(record, record.name)) || children}
|
{(formInput && formInput(record, record.name)) ||
|
||||||
|
children}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</td>
|
</td>
|
||||||
</wrapper>
|
</wrapper>
|
||||||
@@ -738,7 +901,7 @@ const EditableCell = ({
|
|||||||
return (
|
return (
|
||||||
<td {...restProps}>
|
<td {...restProps}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
labelCol={{span: 0}}
|
labelCol={{ span: 0 }}
|
||||||
name={dataIndex}
|
name={dataIndex}
|
||||||
{...(formItemProps && formItemProps(record))}
|
{...(formItemProps && formItemProps(record))}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -440,18 +440,18 @@ export function JobLinesComponent({
|
|||||||
{type: 'divider'},
|
{type: 'divider'},
|
||||||
{key: "LAA", label: t("joblines.fields.lbr_types.LAA")},
|
{key: "LAA", label: t("joblines.fields.lbr_types.LAA")},
|
||||||
{key: "LAB", label: t("joblines.fields.lbr_types.LAB")},
|
{key: "LAB", label: t("joblines.fields.lbr_types.LAB")},
|
||||||
{key: "LAD", label: t("joblines.fields.part_types.LAD")},
|
{key: "LAD", label: t("joblines.fields.lbr_types.LAD")},
|
||||||
{key: "LAE", label: t("joblines.fields.part_types.LAE")},
|
{key: "LAE", label: t("joblines.fields.lbr_types.LAE")},
|
||||||
{key: "LAF", label: t("joblines.fields.part_types.LAF")},
|
{key: "LAF", label: t("joblines.fields.lbr_types.LAF")},
|
||||||
{key: "LAG", label: t("joblines.fields.part_types.LAG")},
|
{key: "LAG", label: t("joblines.fields.lbr_types.LAG")},
|
||||||
{key: "LAM", label: t("joblines.fields.part_types.LAM")},
|
{key: "LAM", label: t("joblines.fields.lbr_types.LAM")},
|
||||||
{key: "LAR", label: t("joblines.fields.part_types.LAR")},
|
{key: "LAR", label: t("joblines.fields.lbr_types.LAR")},
|
||||||
{key: "LAS", label: t("joblines.fields.part_types.LAS")},
|
{key: "LAS", label: t("joblines.fields.lbr_types.LAS")},
|
||||||
{key: "LAU", label: t("joblines.fields.part_types.LAU")},
|
{key: "LAU", label: t("joblines.fields.lbr_types.LAU")},
|
||||||
{key: "LA1", label: t("joblines.fields.part_types.LA1")},
|
{key: "LA1", label: t("joblines.fields.lbr_types.LA1")},
|
||||||
{key: "LA2", label: t("joblines.fields.part_types.LA2")},
|
{key: "LA2", label: t("joblines.fields.lbr_types.LA2")},
|
||||||
{key: "LA3", label: t("joblines.fields.part_types.LA3")},
|
{key: "LA3", label: t("joblines.fields.lbr_types.LA3")},
|
||||||
{key: "LA4", label: t("joblines.fields.part_types.LA4")},
|
{key: "LA4", label: t("joblines.fields.lbr_types.LA4")},
|
||||||
{type: 'divider'},
|
{type: 'divider'},
|
||||||
{key: "clear", label: t("general.labels.clear")},
|
{key: "clear", label: t("general.labels.clear")},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
import {Alert} from "antd";
|
import { Alert } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {useTranslation} from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||||
|
|
||||||
export default function JobProfileDataWarning({job}) {
|
export default function JobProfileDataWarning({ job }) {
|
||||||
const {t} = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
let missingProfileInfo =
|
let missingProfileInfo =
|
||||||
Object.keys(job.cieca_pft).length === 0 ||
|
Object.keys(job.cieca_pft).length === 0 ||
|
||||||
Object.keys(job.cieca_pfl).length === 0 ||
|
Object.keys(job.cieca_pfl).length === 0 ||
|
||||||
Object.keys(job.materials).length === 0;
|
Object.keys(job.materials).length === 0;
|
||||||
|
|
||||||
if (missingProfileInfo)
|
if (missingProfileInfo && InstanceRenderManager({ rome: true }))
|
||||||
return (
|
return (
|
||||||
<Alert type="error" message={t("jobs.labels.missingprofileinfo")}></Alert>
|
<Alert
|
||||||
|
type="error"
|
||||||
|
message={t("jobs.labels.missingprofileinfo")}
|
||||||
|
></Alert>
|
||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export function ShopInfoComponent({bodyshop, form, saveLoading}) {
|
|||||||
|
|
||||||
const {treatments: {CriticalPartsScanning, EnhancedPayroll}} = useSplitTreatments({
|
const {treatments: {CriticalPartsScanning, EnhancedPayroll}} = useSplitTreatments({
|
||||||
attributes: {},
|
attributes: {},
|
||||||
names: ["CriticalPartsScanning"],
|
names: ["CriticalPartsScanning","EnhancedPayroll"],
|
||||||
splitKey: bodyshop.imexshopid,
|
splitKey: bodyshop.imexshopid,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const DineroQbFormat = require("./accounting-constants").DineroQbFormat;
|
|||||||
const Dinero = require("dinero.js");
|
const Dinero = require("dinero.js");
|
||||||
const {DiscountNotAlreadyCounted} = require("../job/job-totals");
|
const {DiscountNotAlreadyCounted} = require("../job/job-totals");
|
||||||
const logger = require("../utils/logger");
|
const logger = require("../utils/logger");
|
||||||
const InstanceManager = require("../utils/instanceMgr");
|
const InstanceManager = require("../utils/instanceMgr").default;
|
||||||
|
|
||||||
exports.default = function ({
|
exports.default = function ({
|
||||||
bodyshop,
|
bodyshop,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const OAuthClient = require("intuit-oauth");
|
|||||||
const client = require("../../graphql-client/graphql-client").client;
|
const client = require("../../graphql-client/graphql-client").client;
|
||||||
const queries = require("../../graphql-client/queries");
|
const queries = require("../../graphql-client/queries");
|
||||||
const {parse, stringify} = require("querystring");
|
const {parse, stringify} = require("querystring");
|
||||||
const InstanceManager = require("../../utils/instanceMgr");
|
const InstanceManager = require("../../utils/instanceMgr").default;
|
||||||
|
|
||||||
const oauthClient = new OAuthClient({
|
const oauthClient = new OAuthClient({
|
||||||
clientId: process.env.QBO_CLIENT_ID,
|
clientId: process.env.QBO_CLIENT_ID,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const axios = require("axios");
|
|||||||
let nodemailer = require("nodemailer");
|
let nodemailer = require("nodemailer");
|
||||||
let aws = require("@aws-sdk/client-ses");
|
let aws = require("@aws-sdk/client-ses");
|
||||||
let { defaultProvider } = require("@aws-sdk/credential-provider-node");
|
let { defaultProvider } = require("@aws-sdk/credential-provider-node");
|
||||||
const InstanceManager = require("../utils/instanceMgr");
|
const InstanceManager = require("../utils/instanceMgr").default;
|
||||||
const logger = require("../utils/logger");
|
const logger = require("../utils/logger");
|
||||||
const client = require("../graphql-client/graphql-client").client;
|
const client = require("../graphql-client/graphql-client").client;
|
||||||
const queries = require("../graphql-client/queries");
|
const queries = require("../graphql-client/queries");
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ exports.totalsSsu = async function (req, res) {
|
|||||||
const BearerToken = req.BearerToken;
|
const BearerToken = req.BearerToken;
|
||||||
const client = req.userGraphQLClient;
|
const client = req.userGraphQLClient;
|
||||||
|
|
||||||
logger.log("job-totals-ssu", "DEBUG", req.user.email, id, null);
|
logger.log("job-totals-ssu-USA", "DEBUG", req.user.email, id, null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const job = await client
|
const job = await client
|
||||||
@@ -55,7 +55,7 @@ exports.totalsSsu = async function (req, res) {
|
|||||||
|
|
||||||
res.status(200).send();
|
res.status(200).send();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.log("job-totals-ssu-error", "ERROR", req.user.email, id, {
|
logger.log("job-totals-ssu-USA-error", "ERROR", req.user.email, id, {
|
||||||
jobid: id,
|
jobid: id,
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
@@ -78,7 +78,7 @@ async function TotalsServerSide(req, res) {
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.log("job-totals-ssu-error", "ERROR", req.user?.email, job.id, {
|
logger.log("job-totals-ssu-USA-error", "ERROR", req.user?.email, job.id, {
|
||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
@@ -92,11 +92,11 @@ async function Totals(req, res) {
|
|||||||
const logger = req.logger;
|
const logger = req.logger;
|
||||||
const client = req.userGraphQLClient;
|
const client = req.userGraphQLClient;
|
||||||
|
|
||||||
logger.log("job-totals", "DEBUG", req.user.email, job.id, {
|
logger.log("job-totals-USA", "DEBUG", req.user.email, job.id, {
|
||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.log("job-totals-ssu", "DEBUG", req.user.email, id, null);
|
logger.log("job-totals-ssu-USA", "DEBUG", req.user.email, id, null);
|
||||||
|
|
||||||
await AutoAddAtsIfRequired({job, client});
|
await AutoAddAtsIfRequired({job, client});
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ async function Totals(req, res) {
|
|||||||
|
|
||||||
res.status(200).json(ret);
|
res.status(200).json(ret);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.log("job-totals-error", "ERROR", req.user.email, job.id, {
|
logger.log("job-totals-USA-error", "ERROR", req.user.email, job.id, {
|
||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
error,
|
error,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const RenderInstanceManager = require("../utils/instanceMgr");
|
const RenderInstanceManager = require("../utils/instanceMgr").default;
|
||||||
|
|
||||||
exports.totals = RenderInstanceManager({
|
exports.totals = RenderInstanceManager({
|
||||||
imex: require("./job-totals").default,
|
imex: require("./job-totals").default,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const queries = require("../graphql-client/queries");
|
|||||||
const {phone} = require("phone");
|
const {phone} = require("phone");
|
||||||
const {admin} = require("../firebase/firebase-handler");
|
const {admin} = require("../firebase/firebase-handler");
|
||||||
const logger = require("../utils/logger");
|
const logger = require("../utils/logger");
|
||||||
const InstanceRenderManager = require("../../client/src/utils/instanceRenderMgr");
|
const InstanceManager = require("../utils/instanceMgr");
|
||||||
|
|
||||||
exports.receive = async (req, res) => {
|
exports.receive = async (req, res) => {
|
||||||
//Perform request validation
|
//Perform request validation
|
||||||
@@ -106,7 +106,7 @@ exports.receive = async (req, res) => {
|
|||||||
topic: `${message.conversation.bodyshop.imexshopid}-messaging`,
|
topic: `${message.conversation.bodyshop.imexshopid}-messaging`,
|
||||||
notification: {
|
notification: {
|
||||||
title:
|
title:
|
||||||
InstanceRenderManager({
|
InstanceManager({
|
||||||
imex:`ImEX Online Message - ${data.phone_num}` ,
|
imex:`ImEX Online Message - ${data.phone_num}` ,
|
||||||
rome: `Rome Online Message - ${data.phone_num}`,
|
rome: `Rome Online Message - ${data.phone_num}`,
|
||||||
promanager: `Pro Manager Message - ${data.phone_num}`
|
promanager: `Pro Manager Message - ${data.phone_num}`
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
* @property { string | object | function } imex Return this prop if Rome.
|
* @property { string | object | function } imex Return this prop if Rome.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default function InstanceManager({ rome, promanager, imex }) {
|
function InstanceManager({ rome, promanager, imex }) {
|
||||||
let propToReturn = null;
|
let propToReturn = null;
|
||||||
|
|
||||||
switch (process.env.INSTANCE) {
|
switch (process.env.INSTANCE) {
|
||||||
@@ -32,3 +32,5 @@ export default function InstanceManager({ rome, promanager, imex }) {
|
|||||||
// }
|
// }
|
||||||
return propToReturn;
|
return propToReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.default = InstanceManager
|
||||||
|
|||||||
Reference in New Issue
Block a user