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

@@ -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 (