diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx index e91957c..9c84e49 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx @@ -12,6 +12,8 @@ import { GlobalReorderProductDetails, PreferenceData, getConfigType, + changeCombofocus, + changefocusStatusCust, } from '../../../../../Features/BookingScreen/BookingData/BookingData'; import { ArrowRightOutlined } from '@ant-design/icons'; import { Messages } from '../../../../../Components/Notifications/Messages'; @@ -48,13 +50,14 @@ const BSBillingEditQuantity = (props) => { const formRef = useRef(null); const detailedFormRef = useRef(null); const itemDiscountFormRef = useRef(null); + const discountRef = useRef(null); const quantityInputRef = useRef(null); const priceChangeInputRef = useRef(null); const reductionInputRef = useRef(null); - const { setIndex = () => { } } = props; + const { setIndex = () => {} } = props; const [disableSubmitButton, setDisableSubmitButton] = useState(false); - console.log(disableSubmitButton, "disableSubmitButton") + console.log(disableSubmitButton, 'disableSubmitButton'); const SessionData = useSelector(StoredSessionData); // const AppId = SessionData?.AppId; // const CompId = SessionData?.CompId; @@ -68,13 +71,30 @@ const BSBillingEditQuantity = (props) => { shallowEqual ); - const overAllLimitPreferenece = - preferenceDatas?.[0]?.['SettingDtlDetails']?.find( - (item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y'); - const itemWiseLimitPreferenece = - preferenceDatas?.[0]?.['SettingDtlDetails']?.find( - (item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y'); - const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null; + const overAllLimitPreferenece = preferenceDatas?.[0]?.[ + 'SettingDtlDetails' + ]?.find( + (item) => + item.SettingIdName?.toLowerCase() === 'overalllimit' && + item?.SettingValue === 'Y' + ); + const itemDiscount = preferenceDatas?.[0]?.['SettingDtlDetails']?.find( + (item) => + item.SettingIdName?.toLowerCase() === 'itemdiscount' && + item?.SettingValue === 'Y' + ); + + const itemWiseLimitPreferenece = preferenceDatas?.[0]?.[ + 'SettingDtlDetails' + ]?.find( + (item) => + item.SettingIdName?.toLowerCase() === 'itemwiselimit' && + item?.SettingValue === 'Y' + ); + const maxQtyLimit = + itemWiseLimitPreferenece?.SettingCount || + overAllLimitPreferenece?.SettingCount || + null; const preferenceOffer = preferenceDatas?.[0]?.['SettingDtlDetails']?.find( (item) => item.SettingIdName === 'Offer' @@ -117,7 +137,7 @@ const BSBillingEditQuantity = (props) => { price: 'Price', quantity: 'qty', Parcel: 'Parcel', - weightAmount: 'weightAmount' + weightAmount: 'weightAmount', }; const [RadioBtnSelection, setRadioBtnSelection] = useState(() => { if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) { @@ -142,9 +162,10 @@ 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 [editedPrice, setEditedPrice] = useState(''); + const [itemDiscountPercentageSelection, setItemDiscountPercentageSelection] = + useState('Fixed'); + const [itemDiscountPrice, setItemDiscountPrice] = useState(''); const allowDecimal = preferenceDatas?.[0]?.SettingDtlDetails?.find( (setting) => setting?.SettingIdName?.toLowerCase() === 'decimal' && @@ -178,19 +199,18 @@ const BSBillingEditQuantity = (props) => { } }, []); - useEffect( - () => { - setEditOpen(props.BSBillingEditQuantity); - setItemData(props.Productdata); - setQuantity( - props?.Productdata?.ScaleType !== 'weight' - ? parseInt(props.Productdata.OrderQty) - : props.Productdata.OrderQty - ); - SellingPriceChange(parseFloat(props.Productdata?.SellingPrice || 0)); - }, - [props.BSBillingEditQuantity, props.Productdata] - ); + useEffect(() => { + dispatch(changeCombofocus(true)); + dispatch(changefocusStatusCust(true)); + setEditOpen(props.BSBillingEditQuantity); + setItemData(props.Productdata); + setQuantity( + props?.Productdata?.ScaleType !== 'weight' + ? parseInt(props.Productdata.OrderQty) + : props.Productdata.OrderQty + ); + SellingPriceChange(parseFloat(props.Productdata?.SellingPrice || 0)); + }, [props.BSBillingEditQuantity, props.Productdata]); useEffect(() => { if (preferenceshortcutkey) { @@ -272,7 +292,6 @@ const BSBillingEditQuantity = (props) => { if (RadioBtnSelection === 'Price' && !RadioDetails) { setEditedPrice(parseFloat(props.Productdata?.SellingPrice || 0)); } - }, [RadioBtnSelection, RadioDetails]); const getBookingTypeId = async () => { @@ -315,9 +334,9 @@ const BSBillingEditQuantity = (props) => { const openRadioDetails = () => { // setDisableSubmitButton(false); setRadioDetails(!RadioDetails); - setEditedPrice(0); + // setEditedPrice(""); // Clear ItemDiscount field and reset discount price - setItemDiscountPrice(0); + setItemDiscountPrice(''); itemDiscountFormRef.current?.resetFields(); }; @@ -357,7 +376,6 @@ const BSBillingEditQuantity = (props) => { }; const calculateOverAllQty = (item, filterItems) => { - if (!item) return 0; const totalUsedQty = @@ -438,8 +456,10 @@ const BSBillingEditQuantity = (props) => { }; const AddProductQuantity = async () => { - let disCountprice = safeRound(editedPrice) - itemDiscountPrice - let newPrice = safeRound(disCountprice > 0 ? disCountprice : props.Productdata.OrderRate); + let disCountprice = safeRound(editedPrice) - itemDiscountPrice; + let newPrice = safeRound( + disCountprice > 0 ? disCountprice : props.Productdata.OrderRate + ); await dispatch(changeHoldOrderDtl(false)); await dispatch(changePreviousOrderLength(CartOrderDetails?.length)); @@ -461,17 +481,32 @@ const BSBillingEditQuantity = (props) => { ); const editedProduct = CartOrderDetails[editedProductIndex]; - if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { + if ( + (overAllLimitPreferenece || itemWiseLimitPreferenece) && + maxQtyLimit + ) { if (overAllLimitPreferenece) { - const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex)); - if ((calculatedOverAllQty + editedQty) > maxQtyLimit) { - setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`); + const calculatedOverAllQty = calculateOverAllQtyLimit( + CartOrderDetails?.filter((_, index) => index !== editedProductIndex) + ); + if (calculatedOverAllQty + editedQty > maxQtyLimit) { + setMessageData( + `Overall Quantity Limit Exceeds than ${maxQtyLimit}` + ); setMessageType('warning'); return; } } else if (itemWiseLimitPreferenece) { - const exceptEditedItemCart = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex && _.ProdId === editedProduct?.ProdId && _.InwardDtlId === editedProduct?.InwardDtlId)); - const totalQtyForItem = ((exceptEditedItemCart || 0) + (editedQty || 0)); + const exceptEditedItemCart = calculateOverAllQtyLimit( + CartOrderDetails?.filter( + (_, index) => + index !== editedProductIndex && + _.ProdId === editedProduct?.ProdId && + _.InwardDtlId === editedProduct?.InwardDtlId + ) + ); + const totalQtyForItem = + (exceptEditedItemCart || 0) + (editedQty || 0); if (totalQtyForItem > maxQtyLimit) { setMessageData(`Item Quantity Limit Exceeds than ${maxQtyLimit}`); setMessageType('warning'); @@ -745,11 +780,12 @@ const BSBillingEditQuantity = (props) => { newPrice, overrideQty = null ) => { - const editedQty = overrideQty !== null - ? overrideQty - : props?.Productdata?.ScaleType !== 'weight' - ? parseInt(Quantity) - : props.Productdata.OrderQty; + const editedQty = + overrideQty !== null + ? overrideQty + : props?.Productdata?.ScaleType !== 'weight' + ? parseInt(Quantity) + : props.Productdata.OrderQty; const addFirst = BillOrderPre === 'Y'; const isExistsInFreeProdList = FreeProdList?.find( (product) => @@ -773,7 +809,7 @@ const BSBillingEditQuantity = (props) => { return ( cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OfferMessage?.[0]?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && cartItem?.OfferMode === editedProduct?.OfferMode && cartItem?.BookingTypeName !== editedProduct?.BookingTypeName ); @@ -907,7 +943,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OrderRate === editedProduct?.OrderRate && cartItem?.BookingTypeName !== - editedProduct?.BookingTypeName && + editedProduct?.BookingTypeName && !cartItem?.OfferMode && cartItem?.Offer === 0 ); @@ -921,7 +957,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.OrderRate === editedProduct?.OrderRate && cartItem?.BookingTypeName !== - editedProduct?.BookingTypeName && + editedProduct?.BookingTypeName && cartItem?.OfferMode === editedProduct?.OfferMode && cartItem?.Offer > 0 ); @@ -1054,7 +1090,7 @@ const BSBillingEditQuantity = (props) => { ) ) && product?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && product?.OfferMode === editedProduct?.OfferMode ) { const freeQty = @@ -1087,7 +1123,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1170,7 +1206,7 @@ const BSBillingEditQuantity = (props) => { ) ) && product?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && product?.OfferMode === editedProduct?.OfferMode ) { return { @@ -1200,7 +1236,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1387,7 +1423,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1489,7 +1525,7 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - editedProduct?.OfferMessage?.[0]?.OfferId && + editedProduct?.OfferMessage?.[0]?.OfferId && offerProduct?.OfferMode === editedProduct?.OfferMode; if (hasMatchingFreeProduct && isMatchingOffer) { @@ -1643,7 +1679,7 @@ const BSBillingEditQuantity = (props) => { ) && cartItem?.Offer && isFreeProductApplicable?.OfferId === - cartItem?.OfferMessage?.[0]?.OfferId + cartItem?.OfferMessage?.[0]?.OfferId ); } ); @@ -1932,11 +1968,11 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && product?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode) + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode) ) { return { ...product, @@ -1970,11 +2006,11 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2115,7 +2151,7 @@ const BSBillingEditQuantity = (props) => { cartItem?.Offer > 0 && isFreeProductApplicable?.OfferMode === cartItem?.OfferMode && isFreeProductApplicable?.OfferId === - cartItem?.OfferMessage?.[0]?.OfferId + cartItem?.OfferMessage?.[0]?.OfferId ); } ); @@ -2218,11 +2254,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2293,12 +2329,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -2332,13 +2368,13 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode); + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2420,11 +2456,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2477,11 +2513,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2570,11 +2606,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem?.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem?.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem?.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem?.OfferMode && cartItem?.Offer > 0 ) { @@ -2603,11 +2639,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2637,11 +2673,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2740,12 +2776,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -2779,12 +2815,12 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -2863,11 +2899,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.InwardDtlId === - sameBookingTypeProduct.InwardDtlId && + sameBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - sameBookingTypeProduct.BookingTypeName && + sameBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - sameBookingTypeProduct.OrderRate && + sameBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -2926,11 +2962,11 @@ const BSBillingEditQuantity = (props) => { if ( cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.InwardDtlId === - otherBookingTypeProduct.InwardDtlId && + otherBookingTypeProduct.InwardDtlId && cartItem.BookingTypeName === - otherBookingTypeProduct.BookingTypeName && + otherBookingTypeProduct.BookingTypeName && cartItem.OrderRate === - otherBookingTypeProduct.OrderRate && + otherBookingTypeProduct.OrderRate && cartItem.OfferMode && cartItem.Offer > 0 ) { @@ -3002,12 +3038,12 @@ const BSBillingEditQuantity = (props) => { product?.ProdId === editedProduct?.ProdId && product?.InwardDtlId === editedProduct?.InwardDtlId && product?.OfferId === - (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeFreeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeFreeProduct?.OfferMessage?.[0] + ?.OfferId) && product?.OfferMode === - (sameBookingTypeFreeProduct?.OfferMode || - otherBookingTypeFreeProduct?.OfferMode) + (sameBookingTypeFreeProduct?.OfferMode || + otherBookingTypeFreeProduct?.OfferMode) ) { return { ...product, @@ -3041,12 +3077,12 @@ const BSBillingEditQuantity = (props) => { // Also check main offer conditions const isMatchingOffer = offerProduct?.OfferId === - (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || - otherBookingTypeProduct?.OfferMessage?.[0] - ?.OfferId) && + (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || + otherBookingTypeProduct?.OfferMessage?.[0] + ?.OfferId) && offerProduct?.OfferMode === - (sameBookingTypeProduct?.OfferMode || - otherBookingTypeProduct?.OfferMode); + (sameBookingTypeProduct?.OfferMode || + otherBookingTypeProduct?.OfferMode); if (hasMatchingFreeProduct && isMatchingOffer) { // Get loyalty points from the matching free product @@ -3164,10 +3200,12 @@ const BSBillingEditQuantity = (props) => { const updatedProduct = { ...editedProduct, OrderQty: fixedQty, - OrderRate: editedPrice > 0 ? safeRound(editedPrice) : editedProduct?.OrderRate, + OrderRate: + editedPrice > 0 ? safeRound(editedPrice) : editedProduct?.OrderRate, ...calculateTaxAmounts({ qty: qty, - rate: editedPrice > 0 ? safeRound(editedPrice) : editedProduct?.OrderRate, + rate: + editedPrice > 0 ? safeRound(editedPrice) : editedProduct?.OrderRate, taxPercentage: editedProduct?.TaxPercentage, type: editedProduct?.Type, product: editedProduct, @@ -3177,26 +3215,23 @@ const BSBillingEditQuantity = (props) => { ...(offerApply && { Offer: qty * (editedPrice > 0 ? editedPrice : editedProduct?.OrderRate), }), - ...( - !offerApply && itemDiscountPrice > 0 - ? { - DiscountAmt: safeRound(itemDiscountPrice*fixedQty ), - DiscountType: itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P', + ...(!offerApply && itemDiscountPrice > 0 + ? { + DiscountAmt: safeRound(itemDiscountPrice * fixedQty), + DiscountType: + itemDiscountPercentageSelection === 'Fixed' ? 'F' : 'P', DiscountValue: itemDiscountPercentageSelection === 'Fixed' - ? itemDiscountPrice*fixedQty - : ( - (itemDiscountPrice*fixedQty / - (newPrice > 0 ? newPrice : editedProduct?.OrderRate)) * 100 - ) + ? itemDiscountPrice * fixedQty + : ((itemDiscountPrice * fixedQty) / + (newPrice > 0 ? newPrice : editedProduct?.OrderRate)) * + 100, } - : { + : { DiscountAmt: null, DiscountType: null, - DiscountValue: null - } - ) - + DiscountValue: null, + }), }; if (hasOffer) { @@ -3221,17 +3256,17 @@ const BSBillingEditQuantity = (props) => { changeOrderCardDetails( CartOrderDetails?.map((i) => i?.InwardDtlId == updatedProduct?.InwardDtlId && - i?.BookingTypeName == updatedProduct?.BookingTypeName && - i?.localId === updatedProduct?.localId + i?.BookingTypeName == updatedProduct?.BookingTypeName && + i?.localId === updatedProduct?.localId ? { - ...updatedProduct, - Offer: 0, - OfferType: - updatedProduct?.Type === 'C' - ? updatedProduct?.OfferType - : null, - OfferMessage: null, - } + ...updatedProduct, + Offer: 0, + OfferType: + updatedProduct?.Type === 'C' + ? updatedProduct?.OfferType + : null, + OfferMessage: null, + } : i ) ) @@ -3256,7 +3291,6 @@ const BSBillingEditQuantity = (props) => { OfferMessage: updatedProduct?.OfferMessage || bestOffer?.OfferMessage, }; - console.log(updatedProduct, 'updatedProduct'); const shouldRemove = (c) => @@ -3268,10 +3302,10 @@ const BSBillingEditQuantity = (props) => { ((c?.OfferModeType && c?.OfferMode === 'B' ? true : c?.OfferMode !== 'B') && - c?.OfferMode !== 'P' && - c?.OfferMode !== 'C' && - c?.OfferMode !== 'O' && - c?.OfferMode !== 'L' + c?.OfferMode !== 'P' && + c?.OfferMode !== 'C' && + c?.OfferMode !== 'O' && + c?.OfferMode !== 'L' ? true : c?.Offer === 0); @@ -3299,9 +3333,9 @@ const BSBillingEditQuantity = (props) => { isOfferApply = false, }) => { const { OfferType = null, OfferPrice = 0 } = product; - - let totalAmount = qty * rate; - totalAmount = totalAmount - (itemDiscountPrice*qty|| 0); + + let totalAmount = qty * rate; + totalAmount = totalAmount - (itemDiscountPrice * qty || 0); const taxAmount = ( (totalAmount * taxPercentage) / (100 + taxPercentage) @@ -3317,7 +3351,7 @@ const BSBillingEditQuantity = (props) => { return { TotalAmt: type === 'C' && OfferPrice > 0 - ? totalAmount - (offerValue || 0) + ? totalAmount - (offerValue || 0) : totalAmount, TaxAmt: parseFloat(taxAmount), WithoutTaxRate: parseFloat(withoutTaxRate), @@ -3327,6 +3361,8 @@ const BSBillingEditQuantity = (props) => { const CloseModal = () => { props.handleEditQuantityCancel(); setClearQuantity(false); + dispatch(changeCombofocus(false)); + dispatch(changefocusStatusCust(false)); }; const onComplete = useCallback(() => { setMessageData(null); @@ -3347,12 +3383,13 @@ const BSBillingEditQuantity = (props) => { 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); + 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)); @@ -3364,7 +3401,8 @@ const BSBillingEditQuantity = (props) => { } } else { if (parseFloat(enteredDiscount) < 100) { - let discountAmt = (parseFloat(enteredDiscount) * parseFloat(sellingPrice)) / 100; + let discountAmt = + (parseFloat(enteredDiscount) * parseFloat(sellingPrice)) / 100; setItemDiscountPrice(parseFloat(discountAmt)); } else { setMessageType('error'); @@ -3379,8 +3417,13 @@ const BSBillingEditQuantity = (props) => { }; const PriceChangefun = (data) => { const enteredDiscount = parseFloat(data?.target.value); - - // Clear ItemDiscount field and reset discount price + const value = data?.target?.value; + if (value === '') { + setEditedPrice(''); + setDisableSubmitButton(false); + formRef.current?.resetFields(); + return; + } setItemDiscountPrice(0); itemDiscountFormRef.current?.resetFields(); @@ -3490,11 +3533,20 @@ const BSBillingEditQuantity = (props) => { } } else { setDisableSubmitButton(false); - setEditedPrice(0); + setEditedPrice(''); formRef.current?.resetFields(); } }; const SellingPriceChange = (data) => { + if (data === '') { + setEditedPrice(''); + setDisableSubmitButton(false); + formRef.current?.setFieldsValue({ SellPrice: '' }); + + setItemDiscountPrice(''); + itemDiscountFormRef.current?.resetFields(); + return; + } if (data) { const sellingPrice = parseFloat(props.Productdata?.SellingPrice || 0); const limit = parseFloat(props.Productdata?.DiscountLimit || 0); @@ -3580,16 +3632,21 @@ const BSBillingEditQuantity = (props) => { ); const editedProduct = { ...CartOrderDetails[editedProductIndex], - OrderQty: qty + OrderQty: qty, }; - await handleEditQuantity(editedProduct, editedProductIndex, editedProduct.OrderRate, qty); + await handleEditQuantity( + editedProduct, + editedProductIndex, + editedProduct.OrderRate, + qty + ); props.handleEditQuantityCancel(); setClearQuantity(false); }; const isKg = props?.Productdata?.Size == 1 && - ["KG", "KGS"].includes(props?.Productdata?.UomName?.toUpperCase()); + ['KG', 'KGS'].includes(props?.Productdata?.UomName?.toUpperCase()); return (
@@ -3688,18 +3745,19 @@ const BSBillingEditQuantity = (props) => { Packing - {isKg && ()} - + {isKg && ( + + )}
{RadioBtnSelection == 'Quantity' && ( @@ -3762,18 +3820,18 @@ const BSBillingEditQuantity = (props) => { )} {RadioBtnSelection == 'Price' && ( -
+
{!RadioDetails && (
{ value={editedPrice} label="Price Override" autocomplete="off" - onChange={(e) => { 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; + onChange={(e) => { + SellingPriceChange(e?.target?.value); }} - // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} + inputMode="decimal" + isOnChange={ + editedPrice !== '' && Number(editedPrice) > 0 + } />
@@ -3841,7 +3891,7 @@ const BSBillingEditQuantity = (props) => {
{ label="Reduction" fieldState={true} fieldApi={true} - // id="error2" autocomplete="off" - onChange={(e) => PriceChangefun(e)} + onChange={PriceChangefun} 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} + isOnChange={ + editedPrice !== '' && Number(editedPrice) > 0 + } /> {/* { /> */}
- {editedPrice > 0 &&
-
- {' '} - Price: {safeRound(editedPrice ? editedPrice : 0)} + {editedPrice > 0 && ( +
+
+ {' '} + Price: {safeRound(editedPrice ? editedPrice : 0)} +
-
} + )} )} -
-
- + {itemDiscount && ( +
+ - <> -
- { - onItemDiscountPercentageChange(e); - }} - /> -
-
-
- { - await validateSafeInput(value); - return Promise.resolve(); - }, - }, + <> +
+ - ItemDiscountChangefun(e)} - inputMode="decimal" - 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; - }} - /> - - -
- {itemDiscountPrice > 0 && safeRound(editedPrice) > 0 &&
-
- {' '} - {console.log(editedPrice, itemDiscountPrice, "itemDiscountPrice")} - Final Price: {safeRound(editedPrice) - (itemDiscountPrice || 0)} + fieldState={true} + defaultSelect={itemDiscountPercentageSelection} + onSelectFuntion={(e) => { + onItemDiscountPercentageChange(e); + }} + /> +
+
+
+ { + await validateSafeInput(value); + return Promise.resolve(); + }, + }, + ]} + > + + +
-
} - -
+ {Number(itemDiscountPrice) > 0 && + safeRound(editedPrice) > 0 && ( +
+
+ Final Price:{' '} + {( + Number(safeRound(editedPrice)) - + Number(itemDiscountPrice || 0) + ).toFixed(2)} +
+
+ )} + +
+ )}
- )} {RadioBtnSelection == 'Parcel' && ( <> @@ -3986,7 +4028,7 @@ const BSBillingEditQuantity = (props) => { /> )} - {(RadioBtnSelection == 'weightAmount') && isKg && ( + {RadioBtnSelection == 'weightAmount' && isKg && ( <> {
{((RadioBtnSelection == 'Price' && disableSubmitButton) || RadioBtnSelection == 'Quantity') && ( - } - > - )} + } + > + )}
diff --git a/src/Pages/Preference/PreferenceList.jsx b/src/Pages/Preference/PreferenceList.jsx index b682040..318a887 100644 --- a/src/Pages/Preference/PreferenceList.jsx +++ b/src/Pages/Preference/PreferenceList.jsx @@ -58,9 +58,16 @@ const PreferenceList = () => { const settingsList = tableValue[0]?.SettingDtlDetails ?? preferenceConfigs; const allSettingsMap = {}; - settingsList?.forEach(({ SettingIdName, SettingValue, SettingCount, SettingTime,Comments }) => { - allSettingsMap[SettingIdName?.toLowerCase()] = { value: SettingValue, count: SettingCount, time: SettingTime?.split(' ')?.[0], comments: Comments }; - }); + settingsList?.forEach( + ({ SettingIdName, SettingValue, SettingCount, SettingTime, Comments }) => { + allSettingsMap[SettingIdName?.toLowerCase()] = { + value: SettingValue, + count: SettingCount, + time: SettingTime?.split(' ')?.[0], + comments: Comments, + }; + } + ); console.log(featureaddDetails, 'featureaddDetails'); @@ -89,16 +96,35 @@ const PreferenceList = () => { wholesaleshortname: allSettingsMap['wholesaleshortname']?.comments || 'WS', billitemsorder: allSettingsMap['billitemsorder']?.value === 'Y', preorderpricechange: allSettingsMap['preorderpricechange']?.value === 'Y', - quantityrestriction: allSettingsMap['overalllimit']?.value === 'Y' || allSettingsMap['itemwiselimit']?.value === 'Y', - quantityrestrictiontype: allSettingsMap['overalllimit']?.value === 'Y' ? 'overall' : allSettingsMap['itemwiselimit']?.value === 'Y' ? 'itemwise' : 'overall', - kiosktimelimit: allSettingsMap['hours']?.value === 'Y' || allSettingsMap['minutes']?.value === 'Y', - kiosktimelimittype: allSettingsMap['hours']?.value === 'Y' ? 'hours' : allSettingsMap['minutes']?.value === 'Y' ? 'minutes' : 'minutes', - maxquantity: allSettingsMap['overalllimit']?.value === 'Y' ? allSettingsMap['overalllimit']?.count || 1 : allSettingsMap['itemwiselimit']?.value === 'Y' ? allSettingsMap['itemwiselimit']?.count || 1 : 1, + quantityrestriction: + allSettingsMap['overalllimit']?.value === 'Y' || + allSettingsMap['itemwiselimit']?.value === 'Y', + quantityrestrictiontype: + allSettingsMap['overalllimit']?.value === 'Y' + ? 'overall' + : allSettingsMap['itemwiselimit']?.value === 'Y' + ? 'itemwise' + : 'overall', + kiosktimelimit: + allSettingsMap['hours']?.value === 'Y' || + allSettingsMap['minutes']?.value === 'Y', + kiosktimelimittype: + allSettingsMap['hours']?.value === 'Y' + ? 'hours' + : allSettingsMap['minutes']?.value === 'Y' + ? 'minutes' + : 'minutes', + maxquantity: + allSettingsMap['overalllimit']?.value === 'Y' + ? allSettingsMap['overalllimit']?.count || 1 + : allSettingsMap['itemwiselimit']?.value === 'Y' + ? allSettingsMap['itemwiselimit']?.count || 1 + : 1, maxtime: allSettingsMap['hours']?.value === 'Y' - ? (allSettingsMap['hours']?.time + ? allSettingsMap['hours']?.time ? parseFloat(allSettingsMap['hours']?.time / 60) - : 0.5) + : 0.5 : allSettingsMap['minutes']?.value === 'Y' ? parseFloat(allSettingsMap['minutes']?.time || 30) : 30, @@ -118,14 +144,19 @@ const PreferenceList = () => { ), mobilea4: allSettingsMap['mobilea4']?.value === 'Y', estimateSettings: [ - ...(allSettingsMap['estimateprintheader']?.value === 'Y' ? ['estimateprintheader'] : []), - ...(allSettingsMap['estimatetitle']?.value === 'Y' ? ['estimatetitle'] : []), + ...(allSettingsMap['estimateprintheader']?.value === 'Y' + ? ['estimateprintheader'] + : []), + ...(allSettingsMap['estimatetitle']?.value === 'Y' + ? ['estimatetitle'] + : []), ], scanlayout: allSettingsMap['scanlayout']?.value === 'Y', verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y', imeidetails: allSettingsMap['imeidetails']?.value === 'Y', customisedbillnumber: allSettingsMap['customisedbillnumber']?.value === 'Y', upiqr: allSettingsMap['upiqr']?.value === 'Y', + itemdiscount: allSettingsMap['itemdiscount']?.value === 'Y', lowstockreport: allSettingsMap['lowstockreport']?.value === 'Y', weeklysalesreport: allSettingsMap['weeklysalesreport']?.value === 'Y', notificationblink: allSettingsMap['notificationblink']?.value === 'Y', @@ -245,7 +276,7 @@ const PreferenceList = () => { res?.data?.data?.map((i) => ({ SettingIdName: i.ConfigName, SettingId: i.ConfigId, - Comments: i.Comments || "", + Comments: i.Comments || '', SettingValue: 'N', })) ); @@ -305,9 +336,9 @@ const PreferenceList = () => { const handleSubmit = async () => { const values = formRef.current.getFieldsValue(); const salesMode = values.salesmode; - console.log("Sales Mode:", values.salesmode); -console.log("Retail Short Name:", values.retailshortname); -console.log("Wholesale Short Name:", values.wholesaleshortname); + console.log('Sales Mode:', values.salesmode); + console.log('Retail Short Name:', values.retailshortname); + console.log('Wholesale Short Name:', values.wholesaleshortname); const settings = settingsList || []; console.log(values, 'values'); const updatedSettings = settings.map((setting) => { @@ -325,7 +356,7 @@ console.log("Wholesale Short Name:", values.wholesaleshortname); weightasquantity: values.weightasquantity, expiredselection: values.expiredselection, 'sales mode': values?.['salesmode'], - + billitemsorder: values.billitemsorder, preorderpricechange: values.preorderpricechange, tokenonly: values.tokenonly, @@ -336,14 +367,20 @@ console.log("Wholesale Short Name:", values.wholesaleshortname); imeidetails: values.imeidetails, customisedbillnumber: values.customisedbillnumber, upiqr: values.upiqr, + itemdiscount: values.itemdiscount, lowstockreport: values.lowstockreport, weeklysalesreport: values.weeklysalesreport, notificationblink: values.notificationblink, editbill: values.editbill, - overalllimit: values.quantityrestriction && values.quantityrestrictiontype === 'overall', - itemwiselimit: values.quantityrestriction && values.quantityrestrictiontype === 'itemwise', + overalllimit: + values.quantityrestriction && + values.quantityrestrictiontype === 'overall', + itemwiselimit: + values.quantityrestriction && + values.quantityrestrictiontype === 'itemwise', hours: values.kiosktimelimit && values.kiosktimelimittype === 'hours', - minutes: values.kiosktimelimit && values.kiosktimelimittype === 'minutes', + minutes: + values.kiosktimelimit && values.kiosktimelimittype === 'minutes', }; const arrayValues = { @@ -371,38 +408,38 @@ console.log("Wholesale Short Name:", values.wholesaleshortname); ? boolValues[key] : (arrayValues[key]?.includes(key) ?? false); - return { - ConfigName: setting.SettingIdName, - SettingId: setting.SettingId, + return { + ConfigName: setting.SettingIdName, + SettingId: setting.SettingId, - Comments: - key === "retailshortname" - ? values.retailshortname || "" - : key === "wholesaleshortname" - ? values.wholesaleshortname || "" - : setting.Comments || "", + Comments: + key === 'retailshortname' + ? values.retailshortname || '' + : key === 'wholesaleshortname' + ? values.wholesaleshortname || '' + : setting.Comments || '', - SettingValue: - key === "retailshortname" || key === "wholesaleshortname" - ? salesMode - ? "Y" - : "N" - : isChecked - ? "Y" - : "N", + SettingValue: + key === 'retailshortname' || key === 'wholesaleshortname' + ? salesMode + ? 'Y' + : 'N' + : isChecked + ? 'Y' + : 'N', - SettingCount: - (key === "overalllimit" || key === "itemwiselimit") && isChecked - ? parseFloat(values.maxquantity) || null - : null, + SettingCount: + (key === 'overalllimit' || key === 'itemwiselimit') && isChecked + ? parseFloat(values.maxquantity) || null + : null, - SettingTime: - key === "hours" && isChecked - ? (parseFloat(values.maxtime) * 60).toFixed(2) + " Minutes" - : key === "minutes" && isChecked - ? parseFloat(values.maxtime).toFixed(2) + " Minutes" - : null, -}; + SettingTime: + key === 'hours' && isChecked + ? (parseFloat(values.maxtime) * 60).toFixed(2) + ' Minutes' + : key === 'minutes' && isChecked + ? parseFloat(values.maxtime).toFixed(2) + ' Minutes' + : null, + }; }); const payload = { @@ -542,95 +579,130 @@ console.log("Wholesale Short Name:", values.wholesaleshortname); 'decimal', 'Display values with 2 decimal places throughout the app?' )} - {renderCheckbox( + {renderCheckbox( 'salespageaskiosk', 'Do you want to open sales page as kiosk layout?' )} {(allSettingsMap['onlineindividualslots'] !== undefined || allSettingsMap['allow individual booking'] !== undefined || allSettingsMap['single booking only'] !== undefined) && ( - - - {allSettingsMap['allow individual booking'] !== - undefined && ( - - Allow online individual booking - - )} - {allSettingsMap['single booking only'] !== undefined && ( - - Allow single booking Only - - )} - - + + + {allSettingsMap['allow individual booking'] !== + undefined && ( + + Allow online individual booking + + )} + {allSettingsMap['single booking only'] !== undefined && ( + + Allow single booking Only + + )} + + + )} + {featureaddDetails?.find( + (item) => + item?.FeatureAddonName?.toLowerCase() === 'kiosk sales' + ) && + renderCheckbox( + 'kioskotp', + 'Enable OTP verification for Kiosk Orders?' )} {featureaddDetails?.find( - (item) => item?.FeatureAddonName?.toLowerCase() === 'kiosk sales' - ) && renderCheckbox('kioskotp', 'Enable OTP verification for Kiosk Orders?')} - {featureaddDetails?.find( - (item) => item?.FeatureAddonName?.toLowerCase() === 'kiosk sales' - ) && (allSettingsMap['hours'] !== undefined || allSettingsMap['minutes'] !== undefined) && <> - - Yes - - prev.kiosktimelimit !== curr.kiosktimelimit}> - {({ getFieldValue }) => getFieldValue('kiosktimelimit') && ( - <> - - formRef.current?.setFieldsValue({ maxtime: undefined })}> - {allSettingsMap['minutes'] !== undefined && ( - Minutes - )} - {allSettingsMap['hours'] !== undefined && ( - Hours - )} - - - - - prev.kiosktimelimittype !== curr.kiosktimelimittype - } - > - {({ getFieldValue }) => { - const type = getFieldValue('kiosktimelimittype'); - - const isHours = type === 'hours'; - - return ( - + item?.FeatureAddonName?.toLowerCase() === 'kiosk sales' + ) && + (allSettingsMap['hours'] !== undefined || + allSettingsMap['minutes'] !== undefined) && ( + <> + + Yes + + + prev.kiosktimelimit !== curr.kiosktimelimit + } + > + {({ getFieldValue }) => + getFieldValue('kiosktimelimit') && ( + <> + + + formRef.current?.setFieldsValue({ + maxtime: undefined, + }) + } > - - - ); - }} - - - )} - - } + {allSettingsMap['minutes'] !== undefined && ( + Minutes + )} + {allSettingsMap['hours'] !== undefined && ( + Hours + )} + + + + + prev.kiosktimelimittype !== + curr.kiosktimelimittype + } + > + {({ getFieldValue }) => { + const type = + getFieldValue('kiosktimelimittype'); + + const isHours = type === 'hours'; + + return ( + + + + ); + }} + + + ) + } + + + )}
@@ -662,23 +734,23 @@ console.log("Wholesale Short Name:", values.wholesaleshortname); {(allSettingsMap['onbilltime'] !== undefined || allSettingsMap['1daybefore'] !== undefined || allSettingsMap['1hourbefore'] !== undefined) && ( - - - {allSettingsMap['onbilltime'] !== undefined && ( - On Bill Time - )} - {allSettingsMap['1daybefore'] !== undefined && ( - 1 Day Before - )} - {allSettingsMap['1hourbefore'] !== undefined && ( - 1 Hour Before - )} - - - )} + + + {allSettingsMap['onbilltime'] !== undefined && ( + On Bill Time + )} + {allSettingsMap['1daybefore'] !== undefined && ( + 1 Day Before + )} + {allSettingsMap['1hourbefore'] !== undefined && ( + 1 Hour Before + )} + + + )}
- - {allSettingsMap['parking'] !== undefined && ( - Parking - )} - {allSettingsMap['offer'] !== undefined && ( - Offer - )} - - - )} + + + {allSettingsMap['parking'] !== undefined && ( + Parking + )} + {allSettingsMap['offer'] !== undefined && ( + Offer + )} + + + )} {((allSettingsMap['dinein'] !== undefined && dinePreference) || allSettingsMap['estimation'] !== undefined) && ( - - - {allSettingsMap['dinein'] !== undefined && - dinePreference && ( - Dine-In - )} - {allSettingsMap['estimation'] !== undefined && ( - Estimation + + + {allSettingsMap['dinein'] !== undefined && + dinePreference && ( + Dine-In )} - - - )} + {allSettingsMap['estimation'] !== undefined && ( + Estimation + )} + + + )} {renderCheckbox('stockselection', 'Enable stock selection?')} {renderCheckbox('weightasquantity', 'Use Weight as Quantity?')} {renderCheckbox('expiredselection', 'Show product expiry date?')} {/* {renderCheckbox('sales mode', 'Retail or Wholesale mode?')} */} - {(allSettingsMap['sales mode'] !== undefined ) && ( + {allSettingsMap['sales mode'] !== undefined && ( <> - Yes - )} - prev.salesmode !== curr.salesmode} - > - {({ getFieldValue }) => - getFieldValue('salesmode') && ( - <> - - - + )} + prev.salesmode !== curr.salesmode} + > + {({ getFieldValue }) => + getFieldValue('salesmode') && ( + <> + + + - - - - - ) - } - + + + + + ) + } + {renderCheckbox( 'billitemsorder', 'Show selected items first in Order Summary?' @@ -809,40 +888,77 @@ console.log("Wholesale Short Name:", values.wholesaleshortname); )} {renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')} {renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')} + {renderCheckbox( + 'itemdiscount', + 'Do you want to show the Item Discount in Price OverRide?' + )} {/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */} - {(allSettingsMap['overalllimit'] !== undefined || allSettingsMap['itemwiselimit'] !== undefined) && ( + {(allSettingsMap['overalllimit'] !== undefined || + allSettingsMap['itemwiselimit'] !== undefined) && ( <> - + Yes - prev.quantityrestriction !== curr.quantityrestriction}> - {({ getFieldValue }) => getFieldValue('quantityrestriction') && ( - <> - - formRef.current?.setFieldsValue({ maxquantity: undefined })}> - {allSettingsMap['overalllimit'] !== undefined && ( - Overall Order Quantity - )} - {allSettingsMap['itemwiselimit'] !== undefined && ( - Item-wise Quantity - )} - - + + prev.quantityrestriction !== curr.quantityrestriction + } + > + {({ getFieldValue }) => + getFieldValue('quantityrestriction') && ( + <> + + + formRef.current?.setFieldsValue({ + maxquantity: undefined, + }) + } + > + {allSettingsMap['overalllimit'] !== undefined && ( + + Overall Order Quantity + + )} + {allSettingsMap['itemwiselimit'] !== + undefined && ( + + Item-wise Quantity + + )} + + - - - - - )} + + + + + ) + } )} @@ -868,46 +984,46 @@ console.log("Wholesale Short Name:", values.wholesaleshortname); {['whatsapp', 'sms', 'email'].some( (k) => allSettingsMap[k] !== undefined ) && ( - <> - - - Print Bill - Send PDF - - + <> + + + Print Bill + Send PDF + + - - prev.billOption !== curr.billOption - } - > - {({ getFieldValue }) => - getFieldValue('billOption') === 'pdf' && ( - - - {allSettingsMap['whatsapp'] !== undefined && ( - WhatsApp - )} - {allSettingsMap['email'] !== undefined && ( - Email - )} - {allSettingsMap['sms'] !== undefined && ( - SMS - )} - - - ) - } - - - )} + + prev.billOption !== curr.billOption + } + > + {({ getFieldValue }) => + getFieldValue('billOption') === 'pdf' && ( + + + {allSettingsMap['whatsapp'] !== undefined && ( + WhatsApp + )} + {allSettingsMap['email'] !== undefined && ( + Email + )} + {allSettingsMap['sms'] !== undefined && ( + SMS + )} + + + ) + } + + + )} {renderCheckbox( 'tokenonly', @@ -937,25 +1053,25 @@ console.log("Wholesale Short Name:", values.wholesaleshortname); {['printuom', 'printlogo', 'printgreetings'].some( (k) => allSettingsMap[k] !== undefined ) && ( - - - {allSettingsMap['printuom'] !== undefined && ( - - Unit of Measure (UOM) - - )} - {allSettingsMap['printlogo'] !== undefined && ( - Branch Logo - )} - {allSettingsMap['printgreetings'] !== undefined && ( - Greetings - )} - - - )} + + + {allSettingsMap['printuom'] !== undefined && ( + + Unit of Measure (UOM) + + )} + {allSettingsMap['printlogo'] !== undefined && ( + Branch Logo + )} + {allSettingsMap['printgreetings'] !== undefined && ( + Greetings + )} + + + )} {renderCheckbox( 'mobilea4', @@ -963,20 +1079,24 @@ console.log("Wholesale Short Name:", values.wholesaleshortname); )} {(allSettingsMap['estimateprintheader'] !== undefined || allSettingsMap['estimatetitle'] !== undefined) && ( - - - {allSettingsMap['estimateprintheader'] !== undefined && ( - Show shop header (Name, Address, GST) - )} - {allSettingsMap['estimatetitle'] !== undefined && ( - Show “Estimate (R/W)” title - )} - - - )} + + + {allSettingsMap['estimateprintheader'] !== undefined && ( + + Show shop header (Name, Address, GST) + + )} + {allSettingsMap['estimatetitle'] !== undefined && ( + + Show “Estimate (R/W)” title + + )} + + + )}