Compare commits

..

2 Commits

Author SHA1 Message Date
2c676eb153 update tax in summaries 2026-01-14 23:21:02 +03:00
6f1f4441f1 done btn logic 2026-01-14 23:07:27 +03:00
4 changed files with 27 additions and 11 deletions

View File

@@ -277,7 +277,10 @@
"am": "ص", "am": "ص",
"pm": "م", "pm": "م",
"cannotSelectPastDate": "لا يمكنك اختيار تاريخ سابق. يرجى اختيار اليوم أو تاريخ مستقبلي.", "cannotSelectPastDate": "لا يمكنك اختيار تاريخ سابق. يرجى اختيار اليوم أو تاريخ مستقبلي.",
"checkRequiredFields": "يرجى التحقق من الحقول المطلوبة" "checkRequiredFields": "يرجى التحقق من الحقول المطلوبة",
"loyalty": "ولاء",
"vatTax": "ضريبة (القيمة المضافة)",
"otherTaxes": "ضريبة (أخرى)"
}, },
"checkout": { "checkout": {
"addCarDetails": "إضافة تفاصيل السيارة", "addCarDetails": "إضافة تفاصيل السيارة",

View File

@@ -295,7 +295,9 @@
"cannotSelectPastDate": "You cannot select a past date. Please select today or a future date.", "cannotSelectPastDate": "You cannot select a past date. Please select today or a future date.",
"checkRequiredFields": "Please check required fields", "checkRequiredFields": "Please check required fields",
"applyYourAvailableRewardsToGetDiscountsOnItemsInYourCart": "Apply your available rewards to get discounts on items in your cart", "applyYourAvailableRewardsToGetDiscountsOnItemsInYourCart": "Apply your available rewards to get discounts on items in your cart",
"loyalty": "Loyalty" "loyalty": "Loyalty",
"vatTax": "Tax (Vat)",
"otherTaxes": "Tax (Other)"
}, },
"checkout": { "checkout": {
"addCarDetails": "Add Car Details", "addCarDetails": "Add Car Details",

View File

@@ -6,15 +6,13 @@ import {
selectDiscountTotal, selectDiscountTotal,
selectGrandTotal, selectGrandTotal,
selectHighestPricedLoyaltyItem, selectHighestPricedLoyaltyItem,
selectLoyaltyValidation,
selectTaxAmount, selectTaxAmount,
updateUseLoyaltyPoints,
} from "features/order/orderSlice"; } from "features/order/orderSlice";
import { OrderType } from "pages/checkout/hooks/types"; import { OrderType } from "pages/checkout/hooks/types";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { useGetRestaurantDetailsQuery } from "redux/api/others"; import { useGetRestaurantDetailsQuery } from "redux/api/others";
import { useAppDispatch, useAppSelector } from "redux/hooks"; import { useAppSelector } from "redux/hooks";
import ProText from "../ProText"; import ProText from "../ProText";
import ProTitle from "../ProTitle"; import ProTitle from "../ProTitle";
import styles from "./OrderSummary.module.css"; import styles from "./OrderSummary.module.css";
@@ -25,7 +23,7 @@ export default function OrderSummary() {
const { useLoyaltyPoints, splitBillAmount } = useAppSelector(selectCart); const { useLoyaltyPoints, splitBillAmount } = useAppSelector(selectCart);
const { subdomain } = useParams(); const { subdomain } = useParams();
const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain); const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain);
const { orderType, tip } = useAppSelector(selectCart); const { orderType } = useAppSelector(selectCart);
const subtotal = useAppSelector(selectCartTotal); const subtotal = useAppSelector(selectCartTotal);
const highestLoyaltyItem = useAppSelector(selectHighestPricedLoyaltyItem); const highestLoyaltyItem = useAppSelector(selectHighestPricedLoyaltyItem);
const taxAmount = useAppSelector(selectTaxAmount); const taxAmount = useAppSelector(selectTaxAmount);
@@ -46,6 +44,8 @@ export default function OrderSummary() {
textAlign: "center", textAlign: "center",
}; };
const vat = (restaurant?.vat ?? 0) / 100 * subtotal || 0
return ( return (
<> <>
<Card className={`${styles.orderSummary}`}> <Card className={`${styles.orderSummary}`}>
@@ -159,10 +159,21 @@ export default function OrderSummary() {
{orderType !== OrderType.Redeem && ( {orderType !== OrderType.Redeem && (
<div className={styles.summaryRow}> <div className={styles.summaryRow}>
<ProText type="secondary" style={titlesStyle}> <ProText type="secondary" style={titlesStyle}>
{t("cart.tax")} {t("cart.vatTax")}
</ProText> </ProText>
<ArabicPrice <ArabicPrice
price={taxAmount || 0} price={vat}
textStyle={{ ...titlesStyle, color: "#434E5C" }}
/>
</div>
)}
{orderType !== OrderType.Redeem && (
<div className={styles.summaryRow}>
<ProText type="secondary" style={titlesStyle}>
{t("cart.otherTaxes")}
</ProText>
<ArabicPrice
price={taxAmount - vat || 0}
textStyle={{ ...titlesStyle, color: "#434E5C" }} textStyle={{ ...titlesStyle, color: "#434E5C" }}
/> />
</div> </div>

View File

@@ -4,13 +4,13 @@ import styles from "./OrderDetails.module.css";
import ProHeader from "components/ProHeader/ProHeader"; import ProHeader from "components/ProHeader/ProHeader";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useParams } from "react-router-dom"; import { useNavigate, useParams } from "react-router-dom";
import ProductChoicesCard from "components/productChoicesCard/ProductChoicesCard.tsx"; import ProductChoicesCard from "components/productChoicesCard/ProductChoicesCard.tsx";
export default function OrderDetails() { export default function OrderDetails() {
const { orderId } = useParams(); const { orderId } = useParams();
const { t } = useTranslation(); const { t } = useTranslation();
const navigate = useNavigate();
const { data: orderDetails } = useGetOrderDetailsQuery( const { data: orderDetails } = useGetOrderDetailsQuery(
{ {
orderID: orderId || "", orderID: orderId || "",
@@ -42,7 +42,7 @@ export default function OrderDetails() {
type="primary" type="primary"
shape="round" shape="round"
className={styles.button} className={styles.button}
onClick={() => {}} onClick={() => navigate(-1)}
> >
{t("order.done")} {t("order.done")}
</Button> </Button>