Merge branch 'feature/IO-2920-cash-discounting' into release/2024-11-22

This commit is contained in:
Patrick Fic
2024-11-25 14:15:37 -08:00
9 changed files with 10976 additions and 10838 deletions

View File

@@ -7,6 +7,7 @@ import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import InstanceRenderManager from "../../utils/instanceRenderMgr";
import JobTotalsCashDiscount from "./jobs-totals.cash-discount-display.component";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
@@ -149,11 +150,27 @@ export function JobTotalsTableTotals({ bodyshop, job }) {
]
}),
{
key: t("jobs.labels.total_repairs"),
total: job.job_totals.totals.total_repairs,
bold: true
},
...(bodyshop.intellipay_config?.enable_cash_discount
? [
{
key: t("jobs.labels.total_repairs_cash_discount"),
total: job.job_totals.totals.total_repairs,
bold: true
},
{
key: t("jobs.labels.total_repairs"),
render: <JobTotalsCashDiscount amountDinero={job.job_totals.totals.total_repairs} />,
bold: true
}
]
: [
{
key: t("jobs.labels.total_repairs"),
total: job.job_totals.totals.total_repairs,
bold: true
}
]),
{
key: t("jobs.fields.ded_amt"),
total: job.job_totals.totals.custPayable.deductible
@@ -186,13 +203,7 @@ export function JobTotalsTableTotals({ bodyshop, job }) {
},
{
key: t("jobs.labels.total_cust_payable"),
total: Dinero(job.job_totals.totals.custPayable.total)
.add(
Dinero(job.job_totals.totals.custPayable.total).percentage(
bodyshop.intellipay_config?.cash_discount_percentage || 0
)
)
.toJSON(),
render: <JobTotalsCashDiscount amountDinero={job.job_totals.totals.custPayable.total} />,
bold: true
}
]
@@ -228,7 +239,7 @@ export function JobTotalsTableTotals({ bodyshop, job }) {
dataIndex: "total",
key: "total",
align: "right",
render: (text, record) => Dinero(record.total).toFormat(),
render: (text, record) => (record.render ? record.render : Dinero(record.total).toFormat()),
width: "20%",
onCell: (record, rowIndex) => {
return { style: { fontWeight: record.bold && "bold" } };