diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 9b5598b52..e43b973ce 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -23615,6 +23615,305 @@ jobs + + 3rdpartyfields + + + addr1 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + addr2 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + addr3 + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + attn + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + city + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + custgst + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + ded_amt + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + depreciation + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + other + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + ponumber + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + sendtype + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + state + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + zip + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + 3rdpartypayer + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + appointment_confirmation false @@ -23846,6 +24145,27 @@ + + thirdpartypayer + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + window_tag false diff --git a/client/src/components/bill-form/bill-form.component.jsx b/client/src/components/bill-form/bill-form.component.jsx index 794cabd4e..df4e8fc07 100644 --- a/client/src/components/bill-form/bill-form.component.jsx +++ b/client/src/components/bill-form/bill-form.component.jsx @@ -18,13 +18,14 @@ import { CHECK_BILL_INVOICE_NUMBER } from "../../graphql/bills.queries"; import { selectBodyshop } from "../../redux/user/user.selectors"; import AlertComponent from "../alert/alert.component"; import FormDatePicker from "../form-date-picker/form-date-picker.component"; +import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component"; import CurrencyInput from "../form-items-formatted/currency-form-item.component"; import JobSearchSelect from "../job-search-select/job-search-select.component"; 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 FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component"; + const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, }); diff --git a/client/src/components/job-3rd-party-modal/job-3rd-party-modal.component.jsx b/client/src/components/job-3rd-party-modal/job-3rd-party-modal.component.jsx new file mode 100644 index 000000000..4c94cad48 --- /dev/null +++ b/client/src/components/job-3rd-party-modal/job-3rd-party-modal.component.jsx @@ -0,0 +1,178 @@ +import { useQuery } from "@apollo/react-hooks"; +import { Button, Form, Input, InputNumber, Modal, Radio } from "antd"; +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; +import { SEARCH_VENDOR_AUTOCOMPLETE_WITH_ADDR } from "../../graphql/vendors.queries"; +import { GenerateDocument } from "../../utils/RenderTemplate"; +import { TemplateList } from "../../utils/TemplateConstants"; +import LayoutFormRow from "../layout-form-row/layout-form-row.component"; +import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component"; + +export default function Jobd3RdPartyModal({ jobId }) { + const [isModalVisible, setIsModalVisible] = useState(false); + const { t } = useTranslation(); + const [form] = Form.useForm(); + const { data: VendorAutoCompleteData } = useQuery( + SEARCH_VENDOR_AUTOCOMPLETE_WITH_ADDR + ); + + const showModal = () => { + setIsModalVisible(true); + }; + + const handleOk = () => { + form.submit(); + setIsModalVisible(false); + }; + + const handleCancel = () => { + setIsModalVisible(false); + }; + const handleFinish = (values) => { + const { sendtype, ...restVals } = values; + console.log(restVals); + GenerateDocument( + { + name: TemplateList("job_special").thirdpartypayer.key, + variables: { id: jobId }, + context: restVals, + }, + {}, + sendtype + ); + }; + + const handleVendorSelect = (vendorid, opt) => { + const vendor = VendorAutoCompleteData.vendors.filter( + (v) => v.id === vendorid + )[0]; + if (vendor) { + form.setFieldsValue({ + addr1: vendor.name, + addr2: vendor.street1, + addr3: vendor.street2, + city: vendor.city, + state: vendor.state, + zip: vendor.zip, + }); + } + }; + + return ( + <> + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {t("parts_orders.labels.email")} + {t("parts_orders.labels.print")} + + +
+
+ + ); +} diff --git a/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx b/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx index 9b367df72..177ad85b8 100644 --- a/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx +++ b/client/src/components/parts-receive-modal/parts-receive-modal.container.jsx @@ -33,7 +33,7 @@ export function PartsReceiveModalContainer({ const { t } = useTranslation(); const { visible, context, actions } = partsOrderModal; - const { jobId, partsorderlines } = context; + const { partsorderlines } = context; const { refetch } = actions; const [form] = Form.useForm(); 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 5b4d7ecc3..261339868 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 @@ -5,6 +5,7 @@ import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectPrintCenter } from "../../redux/modals/modals.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 PrintCenterSpeedPrint from "../print-center-speed-print/print-center-speed-print.component"; @@ -44,6 +45,7 @@ export function PrintCenterJobsComponent({ printCenterModal }) { ))} + diff --git a/client/src/graphql/vendors.queries.js b/client/src/graphql/vendors.queries.js index feb4b5452..faa114043 100644 --- a/client/src/graphql/vendors.queries.js +++ b/client/src/graphql/vendors.queries.js @@ -92,3 +92,21 @@ export const SEARCH_VENDOR_AUTOCOMPLETE = gql` } } `; + +export const SEARCH_VENDOR_AUTOCOMPLETE_WITH_ADDR = gql` + query SEARCH_VENDOR_AUTOCOMPLETE_WITH_ADDR { + vendors(order_by: { name: asc }) { + name + discount + id + cost_center + street1 + street2 + zip + country + city + email + state + } + } +`; diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 2600ec721..3938c4bf5 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -964,7 +964,7 @@ "lam": "Mechanical", "lar": "Refinish", "las": "Structural", - "lau": "LAU", + "lau": "User Defined", "local_tax_rate": "Local Tax Rate", "loss_date": "Loss Date", "loss_desc": "Loss Description", @@ -1017,8 +1017,8 @@ "rate_lag": "Glass", "rate_lam": "Mechanical", "rate_lar": "Refinish", - "rate_las": "Sublet", - "rate_lau": "Aluminum", + "rate_las": "Structural", + "rate_lau": "User Defined", "rate_ma2s": "2 Stage Paint", "rate_ma3s": "3 Stage Paint", "rate_mabl": "MABL??", @@ -1439,6 +1439,22 @@ "nocontexttype": "No context type set." }, "jobs": { + "3rdpartyfields": { + "addr1": "Address 1", + "addr2": "Address 2", + "addr3": "Address 3", + "attn": "Attention", + "city": "City", + "custgst": "Customer Portion of GST", + "ded_amt": "Deductible", + "depreciation": "Depreciation", + "other": "Other", + "ponumber": "PO Number", + "sendtype": "Send by", + "state": "Province/State", + "zip": "Postal Code/Zip" + }, + "3rdpartypayer": "Third Party Payer", "appointment_confirmation": "Appointment Confirmation", "casl_authorization": "CASL Authorization", "diagnostic_authorization": "Diagnostic Authorization", @@ -1450,6 +1466,7 @@ "payment_receipt": "Payment Receipt", "payments_by_job": "Job Payments", "ro_with_description": "RO Summary with Descriptions", + "thirdpartypayer": "Third Party Payer", "window_tag": "Window Tag", "work_authorization": "Work Authorization" }, diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index ec0ed328b..a05d001f8 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1017,8 +1017,8 @@ "rate_lag": "Tasa de vidrio", "rate_lam": "Tasa mecánica", "rate_lar": "Tasa de acabado", - "rate_las": "Tasa de subarriendo", - "rate_lau": "Tasa de aluminio", + "rate_las": "", + "rate_lau": "", "rate_ma2s": "Velocidad de pintura de 2 etapas", "rate_ma3s": "Tasa de pintura de 3 etapas", "rate_mabl": "MABL ??", @@ -1439,6 +1439,22 @@ "nocontexttype": "" }, "jobs": { + "3rdpartyfields": { + "addr1": "", + "addr2": "", + "addr3": "", + "attn": "", + "city": "", + "custgst": "", + "ded_amt": "", + "depreciation": "", + "other": "", + "ponumber": "", + "sendtype": "", + "state": "", + "zip": "" + }, + "3rdpartypayer": "", "appointment_confirmation": "", "casl_authorization": "", "diagnostic_authorization": "", @@ -1450,6 +1466,7 @@ "payment_receipt": "", "payments_by_job": "", "ro_with_description": "", + "thirdpartypayer": "", "window_tag": "", "work_authorization": "" }, diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index cecf4e11d..a2dc16c9b 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1017,7 +1017,7 @@ "rate_lag": "Taux de verre", "rate_lam": "Taux mécanique", "rate_lar": "Taux de finition", - "rate_las": "Taux de sous-location", + "rate_las": "", "rate_lau": "Taux d'aluminium", "rate_ma2s": "Taux de peinture en 2 étapes", "rate_ma3s": "Taux de peinture en 3 étapes", @@ -1439,6 +1439,22 @@ "nocontexttype": "" }, "jobs": { + "3rdpartyfields": { + "addr1": "", + "addr2": "", + "addr3": "", + "attn": "", + "city": "", + "custgst": "", + "ded_amt": "", + "depreciation": "", + "other": "", + "ponumber": "", + "sendtype": "", + "state": "", + "zip": "" + }, + "3rdpartypayer": "", "appointment_confirmation": "", "casl_authorization": "", "diagnostic_authorization": "", @@ -1450,6 +1466,7 @@ "payment_receipt": "", "payments_by_job": "", "ro_with_description": "", + "thirdpartypayer": "", "window_tag": "", "work_authorization": "" }, diff --git a/client/src/utils/CleanAxios.js b/client/src/utils/CleanAxios.js index 5fd2d919e..a35b44aa4 100644 --- a/client/src/utils/CleanAxios.js +++ b/client/src/utils/CleanAxios.js @@ -15,7 +15,6 @@ export const axiosAuthInterceptorId = axios.interceptors.request.use( config.headers.Authorization = `Bearer ${token}`; } } - console.log("Axios interceptor called."); return config; }, (error) => Promise.reject(error) diff --git a/client/src/utils/RenderTemplate.js b/client/src/utils/RenderTemplate.js index 2325c54fe..d0db5e0d0 100644 --- a/client/src/utils/RenderTemplate.js +++ b/client/src/utils/RenderTemplate.js @@ -44,11 +44,15 @@ export default async function RenderTemplate( "There are too many queries to choose from. Please ensure there are no conflicting keys." ); } - const { data: contextData } = await client.query({ - query: gql(templateQueryToExecute), - variables: { ...templateObject.variables }, - fetchPolicy: "network-only", - }); + let contextData; + if (templateQueryToExecute) { + const { data } = await client.query({ + query: gql(templateQueryToExecute), + variables: { ...templateObject.variables }, + fetchPolicy: "network-only", + }); + contextData = data; + } let reportRequest = { template: { @@ -58,8 +62,9 @@ export default async function RenderTemplate( ...(renderAsHtml ? {} : { recipe: "chrome-pdf" }), }, data: { - ...contextData, + ...(templateQueryToExecute ? contextData : {}), ...templateObject.variables, + ...templateObject.context, headerpath: `/${bodyshop.imexshopid}/header.html`, bodyshop: bodyshop, }, diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index 4c3cdce5e..6f96eaf88 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -77,6 +77,16 @@ export const TemplateList = (type, context) => { }, } : {}), + ...(!type || type === "job_special" + ? { + thirdpartypayer: { + title: i18n.t("printcenter.jobs.thirdpartypayer"), + description: "CSI invite", + key: "special/thirdpartypayer", + disabled: false, + }, + } + : {}), ...(!type || type === "appointment" ? { appointment_confirmation: {