mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 00:38:11 +00:00
Merge pull request #640 from Tria-plc/freight_feature/usermanagement
Freight feature/usermanagement
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -24,9 +24,10 @@ export interface GlShipmentQuantities {
|
||||
hazardousQuantity: number;
|
||||
reeferQuantity: number;
|
||||
}>;
|
||||
/** Bulk: tons (or item count) + hazardous qty. */
|
||||
/** Bulk: tons (or item count) + hazardous/reefer qty. */
|
||||
bulkQuantity: number;
|
||||
bulkHazardousQuantity: number;
|
||||
bulkReeferQuantity: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,6 +114,30 @@ export function computeGlShipmentTotal(
|
||||
amount: rate.unitPrice * qty,
|
||||
});
|
||||
}
|
||||
if (contract.isHazardous && q.bulkHazardousQuantity > 0) {
|
||||
const hz = rateFor((i) => i.conditionalOn === "is_hazardous");
|
||||
if (hz) {
|
||||
lines.push({
|
||||
label: hz.label,
|
||||
unitPrice: hz.unitPrice,
|
||||
unit: hz.unit,
|
||||
quantity: q.bulkHazardousQuantity,
|
||||
amount: hz.unitPrice * q.bulkHazardousQuantity,
|
||||
});
|
||||
}
|
||||
}
|
||||
if (contract.isReefer && q.bulkReeferQuantity > 0) {
|
||||
const rf = rateFor((i) => i.conditionalOn === "is_reefer");
|
||||
if (rf) {
|
||||
lines.push({
|
||||
label: rf.label,
|
||||
unitPrice: rf.unitPrice,
|
||||
unit: rf.unit,
|
||||
quantity: q.bulkReeferQuantity,
|
||||
amount: rf.unitPrice * q.bulkReeferQuantity,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const total = lines.reduce((s, l) => s + l.amount, 0);
|
||||
|
||||
Reference in New Issue
Block a user