feat(ui): add original price display for rebated products
This commit is contained in:
@@ -713,6 +713,16 @@ class ProductDetailPage extends Component {
|
|||||||
currency: "EUR",
|
currency: "EUR",
|
||||||
}).format(product.price);
|
}).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 (
|
return (
|
||||||
<Container
|
<Container
|
||||||
maxWidth="lg"
|
maxWidth="lg"
|
||||||
@@ -952,6 +962,20 @@ class ProductDetailPage extends Component {
|
|||||||
color="primary"
|
color="primary"
|
||||||
sx={{ fontWeight: "bold" }}
|
sx={{ fontWeight: "bold" }}
|
||||||
>
|
>
|
||||||
|
{originalPriceWithTax && (
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
variant="h6"
|
||||||
|
sx={{
|
||||||
|
textDecoration: 'line-through',
|
||||||
|
color: 'text.secondary',
|
||||||
|
mr: 1,
|
||||||
|
display: 'inline-block'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{originalPriceWithTax}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
{priceWithTax}
|
{priceWithTax}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="body2" color="text.secondary">
|
<Typography variant="body2" color="text.secondary">
|
||||||
|
|||||||
Reference in New Issue
Block a user