diff --git a/src/langs/fa.json b/src/langs/fa.json
index 380a1f3..4f5d690 100644
--- a/src/langs/fa.json
+++ b/src/langs/fa.json
@@ -855,7 +855,8 @@
"canceled": "لغو شده",
"deliveredToWaiter": "تحویل به گارسون",
"deliveredToReceptionist": "تحویل به پیشخوان",
- "deliveredToRecepient": "تحویل به گیرنده"
+ "deliveredToRecepient": "تحویل به گیرنده",
+ "needConfirmation": "در انتظار تایید فروشگاه"
},
"reviews": {
"reviews": "نظرات",
diff --git a/src/pages/orders/Details.tsx b/src/pages/orders/Details.tsx
index 59f6c8d..2afc29a 100644
--- a/src/pages/orders/Details.tsx
+++ b/src/pages/orders/Details.tsx
@@ -88,6 +88,7 @@ const OrderDetails: FC = () => {
// منطق نمایش دکمهها
const isCashPayment = order.paymentMethod?.method === PaymentMethodEnum.Cash
+ const isNeedConfirmation = order.status === OrderStatus.NEED_CONFIRMATION
const isPendingPayment = order.status === OrderStatus.PENDING_PAYMENT
const isOrderPaid = order.status === OrderStatus.PAID
const isPreparing = order.status === OrderStatus.PREPARING
@@ -159,6 +160,17 @@ const OrderDetails: FC = () => {
})
}
+ const handleConfirmQuantities = () => {
+ changeOrderStatus({
+ orderId: order.id,
+ status: OrderStatus.PENDING_PAYMENT
+ }, {
+ onError: (error) => {
+ toast.error(extractErrorMessage(error))
+ }
+ })
+ }
+
const handleCancelOrder = (description?: string) => {
changeOrderStatus({
orderId: order.id,
@@ -205,7 +217,7 @@ const OrderDetails: FC = () => {
-
+
@@ -223,6 +235,7 @@ const OrderDetails: FC = () => {
isCourierDelivery={isCourierDelivery}
isCustomerPickup={isCustomerPickup}
isCanceled={isCanceled}
+ isNeedConfirmation={isNeedConfirmation}
isVerifyingPayment={isVerifyingPayment}
isChangingStatus={isChangingStatus}
onVerifyCashPayment={handleVerifyCashPayment}
@@ -230,6 +243,7 @@ const OrderDetails: FC = () => {
onDeliverToCourier={handleDeliverToCourier}
onDeliverToReceptionist={handleDeliverToReceptionist}
onCancelOrder={() => setShowCancelModal(true)}
+ onConfirmQuantities={handleConfirmQuantities}
/>
diff --git a/src/pages/orders/components/OrderActions.tsx b/src/pages/orders/components/OrderActions.tsx
index 21cd4b4..320567b 100644
--- a/src/pages/orders/components/OrderActions.tsx
+++ b/src/pages/orders/components/OrderActions.tsx
@@ -9,6 +9,7 @@ interface OrderActionsProps {
isCourierDelivery: boolean
isCustomerPickup: boolean
isCanceled: boolean
+ isNeedConfirmation: boolean
isVerifyingPayment: boolean
isChangingStatus: boolean
onVerifyCashPayment: () => void
@@ -16,6 +17,7 @@ interface OrderActionsProps {
onDeliverToCourier: () => void
onDeliverToReceptionist: () => void
onCancelOrder: () => void
+ onConfirmQuantities: () => void
}
const OrderActions: FC = ({
@@ -26,13 +28,15 @@ const OrderActions: FC = ({
isCourierDelivery,
isCustomerPickup,
isCanceled,
+ isNeedConfirmation,
isVerifyingPayment,
isChangingStatus,
onVerifyCashPayment,
onSendToKitchen,
onDeliverToCourier,
onDeliverToReceptionist,
- onCancelOrder
+ onCancelOrder,
+ onConfirmQuantities
}) => {
const [loadingAction, setLoadingAction] = useState(null)
@@ -64,8 +68,22 @@ const OrderActions: FC = ({
if (isCanceled) return null
+ const handleConfirmQuantities = () => {
+ setLoadingAction('confirmQuantities')
+ onConfirmQuantities()
+ }
+
return (
+ {isNeedConfirmation && (
+
+ )}
+
{showVerifyCashPaymentButton && (