feat(ui): add original price display for rebated products

This commit is contained in:
sebseb7
2025-09-11 06:30:10 +02:00
parent 8abaef8110
commit 71fb9bafcd

View File

@@ -713,6 +713,16 @@ class ProductDetailPage extends Component {
currency: "EUR",
}).format(product.price);
let originalPriceWithTax = null;
if (product.rebate && product.rebate > 0) {
const rebatePct = product.rebate / 100;
const originalPrice = Math.round((product.price / (1 - rebatePct)) * 10) / 10;
originalPriceWithTax = new Intl.NumberFormat("de-DE", {
style: "currency",
currency: "EUR",
}).format(originalPrice);
}
return (
<Container
maxWidth="lg"
@@ -952,6 +962,20 @@ class ProductDetailPage extends Component {
color="primary"
sx={{ fontWeight: "bold" }}
>
{originalPriceWithTax && (
<Typography
component="span"
variant="h6"
sx={{
textDecoration: 'line-through',
color: 'text.secondary',
mr: 1,
display: 'inline-block'
}}
>
{originalPriceWithTax}
</Typography>
)}
{priceWithTax}
</Typography>
<Typography variant="body2" color="text.secondary">