Improve backwards compatibility for job totals calculations.
This commit is contained in:
@@ -13,9 +13,11 @@ export default function JobTotalsTableParts({ job }) {
|
||||
});
|
||||
|
||||
const insuranceAdjustments = useMemo(() => {
|
||||
if (!job.job_totals) return [];
|
||||
if (!job.job_totals?.parts?.adjustments) return [];
|
||||
const adjs = [];
|
||||
Object.keys(job.job_totals.parts.adjustments).forEach((key) => {
|
||||
if (Dinero(job.job_totals.parts.adjustments[key]).getAmount() !== 0) {
|
||||
Object.keys(job.job_totals?.parts?.adjustments).forEach((key) => {
|
||||
if (Dinero(job.job_totals?.parts?.adjustments[key]).getAmount() !== 0) {
|
||||
adjs.push({
|
||||
id: key,
|
||||
amount: Dinero(job.job_totals.parts.adjustments[key]),
|
||||
@@ -25,10 +27,6 @@ export default function JobTotalsTableParts({ job }) {
|
||||
|
||||
return adjs;
|
||||
}, [job.job_totals.parts.adjustments]);
|
||||
console.log(
|
||||
"🚀 ~ file: job-totals.table.parts.component.jsx:16 ~ insuranceAdjustments ~ insuranceAdjustments",
|
||||
insuranceAdjustments
|
||||
);
|
||||
|
||||
const data = useMemo(() => {
|
||||
return Object.keys(job.job_totals.parts.parts.list)
|
||||
|
||||
Reference in New Issue
Block a user