add order details & enhance the checkout page
This commit is contained in:
@@ -5,7 +5,7 @@ import ProText from "components/ProText";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useAppSelector } from "redux/hooks";
|
||||
import { selectCart } from "features/order/orderSlice";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { useLocation, useNavigate, useParams } from "react-router-dom";
|
||||
import { useGetOrderDetailsQuery } from "redux/api/others";
|
||||
import BackIcon from "components/Icons/BackIcon";
|
||||
|
||||
@@ -14,6 +14,7 @@ export default function BriefMenuCard() {
|
||||
const { items } = useAppSelector(selectCart);
|
||||
const { subdomain, orderId } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { data: orderDetails } = useGetOrderDetailsQuery(
|
||||
{
|
||||
orderID: orderId || "",
|
||||
@@ -41,7 +42,11 @@ export default function BriefMenuCard() {
|
||||
padding: "16px 0",
|
||||
}}
|
||||
onClick={() => {
|
||||
navigate(`/${subdomain}/cart`);
|
||||
if (orderId && location.pathname.includes("/order/")) {
|
||||
navigate(`/${subdomain}/order/details/${orderId}`);
|
||||
} else {
|
||||
navigate(`/${subdomain}/cart`);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ProText
|
||||
|
||||
@@ -17,6 +17,8 @@ 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 TimeEstimateCard from "pages/cart/components/timeEstimate/TimeEstimateCard";
|
||||
|
||||
export default function CheckoutPage() {
|
||||
const { t } = useTranslation();
|
||||
@@ -37,6 +39,9 @@ export default function CheckoutPage() {
|
||||
<Layout>
|
||||
<ProHeader>{t("checkout.title")}</ProHeader>
|
||||
<Layout.Content className={styles.checkoutContainer}>
|
||||
{(orderType === OrderType.Pickup ||
|
||||
orderType === OrderType.ScheduledOrder) && <TimeEstimateCard />}
|
||||
|
||||
<PaymentMethods />
|
||||
{!token && <CustomerInformationCard />}
|
||||
<AddressSummary />
|
||||
@@ -101,6 +106,7 @@ export default function CheckoutPage() {
|
||||
{/* Reward Your Waiter */}
|
||||
<RewardWaiterCard />
|
||||
<BriefMenuCard />
|
||||
<Ads1 />
|
||||
<OrderSummary />
|
||||
</Layout.Content>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user