Skip to content

Commit

Permalink
fix for Update button unresponsive on editing an existing invoice - V…
Browse files Browse the repository at this point in the history
…AT ID fix
  • Loading branch information
artem matinian committed Dec 13, 2024
1 parent ec2028b commit 281c58d
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ const EditInvoiceDetailsContent = ({
line_items: invoice.line_items.map((lineItem) => ({
quantity: lineItem.quantity,
product_id: lineItem.product.id,
...(lineItem.vat_rate_id !== undefined
? { vat_rate_id: lineItem.vat_rate_id }
: { tax_rate_value: lineItem.tax_rate_value * 100 }),
...(lineItem.product.vat_rate.id !== null
? { vat_rate_id: lineItem.product.vat_rate.id,
vat_rate_value: lineItem.product.vat_rate.value,
}
: { tax_rate_value: lineItem.product.vat_rate.value / 100 }),
name: lineItem.product.name,
price: lineItem.product.price,
measure_unit_id: lineItem.product.measure_unit?.id ?? '',
Expand All @@ -117,6 +119,7 @@ const EditInvoiceDetailsContent = ({
overdue_reminder_id: invoice.overdue_reminder_id ?? '',
},
});

const [actualCurrency, setActualCurrency] = useState(invoice.currency);
const {
handleSubmit,
Expand Down Expand Up @@ -198,7 +201,8 @@ const EditInvoiceDetailsContent = ({
quantity: lineItem.quantity,
product_id: lineItem.product_id,
...(lineItem.vat_rate_id !== undefined
? { vat_rate_id: lineItem.vat_rate_id }
? { vat_rate_id: lineItem.vat_rate_id,
}
: { tax_rate_value: lineItem.tax_rate_value * 100 }),
})),
};
Expand Down

0 comments on commit 281c58d

Please sign in to comment.