diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 8d18dce03..c905978c4 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -26084,6 +26084,27 @@ + + additionalpayeroverallocation + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + additionaltotal false @@ -28062,6 +28083,27 @@ + + multipayers + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + net_repairs false diff --git a/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx b/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx index 73da49047..d0746a92b 100644 --- a/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx +++ b/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx @@ -16,6 +16,7 @@ import DataLabel from "../data-label/data-label.component"; import { selectBodyshop } from "../../redux/user/user.selectors"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; +import { useTreatments } from "@splitsoftware/splitio-react"; const SelectorDiv = styled.div` .ant-form-item .ant-select { @@ -37,6 +38,11 @@ export default connect( export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { const { t } = useTranslation(); + const { Qb_Multi_Ar } = useTreatments( + ["Qb_Multi_Ar"], + {}, + bodyshop && bodyshop.imexshopid + ); const [costOptions, setCostOptions] = useState( [ @@ -4535,24 +4541,26 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { - Multiple Payers Item}> - - - - + {Qb_Multi_Ar.treatment === "on" && ( + Multiple Payers Item}> + + + + + )} {t("bodyshop.labels.responsibilitycenters.sales_tax_codes")} diff --git a/client/src/graphql/audit_trail.queries.js b/client/src/graphql/audit_trail.queries.js index b0c0b3f40..793cc0001 100644 --- a/client/src/graphql/audit_trail.queries.js +++ b/client/src/graphql/audit_trail.queries.js @@ -26,6 +26,7 @@ export const QUERY_AUDIT_TRAIL = gql` subject to useremail + status } } `; diff --git a/client/src/pages/jobs-close/jobs-close.component.jsx b/client/src/pages/jobs-close/jobs-close.component.jsx index b8f73c144..3df8aafc6 100644 --- a/client/src/pages/jobs-close/jobs-close.component.jsx +++ b/client/src/pages/jobs-close/jobs-close.component.jsx @@ -12,7 +12,9 @@ import { Popconfirm, Select, Space, + Statistic, Switch, + Typography, } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; @@ -33,7 +35,7 @@ import { generateJobLinesUpdatesForInvoicing } from "../../graphql/jobs-lines.qu import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { selectJobReadOnly } from "../../redux/application/application.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors"; - +import Dinero from "dinero.js"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, jobRO: selectJobReadOnly, @@ -325,9 +327,41 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) { )} + {t("jobs.labels.multipayers")} {Qb_Multi_Ar.treatment === "on" && ( - <> - + + ({ + validator(_, value) { + let totalAllocated = Dinero(); + + const payers = form.getFieldValue("qb_multiple_payers"); + payers && + payers.forEach((payer) => { + totalAllocated = totalAllocated.add( + Dinero({ + amount: Math.round((payer?.amount || 0) * 100), + }) + ); + }); + const discrep = job.job_totals + ? Dinero(job.job_totals.totals.total_repairs).subtract( + totalAllocated + ) + : Dinero(); + return discrep.getAmount() > 0 + ? Promise.resolve() + : Promise.reject( + new Error( + t("jobs.labels.additionalpayeroverallocation") + ) + ); + }, + }), + ]} + > {(fields, { add, remove }) => { return (
@@ -382,7 +416,7 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {