Compare commits
1 Commits
feature/IO
...
pagination
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee8cbe33c4 |
@@ -22,7 +22,6 @@ import {
|
|||||||
} from "../redux/user/user.selectors";
|
} from "../redux/user/user.selectors";
|
||||||
import PrivateRoute from "../utils/private-route";
|
import PrivateRoute from "../utils/private-route";
|
||||||
import "./App.styles.scss";
|
import "./App.styles.scss";
|
||||||
import handleBeta from "../utils/handleBeta";
|
|
||||||
|
|
||||||
const ResetPassword = lazy(() =>
|
const ResetPassword = lazy(() =>
|
||||||
import("../pages/reset-password/reset-password.component")
|
import("../pages/reset-password/reset-password.component")
|
||||||
@@ -58,6 +57,7 @@ export function App({
|
|||||||
if (!navigator.onLine) {
|
if (!navigator.onLine) {
|
||||||
setOnline(false);
|
setOnline(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkUserSession();
|
checkUserSession();
|
||||||
}, [checkUserSession, setOnline]);
|
}, [checkUserSession, setOnline]);
|
||||||
|
|
||||||
@@ -73,7 +73,6 @@ export function App({
|
|||||||
window.addEventListener("online", function (e) {
|
window.addEventListener("online", function (e) {
|
||||||
setOnline(true);
|
setOnline(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (currentUser.authorized && bodyshop) {
|
if (currentUser.authorized && bodyshop) {
|
||||||
client.setAttribute("imexshopid", bodyshop.imexshopid);
|
client.setAttribute("imexshopid", bodyshop.imexshopid);
|
||||||
@@ -108,8 +107,6 @@ export function App({
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
handleBeta();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Switch>
|
<Switch>
|
||||||
<Suspense fallback={<LoadingSpinner message="ImEX Online" />}>
|
<Suspense fallback={<LoadingSpinner message="ImEX Online" />}>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import {
|
import {
|
||||||
DELETE_BILL_LINE,
|
DELETE_BILL_LINE,
|
||||||
INSERT_NEW_BILL_LINES,
|
INSERT_NEW_BILL_LINES,
|
||||||
UPDATE_BILL_LINE,
|
UPDATE_BILL_LINE
|
||||||
} from "../../graphql/bill-lines.queries";
|
} from "../../graphql/bill-lines.queries";
|
||||||
import { QUERY_BILL_BY_PK, UPDATE_BILL } from "../../graphql/bills.queries";
|
import { QUERY_BILL_BY_PK, UPDATE_BILL } from "../../graphql/bills.queries";
|
||||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
@@ -20,7 +20,6 @@ import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
|||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import BillFormContainer from "../bill-form/bill-form.container";
|
import BillFormContainer from "../bill-form/bill-form.container";
|
||||||
import BillMarkExportedButton from "../bill-mark-exported-button/bill-mark-exported-button.component";
|
import BillMarkExportedButton from "../bill-mark-exported-button/bill-mark-exported-button.component";
|
||||||
import BillPrintButton from "../bill-print-button/bill-print-button.component";
|
|
||||||
import BillReeportButtonComponent from "../bill-reexport-button/bill-reexport-button.component";
|
import BillReeportButtonComponent from "../bill-reexport-button/bill-reexport-button.component";
|
||||||
import JobDocumentsGallery from "../jobs-documents-gallery/jobs-documents-gallery.container";
|
import JobDocumentsGallery from "../jobs-documents-gallery/jobs-documents-gallery.container";
|
||||||
import JobsDocumentsLocalGallery from "../jobs-documents-local-gallery/jobs-documents-local-gallery.container";
|
import JobsDocumentsLocalGallery from "../jobs-documents-local-gallery/jobs-documents-local-gallery.container";
|
||||||
@@ -177,7 +176,7 @@ export function BillDetailEditcontainer({
|
|||||||
extra={
|
extra={
|
||||||
<Space>
|
<Space>
|
||||||
<BillDetailEditReturn data={data} />
|
<BillDetailEditReturn data={data} />
|
||||||
<BillPrintButton billid={search.billid} />
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
visible={visible}
|
visible={visible}
|
||||||
onConfirm={() => form.submit()}
|
onConfirm={() => form.submit()}
|
||||||
|
|||||||
@@ -79,20 +79,6 @@ export function BillFormComponent({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFederalTaxExemptSwitchToggle = (checked) => {
|
|
||||||
// Early gate
|
|
||||||
if (!checked) return;
|
|
||||||
const values = form.getFieldsValue("billlines");
|
|
||||||
// Gate bill lines
|
|
||||||
if (!values?.billlines?.length) return;
|
|
||||||
|
|
||||||
const billlines = values.billlines.map((b) => {
|
|
||||||
b.applicable_taxes.federal = false;
|
|
||||||
return b;
|
|
||||||
});
|
|
||||||
form.setFieldsValue({ billlines });
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (job) form.validateFields(["is_credit_memo"]);
|
if (job) form.validateFields(["is_credit_memo"]);
|
||||||
}, [job, form]);
|
}, [job, form]);
|
||||||
@@ -401,16 +387,7 @@ export function BillFormComponent({
|
|||||||
>
|
>
|
||||||
<CurrencyInput min={0} />
|
<CurrencyInput min={0} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid ? (
|
<Form.Item shouldUpdate span={15}>
|
||||||
<Form.Item
|
|
||||||
span={2}
|
|
||||||
label={t("bills.labels.federal_tax_exempt")}
|
|
||||||
name="federal_tax_exempt"
|
|
||||||
>
|
|
||||||
<Switch onChange={handleFederalTaxExemptSwitchToggle} />
|
|
||||||
</Form.Item>
|
|
||||||
) : null}
|
|
||||||
<Form.Item shouldUpdate span={13}>
|
|
||||||
{() => {
|
{() => {
|
||||||
const values = form.getFieldsValue([
|
const values = form.getFieldsValue([
|
||||||
"billlines",
|
"billlines",
|
||||||
@@ -428,7 +405,7 @@ export function BillFormComponent({
|
|||||||
totals = CalculateBillTotal(values);
|
totals = CalculateBillTotal(values);
|
||||||
if (!!totals)
|
if (!!totals)
|
||||||
return (
|
return (
|
||||||
<div align="right">
|
<div>
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<Statistic
|
<Statistic
|
||||||
title={t("bills.labels.subtotal")}
|
title={t("bills.labels.subtotal")}
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import { DeleteFilled, DollarCircleFilled } from "@ant-design/icons";
|
import { DeleteFilled, DollarCircleFilled } from "@ant-design/icons";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button, Form,
|
||||||
Form,
|
|
||||||
Input,
|
Input,
|
||||||
InputNumber,
|
InputNumber,
|
||||||
Select,
|
Select,
|
||||||
Space,
|
Space,
|
||||||
Switch,
|
Switch,
|
||||||
Table,
|
Table,
|
||||||
Tooltip,
|
Tooltip
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -467,8 +466,7 @@ export function BillEnterModalLinesComponent({
|
|||||||
return {
|
return {
|
||||||
key: `${field.index}fedtax`,
|
key: `${field.index}fedtax`,
|
||||||
valuePropName: "checked",
|
valuePropName: "checked",
|
||||||
initialValue:
|
initialValue: true,
|
||||||
form.getFieldValue("federal_tax_exempt") === true ? false : true,
|
|
||||||
name: [field.name, "applicable_taxes", "federal"],
|
name: [field.name, "applicable_taxes", "federal"],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
import { Button, Space } from "antd";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
|
||||||
|
|
||||||
export default function BillPrintButton({ billid }) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const [loading, setLoading] = useState(false);
|
|
||||||
const Templates = TemplateList("job_special");
|
|
||||||
|
|
||||||
const submitHandler = async () => {
|
|
||||||
setLoading(true);
|
|
||||||
try {
|
|
||||||
await GenerateDocument(
|
|
||||||
{
|
|
||||||
name: Templates.parts_invoice_label_single.key,
|
|
||||||
variables: {
|
|
||||||
id: billid,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
"p"
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("Warning: Error generating a document.");
|
|
||||||
}
|
|
||||||
setLoading(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Space wrap>
|
|
||||||
<Button loading={loading} onClick={submitHandler}>
|
|
||||||
{t("bills.labels.printlabels")}
|
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@ import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
|||||||
import ChatArchiveButton from "../chat-archive-button/chat-archive-button.component";
|
import ChatArchiveButton from "../chat-archive-button/chat-archive-button.component";
|
||||||
import ChatConversationTitleTags from "../chat-conversation-title-tags/chat-conversation-title-tags.component";
|
import ChatConversationTitleTags from "../chat-conversation-title-tags/chat-conversation-title-tags.component";
|
||||||
import ChatLabelComponent from "../chat-label/chat-label.component";
|
import ChatLabelComponent from "../chat-label/chat-label.component";
|
||||||
import ChatPrintButton from "../chat-print-button/chat-print-button.component";
|
|
||||||
import ChatTagRoContainer from "../chat-tag-ro/chat-tag-ro.container";
|
import ChatTagRoContainer from "../chat-tag-ro/chat-tag-ro.container";
|
||||||
|
|
||||||
export default function ChatConversationTitle({ conversation }) {
|
export default function ChatConversationTitle({ conversation }) {
|
||||||
@@ -14,7 +13,6 @@ export default function ChatConversationTitle({ conversation }) {
|
|||||||
{conversation && conversation.phone_num}
|
{conversation && conversation.phone_num}
|
||||||
</PhoneNumberFormatter>
|
</PhoneNumberFormatter>
|
||||||
<ChatLabelComponent conversation={conversation} />
|
<ChatLabelComponent conversation={conversation} />
|
||||||
<ChatPrintButton conversation={conversation} />
|
|
||||||
<ChatConversationTitleTags
|
<ChatConversationTitleTags
|
||||||
jobConversations={
|
jobConversations={
|
||||||
(conversation && conversation.job_conversations) || []
|
(conversation && conversation.job_conversations) || []
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
import { MailOutlined, PrinterOutlined } from "@ant-design/icons";
|
|
||||||
import { Space, Spin } from "antd";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
|
||||||
import { setEmailOptions } from "../../redux/email/email.actions";
|
|
||||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({});
|
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
|
||||||
setEmailOptions: (e) => dispatch(setEmailOptions(e)),
|
|
||||||
});
|
|
||||||
|
|
||||||
export function ChatPrintButton({ conversation }) {
|
|
||||||
const [loading, setLoading] = useState(false);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Space wrap>
|
|
||||||
<PrinterOutlined
|
|
||||||
onClick={() => {
|
|
||||||
setLoading(true);
|
|
||||||
GenerateDocument(
|
|
||||||
{
|
|
||||||
name: TemplateList("messaging").conversation_list.key,
|
|
||||||
variables: { id: conversation.id },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
subject: TemplateList("messaging").conversation_list.subject,
|
|
||||||
},
|
|
||||||
"p",
|
|
||||||
conversation.id
|
|
||||||
);
|
|
||||||
setLoading(false);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<MailOutlined
|
|
||||||
onClick={() => {
|
|
||||||
setLoading(true);
|
|
||||||
GenerateDocument(
|
|
||||||
{
|
|
||||||
name: TemplateList("messaging").conversation_list.key,
|
|
||||||
variables: { id: conversation.id },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
subject: TemplateList("messaging").conversation_list.subject,
|
|
||||||
},
|
|
||||||
"e",
|
|
||||||
conversation.id
|
|
||||||
);
|
|
||||||
setLoading(false);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{loading && <Spin />}
|
|
||||||
</Space>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(ChatPrintButton);
|
|
||||||
@@ -35,15 +35,6 @@ export default function ContractsCarsComponent({
|
|||||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
render: (text, record) => <div>{t(record.status)}</div>,
|
render: (text, record) => <div>{t(record.status)}</div>,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: t("courtesycars.fields.readiness"),
|
|
||||||
dataIndex: "readiness",
|
|
||||||
key: "readiness",
|
|
||||||
sorter: (a, b) => alphaSort(a.readiness, b.readiness),
|
|
||||||
sortOrder:
|
|
||||||
state.sortedInfo.columnKey === "readiness" && state.sortedInfo.order,
|
|
||||||
render: (text, record) => t(record.readiness),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: t("courtesycars.fields.year"),
|
title: t("courtesycars.fields.year"),
|
||||||
dataIndex: "year",
|
dataIndex: "year",
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { CHECK_CC_FLEET_NUMBER } from "../../graphql/courtesy-car.queries";
|
import { CHECK_CC_FLEET_NUMBER } from "../../graphql/courtesy-car.queries";
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
import CourtesyCarFuelSlider from "../courtesy-car-fuel-select/courtesy-car-fuel-select.component";
|
import CourtesyCarFuelSlider from "../courtesy-car-fuel-select/courtesy-car-fuel-select.component";
|
||||||
import CourtesyCarReadiness from "../courtesy-car-readiness-select/courtesy-car-readiness-select.component";
|
|
||||||
import CourtesyCarStatus from "../courtesy-car-status-select/courtesy-car-status-select.component";
|
import CourtesyCarStatus from "../courtesy-car-status-select/courtesy-car-status-select.component";
|
||||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||||
//import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
//import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||||
@@ -214,9 +213,6 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
>
|
>
|
||||||
<CourtesyCarStatus />
|
<CourtesyCarStatus />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("courtesycars.fields.readiness")} name="readiness">
|
|
||||||
<CourtesyCarReadiness />
|
|
||||||
</Form.Item>
|
|
||||||
<div>
|
<div>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("courtesycars.fields.nextservicekm")}
|
label={t("courtesycars.fields.nextservicekm")}
|
||||||
@@ -231,9 +227,8 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
>
|
>
|
||||||
{() => {
|
{() => {
|
||||||
const nextservicekm = form.getFieldValue("nextservicekm");
|
const nextservicekm = form.getFieldValue("nextservicekm");
|
||||||
const mileageOver = nextservicekm
|
const mileageOver =
|
||||||
? nextservicekm <= form.getFieldValue("mileage")
|
nextservicekm && nextservicekm <= form.getFieldValue("mileage");
|
||||||
: false;
|
|
||||||
if (mileageOver)
|
if (mileageOver)
|
||||||
return (
|
return (
|
||||||
<Space direction="vertical" style={{ color: "tomato" }}>
|
<Space direction="vertical" style={{ color: "tomato" }}>
|
||||||
|
|||||||
@@ -34,32 +34,6 @@ const CourtesyCarFuelComponent = (props, ref) => {
|
|||||||
step={null}
|
step={null}
|
||||||
style={{ marginLeft: "2rem", marginRight: "2rem" }}
|
style={{ marginLeft: "2rem", marginRight: "2rem" }}
|
||||||
{...props}
|
{...props}
|
||||||
tooltip={{
|
|
||||||
formatter: (value) => {
|
|
||||||
switch (value) {
|
|
||||||
case 0:
|
|
||||||
return t("courtesycars.labels.fuel.empty");
|
|
||||||
case 13:
|
|
||||||
return t("courtesycars.labels.fuel.18");
|
|
||||||
case 25:
|
|
||||||
return t("courtesycars.labels.fuel.14");
|
|
||||||
case 38:
|
|
||||||
return t("courtesycars.labels.fuel.38");
|
|
||||||
case 50:
|
|
||||||
return t("courtesycars.labels.fuel.12");
|
|
||||||
case 63:
|
|
||||||
return t("courtesycars.labels.fuel.58");
|
|
||||||
case 75:
|
|
||||||
return t("courtesycars.labels.fuel.34");
|
|
||||||
case 88:
|
|
||||||
return t("courtesycars.labels.fuel.78");
|
|
||||||
case 100:
|
|
||||||
return t("courtesycars.labels.fuel.full");
|
|
||||||
default:
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
import { Select } from "antd";
|
|
||||||
import React, { forwardRef, useEffect, useState } from "react";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
const { Option } = Select;
|
|
||||||
|
|
||||||
const CourtesyCarReadinessComponent = ({ value, onChange }, ref) => {
|
|
||||||
const [option, setOption] = useState(value);
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (value !== option && onChange) {
|
|
||||||
onChange(option);
|
|
||||||
}
|
|
||||||
}, [value, option, onChange]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Select
|
|
||||||
allowClear
|
|
||||||
ref={ref}
|
|
||||||
value={option}
|
|
||||||
style={{
|
|
||||||
width: 100,
|
|
||||||
}}
|
|
||||||
onChange={setOption}
|
|
||||||
>
|
|
||||||
<Option value="courtesycars.readiness.ready">
|
|
||||||
{t("courtesycars.readiness.ready")}
|
|
||||||
</Option>
|
|
||||||
<Option value="courtesycars.readiness.notready">
|
|
||||||
{t("courtesycars.readiness.notready")}
|
|
||||||
</Option>
|
|
||||||
</Select>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
export default forwardRef(CourtesyCarReadinessComponent);
|
|
||||||
@@ -74,11 +74,10 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
const { nextservicedate, nextservicekm, mileage } = record;
|
const { nextservicedate, nextservicekm, mileage } = record;
|
||||||
|
|
||||||
const mileageOver = nextservicekm ? nextservicekm <= mileage : false;
|
const mileageOver = nextservicekm <= mileage;
|
||||||
|
|
||||||
const dueForService =
|
const dueForService =
|
||||||
nextservicedate &&
|
nextservicedate && moment(nextservicedate).isBefore(moment());
|
||||||
moment(nextservicedate).endOf("day").isSameOrBefore(moment());
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Space>
|
<Space>
|
||||||
@@ -92,26 +91,6 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: t("courtesycars.fields.readiness"),
|
|
||||||
dataIndex: "readiness",
|
|
||||||
key: "readiness",
|
|
||||||
sorter: (a, b) => alphaSort(a.readiness, b.readiness),
|
|
||||||
filters: [
|
|
||||||
{
|
|
||||||
text: t("courtesycars.readiness.ready"),
|
|
||||||
value: "courtesycars.readiness.ready",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: t("courtesycars.readiness.notready"),
|
|
||||||
value: "courtesycars.readiness.notready",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
onFilter: (value, record) => value.includes(record.readiness),
|
|
||||||
sortOrder:
|
|
||||||
state.sortedInfo.columnKey === "readiness" && state.sortedInfo.order,
|
|
||||||
render: (text, record) => t(record.readiness),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: t("courtesycars.fields.year"),
|
title: t("courtesycars.fields.year"),
|
||||||
dataIndex: "year",
|
dataIndex: "year",
|
||||||
@@ -152,36 +131,6 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "plate" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "plate" && state.sortedInfo.order,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: t("courtesycars.fields.fuel"),
|
|
||||||
dataIndex: "fuel",
|
|
||||||
key: "fuel",
|
|
||||||
sorter: (a, b) => alphaSort(a.fuel, b.fuel),
|
|
||||||
sortOrder:
|
|
||||||
state.sortedInfo.columnKey === "fuel" && state.sortedInfo.order,
|
|
||||||
render: (text, record) => {
|
|
||||||
switch (record.fuel) {
|
|
||||||
case 100:
|
|
||||||
return t("courtesycars.labels.fuel.full");
|
|
||||||
case 88:
|
|
||||||
return t("courtesycars.labels.fuel.78");
|
|
||||||
case 63:
|
|
||||||
return t("courtesycars.labels.fuel.58");
|
|
||||||
case 50:
|
|
||||||
return t("courtesycars.labels.fuel.12");
|
|
||||||
case 38:
|
|
||||||
return t("courtesycars.labels.fuel.34");
|
|
||||||
case 25:
|
|
||||||
return t("courtesycars.labels.fuel.14");
|
|
||||||
case 13:
|
|
||||||
return t("courtesycars.labels.fuel.18");
|
|
||||||
case 0:
|
|
||||||
return t("courtesycars.labels.fuel.empty");
|
|
||||||
default:
|
|
||||||
return record.fuel;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: t("courtesycars.labels.outwith"),
|
title: t("courtesycars.labels.outwith"),
|
||||||
dataIndex: "outwith",
|
dataIndex: "outwith",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import Icon, {
|
|||||||
FileFilled,
|
FileFilled,
|
||||||
//GlobalOutlined,
|
//GlobalOutlined,
|
||||||
HomeFilled,
|
HomeFilled,
|
||||||
ImportOutlined, InfoCircleOutlined,
|
ImportOutlined,
|
||||||
LineChartOutlined,
|
LineChartOutlined,
|
||||||
PaperClipOutlined,
|
PaperClipOutlined,
|
||||||
PhoneOutlined,
|
PhoneOutlined,
|
||||||
@@ -26,8 +26,8 @@ import Icon, {
|
|||||||
UserOutlined,
|
UserOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
import {Layout, Menu, Switch, Tooltip} from "antd";
|
import { Layout, Menu } from "antd";
|
||||||
import React, {useEffect, useState} from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { BsKanban } from "react-icons/bs";
|
import { BsKanban } from "react-icons/bs";
|
||||||
import {
|
import {
|
||||||
@@ -52,7 +52,6 @@ import {
|
|||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
import {handleBeta, setBeta, checkBeta} from "../../utils/handleBeta";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
@@ -103,21 +102,9 @@ function Header({
|
|||||||
{},
|
{},
|
||||||
bodyshop && bodyshop.imexshopid
|
bodyshop && bodyshop.imexshopid
|
||||||
);
|
);
|
||||||
const [betaSwitch, setBetaSwitch] = useState(false);
|
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const isBeta = checkBeta();
|
|
||||||
setBetaSwitch(isBeta);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const betaSwitchChange = (checked) => {
|
|
||||||
setBeta(checked);
|
|
||||||
setBetaSwitch(checked);
|
|
||||||
handleBeta();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout.Header>
|
<Layout.Header>
|
||||||
<Menu
|
<Menu
|
||||||
@@ -444,17 +431,6 @@ function Header({
|
|||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
))}
|
))}
|
||||||
</Menu.SubMenu>
|
</Menu.SubMenu>
|
||||||
<Menu.Item style={{marginLeft: 'auto'}} key="profile">
|
|
||||||
<Tooltip title="A more modern ImEX Online is ready for you to try! You can switch back at any time.">
|
|
||||||
<InfoCircleOutlined/>
|
|
||||||
<span style={{marginRight: 8}}>Try the new ImEX Online</span>
|
|
||||||
<Switch
|
|
||||||
checked={betaSwitch}
|
|
||||||
onChange={betaSwitchChange}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
</Menu.Item>
|
|
||||||
|
|
||||||
</Menu>
|
</Menu>
|
||||||
</Layout.Header>
|
</Layout.Header>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,31 +7,21 @@ import { connect } from "react-redux";
|
|||||||
import { useHistory } from "react-router";
|
import { useHistory } from "react-router";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { UPDATE_JOB_LINES_IOU } from "../../graphql/jobs-lines.queries";
|
import { UPDATE_JOB_LINES_IOU } from "../../graphql/jobs-lines.queries";
|
||||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
|
||||||
import {
|
import {
|
||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
import { CreateIouForJob } from "../jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util";
|
import { CreateIouForJob } from "../jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
technician: selectTechnician,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
});
|
});
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCreateIOU);
|
export default connect(mapStateToProps, mapDispatchToProps)(JobCreateIOU);
|
||||||
|
|
||||||
export function JobCreateIOU({
|
export function JobCreateIOU({ bodyshop, currentUser, job, selectedJobLines }) {
|
||||||
bodyshop,
|
|
||||||
currentUser,
|
|
||||||
job,
|
|
||||||
selectedJobLines,
|
|
||||||
technician,
|
|
||||||
}) {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
@@ -89,19 +79,13 @@ export function JobCreateIOU({
|
|||||||
title={t("jobs.labels.createiouwarning")}
|
title={t("jobs.labels.createiouwarning")}
|
||||||
onConfirm={handleCreateIou}
|
onConfirm={handleCreateIou}
|
||||||
disabled={
|
disabled={
|
||||||
!selectedJobLines ||
|
!selectedJobLines || selectedJobLines.length === 0 || !job.converted
|
||||||
selectedJobLines.length === 0 ||
|
|
||||||
!job.converted ||
|
|
||||||
technician
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
loading={loading}
|
loading={loading}
|
||||||
disabled={
|
disabled={
|
||||||
!selectedJobLines ||
|
!selectedJobLines || selectedJobLines.length === 0 || !job.converted
|
||||||
selectedJobLines.length === 0 ||
|
|
||||||
!job.converted ||
|
|
||||||
technician
|
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{t("jobs.actions.createiou")}
|
{t("jobs.actions.createiou")}
|
||||||
|
|||||||
@@ -108,14 +108,6 @@ export function JobsDetailHeaderActions({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
insertAuditTrail({
|
|
||||||
jobid: job.id,
|
|
||||||
operation: AuditTrailMapping.alertToggle(
|
|
||||||
!!job.production_vars && !!job.production_vars.alert
|
|
||||||
? !job.production_vars.alert
|
|
||||||
: true
|
|
||||||
),
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSuspend = (e) => {
|
const handleSuspend = (e) => {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
BranchesOutlined,
|
|
||||||
ExclamationCircleFilled,
|
ExclamationCircleFilled,
|
||||||
PauseCircleOutlined,
|
PauseCircleOutlined,
|
||||||
WarningFilled,
|
WarningFilled,
|
||||||
|
BranchesOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { Card, Col, Row, Space, Tag, Tooltip } from "antd";
|
import { Card, Col, Row, Space, Tag, Tooltip } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
@@ -221,14 +221,6 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
|||||||
<VehicleVinDisplay>
|
<VehicleVinDisplay>
|
||||||
{`${job.v_vin || t("general.labels.na")}`}
|
{`${job.v_vin || t("general.labels.na")}`}
|
||||||
</VehicleVinDisplay>
|
</VehicleVinDisplay>
|
||||||
{bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid ? (
|
|
||||||
job.v_vin?.length !== 17 ? (
|
|
||||||
<WarningFilled style={{ color: "tomato", marginLeft: ".3rem" }} />
|
|
||||||
) : null
|
|
||||||
) : null}
|
|
||||||
</DataLabel>
|
|
||||||
<DataLabel label={t("jobs.fields.regie_number")}>
|
|
||||||
{job.regie_number || t("general.labels.na")}
|
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
<DataLabel label={t("jobs.labels.relatedros")}>
|
<DataLabel label={t("jobs.labels.relatedros")}>
|
||||||
<JobsRelatedRos jobid={job.id} job={job} />
|
<JobsRelatedRos jobid={job.id} job={job} />
|
||||||
|
|||||||
@@ -1,105 +1,117 @@
|
|||||||
import {
|
import {BranchesOutlined, ExclamationCircleFilled, PauseCircleOutlined, SyncOutlined,} from "@ant-design/icons";
|
||||||
SyncOutlined,
|
import {useQuery} from "@apollo/client";
|
||||||
ExclamationCircleFilled,
|
import {Button, Card, Grid, Input, Space, Table, Tooltip, Typography} from "antd";
|
||||||
PauseCircleOutlined,
|
|
||||||
BranchesOutlined,
|
|
||||||
} from "@ant-design/icons";
|
|
||||||
import { useQuery } from "@apollo/client";
|
|
||||||
import { Button, Card, Grid, Input, Space, Table, Tooltip } from "antd";
|
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useState } from "react";
|
import React, {useEffect, useState} from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import {useTranslation} from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import {connect} from "react-redux";
|
||||||
import { Link, useHistory, useLocation } from "react-router-dom";
|
import {Link, useHistory, useLocation} from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import {createStructuredSelector} from "reselect";
|
||||||
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
import {QUERY_ALL_ACTIVE_JOBS_PAGINATED} from "../../graphql/jobs.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||||
import { onlyUnique } from "../../utils/arrayHelper";
|
import {onlyUnique} from "../../utils/arrayHelper";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
|
import {flattenDeep} from "lodash";
|
||||||
|
import { pageLimit } from '../../utils/config';
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobsList({ bodyshop }) {
|
const mapDispatchToProps = () => ({
|
||||||
const searchParams = queryString.parse(useLocation().search);
|
});
|
||||||
const { selected } = searchParams;
|
|
||||||
|
export function JobsList({bodyshop,}) {
|
||||||
|
const search = queryString.parse(useLocation().search);
|
||||||
|
const [openSearchResults, setOpenSearchResults] = useState([]);
|
||||||
|
const [searchLoading, setSearchLoading] = useState(false);
|
||||||
|
const {page, selected, sortorder, sortcolumn,statusFilters} = search;
|
||||||
|
|
||||||
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
||||||
.filter((screen) => !!screen[1])
|
.filter((screen) => !!screen[1])
|
||||||
.slice(-1)[0];
|
.slice(-1)[0];
|
||||||
const { loading, error, data, refetch } = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
|
||||||
|
const {loading, error, data, refetch} = useQuery(QUERY_ALL_ACTIVE_JOBS_PAGINATED, {
|
||||||
variables: {
|
variables: {
|
||||||
statuses: bodyshop.md_ro_statuses.active_statuses || ["Open", "Open*"],
|
offset: page ? (page - 1) * pageLimit : 0,
|
||||||
|
limit: pageLimit,
|
||||||
|
statusFilters: statusFilters ? JSON.parse(statusFilters) : bodyshop.md_ro_statuses.active_statuses || ["Open", "Open*"],
|
||||||
|
order: [
|
||||||
|
{
|
||||||
|
[sortcolumn || "ro_number"]:
|
||||||
|
sortorder && sortorder !== "false"
|
||||||
|
? (sortorder === "descend"
|
||||||
|
? "desc"
|
||||||
|
: "asc")
|
||||||
|
: "desc",
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const total = data?.jobs_aggregate?.aggregate?.count || 0;
|
||||||
|
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
sortedInfo: {},
|
filteredInfo: {text: ""},
|
||||||
filteredInfo: { text: "" },
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const {t} = useTranslation();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const [searchText, setSearchText] = useState("");
|
|
||||||
|
|
||||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
const jobs = data?.jobs || [];
|
||||||
|
|
||||||
const jobs = data
|
|
||||||
? searchText === ""
|
|
||||||
? data.jobs
|
|
||||||
: data.jobs.filter(
|
|
||||||
(j) =>
|
|
||||||
(j.ro_number || "")
|
|
||||||
.toString()
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchText.toLowerCase()) ||
|
|
||||||
(j.ownr_co_nm || "")
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchText.toLowerCase()) ||
|
|
||||||
(j.comments || "")
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchText.toLowerCase()) ||
|
|
||||||
(j.ownr_fn || "")
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchText.toLowerCase()) ||
|
|
||||||
(j.ownr_ln || "")
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchText.toLowerCase()) ||
|
|
||||||
(j.clm_no || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
|
||||||
(j.plate_no || "")
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchText.toLowerCase()) ||
|
|
||||||
(j.v_model_desc || "")
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchText.toLowerCase()) ||
|
|
||||||
(j.est_ct_fn || "")
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchText.toLowerCase()) ||
|
|
||||||
(j.est_ct_ln || "")
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchText.toLowerCase()) ||
|
|
||||||
(j.v_make_desc || "")
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchText.toLowerCase())
|
|
||||||
)
|
|
||||||
: [];
|
|
||||||
|
|
||||||
const handleTableChange = (pagination, filters, sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
search.page = pagination.current;
|
||||||
|
search.sortcolumn = sorter.column && sorter.column.key;
|
||||||
|
search.sortorder = sorter.order;
|
||||||
|
|
||||||
|
if (filters.status) {
|
||||||
|
search.statusFilters = JSON.stringify(flattenDeep(filters.status));
|
||||||
|
} else {
|
||||||
|
delete search.statusFilters;
|
||||||
|
}
|
||||||
|
|
||||||
|
history.push({search: queryString.stringify(search)});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (search.search && search.search.trim() !== "") {
|
||||||
|
searchJobs().catch(e => {
|
||||||
|
console.error('Something went wrong searching for jobs in the job-list component', e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||||
|
|
||||||
|
async function searchJobs(value) {
|
||||||
|
try {
|
||||||
|
setSearchLoading(true);
|
||||||
|
const searchData = await axios.post("/search", {
|
||||||
|
search: value || search.search,
|
||||||
|
index: "jobs",
|
||||||
|
});
|
||||||
|
setOpenSearchResults(searchData.data.hits.hits.map((s) => s._source));
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Error while fetching search results", error);
|
||||||
|
} finally {
|
||||||
|
setSearchLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const handleOnRowClick = (record) => {
|
const handleOnRowClick = (record) => {
|
||||||
if (record) {
|
if (record) {
|
||||||
if (record.id) {
|
if (record.id) {
|
||||||
history.push({
|
history.push({
|
||||||
search: queryString.stringify({
|
search: queryString.stringify({
|
||||||
...searchParams,
|
...search,
|
||||||
selected: record.id,
|
selected: record.id,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@@ -112,11 +124,9 @@ export function JobsList({ bodyshop }) {
|
|||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
dataIndex: "ro_number",
|
dataIndex: "ro_number",
|
||||||
key: "ro_number",
|
key: "ro_number",
|
||||||
sorter: (a, b) =>
|
sorter: true,
|
||||||
parseInt((a.ro_number || "0").replace(/\D/g, "")) -
|
|
||||||
parseInt((b.ro_number || "0").replace(/\D/g, "")),
|
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
sortcolumn === "ro_number" && sortorder,
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link
|
<Link
|
||||||
@@ -126,14 +136,14 @@ export function JobsList({ bodyshop }) {
|
|||||||
<Space>
|
<Space>
|
||||||
{record.ro_number || t("general.labels.na")}
|
{record.ro_number || t("general.labels.na")}
|
||||||
{record.production_vars && record.production_vars.alert ? (
|
{record.production_vars && record.production_vars.alert ? (
|
||||||
<ExclamationCircleFilled className="production-alert" />
|
<ExclamationCircleFilled className="production-alert"/>
|
||||||
) : null}
|
) : null}
|
||||||
{record.suspended && (
|
{record.suspended && (
|
||||||
<PauseCircleOutlined style={{ color: "orangered" }} />
|
<PauseCircleOutlined style={{color: "orangered"}}/>
|
||||||
)}
|
)}
|
||||||
{record.iouparent && (
|
{record.iouparent && (
|
||||||
<Tooltip title={t("jobs.labels.iou")}>
|
<Tooltip title={t("jobs.labels.iou")}>
|
||||||
<BranchesOutlined style={{ color: "orangered" }} />
|
<BranchesOutlined style={{color: "orangered"}}/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
@@ -145,22 +155,20 @@ export function JobsList({ bodyshop }) {
|
|||||||
dataIndex: "owner",
|
dataIndex: "owner",
|
||||||
key: "owner",
|
key: "owner",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
sorter: false,
|
||||||
sortOrder:
|
sortOrder: sortcolumn === "owner" && sortorder,
|
||||||
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.ownerid ? (
|
return record.ownerid ? (
|
||||||
<Link
|
<Link
|
||||||
to={"/manage/owners/" + record.ownerid}
|
to={"/manage/owners/" + record.ownerid}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
<OwnerNameDisplay ownerObject={record}/>
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<span>
|
<span>
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
<OwnerNameDisplay ownerObject={record}/>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -172,7 +180,7 @@ export function JobsList({ bodyshop }) {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<ChatOpenButton phone={record.ownr_ph1} jobid={record.id} />
|
<ChatOpenButton phone={record.ownr_ph1} jobid={record.id}/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -182,7 +190,7 @@ export function JobsList({ bodyshop }) {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<ChatOpenButton phone={record.ownr_ph2} jobid={record.id} />
|
<ChatOpenButton phone={record.ownr_ph2} jobid={record.id}/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -191,25 +199,17 @@ export function JobsList({ bodyshop }) {
|
|||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
key: "status",
|
key: "status",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
sorter: true,
|
||||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
sortcolumn === "status" && sortorder,
|
||||||
filters:
|
filters:bodyshop.md_ro_statuses.statuses.map((s) => {
|
||||||
(jobs &&
|
return { text: s, value: [s] };
|
||||||
jobs
|
}),
|
||||||
.map((j) => j.status)
|
|
||||||
.filter(onlyUnique)
|
|
||||||
.map((s) => {
|
|
||||||
return {
|
|
||||||
text: s || "No Status*",
|
|
||||||
value: [s],
|
|
||||||
};
|
|
||||||
})) ||
|
|
||||||
[],
|
|
||||||
onFilter: (value, record) => value.includes(record.status),
|
onFilter: (value, record) => value.includes(record.status),
|
||||||
|
render: (text, record) => {
|
||||||
|
return record.status || t("general.labels.na");
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.vehicle"),
|
title: t("jobs.fields.vehicle"),
|
||||||
dataIndex: "vehicle",
|
dataIndex: "vehicle",
|
||||||
@@ -237,11 +237,10 @@ export function JobsList({ bodyshop }) {
|
|||||||
dataIndex: "plate_no",
|
dataIndex: "plate_no",
|
||||||
key: "plate_no",
|
key: "plate_no",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
sorter: (a, b) => alphaSort(a.plate_no, b.plate_no),
|
sorter: true,
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "plate_no" && state.sortedInfo.order,
|
sortcolumn === "plate_no" && sortorder,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.clm_no"),
|
title: t("jobs.fields.clm_no"),
|
||||||
@@ -249,9 +248,9 @@ export function JobsList({ bodyshop }) {
|
|||||||
key: "clm_no",
|
key: "clm_no",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
|
sorter: true,
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order,
|
sortcolumn === "clm_no" && sortorder,
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
`${record.clm_no || ""}${
|
`${record.clm_no || ""}${
|
||||||
record.po_number ? ` (PO: ${record.po_number})` : ""
|
record.po_number ? ` (PO: ${record.po_number})` : ""
|
||||||
@@ -262,19 +261,20 @@ export function JobsList({ bodyshop }) {
|
|||||||
dataIndex: "ins_co_nm",
|
dataIndex: "ins_co_nm",
|
||||||
key: "ins_co_nm",
|
key: "ins_co_nm",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
filters:
|
// TODO: Restore Filters?
|
||||||
(jobs &&
|
// filters:
|
||||||
jobs
|
// (jobs &&
|
||||||
.map((j) => j.ins_co_nm)
|
// jobs
|
||||||
.filter(onlyUnique)
|
// .map((j) => j.ins_co_nm)
|
||||||
.map((s) => {
|
// .filter(onlyUnique)
|
||||||
return {
|
// .map((s) => {
|
||||||
text: s,
|
// return {
|
||||||
value: [s],
|
// text: s,
|
||||||
};
|
// value: [s],
|
||||||
})) ||
|
// };
|
||||||
[],
|
// })) ||
|
||||||
onFilter: (value, record) => value.includes(record.ins_co_nm),
|
// [],
|
||||||
|
// onFilter: (value, record) => value.includes(record.ins_co_nm),
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -283,10 +283,9 @@ export function JobsList({ bodyshop }) {
|
|||||||
key: "clm_total",
|
key: "clm_total",
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
sorter: true,
|
||||||
sorter: (a, b) => a.clm_total - b.clm_total,
|
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "clm_total" && state.sortedInfo.order,
|
sortcolumn === "clm_total" && sortorder,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<CurrencyFormatter>{record.clm_total}</CurrencyFormatter>
|
<CurrencyFormatter>{record.clm_total}</CurrencyFormatter>
|
||||||
),
|
),
|
||||||
@@ -297,23 +296,24 @@ export function JobsList({ bodyshop }) {
|
|||||||
key: "jobs.labels.estimator",
|
key: "jobs.labels.estimator",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["xl"],
|
responsive: ["xl"],
|
||||||
filterSearch: true,
|
// TODO Restore Filters?
|
||||||
filters:
|
// filterSearch: true,
|
||||||
(jobs &&
|
// filters:
|
||||||
jobs
|
// (jobs &&
|
||||||
.map((j) => `${j.est_ct_fn || ""} ${j.est_ct_ln || ""}`.trim())
|
// jobs
|
||||||
.filter(onlyUnique)
|
// .map((j) => `${j.est_ct_fn || ""} ${j.est_ct_ln || ""}`.trim())
|
||||||
.map((s) => {
|
// .filter(onlyUnique)
|
||||||
return {
|
// .map((s) => {
|
||||||
text: s || "N/A",
|
// return {
|
||||||
value: [s],
|
// text: s || "N/A",
|
||||||
};
|
// value: [s],
|
||||||
})) ||
|
// };
|
||||||
[],
|
// })) ||
|
||||||
onFilter: (value, record) =>
|
// [],
|
||||||
value.includes(
|
// onFilter: (value, record) =>
|
||||||
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim()
|
// value.includes(
|
||||||
),
|
// `${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim()
|
||||||
|
// ),
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim(),
|
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim(),
|
||||||
},
|
},
|
||||||
@@ -349,26 +349,57 @@ export function JobsList({ bodyshop }) {
|
|||||||
title={t("titles.bc.jobs-active")}
|
title={t("titles.bc.jobs-active")}
|
||||||
extra={
|
extra={
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
|
{search.search && (
|
||||||
|
<>
|
||||||
|
<Typography.Title level={4}>
|
||||||
|
{t("general.labels.searchresults", { search: search.search })}
|
||||||
|
</Typography.Title>
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
delete search.search;
|
||||||
|
delete search.page;
|
||||||
|
history.push({ search: queryString.stringify(search) });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("general.actions.clear")}
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<Button onClick={() => refetch()}>
|
<Button onClick={() => refetch()}>
|
||||||
<SyncOutlined />
|
<SyncOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
<Input.Search
|
<Input.Search
|
||||||
placeholder={t("general.labels.search")}
|
placeholder={search.search || t("general.labels.search")}
|
||||||
onChange={(e) => {
|
onSearch={(value) => {
|
||||||
setSearchText(e.target.value);
|
search.search = value;
|
||||||
|
history.push({ search: queryString.stringify(search) });
|
||||||
|
searchJobs(value);
|
||||||
}}
|
}}
|
||||||
value={searchText}
|
loading={loading || searchLoading}
|
||||||
enterButton
|
enterButton
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Table
|
<Table
|
||||||
loading={loading}
|
loading={loading || searchLoading }
|
||||||
pagination={{ defaultPageSize: 50 }}
|
pagination={
|
||||||
|
search?.search
|
||||||
|
? {
|
||||||
|
pageSize: pageLimit,
|
||||||
|
showSizeChanger: false,
|
||||||
|
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
pageSize: pageLimit,
|
||||||
|
current: parseInt(page || 1),
|
||||||
|
total: total,
|
||||||
|
showSizeChanger: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
dataSource={jobs}
|
dataSource={search?.search ? openSearchResults : jobs}
|
||||||
scroll={{
|
scroll={{
|
||||||
x: selectedBreakpoint ? scrollMapper[selectedBreakpoint[0]] : "100%",
|
x: selectedBreakpoint ? scrollMapper[selectedBreakpoint[0]] : "100%",
|
||||||
}}
|
}}
|
||||||
@@ -380,9 +411,9 @@ export function JobsList({ bodyshop }) {
|
|||||||
type: "radio",
|
type: "radio",
|
||||||
}}
|
}}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
onRow={(record, rowIndex) => {
|
onRow={(record) => {
|
||||||
return {
|
return {
|
||||||
onClick: (event) => {
|
onClick: () => {
|
||||||
handleOnRowClick(record);
|
handleOnRowClick(record);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -392,4 +423,4 @@ export function JobsList({ bodyshop }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(JobsList);
|
export default connect(mapStateToProps, mapDispatchToProps)(JobsList);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Button, Dropdown, Menu } from "antd";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { Button, Dropdown, Menu } from "antd";
|
||||||
import dataSource from "./production-list-columns.data";
|
import dataSource from "./production-list-columns.data";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
@@ -24,7 +24,6 @@ export function ProductionColumnsComponent({
|
|||||||
columnState,
|
columnState,
|
||||||
technician,
|
technician,
|
||||||
bodyshop,
|
bodyshop,
|
||||||
data,
|
|
||||||
tableState,
|
tableState,
|
||||||
}) {
|
}) {
|
||||||
const [columns, setColumns] = columnState;
|
const [columns, setColumns] = columnState;
|
||||||
@@ -37,7 +36,6 @@ export function ProductionColumnsComponent({
|
|||||||
bodyshop,
|
bodyshop,
|
||||||
technician,
|
technician,
|
||||||
state: tableState,
|
state: tableState,
|
||||||
data: data,
|
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
}).filter((i) => i.key === e.key),
|
}).filter((i) => i.key === e.key),
|
||||||
]);
|
]);
|
||||||
@@ -48,7 +46,6 @@ export function ProductionColumnsComponent({
|
|||||||
technician,
|
technician,
|
||||||
state: tableState,
|
state: tableState,
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
data: data,
|
|
||||||
});
|
});
|
||||||
const menu = (
|
const menu = (
|
||||||
<Menu
|
<Menu
|
||||||
|
|||||||
@@ -1,23 +1,12 @@
|
|||||||
import { ExclamationCircleFilled } from "@ant-design/icons";
|
import { ExclamationCircleFilled } from "@ant-design/icons";
|
||||||
import { useMutation } from "@apollo/client";
|
|
||||||
import { Dropdown, Menu } from "antd";
|
import { Dropdown, Menu } 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 { useMutation } from "@apollo/client";
|
||||||
import { createStructuredSelector } from "reselect";
|
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({});
|
export default function ProductionListColumnAlert({ record }) {
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
|
||||||
});
|
|
||||||
|
|
||||||
export function ProductionListColumnAlert({ record, insertAuditTrail }) {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const [updateAlert] = useMutation(UPDATE_JOB);
|
const [updateAlert] = useMutation(UPDATE_JOB);
|
||||||
@@ -38,14 +27,6 @@ export function ProductionListColumnAlert({ record, insertAuditTrail }) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
|
||||||
insertAuditTrail({
|
|
||||||
jobid: record.id,
|
|
||||||
operation: AuditTrailMapping.alertToggle(
|
|
||||||
!!record.production_vars && !!record.production_vars.alert
|
|
||||||
? !record.production_vars.alert
|
|
||||||
: true
|
|
||||||
),
|
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
if (record.refetch) record.refetch();
|
if (record.refetch) record.refetch();
|
||||||
});
|
});
|
||||||
@@ -77,8 +58,3 @@ export function ProductionListColumnAlert({ record, insertAuditTrail }) {
|
|||||||
</Dropdown>
|
</Dropdown>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps
|
|
||||||
)(ProductionListColumnAlert);
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BranchesOutlined, PauseCircleOutlined } from "@ant-design/icons";
|
import { PauseCircleOutlined, BranchesOutlined } from "@ant-design/icons";
|
||||||
import { Space, Tooltip } from "antd";
|
import { Space, Tooltip } from "antd";
|
||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
@@ -6,7 +6,6 @@ import { Link } from "react-router-dom";
|
|||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { TimeFormatter } from "../../utils/DateFormatter";
|
import { TimeFormatter } from "../../utils/DateFormatter";
|
||||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
import PhoneFormatter from "../../utils/PhoneFormatter";
|
||||||
import { onlyUnique } from "../../utils/arrayHelper";
|
|
||||||
import { alphaSort, dateSort, statusSort } from "../../utils/sorters";
|
import { alphaSort, dateSort, statusSort } from "../../utils/sorters";
|
||||||
import JobAltTransportChange from "../job-at-change/job-at-change.component";
|
import JobAltTransportChange from "../job-at-change/job-at-change.component";
|
||||||
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component";
|
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component";
|
||||||
@@ -26,7 +25,7 @@ import ProductionListColumnCategory from "./production-list-columns.status.categ
|
|||||||
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
||||||
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
||||||
|
|
||||||
const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.actions.viewdetail"),
|
title: i18n.t("jobs.actions.viewdetail"),
|
||||||
@@ -537,36 +536,6 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
<JobPartsQueueCount parts={record.joblines_status} record={record} />
|
<JobPartsQueueCount parts={record.joblines_status} record={record} />
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: i18n.t("jobs.labels.estimator"),
|
|
||||||
dataIndex: "estimator",
|
|
||||||
key: "estimator",
|
|
||||||
sorter: (a, b) =>
|
|
||||||
alphaSort(
|
|
||||||
`${a.est_ct_fn || ""} ${a.est_ct_ln || ""}`.trim(),
|
|
||||||
`${b.est_ct_fn || ""} ${b.est_ct_ln || ""}`.trim()
|
|
||||||
),
|
|
||||||
sortOrder:
|
|
||||||
state.sortedInfo.columnKey === "estimator" && state.sortedInfo.order,
|
|
||||||
filters:
|
|
||||||
(data &&
|
|
||||||
data
|
|
||||||
.map((j) => `${j.est_ct_fn || ""} ${j.est_ct_ln || ""}`.trim())
|
|
||||||
.filter(onlyUnique)
|
|
||||||
.map((s) => {
|
|
||||||
return {
|
|
||||||
text: s || "N/A",
|
|
||||||
value: [s],
|
|
||||||
};
|
|
||||||
})) ||
|
|
||||||
[],
|
|
||||||
onFilter: (value, record) =>
|
|
||||||
value.includes(
|
|
||||||
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim()
|
|
||||||
),
|
|
||||||
render: (text, record) =>
|
|
||||||
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim(),
|
|
||||||
},
|
|
||||||
|
|
||||||
//Added as a place holder for St Claude. Not implemented as it requires another join for a field used by only 1 client.
|
//Added as a place holder for St Claude. Not implemented as it requires another join for a field used by only 1 client.
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ export function ProductionListTable({
|
|||||||
technician,
|
technician,
|
||||||
currentUser,
|
currentUser,
|
||||||
state,
|
state,
|
||||||
data,
|
|
||||||
setColumns,
|
setColumns,
|
||||||
setState,
|
setState,
|
||||||
}) {
|
}) {
|
||||||
@@ -42,7 +41,6 @@ export function ProductionListTable({
|
|||||||
bodyshop,
|
bodyshop,
|
||||||
technician,
|
technician,
|
||||||
state,
|
state,
|
||||||
data: data,
|
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
}).find((e) => e.key === k.key),
|
}).find((e) => e.key === k.key),
|
||||||
width: k.width,
|
width: k.width,
|
||||||
@@ -97,7 +95,6 @@ export function ProductionListTable({
|
|||||||
...ProductionListColumns({
|
...ProductionListColumns({
|
||||||
technician,
|
technician,
|
||||||
state,
|
state,
|
||||||
data: data,
|
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
}).find((e) => e.key === k.key),
|
}).find((e) => e.key === k.key),
|
||||||
width: k.width,
|
width: k.width,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
Statistic,
|
Statistic,
|
||||||
Table,
|
Table,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import React, { useEffect, useMemo, useState } from "react";
|
import React, { useMemo, useState } from "react";
|
||||||
import ReactDragListView from "react-drag-listview";
|
import ReactDragListView from "react-drag-listview";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -79,7 +79,6 @@ export function ProductionListTable({
|
|||||||
bodyshop,
|
bodyshop,
|
||||||
technician,
|
technician,
|
||||||
state,
|
state,
|
||||||
data: data,
|
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
}).find((e) => e.key === k.key),
|
}).find((e) => e.key === k.key),
|
||||||
width: k.width ?? 100,
|
width: k.width ?? 100,
|
||||||
@@ -88,33 +87,6 @@ export function ProductionListTable({
|
|||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const newColumns =
|
|
||||||
(state &&
|
|
||||||
matchingColumnConfig &&
|
|
||||||
matchingColumnConfig.columns.columnKeys.map((k) => {
|
|
||||||
return {
|
|
||||||
...ProductionListColumns({
|
|
||||||
bodyshop,
|
|
||||||
technician,
|
|
||||||
state,
|
|
||||||
data: data,
|
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
|
||||||
}).find((e) => e.key === k.key),
|
|
||||||
width: k.width ?? 100,
|
|
||||||
};
|
|
||||||
})) ||
|
|
||||||
[];
|
|
||||||
setColumns(newColumns);
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [
|
|
||||||
//state,
|
|
||||||
matchingColumnConfig,
|
|
||||||
bodyshop,
|
|
||||||
technician,
|
|
||||||
data,
|
|
||||||
]); //State removed from dependency array as it causes race condition when removing columns from table view and is not needed.
|
|
||||||
|
|
||||||
const handleTableChange = (pagination, filters, sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
setState({
|
setState({
|
||||||
...state,
|
...state,
|
||||||
@@ -132,8 +104,7 @@ export function ProductionListTable({
|
|||||||
|
|
||||||
const removeColumn = (e) => {
|
const removeColumn = (e) => {
|
||||||
const { key } = e;
|
const { key } = e;
|
||||||
const newColumns = columns.filter((i) => i.key !== key);
|
setColumns(columns.filter((i) => i.key !== key));
|
||||||
setColumns(newColumns);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleResize =
|
const handleResize =
|
||||||
@@ -256,7 +227,6 @@ export function ProductionListTable({
|
|||||||
<ProductionListColumnsAdd
|
<ProductionListColumnsAdd
|
||||||
columnState={[columns, setColumns]}
|
columnState={[columns, setColumns]}
|
||||||
tableState={state}
|
tableState={state}
|
||||||
data={data}
|
|
||||||
/>
|
/>
|
||||||
<ProductionListSaveConfigButton
|
<ProductionListSaveConfigButton
|
||||||
columns={columns}
|
columns={columns}
|
||||||
@@ -267,7 +237,6 @@ export function ProductionListTable({
|
|||||||
state={state}
|
state={state}
|
||||||
setState={setState}
|
setState={setState}
|
||||||
setColumns={setColumns}
|
setColumns={setColumns}
|
||||||
data={data}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
|
|||||||
@@ -55,11 +55,10 @@ const ret = {
|
|||||||
"shiftclock:view": 2,
|
"shiftclock:view": 2,
|
||||||
|
|
||||||
"shop:config": 4,
|
"shop:config": 4,
|
||||||
"shop:dashboard": 3,
|
|
||||||
"shop:rbac": 5,
|
"shop:rbac": 5,
|
||||||
"shop:reportcenter": 2,
|
|
||||||
"shop:templates": 4,
|
|
||||||
"shop:vendors": 2,
|
"shop:vendors": 2,
|
||||||
|
"shop:dashboard": 3,
|
||||||
|
"shop:templates": 4,
|
||||||
|
|
||||||
"temporarydocs:view": 2,
|
"temporarydocs:view": 2,
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { connect } from "react-redux";
|
|||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||||
import { selectReportCenter } from "../../redux/modals/modals.selectors";
|
import { selectReportCenter } from "../../redux/modals/modals.selectors";
|
||||||
import RbacWrapperComponent from "../rbac-wrapper/rbac-wrapper.component";
|
|
||||||
import ReportCenterModalComponent from "./report-center-modal.component";
|
import ReportCenterModalComponent from "./report-center-modal.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
@@ -34,9 +33,7 @@ export function ReportCenterModalContainer({
|
|||||||
destroyOnClose
|
destroyOnClose
|
||||||
width="80%"
|
width="80%"
|
||||||
>
|
>
|
||||||
<RbacWrapperComponent action="shop:reportcenter">
|
<ReportCenterModalComponent />
|
||||||
<ReportCenterModalComponent />
|
|
||||||
</RbacWrapperComponent>
|
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export default connect(
|
|||||||
|
|
||||||
export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const startDate = moment().startOf("month");
|
const startDate = moment().startOf("month")
|
||||||
const endDate = moment().endOf("month");
|
const endDate = moment().endOf("month");
|
||||||
|
|
||||||
const fixedPeriods = useMemo(() => {
|
const fixedPeriods = useMemo(() => {
|
||||||
@@ -84,8 +84,6 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
|||||||
end: endDate.format("YYYY-MM-DD"),
|
end: endDate.format("YYYY-MM-DD"),
|
||||||
fixedStart: fixedPeriods.start.format("YYYY-MM-DD"),
|
fixedStart: fixedPeriods.start.format("YYYY-MM-DD"),
|
||||||
fixedEnd: fixedPeriods.end.format("YYYY-MM-DD"),
|
fixedEnd: fixedPeriods.end.format("YYYY-MM-DD"),
|
||||||
jobStart: startDate,
|
|
||||||
jobEnd: endDate,
|
|
||||||
},
|
},
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
@@ -342,21 +340,11 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
|||||||
larData.push({ ...r, ...lar });
|
larData.push({ ...r, ...lar });
|
||||||
});
|
});
|
||||||
|
|
||||||
const jobData = {};
|
|
||||||
data.jobs.forEach((job) => {
|
|
||||||
job.tthrs = job.joblines.reduce((acc, val) => acc + val.mod_lb_hrs, 0);
|
|
||||||
});
|
|
||||||
jobData.tthrs = data.jobs
|
|
||||||
.reduce((acc, val) => acc + val.tthrs, 0)
|
|
||||||
.toFixed(1);
|
|
||||||
jobData.count = data.jobs.length.toFixed(0);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
fixed: ret,
|
fixed: ret,
|
||||||
combinedData: combinedData,
|
combinedData: combinedData,
|
||||||
labData: labData,
|
labData: labData,
|
||||||
larData: larData,
|
larData: larData,
|
||||||
jobData: jobData,
|
|
||||||
};
|
};
|
||||||
}, [fixedPeriods, data, bodyshop]);
|
}, [fixedPeriods, data, bodyshop]);
|
||||||
|
|
||||||
@@ -368,10 +356,7 @@ export function ScoreboardTimeTicketsStats({ bodyshop }) {
|
|||||||
<ScoreboardTimeticketsTargetsTable />
|
<ScoreboardTimeticketsTargetsTable />
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<ScoreboardTicketsStats
|
<ScoreboardTicketsStats data={calculatedData.fixed} />
|
||||||
data={calculatedData.fixed}
|
|
||||||
jobData={calculatedData.jobData}
|
|
||||||
/>
|
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<ScoreboardTimeTicketsChart
|
<ScoreboardTimeTicketsChart
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ function useLocalStorage(key, initialValue) {
|
|||||||
return [storedValue, setStoredValue];
|
return [storedValue, setStoredValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ScoreboardTicketsStats({ data, jobData, bodyshop }) {
|
export function ScoreboardTicketsStats({ data, bodyshop }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [isLarge, setIsLarge] = useLocalStorage("isLargeStatistic", false);
|
const [isLarge, setIsLarge] = useLocalStorage("isLargeStatistic", false);
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ export function ScoreboardTicketsStats({ data, jobData, bodyshop }) {
|
|||||||
{/* Monthly Stats */}
|
{/* Monthly Stats */}
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
{/* This Month */}
|
{/* This Month */}
|
||||||
<Col span={7} align="center">
|
<Col span={8} align="center">
|
||||||
<Card size="small" title={t("scoreboard.labels.thismonth")}>
|
<Card size="small" title={t("scoreboard.labels.thismonth")}>
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
@@ -482,7 +482,7 @@ export function ScoreboardTicketsStats({ data, jobData, bodyshop }) {
|
|||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
{/* Last Month */}
|
{/* Last Month */}
|
||||||
<Col span={7} align="center">
|
<Col span={8} align="center">
|
||||||
<Card size="small" title={t("scoreboard.labels.lastmonth")}>
|
<Card size="small" title={t("scoreboard.labels.lastmonth")}>
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
@@ -556,7 +556,7 @@ export function ScoreboardTicketsStats({ data, jobData, bodyshop }) {
|
|||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
{/* Efficiency Over Period */}
|
{/* Efficiency Over Period */}
|
||||||
<Col span={7} align="center">
|
<Col span={8} align="center">
|
||||||
<Card
|
<Card
|
||||||
size="small"
|
size="small"
|
||||||
title={t("scoreboard.labels.efficiencyoverperiod")}
|
title={t("scoreboard.labels.efficiencyoverperiod")}
|
||||||
@@ -604,40 +604,6 @@ export function ScoreboardTicketsStats({ data, jobData, bodyshop }) {
|
|||||||
</Row>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={3} align="center">
|
|
||||||
<Card
|
|
||||||
size="small"
|
|
||||||
title={t("scoreboard.labels.jobscompletednotinvoiced")}
|
|
||||||
>
|
|
||||||
<Row gutter={[16, 16]}>
|
|
||||||
<Col span={24}>
|
|
||||||
<Statistic
|
|
||||||
value={jobData.count}
|
|
||||||
valueStyle={{
|
|
||||||
fontSize: statisticSize,
|
|
||||||
fontWeight: statisticWeight,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
<Row gutter={[16, 16]}>
|
|
||||||
<Col span={24}>
|
|
||||||
<Statistic
|
|
||||||
title={
|
|
||||||
<Typography.Text strong>
|
|
||||||
{t("scoreboard.labels.totalhrs")}
|
|
||||||
</Typography.Text>
|
|
||||||
}
|
|
||||||
value={jobData.tthrs}
|
|
||||||
valueStyle={{
|
|
||||||
fontSize: statisticSize,
|
|
||||||
fontWeight: statisticWeight,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
</Card>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
</Row>
|
||||||
</Space>
|
</Space>
|
||||||
{/* Disclaimer */}
|
{/* Disclaimer */}
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ export default function ScoreboardTimeTickets() {
|
|||||||
end: endDate.format("YYYY-MM-DD"),
|
end: endDate.format("YYYY-MM-DD"),
|
||||||
fixedStart: fixedPeriods.start.format("YYYY-MM-DD"),
|
fixedStart: fixedPeriods.start.format("YYYY-MM-DD"),
|
||||||
fixedEnd: fixedPeriods.end.format("YYYY-MM-DD"),
|
fixedEnd: fixedPeriods.end.format("YYYY-MM-DD"),
|
||||||
jobStart: startDate,
|
|
||||||
jobEnd: endDate,
|
|
||||||
},
|
},
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
|
|||||||
@@ -28,18 +28,6 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
return (
|
return (
|
||||||
<RbacWrapper action="shop:rbac">
|
<RbacWrapper action="shop:rbac">
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.accounting.exportlog")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "accounting:exportlog"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.accounting.payables")}
|
label={t("bodyshop.fields.rbac.accounting.payables")}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -52,6 +40,18 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.accounting.exportlog")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "accounting:exportlog"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.accounting.payments")}
|
label={t("bodyshop.fields.rbac.accounting.payments")}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -77,62 +77,26 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.bills.delete")}
|
label={t("bodyshop.fields.rbac.csi.page")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_rbac", "bills:delete"]}
|
name={["md_rbac", "csi:page"]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.bills.enter")}
|
label={t("bodyshop.fields.rbac.csi.export")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_rbac", "bills:enter"]}
|
name={["md_rbac", "csi:export"]}
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.bills.list")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "bills:list"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.bills.reexport")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "bills:reexport"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.bills.view")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "bills:view"]}
|
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -209,38 +173,26 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.csi.export")}
|
label={t("bodyshop.fields.rbac.jobs.list-active")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_rbac", "csi:export"]}
|
name={["md_rbac", "jobs:list-active"]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.csi.page")}
|
label={t("bodyshop.fields.rbac.jobs.list-ready")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_rbac", "csi:page"]}
|
name={["md_rbac", "jobs:list-ready"]}
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.employees.page")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "employees:page"]}
|
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -256,6 +208,30 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.jobs.partsqueue")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "jobs:partsqueue"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.jobs.list-all")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "jobs:list-all"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.jobs.available-list")}
|
label={t("bodyshop.fields.rbac.jobs.available-list")}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -269,14 +245,26 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.jobs.checklist-view")}
|
label={t("bodyshop.fields.rbac.jobs.create")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_rbac", "jobs:checklist-view"]}
|
name={["md_rbac", "jobs:create"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.jobs.intake")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "jobs:intake"]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -292,18 +280,6 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.jobs.create")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "jobs:create"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.jobs.deliver")}
|
label={t("bodyshop.fields.rbac.jobs.deliver")}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -329,62 +305,14 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.jobs.intake")}
|
label={t("bodyshop.fields.rbac.jobs.checklist-view")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_rbac", "jobs:intake"]}
|
name={["md_rbac", "jobs:checklist-view"]}
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.jobs.list-active")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "jobs:list-active"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.jobs.list-all")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "jobs:list-all"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.jobs.list-ready")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "jobs:list-ready"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.jobs.partsqueue")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "jobs:partsqueue"]}
|
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -401,14 +329,74 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.owners.detail")}
|
label={t("bodyshop.fields.rbac.bills.enter")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_rbac", "owners:detail"]}
|
name={["md_rbac", "bills:enter"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.bills.delete")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "bills:delete"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.bills.reexport")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "bills:reexport"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.bills.view")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "bills:view"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.bills.list")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "bills:list"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.employees.page")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "employees:page"]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -424,6 +412,18 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.owners.detail")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "owners:detail"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.payments.enter")}
|
label={t("bodyshop.fields.rbac.payments.enter")}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -448,30 +448,6 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.phonebook.edit")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "phonebook:edit"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.phonebook.view")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "phonebook:view"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.production.board")}
|
label={t("bodyshop.fields.rbac.production.board")}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -533,62 +509,26 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.shop.config")}
|
label={t("bodyshop.fields.rbac.timetickets.edit")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_rbac", "shop:config"]}
|
name={["md_rbac", "timetickets:edit"]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.shop.dashboard")}
|
label={t("bodyshop.fields.rbac.timetickets.shiftedit")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_rbac", "shop:dashboard"]}
|
name={["md_rbac", "timetickets:shiftedit"]}
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.shop.rbac")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "shop:rbac"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.shop.reportcenter")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "shop:reportcenter"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.shop.templates")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "shop:templates"]}
|
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -605,26 +545,50 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.temporarydocs.view")}
|
label={t("bodyshop.fields.rbac.shop.dashboard")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_rbac", "temporarydocs:view"]}
|
name={["md_rbac", "shop:dashboard"]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.timetickets.edit")}
|
label={t("bodyshop.fields.rbac.shop.config")}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
//message: t("general.validation.required"),
|
//message: t("general.validation.required"),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
name={["md_rbac", "timetickets:edit"]}
|
name={["md_rbac", "shop:config"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.shop.rbac")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "shop:rbac"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.shop.templates")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "shop:templates"]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -652,18 +616,6 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
|
||||||
label={t("bodyshop.fields.rbac.timetickets.shiftedit")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
name={["md_rbac", "timetickets:shiftedit"]}
|
|
||||||
>
|
|
||||||
<InputNumber />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bodyshop.fields.rbac.users.editaccess")}
|
label={t("bodyshop.fields.rbac.users.editaccess")}
|
||||||
rules={[
|
rules={[
|
||||||
@@ -676,6 +628,42 @@ export function ShopInfoRbacComponent({ form, bodyshop }) {
|
|||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.temporarydocs.view")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "temporarydocs:view"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.phonebook.view")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "phonebook:view"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
label={t("bodyshop.fields.rbac.phonebook.edit")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "phonebook:edit"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>
|
||||||
{Simple_Inventory.treatment === "on" && (
|
{Simple_Inventory.treatment === "on" && (
|
||||||
<>
|
<>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
|||||||
@@ -30,15 +30,15 @@ export const QUERY_AVAILABLE_CC = gql`
|
|||||||
fuel
|
fuel
|
||||||
id
|
id
|
||||||
make
|
make
|
||||||
mileage
|
|
||||||
model
|
model
|
||||||
|
plate
|
||||||
|
status
|
||||||
|
year
|
||||||
|
dailycost
|
||||||
|
mileage
|
||||||
notes
|
notes
|
||||||
nextservicekm
|
nextservicekm
|
||||||
nextservicedate
|
nextservicedate
|
||||||
plate
|
|
||||||
readiness
|
|
||||||
status
|
|
||||||
year
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@@ -68,20 +68,19 @@ export const QUERY_ALL_CC = gql`
|
|||||||
insuranceexpires
|
insuranceexpires
|
||||||
leaseenddate
|
leaseenddate
|
||||||
make
|
make
|
||||||
mileage
|
|
||||||
model
|
model
|
||||||
nextservicedate
|
nextservicedate
|
||||||
nextservicekm
|
nextservicekm
|
||||||
notes
|
notes
|
||||||
plate
|
plate
|
||||||
purchasedate
|
purchasedate
|
||||||
readiness
|
|
||||||
registrationexpires
|
registrationexpires
|
||||||
serviceenddate
|
serviceenddate
|
||||||
servicestartdate
|
servicestartdate
|
||||||
status
|
status
|
||||||
vin
|
vin
|
||||||
year
|
year
|
||||||
|
mileage
|
||||||
cccontracts(
|
cccontracts(
|
||||||
where: { status: { _eq: "contracts.status.out" } }
|
where: { status: { _eq: "contracts.status.out" } }
|
||||||
order_by: { contract_date: desc }
|
order_by: { contract_date: desc }
|
||||||
@@ -91,10 +90,10 @@ export const QUERY_ALL_CC = gql`
|
|||||||
scheduledreturn
|
scheduledreturn
|
||||||
job {
|
job {
|
||||||
id
|
id
|
||||||
|
ro_number
|
||||||
ownr_fn
|
ownr_fn
|
||||||
ownr_ln
|
ownr_ln
|
||||||
ownr_co_nm
|
ownr_co_nm
|
||||||
ro_number
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,20 +119,19 @@ export const QUERY_CC_BY_PK = gql`
|
|||||||
insuranceexpires
|
insuranceexpires
|
||||||
leaseenddate
|
leaseenddate
|
||||||
make
|
make
|
||||||
mileage
|
|
||||||
model
|
model
|
||||||
nextservicedate
|
nextservicedate
|
||||||
nextservicekm
|
nextservicekm
|
||||||
notes
|
notes
|
||||||
plate
|
plate
|
||||||
purchasedate
|
purchasedate
|
||||||
readiness
|
|
||||||
registrationexpires
|
registrationexpires
|
||||||
serviceenddate
|
serviceenddate
|
||||||
servicestartdate
|
servicestartdate
|
||||||
status
|
status
|
||||||
vin
|
vin
|
||||||
year
|
year
|
||||||
|
mileage
|
||||||
cccontracts_aggregate {
|
cccontracts_aggregate {
|
||||||
aggregate {
|
aggregate {
|
||||||
count(distinct: true)
|
count(distinct: true)
|
||||||
@@ -141,20 +139,21 @@ export const QUERY_CC_BY_PK = gql`
|
|||||||
}
|
}
|
||||||
cccontracts(offset: $offset, limit: $limit, order_by: $order) {
|
cccontracts(offset: $offset, limit: $limit, order_by: $order) {
|
||||||
agreementnumber
|
agreementnumber
|
||||||
driver_fn
|
|
||||||
driver_ln
|
|
||||||
id
|
id
|
||||||
|
status
|
||||||
|
start
|
||||||
|
scheduledreturn
|
||||||
kmstart
|
kmstart
|
||||||
kmend
|
kmend
|
||||||
scheduledreturn
|
driver_ln
|
||||||
start
|
driver_fn
|
||||||
status
|
|
||||||
job {
|
job {
|
||||||
id
|
ro_number
|
||||||
|
|
||||||
ownr_ln
|
ownr_ln
|
||||||
ownr_fn
|
ownr_fn
|
||||||
ownr_co_nm
|
ownr_co_nm
|
||||||
ro_number
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ export const QUERY_ALL_ACTIVE_JOBS_PAGINATED = gql`
|
|||||||
$offset: Int
|
$offset: Int
|
||||||
$limit: Int
|
$limit: Int
|
||||||
$order: [jobs_order_by!]
|
$order: [jobs_order_by!]
|
||||||
$statuses: [String!]!,
|
$statusFilters: [String!]!,
|
||||||
$isConverted: Boolean
|
$isConverted: Boolean
|
||||||
) {
|
) {
|
||||||
jobs(
|
jobs(
|
||||||
offset: $offset
|
offset: $offset
|
||||||
limit: $limit
|
limit: $limit
|
||||||
where: { status: { _in: $statuses }, converted: { _eq: $isConverted } }
|
where: { status: { _in: $statusFilters }, converted: { _eq: $isConverted } }
|
||||||
order_by: $order
|
order_by: $order
|
||||||
) {
|
) {
|
||||||
iouparent
|
iouparent
|
||||||
@@ -52,7 +52,7 @@ export const QUERY_ALL_ACTIVE_JOBS_PAGINATED = gql`
|
|||||||
est_ct_fn
|
est_ct_fn
|
||||||
est_ct_ln
|
est_ct_ln
|
||||||
}
|
}
|
||||||
jobs_aggregate(where: { status: { _in: $statuses } }) {
|
jobs_aggregate(where: { status: { _in: $statusFilters } }) {
|
||||||
aggregate {
|
aggregate {
|
||||||
count(distinct: true)
|
count(distinct: true)
|
||||||
}
|
}
|
||||||
@@ -364,8 +364,6 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
|
|||||||
employee_refinish
|
employee_refinish
|
||||||
employee_prep
|
employee_prep
|
||||||
employee_csr
|
employee_csr
|
||||||
est_ct_fn
|
|
||||||
est_ct_ln
|
|
||||||
suspended
|
suspended
|
||||||
date_repairstarted
|
date_repairstarted
|
||||||
joblines_status {
|
joblines_status {
|
||||||
|
|||||||
@@ -143,14 +143,9 @@ export const QUERY_TIME_TICKETS_IN_RANGE_SB = gql`
|
|||||||
$end: date!
|
$end: date!
|
||||||
$fixedStart: date!
|
$fixedStart: date!
|
||||||
$fixedEnd: date!
|
$fixedEnd: date!
|
||||||
$jobStart: timestamptz!
|
|
||||||
$jobEnd: timestamptz!
|
|
||||||
) {
|
) {
|
||||||
timetickets(
|
timetickets(
|
||||||
where: {
|
where: { date: { _gte: $start, _lte: $end }, cost_center: {_neq: "timetickets.labels.shift"} }
|
||||||
date: { _gte: $start, _lte: $end }
|
|
||||||
cost_center: { _neq: "timetickets.labels.shift" }
|
|
||||||
}
|
|
||||||
order_by: { date: desc_nulls_first }
|
order_by: { date: desc_nulls_first }
|
||||||
) {
|
) {
|
||||||
actualhrs
|
actualhrs
|
||||||
@@ -181,10 +176,7 @@ export const QUERY_TIME_TICKETS_IN_RANGE_SB = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fixedperiod: timetickets(
|
fixedperiod: timetickets(
|
||||||
where: {
|
where: { date: { _gte: $fixedStart, _lte: $fixedEnd }, cost_center: {_neq: "timetickets.labels.shift"} }
|
||||||
date: { _gte: $fixedStart, _lte: $fixedEnd }
|
|
||||||
cost_center: { _neq: "timetickets.labels.shift" }
|
|
||||||
}
|
|
||||||
order_by: { date: desc_nulls_first }
|
order_by: { date: desc_nulls_first }
|
||||||
) {
|
) {
|
||||||
actualhrs
|
actualhrs
|
||||||
@@ -213,25 +205,6 @@ export const QUERY_TIME_TICKETS_IN_RANGE_SB = gql`
|
|||||||
last_name
|
last_name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jobs(
|
|
||||||
where: {
|
|
||||||
date_invoiced: { _is_null: true }
|
|
||||||
ro_number: { _is_null: false }
|
|
||||||
voided: { _eq: false }
|
|
||||||
_or: [
|
|
||||||
{ actual_completion: { _gte: $jobStart, _lte: $jobEnd } }
|
|
||||||
{ actual_delivery: { _gte: $jobStart, _lte: $jobEnd } }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
id
|
|
||||||
joblines(order_by: { line_no: asc }, where: { removed: { _eq: false } }) {
|
|
||||||
convertedtolbr
|
|
||||||
convertedtolbr_data
|
|
||||||
mod_lb_hrs
|
|
||||||
mod_lbr_ty
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
import { useMutation, useQuery } from "@apollo/client";
|
import { useMutation, useQuery } from "@apollo/client";
|
||||||
import { Form, notification } from "antd";
|
import { Form, notification } from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import queryString from "query-string";
|
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { useLocation, useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import AlertComponent from "../../components/alert/alert.component";
|
import AlertComponent from "../../components/alert/alert.component";
|
||||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
|
||||||
import NotFound from "../../components/not-found/not-found.component";
|
|
||||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||||
import { QUERY_CC_BY_PK, UPDATE_CC } from "../../graphql/courtesy-car.queries";
|
import { QUERY_CC_BY_PK, UPDATE_CC } from "../../graphql/courtesy-car.queries";
|
||||||
import {
|
import {
|
||||||
@@ -16,10 +13,13 @@ import {
|
|||||||
setBreadcrumbs,
|
setBreadcrumbs,
|
||||||
setSelectedHeader,
|
setSelectedHeader,
|
||||||
} from "../../redux/application/application.actions";
|
} from "../../redux/application/application.actions";
|
||||||
import { pageLimit } from "../../utils/config";
|
|
||||||
import { CreateRecentItem } from "../../utils/create-recent-item";
|
import { CreateRecentItem } from "../../utils/create-recent-item";
|
||||||
import UndefinedToNull from "./../../utils/undefinedtonull";
|
|
||||||
import CourtesyCarDetailPageComponent from "./courtesy-car-detail.page.component";
|
import CourtesyCarDetailPageComponent from "./courtesy-car-detail.page.component";
|
||||||
|
import NotFound from "../../components/not-found/not-found.component";
|
||||||
|
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||||
|
import queryString from "query-string";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
import {pageLimit} from "../../utils/config";
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||||
@@ -112,10 +112,7 @@ export function CourtesyCarDetailPageContainer({
|
|||||||
setSaveLoading(true);
|
setSaveLoading(true);
|
||||||
|
|
||||||
const result = await updateCourtesyCar({
|
const result = await updateCourtesyCar({
|
||||||
variables: {
|
variables: { cc: { ...values }, ccId: ccId },
|
||||||
cc: { ...UndefinedToNull(values, ["readiness"]) },
|
|
||||||
ccId: ccId,
|
|
||||||
},
|
|
||||||
refetchQueries: ["QUERY_CC_BY_PK"],
|
refetchQueries: ["QUERY_CC_BY_PK"],
|
||||||
awaitRefetchQueries: true,
|
awaitRefetchQueries: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -36,22 +36,14 @@ import JobsCloseLines from "../../components/jobs-close-lines/jobs-close-lines.c
|
|||||||
import LayoutFormRow from "../../components/layout-form-row/layout-form-row.component";
|
import LayoutFormRow from "../../components/layout-form-row/layout-form-row.component";
|
||||||
import { generateJobLinesUpdatesForInvoicing } from "../../graphql/jobs-lines.queries";
|
import { generateJobLinesUpdatesForInvoicing } from "../../graphql/jobs-lines.queries";
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
|
||||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
|
||||||
});
|
|
||||||
|
|
||||||
export function JobsCloseComponent({ job, bodyshop, jobRO, insertAuditTrail, }) {
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
@@ -118,10 +110,6 @@ export function JobsCloseComponent({ job, bodyshop, jobRO, insertAuditTrail, })
|
|||||||
notification["success"]({
|
notification["success"]({
|
||||||
message: t("jobs.successes.closed"),
|
message: t("jobs.successes.closed"),
|
||||||
});
|
});
|
||||||
insertAuditTrail({
|
|
||||||
jobid: job.id,
|
|
||||||
operation: AuditTrailMapping.jobinvoiced(),
|
|
||||||
});
|
|
||||||
// history.push(`/manage/jobs/${job.id}`);
|
// history.push(`/manage/jobs/${job.id}`);
|
||||||
} else {
|
} else {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -539,4 +527,4 @@ export function JobsCloseComponent({ job, bodyshop, jobRO, insertAuditTrail, })
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(JobsCloseComponent);
|
export default connect(mapStateToProps, null)(JobsCloseComponent);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import _ from "lodash";
|
||||||
import { useLazyQuery, useMutation } from "@apollo/client";
|
import { useLazyQuery, useMutation } from "@apollo/client";
|
||||||
import { Form, notification } from "antd";
|
import { Form, notification } from "antd";
|
||||||
import _ from "lodash";
|
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -90,7 +90,6 @@ function JobsCreateContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
|
|||||||
{},
|
{},
|
||||||
values,
|
values,
|
||||||
{ date_open: new Date() },
|
{ date_open: new Date() },
|
||||||
{ date_estimated: new Date() },
|
|
||||||
{
|
{
|
||||||
vehicle:
|
vehicle:
|
||||||
state.vehicle.selectedid || state.vehicle.none
|
state.vehicle.selectedid || state.vehicle.none
|
||||||
|
|||||||
@@ -103,7 +103,6 @@
|
|||||||
"admin_jobmarkforreexport": "ADMIN: Job marked for re-export.",
|
"admin_jobmarkforreexport": "ADMIN: Job marked for re-export.",
|
||||||
"admin_jobuninvoice": "ADMIN: Job has been uninvoiced.",
|
"admin_jobuninvoice": "ADMIN: Job has been uninvoiced.",
|
||||||
"admin_jobunvoid": "ADMIN: Job has been unvoided.",
|
"admin_jobunvoid": "ADMIN: Job has been unvoided.",
|
||||||
"alerttoggle": "Alert Toggle set to {{status}}",
|
|
||||||
"appointmentcancel": "Appointment canceled. Lost Reason: {{lost_sale_reason}}.",
|
"appointmentcancel": "Appointment canceled. Lost Reason: {{lost_sale_reason}}.",
|
||||||
"appointmentinsert": "Appointment created. Appointment Date: {{start}}.",
|
"appointmentinsert": "Appointment created. Appointment Date: {{start}}.",
|
||||||
"billposted": "Bill with invoice number {{invoice_number}} posted.",
|
"billposted": "Bill with invoice number {{invoice_number}} posted.",
|
||||||
@@ -112,7 +111,6 @@
|
|||||||
"jobassignmentchange": "Employee {{name}} assigned to {{operation}}",
|
"jobassignmentchange": "Employee {{name}} assigned to {{operation}}",
|
||||||
"jobassignmentremoved": "Employee assignment removed for {{operation}}",
|
"jobassignmentremoved": "Employee assignment removed for {{operation}}",
|
||||||
"jobchecklist": "Checklist type \"{{type}}\" completed. In production set to {{inproduction}}. Status set to {{status}}.",
|
"jobchecklist": "Checklist type \"{{type}}\" completed. In production set to {{inproduction}}. Status set to {{status}}.",
|
||||||
"jobinvoiced": "Job has been invoiced.",
|
|
||||||
"jobconverted": "Job converted and assigned number {{ro_number}}.",
|
"jobconverted": "Job converted and assigned number {{ro_number}}.",
|
||||||
"jobfieldchanged": "Job field $t(jobs.fields.{{field}}) changed to {{value}}.",
|
"jobfieldchanged": "Job field $t(jobs.fields.{{field}}) changed to {{value}}.",
|
||||||
"jobimported": "Job imported.",
|
"jobimported": "Job imported.",
|
||||||
@@ -205,7 +203,6 @@
|
|||||||
"entered_total": "Total of Entered Lines",
|
"entered_total": "Total of Entered Lines",
|
||||||
"enteringcreditmemo": "You are entering a credit memo. Please ensure you are also entering positive values.",
|
"enteringcreditmemo": "You are entering a credit memo. Please ensure you are also entering positive values.",
|
||||||
"federal_tax": "Federal Tax",
|
"federal_tax": "Federal Tax",
|
||||||
"federal_tax_exempt": "Federal Tax Exempt?",
|
|
||||||
"generatepartslabel": "Generate Parts Labels after Saving?",
|
"generatepartslabel": "Generate Parts Labels after Saving?",
|
||||||
"iouexists": "An IOU exists that is associated to this RO.",
|
"iouexists": "An IOU exists that is associated to this RO.",
|
||||||
"local_tax": "Local Tax",
|
"local_tax": "Local Tax",
|
||||||
@@ -214,7 +211,6 @@
|
|||||||
"new": "New Bill",
|
"new": "New Bill",
|
||||||
"noneselected": "No bill selected.",
|
"noneselected": "No bill selected.",
|
||||||
"onlycmforinvoiced": "Only credit memos can be entered for any Job that has been invoiced, exported, or voided.",
|
"onlycmforinvoiced": "Only credit memos can be entered for any Job that has been invoiced, exported, or voided.",
|
||||||
"printlabels": "Print Labels",
|
|
||||||
"retailtotal": "Bills Retail Total",
|
"retailtotal": "Bills Retail Total",
|
||||||
"savewithdiscrepancy": "You are about to save this bill with a discrepancy. The system will continue to use the calculated amount using the bill lines. Press cancel to return to the bill.",
|
"savewithdiscrepancy": "You are about to save this bill with a discrepancy. The system will continue to use the calculated amount using the bill lines. Press cancel to return to the bill.",
|
||||||
"state_tax": "Provincial/State Tax",
|
"state_tax": "Provincial/State Tax",
|
||||||
@@ -451,7 +447,6 @@
|
|||||||
"config": "Shop -> Config",
|
"config": "Shop -> Config",
|
||||||
"dashboard": "Shop -> Dashboard",
|
"dashboard": "Shop -> Dashboard",
|
||||||
"rbac": "Shop -> RBAC",
|
"rbac": "Shop -> RBAC",
|
||||||
"reportcenter": "Shop -> Report Center",
|
|
||||||
"templates": "Shop -> Templates",
|
"templates": "Shop -> Templates",
|
||||||
"vendors": "Shop -> Vendors"
|
"vendors": "Shop -> Vendors"
|
||||||
},
|
},
|
||||||
@@ -786,7 +781,6 @@
|
|||||||
"notes": "Notes",
|
"notes": "Notes",
|
||||||
"plate": "Plate Number",
|
"plate": "Plate Number",
|
||||||
"purchasedate": "Purchase Date",
|
"purchasedate": "Purchase Date",
|
||||||
"readiness": "Readiness",
|
|
||||||
"registrationexpires": "Registration Expires On",
|
"registrationexpires": "Registration Expires On",
|
||||||
"serviceenddate": "Usage End Date",
|
"serviceenddate": "Usage End Date",
|
||||||
"servicestartdate": "Usage Start Date",
|
"servicestartdate": "Usage Start Date",
|
||||||
@@ -823,10 +817,6 @@
|
|||||||
},
|
},
|
||||||
"successes": {
|
"successes": {
|
||||||
"saved": "Courtesy Car saved successfully."
|
"saved": "Courtesy Car saved successfully."
|
||||||
},
|
|
||||||
"readiness": {
|
|
||||||
"notready": "Not Ready",
|
|
||||||
"ready": "Ready"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"csi": {
|
"csi": {
|
||||||
@@ -2054,9 +2044,6 @@
|
|||||||
"sentby": "Sent by {{by}} at {{time}}",
|
"sentby": "Sent by {{by}} at {{time}}",
|
||||||
"typeamessage": "Send a message...",
|
"typeamessage": "Send a message...",
|
||||||
"unarchive": "Unarchive"
|
"unarchive": "Unarchive"
|
||||||
},
|
|
||||||
"render": {
|
|
||||||
"conversation_list": "Conversation List"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"notes": {
|
"notes": {
|
||||||
@@ -2708,7 +2695,6 @@
|
|||||||
"efficiencyoverperiod": "Efficiency over Selected Dates",
|
"efficiencyoverperiod": "Efficiency over Selected Dates",
|
||||||
"entries": "Scoreboard Entries",
|
"entries": "Scoreboard Entries",
|
||||||
"jobs": "Jobs",
|
"jobs": "Jobs",
|
||||||
"jobscompletednotinvoiced": "Completed Not Invoiced",
|
|
||||||
"lastmonth": "Last Month",
|
"lastmonth": "Last Month",
|
||||||
"lastweek": "Last Week",
|
"lastweek": "Last Week",
|
||||||
"monthlytarget": "Monthly",
|
"monthlytarget": "Monthly",
|
||||||
@@ -2723,7 +2709,6 @@
|
|||||||
"timetickets": "Time Tickets",
|
"timetickets": "Time Tickets",
|
||||||
"timeticketsemployee": "Time Tickets by Employee",
|
"timeticketsemployee": "Time Tickets by Employee",
|
||||||
"todateactual": "Actual (MTD)",
|
"todateactual": "Actual (MTD)",
|
||||||
"totalhrs": "Total Hours",
|
|
||||||
"totaloverperiod": "Total over Selected Dates",
|
"totaloverperiod": "Total over Selected Dates",
|
||||||
"weeklyactual": "Actual (W)",
|
"weeklyactual": "Actual (W)",
|
||||||
"weeklytarget": "Weekly",
|
"weeklytarget": "Weekly",
|
||||||
|
|||||||
@@ -103,7 +103,6 @@
|
|||||||
"admin_jobmarkforreexport": "",
|
"admin_jobmarkforreexport": "",
|
||||||
"admin_jobuninvoice": "",
|
"admin_jobuninvoice": "",
|
||||||
"admin_jobunvoid": "",
|
"admin_jobunvoid": "",
|
||||||
"alerttoggle": "",
|
|
||||||
"appointmentcancel": "",
|
"appointmentcancel": "",
|
||||||
"appointmentinsert": "",
|
"appointmentinsert": "",
|
||||||
"billposted": "",
|
"billposted": "",
|
||||||
@@ -112,7 +111,6 @@
|
|||||||
"jobassignmentchange": "",
|
"jobassignmentchange": "",
|
||||||
"jobassignmentremoved": "",
|
"jobassignmentremoved": "",
|
||||||
"jobchecklist": "",
|
"jobchecklist": "",
|
||||||
"jobinvoiced": "",
|
|
||||||
"jobconverted": "",
|
"jobconverted": "",
|
||||||
"jobfieldchanged": "",
|
"jobfieldchanged": "",
|
||||||
"jobimported": "",
|
"jobimported": "",
|
||||||
@@ -205,7 +203,6 @@
|
|||||||
"entered_total": "",
|
"entered_total": "",
|
||||||
"enteringcreditmemo": "",
|
"enteringcreditmemo": "",
|
||||||
"federal_tax": "",
|
"federal_tax": "",
|
||||||
"federal_tax_exempt": "",
|
|
||||||
"generatepartslabel": "",
|
"generatepartslabel": "",
|
||||||
"iouexists": "",
|
"iouexists": "",
|
||||||
"local_tax": "",
|
"local_tax": "",
|
||||||
@@ -214,7 +211,6 @@
|
|||||||
"new": "",
|
"new": "",
|
||||||
"noneselected": "",
|
"noneselected": "",
|
||||||
"onlycmforinvoiced": "",
|
"onlycmforinvoiced": "",
|
||||||
"printlabels": "",
|
|
||||||
"retailtotal": "",
|
"retailtotal": "",
|
||||||
"savewithdiscrepancy": "",
|
"savewithdiscrepancy": "",
|
||||||
"state_tax": "",
|
"state_tax": "",
|
||||||
@@ -451,7 +447,6 @@
|
|||||||
"config": "",
|
"config": "",
|
||||||
"dashboard": "",
|
"dashboard": "",
|
||||||
"rbac": "",
|
"rbac": "",
|
||||||
"reportcenter": "",
|
|
||||||
"templates": "",
|
"templates": "",
|
||||||
"vendors": ""
|
"vendors": ""
|
||||||
},
|
},
|
||||||
@@ -786,7 +781,6 @@
|
|||||||
"notes": "",
|
"notes": "",
|
||||||
"plate": "",
|
"plate": "",
|
||||||
"purchasedate": "",
|
"purchasedate": "",
|
||||||
"readiness": "",
|
|
||||||
"registrationexpires": "",
|
"registrationexpires": "",
|
||||||
"serviceenddate": "",
|
"serviceenddate": "",
|
||||||
"servicestartdate": "",
|
"servicestartdate": "",
|
||||||
@@ -823,10 +817,6 @@
|
|||||||
},
|
},
|
||||||
"successes": {
|
"successes": {
|
||||||
"saved": ""
|
"saved": ""
|
||||||
},
|
|
||||||
"readiness": {
|
|
||||||
"notready": "",
|
|
||||||
"ready": ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"csi": {
|
"csi": {
|
||||||
@@ -2054,9 +2044,6 @@
|
|||||||
"sentby": "",
|
"sentby": "",
|
||||||
"typeamessage": "Enviar un mensaje...",
|
"typeamessage": "Enviar un mensaje...",
|
||||||
"unarchive": ""
|
"unarchive": ""
|
||||||
},
|
|
||||||
"render": {
|
|
||||||
"conversation_list": ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"notes": {
|
"notes": {
|
||||||
@@ -2708,7 +2695,6 @@
|
|||||||
"efficiencyoverperiod": "",
|
"efficiencyoverperiod": "",
|
||||||
"entries": "",
|
"entries": "",
|
||||||
"jobs": "",
|
"jobs": "",
|
||||||
"jobscompletednotinvoiced": "",
|
|
||||||
"lastmonth": "",
|
"lastmonth": "",
|
||||||
"lastweek": "",
|
"lastweek": "",
|
||||||
"monthlytarget": "",
|
"monthlytarget": "",
|
||||||
@@ -2723,7 +2709,6 @@
|
|||||||
"timetickets": "",
|
"timetickets": "",
|
||||||
"timeticketsemployee": "",
|
"timeticketsemployee": "",
|
||||||
"todateactual": "",
|
"todateactual": "",
|
||||||
"totalhrs": "",
|
|
||||||
"totaloverperiod": "",
|
"totaloverperiod": "",
|
||||||
"weeklyactual": "",
|
"weeklyactual": "",
|
||||||
"weeklytarget": "",
|
"weeklytarget": "",
|
||||||
|
|||||||
@@ -103,7 +103,6 @@
|
|||||||
"admin_jobmarkforreexport": "",
|
"admin_jobmarkforreexport": "",
|
||||||
"admin_jobuninvoice": "",
|
"admin_jobuninvoice": "",
|
||||||
"admin_jobunvoid": "",
|
"admin_jobunvoid": "",
|
||||||
"alerttoggle": "",
|
|
||||||
"appointmentcancel": "",
|
"appointmentcancel": "",
|
||||||
"appointmentinsert": "",
|
"appointmentinsert": "",
|
||||||
"billposted": "",
|
"billposted": "",
|
||||||
@@ -112,7 +111,6 @@
|
|||||||
"jobassignmentchange": "",
|
"jobassignmentchange": "",
|
||||||
"jobassignmentremoved": "",
|
"jobassignmentremoved": "",
|
||||||
"jobchecklist": "",
|
"jobchecklist": "",
|
||||||
"jobinvoiced": "",
|
|
||||||
"jobconverted": "",
|
"jobconverted": "",
|
||||||
"jobfieldchanged": "",
|
"jobfieldchanged": "",
|
||||||
"jobimported": "",
|
"jobimported": "",
|
||||||
@@ -205,7 +203,6 @@
|
|||||||
"entered_total": "",
|
"entered_total": "",
|
||||||
"enteringcreditmemo": "",
|
"enteringcreditmemo": "",
|
||||||
"federal_tax": "",
|
"federal_tax": "",
|
||||||
"federal_tax_exempt": "",
|
|
||||||
"generatepartslabel": "",
|
"generatepartslabel": "",
|
||||||
"iouexists": "",
|
"iouexists": "",
|
||||||
"local_tax": "",
|
"local_tax": "",
|
||||||
@@ -214,7 +211,6 @@
|
|||||||
"new": "",
|
"new": "",
|
||||||
"noneselected": "",
|
"noneselected": "",
|
||||||
"onlycmforinvoiced": "",
|
"onlycmforinvoiced": "",
|
||||||
"printlabels": "",
|
|
||||||
"retailtotal": "",
|
"retailtotal": "",
|
||||||
"savewithdiscrepancy": "",
|
"savewithdiscrepancy": "",
|
||||||
"state_tax": "",
|
"state_tax": "",
|
||||||
@@ -451,7 +447,6 @@
|
|||||||
"config": "",
|
"config": "",
|
||||||
"dashboard": "",
|
"dashboard": "",
|
||||||
"rbac": "",
|
"rbac": "",
|
||||||
"reportcenter": "",
|
|
||||||
"templates": "",
|
"templates": "",
|
||||||
"vendors": ""
|
"vendors": ""
|
||||||
},
|
},
|
||||||
@@ -786,7 +781,6 @@
|
|||||||
"notes": "",
|
"notes": "",
|
||||||
"plate": "",
|
"plate": "",
|
||||||
"purchasedate": "",
|
"purchasedate": "",
|
||||||
"readiness": "",
|
|
||||||
"registrationexpires": "",
|
"registrationexpires": "",
|
||||||
"serviceenddate": "",
|
"serviceenddate": "",
|
||||||
"servicestartdate": "",
|
"servicestartdate": "",
|
||||||
@@ -823,10 +817,6 @@
|
|||||||
},
|
},
|
||||||
"successes": {
|
"successes": {
|
||||||
"saved": ""
|
"saved": ""
|
||||||
},
|
|
||||||
"readiness": {
|
|
||||||
"notready": "",
|
|
||||||
"ready": ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"csi": {
|
"csi": {
|
||||||
@@ -2054,9 +2044,6 @@
|
|||||||
"sentby": "",
|
"sentby": "",
|
||||||
"typeamessage": "Envoyer un message...",
|
"typeamessage": "Envoyer un message...",
|
||||||
"unarchive": ""
|
"unarchive": ""
|
||||||
},
|
|
||||||
"render": {
|
|
||||||
"conversation_list": ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"notes": {
|
"notes": {
|
||||||
@@ -2708,7 +2695,6 @@
|
|||||||
"efficiencyoverperiod": "",
|
"efficiencyoverperiod": "",
|
||||||
"entries": "",
|
"entries": "",
|
||||||
"jobs": "",
|
"jobs": "",
|
||||||
"jobscompletednotinvoiced": "",
|
|
||||||
"lastmonth": "",
|
"lastmonth": "",
|
||||||
"lastweek": "",
|
"lastweek": "",
|
||||||
"monthlytarget": "",
|
"monthlytarget": "",
|
||||||
@@ -2723,7 +2709,6 @@
|
|||||||
"timetickets": "",
|
"timetickets": "",
|
||||||
"timeticketsemployee": "",
|
"timeticketsemployee": "",
|
||||||
"todateactual": "",
|
"todateactual": "",
|
||||||
"totalhrs": "",
|
|
||||||
"totaloverperiod": "",
|
"totaloverperiod": "",
|
||||||
"weeklyactual": "",
|
"weeklyactual": "",
|
||||||
"weeklytarget": "",
|
"weeklytarget": "",
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
|
|
||||||
const AuditTrailMapping = {
|
const AuditTrailMapping = {
|
||||||
alertToggle: (status) => i18n.t("audit_trail.messages.alerttoggle", { status }),
|
|
||||||
appointmentcancel: (lost_sale_reason) =>
|
appointmentcancel: (lost_sale_reason) =>
|
||||||
i18n.t("audit_trail.messages.appointmentcancel", { lost_sale_reason }),
|
i18n.t("audit_trail.messages.appointmentcancel", { lost_sale_reason }),
|
||||||
appointmentinsert: (start) =>
|
appointmentinsert: (start) =>
|
||||||
@@ -12,8 +11,6 @@ const AuditTrailMapping = {
|
|||||||
"ADMIN: " + i18n.t("audit_trail.messages.jobstatuschange", { status }),
|
"ADMIN: " + i18n.t("audit_trail.messages.jobstatuschange", { status }),
|
||||||
jobsupplement: () => i18n.t("audit_trail.messages.jobsupplement"),
|
jobsupplement: () => i18n.t("audit_trail.messages.jobsupplement"),
|
||||||
jobimported: () => i18n.t("audit_trail.messages.jobimported"),
|
jobimported: () => i18n.t("audit_trail.messages.jobimported"),
|
||||||
jobinvoiced: () =>
|
|
||||||
i18n.t("audit_trail.messages.jobinvoiced"),
|
|
||||||
jobconverted: (ro_number) =>
|
jobconverted: (ro_number) =>
|
||||||
i18n.t("audit_trail.messages.jobconverted", { ro_number }),
|
i18n.t("audit_trail.messages.jobconverted", { ro_number }),
|
||||||
jobfieldchange: (field, value) =>
|
jobfieldchange: (field, value) =>
|
||||||
|
|||||||
@@ -2102,17 +2102,6 @@ export const TemplateList = (type, context) => {
|
|||||||
// },
|
// },
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
...(!type || type === "messaging"
|
|
||||||
? {
|
|
||||||
conversation_list: {
|
|
||||||
title: i18n.t("messaging.render.conversation_list"),
|
|
||||||
description: "",
|
|
||||||
subject: i18n.t("messaging.render.conversation_list"),
|
|
||||||
key: "conversation_list",
|
|
||||||
disabled: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
: {}),
|
|
||||||
...(!type || type === "vendor"
|
...(!type || type === "vendor"
|
||||||
? {
|
? {
|
||||||
purchases_by_vendor_detailed: {
|
purchases_by_vendor_detailed: {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
// Sometimes referred to as PageSize, this variable controls the amount of records
|
// Sometimes referred to as PageSize, this variable controls the amount of records
|
||||||
// to show on one page during pagination.
|
// to show on one page during pagination.
|
||||||
export const pageLimit = 50;
|
export const pageLimit = 10;
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
export const BETA_KEY = 'betaSwitchImex';
|
|
||||||
|
|
||||||
export const checkBeta = () => {
|
|
||||||
const cookie = document.cookie.split('; ').find(row => row.startsWith(BETA_KEY));
|
|
||||||
return cookie ? cookie.split('=')[1] === 'true' : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const setBeta = (value) => {
|
|
||||||
const domain = window.location.hostname.split('.').slice(-2).join('.');
|
|
||||||
document.cookie = `${BETA_KEY}=${value}; path=/; domain=.${domain}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const handleBeta = () => {
|
|
||||||
// If the current host name does not start with beta or test, then we don't need to do anything.
|
|
||||||
if (window.location.hostname.startsWith('localhost')) {
|
|
||||||
console.log('Not on beta or test, so no need to handle beta.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const isBeta = checkBeta();
|
|
||||||
|
|
||||||
const currentHostName = window.location.hostname;
|
|
||||||
|
|
||||||
// Beta is enabled, but the current host name does start with beta.
|
|
||||||
if (isBeta && !currentHostName.startsWith('beta')) {
|
|
||||||
const href= `${window.location.protocol}//beta.${currentHostName}${window.location.pathname}${window.location.search}${window.location.hash}`;
|
|
||||||
window.location.replace(href);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Beta is not enabled, but the current host name does start with beta.
|
|
||||||
else if (!isBeta && currentHostName.startsWith('beta')) {
|
|
||||||
const href = `${window.location.protocol}//${currentHostName.replace('beta.', '')}${window.location.pathname}${window.location.search}${window.location.hash}`;
|
|
||||||
window.location.replace(href);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export default handleBeta;
|
|
||||||
@@ -1388,62 +1388,60 @@
|
|||||||
- active:
|
- active:
|
||||||
_eq: true
|
_eq: true
|
||||||
columns:
|
columns:
|
||||||
- bodyshopid
|
|
||||||
- color
|
|
||||||
- created_at
|
|
||||||
- dailycost
|
|
||||||
- damage
|
|
||||||
- fleetnumber
|
|
||||||
- fuel
|
|
||||||
- id
|
- id
|
||||||
- insuranceexpires
|
- created_at
|
||||||
- leaseenddate
|
|
||||||
- make
|
|
||||||
- mileage
|
|
||||||
- model
|
|
||||||
- nextservicedate
|
|
||||||
- nextservicekm
|
|
||||||
- notes
|
|
||||||
- plate
|
|
||||||
- purchasedate
|
|
||||||
- readiness
|
|
||||||
- registrationexpires
|
|
||||||
- serviceenddate
|
|
||||||
- servicestartdate
|
|
||||||
- status
|
|
||||||
- updated_at
|
- updated_at
|
||||||
- vin
|
- bodyshopid
|
||||||
|
- make
|
||||||
|
- model
|
||||||
- year
|
- year
|
||||||
|
- plate
|
||||||
|
- color
|
||||||
|
- vin
|
||||||
|
- fleetnumber
|
||||||
|
- purchasedate
|
||||||
|
- servicestartdate
|
||||||
|
- serviceenddate
|
||||||
|
- leaseenddate
|
||||||
|
- status
|
||||||
|
- nextservicekm
|
||||||
|
- nextservicedate
|
||||||
|
- damage
|
||||||
|
- notes
|
||||||
|
- fuel
|
||||||
|
- registrationexpires
|
||||||
|
- insuranceexpires
|
||||||
|
- dailycost
|
||||||
|
- mileage
|
||||||
select_permissions:
|
select_permissions:
|
||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
- bodyshopid
|
|
||||||
- color
|
|
||||||
- created_at
|
|
||||||
- dailycost
|
|
||||||
- damage
|
|
||||||
- fleetnumber
|
|
||||||
- fuel
|
|
||||||
- id
|
|
||||||
- insuranceexpires
|
- insuranceexpires
|
||||||
- leaseenddate
|
- leaseenddate
|
||||||
- make
|
|
||||||
- mileage
|
|
||||||
- model
|
|
||||||
- nextservicedate
|
- nextservicedate
|
||||||
- nextservicekm
|
|
||||||
- notes
|
|
||||||
- plate
|
|
||||||
- purchasedate
|
- purchasedate
|
||||||
- readiness
|
|
||||||
- registrationexpires
|
- registrationexpires
|
||||||
- serviceenddate
|
- serviceenddate
|
||||||
- servicestartdate
|
- servicestartdate
|
||||||
|
- dailycost
|
||||||
|
- fuel
|
||||||
|
- mileage
|
||||||
|
- nextservicekm
|
||||||
|
- color
|
||||||
|
- damage
|
||||||
|
- fleetnumber
|
||||||
|
- make
|
||||||
|
- model
|
||||||
|
- notes
|
||||||
|
- plate
|
||||||
- status
|
- status
|
||||||
- updated_at
|
|
||||||
- vin
|
- vin
|
||||||
- year
|
- year
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- bodyshopid
|
||||||
|
- id
|
||||||
filter:
|
filter:
|
||||||
bodyshop:
|
bodyshop:
|
||||||
associations:
|
associations:
|
||||||
@@ -1458,32 +1456,31 @@
|
|||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
- bodyshopid
|
|
||||||
- color
|
|
||||||
- created_at
|
|
||||||
- dailycost
|
|
||||||
- damage
|
|
||||||
- fleetnumber
|
|
||||||
- fuel
|
|
||||||
- id
|
|
||||||
- insuranceexpires
|
- insuranceexpires
|
||||||
- leaseenddate
|
- leaseenddate
|
||||||
- make
|
|
||||||
- mileage
|
|
||||||
- model
|
|
||||||
- nextservicedate
|
- nextservicedate
|
||||||
- nextservicekm
|
|
||||||
- notes
|
|
||||||
- plate
|
|
||||||
- purchasedate
|
- purchasedate
|
||||||
- readiness
|
|
||||||
- registrationexpires
|
- registrationexpires
|
||||||
- serviceenddate
|
- serviceenddate
|
||||||
- servicestartdate
|
- servicestartdate
|
||||||
|
- dailycost
|
||||||
|
- fuel
|
||||||
|
- mileage
|
||||||
|
- nextservicekm
|
||||||
|
- color
|
||||||
|
- damage
|
||||||
|
- fleetnumber
|
||||||
|
- make
|
||||||
|
- model
|
||||||
|
- notes
|
||||||
|
- plate
|
||||||
- status
|
- status
|
||||||
- updated_at
|
|
||||||
- vin
|
- vin
|
||||||
- year
|
- year
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- bodyshopid
|
||||||
|
- id
|
||||||
filter:
|
filter:
|
||||||
bodyshop:
|
bodyshop:
|
||||||
associations:
|
associations:
|
||||||
@@ -2023,24 +2020,24 @@
|
|||||||
- active:
|
- active:
|
||||||
_eq: true
|
_eq: true
|
||||||
columns:
|
columns:
|
||||||
- created_at
|
|
||||||
- employeeid
|
|
||||||
- id
|
|
||||||
- labor_rates
|
- labor_rates
|
||||||
- percentage
|
- percentage
|
||||||
- teamid
|
- created_at
|
||||||
- updated_at
|
- updated_at
|
||||||
|
- employeeid
|
||||||
|
- id
|
||||||
|
- teamid
|
||||||
select_permissions:
|
select_permissions:
|
||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
- created_at
|
|
||||||
- employeeid
|
|
||||||
- id
|
|
||||||
- labor_rates
|
- labor_rates
|
||||||
- percentage
|
- percentage
|
||||||
- teamid
|
- created_at
|
||||||
- updated_at
|
- updated_at
|
||||||
|
- employeeid
|
||||||
|
- id
|
||||||
|
- teamid
|
||||||
filter:
|
filter:
|
||||||
employee_team:
|
employee_team:
|
||||||
bodyshop:
|
bodyshop:
|
||||||
@@ -2055,13 +2052,13 @@
|
|||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
- created_at
|
|
||||||
- employeeid
|
|
||||||
- id
|
|
||||||
- labor_rates
|
- labor_rates
|
||||||
- percentage
|
- percentage
|
||||||
- teamid
|
- created_at
|
||||||
- updated_at
|
- updated_at
|
||||||
|
- employeeid
|
||||||
|
- id
|
||||||
|
- teamid
|
||||||
filter:
|
filter:
|
||||||
employee_team:
|
employee_team:
|
||||||
bodyshop:
|
bodyshop:
|
||||||
@@ -2123,23 +2120,21 @@
|
|||||||
_eq: true
|
_eq: true
|
||||||
columns:
|
columns:
|
||||||
- active
|
- active
|
||||||
- bodyshopid
|
|
||||||
- created_at
|
|
||||||
- id
|
|
||||||
- max_load
|
|
||||||
- name
|
- name
|
||||||
|
- created_at
|
||||||
- updated_at
|
- updated_at
|
||||||
|
- bodyshopid
|
||||||
|
- id
|
||||||
select_permissions:
|
select_permissions:
|
||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
- active
|
- active
|
||||||
- bodyshopid
|
|
||||||
- created_at
|
|
||||||
- id
|
|
||||||
- max_load
|
|
||||||
- name
|
- name
|
||||||
|
- created_at
|
||||||
- updated_at
|
- updated_at
|
||||||
|
- bodyshopid
|
||||||
|
- id
|
||||||
filter:
|
filter:
|
||||||
bodyshop:
|
bodyshop:
|
||||||
associations:
|
associations:
|
||||||
@@ -2155,7 +2150,6 @@
|
|||||||
columns:
|
columns:
|
||||||
- active
|
- active
|
||||||
- bodyshopid
|
- bodyshopid
|
||||||
- max_load
|
|
||||||
- name
|
- name
|
||||||
- updated_at
|
- updated_at
|
||||||
filter:
|
filter:
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
-- Could not auto-generate a down migration.
|
|
||||||
-- Please write an appropriate down migration for the SQL below:
|
|
||||||
-- alter table "public"."courtesycars" add column "readiness" text
|
|
||||||
-- null;
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
alter table "public"."courtesycars" add column "readiness" text
|
|
||||||
null;
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
-- Could not auto-generate a down migration.
|
|
||||||
-- Please write an appropriate down migration for the SQL below:
|
|
||||||
-- alter table "public"."employee_team_members" add column "max_load" numeric
|
|
||||||
-- not null default '10000';
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
alter table "public"."employee_team_members" add column "max_load" numeric
|
|
||||||
not null default '10000';
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
alter table "public"."employee_team_members" alter column "max_load" set default '10000'::numeric;
|
|
||||||
alter table "public"."employee_team_members" alter column "max_load" drop not null;
|
|
||||||
alter table "public"."employee_team_members" add column "max_load" numeric;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
alter table "public"."employee_team_members" drop column "max_load" cascade;
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
-- Could not auto-generate a down migration.
|
|
||||||
-- Please write an appropriate down migration for the SQL below:
|
|
||||||
-- alter table "public"."employee_teams" add column "max_load" numeric
|
|
||||||
-- not null default '10000';
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
alter table "public"."employee_teams" add column "max_load" numeric
|
|
||||||
not null default '10000';
|
|
||||||
@@ -34,10 +34,6 @@ const io = new Server(server, {
|
|||||||
"http://localhost:3000",
|
"http://localhost:3000",
|
||||||
"https://imex.online",
|
"https://imex.online",
|
||||||
"https://www.imex.online",
|
"https://www.imex.online",
|
||||||
"https://beta.test.imex.online",
|
|
||||||
"https://www.beta.test.imex.online",
|
|
||||||
"https://beta.imex.online",
|
|
||||||
"https://www.beta.imex.online",
|
|
||||||
],
|
],
|
||||||
methods: ["GET", "POST"],
|
methods: ["GET", "POST"],
|
||||||
credentials: true,
|
credentials: true,
|
||||||
@@ -228,7 +224,6 @@ app.post("/qbo/payments", fb.validateFirebaseIdToken, qbo.payments);
|
|||||||
var data = require("./server/data/data");
|
var data = require("./server/data/data");
|
||||||
app.post("/data/ah", data.autohouse);
|
app.post("/data/ah", data.autohouse);
|
||||||
app.post("/data/cc", data.claimscorp);
|
app.post("/data/cc", data.claimscorp);
|
||||||
app.post("/data/kaizen", data.kaizen);
|
|
||||||
app.post("/record-handler/arms", data.arms);
|
app.post("/record-handler/arms", data.arms);
|
||||||
|
|
||||||
var taskHandler = require("./server/tasks/tasks");
|
var taskHandler = require("./server/tasks/tasks");
|
||||||
|
|||||||
@@ -507,7 +507,7 @@ const CreateRepairOrderTag = (job, errorCallback) => {
|
|||||||
Body: repairCosts.BodyLaborTotalCost.toFormat(CCDineroFormat),
|
Body: repairCosts.BodyLaborTotalCost.toFormat(CCDineroFormat),
|
||||||
Paint: repairCosts.RefinishLaborTotalCost.toFormat(CCDineroFormat),
|
Paint: repairCosts.RefinishLaborTotalCost.toFormat(CCDineroFormat),
|
||||||
Prep: Dinero().toFormat(CCDineroFormat),
|
Prep: Dinero().toFormat(CCDineroFormat),
|
||||||
Frame: repairCosts.FrameLaborTotalCost.toFormat(CCDineroFormat),
|
Frame: Dinero(job.job_totals.rates.laf.total).toFormat(CCDineroFormat),
|
||||||
Mech: repairCosts.MechanicalLaborTotalCost.toFormat(CCDineroFormat),
|
Mech: repairCosts.MechanicalLaborTotalCost.toFormat(CCDineroFormat),
|
||||||
Glass: repairCosts.GlassLaborTotalCost.toFormat(CCDineroFormat),
|
Glass: repairCosts.GlassLaborTotalCost.toFormat(CCDineroFormat),
|
||||||
Elec: repairCosts.ElectricalLaborTotalCost.toFormat(CCDineroFormat),
|
Elec: repairCosts.ElectricalLaborTotalCost.toFormat(CCDineroFormat),
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
exports.arms = require("./arms").default;
|
|
||||||
exports.autohouse = require("./autohouse").default;
|
exports.autohouse = require("./autohouse").default;
|
||||||
exports.claimscorp = require("./claimscorp").default;
|
exports.claimscorp = require("./claimscorp").default;
|
||||||
exports.kaizen = require("./kaizen").default;
|
exports.arms = require("./arms").default;
|
||||||
@@ -1,837 +0,0 @@
|
|||||||
const path = require("path");
|
|
||||||
const queries = require("../graphql-client/queries");
|
|
||||||
const Dinero = require("dinero.js");
|
|
||||||
const moment = require("moment-timezone");
|
|
||||||
var builder = require("xmlbuilder2");
|
|
||||||
const _ = require("lodash");
|
|
||||||
const logger = require("../utils/logger");
|
|
||||||
const fs = require("fs");
|
|
||||||
require("dotenv").config({
|
|
||||||
path: path.resolve(
|
|
||||||
process.cwd(),
|
|
||||||
`.env.${process.env.NODE_ENV || "development"}`
|
|
||||||
),
|
|
||||||
});
|
|
||||||
let Client = require("ssh2-sftp-client");
|
|
||||||
|
|
||||||
const client = require("../graphql-client/graphql-client").client;
|
|
||||||
const { sendServerEmail } = require("../email/sendemail");
|
|
||||||
const DineroFormat = "0,0.00";
|
|
||||||
const DateFormat = "MM/DD/YYYY";
|
|
||||||
|
|
||||||
const repairOpCodes = ["OP4", "OP9", "OP10"];
|
|
||||||
const replaceOpCodes = ["OP2", "OP5", "OP11", "OP12"];
|
|
||||||
|
|
||||||
const ftpSetup = {
|
|
||||||
host: process.env.KAIZEN_HOST,
|
|
||||||
port: process.env.KAIZEN_PORT,
|
|
||||||
username: process.env.KAIZEN_USER,
|
|
||||||
password: process.env.KAIZEN_PASSWORD,
|
|
||||||
debug: (message, ...data) => logger.log(message, "DEBUG", "api", null, data),
|
|
||||||
algorithms: {
|
|
||||||
serverHostKey: [
|
|
||||||
"ssh-rsa",
|
|
||||||
"ssh-dss",
|
|
||||||
"rsa-sha2-256",
|
|
||||||
"rsa-sha2-512",
|
|
||||||
"ecdsa-sha2-nistp256",
|
|
||||||
"ecdsa-sha2-nistp384",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.default = async (req, res) => {
|
|
||||||
//Query for the List of Bodyshop Clients.
|
|
||||||
logger.log("kaizen-start", "DEBUG", "api", null, null);
|
|
||||||
const kaizenShopsIDs = ["SUMMIT", "STRATHMORE", "SUNRIDGE"];
|
|
||||||
|
|
||||||
const { bodyshops } = await client.request(queries.GET_KAIZEN_SHOPS, {
|
|
||||||
imexshopid: kaizenShopsIDs,
|
|
||||||
});
|
|
||||||
|
|
||||||
const specificShopIds = req.body.bodyshopIds; // ['uuid]
|
|
||||||
const { start, end, skipUpload } = req.body; //YYYY-MM-DD
|
|
||||||
if (req.headers["x-imex-auth"] !== process.env.AUTOHOUSE_AUTH_TOKEN) {
|
|
||||||
res.sendStatus(401);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const allxmlsToUpload = [];
|
|
||||||
const allErrors = [];
|
|
||||||
try {
|
|
||||||
for (const bodyshop of specificShopIds
|
|
||||||
? bodyshops.filter((b) => specificShopIds.includes(b.id))
|
|
||||||
: bodyshops) {
|
|
||||||
logger.log("kaizen-start-shop-extract", "DEBUG", "api", bodyshop.id, {
|
|
||||||
shopname: bodyshop.shopname,
|
|
||||||
});
|
|
||||||
const erroredJobs = [];
|
|
||||||
try {
|
|
||||||
const { jobs, bodyshops_by_pk } = await client.request(
|
|
||||||
queries.KAIZEN_QUERY,
|
|
||||||
{
|
|
||||||
bodyshopid: bodyshop.id,
|
|
||||||
start: start
|
|
||||||
? moment(start).startOf("hours")
|
|
||||||
: moment().subtract(2, "hours").startOf("hour"),
|
|
||||||
...(end && { end: moment(end).endOf("hours") }),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const kaizenObject = {
|
|
||||||
DataFeed: {
|
|
||||||
ShopInfo: {
|
|
||||||
ShopName: bodyshops_by_pk.shopname,
|
|
||||||
Jobs: jobs.map((j) =>
|
|
||||||
CreateRepairOrderTag(
|
|
||||||
{ ...j, bodyshop: bodyshops_by_pk },
|
|
||||||
function ({ job, error }) {
|
|
||||||
erroredJobs.push({ job: job, error: error.toString() });
|
|
||||||
}
|
|
||||||
)
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
if (erroredJobs.length > 0) {
|
|
||||||
logger.log("kaizen-failed-jobs", "ERROR", "api", bodyshop.id, {
|
|
||||||
count: erroredJobs.length,
|
|
||||||
jobs: JSON.stringify(erroredJobs.map((j) => j.job.ro_number)),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var ret = builder
|
|
||||||
.create(
|
|
||||||
{
|
|
||||||
// version: "1.0",
|
|
||||||
// encoding: "UTF-8",
|
|
||||||
//keepNullNodes: true,
|
|
||||||
},
|
|
||||||
kaizenObject
|
|
||||||
)
|
|
||||||
.end({ allowEmptyTags: true });
|
|
||||||
|
|
||||||
allxmlsToUpload.push({
|
|
||||||
count: kaizenObject.DataFeed.ShopInfo.Jobs.length,
|
|
||||||
xml: ret,
|
|
||||||
filename: `${bodyshop.shopname}-${moment().format(
|
|
||||||
"YYYYMMDDTHHMMss"
|
|
||||||
)}.xml`,
|
|
||||||
});
|
|
||||||
|
|
||||||
logger.log("kaizen-end-shop-extract", "DEBUG", "api", bodyshop.id, {
|
|
||||||
shopname: bodyshop.shopname,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
//Error at the shop level.
|
|
||||||
logger.log("kaizen-error-shop", "ERROR", "api", bodyshop.id, {
|
|
||||||
...error,
|
|
||||||
});
|
|
||||||
|
|
||||||
allErrors.push({
|
|
||||||
bodyshopid: bodyshop.id,
|
|
||||||
imexshopid: bodyshop.imexshopid,
|
|
||||||
shopname: bodyshop.shopname,
|
|
||||||
fatal: true,
|
|
||||||
errors: [error.toString()],
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
allErrors.push({
|
|
||||||
bodyshopid: bodyshop.id,
|
|
||||||
imexshopid: bodyshop.imexshopid,
|
|
||||||
shopname: bodyshop.shopname,
|
|
||||||
errors: erroredJobs.map((ej) => ({
|
|
||||||
ro_number: ej.job?.ro_number,
|
|
||||||
jobid: ej.job?.id,
|
|
||||||
error: ej.error,
|
|
||||||
})),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (skipUpload) {
|
|
||||||
for (const xmlObj of allxmlsToUpload) {
|
|
||||||
fs.writeFileSync(`./logs/${xmlObj.filename}`, xmlObj.xml);
|
|
||||||
}
|
|
||||||
|
|
||||||
res.json(allxmlsToUpload);
|
|
||||||
sendServerEmail({
|
|
||||||
subject: `Kaizen Report ${moment().format("MM-DD-YY")}`,
|
|
||||||
text: `Errors: ${allErrors.map((e) => JSON.stringify(e, null, 2))}
|
|
||||||
Uploaded: ${JSON.stringify(
|
|
||||||
allxmlsToUpload.map((x) => ({ filename: x.filename, count: x.count })),
|
|
||||||
null,
|
|
||||||
2
|
|
||||||
)}
|
|
||||||
`,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let sftp = new Client();
|
|
||||||
sftp.on("error", (errors) =>
|
|
||||||
logger.log("kaizen-sftp-error", "ERROR", "api", null, {
|
|
||||||
...errors,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
//Connect to the FTP and upload all.
|
|
||||||
|
|
||||||
await sftp.connect(ftpSetup);
|
|
||||||
|
|
||||||
for (const xmlObj of allxmlsToUpload) {
|
|
||||||
logger.log("kaizen-sftp-upload", "DEBUG", "api", null, {
|
|
||||||
filename: xmlObj.filename,
|
|
||||||
});
|
|
||||||
|
|
||||||
const uploadResult = await sftp.put(
|
|
||||||
Buffer.from(xmlObj.xml),
|
|
||||||
`/${xmlObj.filename}`
|
|
||||||
);
|
|
||||||
logger.log("kaizen-sftp-upload-result", "DEBUG", "api", null, {
|
|
||||||
uploadResult,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//***TODO Change filing naming when creating the cron job. IM_ShopInternalName_DDMMYYYY_HHMMSS.xml
|
|
||||||
} catch (error) {
|
|
||||||
logger.log("kaizen-sftp-error", "ERROR", "api", null, {
|
|
||||||
...error,
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
sftp.end();
|
|
||||||
}
|
|
||||||
sendServerEmail({
|
|
||||||
subject: `Kaizen Report ${moment().format("MM-DD-YY")}`,
|
|
||||||
text: `Errors: ${allErrors.map((e) => JSON.stringify(e, null, 2))}
|
|
||||||
Uploaded: ${JSON.stringify(
|
|
||||||
allxmlsToUpload.map((x) => ({ filename: x.filename, count: x.count })),
|
|
||||||
null,
|
|
||||||
2
|
|
||||||
)}
|
|
||||||
`,
|
|
||||||
});
|
|
||||||
res.sendStatus(200);
|
|
||||||
} catch (error) {
|
|
||||||
res.status(200).json(error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const CreateRepairOrderTag = (job, errorCallback) => {
|
|
||||||
//Level 2
|
|
||||||
|
|
||||||
if (!job.job_totals) {
|
|
||||||
errorCallback({
|
|
||||||
jobid: job.id,
|
|
||||||
job: job,
|
|
||||||
ro_number: job.ro_number,
|
|
||||||
error: { toString: () => "No job totals for RO." },
|
|
||||||
});
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
const repairCosts = CreateCosts(job);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const ret = {
|
|
||||||
JobID: job.id,
|
|
||||||
RoNumber: job.ro_number,
|
|
||||||
JobStatus: job.tlos_ind
|
|
||||||
? "Total Loss"
|
|
||||||
: job.ro_number
|
|
||||||
? job.status
|
|
||||||
: "Estimate",
|
|
||||||
Customer: {
|
|
||||||
CompanyName: job.ownr_co_nm?.trim() || "",
|
|
||||||
FirstName: job.ownr_fn?.trim() || "",
|
|
||||||
LastName: job.ownr_ln?.trim() || "",
|
|
||||||
Address1: job.ownr_addr1?.trim() || "",
|
|
||||||
Address2: job.ownr_addr2?.trim() || "",
|
|
||||||
City: job.ownr_city?.trim() || "",
|
|
||||||
State: job.ownr_st?.trim() || "",
|
|
||||||
Zip: job.ownr_zip?.trim() || "",
|
|
||||||
},
|
|
||||||
Vehicle: {
|
|
||||||
Year: job.v_model_yr
|
|
||||||
? parseInt(job.v_model_yr.match(/\d/g))
|
|
||||||
? parseInt(job.v_model_yr.match(/\d/g).join(""), 10)
|
|
||||||
: ""
|
|
||||||
: "",
|
|
||||||
Make: job.v_make_desc || "",
|
|
||||||
Model: job.v_model_desc || "",
|
|
||||||
BodyStyle: job.vehicle?.v_bstyle || "",
|
|
||||||
Color: job.v_color || "",
|
|
||||||
VIN: job.v_vin || "",
|
|
||||||
PlateNo: job.plate_no || "",
|
|
||||||
},
|
|
||||||
InsuranceCompany: job.ins_co_nm || "",
|
|
||||||
Claim: job.clm_no || "",
|
|
||||||
Contacts: {
|
|
||||||
CSR: job.employee_csr_rel
|
|
||||||
? `${
|
|
||||||
job.employee_csr_rel.last_name
|
|
||||||
? job.employee_csr_rel.last_name
|
|
||||||
: ""
|
|
||||||
}${job.employee_csr_rel.last_name ? ", " : ""}${
|
|
||||||
job.employee_csr_rel.first_name
|
|
||||||
? job.employee_csr_rel.first_name
|
|
||||||
: ""
|
|
||||||
}`
|
|
||||||
: "",
|
|
||||||
Estimator: `${job.est_ct_ln ? job.est_ct_ln : ""}${
|
|
||||||
job.est_ct_ln ? ", " : ""
|
|
||||||
}${job.est_ct_fn ? job.est_ct_fn : ""}`,
|
|
||||||
},
|
|
||||||
Dates: {
|
|
||||||
DateEstimated:
|
|
||||||
(job.date_estimated &&
|
|
||||||
moment(job.date_estimated).format(DateFormat)) ||
|
|
||||||
"",
|
|
||||||
DateOpened:
|
|
||||||
(job.date_opened && moment(job.date_opened).format(DateFormat)) || "",
|
|
||||||
DateScheduled:
|
|
||||||
(job.scheduled_in &&
|
|
||||||
moment(job.scheduled_in)
|
|
||||||
.tz(job.bodyshop.timezone)
|
|
||||||
.format(DateFormat)) ||
|
|
||||||
"",
|
|
||||||
DateArrived:
|
|
||||||
(job.actual_in &&
|
|
||||||
moment(job.actual_in)
|
|
||||||
.tz(job.bodyshop.timezone)
|
|
||||||
.format(DateFormat)) ||
|
|
||||||
"",
|
|
||||||
DateStart: job.date_repairstarted
|
|
||||||
? (job.date_repairstarted &&
|
|
||||||
moment(job.date_repairstarted)
|
|
||||||
.tz(job.bodyshop.timezone)
|
|
||||||
.format(DateFormat)) ||
|
|
||||||
""
|
|
||||||
: (job.actual_in &&
|
|
||||||
moment(job.actual_in)
|
|
||||||
.tz(job.bodyshop.timezone)
|
|
||||||
.format(DateFormat)) ||
|
|
||||||
"",
|
|
||||||
DateScheduledCompletion:
|
|
||||||
(job.scheduled_completion &&
|
|
||||||
moment(job.scheduled_completion)
|
|
||||||
.tz(job.bodyshop.timezone)
|
|
||||||
.format(DateFormat)) ||
|
|
||||||
"",
|
|
||||||
DateCompleted:
|
|
||||||
(job.actual_completion &&
|
|
||||||
moment(job.actual_completion)
|
|
||||||
.tz(job.bodyshop.timezone)
|
|
||||||
.format(DateFormat)) ||
|
|
||||||
"",
|
|
||||||
DateScheduledDelivery:
|
|
||||||
(job.scheduled_delivery &&
|
|
||||||
moment(job.scheduled_delivery)
|
|
||||||
.tz(job.bodyshop.timezone)
|
|
||||||
.format(DateFormat)) ||
|
|
||||||
"",
|
|
||||||
DateDelivered:
|
|
||||||
(job.actual_delivery &&
|
|
||||||
moment(job.actual_delivery)
|
|
||||||
.tz(job.bodyshop.timezone)
|
|
||||||
.format(DateFormat)) ||
|
|
||||||
"",
|
|
||||||
DateInvoiced:
|
|
||||||
(job.date_invoiced &&
|
|
||||||
moment(job.date_invoiced)
|
|
||||||
.tz(job.bodyshop.timezone)
|
|
||||||
.format(DateFormat)) ||
|
|
||||||
"",
|
|
||||||
DateExported:
|
|
||||||
(job.date_exported &&
|
|
||||||
moment(job.date_exported)
|
|
||||||
.tz(job.bodyshop.timezone)
|
|
||||||
.format(DateFormat)) ||
|
|
||||||
"",
|
|
||||||
},
|
|
||||||
Sales: {
|
|
||||||
Labour: {
|
|
||||||
Aluminum: Dinero(job.job_totals.rates.laa.total).toFormat(
|
|
||||||
DineroFormat
|
|
||||||
),
|
|
||||||
Body: Dinero(job.job_totals.rates.lab.total).toFormat(DineroFormat),
|
|
||||||
Diagnostic: Dinero(job.job_totals.rates.lad.total).toFormat(
|
|
||||||
DineroFormat
|
|
||||||
),
|
|
||||||
Electrical: Dinero(job.job_totals.rates.lae.total).toFormat(
|
|
||||||
DineroFormat
|
|
||||||
),
|
|
||||||
Frame: Dinero(job.job_totals.rates.laf.total).toFormat(DineroFormat),
|
|
||||||
Glass: Dinero(job.job_totals.rates.lag.total).toFormat(DineroFormat),
|
|
||||||
Mechanical: Dinero(job.job_totals.rates.lam.total).toFormat(
|
|
||||||
DineroFormat
|
|
||||||
),
|
|
||||||
OtherLabour: Dinero(job.job_totals.rates.la1.total)
|
|
||||||
.add(Dinero(job.job_totals.rates.la2.total))
|
|
||||||
.add(Dinero(job.job_totals.rates.la3.total))
|
|
||||||
.add(Dinero(job.job_totals.rates.la4.total))
|
|
||||||
.add(Dinero(job.job_totals.rates.lau.total))
|
|
||||||
.toFormat(DineroFormat),
|
|
||||||
Refinish: Dinero(job.job_totals.rates.lar.total).toFormat(
|
|
||||||
DineroFormat
|
|
||||||
),
|
|
||||||
Structural: Dinero(job.job_totals.rates.las.total).toFormat(
|
|
||||||
DineroFormat
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Materials: {
|
|
||||||
Body: Dinero(job.job_totals.rates.mash.total).toFormat(DineroFormat),
|
|
||||||
Refinish: Dinero(job.job_totals.rates.mapa.total).toFormat(
|
|
||||||
DineroFormat
|
|
||||||
),
|
|
||||||
},
|
|
||||||
Parts: {
|
|
||||||
Aftermarket: Dinero(
|
|
||||||
job.job_totals.parts.parts.list.PAA &&
|
|
||||||
job.job_totals.parts.parts.list.PAA.total
|
|
||||||
).toFormat(DineroFormat),
|
|
||||||
LKQ: Dinero(
|
|
||||||
job.job_totals.parts.parts.list.PAL &&
|
|
||||||
job.job_totals.parts.parts.list.PAL.total
|
|
||||||
).toFormat(DineroFormat),
|
|
||||||
OEM: Dinero(
|
|
||||||
job.job_totals.parts.parts.list.PAN &&
|
|
||||||
job.job_totals.parts.parts.list.PAN.total
|
|
||||||
)
|
|
||||||
.add(
|
|
||||||
Dinero(
|
|
||||||
job.job_totals.parts.parts.list.PAP &&
|
|
||||||
job.job_totals.parts.parts.list.PAP.total
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.toFormat(DineroFormat),
|
|
||||||
OtherParts: Dinero(
|
|
||||||
job.job_totals.parts.parts.list.PAO &&
|
|
||||||
job.job_totals.parts.parts.list.PAO.total
|
|
||||||
).toFormat(DineroFormat),
|
|
||||||
Reconditioned: Dinero(
|
|
||||||
job.job_totals.parts.parts.list.PAM &&
|
|
||||||
job.job_totals.parts.parts.list.PAM.total
|
|
||||||
).toFormat(DineroFormat),
|
|
||||||
TotalParts: Dinero(
|
|
||||||
job.job_totals.parts.parts.list.PAA &&
|
|
||||||
job.job_totals.parts.parts.list.PAA.total
|
|
||||||
)
|
|
||||||
.add(
|
|
||||||
Dinero(
|
|
||||||
job.job_totals.parts.parts.list.PAL &&
|
|
||||||
job.job_totals.parts.parts.list.PAL.total
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.add(
|
|
||||||
Dinero(
|
|
||||||
job.job_totals.parts.parts.list.PAN &&
|
|
||||||
job.job_totals.parts.parts.list.PAN.total
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.add(
|
|
||||||
Dinero(
|
|
||||||
job.job_totals.parts.parts.list.PAO &&
|
|
||||||
job.job_totals.parts.parts.list.PAO.total
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.add(
|
|
||||||
Dinero(
|
|
||||||
job.job_totals.parts.parts.list.PAM &&
|
|
||||||
job.job_totals.parts.parts.list.PAM.total
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.toFormat(DineroFormat),
|
|
||||||
},
|
|
||||||
OtherSales: Dinero(job.job_totals.additional.storage).toFormat(
|
|
||||||
DineroFormat
|
|
||||||
),
|
|
||||||
Sublet: Dinero(job.job_totals.parts.sublets.total).toFormat(
|
|
||||||
DineroFormat
|
|
||||||
),
|
|
||||||
Towing: Dinero(job.job_totals.additional.towing).toFormat(DineroFormat),
|
|
||||||
ATS:
|
|
||||||
job.job_totals.additional.additionalCostItems.includes(
|
|
||||||
"ATS Amount"
|
|
||||||
) === true
|
|
||||||
? Dinero(
|
|
||||||
job.job_totals.additional.additionalCostItems[
|
|
||||||
job.job_totals.additional.additionalCostItems.indexOf(
|
|
||||||
"ATS Amount"
|
|
||||||
)
|
|
||||||
].total
|
|
||||||
).toFormat(DineroFormat)
|
|
||||||
: Dinero().toFormat(DineroFormat),
|
|
||||||
SaleSubtotal: Dinero(job.job_totals.totals.subtotal).toFormat(
|
|
||||||
DineroFormat
|
|
||||||
),
|
|
||||||
Tax: Dinero(job.job_totals.totals.local_tax)
|
|
||||||
.add(Dinero(job.job_totals.totals.state_tax))
|
|
||||||
.add(Dinero(job.job_totals.totals.federal_tax))
|
|
||||||
.add(Dinero(job.job_totals.additional.pvrt))
|
|
||||||
.toFormat(DineroFormat),
|
|
||||||
SaleTotal: Dinero(job.job_totals.totals.total_repairs).toFormat(
|
|
||||||
DineroFormat
|
|
||||||
),
|
|
||||||
},
|
|
||||||
SaleHours: {
|
|
||||||
Aluminum: job.job_totals.rates.laa.hours.toFixed(2),
|
|
||||||
Body: job.job_totals.rates.lab.hours.toFixed(2),
|
|
||||||
Diagnostic: job.job_totals.rates.lad.hours.toFixed(2),
|
|
||||||
Electrical: job.job_totals.rates.lae.hours.toFixed(2),
|
|
||||||
Frame: job.job_totals.rates.laf.hours.toFixed(2),
|
|
||||||
Glass: job.job_totals.rates.lag.hours.toFixed(2),
|
|
||||||
Mechanical: job.job_totals.rates.lam.hours.toFixed(2),
|
|
||||||
Other: (
|
|
||||||
job.job_totals.rates.la1.hours +
|
|
||||||
job.job_totals.rates.la2.hours +
|
|
||||||
job.job_totals.rates.la3.hours +
|
|
||||||
job.job_totals.rates.la4.hours +
|
|
||||||
job.job_totals.rates.lau.hours
|
|
||||||
).toFixed(2),
|
|
||||||
Refinish: job.job_totals.rates.lar.hours.toFixed(2),
|
|
||||||
Structural: job.job_totals.rates.las.hours.toFixed(2),
|
|
||||||
TotalHours: job.joblines
|
|
||||||
.reduce((acc, val) => acc + val.mod_lb_hrs, 0)
|
|
||||||
.toFixed(2),
|
|
||||||
},
|
|
||||||
Costs: {
|
|
||||||
Labour: {
|
|
||||||
Aluminum: repairCosts.AluminumLabourTotalCost.toFormat(DineroFormat),
|
|
||||||
Body: repairCosts.BodyLabourTotalCost.toFormat(DineroFormat),
|
|
||||||
Diagnostic:
|
|
||||||
repairCosts.DiagnosticLabourTotalCost.toFormat(DineroFormat),
|
|
||||||
Electrical:
|
|
||||||
repairCosts.ElectricalLabourTotalCost.toFormat(DineroFormat),
|
|
||||||
Frame: repairCosts.FrameLabourTotalCost.toFormat(DineroFormat),
|
|
||||||
Glass: repairCosts.GlassLabourTotalCost.toFormat(DineroFormat),
|
|
||||||
Mechancial:
|
|
||||||
repairCosts.MechanicalLabourTotalCost.toFormat(DineroFormat),
|
|
||||||
OtherLabour: repairCosts.LabourMiscTotalCost.toFormat(DineroFormat),
|
|
||||||
Refinish: repairCosts.RefinishLabourTotalCost.toFormat(DineroFormat),
|
|
||||||
Structural:
|
|
||||||
repairCosts.StructuralLabourTotalCost.toFormat(DineroFormat),
|
|
||||||
TotalLabour: repairCosts.LabourTotalCost.toFormat(DineroFormat),
|
|
||||||
},
|
|
||||||
Materials: {
|
|
||||||
Body: repairCosts.BMTotalCost.toFormat(DineroFormat),
|
|
||||||
Refinish: repairCosts.PMTotalCost.toFormat(DineroFormat),
|
|
||||||
},
|
|
||||||
Parts: {
|
|
||||||
Aftermarket: repairCosts.PartsAMCost.toFormat(DineroFormat),
|
|
||||||
LKQ: repairCosts.PartsRecycledCost.toFormat(DineroFormat),
|
|
||||||
OEM: repairCosts.PartsOemCost.toFormat(DineroFormat),
|
|
||||||
OtherCost: repairCosts.PartsOtherCost.toFormat(DineroFormat),
|
|
||||||
Reconditioned:
|
|
||||||
repairCosts.PartsReconditionedCost.toFormat(DineroFormat),
|
|
||||||
TotalParts: repairCosts.PartsAMCost.add(repairCosts.PartsRecycledCost)
|
|
||||||
.add(repairCosts.PartsReconditionedCost)
|
|
||||||
.add(repairCosts.PartsOemCost)
|
|
||||||
.add(repairCosts.PartsOtherCost)
|
|
||||||
.toFormat(DineroFormat),
|
|
||||||
},
|
|
||||||
Sublet: repairCosts.SubletTotalCost.toFormat(DineroFormat),
|
|
||||||
Towing: repairCosts.TowingTotalCost.toFormat(DineroFormat),
|
|
||||||
ATS: Dinero().toFormat(DineroFormat),
|
|
||||||
Storage: repairCosts.StorageTotalCost.toFormat(DineroFormat),
|
|
||||||
CostTotal: repairCosts.TotalCost.toFormat(DineroFormat),
|
|
||||||
},
|
|
||||||
CostHours: {
|
|
||||||
Aluminum: repairCosts.AluminumLabourTotalHrs.toFixed(2),
|
|
||||||
Body: repairCosts.BodyLabourTotalHrs.toFixed(2),
|
|
||||||
Diagnostic: repairCosts.DiagnosticLabourTotalHrs.toFixed(2),
|
|
||||||
Refinish: repairCosts.RefinishLabourTotalHrs.toFixed(2),
|
|
||||||
Frame: repairCosts.FrameLabourTotalHrs.toFixed(2),
|
|
||||||
Mechanical: repairCosts.MechanicalLabourTotalHrs.toFixed(2),
|
|
||||||
Glass: repairCosts.GlassLabourTotalHrs.toFixed(2),
|
|
||||||
Electrical: repairCosts.ElectricalLabourTotalHrs.toFixed(2),
|
|
||||||
Structural: repairCosts.StructuralLabourTotalHrs.toFixed(2),
|
|
||||||
Other: repairCosts.LabourMiscTotalHrs.toFixed(2),
|
|
||||||
CostTotalHours: repairCosts.TotalHrs.toFixed(2),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
return ret;
|
|
||||||
} catch (error) {
|
|
||||||
logger.log("kaizen-job-calculate-error", "ERROR", "api", null, {
|
|
||||||
error,
|
|
||||||
});
|
|
||||||
|
|
||||||
errorCallback({ jobid: job.id, ro_number: job.ro_number, error });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const CreateCosts = (job) => {
|
|
||||||
//Create a mapping based on AH Requirements
|
|
||||||
|
|
||||||
//For DMS, the keys in the object below are the CIECA part types.
|
|
||||||
const billTotalsByCostCenters = job.bills.reduce((bill_acc, bill_val) => {
|
|
||||||
//At the bill level.
|
|
||||||
bill_val.billlines.map((line_val) => {
|
|
||||||
//At the bill line level.
|
|
||||||
|
|
||||||
if (!bill_acc[line_val.cost_center])
|
|
||||||
bill_acc[line_val.cost_center] = Dinero();
|
|
||||||
|
|
||||||
bill_acc[line_val.cost_center] = bill_acc[line_val.cost_center].add(
|
|
||||||
Dinero({
|
|
||||||
amount: Math.round((line_val.actual_cost || 0) * 100),
|
|
||||||
})
|
|
||||||
.multiply(line_val.quantity)
|
|
||||||
.multiply(bill_val.is_credit_memo ? -1 : 1)
|
|
||||||
);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
return bill_acc;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
//If the hourly rates for job costing are set, add them in.
|
|
||||||
if (
|
|
||||||
job.bodyshop.jc_hourly_rates &&
|
|
||||||
(job.bodyshop.jc_hourly_rates.mapa ||
|
|
||||||
typeof job.bodyshop.jc_hourly_rates.mapa === "number" ||
|
|
||||||
isNaN(job.bodyshop.jc_hourly_rates.mapa) === false)
|
|
||||||
) {
|
|
||||||
if (
|
|
||||||
!billTotalsByCostCenters[
|
|
||||||
job.bodyshop.md_responsibility_centers.defaults.costs.MAPA
|
|
||||||
]
|
|
||||||
)
|
|
||||||
billTotalsByCostCenters[
|
|
||||||
job.bodyshop.md_responsibility_centers.defaults.costs.MAPA
|
|
||||||
] = Dinero();
|
|
||||||
if (job.bodyshop.use_paint_scale_data === true) {
|
|
||||||
if (job.mixdata.length > 0) {
|
|
||||||
billTotalsByCostCenters[
|
|
||||||
job.bodyshop.md_responsibility_centers.defaults.costs.MAPA
|
|
||||||
] = Dinero({
|
|
||||||
amount: Math.round(
|
|
||||||
((job.mixdata[0] && job.mixdata[0].totalliquidcost) || 0) * 100
|
|
||||||
),
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
billTotalsByCostCenters[
|
|
||||||
job.bodyshop.md_responsibility_centers.defaults.costs.MAPA
|
|
||||||
] = billTotalsByCostCenters[
|
|
||||||
job.bodyshop.md_responsibility_centers.defaults.costs.MAPA
|
|
||||||
].add(
|
|
||||||
Dinero({
|
|
||||||
amount: Math.round(
|
|
||||||
(job.bodyshop.jc_hourly_rates &&
|
|
||||||
job.bodyshop.jc_hourly_rates.mapa * 100) ||
|
|
||||||
0
|
|
||||||
),
|
|
||||||
}).multiply(job.job_totals.rates.mapa.hours)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
billTotalsByCostCenters[
|
|
||||||
job.bodyshop.md_responsibility_centers.defaults.costs.MAPA
|
|
||||||
] = billTotalsByCostCenters[
|
|
||||||
job.bodyshop.md_responsibility_centers.defaults.costs.MAPA
|
|
||||||
].add(
|
|
||||||
Dinero({
|
|
||||||
amount: Math.round(
|
|
||||||
(job.bodyshop.jc_hourly_rates &&
|
|
||||||
job.bodyshop.jc_hourly_rates.mapa * 100) ||
|
|
||||||
0
|
|
||||||
),
|
|
||||||
}).multiply(job.job_totals.rates.mapa.hours)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (job.bodyshop.jc_hourly_rates && job.bodyshop.jc_hourly_rates.mash) {
|
|
||||||
if (
|
|
||||||
!billTotalsByCostCenters[
|
|
||||||
job.bodyshop.md_responsibility_centers.defaults.costs.MASH
|
|
||||||
]
|
|
||||||
)
|
|
||||||
billTotalsByCostCenters[
|
|
||||||
job.bodyshop.md_responsibility_centers.defaults.costs.MASH
|
|
||||||
] = Dinero();
|
|
||||||
billTotalsByCostCenters[
|
|
||||||
job.bodyshop.md_responsibility_centers.defaults.costs.MASH
|
|
||||||
] = billTotalsByCostCenters[
|
|
||||||
job.bodyshop.md_responsibility_centers.defaults.costs.MASH
|
|
||||||
].add(
|
|
||||||
Dinero({
|
|
||||||
amount: Math.round(
|
|
||||||
(job.bodyshop.jc_hourly_rates &&
|
|
||||||
job.bodyshop.jc_hourly_rates.mash * 100) ||
|
|
||||||
0
|
|
||||||
),
|
|
||||||
}).multiply(job.job_totals.rates.mash.hours)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
//Uses CIECA Labour types.
|
|
||||||
const ticketTotalsByCostCenter = job.timetickets.reduce(
|
|
||||||
(ticket_acc, ticket_val) => {
|
|
||||||
//At the invoice level.
|
|
||||||
if (!ticket_acc[ticket_val.cost_center])
|
|
||||||
ticket_acc[ticket_val.cost_center] = Dinero();
|
|
||||||
|
|
||||||
ticket_acc[ticket_val.cost_center] = ticket_acc[
|
|
||||||
ticket_val.cost_center
|
|
||||||
].add(
|
|
||||||
Dinero({
|
|
||||||
amount: Math.round((ticket_val.rate || 0) * 100),
|
|
||||||
}).multiply(
|
|
||||||
(ticket_val.flat_rate
|
|
||||||
? ticket_val.productivehrs
|
|
||||||
: ticket_val.actualhrs) || 0
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return ticket_acc;
|
|
||||||
},
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
const ticketHrsByCostCenter = job.timetickets.reduce(
|
|
||||||
(ticket_acc, ticket_val) => {
|
|
||||||
//At the invoice level.
|
|
||||||
if (!ticket_acc[ticket_val.cost_center])
|
|
||||||
ticket_acc[ticket_val.cost_center] = 0;
|
|
||||||
|
|
||||||
ticket_acc[ticket_val.cost_center] =
|
|
||||||
ticket_acc[ticket_val.cost_center] +
|
|
||||||
(ticket_val.flat_rate
|
|
||||||
? ticket_val.productivehrs
|
|
||||||
: ticket_val.actualhrs) || 0;
|
|
||||||
|
|
||||||
return ticket_acc;
|
|
||||||
},
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
//CIECA STANDARD MAPPING OBJECT.
|
|
||||||
|
|
||||||
const ciecaObj = {
|
|
||||||
ATS: "ATS",
|
|
||||||
LA1: "LA1",
|
|
||||||
LA2: "LA2",
|
|
||||||
LA3: "LA3",
|
|
||||||
LA4: "LA4",
|
|
||||||
LAA: "LAA",
|
|
||||||
LAB: "LAB",
|
|
||||||
LAD: "LAD",
|
|
||||||
LAE: "LAE",
|
|
||||||
LAF: "LAF",
|
|
||||||
LAG: "LAG",
|
|
||||||
LAM: "LAM",
|
|
||||||
LAR: "LAR",
|
|
||||||
LAS: "LAS",
|
|
||||||
LAU: "LAU",
|
|
||||||
PAA: "PAA",
|
|
||||||
PAC: "PAC",
|
|
||||||
PAG: "PAG",
|
|
||||||
PAL: "PAL",
|
|
||||||
PAM: "PAM",
|
|
||||||
PAN: "PAN",
|
|
||||||
PAO: "PAO",
|
|
||||||
PAP: "PAP",
|
|
||||||
PAR: "PAR",
|
|
||||||
PAS: "PAS",
|
|
||||||
TOW: "TOW",
|
|
||||||
MAPA: "MAPA",
|
|
||||||
MASH: "MASH",
|
|
||||||
PASL: "PASL",
|
|
||||||
};
|
|
||||||
const defaultCosts =
|
|
||||||
job.bodyshop.cdk_dealerid || job.bodyshop.pbs_serialnumber
|
|
||||||
? ciecaObj
|
|
||||||
: job.bodyshop.md_responsibility_centers.defaults.costs;
|
|
||||||
|
|
||||||
return {
|
|
||||||
PartsTotalCost: Object.keys(billTotalsByCostCenters).reduce((acc, key) => {
|
|
||||||
if (
|
|
||||||
key !== defaultCosts.PAS &&
|
|
||||||
key !== defaultCosts.PASL &&
|
|
||||||
key !== defaultCosts.MAPA &&
|
|
||||||
key !== defaultCosts.MASH &&
|
|
||||||
key !== defaultCosts.TOW
|
|
||||||
)
|
|
||||||
return acc.add(billTotalsByCostCenters[key]);
|
|
||||||
return acc;
|
|
||||||
}, Dinero()),
|
|
||||||
PartsOemCost: (billTotalsByCostCenters[defaultCosts.PAN] || Dinero()).add(
|
|
||||||
billTotalsByCostCenters[defaultCosts.PAP] || Dinero()
|
|
||||||
),
|
|
||||||
PartsAMCost: billTotalsByCostCenters[defaultCosts.PAA] || Dinero(),
|
|
||||||
PartsReconditionedCost:
|
|
||||||
billTotalsByCostCenters[defaultCosts.PAM] || Dinero(),
|
|
||||||
PartsRecycledCost: billTotalsByCostCenters[defaultCosts.PAL] || Dinero(),
|
|
||||||
PartsOtherCost: billTotalsByCostCenters[defaultCosts.PAO] || Dinero(),
|
|
||||||
|
|
||||||
SubletTotalCost:
|
|
||||||
billTotalsByCostCenters[defaultCosts.PAS] ||
|
|
||||||
Dinero(billTotalsByCostCenters[defaultCosts.PASL] || Dinero()),
|
|
||||||
|
|
||||||
AluminumLabourTotalCost:
|
|
||||||
ticketTotalsByCostCenter[defaultCosts.LAA] || Dinero(),
|
|
||||||
AluminumLabourTotalHrs: ticketHrsByCostCenter[defaultCosts.LAA] || 0,
|
|
||||||
BodyLabourTotalCost: ticketTotalsByCostCenter[defaultCosts.LAB] || Dinero(),
|
|
||||||
BodyLabourTotalHrs: ticketHrsByCostCenter[defaultCosts.LAB] || 0,
|
|
||||||
DiagnosticLabourTotalCost:
|
|
||||||
ticketTotalsByCostCenter[defaultCosts.LAD] || Dinero(),
|
|
||||||
DiagnosticLabourTotalHrs: ticketHrsByCostCenter[defaultCosts.LAD] || 0,
|
|
||||||
ElectricalLabourTotalCost:
|
|
||||||
ticketTotalsByCostCenter[defaultCosts.LAE] || Dinero(),
|
|
||||||
ElectricalLabourTotalHrs: ticketHrsByCostCenter[defaultCosts.LAE] || 0,
|
|
||||||
FrameLabourTotalCost:
|
|
||||||
ticketTotalsByCostCenter[defaultCosts.LAF] || Dinero(),
|
|
||||||
FrameLabourTotalHrs: ticketHrsByCostCenter[defaultCosts.LAF] || 0,
|
|
||||||
GlassLabourTotalCost:
|
|
||||||
ticketTotalsByCostCenter[defaultCosts.LAG] || Dinero(),
|
|
||||||
GlassLabourTotalHrs: ticketHrsByCostCenter[defaultCosts.LAG] || 0,
|
|
||||||
LabourMiscTotalCost: (
|
|
||||||
ticketTotalsByCostCenter[defaultCosts.LA1] || Dinero()
|
|
||||||
)
|
|
||||||
.add(ticketTotalsByCostCenter[defaultCosts.LA2] || Dinero())
|
|
||||||
.add(ticketTotalsByCostCenter[defaultCosts.LA2] || Dinero())
|
|
||||||
.add(ticketTotalsByCostCenter[defaultCosts.LA3] || Dinero())
|
|
||||||
.add(ticketTotalsByCostCenter[defaultCosts.LA4] || Dinero())
|
|
||||||
.add(ticketTotalsByCostCenter[defaultCosts.LAU] || Dinero()),
|
|
||||||
LabourMiscTotalHrs:
|
|
||||||
(ticketHrsByCostCenter[defaultCosts.LA1] || 0) +
|
|
||||||
(ticketHrsByCostCenter[defaultCosts.LA2] || 0) +
|
|
||||||
(ticketHrsByCostCenter[defaultCosts.LA3] || 0) +
|
|
||||||
(ticketHrsByCostCenter[defaultCosts.LA4] || 0) +
|
|
||||||
(ticketHrsByCostCenter[defaultCosts.LAU] || 0),
|
|
||||||
MechanicalLabourTotalCost:
|
|
||||||
ticketTotalsByCostCenter[defaultCosts.LAM] || Dinero(),
|
|
||||||
MechanicalLabourTotalHrs: ticketHrsByCostCenter[defaultCosts.LAM] || 0,
|
|
||||||
RefinishLabourTotalCost:
|
|
||||||
ticketTotalsByCostCenter[defaultCosts.LAR] || Dinero(),
|
|
||||||
RefinishLabourTotalHrs: ticketHrsByCostCenter[defaultCosts.LAR] || 0,
|
|
||||||
StructuralLabourTotalCost:
|
|
||||||
ticketTotalsByCostCenter[defaultCosts.LAS] || Dinero(),
|
|
||||||
StructuralLabourTotalHrs: ticketHrsByCostCenter[defaultCosts.LAS] || 0,
|
|
||||||
|
|
||||||
PMTotalCost: billTotalsByCostCenters[defaultCosts.MAPA] || Dinero(),
|
|
||||||
BMTotalCost: billTotalsByCostCenters[defaultCosts.MASH] || Dinero(),
|
|
||||||
|
|
||||||
MiscTotalCost: billTotalsByCostCenters[defaultCosts.PAO] || Dinero(),
|
|
||||||
TowingTotalCost: billTotalsByCostCenters[defaultCosts.TOW] || Dinero(),
|
|
||||||
StorageTotalCost: Dinero(),
|
|
||||||
DetailTotal: Dinero(),
|
|
||||||
DetailTotalCost: Dinero(),
|
|
||||||
|
|
||||||
SalesTaxTotalCost: Dinero(),
|
|
||||||
LabourTotalCost: Object.keys(ticketTotalsByCostCenter).reduce(
|
|
||||||
(acc, key) => {
|
|
||||||
return acc.add(ticketTotalsByCostCenter[key]);
|
|
||||||
},
|
|
||||||
Dinero()
|
|
||||||
),
|
|
||||||
TotalCost: Object.keys(billTotalsByCostCenters).reduce((acc, key) => {
|
|
||||||
return acc.add(billTotalsByCostCenters[key]);
|
|
||||||
}, Dinero()),
|
|
||||||
TotalHrs: job.timetickets.reduce((acc, ticket_val) => {
|
|
||||||
return (
|
|
||||||
acc +
|
|
||||||
(ticket_val.flat_rate
|
|
||||||
? ticket_val.productivehrs
|
|
||||||
: ticket_val.actualhrs) || 0
|
|
||||||
);
|
|
||||||
}, 0),
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -50,7 +50,7 @@ exports.createUser = async (req, res) => {
|
|||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
user: {
|
user: {
|
||||||
email: email.toLowerCase(),
|
email,
|
||||||
authid: userRecord.uid,
|
authid: userRecord.uid,
|
||||||
associations: {
|
associations: {
|
||||||
data: [{ shopid, authlevel, active: true }],
|
data: [{ shopid, authlevel, active: true }],
|
||||||
|
|||||||
@@ -1070,183 +1070,6 @@ query ENTEGRAL_EXPORT($bodyshopid: uuid!) {
|
|||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
exports.KAIZEN_QUERY = `query KAIZEN_EXPORT($start: timestamptz, $bodyshopid: uuid!, $end: timestamptz) {
|
|
||||||
bodyshops_by_pk(id: $bodyshopid){
|
|
||||||
id
|
|
||||||
shopname
|
|
||||||
address1
|
|
||||||
city
|
|
||||||
state
|
|
||||||
zip_post
|
|
||||||
country
|
|
||||||
phone
|
|
||||||
last_name_first
|
|
||||||
md_ro_statuses
|
|
||||||
md_order_statuses
|
|
||||||
md_responsibility_centers
|
|
||||||
jc_hourly_rates
|
|
||||||
cdk_dealerid
|
|
||||||
pbs_serialnumber
|
|
||||||
use_paint_scale_data
|
|
||||||
timezone
|
|
||||||
}
|
|
||||||
jobs(where: {_and: [{updated_at: {_gt: $start}}, {updated_at: {_lte: $end}}, {shopid: {_eq: $bodyshopid}}]}) {
|
|
||||||
actual_completion
|
|
||||||
actual_delivery
|
|
||||||
actual_in
|
|
||||||
asgn_date
|
|
||||||
bills {
|
|
||||||
billlines {
|
|
||||||
actual_cost
|
|
||||||
cost_center
|
|
||||||
id
|
|
||||||
quantity
|
|
||||||
}
|
|
||||||
federal_tax_rate
|
|
||||||
id
|
|
||||||
is_credit_memo
|
|
||||||
local_tax_rate
|
|
||||||
state_tax_rate
|
|
||||||
}
|
|
||||||
created_at
|
|
||||||
clm_no
|
|
||||||
date_estimated
|
|
||||||
date_exported
|
|
||||||
date_invoiced
|
|
||||||
date_open
|
|
||||||
date_repairstarted
|
|
||||||
employee_body_rel {
|
|
||||||
first_name
|
|
||||||
last_name
|
|
||||||
employee_number
|
|
||||||
id
|
|
||||||
}
|
|
||||||
employee_csr_rel {
|
|
||||||
first_name
|
|
||||||
last_name
|
|
||||||
employee_number
|
|
||||||
id
|
|
||||||
}
|
|
||||||
employee_prep_rel {
|
|
||||||
first_name
|
|
||||||
last_name
|
|
||||||
employee_number
|
|
||||||
id
|
|
||||||
}
|
|
||||||
employee_refinish_rel {
|
|
||||||
first_name
|
|
||||||
last_name
|
|
||||||
employee_number
|
|
||||||
id
|
|
||||||
}
|
|
||||||
est_ct_fn
|
|
||||||
est_ct_ln
|
|
||||||
id
|
|
||||||
ins_co_nm
|
|
||||||
joblines(where: {removed: {_eq: false}}) {
|
|
||||||
act_price
|
|
||||||
billlines(order_by: {bill: {date: desc_nulls_last}} limit: 1) {
|
|
||||||
actual_cost
|
|
||||||
actual_price
|
|
||||||
quantity
|
|
||||||
bill {
|
|
||||||
vendor {
|
|
||||||
name
|
|
||||||
}
|
|
||||||
invoice_number
|
|
||||||
date
|
|
||||||
}
|
|
||||||
}
|
|
||||||
db_price
|
|
||||||
id
|
|
||||||
lbr_op
|
|
||||||
line_desc
|
|
||||||
line_ind
|
|
||||||
line_no
|
|
||||||
mod_lb_hrs
|
|
||||||
mod_lbr_ty
|
|
||||||
parts_order_lines(order_by: {parts_order: {order_date: desc_nulls_last}} limit: 1){
|
|
||||||
parts_order{
|
|
||||||
id
|
|
||||||
order_date
|
|
||||||
}
|
|
||||||
}
|
|
||||||
part_qty
|
|
||||||
part_type
|
|
||||||
profitcenter_part
|
|
||||||
profitcenter_labor
|
|
||||||
prt_dsmk_m
|
|
||||||
prt_dsmk_p
|
|
||||||
oem_partno
|
|
||||||
status
|
|
||||||
}
|
|
||||||
job_totals
|
|
||||||
loss_date
|
|
||||||
mixdata(limit: 1, order_by: {updated_at: desc}) {
|
|
||||||
jobid
|
|
||||||
totalliquidcost
|
|
||||||
}
|
|
||||||
ownr_addr1
|
|
||||||
ownr_addr2
|
|
||||||
ownr_city
|
|
||||||
ownr_co_nm
|
|
||||||
ownr_fn
|
|
||||||
ownr_ln
|
|
||||||
ownr_st
|
|
||||||
ownr_zip
|
|
||||||
parts_orders(limit: 1, order_by: {created_at: desc}) {
|
|
||||||
created_at
|
|
||||||
}
|
|
||||||
parts_tax_rates
|
|
||||||
plate_no
|
|
||||||
rate_la1
|
|
||||||
rate_la2
|
|
||||||
rate_la3
|
|
||||||
rate_la4
|
|
||||||
rate_laa
|
|
||||||
rate_lab
|
|
||||||
rate_lad
|
|
||||||
rate_lae
|
|
||||||
rate_laf
|
|
||||||
rate_lag
|
|
||||||
rate_lam
|
|
||||||
rate_lar
|
|
||||||
rate_las
|
|
||||||
rate_lau
|
|
||||||
rate_ma2s
|
|
||||||
rate_ma2t
|
|
||||||
rate_ma3s
|
|
||||||
rate_mabl
|
|
||||||
rate_macs
|
|
||||||
rate_mahw
|
|
||||||
rate_matd
|
|
||||||
rate_mapa
|
|
||||||
rate_mash
|
|
||||||
ro_number
|
|
||||||
scheduled_completion
|
|
||||||
scheduled_delivery
|
|
||||||
scheduled_in
|
|
||||||
status
|
|
||||||
timetickets {
|
|
||||||
id
|
|
||||||
rate
|
|
||||||
cost_center
|
|
||||||
actualhrs
|
|
||||||
productivehrs
|
|
||||||
flat_rate
|
|
||||||
}
|
|
||||||
tlos_ind
|
|
||||||
v_color
|
|
||||||
v_model_yr
|
|
||||||
v_model_desc
|
|
||||||
v_make_desc
|
|
||||||
v_vin
|
|
||||||
vehicle {
|
|
||||||
v_bstyle
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}`;
|
|
||||||
|
|
||||||
exports.UPDATE_JOB = `
|
exports.UPDATE_JOB = `
|
||||||
mutation UPDATE_JOB($jobId: uuid!, $job: jobs_set_input!) {
|
mutation UPDATE_JOB($jobId: uuid!, $job: jobs_set_input!) {
|
||||||
update_jobs(where: { id: { _eq: $jobId } }, _set: $job) {
|
update_jobs(where: { id: { _eq: $jobId } }, _set: $job) {
|
||||||
@@ -1719,7 +1542,7 @@ exports.GET_CLAIMSCORP_SHOPS = `query GET_CLAIMSCORP_SHOPS {
|
|||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
exports.GET_ENTEGRAL_SHOPS = `query GET_ENTEGRAL_SHOPS {
|
exports.GET_ENTEGRAL_SHOPS = `query GET_AUTOHOUSE_SHOPS {
|
||||||
bodyshops(where: {entegral_id: {_is_null: false}, _or: {entegral_id: {_neq: ""}}}){
|
bodyshops(where: {entegral_id: {_is_null: false}, _or: {entegral_id: {_neq: ""}}}){
|
||||||
id
|
id
|
||||||
shopname
|
shopname
|
||||||
@@ -1739,26 +1562,6 @@ exports.GET_ENTEGRAL_SHOPS = `query GET_ENTEGRAL_SHOPS {
|
|||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
exports.GET_KAIZEN_SHOPS = `query GET_KAIZEN_SHOPS($imexshopid: [String]) {
|
|
||||||
bodyshops(where: {imexshopid: {_in: $imexshopid}}){
|
|
||||||
id
|
|
||||||
shopname
|
|
||||||
address1
|
|
||||||
city
|
|
||||||
state
|
|
||||||
zip_post
|
|
||||||
country
|
|
||||||
phone
|
|
||||||
md_ro_statuses
|
|
||||||
md_order_statuses
|
|
||||||
autohouseid
|
|
||||||
md_responsibility_centers
|
|
||||||
jc_hourly_rates
|
|
||||||
imexshopid
|
|
||||||
timezone
|
|
||||||
}
|
|
||||||
}`;
|
|
||||||
|
|
||||||
exports.DELETE_ALL_DMS_VEHICLES = `mutation DELETE_ALL_DMS_VEHICLES{
|
exports.DELETE_ALL_DMS_VEHICLES = `mutation DELETE_ALL_DMS_VEHICLES{
|
||||||
delete_dms_vehicles(where: {}) {
|
delete_dms_vehicles(where: {}) {
|
||||||
affected_rows
|
affected_rows
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ exports.payment_refund = async (req, res) => {
|
|||||||
exports.generate_payment_url = async (req, res) => {
|
exports.generate_payment_url = async (req, res) => {
|
||||||
logger.log("intellipay-payment-url", "DEBUG", req.user?.email, null, null);
|
logger.log("intellipay-payment-url", "DEBUG", req.user?.email, null, null);
|
||||||
const shopCredentials = await getShopCredentials(req.body.bodyshop);
|
const shopCredentials = await getShopCredentials(req.body.bodyshop);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {
|
const options = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -140,12 +139,7 @@ exports.generate_payment_url = async (req, res) => {
|
|||||||
//TODO: Move these to environment variables/database.
|
//TODO: Move these to environment variables/database.
|
||||||
data: qs.stringify({
|
data: qs.stringify({
|
||||||
...shopCredentials,
|
...shopCredentials,
|
||||||
//...req.body,
|
...req.body,
|
||||||
amount: Dinero({ amount: Math.round(req.body.amount * 100) }).toFormat(
|
|
||||||
"0.00"
|
|
||||||
),
|
|
||||||
account: req.body.account,
|
|
||||||
invoice: req.body.invoice,
|
|
||||||
createshorturl: true,
|
createshorturl: true,
|
||||||
//The postback URL is set at the CP teller global terminal settings page.
|
//The postback URL is set at the CP teller global terminal settings page.
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user