import { Flex, Form, Layout } from "antd"; import InputCard from "components/InputCard"; import OrderSummary from "components/OrderSummary/OrderSummary"; import PaymentMethods from "components/PaymentMethods/PaymentMethods"; import ProHeader from "components/ProHeader/ProHeader"; import { selectCart, updateCollectionMethod } from "features/order/orderSlice"; import { useTranslation } from "react-i18next"; import { useAppDispatch, useAppSelector } from "redux/hooks"; import styles from "../address/address.module.css"; import { AddressSummary } from "./components/AddressSummary"; import CheckoutButton from "./components/CheckoutButton"; import { GiftCard } from "./components/GiftCard"; import { OrderType } from "./hooks/types"; import RewardWaiterCard from "pages/cart/components/RewardWaiterCard"; import ProInputCard from "components/ProInputCard/ProInputCard"; import ProRatioGroups from "components/ProRatioGroups/ProRatioGroups"; import CouponCard from "pages/cart/components/CouponCard"; import BriefMenuCard from "./components/BriefMenuCard"; import CustomerInformationCard from "./components/CustomerInformationCard"; import Ads1 from "components/Ads/Ads1"; import { useEffect } from "react"; import { CarCard } from "./components/CarCard"; import { CollectWay } from "./components/CollectWay/CollectWay"; import PickupTimeCard from "./components/pickupEstimate/TimeEstimateCard"; import VoucherSummary from "pages/redeem/components/VoucherSummary/VoucherSummary"; export default function CheckoutPage() { const { t } = useTranslation(); const [form] = Form.useForm(); const { phone, order, orderType, collectionMethod, coupon, customerName, tip, } = useAppSelector(selectCart); const { token } = useAppSelector((state) => state.auth); const dispatch = useAppDispatch(); useEffect(() => { form.setFieldsValue({ coupon, collectionMethod, phone, customerName, tip }); }, [form, phone, coupon, collectionMethod, customerName, tip]); return ( <>
{t("checkout.title")} {orderType === OrderType.Pickup && } {(orderType === OrderType.Pickup || orderType === OrderType.ScheduledOrder) && } {orderType === OrderType.Pickup && } {orderType === OrderType.Gift && } {!token && } {orderType === OrderType.ToRoom && ( )} {orderType === OrderType.ToOffice && ( )} {orderType === OrderType.Redeem && } {/* {orderType === OrderType.Gift && } */} {/* */} {/* */} {/* */} {orderType !== OrderType.Redeem && } {/* Collection Method */} {orderType === OrderType.Pickup && ( { if (value === "cod") { dispatch(updateCollectionMethod(value)); } else { dispatch(updateCollectionMethod(value)); } }} /> )} {/* Reward Your Waiter */} {orderType !== OrderType.Redeem && }
); }