mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 06:47:17 +10:00
Improve error messages when TransactionPanel is rendering line-items.
This commit is contained in:
parent
e116c1cd6a
commit
467377027b
4 changed files with 19 additions and 0 deletions
|
|
@ -52,6 +52,10 @@ const LineItemBookingPeriod = props => {
|
|||
item => item.code === unitType && !item.reversal
|
||||
);
|
||||
|
||||
if (!unitPurchase) {
|
||||
throw new Error(`LineItemBookingPeriod: lineItem (${unitType}) missing`);
|
||||
}
|
||||
|
||||
const useQuantityForDayCount = isNightly || isDaily;
|
||||
const count = useQuantityForDayCount ? unitPurchase.quantity.toFixed() : dayCount;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@ const LineItemSubTotalMaybe = props => {
|
|||
const unitPurchase = transaction.attributes.lineItems.find(
|
||||
item => item.code === unitType && !item.reversal
|
||||
);
|
||||
|
||||
if (!unitPurchase) {
|
||||
throw new Error(`LineItemSubTotalMaybe: lineItem (${unitType}) missing`);
|
||||
}
|
||||
|
||||
const formattedSubTotal = formatMoney(intl, unitPurchase.lineTotal);
|
||||
|
||||
return showSubTotal ? (
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ const LineItemUnitPrice = props => {
|
|||
const unitPurchase = transaction.attributes.lineItems.find(
|
||||
item => item.code === unitType && !item.reversal
|
||||
);
|
||||
|
||||
if (!unitPurchase) {
|
||||
throw new Error(`LineItemUnitPrice: lineItem (${unitType}) missing`);
|
||||
}
|
||||
|
||||
const formattedUnitPrice = formatMoney(intl, unitPurchase.unitPrice);
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ const LineItemUnitsMaybe = props => {
|
|||
const unitPurchase = transaction.attributes.lineItems.find(
|
||||
item => item.code === unitType && !item.reversal
|
||||
);
|
||||
|
||||
if (!unitPurchase) {
|
||||
throw new Error(`LineItemUnitsMaybe: lineItem (${unitType}) missing`);
|
||||
}
|
||||
|
||||
const quantity = unitPurchase.quantity;
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue