diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 4bf60547c..a688deb45 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -2349,6 +2349,27 @@ actions + + deductallhours + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + edit false @@ -31108,6 +31129,27 @@ + + missingprofileinfo + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + multipayers false diff --git a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx index 9cad08f90..23a2e9c7f 100644 --- a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx +++ b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx @@ -98,6 +98,7 @@ function BillEnterModalContainer({ } = values; let adjustmentsToInsert = {}; + let payrollAdjustmentsToInsert = []; const r1 = await insertBill({ variables: { @@ -121,6 +122,24 @@ function BillEnterModalContainer({ (adjustmentsToInsert[lbr_adjustment.mod_lbr_ty] || 0) - restI.actual_price / lbr_adjustment.rate; } + + //If deduct from labor has lines, + // + if ( + deductedfromlbr && + true //payroll is on + ) { + payrollAdjustmentsToInsert.push({ + id: i.joblineid, + convertedtolbr: true, + convertedtolbr_data: { + mod_lb_hrs: + (restI.actual_price / lbr_adjustment.rate) * -1, + mod_lbr_ty: lbr_adjustment.mod_lbr_ty, + }, + }); + } + return { ...restI, deductedfromlbr: deductedfromlbr, @@ -146,6 +165,20 @@ function BillEnterModalContainer({ refetchQueries: ["QUERY_PARTS_BILLS_BY_JOBID"], }); + await Promise.all( + payrollAdjustmentsToInsert.map((li) => { + return updateJobLines({ + variables: { + lineId: li.id, + line: { + convertedtolbr: li.convertedtolbr, + convertedtolbr_data: li.convertedtolbr_data, + }, + }, + }); + }) + ); + const adjKeys = Object.keys(adjustmentsToInsert); if (adjKeys.length > 0) { //Query the adjustments, merge, and update them. diff --git a/client/src/components/bill-form/bill-form.lines.component.jsx b/client/src/components/bill-form/bill-form.lines.component.jsx index d3fc1f8e1..bf33d2aba 100644 --- a/client/src/components/bill-form/bill-form.lines.component.jsx +++ b/client/src/components/bill-form/bill-form.lines.component.jsx @@ -40,7 +40,7 @@ export function BillEnterModalLinesComponent({ billid, }) { const { t } = useTranslation(); - const { setFieldsValue, getFieldsValue, getFieldValue } = form; + const { setFieldsValue, getFieldsValue, getFieldValue, setFieldValue } = form; const { Simple_Inventory } = useTreatments( ["Simple_Inventory"], {}, @@ -376,9 +376,43 @@ export function BillEnterModalLinesComponent({ "rate", ]); + const billline = getFieldValue(["billlines", record.name]); + + const jobline = lineData.find( + (line) => line.id === billline?.joblineid + ); + + const employeeTeamName = bodyshop.employee_teams.find( + (team) => team.id === jobline?.assigned_team + ); + if (getFieldValue(["billlines", record.name, "deductedfromlbr"])) return (
+ + {t("joblines.fields.assigned_team", { + name: employeeTeamName?.name, + })} + {`${jobline.mod_lb_hrs} units`} + + - {price && - adjustmentRate && - `${(price / adjustmentRate).toFixed(1)} hrs`} + + {price && + adjustmentRate && + `${(price / adjustmentRate).toFixed(1)} hrs`} +
); return <>; diff --git a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx index 552c2ad47..aace2a52a 100644 --- a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx +++ b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx @@ -63,6 +63,12 @@ const BillLineSearchSelect = ( item.oem_partno ? ` - ${item.oem_partno}` : "" }${item.alt_partno ? ` (${item.alt_partno})` : ""}`.trim()} + {item.act_price === 0 && item.mod_lb_hrs > 0 && ( + + {`${item.mod_lb_hrs} units`} + + )} + {item.act_price ? `$${item.act_price && item.act_price.toFixed(2)}` diff --git a/client/src/components/job-profile-data-warning/job-profile-data-warning.component.jsx b/client/src/components/job-profile-data-warning/job-profile-data-warning.component.jsx new file mode 100644 index 000000000..f0ba998fc --- /dev/null +++ b/client/src/components/job-profile-data-warning/job-profile-data-warning.component.jsx @@ -0,0 +1,18 @@ +import { Alert } from "antd"; +import React from "react"; +import { useTranslation } from "react-i18next"; + +export default function JobProfileDataWarning({ job }) { + const { t } = useTranslation(); + + let missingProfileInfo = + Object.keys(job.cieca_pft).length === 0 || + Object.keys(job.cieca_pfl).length === 0 || + Object.keys(job.materials).length === 0; + + if (missingProfileInfo) + return ( + + ); + return null; +} diff --git a/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx b/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx index 504d0dce6..6bb247992 100644 --- a/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx +++ b/client/src/components/labor-allocations-table/labor-allocations-table.payroll.component.jsx @@ -239,7 +239,7 @@ export function PayrollLaborAllocationsTable({ }); if (response.status === 200) { - if (response.data.success) { + if (response.data.success !== false) { notification.open({ type: "success", message: t("timetickets.successes.payall"), diff --git a/client/src/graphql/jobs-lines.queries.js b/client/src/graphql/jobs-lines.queries.js index 47c382054..4ee5e5515 100644 --- a/client/src/graphql/jobs-lines.queries.js +++ b/client/src/graphql/jobs-lines.queries.js @@ -274,6 +274,7 @@ export const GET_JOB_LINES_TO_ENTER_BILL = gql` lbr_amt op_code_desc alt_partno + assigned_team } jobs_by_pk(id: $id) { id diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index 995d7f8c1..8eff287ff 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -54,6 +54,7 @@ import JobsDocumentsLocalGallery from "../../components/jobs-documents-local-gal import UndefinedToNull from "../../utils/undefinedtonull"; import NoteUpsertModalComponent from "../../components/note-upsert-modal/note-upsert-modal.container"; import _ from "lodash"; +import JobProfileDataWarning from "../../components/job-profile-data-warning/job-profile-data-warning.component"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -288,6 +289,7 @@ export function JobsDetailPage({ /> +