allways show receipt
This commit is contained in:
@@ -109,7 +109,11 @@ const OrderDetails: FC = () => {
|
|||||||
const isDineInOrCarDelivery = order.deliveryMethod?.method === DeliveryMethodEnum.DineIn || order.deliveryMethod?.method === DeliveryMethodEnum.DeliveryCar
|
const isDineInOrCarDelivery = order.deliveryMethod?.method === DeliveryMethodEnum.DineIn || order.deliveryMethod?.method === DeliveryMethodEnum.DeliveryCar
|
||||||
const isCustomerPickup = order.deliveryMethod?.method === DeliveryMethodEnum.CustomerPickup
|
const isCustomerPickup = order.deliveryMethod?.method === DeliveryMethodEnum.CustomerPickup
|
||||||
|
|
||||||
const showVerifyPaymentBox = (isCashPayment || isCreditCardPayment) && isPaymentPending && !isCanceled
|
const payment = order.payments?.[0]
|
||||||
|
const hasPaymentDescription = Boolean(payment?.description)
|
||||||
|
const hasPaymentAttachments = Boolean(payment?.attachments && payment.attachments.length > 0)
|
||||||
|
const showPaymentReceiptBox = isCreditCardPayment && (hasPaymentDescription || hasPaymentAttachments)
|
||||||
|
const showVerifyPaymentButton = (isCashPayment || isCreditCardPayment) && isPaymentPending && !isCanceled
|
||||||
|
|
||||||
// نمایش دکمه ارسال به آشپزخانه
|
// نمایش دکمه ارسال به آشپزخانه
|
||||||
// برای pendingPayment با پرداخت نقدی یا برای paid
|
// برای pendingPayment با پرداخت نقدی یا برای paid
|
||||||
@@ -251,11 +255,12 @@ const OrderDetails: FC = () => {
|
|||||||
getPaymentStatusTextColor={getPaymentStatusTextColor}
|
getPaymentStatusTextColor={getPaymentStatusTextColor}
|
||||||
getPaymentStatusText={getPaymentStatusText}
|
getPaymentStatusText={getPaymentStatusText}
|
||||||
/>
|
/>
|
||||||
{showVerifyPaymentBox && (
|
{showPaymentReceiptBox && (
|
||||||
<PaymentVerificationBox
|
<PaymentVerificationBox
|
||||||
order={order}
|
order={order}
|
||||||
isVerifyingPayment={isVerifyingPayment}
|
isVerifyingPayment={isVerifyingPayment}
|
||||||
onVerifyPayment={handleVerifyPayment}
|
onVerifyPayment={handleVerifyPayment}
|
||||||
|
showVerifyButton={showVerifyPaymentButton}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<OrderActions
|
<OrderActions
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ interface PaymentVerificationBoxProps {
|
|||||||
order: Order
|
order: Order
|
||||||
isVerifyingPayment: boolean
|
isVerifyingPayment: boolean
|
||||||
onVerifyPayment: () => void
|
onVerifyPayment: () => void
|
||||||
|
showVerifyButton: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const PaymentVerificationBox: FC<PaymentVerificationBoxProps> = ({
|
const PaymentVerificationBox: FC<PaymentVerificationBoxProps> = ({
|
||||||
order,
|
order,
|
||||||
isVerifyingPayment,
|
isVerifyingPayment,
|
||||||
onVerifyPayment,
|
onVerifyPayment,
|
||||||
|
showVerifyButton,
|
||||||
}) => {
|
}) => {
|
||||||
const payment = order.payments?.[0]
|
const payment = order.payments?.[0]
|
||||||
const isCreditCard = order.paymentMethod?.method === PaymentMethodEnum.CreditCard
|
const isCreditCard = order.paymentMethod?.method === PaymentMethodEnum.CreditCard
|
||||||
@@ -53,12 +55,14 @@ const PaymentVerificationBox: FC<PaymentVerificationBoxProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Button
|
{showVerifyButton && (
|
||||||
label='تایید پرداخت'
|
<Button
|
||||||
onClick={onVerifyPayment}
|
label='تایید پرداخت'
|
||||||
isloading={isVerifyingPayment}
|
onClick={onVerifyPayment}
|
||||||
className='bg-green-600 hover:bg-green-700 w-full'
|
isloading={isVerifyingPayment}
|
||||||
/>
|
className='bg-green-600 hover:bg-green-700 w-full'
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user