removed the title and modified the change calcluator
This commit is contained in:
parent
19a433a420
commit
8c8d8d5732
@ -34,7 +34,8 @@ const ChangeCalculatorPage: React.FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const total = moneyItems.reduce((sum, item) => sum + item.value * item.count, 0);
|
const total = moneyItems.reduce((sum, item) => sum + item.value * item.count, 0);
|
||||||
setCustomerTotal(total);
|
setCustomerTotal(total);
|
||||||
setChangeAmount(Math.max(0, total - cartTotal));
|
// Allow negative values when customer hasn't paid enough
|
||||||
|
setChangeAmount(total - cartTotal);
|
||||||
}, [moneyItems, cartTotal]);
|
}, [moneyItems, cartTotal]);
|
||||||
|
|
||||||
const handleDenominationClick = (index: number) => {
|
const handleDenominationClick = (index: number) => {
|
||||||
@ -90,7 +91,14 @@ const ChangeCalculatorPage: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="total-item highlight">
|
<div className="total-item highlight">
|
||||||
<span>Restgeld:</span>
|
<span>Restgeld:</span>
|
||||||
<span>{changeAmount.toFixed(2)} €</span>
|
<span
|
||||||
|
style={{
|
||||||
|
color: changeAmount < 0 ? '#ff0000' : 'inherit',
|
||||||
|
fontWeight: changeAmount < 0 ? 'bold' : 'inherit'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{changeAmount.toFixed(2)} €
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -39,8 +39,7 @@ const HomePage: React.FC = () => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 className="section-title">{activeTab === 'food' ? 'Essen' : 'Getränke'}</h2>
|
<ProductList
|
||||||
<ProductList
|
|
||||||
products={productsData[activeTab]}
|
products={productsData[activeTab]}
|
||||||
category={activeTab}
|
category={activeTab}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user