From 3f01ca12b48654716ebfb0b37a1532da96a712cc Mon Sep 17 00:00:00 2001 From: sebseb7 Date: Thu, 11 Sep 2025 06:47:57 +0200 Subject: [PATCH] feat(ui): add strikethrough original price display for rebated products Update Product component to show original price with red strikethrough and reduced opacity above the current price when rebate > 0. Calculate original price by reversing rebate percentage. Adjust layout with relative positioning and z-index for overlay. Ensure rebate prop is passed from ProductList to support this feature. --- src/components/Product.js | 53 ++++++++++++++++++++++++++--------- src/components/ProductList.js | 3 +- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/components/Product.js b/src/components/Product.js index c0bef23..081d68a 100644 --- a/src/components/Product.js +++ b/src/components/Product.js @@ -353,22 +353,49 @@ class Product extends Component { -
- - {new Intl.NumberFormat('de-DE', {style: 'currency', currency: currency || 'EUR'}).format(price)} - ({this.props.t ? this.props.t('product.inclVatFooter', { vat }) : `incl. ${vat}% USt.,*`}) - - - - +
+ + + {this.props.rebate && this.props.rebate > 0 && ( + + {(() => { + const rebatePct = this.props.rebate / 100; + const originalPrice = Math.round((price / (1 - rebatePct)) * 10) / 10; + return new Intl.NumberFormat('de-DE', {style: 'currency', currency: currency || 'EUR'}).format(originalPrice); + })()} + + )} + {new Intl.NumberFormat('de-DE', {style: 'currency', currency: currency || 'EUR'}).format(price)} + + ({this.props.t ? this.props.t('product.inclVatFooter', { vat }) : `incl. ${vat}% USt.,*`}) + +
{cGrundEinheit && fGrundPreis && fGrundPreis != price && ( ({new Intl.NumberFormat('de-DE', {style: 'currency', currency: currency || 'EUR'}).format(fGrundPreis)}/{cGrundEinheit}) )} -
{/*incoming*/} diff --git a/src/components/ProductList.js b/src/components/ProductList.js index cbba217..4f7ad7a 100644 --- a/src/components/ProductList.js +++ b/src/components/ProductList.js @@ -454,7 +454,7 @@ class ProductList extends Component { } }} > -