room & office number fix sending

This commit is contained in:
2026-01-15 06:22:09 +03:00
parent 26a16fa8d7
commit adc98200cb
4 changed files with 18 additions and 8 deletions

View File

@@ -17,10 +17,10 @@ const NoteIcon = ({ className, onClick }: NoteIconType) => {
<path
d="M12 16H12.008M12 8V13M3.23005 7.913L7.91005 3.23C8.06005 3.08 8.26005 3 8.48005 3H15.53C15.74 3 15.95 3.08 16.1 3.23L20.77 7.903C20.92 8.053 21 8.253 21 8.473V15.527C21 15.737 20.92 15.947 20.77 16.097L16.1 20.77C15.95 20.92 15.75 21 15.53 21H8.47005C8.36456 21.0011 8.2599 20.9814 8.16208 20.9419C8.06425 20.9025 7.9752 20.844 7.90005 20.77L3.23005 16.097C3.15602 16.0218 3.09759 15.9328 3.05812 15.835C3.01865 15.7371 2.99891 15.6325 3.00005 15.527V8.473C3.00005 8.263 3.08005 8.053 3.23005 7.903V7.913Z"
stroke="#3D3B4A"
stroke-width="1.5"
stroke-miterlimit="10"
stroke-linecap="round"
stroke-linejoin="round"
strokeWidth="1.5"
strokeMiterlimit="10"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);

View File

@@ -702,7 +702,7 @@ const orderSlice = createSlice({
}
},
updateOrder(state, action: PayloadAction<any>) {
state.order = action.payload;
state.order = { ...state.order, ...action.payload };
if (typeof window !== "undefined") {
localStorage.setItem(
CART_STORAGE_KEYS.ORDER,

View File

@@ -54,6 +54,8 @@ export default function useOrder() {
const [createOrder] = useCreateOrderMutation();
console.log(order);
const getDeliveryMethod = useCallback(() => {
if (orderType === OrderType.Delivery) return 1;
if (orderType === OrderType.Pickup) return 2;
@@ -93,8 +95,8 @@ export default function useOrder() {
order_item_comment: i.comment || "",
variant: (i.variant as Variant)?.id || "",
})),
office_no: order?.officeNumber || "",
room_no: order?.roomNumber || "",
office_no: order?.officeNumber,
room_no: order?.roomNumber,
...(discount.isDiscount ? { couponID: coupon } : {}),
...(discount.isGift ? { discountGiftCode: coupon } : {}),
discountAmount: discountAmount || 0,

View File

@@ -35,7 +35,15 @@ export default function CheckoutPage() {
} = useAppSelector(selectCart);
const { token } = useAppSelector((state) => state.auth);
useEffect(() => {
form.setFieldsValue({ coupon, collectionMethod, phone, customerName, tip });
form.setFieldsValue({
coupon,
collectionMethod,
phone,
customerName,
tip,
officeNumber: order?.officeNumber,
roomNumber: order?.roomNumber,
});
}, [form, phone, coupon, collectionMethod, customerName, tip]);
return (