feat: enhance discount and adjustment formatting

This commit is contained in:
Ahmed Bouhuolia
2024-12-04 12:00:22 +02:00
parent fabc88c81a
commit 6ab461a212
10 changed files with 24 additions and 12 deletions

View File

@@ -30,7 +30,7 @@ export default function EstimateDetailHeader() {
<CommercialDocTopHeader>
<DetailsMenu>
<AmountEstimateDetail label={intl.get('amount')}>
<span class="big-number">{estimate.formatted_amount}</span>
<span class="big-number">{estimate.total_formatted}</span>
</AmountEstimateDetail>
<EstimateStatusDetail>

View File

@@ -25,11 +25,11 @@ export default function EstimateDetailTableFooter() {
value={estimate.formatted_subtotal}
borderStyle={TotalLineBorderStyle.SingleDark}
/>
{estimate.discount_amount > 0 && (
{estimate?.discount_amount > 0 && (
<TotalLine
title={
estimate.discount_percentage_formatted
? `Discount [${invoice.discount_percentage_formatted}]`
? `Discount [${estimate.discount_percentage_formatted}]`
: 'Discount'
}
value={estimate.discount_amount_formatted}
@@ -38,7 +38,7 @@ export default function EstimateDetailTableFooter() {
)}
<TotalLine
title={<T id={'estimate.details.total'} />}
value={estimate.formatted_amount}
value={estimate.total_formatted}
borderStyle={TotalLineBorderStyle.DoubleDark}
textStyle={TotalLineTextStyle.Bold}
/>

View File

@@ -26,7 +26,7 @@ export function InvoiceDetailTableFooter() {
value={invoice.subtotal_formatted}
borderStyle={TotalLineBorderStyle.SingleDark}
/>
{invoice.discount_amount > 0 && (
{invoice?.discount_amount > 0 && (
<TotalLine
title={
invoice.discount_percentage_formatted
@@ -37,14 +37,14 @@ export function InvoiceDetailTableFooter() {
textStyle={TotalLineTextStyle.Regular}
/>
)}
{invoice.adjustment > 0 && (
{invoice?.adjustment > 0 && (
<TotalLine
title="Adjustment"
value={invoice.adjustment_formatted}
textStyle={TotalLineTextStyle.Regular}
/>
)}
{invoice.taxes.map((taxRate) => (
{invoice?.taxes?.map((taxRate) => (
<TotalLine
key={taxRate.id}
title={`${taxRate.name} [${taxRate.tax_rate}%]`}

View File

@@ -25,11 +25,11 @@ export default function VendorCreditDetailDrawerFooter() {
value={vendorCredit.formatted_subtotal}
borderStyle={TotalLineBorderStyle.SingleDark}
/>
{vendorCredit.discount_amount > 0 && (
{vendorCredit.discount_amount_formatted && (
<TotalLine
title={
bill.discount_percentage_formatted
? `Discount [${bill.discount_percentage_formatted}]`
vendorCredit.discount_percentage_formatted
? `Discount [${vendorCredit.discount_percentage_formatted}]`
: 'Discount'
}
value={vendorCredit.discount_amount_formatted}