diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index c6fbd2117..23adaf98d 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -14010,6 +14010,27 @@ + + print + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + refresh false @@ -34070,6 +34091,74 @@ + + labels + + + count + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + labels + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + position + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + mpi_animal_checklist false diff --git a/client/package.json b/client/package.json index 34ae41cea..71d7bfa89 100644 --- a/client/package.json +++ b/client/package.json @@ -111,9 +111,13 @@ "last 1 safari version" ] }, + "resolutions": { + "react-error-overlay": "6.0.9" + }, "devDependencies": { "@sentry/webpack-plugin": "^1.18.3", "@testing-library/cypress": "^8.0.2", + "react-error-overlay": "6.0.9", "cypress": "^9.1.1", "eslint-plugin-cypress": "^2.12.1", "redux-logger": "^3.0.6", diff --git a/client/src/components/bill-form-lines-extended/bill-form-lines-extended.component.jsx b/client/src/components/bill-form-lines-extended/bill-form-lines-extended.component.jsx new file mode 100644 index 000000000..ad356cae0 --- /dev/null +++ b/client/src/components/bill-form-lines-extended/bill-form-lines-extended.component.jsx @@ -0,0 +1,135 @@ +import { Form, Input, Table } from "antd"; +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; +import CurrencyFormatter from "../../utils/CurrencyFormatter"; +import { alphaSort } from "../../utils/sorters"; +import BillFormItemsExtendedFormItem from "./bill-form-lines.extended.formitem.component"; +export default function BillFormLinesExtended({ + lineData, + discount, + form, + responsibilityCenters, + disabled, +}) { + const [search, setSearch] = useState(""); + const { t } = useTranslation(); + const columns = [ + { + title: t("joblines.fields.line_desc"), + dataIndex: "line_desc", + key: "line_desc", + width: "10%", + sorter: (a, b) => alphaSort(a.line_desc, b.line_desc), + }, + { + title: t("joblines.fields.oem_partno"), + dataIndex: "oem_partno", + key: "oem_partno", + width: "10%", + sorter: (a, b) => alphaSort(a.oem_partno, b.oem_partno), + }, + { + title: t("joblines.fields.part_type"), + dataIndex: "part_type", + key: "part_type", + width: "10%", + filters: [ + { + text: t("jobs.labels.partsfilter"), + value: ["PAN", "PAP", "PAL", "PAA", "PAS", "PASL"], + }, + { + text: t("joblines.fields.part_types.PAN"), + value: ["PAN", "PAP"], + }, + { + text: t("joblines.fields.part_types.PAL"), + value: ["PAL"], + }, + { + text: t("joblines.fields.part_types.PAA"), + value: ["PAA"], + }, + { + text: t("joblines.fields.part_types.PAS"), + value: ["PAS", "PASL"], + }, + ], + onFilter: (value, record) => value.includes(record.part_type), + render: (text, record) => + record.part_type + ? t(`joblines.fields.part_types.${record.part_type}`) + : null, + }, + + { + title: t("joblines.fields.act_price"), + dataIndex: "act_price", + key: "act_price", + width: "10%", + sorter: (a, b) => a.act_price - b.act_price, + shouldCellUpdate: false, + render: (text, record) => ( + <> + + {record.db_ref === "900510" || record.db_ref === "900511" + ? record.prt_dsmk_m + : record.act_price} + + {record.part_qty ? `(x ${record.part_qty})` : null} + {record.prt_dsmk_p && record.prt_dsmk_p !== 0 ? ( + {`(${record.prt_dsmk_p}%)`} + ) : ( + <>> + )} + > + ), + }, + { + title: t("billlines.fields.posting"), + dataIndex: "posting", + key: "posting", + + render: (text, record, index) => ( + + + + ), + }, + ]; + + const data = + search === "" + ? lineData + : lineData.filter( + (l) => + (l.line_desc && + l.line_desc.toLowerCase().includes(search.toLowerCase())) || + (l.oem_partno && + l.oem_partno.toLowerCase().includes(search.toLowerCase())) || + (l.act_price && + l.act_price.toString().startsWith(search.toString())) + ); + + return ( + + console.log(form.getFieldsValue())}>form + setSearch(e.target.value)} allowClear /> + + + ); +} diff --git a/client/src/components/bill-form-lines-extended/bill-form-lines.extended.formitem.component.jsx b/client/src/components/bill-form-lines-extended/bill-form-lines.extended.formitem.component.jsx new file mode 100644 index 000000000..32824e50e --- /dev/null +++ b/client/src/components/bill-form-lines-extended/bill-form-lines.extended.formitem.component.jsx @@ -0,0 +1,288 @@ +import React from "react"; +import { + PlusCircleFilled, + MinusCircleFilled, + WarningOutlined, +} from "@ant-design/icons"; +import { Form, Button, InputNumber, Input, Select, Switch, Space } from "antd"; +import { useTranslation } from "react-i18next"; + +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +import CurrencyInput from "../form-items-formatted/currency-form-item.component"; +import CiecaSelect from "../../utils/Ciecaselect"; + +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); +export default connect( + mapStateToProps, + mapDispatchToProps +)(BillFormItemsExtendedFormItem); + +export function BillFormItemsExtendedFormItem({ + value, + bodyshop, + form, + record, + index, + disabled, + responsibilityCenters, + discount, +}) { + // const { billlineskeys } = form.getFieldsValue("billlineskeys"); + + const { t } = useTranslation(); + if (!value) + return ( + { + const values = form.getFieldsValue("billlineskeys"); + + form.setFieldsValue({ + ...values, + billlineskeys: { + ...(values.billlineskeys || {}), + [record.id]: { + joblineid: record.id, + line_desc: record.line_desc, + quantity: record.part_qty || 1, + actual_price: record.act_price, + cost_center: record.part_type + ? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid + ? record.part_type + : responsibilityCenters.defaults && + (responsibilityCenters.defaults.costs[record.part_type] || + null) + : null, + }, + }, + }); + }} + > + + + ); + + return ( + + + + + + + + + { + const { billlineskeys } = form.getFieldsValue("billlineskeys"); + form.setFieldsValue({ + billlineskeys: { + ...billlineskeys, + [record.id]: { + ...billlineskeys[billlineskeys], + actual_cost: !!billlineskeys[billlineskeys].actual_cost + ? billlineskeys[billlineskeys].actual_cost + : Math.round( + (parseFloat(e.target.value) * (1 - discount) + + Number.EPSILON) * + 100 + ) / 100, + }, + }, + }); + }} + /> + + + + + + {() => { + const line = value; + if (!!!line) return null; + const lineDiscount = ( + 1 - + Math.round((line.actual_cost / line.actual_price) * 100) / 100 + ).toPrecision(2); + + if (lineDiscount - discount === 0) return ; + return ; + }} + + + + {bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber + ? CiecaSelect(true, false) + : responsibilityCenters.costs.map((item) => ( + {item.name} + ))} + + + + + {bodyshop.md_parts_locations.map((loc, idx) => ( + + {loc} + + ))} + + + + + + + {() => { + if ( + form.getFieldsValue("billlineskeys").billlineskeys[record.id] + .deductedfromlbr + ) + return ( + + + + + {t("joblines.fields.lbr_types.LAA")} + + + {t("joblines.fields.lbr_types.LAB")} + + + {t("joblines.fields.lbr_types.LAD")} + + + {t("joblines.fields.lbr_types.LAE")} + + + {t("joblines.fields.lbr_types.LAF")} + + + {t("joblines.fields.lbr_types.LAG")} + + + {t("joblines.fields.lbr_types.LAM")} + + + {t("joblines.fields.lbr_types.LAR")} + + + {t("joblines.fields.lbr_types.LAS")} + + + {t("joblines.fields.lbr_types.LAU")} + + + {t("joblines.fields.lbr_types.LA1")} + + + {t("joblines.fields.lbr_types.LA2")} + + + {t("joblines.fields.lbr_types.LA3")} + + + {t("joblines.fields.lbr_types.LA4")} + + + + + + + + ); + return <>>; + }} + + + + + + + + + + + + + { + const values = form.getFieldsValue("billlineskeys"); + + form.setFieldsValue({ + ...values, + billlineskeys: { + ...(values.billlineskeys || {}), + [record.id]: null, + }, + }); + }} + > + + + + ); +} diff --git a/client/src/components/bill-form/bill-form.component.jsx b/client/src/components/bill-form/bill-form.component.jsx index 60e48509a..c6a979d56 100644 --- a/client/src/components/bill-form/bill-form.component.jsx +++ b/client/src/components/bill-form/bill-form.component.jsx @@ -28,6 +28,8 @@ import LayoutFormRow from "../layout-form-row/layout-form-row.component"; import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component"; import BillFormLines from "./bill-form.lines.component"; import { CalculateBillTotal } from "./bill-form.totals.utility"; +import { useTreatments } from "@splitsoftware/splitio-react"; +import BillFormLinesExtended from "../bill-form-lines-extended/bill-form-lines-extended.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -49,7 +51,11 @@ export function BillFormComponent({ const { t } = useTranslation(); const client = useApolloClient(); const [discount, setDiscount] = useState(0); - + const { Extended_Bill_Posting } = useTreatments( + ["Extended_Bill_Posting"], + {}, + bodyshop.imexshopid + ); const handleVendorSelect = (props, opt) => { setDiscount(opt.discount); }; @@ -357,13 +363,24 @@ export function BillFormComponent({ {t("bills.labels.bill_lines")} - + + {Extended_Bill_Posting.treatment === "on" ? ( + + ) : ( + + )} @@ -174,6 +175,22 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) { + + + + + {(fields, { add, remove }) => { return ( diff --git a/client/src/components/print-center-jobs-labels/print-center-jobs-labels.component.jsx b/client/src/components/print-center-jobs-labels/print-center-jobs-labels.component.jsx new file mode 100644 index 000000000..a45339d56 --- /dev/null +++ b/client/src/components/print-center-jobs-labels/print-center-jobs-labels.component.jsx @@ -0,0 +1,83 @@ +import { Button, Card, Form, InputNumber, Popover } from "antd"; +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 { GenerateDocument } from "../../utils/RenderTemplate"; +import { TemplateList } from "../../utils/TemplateConstants"; + +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); +export default connect( + mapStateToProps, + mapDispatchToProps +)(PrintCenterJobsLabels); + +export function PrintCenterJobsLabels({ bodyshop, jobId }) { + const [isModalVisible, setIsModalVisible] = useState(false); + const [loading, setLoading] = useState(false); + const { t } = useTranslation(); + const [form] = Form.useForm(); + + const handleOk = () => { + form.submit(); + setIsModalVisible(false); + }; + + const handleCancel = () => { + setIsModalVisible(false); + setLoading(false); + }; + const handleFinish = async (values) => { + const { sendtype, ...restVals } = values; + setLoading(true); + await GenerateDocument( + { + name: TemplateList("job_special").folder_label_multiple.key, + variables: { id: jobId }, + context: restVals, + }, + {}, + "p" + ); + setLoading(false); + setIsModalVisible(false); + }; + + const content = ( + + + + + + + + + + {t("general.actions.print")} + + {t("general.actions.cancel")} + + + ); + return ( + + setIsModalVisible(true)}> + {t("printcenter.jobs.labels.labels")} + + + ); +} diff --git a/client/src/components/print-center-jobs/print-center-jobs.component.jsx b/client/src/components/print-center-jobs/print-center-jobs.component.jsx index 7773a89df..bd21a6e25 100644 --- a/client/src/components/print-center-jobs/print-center-jobs.component.jsx +++ b/client/src/components/print-center-jobs/print-center-jobs.component.jsx @@ -9,6 +9,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors"; import { TemplateList } from "../../utils/TemplateConstants"; import Jobd3RdPartyModal from "../job-3rd-party-modal/job-3rd-party-modal.component"; import PrintCenterItem from "../print-center-item/print-center-item.component"; +import PrintCenterJobsLabels from "../print-center-jobs-labels/print-center-jobs-labels.component"; import PrintCenterSpeedPrint from "../print-center-speed-print/print-center-speed-print.component"; const mapStateToProps = createStructuredSelector({ printCenterModal: selectPrintCenter, @@ -52,6 +53,7 @@ export function PrintCenterJobsComponent({ printCenterModal, bodyshop }) { + setSearch(e.target.value)} diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index a9e6c1478..6ec415432 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -2032,6 +2032,8 @@ export const QUERY_JOB_EXPORT_DMS = gql` po_number clm_no job_totals + ded_amt + ded_status ownr_fn ownr_ln ownr_co_nm diff --git a/client/src/pages/dms/dms.container.jsx b/client/src/pages/dms/dms.container.jsx index 48d3a69d3..8fc496718 100644 --- a/client/src/pages/dms/dms.container.jsx +++ b/client/src/pages/dms/dms.container.jsx @@ -13,7 +13,7 @@ import queryString from "query-string"; import React, { useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useHistory, useLocation, Link } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import SocketIO from "socket.io-client"; import AlertComponent from "../../components/alert/alert.component"; @@ -138,13 +138,20 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) { + {`${ + data && data.jobs_by_pk && data.jobs_by_pk.ro_number + }`} + {` | ${data.jobs_by_pk.ownr_fn || ""} ${ + data.jobs_by_pk.ownr_ln || "" + } ${data.jobs_by_pk.ownr_co_nm || ""} | ${ + data.jobs_by_pk.v_model_yr || "" + } ${data.jobs_by_pk.v_make_desc || ""} ${ + data.jobs_by_pk.v_model_desc || "" + }`} + + } socket={socket} jobId={jobId} /> diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index bfabd708d..78d35cd95 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -890,6 +890,7 @@ "deselectall": "Deselect All", "edit": "Edit", "login": "Login", + "print": "Print", "refresh": "Refresh", "remove": "Remove", "reset": "Reset your changes.", @@ -2032,6 +2033,11 @@ "job_costing_ro": "Job Costing", "job_notes": "Job Notes", "key_tag": "Key Tag", + "labels": { + "count": "Count", + "labels": "Labels", + "position": "Starting Position" + }, "mpi_animal_checklist": "MPI - Animal Checklist", "mpi_eglass_auth": "MPI - eGlass Auth", "mpi_final_acct_sheet": "MPI - Final Accounting Sheet", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 0edd70d22..758e2aa00 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -890,6 +890,7 @@ "deselectall": "", "edit": "Editar", "login": "", + "print": "", "refresh": "", "remove": "", "reset": " Restablecer a original.", @@ -2032,6 +2033,11 @@ "job_costing_ro": "", "job_notes": "", "key_tag": "", + "labels": { + "count": "", + "labels": "", + "position": "" + }, "mpi_animal_checklist": "", "mpi_eglass_auth": "", "mpi_final_acct_sheet": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index f1debe9fd..5ec013d95 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -890,6 +890,7 @@ "deselectall": "", "edit": "modifier", "login": "", + "print": "", "refresh": "", "remove": "", "reset": " Rétablir l'original.", @@ -2032,6 +2033,11 @@ "job_costing_ro": "", "job_notes": "", "key_tag": "", + "labels": { + "count": "", + "labels": "", + "position": "" + }, "mpi_animal_checklist": "", "mpi_eglass_auth": "", "mpi_final_acct_sheet": "", diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index a62804e8b..b0cb049ab 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -464,6 +464,12 @@ export const TemplateList = (type, context) => { key: "special_thirdpartypayer", disabled: false, }, + folder_label_multiple: { + title: i18n.t("printcenter.jobs.folder_label_multiple"), + description: "Folder Label Multiple", + key: "folder_label_multiple", + disabled: false, + }, csi_invitation_action: { title: i18n.t("printcenter.jobs.csi_invitation_action"), description: "CSI invite", diff --git a/client/yarn.lock b/client/yarn.lock index 6f354ec84..cb4de1d5b 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -11842,10 +11842,10 @@ react-draggable@^4.0.0, react-draggable@^4.0.3: clsx "^1.1.1" prop-types "^15.6.0" -react-error-overlay@^6.0.9: - version "6.0.10" - resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.10.tgz#0fe26db4fa85d9dbb8624729580e90e7159a59a6" - integrity sha512-mKR90fX7Pm5seCOfz8q9F+66VCc1PGsWSBxKbITjfKVQHMNF2zudxHnMdJiB1fRCb+XsbQV9sO9DCkgsMQgBIA== +react-error-overlay@6.0.9, react-error-overlay@^6.0.9: + version "6.0.9" + resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.9.tgz#3c743010c9359608c375ecd6bc76f35d93995b0a" + integrity sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew== react-grid-gallery@^0.5.5: version "0.5.5"