hide unnecessary elements

This commit is contained in:
2026-01-14 21:59:02 +03:00
parent ce68b8b978
commit a68480c075
7 changed files with 72 additions and 32 deletions

View File

@@ -321,7 +321,8 @@
"today": "اليوم", "today": "اليوم",
"change": "تغيير", "change": "تغيير",
"pickup": "استلام", "pickup": "استلام",
"setPickupTime": "تحديد وقت الاستلام" "setPickupTime": "تحديد وقت الاستلام",
"carPlateNumber": "رقم لوحة السيارة"
}, },
"address": { "address": {
"title": "العنوان", "title": "العنوان",

View File

@@ -341,7 +341,8 @@
"today": "Today", "today": "Today",
"change": "Change", "change": "Change",
"pickup": "Pickup", "pickup": "Pickup",
"setPickupTime": "Set Pickup Time" "setPickupTime": "Set Pickup Time",
"carPlateNumber": "Car Plate Number"
}, },
"address": { "address": {
"title": "Address", "title": "Address",

View File

@@ -148,8 +148,8 @@ export default function CartMobileTabletLayout({
<SpecialRequestCard /> <SpecialRequestCard />
{/* Car Plate*/} {/* Car Plate*/}
{((orderType === OrderType.Pickup && pickup_type === "car") || {/* {((orderType === OrderType.Pickup && pickup_type === "car") ||
orderType === OrderType.ScheduledOrder) && <CarPlateCard />} orderType === OrderType.ScheduledOrder) && <CarPlateCard />} */}
{/* Estimate Time */} {/* Estimate Time */}
{/* {(orderType === OrderType.Pickup || {/* {(orderType === OrderType.Pickup ||

View File

@@ -7,6 +7,8 @@ import CarRatioGroups from "./CarRatioGroups/CarRatioGroups";
import PlusIcon from "components/Icons/PlusIcon"; import PlusIcon from "components/Icons/PlusIcon";
import styles from "../checkout.module.css"; import styles from "../checkout.module.css";
import { AddCarBottomSheet } from "components/CustomBottomSheet/AddCarBottomSheet"; import { AddCarBottomSheet } from "components/CustomBottomSheet/AddCarBottomSheet";
import { updatePlateCar } from "features/order/orderSlice";
import { useAppDispatch } from "redux/hooks";
interface CarBottomSheetProps { interface CarBottomSheetProps {
isOpen: boolean; isOpen: boolean;
@@ -17,6 +19,7 @@ export function CarBottomSheet({ isOpen, onClose }: CarBottomSheetProps) {
const { t } = useTranslation(); const { t } = useTranslation();
const [value, setValue] = useState<string | null>(null); const [value, setValue] = useState<string | null>(null);
const [isAddCarOpen, setIsAddCarOpen] = useState(false); const [isAddCarOpen, setIsAddCarOpen] = useState(false);
const dispatch = useAppDispatch();
const handleCancel = () => { const handleCancel = () => {
setValue(null); setValue(null);
@@ -24,8 +27,8 @@ export function CarBottomSheet({ isOpen, onClose }: CarBottomSheetProps) {
}; };
const handleSave = () => { const handleSave = () => {
dispatch(updatePlateCar(value || ""));
onClose(); onClose();
setValue(value);
}; };
const handleAddCarClick = () => { const handleAddCarClick = () => {
@@ -38,9 +41,8 @@ export function CarBottomSheet({ isOpen, onClose }: CarBottomSheetProps) {
// The parent component should handle reopening, but we'll ensure state is correct // The parent component should handle reopening, but we'll ensure state is correct
}; };
const handleAddCarSave = (carDetails: any) => { const handleAddCarSave = () => {
// Handle saving the new car details dispatch(updatePlateCar(value || ""));
console.log("Car details saved:", carDetails);
// After saving, close AddCarBottomSheet which will trigger reopening CarBottomSheet // After saving, close AddCarBottomSheet which will trigger reopening CarBottomSheet
setIsAddCarOpen(false); setIsAddCarOpen(false);
}; };

View File

@@ -13,11 +13,15 @@ export function CarCard() {
const { t } = useTranslation(); const { t } = useTranslation();
const { isRTL } = useAppSelector((state) => state.locale); const { isRTL } = useAppSelector((state) => state.locale);
const [isCarBottomSheetOpen, setIsCarBottomSheetOpen] = useState(false); const [isCarBottomSheetOpen, setIsCarBottomSheetOpen] = useState(false);
const { plateCar } = useAppSelector((state) => state.order);
return ( return (
<> <>
<Card onClick={() => { <Card
onClick={() => {
setIsCarBottomSheetOpen(true); setIsCarBottomSheetOpen(true);
}}> }}
>
<div className={styles.carCard}> <div className={styles.carCard}>
<Button <Button
shape="circle" shape="circle"
@@ -54,6 +58,44 @@ export function CarCard() {
{t("checkout.addCarDetails")} {t("checkout.addCarDetails")}
</ProText> </ProText>
{plateCar ? (
<div
style={{
display: "flex",
alignItems: "center",
gap: 10,
marginTop: 6,
}}
>
<ProText
style={{
fontWeight: 400,
fontStyle: "Regular",
fontSize: 16,
lineHeight: "140%",
color: "#777580",
}}
>{t("checkout.carPlateNumber")}:</ProText>
<div
style={{
backgroundColor: "#FFC600",
color: "#333333",
padding: "3px 14px",
borderRadius: "20px",
fontSize: 15,
fontWeight: 600,
fontStyle: "SemiBold",
letterSpacing: "0.8px",
display: "inline-flex",
alignItems: "center",
boxShadow: "0 2px 6px rgba(255, 198, 0, 0.25)",
fontFamily: "monospace",
}}
>
{plateCar}
</div>
</div>
) : (
<ProText <ProText
style={{ style={{
fontWeight: 400, fontWeight: 400,
@@ -65,6 +107,7 @@ export function CarCard() {
> >
{t("checkout.soTheRestaurantCanRecognizeYourCarWhenYouArrive")} {t("checkout.soTheRestaurantCanRecognizeYourCarWhenYouArrive")}
</ProText> </ProText>
)}
</div> </div>
{isRTL ? <BackIcon iconSize={24} /> : <NextIcon iconSize={24} />} {isRTL ? <BackIcon iconSize={24} /> : <NextIcon iconSize={24} />}
</div> </div>

View File

@@ -24,9 +24,7 @@ const CarRatioGroups = ({
showDivider = false, showDivider = false,
...props ...props
}: CarRatioGroupsProps) => { }: CarRatioGroupsProps) => {
const { t } = useTranslation();
const handleChange = (e: RadioChangeEvent) => { const handleChange = (e: RadioChangeEvent) => {
console.log(e.target.value);
// If onChange is provided (from Form.Item), use it // If onChange is provided (from Form.Item), use it
if (onChange) { if (onChange) {
onChange(e); onChange(e);

View File

@@ -1,29 +1,25 @@
import { Flex, Form, Layout } from "antd";
import InputCard from "components/InputCard"; import InputCard from "components/InputCard";
import OrderSummary from "components/OrderSummary/OrderSummary"; import OrderSummary from "components/OrderSummary/OrderSummary";
import PaymentMethods from "components/PaymentMethods/PaymentMethods"; import PaymentMethods from "components/PaymentMethods/PaymentMethods";
import ProHeader from "components/ProHeader/ProHeader"; import ProHeader from "components/ProHeader/ProHeader";
import { selectCart, updateCollectionMethod } from "features/order/orderSlice"; import { selectCart } from "features/order/orderSlice";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useAppDispatch, useAppSelector } from "redux/hooks"; import { useAppSelector } from "redux/hooks";
import styles from "../address/address.module.css"; import styles from "../address/address.module.css";
import { AddressSummary } from "./components/AddressSummary"; import { AddressSummary } from "./components/AddressSummary";
import CheckoutButton from "./components/CheckoutButton"; import CheckoutButton from "./components/CheckoutButton";
import { GiftCard } from "./components/GiftCard"; import { GiftCard } from "./components/GiftCard";
import { OrderType } from "./hooks/types"; 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 CouponCard from "pages/cart/components/CouponCard";
import BriefMenuCard from "./components/BriefMenuCard"; import BriefMenuCard from "./components/BriefMenuCard";
import CustomerInformationCard from "./components/CustomerInformationCard"; import CustomerInformationCard from "./components/CustomerInformationCard";
import Ads1 from "components/Ads/Ads1";
import { useEffect } from "react"; import { useEffect } from "react";
import { CarCard } from "./components/CarCard"; import { CarCard } from "./components/CarCard";
import { CollectWay } from "./components/CollectWay/CollectWay"; import { CollectWay } from "./components/CollectWay/CollectWay";
import PickupTimeCard from "./components/pickupEstimate/TimeEstimateCard"; import PickupTimeCard from "./components/pickupEstimate/TimeEstimateCard";
import VoucherSummary from "pages/redeem/components/VoucherSummary/VoucherSummary"; import VoucherSummary from "pages/redeem/components/VoucherSummary/VoucherSummary";
import EarnLoyaltyPointsCard from "pages/cart/components/earnLoyaltyPointsCard/EarnLoyaltyPointsCard"; import EarnLoyaltyPointsCard from "pages/cart/components/earnLoyaltyPointsCard/EarnLoyaltyPointsCard";
import { Form, Layout } from "antd";
export default function CheckoutPage() { export default function CheckoutPage() {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -38,7 +34,6 @@ export default function CheckoutPage() {
tip, tip,
} = useAppSelector(selectCart); } = useAppSelector(selectCart);
const { token } = useAppSelector((state) => state.auth); const { token } = useAppSelector((state) => state.auth);
const dispatch = useAppDispatch();
useEffect(() => { useEffect(() => {
form.setFieldsValue({ coupon, collectionMethod, phone, customerName, tip }); form.setFieldsValue({ coupon, collectionMethod, phone, customerName, tip });
}, [form, phone, coupon, collectionMethod, customerName, tip]); }, [form, phone, coupon, collectionMethod, customerName, tip]);