diff --git a/src/features/order/orderSlice.ts b/src/features/order/orderSlice.ts index 5e16670..00c54fc 100644 --- a/src/features/order/orderSlice.ts +++ b/src/features/order/orderSlice.ts @@ -662,15 +662,26 @@ export const { } = orderSlice.actions; // Tax calculation helper functions -const calculateTaxAmount = (amount: number, tax: Tax): number => { +const calculateTaxAmount = ( + state: RootState, + amount: number, + tax: Tax, +): number => { const percentage = parseFloat(tax.percentage); - return (percentage * amount) / 100; + return (((state.order.restaurant?.vat || 0) + percentage) * amount) / 100; }; -const calculateTotalTax = (subtotal: number, taxes: Tax[]): number => { +const calculateTotalTax = ( + state: RootState, + subtotal: number, + taxes: Tax[], +): number => { return taxes .filter((tax) => tax.is_active === 1) - .reduce((total, tax) => total + calculateTaxAmount(subtotal, tax), 0); + .reduce( + (total, tax) => total + calculateTaxAmount(state, subtotal, tax), + 0, + ); }; // Selectors @@ -742,7 +753,7 @@ export const selectTaxes = (state: RootState) => state.order.restaurant.taxes; export const selectTaxAmount = (state: RootState) => { const subtotal = selectCartTotal(state) - selectDiscountTotal(state); const taxes = selectTaxes(state); - return calculateTotalTax(subtotal, taxes || []); + return calculateTotalTax(state, subtotal, taxes || []); }; export const selectGrandTotal = (state: RootState) => { diff --git a/src/pages/menu/menu.module.css b/src/pages/menu/menu.module.css index a6104e5..b781351 100644 --- a/src/pages/menu/menu.module.css +++ b/src/pages/menu/menu.module.css @@ -477,7 +477,7 @@ .openingHours { position: absolute; top: 190px; - right: 10px; + right: 16px; font-size: 14px; font-weight: 600; color: #666; @@ -706,3 +706,10 @@ left: 10px; right: auto; } + +.timeIcon { + position: relative; + top: 4px; + margin: 0 4px; +} + diff --git a/src/pages/menu/page.tsx b/src/pages/menu/page.tsx index 0511d9e..35707f9 100644 --- a/src/pages/menu/page.tsx +++ b/src/pages/menu/page.tsx @@ -29,6 +29,7 @@ import MenuSkeleton from "./components/MenuSkeleton/MenuSkeleton"; import ScrollEventHandler from "./components/ScrollEventHandler"; import SearchButton from "./components/SearchButton"; import styles from "./menu.module.css"; +import TimeIcon from "components/Icons/order/TimeIcon"; function MenuPage() { const { subdomain } = useParams(); @@ -128,10 +129,8 @@ function MenuPage() { - {t("menu.openingHours", { - openingTime: restaurant?.openingTime, - closingTime: restaurant?.closingTime, - })} + + {restaurant?.openingTime} - {restaurant?.closingTime}