Merged in release/2021-12-03 (pull request #286)

Release/2021 12 03
This commit is contained in:
Patrick Fic
2021-12-03 17:33:37 +00:00
14 changed files with 212 additions and 90 deletions

View File

@@ -6092,6 +6092,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>gst_override</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>la1</name>
<definition_loaded>false</definition_loaded>
@@ -12170,6 +12191,32 @@
<folder_node>
<name>dms</name>
<children>
<folder_node>
<name>errors</name>
<children>
<concept_node>
<name>alreadyexported</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
</children>
</folder_node>
<folder_node>
<name>labels</name>
<children>

View File

@@ -48,7 +48,7 @@ export function DmsCdkVehicles({ bodyshop, form, socket, job }) {
];
return (
<div>
<>
<Modal
width={"90%"}
visible={visible}
@@ -100,6 +100,6 @@ export function DmsCdkVehicles({ bodyshop, form, socket, job }) {
>
{t("jobs.actions.dms.findmakemodelcode")}
</Button>
</div>
</>
);
}

View File

@@ -4,9 +4,12 @@ import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import {
selectBodyshop,
selectCurrentUser,
} from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
currentUser: selectCurrentUser,
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
@@ -14,9 +17,12 @@ const mapDispatchToProps = (dispatch) => ({
});
export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkMakesRefetch);
export function DmsCdkMakesRefetch({ bodyshop, form, socket }) {
export function DmsCdkMakesRefetch({ currentUser, bodyshop, form, socket }) {
const [loading, setLoading] = useState(false);
const { t } = useTranslation();
if (!currentUser.email.includes("@imex.")) return null;
const handleRefetch = async () => {
setLoading(true);
await axios.post("/cdk/getvehicles", {

View File

@@ -34,7 +34,6 @@ export function DmsCustomerSelector({ bodyshop }) {
setVisible(true);
setDmsType("pbs");
setcustomerList(customerList);
});
const onUseSelected = () => {
@@ -118,7 +117,6 @@ export function DmsCustomerSelector({ bodyshop }) {
if (!visible) return null;
return (
<Col span={24}>
{dmsType}
<Table
title={() => (
<div>

View File

@@ -7,10 +7,10 @@ import {
Form,
Input,
InputNumber,
Menu,
Select,
Space,
Statistic,
Menu,
Typography,
} from "antd";
import Dinero from "dinero.js";
@@ -21,9 +21,9 @@ import { createStructuredSelector } from "reselect";
import { determineDmsType } from "../../pages/dms/dms.container";
import { selectBodyshop } from "../../redux/user/user.selectors";
import DmsCdkMakes from "../dms-cdk-makes/dms-cdk-makes.component";
import DmsCdkMakesRefetch from "../dms-cdk-makes/dms-cdk-makes.refetch.component";
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
import DmsCdkMakesRefetch from "../dms-cdk-makes/dms-cdk-makes.refetch.component";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
@@ -33,7 +33,7 @@ const mapDispatchToProps = (dispatch) => ({
});
export default connect(mapStateToProps, mapDispatchToProps)(DmsPostForm);
export function DmsPostForm({ bodyshop, socket, job }) {
export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
const [form] = Form.useForm();
const { t } = useTranslation();
@@ -61,6 +61,14 @@ export function DmsPostForm({ bodyshop, socket, job }) {
jobid: job.id,
txEnvelope: values,
});
console.log(logsRef);
if (logsRef) {
console.log("executing", logsRef);
logsRef.curent &&
logsRef.current.scrollIntoView({
behavior: "smooth",
});
}
};
return (
@@ -122,33 +130,36 @@ export function DmsPostForm({ bodyshop, socket, job }) {
</LayoutFormRow>
{bodyshop.cdk_dealerid && (
<LayoutFormRow style={{ justifyContent: "center" }} grow>
<Form.Item
name="dms_make"
label={t("jobs.fields.dms.dms_make")}
rules={[
{
required: true,
},
]}
>
<Input disabled />
</Form.Item>
<Form.Item
name="dms_model"
label={t("jobs.fields.dms.dms_model")}
rules={[
{
required: true,
},
]}
>
<Input disabled />
</Form.Item>
<DmsCdkMakes form={form} socket={socket} job={job} />
<DmsCdkMakesRefetch />
</LayoutFormRow>
<div>
<LayoutFormRow style={{ justifyContent: "center" }} grow>
<Form.Item
name="dms_make"
label={t("jobs.fields.dms.dms_make")}
rules={[
{
required: true,
},
]}
>
<Input disabled />
</Form.Item>
<Form.Item
name="dms_model"
label={t("jobs.fields.dms.dms_model")}
rules={[
{
required: true,
},
]}
>
<Input disabled />
</Form.Item>
</LayoutFormRow>
<Space>
<DmsCdkMakes form={form} socket={socket} job={job} />
<DmsCdkMakesRefetch />
</Space>
</div>
)}
<Form.Item
name="story"

View File

@@ -1,14 +1,30 @@
import { DeleteFilled, WarningFilled } from "@ant-design/icons";
import { useTreatments } from "@splitsoftware/splitio-react";
import { Divider, Form, Input, InputNumber, Radio, Space, Tag } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import FormDatePicker from "../form-date-picker/form-date-picker.component";
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component";
export default function PartsOrderModalComponent({
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(PartsOrderModalComponent);
export function PartsOrderModalComponent({
bodyshop,
vendorList,
sendTypeState,
isReturn,
@@ -16,7 +32,11 @@ export default function PartsOrderModalComponent({
job,
}) {
const [sendType, setSendType] = sendTypeState;
const { OEConnection } = useTreatments(
["OEConnection"],
{},
bodyshop.imexshopid
);
const { t } = useTranslation();
return (
@@ -164,7 +184,9 @@ export default function PartsOrderModalComponent({
<Radio value={"none"}>{t("general.labels.none")}</Radio>
<Radio value={"e"}>{t("parts_orders.labels.email")}</Radio>
<Radio value={"p"}>{t("parts_orders.labels.print")}</Radio>
<Radio value={"oec"}>{t("parts_orders.labels.oec")}</Radio>
{OEConnection.treatment === "on" && (
<Radio value={"oec"}>{t("parts_orders.labels.oec")}</Radio>
)}
</Radio.Group>
</div>
);

View File

@@ -550,6 +550,14 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
>
<Input />
</Form.Item>
<Form.Item
label={t(
"bodyshop.fields.responsibilitycenters.gst_override"
)}
name={[field.name, "gst_override"]}
>
<Input />
</Form.Item>
<DeleteFilled
onClick={() => {
remove(field.name);

View File

@@ -1919,6 +1919,7 @@ export const QUERY_JOB_EXPORT_DMS = gql`
v_model_yr
v_model_desc
area_of_damage
date_exported
}
}
`;

View File

@@ -7,13 +7,13 @@ import {
Result,
Row,
Select,
Space,
Space
} from "antd";
import queryString from "query-string";
import React, { useEffect, useState } from "react";
import React, { useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { useLocation, useHistory } from "react-router-dom";
import { useHistory, useLocation } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import SocketIO from "socket.io-client";
import AlertComponent from "../../components/alert/alert.component";
@@ -26,7 +26,7 @@ import { auth } from "../../firebase/firebase.utils";
import { QUERY_JOB_EXPORT_DMS } from "../../graphql/jobs.queries";
import {
setBreadcrumbs,
setSelectedHeader,
setSelectedHeader
} from "../../redux/application/application.actions";
import { selectBodyshop } from "../../redux/user/user.selectors";
@@ -66,6 +66,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
variables: { id: jobId },
skip: !jobId,
});
const logsRef = useRef(null);
useEffect(() => {
document.title = t("titles.dms");
@@ -125,12 +126,15 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
!(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber) ||
!(data && data.jobs_by_pk)
)
return <Result status="404" />;
return <Result status="404" title={t("general.errors.notfound")} />;
if (data.jobs_by_pk && data.jobs_by_pk.date_exported)
return <Result status="warning" title={t("dms.errors.alreadyexported")} />;
return (
<div>
<Row gutter={[16, 16]}>
<Col span={10}>
<Col md={24} lg={10}>
<DmsAllocationsSummary
title={`${data && data.jobs_by_pk && data.jobs_by_pk.ro_number} | ${
data.jobs_by_pk.ownr_fn || ""
@@ -143,51 +147,54 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) {
jobId={jobId}
/>
</Col>
<Col span={14}>
<Col md={24} lg={14}>
<DmsPostForm
socket={socket}
jobId={jobId}
job={data && data.jobs_by_pk}
logsRef={logsRef}
/>
</Col>
<DmsCustomerSelector />
<Col span={24}>
<Card
title={t("jobs.labels.dms.logs")}
extra={
<Space wrap>
<Select
placeholder="Log Level"
value={logLevel}
onChange={(value) => {
setLogLevel(value);
socket.emit("set-log-level", value);
}}
>
<Select.Option key="TRACE">TRACE</Select.Option>
<Select.Option key="DEBUG">DEBUG</Select.Option>
<Select.Option key="INFO">INFO</Select.Option>
<Select.Option key="WARNING">WARNING</Select.Option>
<Select.Option key="ERROR">ERROR</Select.Option>
</Select>
<Button onClick={() => setLogs([])}>Clear Logs</Button>
<Button
onClick={() => {
setLogs([]);
socket.disconnect();
socket.connect();
}}
>
Reconnect
</Button>
</Space>
}
>
<DmsLogEvents socket={socket} logs={logs} />
</Card>
</Col>
<div ref={logsRef}>
<Col span={24}>
<Card
title={t("jobs.labels.dms.logs")}
extra={
<Space wrap>
<Select
placeholder="Log Level"
value={logLevel}
onChange={(value) => {
setLogLevel(value);
socket.emit("set-log-level", value);
}}
>
<Select.Option key="TRACE">TRACE</Select.Option>
<Select.Option key="DEBUG">DEBUG</Select.Option>
<Select.Option key="INFO">INFO</Select.Option>
<Select.Option key="WARNING">WARNING</Select.Option>
<Select.Option key="ERROR">ERROR</Select.Option>
</Select>
<Button onClick={() => setLogs([])}>Clear Logs</Button>
<Button
onClick={() => {
setLogs([]);
socket.disconnect();
socket.connect();
}}
>
Reconnect
</Button>
</Space>
}
>
<DmsLogEvents socket={socket} logs={logs} />
</Card>
</Col>
</div>
</Row>
</div>
);

View File

@@ -394,6 +394,7 @@
"ar": "Accounts Receivable",
"ats": "ATS",
"federal_tax": "Federal Tax",
"gst_override": "GST Override Account #",
"la1": "LA1",
"la2": "LA2",
"la3": "LA3",
@@ -761,6 +762,9 @@
}
},
"dms": {
"errors": {
"alreadyexported": "This job has already been sent to the DMS. If you need to resend it, please use admin permissions to mark the job for re-export."
},
"labels": {
"refreshallocations": "Refresh to see DMS Allocataions."
}

View File

@@ -394,6 +394,7 @@
"ar": "",
"ats": "",
"federal_tax": "",
"gst_override": "",
"la1": "",
"la2": "",
"la3": "",
@@ -761,6 +762,9 @@
}
},
"dms": {
"errors": {
"alreadyexported": ""
},
"labels": {
"refreshallocations": ""
}

View File

@@ -394,6 +394,7 @@
"ar": "",
"ats": "",
"federal_tax": "",
"gst_override": "",
"la1": "",
"la2": "",
"la3": "",
@@ -761,6 +762,9 @@
}
},
"dms": {
"errors": {
"alreadyexported": ""
},
"labels": {
"refreshallocations": ""
}

View File

@@ -213,8 +213,7 @@ exports.default = async function (socket, jobid) {
}
if (job.towing_payable && job.towing_payable !== 0) {
const towAccountName =
selectedDmsAllocationConfig.profits.TOW;
const towAccountName = selectedDmsAllocationConfig.profits.TOW;
const towAccount = bodyshop.md_responsibility_centers.profits.find(
(c) => c.name === towAccountName
@@ -234,8 +233,7 @@ exports.default = async function (socket, jobid) {
}
}
if (job.storage_payable && job.storage_payable !== 0) {
const storageAccountName =
selectedDmsAllocationConfig.profits.TOW;
const storageAccountName = selectedDmsAllocationConfig.profits.TOW;
const towAccount = bodyshop.md_responsibility_centers.profits.find(
(c) => c.name === storageAccountName
@@ -258,8 +256,7 @@ exports.default = async function (socket, jobid) {
}
if (job.adjustment_bottom_line && job.adjustment_bottom_line !== 0) {
const otherAccountName =
selectedDmsAllocationConfig.profits.PAO;
const otherAccountName = selectedDmsAllocationConfig.profits.PAO;
const otherAccount = bodyshop.md_responsibility_centers.profits.find(
(c) => c.name === otherAccountName
@@ -310,7 +307,20 @@ exports.default = async function (socket, jobid) {
taxAllocations[key].cost.getAmount() > 0
)
.map((key) => {
return { ...taxAllocations[key], tax: key };
if (
key === "federal" &&
selectedDmsAllocationConfig.gst_override &&
selectedDmsAllocationConfig.gst_override !== ""
) {
const ret = { ...taxAllocations[key], tax: key };
ret.costCenter.dms_acctnumber =
selectedDmsAllocationConfig.gst_override;
ret.profitCenter.dms_acctnumber =
selectedDmsAllocationConfig.gst_override;
return ret;
} else {
return { ...taxAllocations[key], tax: key };
}
}),
];
} catch (error) {

View File

@@ -784,7 +784,7 @@ async function UpdateDmsVehicle(socket) {
return {
id: {
assigningPartyId:
o.id.value === socket.dmsCust.id.value ? "CURRENT" : "PREVIOUS",
o.id.value === socket.DMSCust.id.value ? "CURRENT" : "PREVIOUS",
value: o.id.value,
},
};