update tax in summaries
This commit is contained in:
@@ -277,7 +277,10 @@
|
|||||||
"am": "ص",
|
"am": "ص",
|
||||||
"pm": "م",
|
"pm": "م",
|
||||||
"cannotSelectPastDate": "لا يمكنك اختيار تاريخ سابق. يرجى اختيار اليوم أو تاريخ مستقبلي.",
|
"cannotSelectPastDate": "لا يمكنك اختيار تاريخ سابق. يرجى اختيار اليوم أو تاريخ مستقبلي.",
|
||||||
"checkRequiredFields": "يرجى التحقق من الحقول المطلوبة"
|
"checkRequiredFields": "يرجى التحقق من الحقول المطلوبة",
|
||||||
|
"loyalty": "ولاء",
|
||||||
|
"vatTax": "ضريبة (القيمة المضافة)",
|
||||||
|
"otherTaxes": "ضريبة (أخرى)"
|
||||||
},
|
},
|
||||||
"checkout": {
|
"checkout": {
|
||||||
"addCarDetails": "إضافة تفاصيل السيارة",
|
"addCarDetails": "إضافة تفاصيل السيارة",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user