diff --git a/src/check.jsx b/src/check.jsx index d993a1b..0a876eb 100644 --- a/src/check.jsx +++ b/src/check.jsx @@ -1,829 +1,4608 @@ -export const style = ``; + if (TokenOnly?.SettingValue === 'Y') { + if (IndividualToken?.SettingValue === 'Y') { + await printDiv(`TokenOnlySingle${index}`, stylePrint); + } else { + await printDiv(`TokenOnlyMultiple${index}`, stylePrint); + } + } else { + await printDiv(`TakeawayToken${index}`, stylePrint); + } + } catch (error) { + console.error(`Error printing token for index ${index}:`, error); + } + }; + const AllProductTokenFunction = async () => { + if (IndividualToken?.SettingValue === 'Y') { + await Promise.all( + PrintOrderDetails?.[0]?.OrderDetails?.map( + async (orderDetail, index) => { + const groupedTokens = orderDetail?.productDetails?.reduce( + (acc, item, idx) => { + if (item.TokenAvailable === 'Y') { + if (!item.CounterName) { + // If CounterName is null or empty + acc[`single-${idx}-${item.ProdId}`] = [item]; // Unique entry for each null/empty CounterName item + } else { + if (!acc[item.CounterName]) { + acc[item.CounterName] = []; + } + acc[item.CounterName].push(item); // Group by CounterName + } + } + return acc; + }, + {} + ); -} -.BarQrprint7 { - display: flex; - align-items: center; - justify-content: space-between; - gap: 6px; -width: 100mm; -height: 149mm; - background-color: #fff; - padding: 4px 4px; - border-radius: 6px; -} -// .Qrcodeimage, -// .Barcodeimage { -// display: flex; -// gap: 6px; -// align-items: center; + // Iterate over grouped tokens and print them + const tokensToPrint = Object.entries(groupedTokens).map( + async ([counterName, items], idx) => { + // Use the counterName (or unique identifier for individual items) as part of the tokenId + const tokenId = `${idx}-${items?.[0]?.ProdId}-${counterName}`; + await TokenPrint(tokenId, items); // Pass all grouped items to the print function + } + ); + if (tokensToPrint?.length > 0) { + await Promise.all(tokensToPrint); + } + setPrintOrderDetails([]); + closePrintOption(); + } + ) + ); + } else { + await Promise.all( + PrintOrderDetails?.[0]?.OrderDetails?.map( + async (orderDetail, index) => { + await TokenPrint(`${index}-${orderDetail?.OrderId}`); + } + ) + ); + setPrintOrderDetails([]); + closePrintOption(); + } + }; -// >img { -// width:50%; -// object-fit: cover; -// } -// } -.BarQrprint1details { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - gap: 2px; - font-size: 12px; - text-transform: capitalize; - font-weight: 600; - width: 100%; - } -.flexDirection { - flex-direction: column -} + const getHolddata = async () => { + const data = { CompId: CompId, BranchId: BranchId, AppId: AppId }; + let response = await dispatch(gettinghold(data)).unwrap(); + if (response?.data?.statusCode == 1) { + dispatch(changeholddata(response?.data?.data)); + } else { + dispatch(changeholddata([])); + } + }; + const getUnpaiddatas = async () => { + let data = { + CompId: CompId, + BranchId: BranchId, + AppId: AppId, + }; + await dispatch(getUnpaidData(data)).unwrap(); + }; -.printingstickermain{ - display: flex; - align-items: flex-start; - gap: 6px; - flex-wrap: wrap; - width: 100%; - flex-direction: row; + const TotalItemsCalculation = async () => { + let tempTotalitems = OrderCardDetail?.length; + let OverAllQty = OrderCardDetail?.reduce((acc, item) => { + const isWeightScale = item?.ScaleType === 'weight'; - } + if (isWeightScale) { + return ( + acc + (Weightasquantity ? Math.round(Number(item?.OrderQty || 0)) : 1) + ); + } -// .container{ -// display: flex; -// gap: 6px; -// align-items: flex-start; -// flex-wrap: wrap; -// width: 100%; -// justify-content: space-evenly; -// } + return acc + Math.round(Number(item?.OrderQty || 0)); + }, 0); + setTotalItems(tempTotalitems); + setQty(OverAllQty); + }; + const Print = async () => { + const style = await PrintStyleFunction( + printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle, + 'Sales' + ); + const stylesMap = { + 'Style 1': 'PrintStyle1', + 'Style 2': 'PrintStyle2', + 'Style 3': 'PrintStyle3', + 'Style 4': 'PrintStyle4', + 'Style 5': 'PrintStyle5', + 'Style 6': 'PrintStyle6', + 'Style 7': 'PrintStyle7', + 'Style 8': 'PrintStyle8', + 'Style 9': 'PrintStyle9', + 'Style 10': 'PrintStyle10', + 'Style 11': 'PrintStyle11', + 'Style 12': 'PrintStyle12', + 'Style 13': 'RePrint', + A4: 'PrintStyleA4', + A5: 'PrintStyleA5', + A4Standard: 'A4Standard', + TaxInvoice: 'TaxInvoice', + }; + const selectedStyle = + stylesMap[ + printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle + ]; - #StickerPrints0{ - width: 90mm; + if (selectedStyle) { + await Promise.all( + PrintOrderDetails?.[0]?.OrderDetails?.map( + async (orderDetail, index) => { + await printDiv(`${selectedStyle}-${index}`, style); // Use unique IDs for each print + if (orderDetail?.BookingTypeName !== 'Dine In') { + const groupedTokens = orderDetail?.productDetails?.reduce( + (acc, item, idx) => { + if (item.TokenAvailable === 'Y') { + if (!item.CounterName) { + // If CounterName is null or empty + acc[`individual-${idx}-${item.ProdId}`] = [item]; // Unique entry for each null/empty CounterName item + } else { + if (!acc[item.CounterName]) { + acc[item.CounterName] = []; + } + acc[item.CounterName].push(item); // Group by CounterName + } + } + return acc; + }, + {} + ); + + // Iterate over grouped tokens and print them + const tokensToPrint = Object.entries(groupedTokens).map( + async ([counterName, items], idx) => { + // Use the counterName (or unique identifier for individual items) as part of the tokenId + const tokenId = `${idx}-${items?.[0]?.ProdId}-${counterName}`; + await TokenPrint(tokenId, items); // Pass all grouped items to the print function + } + ); + if (tokensToPrint?.length > 0) { + await Promise.all(tokensToPrint); + } + } + } + ) + ); + + setPrintOrderDetails([]); + closePrintOption(); + } + }; + + function safeRound(amountStr) { + if (amountStr == null) return '0.00'; + + const cleaned = String(amountStr).replace(/[^0-9.-]+/g, ''); + const num = Number(cleaned); + + return isNaN(num) ? '0.00' : num.toFixed(2); // return as string with 2 decimals } - - .Sticker1 { - width: 35mm; - height: 22mm; - padding-left: 2mm; - box-sizing: border-box; - - display: flex; - align-items: center; - justify-content: space-between; - - font-size: 9px; - font-weight: bold; -} - -.grid15x15_6cross { - display: grid; - grid-template-columns: repeat(6, 15mm); - width: 90mm; - column-gap: 0.5mm; -} - - .BarQrprint3 { - width: 25mm; - height: 25mm; - box-sizing: border-box; - - display: flex; - align-items: center; - justify-content: center; - - background: #fff; - border-radius: 0; /* IMPORTANT for thermal printers */ -} - -// 25x25 4 Cross Dummy - -@media print { - body { - margin: 0 !important; - padding: 0 !important; - } - - img { - display: block !important; - visibility: visible !important; - } -} - -// 25x25 4Cross - -#25X254cross { - width: 100mm; - margin: 0 !important; - padding: 0 !important; -} - -.grid25x25_4cross { - display: grid; - grid-template-columns: repeat(4, 25mm); - width: 100mm; - column-gap: 0; -} - -.barcode-wrapper-25x25 { - width: 25mm; - height: 25mm; - - box-sizing: border-box; - padding: 1mm; - - display: flex; - align-items: center; - justify-content: center; - - background: #fff; -} - -.barcode-container-25x25 { - width: 100%; - height: 100%; - - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - - gap: 1mm; - text-align: center; - - .productNameBQ { - font-size: 9px; - line-height: 1; - white-space: nowrap; - text-align: center; - max-width: 100%; - font-weight: 600; - } - - .MRPBQ { - font-size: 9px; - line-height: 1; - white-space: nowrap; - font-weight: 600; - } - - .MandateBQ, - .ExpdateBQ { - font-size: 8px; - line-height: 1; - white-space: nowrap; - font-weight: 600; - } -} - -.barcode-wrapper img { - height: auto; - object-fit: contain; -} - -// 25x25 4Cross Dummy - -#StickerPrints2 { - width: 100mm; - margin: 0 !important; - padding: 0 !important; -} - -.sticker25x25{ - width: 25mm; - height: 25mm; - box-sizing: border-box; - padding: 1mm; - - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - - background: #fff; -} - -.sticker25x25-name { - margin: 0; - padding: 0; - text-align: center; - line-height: 1; -} - -.product-name2 { - font-size: 10px; - white-space: nowrap; - font-weight: bold; -} - -.product-nameSmall2 { - font-size: 8px; - white-space: nowrap; - font-weight: bold; -} - -.product-size2 { - font-size: 10px; - font-weight: bold; -} - -.product-sizeSmall2 { - font-size: 8px; - font-weight: bold; -} - -.sticker25-img { - width: 16mm; - height: auto; - object-fit: contain; -} - .product-id2 { - margin: 0; - padding: 0; - font-size: 6px; - line-height: 1; - text-align: center; - word-break: break-word; -} - -// 22x35 3cross - - #22X353cross { - width: 105mm; - margin: 0; - padding: 0; -} - -.grid22x35_3cross { - display: grid; - grid-template-columns: repeat(3, 35mm); - width: 105mm; - column-gap: 0; - padding: 0; -} - -.barcode-wrapper-22x35 { - width: 35mm; - height: 22mm; - - box-sizing: border-box; - padding: 1.2mm; - - display: flex; - align-items: center; - justify-content: center; - - background: #fff; -} - -.barcode-wrapper-22x35 img { - height: auto; - object-fit: contain; -} - -.barcode-container-22x35 { - width: 100%; - height: 100%; - - display: flex; - align-items: center; - justify-content: center; - - gap: 1mm; - text-align: center; - - .productNameBQ { - font-weight: 600; - font-size: 9px; - line-height: 1; - white-space: nowrap; - text-align: center; - max-width: 100%; - } - - .productNameBQSmall { - font-size: 7px; - font-weight: 600; - } - .MRPBQ { - font-size: 8px; - font-weight: 600; - line-height: 1; - white-space: nowrap; - } - -} - -// 22x35 3cross Dummy -#StickerPrints1 { - width: 105mm; - margin: 0; - padding: 0; -} - -.label-wrapper-22x35 { - width: 35mm; - height: 22mm; - - box-sizing: border-box; - padding: 1mm; - - display: flex; - align-items: center; - justify-content: center; - gap : 0; - background: #fff; -} - -.label-wrapper-22x35 p { - margin: 0; - padding: 0; - font-size: 10px; - font-weight: 600; - line-height: 1.1; -} - -.label-wrapper-22x35 p:last-child { - margin-top: 2px; - font-size: 8px; - font-weight: 600; -} - -.label-wrapper-22x35 img { - width: 14mm; - height: 14mm; - object-fit: contain; -} - -// 25x50 2 Cross - -#25X502cross { - margin: 0 !important; - padding: 0 !important; - width: 100mm; -} - -.grid25x50_2cross { - display: grid; - grid-template-columns: repeat(2, 50mm); - width: 100mm; - column-gap: 0; - padding: 0; -} - -.label25x50-wrapper { - width: 50mm; - height: 25mm; - - box-sizing: border-box; - padding: 1.5mm; - - display: flex; - align-items: center; - justify-content: center; - - background: #fff; -} - -.label25x50-name { - font-size: 10px; - line-height: 1; - white-space: nowrap; - font-weight: 600; -} - -.label25x50-mrp { - font-size: 9px; - line-height: 1; - white-space: nowrap; - font-weight: 600; -} - -.label25x50-container { - display: flex; - flex-direction: column; - align-items: center; - text-align: center; -} - -.label25x50-container img { - width: 16mm; - height: 16mm; - object-fit: contain; -} - -// 25x50 2 Cross Dummy - -#StickerPrints3 { - width: 100mm; - margin: 0; - padding: 0; -} - -.label-25x50-content { - width: 50mm; - height: 25mm; - - box-sizing: border-box; - padding: 1.5mm; - - display: flex; - align-items: center; - justify-content: space-between; - - background: #fff; -} - -.label-25x50-content > div { - width: 60%; - display: flex; - flex-direction: column; - justify-content: center; - gap: 1mm; - font-weight: 600; -} - -.label-25x50-content p { - margin: 0; - padding: 0; - font-size: 10px; - line-height: 1; -} - -.label-25x50-content p:last-child { - font-size: 9px; - white-space: nowrap; -} - -.label-25x50-content img { - width: 20mm; /* QR SAFE SIZE */ - height: 20mm; - object-fit: contain; -} - -// 15x15 6 Cross - -#label-15X156cross { - width: 92mm; - margin: 0 !important; - padding: 0 !important; -} - -.label-15x15-container { - display: grid; - grid-template-columns: repeat(6, 15mm); - width: 100%; - column-gap: 0.5mm; - row-gap: 0; - align-items: flex-start; -} - -.label-15x15-wrapper { - width: 15mm; - height: 15mm; - box-sizing: border-box; - display: flex; - align-items: center; - justify-content: center; - - background: #fff; -} - -.label-15x15-content { - width: 100%; - height: 100%; - display: flex; - flex-direction: column; - align-items: center; - justify-content: flex-start; - - text-align: center; -} - -.label-15x15-name, -.label-15x15-mrp { - font-size: 6px; - white-space: nowrap; -} - -.label-15x15-wrapper img { - width: 7.5mm; - height: 7.5mm; - object-fit: contain; -} - - -.text-ellipsis { - width: 90%; - white-space: nowrap; - overflow: hidden; - text-align: center; - text-overflow: ellipsis; -} - -.text-clamp-2 { - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; - line-height: 1.1; - max-height: 2.8em; -} -`; - -export const getPageStyle = (width) => ` - -`; \ No newline at end of file + }; + const PaymentDeviceFlow = async (Paymentdevicefilter, value) => { + await dispatch(changePaymentloader(true)); + await dispatch( + changePaymentTransactionNumber(Paymentdevicefilter?.[0]?.PaymentOrderId) + ); + + let paymentdetail = { + TransactionNumber: Paymentdevicefilter?.[0]?.PaymentOrderId, + SequenceNumber: 1, + AllowedPaymentMode: + Paymentdevicefilter?.[0]?.PaymentTypeName?.toLowerCase() === 'card' + ? '1' + : Paymentdevicefilter?.[0]?.PaymentTypeName?.toLowerCase() === 'upi' + ? '10' + : '', + Amount: `${parseInt(Paymentdevicefilter?.[0]?.Amount) * 100}`, + ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId, + StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId, + UserID: useOptions?.[0]?.PDConfigDetails?.[0]?.UserId, + MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId, + SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken, + IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI, + AutoCancelDurationInMinutes: + useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes, + }; + let apiresponse = await dispatch(PostPaymentdevice(paymentdetail)).unwrap(); + if (apiresponse?.ResponseMessage?.toLowerCase() === 'approved') { + let pendingPaymentList = { + MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId, + SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken, + ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId, + StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId, + IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI, + PlutusTransactionReferenceId: apiresponse?.PlutusTransactionReferenceID, + PaymentOrderId: Paymentdevicefilter?.[0]?.PaymentOrderId, + UpdatedBy: UserId, + }; + await dispatch(PutPendingPaymentList(pendingPaymentList)).unwrap(); + let isApproved = false; + const startTime = Date.now(); + let postpaymentdata = { + MerchantID: useOptions?.[0]?.PDConfigDetails?.[0]?.MerchantId, + SecurityToken: useOptions?.[0]?.PDConfigDetails?.[0]?.SecurityToken, + ClientID: useOptions?.[0]?.PDConfigDetails?.[0]?.ClientId, + StoreID: useOptions?.[0]?.PDConfigDetails?.[0]?.StoreId, + IMEI: useOptions?.[0]?.PDConfigDetails?.[0]?.IMEI, + PlutusTransactionReferenceID: apiresponse?.PlutusTransactionReferenceID, + }; + // Loop to call the second API every 3 seconds + while (!isApproved) { + let ApiResponseget = await dispatch( + GetPaymentdeviceResponse(postpaymentdata) + ).unwrap(); + + if (ApiResponseget?.ResponseMessage?.toLowerCase() === 'txn approved') { + let putbookingdata = { + OrderBookingId: Paymentdevicefilter?.[0]?.OrderId, + OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId, + PaymentStatus: 'S', + Amount: Paymentdevicefilter?.[0]?.Amount, + ResponseDtl: [ApiResponseget], + PaymentType: Paymentdevicefilter?.[0]?.PaymentType, + UpdatedBy: UserId, + }; + + let bookingpaymentupdate = await dispatch( + PutBookingPaymentStatusChange(putbookingdata) + ).unwrap(); + if (bookingpaymentupdate?.data?.statusCode === 1) { + setMessageType('success'); + setMessageData( + bookingpaymentupdate?.data?.response + + ' ' + + (bookingpaymentupdate?.data?.OrderDetails?.length > 0 + ? bookingpaymentupdate?.data?.OrderId && + extractLastNumberOrderId( + bookingpaymentupdate?.data?.OrderId, + bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus + ) + : '') + ); + bookingpaymentupdate?.data?.OrderDetails?.length > 0 && + setPrintOrderDetails([bookingpaymentupdate?.data]); + CustomerDisplay(value); + ClearAllGlobalStateDatas(value); + dispatch(changePaymentloader(false)); + } + isApproved = true; + console.log('Transaction Approved!'); + // Exit the loop + break; + } + + // Check if 1 minute has passed + if ( + Date.now() - startTime > + useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes * + 60000 + ) { + // 60,000 ms = 1 minute + + let putbookingdata = { + OrderBookingId: Paymentdevicefilter?.[0]?.OrderId, + OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId, + PaymentStatus: 'F', + Amount: Paymentdevicefilter?.[0]?.Amount, + ResponseDtl: [ApiResponseget], + PaymentType: Paymentdevicefilter?.[0]?.PaymentType, + UpdatedBy: UserId, + }; + + let bookingpaymentupdate = await dispatch( + PutBookingPaymentStatusChange(putbookingdata) + ).unwrap(); + if (bookingpaymentupdate?.data?.statusCode === 1) { + setMessageType('error'); + setMessageData( + `Payment Failed. Your Transaction Number is ${Paymentdevicefilter?.[0]?.PaymentOrderId}` + ); + setFirstPaymentclick(false); + setPaybtnnameselected(PaymentOptionsModeName); + setPaybtnselected(PaymentOptionsModeId); + dispatch(changePaymentloader(false)); + CustomerDisplayRemovedData(); + ClearAllGlobalStateDatas(value); + } + + console.error('Transaction not approved within 1 minute.'); + // Send an error message or handle the timeout + // You can dispatch an action, show a notification, etc. + break; + } + + // Wait for 3 seconds before making the next call + await new Promise((resolve) => setTimeout(resolve, 3000)); + } + } else { + let putbookingdata = { + OrderBookingId: Paymentdevicefilter?.[0]?.OrderId, + OrderId: Paymentdevicefilter?.[0]?.PaymentOrderId, + PaymentStatus: 'F', + Amount: Paymentdevicefilter?.[0]?.Amount, + PaymentType: Paymentdevicefilter?.[0]?.PaymentType, + UpdatedBy: UserId, + }; + let bookingpaymentupdate = await dispatch( + PutBookingPaymentStatusChange(putbookingdata) + ).unwrap(); + if (bookingpaymentupdate?.data?.statusCode === 1) { + setMessageType('error'); + setMessageData(apiresponse?.ResponseMessage); + setFirstPaymentclick(false); + setPaybtnnameselected(PaymentOptionsModeName); + setPaybtnselected(PaymentOptionsModeId); + dispatch(changePaymentloader(false)); + CustomerDisplayRemovedData(); + ClearAllGlobalStateDatas(value); + } + } + }; + const PaymentGatewayFlow = async (PaymentGatewayfilter) => { + if (PaymentGatewayfilter?.[0]?.PaymentOptionType?.toLowerCase() === 'pg') { + await dispatch(changePaymentloader(true)); + const customerDisplayWindow = getCustomerDisplayWindow(); + if (customerDisplayWindow && !customerDisplayWindow.closed) { + const updatedData = { + OrderBookingId: PaymentGatewayfilter?.[0]?.OrderId, + Paymentgateway: true, + OrderPaymentId: PaymentGatewayfilter?.[0]?.PaymentOrderId, + OrderTotalAmount: PaymentGatewayfilter?.[0]?.Amount, + }; + customerDisplayWindow.postMessage(updatedData, '*'); + } else { + console.error( + 'Customer display window is not available or has been closed.' + ); + } + const checkPaymentStatus = async () => { + const intervalId = setInterval(async () => { + try { + let getpaymentgatewaydetail = await dispatch( + PaymentGatewayGetdetail(PaymentGatewayfilter?.[0]?.OrderId) + ).unwrap(); + + if (getpaymentgatewaydetail?.data?.statusCode === 1) { + let paymentdataget = + getpaymentgatewaydetail?.data?.PaymentOrderDtl?.find( + (item) => + item?.PaymentOrderId === + PaymentGatewayfilter?.[0]?.PaymentOrderId + )?.PaymentStatus; + + if (paymentdataget === 'S') { + setMessageType('success'); + setMessageData('Payment Success'); + await dispatch(changePaymentloader(false)); + if (getpaymentgatewaydetail?.data?.OrderDetails?.length > 0) { + setPrintOrderDetails([getpaymentgatewaydetail?.data]); + CustomerDisplay(value); + + ClearAllGlobalStateDatas(value); + } + clearInterval(intervalId); // Stop the loop when payment is successful + } else if (paymentdataget === 'F') { + setMessageType('error'); + setMessageData('Payment Failed'); + await dispatch(changePaymentloader(false)); + setFirstPaymentclick(false); + setPaybtnnameselected(PaymentOptionsModeName); + setPaybtnselected(PaymentOptionsModeId); + clearInterval(intervalId); // Stop the loop when payment fails + CustomerDisplayRemovedData(); + ClearAllGlobalStateDatas(value); + // const customerDisplayWindow = getCustomerDisplayWindow(); + // if (customerDisplayWindow && !customerDisplayWindow.closed) { + // const updatedData = { + // userData: OrderCardDetail, + // ExtraCharges: GlobalExtraCharge, + // upi: GlobalUpiID, + // customer: selOption != null ? selOption : GetCustId, + // paymentMethod: Paybtnnameselected, + // Paymentgateway: false, + // OrderTotalAmount:PaymentGatewayfilter?.[0]?.Amount + + // }; + // customerDisplayWindow.postMessage(updatedData, '*'); + // } + } + } + } catch (error) { + console.error('Error fetching payment details: ', error); + } + }, 3000); // Call the API every 3 seconds + }; + + // Call the function to start checking payment status + checkPaymentStatus(); + } + }; + const CustomerDisplayRemovedData = () => { + const customerDisplayWindow = getCustomerDisplayWindow(); + if (customerDisplayWindow && !customerDisplayWindow.closed) { + const updatedData = { + userData: [], + ExtraCharges: [], + Paymentgateway: false, + type: 'remove', + keyValue: 'customer', + }; + customerDisplayWindow.postMessage(updatedData, '*'); + const updatedRemovedData = { + type: 'remove', + keyValue: 'OrderTotalAmount', + }; + customerDisplayWindow.postMessage(updatedRemovedData, '*'); + } else { + console.error( + 'Customer display window is not available or has been closed.' + ); + } + }; + const CustomerDisplay = (value) => { + const customerDisplayWindow = getCustomerDisplayWindow(); + if (value == 'TakeAway') { + if (customerDisplayWindow && !customerDisplayWindow.closed) { + const updatedData = { + userData: [], + ExtraCharges: [], + Paymentgateway: false, + upioption1: 'okk', + type: 'remove', + keyValue: 'customer', + }; + customerDisplayWindow.postMessage(updatedData, '*'); + const updatedRemovedData = { + type: 'remove', + keyValue: 'OrderTotalAmount', + }; + customerDisplayWindow.postMessage(updatedRemovedData, '*'); + } else { + console.error( + 'Customer display window is not available or has been closed.' + ); + } + } else { + if (customerDisplayWindow && !customerDisplayWindow.closed) { + const updatedData = { + type: 'remove', + keyValue: 'customer', + }; + customerDisplayWindow.postMessage(updatedData, '*'); + } else { + console.error( + 'Customer display window is not available or has been closed.' + ); + } + } + }; + const columns = [ + { + title: 'Sl.No', + key: 'sno', + align: 'center', + width: '100px', + render: (text, object, index) => ( + {index + 1} + ), + }, + { + title: 'Table Name/Chair Name', + dataIndex: 'TableName', + key: 'TableName', + width: '150px', + onCell: (_, record, index) => { + return { + onClick: () => { + Unpaidfun(record); + }, + }; + }, + }, + { + title: 'Order Id', + dataIndex: 'OrderID', + key: 'OrderID', + width: '150px', + align: 'right', + onCell: (_, record, index) => { + return { + onClick: () => { + Unpaidfun(record); + }, + }; + }, + }, + { + title: "Item's", + dataIndex: 'ProductName', + key: 'ProductName', + width: '250px', + onCell: (_, record, index) => { + return { + onClick: () => { + Unpaidfun(record); + }, + }; + }, + }, + { + title: 'Amount', + dataIndex: 'TotalAmount', + key: 'TotalAmount', + width: '150px', + align: 'right', + render: (text) => {safeRound(text)}, + onCell: (_, record, index) => { + return { + onClick: () => { + Unpaidfun(record); + }, + }; + }, + }, + ]; + + const TableData = []; + tabledata?.map((item) => + TableData.push({ + TableName: item.SalesTableLinkDetails?.map((item) => + item.ChairName == null ? item.TableName : item.ChairName + )?.join(','), + OrderID: extractLastNumberOrderId(item?.OrderId, item?.FYStatus), + ProductName: item.productDetails + ?.map( + (item) => + item?.ProdName + + '-' + + (item?.Type != 'C' ? item?.OrderQty : '1 Combo') + ) + ?.join(','), + TotalAmount: item.NetAmount, + }) + ); + + const Unpaidfun = async (event) => { + const UpdatedData = tabledata?.[event]?.productDetails; + dispatch(changeunpaidflow(true)); + if ( + OrderCardDetail?.length > 0 && + (BookingType === 'Dine In' || BookingTypeBoth) + ) { + if (OfferCheckedInSetup && preferenceOffer) { + await applyOffer([]); + } else { + dispatch(changeOrderCardDetails([])); + } + // await dispatch(changeOrderCardDetails([])) + // await dispatch(changeOrderCardDetails(tabledata?.[event]?.productDetails)) + // await dispatch(ChangeTotalAmount(tabledata?.[event]?.ExtraChargeDetails)) + // await dispatch(changeUnpaidData(true)) + // await dispatch(changeReorderHoldDetails([tabledata?.[event]]?.[0])); + // await dispatch(changeReorderProductDetails(tabledata?.[event]?.productDetails)) + // setUnpaidOpen(false) + setUnpaidConfirmation(true); + setunpaidselectedindex(event); + } else { + if (OfferCheckedInSetup && preferenceOffer) { + await applyOffer(UpdatedData); + } else { + dispatch(changeOrderCardDetails(UpdatedData)); + } + dispatch(changeReorderHoldDetails([tabledata?.[event]]?.[0])); + await dispatch( + changeReorderProductDetails(tabledata?.[event]?.productDetails) + ); + dispatch(ChangeTotalAmount(tabledata?.[event]?.ExtraChargeDetails)); + setUnpaidOpen(false); + } + }; + + const UnpaidOk = async () => { + setOrderStatus(false); + await dispatch(changeSelectedTableDetails([])); + await dispatch(changeSelectTable([])); + await dispatch(changeSelectChair([])); + await dispatch(changeBookingType('TakeAway')); + await dispatch( + changeOrderCardDetails(tabledata?.[unpaidselectedindex]?.productDetails) + ); + await dispatch( + changeReorderProductDetails( + tabledata?.[unpaidselectedindex]?.productDetails + ) + ); + await dispatch( + changeReorderHoldDetails([tabledata?.[unpaidselectedindex]]?.[0]) + ); + await dispatch( + ChangeTotalAmount(tabledata?.[unpaidselectedindex]?.ExtraChargeDetails) + ); + await dispatch(changeUnpaidData(true)); + setUnpaidOpen(false); + setUnpaidConfirmation(false); + }; + const Unpaidclose = async () => { + dispatch(changeunpaidflow(false)); + setUnpaidOpen(false); + setUnpaidConfirmation(false); + }; + + const Recipt = async () => { + AddBookingDetails('Unpaid', false); + }; + const navigateDineIn = async () => { + navigate(`${subDirectory}sales/dine-in`); + await dispatch(changeBookingType('Dine In')); + await dispatch(changeEstimateBooking('Sales')); + if (OrderType === 'Hold') { + await dispatch(changeReorderHoldDetails({})); + await dispatch(changeReorderProductDetails([])); + + if (OfferCheckedInSetup && preferenceOffer) { + await applyOffer([]); + } else { + dispatch(changeOrderCardDetails([])); + } + } + }; + + useEffect(() => { + if (ReprintModal === true) { + setReprint1(false); + } + }, [ReprintModal]); + const handleReprint = () => { + // setReprint1(true) + window.dispatchEvent(new Event('CLICK REPRINT')); + }; + const handleReprintCancel = () => { + setReprint1(false); + }; + const today = new Date(); + const year = today.getFullYear(); + // Note: Months are zero-based, so we add 1 to get the actual month + const month = today.getMonth() + 1; + const day = today.getDate(); + + // Creating a formatted date string (in the format YYYY-MM-DD) + const Todaydate = `${day < 10 ? '0' : ''}${day}-${month < 10 ? '0' : ''}${month}-${year}`; + const OrderId = PrintOrderDetails?.[0]?.OrderDetails?.[0]?.OrderId; + let MobileNo = selOption?.value; + useEffect(() => { + if (selOption) { + closePrintOption(); + setMobileNoWhatsApp(selOption); + } + }, [selOption]); + const UpiPayment = () => { + if (OrderStatus) { + AddBookingDetails('Dine-In', false); + } else { + if (SelectedUpiOption && TotalAmount == 0) { + Upimodel('Submit'); + } else if (SelectedUpiOption) { + setUpiOpen(true); + const customerDisplayWindow = getCustomerDisplayWindow(); + if (customerDisplayWindow && !customerDisplayWindow.closed) { + const updatedData = { + OrderTotalAmount: TotalAmount, + }; + customerDisplayWindow.postMessage(updatedData, '*'); + } else { + console.error( + 'Customer display window is not available or has been closed.' + ); + } + } else { + setUpinotSelected(true); + setMessageType('error'); + setMessageData('Please Select Upi Option'); + } + } + }; + + const onFinalSubmit = async () => { + let url = `${MainHomeUrl}payment-page?amt=${TotalAmount}&Id=${MobileNo}&cus=${SelCustId} &CusN=${selOption?.CustName}&Br=${brachName}`; + let response = await dispatch(SendPaymentLink({ MobileNo, url })).unwrap(); + if (response?.data?.statusCode === 1) { + setMessageType('success'); + setMessageData('Link Sent Successfully'); + } + }; + const Upimodel = (type) => { + setUpiOpen(false); + if (type == 'Submit') { + AddBookingDetails(BookingType, true); + } + const customerDisplayWindow = getCustomerDisplayWindow(); + if (customerDisplayWindow && !customerDisplayWindow.closed) { + const updatedRemovedData = { + type: 'remove', + keyValue: 'OrderTotalAmount', + }; + customerDisplayWindow.postMessage(updatedRemovedData, '*'); + } else { + console.error( + 'Customer display window is not available or has been closed.' + ); + } + }; + const CreditCustomerHAndleCancel = async () => { + setcreditCustomerOpen(false); + await dispatch(changeCreditFocus(false)); + }; + + const CreditCustomerFun = async () => { + if ( + OrderCardDetail?.length === 0 && + (selOption?.value !== undefined || + GlobalAddCustomerDetails1.length > 0 || + GetCustId.CustMobile !== undefined) + ) { + setcreditCustomerOpen(true); + await dispatch(changeCreditFocus(true)); + } else { + if (selOption?.value == undefined) { + setMessageType('warning'); + setMessageData('Please Select the Customer'); + } + } + }; + const changeOrderStatus = () => { + setOrderStatus(!OrderStatus); + setPaybtnnameselected(PaymentOptionsModeName); + setPaybtnselected(PaymentOptionsModeId); + }; + // split payments + const SplitPaymentOpen = () => { + if (OrderCardDetail?.length > 0) { + const updatedData = { + userData: OrderCardDetail, + ExtraCharges: GlobalExtraCharge, + customer: selOption != null ? selOption : GetCustId, + Paymentgateway: false, + }; + setFailedOrderData(updatedData); + setSplitpayment(true); + } else { + setMessageType('warning'); + setMessageData('Please Select the Product'); + } + }; + + const handlePopoverVisibleChangeCard = (visible) => { + setCardOptionOpen(visible); + }; + + const handlesplitpaymentclose = () => { + setSplitpayment(false); + setPaybtnnameselected(PaymentOptionsModeName); + setPaybtnselected(PaymentOptionsModeId); + const customerDisplayWindow = getCustomerDisplayWindow(); + if (customerDisplayWindow && !customerDisplayWindow.closed) { + const updatedData = { + paymentMethod: PaymentOptions?.[0]?.ModeName, + Paymentgateway: false, + }; + customerDisplayWindow.postMessage(updatedData, '*'); + } else { + console.error( + 'Customer display window is not available or has been closed.' + ); + } + }; + // const handleClick = async () => { + // if (Comboglobal == false) { + // await dispatch(changeCombosearch(true)); + // } else { + // await dispatch(changeCombosearch(false)); + // } + // }; + + // const Combodata = async () => { + // let data = { + // AppId: AppId, + // CompId: CompId, + // BranchId: BranchId, + // ActiveStatus: 'A', + // }; + + // let Response = await dispatch(Comboget(data)).unwrap(); + // if (Response?.data?.statusCode == 1) { + // setComboDropDown(Response?.data?.data); + // } + // }; + + const openPreOrder = async () => { + setPreOrderOpen((prevState) => !prevState); + if (preOrderOpen) { + const customerDisplayWindow = getCustomerDisplayWindow(); + if (customerDisplayWindow && !customerDisplayWindow.closed) { + const updatedRemovedData = { + userData: [], + ExtraCharges: [], + paymentMethod: 'Cash', + type: 'remove', + keyValue: 'customer', + }; + customerDisplayWindow.postMessage(updatedRemovedData, '*'); + } else { + console.error( + 'Customer display window is not available or has been closed.' + ); + } + await dispatch(changeBookingType('TakeAway')); + await dispatch(changepreOrder(false)); + await dispatch(changepreOrderList(null)); + await dispatch(changePreOrderCusName(null)); + await dispatch(changePreOrderCusMob(null)); + await dispatch(changePreOrderDate()); + await dispatch(changePreOrderTime(null)); + await dispatch(changePreOrderAdd1(null)); + await dispatch(changePreOrderAdd2(null)); + await dispatch(changePreOrderAdvance(null)); + await dispatch(changePreOrderzip(null)); + await dispatch(changePreOrderCity(null)); + await dispatch(changePreOrderDistrict(null)); + await dispatch(changePreOrderState(null)); + await dispatch(changePreOrderAdditem('AddDetails')); + await dispatch(changeSelectedOption(null)); + await dispatch(changeCustomerID(null)); + await dispatch(changealldata(false)); + await dispatch(changeSelectedCustId(null)); + } + }; + + const closePrintOption = () => { + setShowWhatsAppShare(false); + setSMSShare(false); + setPrintOrderDetails([]); + setMobileNoWhatsApp(); + }; + + // const orderIdsArray = + // PrintOrderDetails?.[0]?.OrderDetails?.map( + // (orderDetail) => orderDetail?.OrderId + // ) || []; + + const handleURL = async (PrintOrderDetails) => { + let orderIdsArray = PrintOrderDetails?.[0]?.OrderDetails?.map( + (orderDetail) => orderDetail?.OrderId + ); + const encrypted = encryptObject(orderIdsArray); + + const postData = { + Url: encrypted, + CreatedBy: UserId, + }; + if (orderIdsArray) { + const res = await dispatch(PublicQrCodepost(postData)).unwrap(); + const urlData = res?.data?.ReferenceNo; + setUrlData(urlData); + } + }; + + const customerNameOrMobile = MobileNoWhatsApp?.CustName?.trim() + ? `Dear ${MobileNoWhatsApp?.CustName}` + : `Dear ${MobileNoWhatsApp?.value}`; + const documentUrl = `${MainHomeUrl}viewbill?code=${urlData}`; + const encodedMessage = `${customerNameOrMobile},\n\n🙏 Thank you for being a valuable customer!\n\n🧾 To view your bill, please click the link below:\n${documentUrl}`; + const handlepaymentoptions = async () => { + await dispatch(changeSalesPaymentoption(true)); + await dispatch( + getPaymentOptionsData({ + AppId: AppId, + CompId: CompId, + BranchId: BranchId, + }) + ); + }; + + const handleotherservices = () => { + dispatch(changeOtherServices(true)); + dispatch(changeComboRedirectionToDefaultLayoutForParking(true)); + dispatch( + changetemplateData({ + AppName, + SelectedApplication: AppId, + Type: 'ParkingRedirect', + }) + ); + }; + + return ( + <> +
+ +
+
+ {BSComboNavbar?.[1]?.map((item) => ( + <> + {item?.OptionName == 'QuickAdd' && ( + +
+ +
+ Quick Add + + (Alt + N) + +
+
+
+ )} + {item?.OptionName == 'DineIn' && + DineInPreference?.SettingValue === 'Y' && + dinePreference && ( + +
+ + DINE IN +
+
+ )} + {item?.OptionName == 'TakeAway' && takeAwayPreference && ( + +
+ BookingType !== 'TakeAway' && ChangeTakeAway() + } + style={{ + pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', + }} + > + + {/* TAKE AWAY */} + Take Away +
+
+ )} + + ))} + + {OtherServiceStatus && ( +
+ +
+ + Other Services +
+
+
+ )} +
+ +
+ {BSComboNavbar?.[1]?.map((item) => ( + <> + {item?.OptionName == 'Offer' && ( +
+ +
+ )} + {item?.OptionName == 'ExtraCharge' && ( + +
+
+ + {/* EXTRA CHARGE */} + Extra Charge +
+ +
+ (Alt + A) +
+
+
+ )} + {item?.OptionName == 'RePrint' && ( + +
+
+ + Re-Print +
+ + + (Alt + R) + +
+
+ )} + + ))} + {/* {reprint1 && ( + + )} */} + {extraCharges && ( + + )} + {QuickAdd && ( + + )} + {creditCustomerOpen && ( + + )} + {TotalAmount == 0 && Success && ( +
+ +
+ )} + {TotalAmount > 0 && + qrCode && + PaymentUpiOptions?.length > 0 && + SelectedUpiOption && ( +
+ +
+ )} + + {PaymentUpiOptions?.length > 0 && OrderId && ( +
+ +
+ )} +
+
+ +
+
+
setIsFloatMenuOpen(!isFloatMenuOpen)} + > + +
+ + {isFloatMenuOpen && ( +
+ {!OtherServiceStatus && ( +
+ +
+ +

Parking

+
+
+
+ )} + {BSComboNavbar?.[1]?.map((item) => ( + <> + {item?.OptionName == 'QuickAdd' && ( +
+ +
+ +

+ Quick Add
(Alt +N) +

+
+
+
+ )} + {item?.OptionName == 'DineIn' && + DineInPreference?.SettingValue === 'Y' && ( + <> +
+ +
+ +

Dine In

+
+
+
+ {FirstPaymentclick === false && + !addnewAccess && + !OrderStatus && ( +
+ +
+ )} + + )} + {item?.OptionName == 'TakeAway' && ( +
+ +
+ +

Take Away

+
+
+
+ )} + {item?.OptionName == 'Offer' && ( +
+ +
+ )} + {item?.OptionName == 'ExtraCharge' && ( +
+ +
+ +

Extra Charge

+
+
+
+ )} + {item?.OptionName == 'RePrint' && ( +
+ +
+ +

Re Print

+
+
+
+ )} + + ))} +
+ )} +
+
+ +
+ +
0) && + !unpaidFlow && + OrderStatus + ? 'none' + : 'auto', + opacity: + (BookingType === 'Dine In' || + BookingTypeBoth || + CheckOrderType?.length > 0) && + !unpaidFlow && + OrderStatus + ? 0.5 + : 1, + }} + > + {paybtns?.length > 0 ? ( + paybtns?.map((payment) => ( +
+ +
+ )) + ) : ( +
+ Please Set Payment Options +
+ )} + + {paybtns?.length > 1 && ( +
0) && + !unpaidFlow && + OrderStatus + ? 'none' + : 'auto', + opacity: + (BookingType === 'Dine In' || + BookingTypeBoth || + CheckOrderType?.length > 0) && + !unpaidFlow && + OrderStatus + ? 0.5 + : 1, + }} + > + + {' '} +
+
+ + Split Pay +
+
+
+
+ )} +
+
+ + {/*
+ +
*/} + +
+ +
+
+
+
+
Items
+
:
+
+ {' '} + {TotalItems}{' '} +
+
+
+
Qty
+
:
+
{Qty}
+
+
+
+
+
+ +
+ {(addcustomer || hold) && ( + setHold(false)} + /> + )} +
+ {Estimation?.SettingValue == 'Y' && + BookingType !== 'Dine In' && + !BookingTypeBoth && ( +
+ +
+ )} + {BSComboData?.BookingBilling?.[1]?.map((item) => ( + <> + {/* {item?.OptionName=="Hold" && */} + {unpaidFlow == false + ? item?.OptionName == 'Hold' && + BookingType !== 'Dine In' && + !BookingTypeBoth && + OrderCardDetail?.length != 0 && + CheckOrderType?.length === 0 && + OrderType != 'Failed' && + CheckBookingStatus != 'Close' && + !addnewAccess && ( + + {' '} +
+ AddBookingDetails('Hold')} + style={{ + cursor: 'pointer', + // color: '' ? '#52c41a' : '#1292EE', + }} + />{' '} +

Hold

+
+
+ ) + : ''} + + {unpaidFlow == false + ? item?.OptionName == 'Hold' && + BookingType !== 'Dine In' && + !BookingTypeBoth && + Holddata?.length > 0 && + OrderCardDetail?.length == 0 && + CheckBookingStatus != 'Close' && + !addnewAccess && ( + + {' '} + +
+ HandleholdModelOpen()} + style={{ + cursor: 'pointer', + // color: Holddata ? '#52c41a' : 'default', + pointerEvents: + OrderType === 'Failed' ? 'none' : 'auto', + }} + /> +
+
+
+ ) + : ''} + {tabledata?.length > 0 && dinePreference && ( + <> + {item?.OptionName == 'UnpaidBill' && ( + + {' '} +
+ { + (setUnpaidOpen(true), getUnpaiddatas()); + }} + /> +
+
+ )} + + )} + + ))} + {BSComboData?.BookingBilling?.[1]?.filter( + (item) => item.OptionName === 'AddCustomer' + ).length === 1 ? ( + <> + {Object.keys(useOptions)?.length > 0 && + useOptions?.some((flow) => + flow.OptionDetails.some( + (option) => + option.OptionName === 'Pay at the counter' && + option.ModeDetails.some( + (mode) => mode.ModeName === 'Credit' + ) + ) + ) && ( + + +
0 || + (selOption?.value === undefined && + GlobalAddCustomerDetails1?.length === 0 && + GetCustId?.CustMobile === undefined) + ? 'gray' + : '#1292eeff', + color: '#fff', + height: '40px', + width: '45px', + borderRadius: '6px', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + padding: '8px 8px 12px 8px', + }} + > + {' '} + 0 && 'not-allowed', + // color: + // OrderCardDetail?.length > 0 || + // (selOption?.value === undefined && + // GlobalAddCustomerDetails1?.length === 0 && + // GetCustId?.CustMobile === undefined) + // ? 'gray' + // : '#1292eeff', + fontSize: '28px', + }} + />{' '} +

Adv Amt

+
+
+
+ )} + + ) : ( + '' + )} + + {/* Customer Orders */} + {GetCustId && ( + + {' '} +
{ + if ( + CheckBookingStatus !== 'Close' && + !addnewAccess && + !(OrderCardDetail?.length > 0) + ) { + setCustomerPreviesOrders(true); + } + }} + style={{ + cursor: OrderCardDetail?.length > 0 && 'not-allowed', + color: + OrderCardDetail?.length > 0 || + (OrderCardDetail?.length > 0 && + GetCustId?.CustMobile === undefined) + ? 'gray' + : 'rgb(255, 255, 255)', + color: '#fff', + height: '40px', + width: '45px', + borderRadius: '6px', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + padding: '5px 5px 6px 5px', + background: 'rgb(18, 146, 238)' + }} + > + Cust Orders +
+
+ )} + {FeatureAddonData?.FeatureDtls?.find( + (item) => item?.FeatureAddonName?.toLowerCase() === 'preorder' + ) && ( + <> + { +
0 || OrderType === 'Failed' + ? 'none' + : 'auto', + opacity: OrderCardDetail?.length > 0 ? 0.5 : 1, + }} + > + + + { + openPreOrder(); + }} + /> + + +
+ } + + )} + {preOrderOpen && } + {sportsAppPreference && } + {dinePreference && + (BookingType === 'Dine In' || + BookingTypeBoth || + CheckOrderType?.length > 0) && + !unpaidFlow && ( + <> + + {' '} + + FirstPaymentclick === false && !addnewAccess + ? changeOrderStatus() + : '' + } + style={{ + pointerEvents: OrderType === 'Failed' ? 'none' : 'auto', + }} + /> + + {FirstPaymentclick === false && + !addnewAccess && + !OrderStatus && } + + )} + {OrderCardDetail?.length > 0 && ParkingDisplay && ( +
+ +
+ )} + {unpaidFlow == true ? ( + + { + Recipt(); + }} + /> + + ) : ( + '' + )} + {/*
+ + + + } + trigger="click" + open={open} + onOpenChange={handleOpenChange} + > + + +
*/} + {/* {ComboDropDown?.length >= 1 && ( +
+ + + +
+ )} */} + {paymentfeataddon && ( + +
{ + paymentFailedStatusFun(); + }} + style={{ + width: '27px', + cursor: 'pointer', + fontWeight: '600', + color: 'rgb(18, 146, 238)', + }} + > + +
+
+ )} + {OpenFailData && ( + + )} +
+
+
+ {BSComboData?.BookingBilling?.[1]?.map((item) => ( + <> + {item?.OptionName == 'AddCustomer' && !preOrderOpen && ( +
+ + +
+ +
+
+
+ )} + + ))} + +
+ + + + + + + + + + } + trigger="click" + open={open} + onOpenChange={handleOpenChange} + > + + + + +
+
+ {PrintOrderDetails?.length > 0 && + PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => ( +
+ +
+ ))} + {PrintOrderDetails?.length > 0 && + (TokenOnly?.SettingValue === 'Y' || + IndividualToken?.SettingValue === 'Y') && + PrintOrderDetails?.[0]?.OrderDetails?.map((orderDetail, index) => ( +
+ +
+ ))} + {CreditCustomer && ( +
+ { + handleCreditCustomer('Cancel'); + }} + handleOk={() => { + handleCreditCustomer('Submit'); + }} + /> +
+ )} +
+ {UpiOpen && ( + { + Upimodel('Cancel'); + }} + footer={false} + children={ +
+ {/*

UPI PAYMENT

*/} + +
+
+ +
+ +
+

+ {' '} + RS : + {OrderType === 'Failed' + ? FailedTotalAmt + : Math.round(TotalAmount)}{' '} +

+
+
+ +
+ {(selOption || SelCustId) && ( +
+ Sent Payment Link + Your Alt Text + {/* */} +
+ )} + +
+ } + handleSubmit={() => { + Upimodel('Submit'); + }} + /> +
+
+
+ } + /> + )} + {unpaidopen && ( + { + setUnpaidOpen(false); + }} + footer={false} + children={ +
+ +
+ } + /> + )} + {/* + + */} + {UnpaidConfirmation && ( + +
+ You have already selected a table. If you click 'OK,' the table + selection will be removed, and the unpaid flow will continue. If + you click 'Cancel,' the dine-in flow will proceed as selected. +
+ + } + onOk={UnpaidOk} + onCancel={Unpaidclose} + /> + )} + {Splitpayment && ( + + )} + {PrintOrderDetails?.length > 0 && ( +
+ {filteredSettingNames?.includes('whatsapp') && + MobileNoWhatsApp?.value && ( + + )} + + + + {filteredSettingNames?.includes('SMS') && isMobile && ( + + )} + {/* WhatsAppShare modal/component */} + {showWhatsAppShare && ( + closePrintOption(false)} + /> + )} + {showSMSShare && isMobile && ( + closePrintOption(false)} + /> + )} +
+ )} + { + dispatch(changeSalesPaymentoption(false)); + }} + footer={false} + children={ +
+ +
+ } + /> + {customerPreviesOrders && ( + setCustomerPreviesOrders(false)} + footer={false} + width={700} + className={'ModalPaymentGatewayEmbedded'} + children={ + <> + setCustomerPreviesOrders(false)} + /> + + } + /> + )} + + ); +}; + +export default BSC1Payment; \ No newline at end of file