IO-2920 Refactor fee discounting to use API to check.

This commit is contained in:
Patrick Fic
2024-11-25 10:51:48 -08:00
parent 9c1774c417
commit 268b1ba9c1
4 changed files with 108 additions and 9 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
@@ -169,13 +170,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
}
]
@@ -211,7 +206,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" } };