Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -19,6 +19,7 @@ const LoyaltyCard = () => {
|
|||||||
(restaurant?.customer_loyalty_points || 0) <=
|
(restaurant?.customer_loyalty_points || 0) <=
|
||||||
0;
|
0;
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.loyaltyContainer}>
|
<div className={styles.loyaltyContainer}>
|
||||||
<Card className={styles.loyaltyCard}>
|
<Card className={styles.loyaltyCard}>
|
||||||
@@ -35,6 +36,7 @@ const LoyaltyCard = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{!isHasLoyaltyGift && (
|
||||||
<Row
|
<Row
|
||||||
justify="space-between"
|
justify="space-between"
|
||||||
align="middle"
|
align="middle"
|
||||||
@@ -90,7 +92,8 @@ const LoyaltyCard = () => {
|
|||||||
<PresentIcon />
|
<PresentIcon />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
{token && (
|
)}
|
||||||
|
{token && !isHasLoyaltyGift && (
|
||||||
<Row justify="space-between" align="middle">
|
<Row justify="space-between" align="middle">
|
||||||
<Col>
|
<Col>
|
||||||
<div className={styles.presentIcon}>
|
<div className={styles.presentIcon}>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
} 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 { useGetRestaurantDetailsQuery } from "redux/api/others";
|
import { useGetRestaurantDetailsQuery } from "redux/api/others";
|
||||||
import { useAppDispatch, useAppSelector } from "redux/hooks";
|
import { useAppDispatch, useAppSelector } from "redux/hooks";
|
||||||
import ProText from "../ProText";
|
import ProText from "../ProText";
|
||||||
@@ -20,7 +21,8 @@ import styles from "./OrderSummary.module.css";
|
|||||||
export default function OrderSummary() {
|
export default function OrderSummary() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { useLoyaltyPoints } = useAppSelector(selectCart);
|
const { useLoyaltyPoints } = useAppSelector(selectCart);
|
||||||
const { data: restaurant } = useGetRestaurantDetailsQuery("595");
|
const { subdomain } = useParams();
|
||||||
|
const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain);
|
||||||
const { orderType } = useAppSelector(selectCart);
|
const { orderType } = useAppSelector(selectCart);
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const subtotal = useAppSelector(selectCartTotal);
|
const subtotal = useAppSelector(selectCartTotal);
|
||||||
@@ -44,13 +46,21 @@ export default function OrderSummary() {
|
|||||||
<ProText type="secondary">{t("cart.basketTotal")}</ProText>
|
<ProText type="secondary">{t("cart.basketTotal")}</ProText>
|
||||||
<ArabicPrice price={subtotal} />
|
<ArabicPrice price={subtotal} />
|
||||||
</div>
|
</div>
|
||||||
{orderType != OrderType.DineIn && <div className={styles.summaryRow}>
|
{orderType != OrderType.DineIn && (
|
||||||
|
<div className={styles.summaryRow}>
|
||||||
<ProText type="secondary">{t("cart.deliveryFee")}</ProText>
|
<ProText type="secondary">{t("cart.deliveryFee")}</ProText>
|
||||||
<ArabicPrice price={Number(restaurant?.delivery_fees || 0)} />
|
<ArabicPrice price={Number(restaurant?.delivery_fees || 0)} />
|
||||||
</div>}
|
</div>
|
||||||
|
)}
|
||||||
<div className={styles.summaryRow}>
|
<div className={styles.summaryRow}>
|
||||||
<ProText type="secondary">{t("cart.discount")}</ProText>
|
<ProText type="secondary">{t("cart.discount")}</ProText>
|
||||||
<ArabicPrice price={highestLoyaltyItem?.price || 0} />
|
<ArabicPrice
|
||||||
|
price={
|
||||||
|
useLoyaltyPoints && restaurant?.is_loyalty_enabled === 1
|
||||||
|
? highestLoyaltyItem?.price || 0
|
||||||
|
: 0
|
||||||
|
}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.summaryRow}>
|
<div className={styles.summaryRow}>
|
||||||
<ProText type="secondary">{t("cart.tax")}</ProText>
|
<ProText type="secondary">{t("cart.tax")}</ProText>
|
||||||
@@ -65,7 +75,7 @@ export default function OrderSummary() {
|
|||||||
</div>
|
</div>
|
||||||
</Space>
|
</Space>
|
||||||
|
|
||||||
{isHasLoyaltyGift && (
|
{isHasLoyaltyGift && restaurant?.is_loyalty_enabled === 1 && (
|
||||||
<>
|
<>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@@ -86,7 +96,10 @@ export default function OrderSummary() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isHasLoyaltyGift && useLoyaltyPoints && highestLoyaltyItem && (
|
{isHasLoyaltyGift &&
|
||||||
|
useLoyaltyPoints &&
|
||||||
|
highestLoyaltyItem &&
|
||||||
|
restaurant?.is_loyalty_enabled === 1 && (
|
||||||
<div style={{ marginTop: 8, color: "green", fontSize: "12px" }}>
|
<div style={{ marginTop: 8, color: "green", fontSize: "12px" }}>
|
||||||
{t("cart.loyaltyDiscountApplied", {
|
{t("cart.loyaltyDiscountApplied", {
|
||||||
itemName: highestLoyaltyItem.name,
|
itemName: highestLoyaltyItem.name,
|
||||||
|
|||||||
@@ -650,7 +650,11 @@ export const selectGrandTotal = (state: RootState) => {
|
|||||||
? Number(state.order.restaurant?.delivery_fees) || 0
|
? Number(state.order.restaurant?.delivery_fees) || 0
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
return subtotal + taxAmount - loyaltyDiscount + deliveryFee;
|
return (
|
||||||
};
|
subtotal +
|
||||||
|
taxAmount -
|
||||||
|
(state.order.useLoyaltyPoints && state.order.restaurant?.is_loyalty_enabled === 1 ? loyaltyDiscount : 0) +
|
||||||
|
deliveryFee
|
||||||
|
);};
|
||||||
|
|
||||||
export default orderSlice.reducer;
|
export default orderSlice.reducer;
|
||||||
|
|||||||
Reference in New Issue
Block a user