diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx index 9e5df58..51b1605 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx @@ -46,13 +46,15 @@ import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js'; const BSBillingEditQuantity = (props) => { const dispatch = useDispatch(); const formRef = useRef(null); + const detailedFormRef = useRef(null); + const itemDiscountFormRef = useRef(null); const quantityInputRef = useRef(null); const priceChangeInputRef = useRef(null); const reductionInputRef = useRef(null); - const { setIndex = () => { } } = props; const [disableSubmitButton, setDisableSubmitButton] = useState(false); + console.log(disableSubmitButton, "disableSubmitButton") const SessionData = useSelector(StoredSessionData); // const AppId = SessionData?.AppId; // const CompId = SessionData?.CompId; @@ -141,6 +143,8 @@ const BSBillingEditQuantity = (props) => { const [PercentageSelection, setPercentageSelection] = useState('Fixed'); const [RadioDetails, setRadioDetails] = useState(false); const [editedPrice, setEditedPrice] = useState(0); + const [itemDiscountPercentageSelection, setItemDiscountPercentageSelection] = useState('Fixed'); + const [itemDiscountPrice, setItemDiscountPrice] = useState(0); const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find( (setting) => setting?.SettingIdName?.toLowerCase() === 'decimal' && @@ -156,7 +160,7 @@ const BSBillingEditQuantity = (props) => { shallowEqual ); const FreeProdList = useSelector(GlobalFreeProdList); - console.log(CartOrderDetails, 'CartOrderDetails'); + console.log(editedPrice, 'editedPrice'); const TakAwayId = ConfigDataList?.find( (a) => a?.ConfigName === 'TakeAway' @@ -183,9 +187,9 @@ const BSBillingEditQuantity = (props) => { ? parseInt(props.Productdata.OrderQty) : props.Productdata.OrderQty ); + SellingPriceChange(parseFloat(props.Productdata?.SellingPrice || 0)); }, - [props.BSBillingEditQuantity], - [props.Productdata] + [props.BSBillingEditQuantity, props.Productdata] ); useEffect(() => { @@ -264,6 +268,13 @@ const BSBillingEditQuantity = (props) => { } }, [PackageDtl]); + useEffect(() => { + if (RadioBtnSelection === 'Price' && !RadioDetails) { + setEditedPrice(parseFloat(props.Productdata?.SellingPrice || 0)); + } + + }, [RadioBtnSelection, RadioDetails]); + const getBookingTypeId = async () => { let tempconfigdata = await dispatch( getConfigType({ TypeName: 'Booking Type' }) @@ -302,9 +313,12 @@ const BSBillingEditQuantity = (props) => { setQuantity(tempremovedata); }; const openRadioDetails = () => { - setDisableSubmitButton(false); + // setDisableSubmitButton(false); setRadioDetails(!RadioDetails); setEditedPrice(0); + // Clear ItemDiscount field and reset discount price + setItemDiscountPrice(0); + itemDiscountFormRef.current?.resetFields(); }; // const AddQuantityonly = () => { @@ -424,7 +438,8 @@ const BSBillingEditQuantity = (props) => { }; const AddProductQuantity = async () => { - let newPrice = editedPrice > 0 ? editedPrice : props.Productdata.OrderRate; + let disCountprice = editedPrice - itemDiscountPrice + let newPrice = safeRound(disCountprice > 0 ? disCountprice : props.Productdata.OrderRate); await dispatch(changeHoldOrderDtl(false)); await dispatch(changePreviousOrderLength(CartOrderDetails?.length)); @@ -3154,6 +3169,26 @@ const BSBillingEditQuantity = (props) => { ...(offerApply && { Offer: qty * (newPrice > 0 ? newPrice : editedProduct?.OrderRate), }), + ...( + !offerApply && itemDiscountPrice > 0 + ? { + DiscountAmt: safeRound(itemDiscountPrice), + DiscountType: itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P', + DiscountValue: + itemDiscountPercentageSelection === 'Fixed' + ? itemDiscountPrice + : ( + (itemDiscountPrice / + (newPrice > 0 ? newPrice : editedProduct?.OrderRate)) * 100 + ) + } + : { + DiscountAmt: null, + DiscountType: null, + DiscountValue: null + } + ) + }; if (hasOffer) { @@ -3213,6 +3248,7 @@ const BSBillingEditQuantity = (props) => { OfferMessage: updatedProduct?.OfferMessage || bestOffer?.OfferMessage, }; + console.log(updatedProduct, 'updatedProduct'); const shouldRemove = (c) => @@ -3292,11 +3328,52 @@ const BSBillingEditQuantity = (props) => { const onPercentageSelectionChange = (data) => { setPercentageSelection(data); setEditedPrice(0); - formRef.current?.resetFields(); + detailedFormRef.current?.resetFields(); setDisableSubmitButton(false); }; + const onItemDiscountPercentageChange = (data) => { + setItemDiscountPercentageSelection(data); + setItemDiscountPrice(0); + itemDiscountFormRef.current?.resetFields(); + }; + const ItemDiscountChangefun = (data) => { + + const enteredDiscount = parseFloat(data?.target.value); + + if (enteredDiscount) { + let roundedrice = safeRound(editedPrice ? editedPrice : 0) + const sellingPrice = parseFloat(roundedrice || props.Productdata?.SellingPrice || 0); + if (itemDiscountPercentageSelection === 'Fixed') { + if (parseFloat(enteredDiscount) < parseFloat(sellingPrice)) { + setItemDiscountPrice(parseFloat(enteredDiscount)); + } else { + setMessageType('error'); + setMessageData('Discount cannot exceed selling price'); + setItemDiscountPrice(0); + itemDiscountFormRef.current?.resetFields(); + } + } else { + if (parseFloat(enteredDiscount) < 100) { + let discountAmt = (parseFloat(enteredDiscount) * parseFloat(sellingPrice)) / 100; + setItemDiscountPrice(parseFloat(discountAmt)); + } else { + setMessageType('error'); + setMessageData('Percentage cannot exceed 100%'); + setItemDiscountPrice(0); + itemDiscountFormRef.current?.resetFields(); + } + } + } else { + setItemDiscountPrice(0); + } + }; const PriceChangefun = (data) => { const enteredDiscount = parseFloat(data?.target.value); + + // Clear ItemDiscount field and reset discount price + setItemDiscountPrice(0); + itemDiscountFormRef.current?.resetFields(); + if (enteredDiscount) { const sellingPrice = parseFloat(props.Productdata?.SellingPrice || 0); const limit = parseFloat(props.Productdata?.DiscountLimit || 0); @@ -3408,11 +3485,15 @@ const BSBillingEditQuantity = (props) => { } }; const SellingPriceChange = (data) => { - if (data?.target.value) { + if (data) { const sellingPrice = parseFloat(props.Productdata?.SellingPrice || 0); const limit = parseFloat(props.Productdata?.DiscountLimit || 0); const limitType = props.Productdata?.DiscountLimitType; - const enteredDiscount = parseFloat(data?.target.value); + const enteredDiscount = parseFloat(data); + + // Clear ItemDiscount field and reset discount price + setItemDiscountPrice(0); + itemDiscountFormRef.current?.resetFields(); if (limit === null || limit === undefined || limit === 0) { // if ( @@ -3420,6 +3501,7 @@ const BSBillingEditQuantity = (props) => { // parseFloat(enteredDiscount) === parseFloat(sellingPrice) // ) { setEditedPrice(enteredDiscount); + formRef.current?.setFieldsValue({ SellPrice: enteredDiscount }); setDisableSubmitButton(true); // } else { // setMessageType('error'); @@ -3440,7 +3522,8 @@ const BSBillingEditQuantity = (props) => { } if (enteredDiscount === maxDiscount) { - setEditedPrice(data?.target.value); + setEditedPrice(data); + formRef.current?.setFieldsValue({ SellPrice: data }); setDisableSubmitButton(true); return; } @@ -3449,14 +3532,20 @@ const BSBillingEditQuantity = (props) => { setMessageType('error'); setMessageData(`You cannot sell below ₹${maxDiscount.toFixed(2)}`); setEditedPrice(0); + formRef.current?.setFieldsValue({ SellPrice: 0 }); setDisableSubmitButton(false); return; } setDisableSubmitButton(true); - setEditedPrice(data?.target.value); + setEditedPrice(data); + formRef.current?.setFieldsValue({ SellPrice: data }); } else { setDisableSubmitButton(false); setEditedPrice(0); + formRef.current?.setFieldsValue({ SellPrice: 0 }); + // Clear ItemDiscount field and reset discount price + setItemDiscountPrice(0); + itemDiscountFormRef.current?.resetFields(); } }; @@ -3573,7 +3662,7 @@ const BSBillingEditQuantity = (props) => { } }} > - Price Change + OverRide / Discount )} @@ -3663,62 +3752,147 @@ const BSBillingEditQuantity = (props) => { )} {RadioBtnSelection == 'Price' && ( -
- +
+
+ - {!RadioDetails && ( - { - await validateSafeInput(value); + {!RadioDetails && ( +
+ { + await validateSafeInput(value); - if (value && value.length > 10) { - return Promise.reject( - 'Selling Price should not exceed 10 characters' + if (value && value.length > 10) { + return Promise.reject( + 'Selling Price should not exceed 10 characters' + ); + } + + return Promise.resolve(); + }, + }, + ]} + > + { SellingPriceChange(e?.target?.value) }} + inputMode="decimal" + isOnChange={editedPrice > 0 ? true : false} + onInput={(e) => { + const cleanedValue = e.target.value.replace( + /[^0-9.]/g, + '' ); - } + const parts = cleanedValue.split('.'); + e.target.value = + parts.length > 2 + ? `${parts[0]}.${parts.slice(1).join('')}` + : cleanedValue; + }} + // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} + /> + +
+ )} - return Promise.resolve(); - }, - }, - ]} - > - { - const cleanedValue = e.target.value.replace( - /[^0-9.]/g, - '' - ); - const parts = cleanedValue.split('.'); - e.target.value = - parts.length > 2 - ? `${parts[0]}.${parts.slice(1).join('')}` - : cleanedValue; - }} - // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} - /> -
- )} +
+ More +
+ {RadioDetails && ( + <> +
+ { + onPercentageSelectionChange(e); + }} + /> +
+
+
+ { + await validateSafeInput(value); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + PriceChangefun(e)} + inputMode="decimal" + isOnChange={editedPrice > 0 ? true : false} + onInput={(e) => { + const cleanedValue = e.target.value.replace( + /[^0-9.]/g, + '' + ); + const parts = cleanedValue.split('.'); + e.target.value = + parts.length > 2 + ? `${parts[0]}.${parts.slice(1).join('')}` + : cleanedValue; + }} + // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} + /> + + {/* PriceChangefun(e)} + className="EditQuantity-Pricebox" + /> */} +
+
+ {editedPrice > 0 &&
+
+ {' '} + Price: {safeRound(editedPrice ? editedPrice : 0)} +
+
} + + )} -
- More
- {RadioDetails && ( +
+ + <>
{ { value: 'Percentage', label: 'Percentage' }, ]} fieldState={true} - defaultSelect={PercentageSelection} + defaultSelect={itemDiscountPercentageSelection} onSelectFuntion={(e) => { - onPercentageSelectionChange(e); + onItemDiscountPercentageChange(e); }} />
-
+ { }, { validator: async (_, value) => { - await validateSafeInput(value); // To block HTML tags & SQL keywords + await validateSafeInput(value); return Promise.resolve(); }, }, ]} > PriceChangefun(e)} + onChange={(e) => ItemDiscountChangefun(e)} inputMode="decimal" onInput={(e) => { const cleanedValue = e.target.value.replace( @@ -3773,24 +3945,22 @@ const BSBillingEditQuantity = (props) => { ? `${parts[0]}.${parts.slice(1).join('')}` : cleanedValue; }} - // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} /> - {/* PriceChangefun(e)} - className="EditQuantity-Pricebox" - /> */}
-
+ {itemDiscountPrice > 0 && editedPrice > 0 &&
{' '} - Price: {safeRound(editedPrice ? editedPrice : 0)} + {console.log(editedPrice, itemDiscountPrice, "itemDiscountPrice")} + Final Price: {safeRound(editedPrice) - (itemDiscountPrice || 0)}
-
+
} - )} +
+
+ )} {RadioBtnSelection == 'Parcel' && ( <> diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx index d059d55..ea2cd46 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx @@ -2596,7 +2596,7 @@ const BSBillingTable3 = () => { {item?.Type != 'C' ? item.Offer && item.Offer > 0 ? item.Offer - : '-' + :item.DiscountAmt ? item.DiscountAmt : '-' : item?.OfferPrice && item?.OfferPrice > 0 ? item?.OfferType === 'F' ? `₹${safeRound(item.OfferPrice)}` @@ -2873,7 +2873,7 @@ const BSBillingTable3 = () => { {item?.Type != 'C' ? item.Offer && item.Offer > 0 ? item.Offer - : '-' + : item.DiscountAmt ? item.DiscountAmt : '-' : item?.OfferPrice && item?.OfferPrice > 0 ? item?.OfferType === 'F' ? `₹${safeRound(item.OfferPrice)}` @@ -3198,7 +3198,7 @@ const BSBillingTable3 = () => { {item?.Type != 'C' ? item.Offer && item.Offer > 0 ? item.Offer - : '-' + : item.DiscountAmt ? item.DiscountAmt : '-' : item?.OfferPrice && item?.OfferPrice > 0 ? item?.OfferType === 'F' ? `₹${safeRound(item.OfferPrice)}` @@ -3508,7 +3508,7 @@ const BSBillingTable3 = () => { {item?.Type != 'C' ? item.Offer && item.Offer > 0 ? item.Offer - : '-' + : item.DiscountAmt ? item.DiscountAmt : '-' : item?.OfferPrice && item?.OfferPrice > 0 ? item?.OfferType === 'F' ? `₹${safeRound(item.OfferPrice)}` diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx index d8e3faf..d4f2a42 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3pay.jsx @@ -321,7 +321,7 @@ const BSBillingTable3Pay = () => { const ProdSubCat = useSelector(GlobalProductSubCategorie); const BSLayoutData = useSelector(getTemplateData); const Combodata = useSelector(GlobalCombocarddata, shallowEqual); - + console.log(PaymentOptions, "PaymentOptions") const Custdisable = useSelector(GlobalSelectedCustDisable); const SettingDataSelector = useSelector(PreferenceData); @@ -379,7 +379,7 @@ const BSBillingTable3Pay = () => { const OrderCardDetail = useSelector(GlobalOrderCardDetails); const [customerPreviesOrders, setCustomerPreviesOrders] = useState(false); - console.log(OrderCardDetail, 'OrderCardDetail'); + console.log(paybtns, 'paybtns'); //Total calculation const TotalItems = OrderCardDetail?.length; const [formattedDate, setFormattedDate] = useState(''); @@ -423,6 +423,7 @@ const BSBillingTable3Pay = () => { const [PaymentgatewayUPI, setPaymentgatewayUPI] = useState([]); const [PaymentDeviceUPI, setPaymentDeviceUPI] = useState([]); const [UpiPayOption, setUpiPayOption] = useState([]); + console.log(UpiPayOption, "UpiPayOption") const [BusinessPayOption, setBusinessPayoption] = useState([]); const [CardPayOption, setCardPayOption] = useState([]); const [Splitpayment, setSplitpayment] = useState(false); @@ -469,6 +470,7 @@ const BSBillingTable3Pay = () => { const [OrderStatus, setOrderStatus] = useState(true); const GlobaluseOptions = useSelector(GlobalCommonPaymentOptions); + console.log(GlobaluseOptions, "GlobaluseOptions") const [useOptions, setuseOptions] = useState([]); const paymentloader = useSelector(GlobalPayementloader); const [UnpaidConfirmation, setUnpaidConfirmation] = useState(false); @@ -993,7 +995,7 @@ const BSBillingTable3Pay = () => { const selectedStyle = stylesMap[ - printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle + printerTemplateStyle == undefined ? 'Style 13' : printerTemplateStyle ]; if (selectedStyle) { @@ -1072,9 +1074,9 @@ const BSBillingTable3Pay = () => { setDefaultPaymentMode([]); } }; - if (salesBillEdit) { - setDefaultPaymentOption(); - } + // if (salesBillEdit) { + setDefaultPaymentOption(); + // } }, [defaultPaymentTrigger, salesBillEdit]); const TokenPrint = async (index) => { @@ -1614,6 +1616,7 @@ const BSBillingTable3Pay = () => { //dhana const getPaymentOptionFeature = async () => { + const FiltersalesPayment = GlobaluseOptions?.filter( (item) => item.FlowName?.toLowerCase() === 'sales' ); @@ -1648,6 +1651,7 @@ const BSBillingTable3Pay = () => { filterpaymentdevice?.[0]?.ModeDetails?.filter((item) => item?.ModeName?.toLowerCase()?.includes('upi') ) || []; + setPaymentOptions(filterpaycounter?.[0]?.ModeDetails); setPaymentUpiOptions( FiltersalesPayment?.[0]?.PaymentDetails?.Payatthecounter @@ -2189,6 +2193,7 @@ const BSBillingTable3Pay = () => { }; const Booking = async (value, pay) => { + const TakAwayId = ConfigDataList?.find( (a) => a?.ConfigName === 'TakeAway' )?.ConfigId; @@ -2214,15 +2219,15 @@ const BSBillingTable3Pay = () => { OrderStatus: 'O', OrderType: BookingType === 'Dine In' || - BookingTypeBoth || - Estimation?.SettingValue == 'N' + BookingTypeBoth || + Estimation?.SettingValue == 'N' ? 'S' : GlobEstBooking === 'OvrAllEst' ? 'E' : GlobEstBooking === 'ParEst' ? GlobProdwisedata?.includes( - a.InwardDtlId + ' ' + a?.BookingTypeName - ) + a.InwardDtlId + ' ' + a?.BookingTypeName + ) ? 'E' : 'S' : 'S', @@ -2239,6 +2244,10 @@ const BSBillingTable3Pay = () => { BatchRef: a.BatchRef, PackageDtl: a.PackageDtl, SetCount: a.SetCount, + ...(a?.DiscountValue && { DiscountValue: a.DiscountValue }), + ...(a?.DiscountType && { DiscountType: a.DiscountType }), + ...(a?.DiscountAmt && { DiscountAmt: a.DiscountAmt }) + })); const NotSlectedTypeFind = temporderdetail?.find( (a) => a?.BookingType != SelectedBookingType @@ -2314,7 +2323,7 @@ const BSBillingTable3Pay = () => { : Paybtnnameselected?.toLowerCase() === 'credit' ? 'S' : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', OrderDtlDetails: @@ -2331,9 +2340,9 @@ const BSBillingTable3Pay = () => { ? globalTipAmount === 0 ? SelectedTableDetails : SelectedTableDetails?.map((item) => ({ - ...item, - TipsAmount: globalTipAmount, - })) + ...item, + TipsAmount: globalTipAmount, + })) : null, SalesPaymentType: 'normal', PaymentDetail: [ @@ -2348,8 +2357,8 @@ const BSBillingTable3Pay = () => { ? PaymentgatewayUPI?.[0]?.ModeId : SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find( - (busupi) => busupi?.ModeId === UpiId - )?.ModeId + (busupi) => busupi?.ModeId === UpiId + )?.ModeId : paybtnselected : paybtnselected ? paybtnselected @@ -2362,15 +2371,15 @@ const BSBillingTable3Pay = () => { salesBillEdit && currentOrderNetAmount < previousNetAmount ? null : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'business' + SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find((busupi) => busupi?.ModeId === UpiId) - ?.MerchantId + ?.MerchantId : null, PaymentOptionType: salesBillEdit && - currentOrderNetAmount < previousNetAmount && - (refundPaySelectedName?.toLowerCase() === 'cash' || - refundPaySelectedName?.toLowerCase() === 'credit') + currentOrderNetAmount < previousNetAmount && + (refundPaySelectedName?.toLowerCase() === 'cash' || + refundPaySelectedName?.toLowerCase() === 'credit') ? 'PC' : Paybtnnameselected?.toLowerCase() === 'cash' ? 'PC' @@ -2390,29 +2399,29 @@ const BSBillingTable3Pay = () => { ? null : SelectedUPIPayOption?.toLowerCase() === 'default' ? PaymentUpiOptions?.find((upipay) => upipay?.UPIId === UpiId) - ?.UPIDetailId + ?.UPIDetailId : SelectedUPIPayOption?.toLowerCase() === 'business' ? BusinessPayOption?.find( - (busupi) => busupi?.ModeId === UpiId - )?.MerchantUPIId + (busupi) => busupi?.ModeId === UpiId + )?.MerchantUPIId : null, AccountDtl: salesBillEdit && currentOrderNetAmount < previousNetAmount ? [] : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? useOptions?.[0]?.PaymentDetails?.Payatthecounter?.find( - (upipay) => upipay?.UPIId === UpiId - ) + (upipay) => upipay?.UPIId === UpiId + ) : (Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'pd') || - (Paybtnnameselected?.toLowerCase() === 'card' && - SelectedCardOption?.toLowerCase() === 'pd') + SelectedUPIPayOption?.toLowerCase() === 'pd') || + (Paybtnnameselected?.toLowerCase() === 'card' && + SelectedCardOption?.toLowerCase() === 'pd') ? useOptions?.[0]?.PaymentDetails?.PaymentDevice : (Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'pg') || - (Paybtnnameselected?.toLowerCase() === 'card' && - SelectedCardOption?.toLowerCase() === 'pg') + SelectedUPIPayOption?.toLowerCase() === 'pg') || + (Paybtnnameselected?.toLowerCase() === 'card' && + SelectedCardOption?.toLowerCase() === 'pg') ? useOptions?.[0]?.PaymentDetails?.PaymentGateway : [], PaymentStatus: @@ -2423,13 +2432,13 @@ const BSBillingTable3Pay = () => { : Paybtnnameselected?.toLowerCase() === 'credit' ? 'S' : Paybtnnameselected?.toLowerCase() === 'upi' && - SelectedUPIPayOption?.toLowerCase() === 'default' + SelectedUPIPayOption?.toLowerCase() === 'default' ? 'S' : 'P', Debit: salesBillEdit && - currentOrderNetAmount < previousNetAmount && - refundPaySelectedName?.toLowerCase() === 'credit' + currentOrderNetAmount < previousNetAmount && + refundPaySelectedName?.toLowerCase() === 'credit' ? Math.round(previousNetAmount - currentOrderNetAmount) : 0, Credit: salesBillEdit @@ -2507,14 +2516,14 @@ const BSBillingTable3Pay = () => { setMessageType('success'); setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); response?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([response?.data]); @@ -2674,14 +2683,14 @@ const BSBillingTable3Pay = () => { setMessageType('success'); setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); response?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([response?.data]); @@ -2784,14 +2793,14 @@ const BSBillingTable3Pay = () => { } setMessageData( response?.data?.response + - ' ' + - (response?.data?.OrderDetails?.length > 0 - ? response?.data?.OrderId && - extractLastNumberOrderId( - response?.data?.OrderId, - response?.data?.OrderDetails?.[0]?.FYStatus - ) - : '') + ' ' + + (response?.data?.OrderDetails?.length > 0 + ? response?.data?.OrderId && + extractLastNumberOrderId( + response?.data?.OrderId, + response?.data?.OrderDetails?.[0]?.FYStatus + ) + : '') ); if (response?.data?.OrderDetails?.length > 0) { setPrintOrderDetails([response?.data]); @@ -2968,14 +2977,14 @@ const BSBillingTable3Pay = () => { 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 + ? bookingpaymentupdate?.data?.OrderId && + extractLastNumberOrderId( + bookingpaymentupdate?.data?.OrderId, + bookingpaymentupdate?.data?.OrderDetail?.[0]?.FYStatus + ) + : '') ); bookingpaymentupdate?.data?.OrderDetails?.length > 0 && setPrintOrderDetails([bookingpaymentupdate?.data]); @@ -2994,7 +3003,7 @@ const BSBillingTable3Pay = () => { if ( Date.now() - startTime > useOptions?.[0]?.PDConfigDetails?.[0]?.AutoCancelDurationInMinutes * - 60000 + 60000 ) { // 60,000 ms = 1 minute @@ -3713,9 +3722,9 @@ const BSBillingTable3Pay = () => { 'not-allowed', color: OrderCardDetail?.length > 0 || - (selOption?.value === undefined && - GlobalAddCustomerDetails1?.length === 0 && - GetCustId?.CustMobile === undefined) + (selOption?.value === undefined && + GlobalAddCustomerDetails1?.length === 0 && + GetCustId?.CustMobile === undefined) ? 'gray' : 'rgb(18, 146, 238)', fontSize: '28px', @@ -3737,16 +3746,16 @@ const BSBillingTable3Pay = () => { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, width: '2rem', @@ -3769,14 +3778,14 @@ const BSBillingTable3Pay = () => { width: '1.5rem', cursor: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'not-allowed' : 'pointer', color: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'gray' : 'rgb(18, 146, 238)', display: 'flex', @@ -3809,8 +3818,8 @@ const BSBillingTable3Pay = () => { cursor: OrderCardDetail?.length > 0 && 'not-allowed', color: OrderCardDetail?.length > 0 || - (OrderCardDetail?.length > 0 && - GetCustId?.CustMobile === undefined) + (OrderCardDetail?.length > 0 && + GetCustId?.CustMobile === undefined) ? 'gray' : 'rgb(18, 146, 238)', fontSize: '25px', @@ -3897,65 +3906,65 @@ const BSBillingTable3Pay = () => { <> {unpaidFlow == false ? item?.OptionName == 'Hold' && - BookingType !== 'Dine In' && - !BookingTypeBoth && - OrderCardDetail?.length != 0 && - CheckOrderType?.length === 0 && - OrderType != 'Failed' && - CheckBookingStatus != 'Close' && - paybtns?.length > 0 && - !addnewAccess && ( - - {' '} - AddBookingDetails('Hold', false)} - style={{ - fontSize: '30px', - cursor: 'pointer', - color: '' ? '#52c41a' : '#1292EE', - }} - /> - - ) + BookingType !== 'Dine In' && + !BookingTypeBoth && + OrderCardDetail?.length != 0 && + CheckOrderType?.length === 0 && + OrderType != 'Failed' && + CheckBookingStatus != 'Close' && + paybtns?.length > 0 && + !addnewAccess && ( + + {' '} + AddBookingDetails('Hold', false)} + style={{ + fontSize: '30px', + cursor: 'pointer', + color: '' ? '#52c41a' : '#1292EE', + }} + /> + + ) : ''} - + {unpaidFlow == false ? item?.OptionName == 'Hold' && - paybtns?.length > 0 && - BookingType !== 'Dine In' && - !BookingTypeBoth && - Holddata?.length > 0 && - OrderCardDetail?.length == 0 && - CheckBookingStatus != 'Close' && - !addnewAccess && ( - 0 && + BookingType !== 'Dine In' && + !BookingTypeBoth && + Holddata?.length > 0 && + OrderCardDetail?.length == 0 && + CheckBookingStatus != 'Close' && + !addnewAccess && ( + + {' '} + - {' '} - - HandleholdModelOpen()} - style={{ - fontSize: '28px', - cursor: 'pointer', - color: Holddata ? '#52c41a' : 'default', - pointerEvents: - OrderType === 'Failed' ? 'none' : 'auto', - }} - /> - - - ) + HandleholdModelOpen()} + style={{ + fontSize: '28px', + cursor: 'pointer', + color: Holddata ? '#52c41a' : 'default', + pointerEvents: + OrderType === 'Failed' ? 'none' : 'auto', + }} + /> + + + ) : ''} ))} @@ -4001,14 +4010,14 @@ const BSBillingTable3Pay = () => { width: '1.5rem', cursor: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'not-allowed' : 'pointer', color: OrderCardDetail?.length === 0 || - CheckBookingStatus == 'Close' || - addnewAccess + CheckBookingStatus == 'Close' || + addnewAccess ? 'gray' : 'rgb(18, 146, 238)', display: 'flex', @@ -4070,31 +4079,31 @@ const BSBillingTable3Pay = () => { (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 'none' : 'auto', opacity: (BookingType === 'Dine In' || BookingTypeBoth || CheckOrderType?.length > 0) && - !unpaidFlow && - OrderStatus + !unpaidFlow && + OrderStatus ? 0.5 : 1, }} > {paybtns?.length > 0 && - currentOrderNetAmount >= previousNetAmount ? ( + currentOrderNetAmount >= previousNetAmount ? ( paybtns?.map((payment) => (