kisok quantity constrain
This commit is contained in:
parent
70444d3028
commit
608aa917b3
|
|
@ -41,6 +41,7 @@ import {
|
||||||
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
|
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import WeightCalculatePrice from './WeightCalculatePrice.jsx';
|
import WeightCalculatePrice from './WeightCalculatePrice.jsx';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
|
||||||
|
|
||||||
const BSBillingEditQuantity = (props) => {
|
const BSBillingEditQuantity = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
@ -49,7 +50,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const priceChangeInputRef = useRef(null);
|
const priceChangeInputRef = useRef(null);
|
||||||
const reductionInputRef = useRef(null);
|
const reductionInputRef = useRef(null);
|
||||||
|
|
||||||
const { setIndex = () => {} } = props;
|
const { setIndex = () => { } } = props;
|
||||||
|
|
||||||
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
||||||
const SessionData = useSelector(StoredSessionData);
|
const SessionData = useSelector(StoredSessionData);
|
||||||
|
|
@ -64,6 +65,14 @@ const BSBillingEditQuantity = (props) => {
|
||||||
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
|
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
|
||||||
shallowEqual
|
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 preferenceOffer =
|
const preferenceOffer =
|
||||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
(item) => item.SettingIdName === 'Offer'
|
(item) => item.SettingIdName === 'Offer'
|
||||||
|
|
@ -103,23 +112,23 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const OrderType = useSelector(GlobalOrderType);
|
const OrderType = useSelector(GlobalOrderType);
|
||||||
const [BillOrderPre, setBillOrderPre] = useState(null);
|
const [BillOrderPre, setBillOrderPre] = useState(null);
|
||||||
const SHORTKEY_TO_RADIO = {
|
const SHORTKEY_TO_RADIO = {
|
||||||
price: 'Price',
|
price: 'Price',
|
||||||
quantity: 'qty',
|
quantity: 'qty',
|
||||||
Parcel: 'Parcel',
|
Parcel: 'Parcel',
|
||||||
weightAmount: 'weightAmount'
|
weightAmount: 'weightAmount'
|
||||||
};
|
};
|
||||||
const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
|
if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
|
||||||
return SHORTKEY_TO_RADIO[props.shortKeyMethod];
|
return SHORTKEY_TO_RADIO[props.shortKeyMethod];
|
||||||
}
|
}
|
||||||
if (ItemData?.ScaleType !== 'weight') {
|
if (ItemData?.ScaleType !== 'weight') {
|
||||||
return 'Quantity';
|
return 'Quantity';
|
||||||
}
|
}
|
||||||
if (PriceChangeaccess) {
|
if (PriceChangeaccess) {
|
||||||
return 'Price';
|
return 'Price';
|
||||||
}
|
}
|
||||||
return 'Parcel';
|
return 'Parcel';
|
||||||
});
|
});
|
||||||
// const [RadioBtnSelection, setRadioBtnSelection] = useState(
|
// const [RadioBtnSelection, setRadioBtnSelection] = useState(
|
||||||
// props?.shortKeyMethod == 'price'
|
// props?.shortKeyMethod == 'price'
|
||||||
// ? 'Price'
|
// ? 'Price'
|
||||||
|
|
@ -334,6 +343,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const calculateOverAllQty = (item, filterItems) => {
|
const calculateOverAllQty = (item, filterItems) => {
|
||||||
|
|
||||||
if (!item) return 0;
|
if (!item) return 0;
|
||||||
|
|
||||||
const totalUsedQty =
|
const totalUsedQty =
|
||||||
|
|
@ -435,6 +445,18 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
(e) => e?.localId == localId
|
(e) => e?.localId == localId
|
||||||
);
|
);
|
||||||
const editedProduct = CartOrderDetails[editedProductIndex];
|
const editedProduct = CartOrderDetails[editedProductIndex];
|
||||||
|
|
||||||
|
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}`);
|
||||||
|
setMessageType('warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const productBookingType = editedProduct?.BookingTypeName;
|
const productBookingType = editedProduct?.BookingTypeName;
|
||||||
const isItemInCart = CartOrderDetails?.find(
|
const isItemInCart = CartOrderDetails?.find(
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
|
|
@ -728,7 +750,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
return (
|
return (
|
||||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
cartItem?.OfferMessage?.[0]?.OfferId ===
|
cartItem?.OfferMessage?.[0]?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||||
cartItem?.BookingTypeName !== editedProduct?.BookingTypeName
|
cartItem?.BookingTypeName !== editedProduct?.BookingTypeName
|
||||||
);
|
);
|
||||||
|
|
@ -862,7 +884,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||||
cartItem?.BookingTypeName !==
|
cartItem?.BookingTypeName !==
|
||||||
editedProduct?.BookingTypeName &&
|
editedProduct?.BookingTypeName &&
|
||||||
!cartItem?.OfferMode &&
|
!cartItem?.OfferMode &&
|
||||||
cartItem?.Offer === 0
|
cartItem?.Offer === 0
|
||||||
);
|
);
|
||||||
|
|
@ -876,7 +898,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||||
cartItem?.BookingTypeName !==
|
cartItem?.BookingTypeName !==
|
||||||
editedProduct?.BookingTypeName &&
|
editedProduct?.BookingTypeName &&
|
||||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||||
cartItem?.Offer > 0
|
cartItem?.Offer > 0
|
||||||
);
|
);
|
||||||
|
|
@ -1009,7 +1031,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
)
|
)
|
||||||
) &&
|
) &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
product?.OfferMode === editedProduct?.OfferMode
|
product?.OfferMode === editedProduct?.OfferMode
|
||||||
) {
|
) {
|
||||||
const freeQty =
|
const freeQty =
|
||||||
|
|
@ -1042,7 +1064,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -1125,7 +1147,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
)
|
)
|
||||||
) &&
|
) &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
product?.OfferMode === editedProduct?.OfferMode
|
product?.OfferMode === editedProduct?.OfferMode
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
|
|
@ -1155,7 +1177,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -1342,7 +1364,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -1444,7 +1466,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -1598,7 +1620,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
) &&
|
) &&
|
||||||
cartItem?.Offer &&
|
cartItem?.Offer &&
|
||||||
isFreeProductApplicable?.OfferId ===
|
isFreeProductApplicable?.OfferId ===
|
||||||
cartItem?.OfferMessage?.[0]?.OfferId
|
cartItem?.OfferMessage?.[0]?.OfferId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -1887,11 +1909,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode)
|
otherBookingTypeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -1925,11 +1947,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode);
|
otherBookingTypeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -2070,7 +2092,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
cartItem?.Offer > 0 &&
|
cartItem?.Offer > 0 &&
|
||||||
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
|
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
|
||||||
isFreeProductApplicable?.OfferId ===
|
isFreeProductApplicable?.OfferId ===
|
||||||
cartItem?.OfferMessage?.[0]?.OfferId
|
cartItem?.OfferMessage?.[0]?.OfferId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -2173,11 +2195,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2248,12 +2270,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode)
|
otherBookingTypeFreeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -2287,13 +2309,13 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId ||
|
?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode);
|
otherBookingTypeFreeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -2375,11 +2397,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
sameBookingTypeProduct.InwardDtlId &&
|
sameBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
sameBookingTypeProduct.BookingTypeName &&
|
sameBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
sameBookingTypeProduct.OrderRate &&
|
sameBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2432,11 +2454,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
sameBookingTypeProduct.InwardDtlId &&
|
sameBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
sameBookingTypeProduct.BookingTypeName &&
|
sameBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
sameBookingTypeProduct.OrderRate &&
|
sameBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2525,11 +2547,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem?.BookingTypeName ===
|
cartItem?.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem?.OfferMode &&
|
cartItem?.OfferMode &&
|
||||||
cartItem?.Offer > 0
|
cartItem?.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2558,11 +2580,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2592,11 +2614,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2695,12 +2717,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode)
|
otherBookingTypeFreeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -2734,12 +2756,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode);
|
otherBookingTypeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -2818,11 +2840,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
sameBookingTypeProduct.InwardDtlId &&
|
sameBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
sameBookingTypeProduct.BookingTypeName &&
|
sameBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
sameBookingTypeProduct.OrderRate &&
|
sameBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2881,11 +2903,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2957,12 +2979,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode)
|
otherBookingTypeFreeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -2996,12 +3018,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode);
|
otherBookingTypeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -3156,17 +3178,17 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
changeOrderCardDetails(
|
changeOrderCardDetails(
|
||||||
CartOrderDetails?.map((i) =>
|
CartOrderDetails?.map((i) =>
|
||||||
i?.InwardDtlId == updatedProduct?.InwardDtlId &&
|
i?.InwardDtlId == updatedProduct?.InwardDtlId &&
|
||||||
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
||||||
i?.localId === updatedProduct?.localId
|
i?.localId === updatedProduct?.localId
|
||||||
? {
|
? {
|
||||||
...updatedProduct,
|
...updatedProduct,
|
||||||
Offer: 0,
|
Offer: 0,
|
||||||
OfferType:
|
OfferType:
|
||||||
updatedProduct?.Type === 'C'
|
updatedProduct?.Type === 'C'
|
||||||
? updatedProduct?.OfferType
|
? updatedProduct?.OfferType
|
||||||
: null,
|
: null,
|
||||||
OfferMessage: null,
|
OfferMessage: null,
|
||||||
}
|
}
|
||||||
: i
|
: i
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -3202,10 +3224,10 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
((c?.OfferModeType && c?.OfferMode === 'B'
|
((c?.OfferModeType && c?.OfferMode === 'B'
|
||||||
? true
|
? true
|
||||||
: c?.OfferMode !== 'B') &&
|
: c?.OfferMode !== 'B') &&
|
||||||
c?.OfferMode !== 'P' &&
|
c?.OfferMode !== 'P' &&
|
||||||
c?.OfferMode !== 'C' &&
|
c?.OfferMode !== 'C' &&
|
||||||
c?.OfferMode !== 'O' &&
|
c?.OfferMode !== 'O' &&
|
||||||
c?.OfferMode !== 'L'
|
c?.OfferMode !== 'L'
|
||||||
? true
|
? true
|
||||||
: c?.Offer === 0);
|
: c?.Offer === 0);
|
||||||
|
|
||||||
|
|
@ -3397,8 +3419,8 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
// parseFloat(enteredDiscount) < parseFloat(sellingPrice) ||
|
// parseFloat(enteredDiscount) < parseFloat(sellingPrice) ||
|
||||||
// parseFloat(enteredDiscount) === parseFloat(sellingPrice)
|
// parseFloat(enteredDiscount) === parseFloat(sellingPrice)
|
||||||
// ) {
|
// ) {
|
||||||
setEditedPrice(enteredDiscount);
|
setEditedPrice(enteredDiscount);
|
||||||
setDisableSubmitButton(true);
|
setDisableSubmitButton(true);
|
||||||
// } else {
|
// } else {
|
||||||
// setMessageType('error');
|
// setMessageType('error');
|
||||||
// setMessageData('Please Give less than value for sell price');
|
// setMessageData('Please Give less than value for sell price');
|
||||||
|
|
@ -3467,8 +3489,8 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
setClearQuantity(false);
|
setClearQuantity(false);
|
||||||
};
|
};
|
||||||
const isKg =
|
const isKg =
|
||||||
props?.Productdata?.Size == 1 &&
|
props?.Productdata?.Size == 1 &&
|
||||||
["KG", "KGS"].includes(props?.Productdata?.UomName?.toUpperCase());
|
["KG", "KGS"].includes(props?.Productdata?.UomName?.toUpperCase());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="BSBilling-EditQuantity-Modal">
|
<div className="BSBilling-EditQuantity-Modal">
|
||||||
|
|
@ -3688,7 +3710,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
? `${parts[0]}.${parts.slice(1).join('')}`
|
? `${parts[0]}.${parts.slice(1).join('')}`
|
||||||
: cleanedValue;
|
: cleanedValue;
|
||||||
}}
|
}}
|
||||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
|
@ -3751,7 +3773,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
? `${parts[0]}.${parts.slice(1).join('')}`
|
? `${parts[0]}.${parts.slice(1).join('')}`
|
||||||
: cleanedValue;
|
: cleanedValue;
|
||||||
}}
|
}}
|
||||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{/* <input type="text"
|
{/* <input type="text"
|
||||||
|
|
@ -3796,14 +3818,14 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
||||||
{((RadioBtnSelection == 'Price' && disableSubmitButton) ||
|
{((RadioBtnSelection == 'Price' && disableSubmitButton) ||
|
||||||
RadioBtnSelection == 'Quantity') && (
|
RadioBtnSelection == 'Quantity') && (
|
||||||
<Buttons
|
<Buttons
|
||||||
buttonText="Submit"
|
buttonText="Submit"
|
||||||
color="901D77"
|
color="901D77"
|
||||||
htmlType
|
htmlType
|
||||||
// handleSubmit={AddProductQuantity}
|
// handleSubmit={AddProductQuantity}
|
||||||
icon={<ArrowRightOutlined />}
|
icon={<ArrowRightOutlined />}
|
||||||
></Buttons>
|
></Buttons>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import {
|
||||||
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
|
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import './ComboBillTableEdit.scss';
|
import './ComboBillTableEdit.scss';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
|
||||||
|
|
||||||
const ComboEditQtyAndRate = (props) => {
|
const ComboEditQtyAndRate = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
@ -37,9 +38,9 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
const quantityInputRef = useRef(null);
|
const quantityInputRef = useRef(null);
|
||||||
const priceChangeInputRef = useRef(null);
|
const priceChangeInputRef = useRef(null);
|
||||||
const {
|
const {
|
||||||
setIndex = () => {},
|
setIndex = () => { },
|
||||||
setEditQtyCombo = () => {},
|
setEditQtyCombo = () => { },
|
||||||
setEditRateCombo = () => {},
|
setEditRateCombo = () => { },
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
||||||
|
|
@ -51,10 +52,19 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
const applyOffer = useApplyOfferto_CardDetail();
|
const applyOffer = useApplyOfferto_CardDetail();
|
||||||
const preferenceDatas = useSelector(PreferenceData);
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
const EmpAccessDetail = useSelector(GlobalEmpAccessDetail);
|
const EmpAccessDetail = useSelector(GlobalEmpAccessDetail);
|
||||||
|
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 OverAllproductBasedOfferDatas = useSelector(
|
const OverAllproductBasedOfferDatas = useSelector(
|
||||||
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
|
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
|
||||||
shallowEqual
|
shallowEqual
|
||||||
);
|
);
|
||||||
|
console.log(overAllLimitPreferenece, "itemWiseLimitPreferenece")
|
||||||
const preferenceOffer =
|
const preferenceOffer =
|
||||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
(item) => item.SettingIdName === 'Offer'
|
(item) => item.SettingIdName === 'Offer'
|
||||||
|
|
@ -251,7 +261,16 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
item?.SinglePc === 'Y' ? item?.OverAllPcs : item?.BalanceQty;
|
item?.SinglePc === 'Y' ? item?.OverAllPcs : item?.BalanceQty;
|
||||||
return availableQty - totalUsedQty;
|
return availableQty - totalUsedQty;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const quantityValidation = async (val) => {
|
||||||
|
|
||||||
|
setQuantity(val)
|
||||||
|
|
||||||
|
}
|
||||||
const AddProductQuantity = async () => {
|
const AddProductQuantity = async () => {
|
||||||
|
// debugger
|
||||||
|
|
||||||
|
|
||||||
let newPrice = editedPrice > 0 ? editedPrice : props.Productdata.OrderRate;
|
let newPrice = editedPrice > 0 ? editedPrice : props.Productdata.OrderRate;
|
||||||
await dispatch(changeHoldOrderDtl(false));
|
await dispatch(changeHoldOrderDtl(false));
|
||||||
await dispatch(changePreviousOrderLength(CartOrderDetails?.length));
|
await dispatch(changePreviousOrderLength(CartOrderDetails?.length));
|
||||||
|
|
@ -312,6 +331,20 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
let editedProductIndex = CartOrderDetails?.findIndex(
|
let editedProductIndex = CartOrderDetails?.findIndex(
|
||||||
(e) => e?.localId == localId
|
(e) => e?.localId == localId
|
||||||
);
|
);
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
let removeProds1 = CartOrderDetails?.find((_, index) => index == editedProductIndex)
|
||||||
|
let removeProds = CartOrderDetails?.filter((_, index) => index !== editedProductIndex)
|
||||||
|
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(removeProds);
|
||||||
|
if ((calculatedOverAllQty + editedQty) > maxQtyLimit) {
|
||||||
|
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||||
|
setMessageType('warning');
|
||||||
|
setQuantity(removeProds1?.OrderQty || 1)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const editedProduct = CartOrderDetails[editedProductIndex];
|
const editedProduct = CartOrderDetails[editedProductIndex];
|
||||||
const productBookingType = editedProduct?.BookingTypeName;
|
const productBookingType = editedProduct?.BookingTypeName;
|
||||||
const isItemInCart = CartOrderDetails?.find(
|
const isItemInCart = CartOrderDetails?.find(
|
||||||
|
|
@ -591,7 +624,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
return (
|
return (
|
||||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
cartItem?.OfferMessage?.[0]?.OfferId ===
|
cartItem?.OfferMessage?.[0]?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||||
cartItem?.BookingTypeName !== editedProduct?.BookingTypeName
|
cartItem?.BookingTypeName !== editedProduct?.BookingTypeName
|
||||||
);
|
);
|
||||||
|
|
@ -725,7 +758,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||||
cartItem?.BookingTypeName !==
|
cartItem?.BookingTypeName !==
|
||||||
editedProduct?.BookingTypeName &&
|
editedProduct?.BookingTypeName &&
|
||||||
!cartItem?.OfferMode &&
|
!cartItem?.OfferMode &&
|
||||||
cartItem?.Offer === 0
|
cartItem?.Offer === 0
|
||||||
);
|
);
|
||||||
|
|
@ -739,7 +772,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||||
cartItem?.BookingTypeName !==
|
cartItem?.BookingTypeName !==
|
||||||
editedProduct?.BookingTypeName &&
|
editedProduct?.BookingTypeName &&
|
||||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||||
cartItem?.Offer > 0
|
cartItem?.Offer > 0
|
||||||
);
|
);
|
||||||
|
|
@ -872,7 +905,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
)
|
)
|
||||||
) &&
|
) &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
product?.OfferMode === editedProduct?.OfferMode
|
product?.OfferMode === editedProduct?.OfferMode
|
||||||
) {
|
) {
|
||||||
const freeQty =
|
const freeQty =
|
||||||
|
|
@ -905,7 +938,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -984,7 +1017,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
)
|
)
|
||||||
) &&
|
) &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
product?.OfferMode === editedProduct?.OfferMode
|
product?.OfferMode === editedProduct?.OfferMode
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
|
|
@ -1014,7 +1047,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -1201,7 +1234,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -1303,7 +1336,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
|
|
@ -1457,7 +1490,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
) &&
|
) &&
|
||||||
cartItem?.Offer &&
|
cartItem?.Offer &&
|
||||||
isFreeProductApplicable?.OfferId ===
|
isFreeProductApplicable?.OfferId ===
|
||||||
cartItem?.OfferMessage?.[0]?.OfferId
|
cartItem?.OfferMessage?.[0]?.OfferId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -1746,11 +1779,11 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode)
|
otherBookingTypeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -1784,11 +1817,11 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode);
|
otherBookingTypeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -1929,7 +1962,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
cartItem?.Offer > 0 &&
|
cartItem?.Offer > 0 &&
|
||||||
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
|
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
|
||||||
isFreeProductApplicable?.OfferId ===
|
isFreeProductApplicable?.OfferId ===
|
||||||
cartItem?.OfferMessage?.[0]?.OfferId
|
cartItem?.OfferMessage?.[0]?.OfferId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
@ -2032,11 +2065,11 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2107,12 +2140,12 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode)
|
otherBookingTypeFreeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -2146,13 +2179,13 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId ||
|
?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode);
|
otherBookingTypeFreeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -2234,11 +2267,11 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
sameBookingTypeProduct.InwardDtlId &&
|
sameBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
sameBookingTypeProduct.BookingTypeName &&
|
sameBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
sameBookingTypeProduct.OrderRate &&
|
sameBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2291,11 +2324,11 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
sameBookingTypeProduct.InwardDtlId &&
|
sameBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
sameBookingTypeProduct.BookingTypeName &&
|
sameBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
sameBookingTypeProduct.OrderRate &&
|
sameBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2384,11 +2417,11 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem?.BookingTypeName ===
|
cartItem?.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem?.OfferMode &&
|
cartItem?.OfferMode &&
|
||||||
cartItem?.Offer > 0
|
cartItem?.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2417,11 +2450,11 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2451,11 +2484,11 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2554,12 +2587,12 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode)
|
otherBookingTypeFreeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -2593,12 +2626,12 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode);
|
otherBookingTypeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -2677,11 +2710,11 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
sameBookingTypeProduct.InwardDtlId &&
|
sameBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
sameBookingTypeProduct.BookingTypeName &&
|
sameBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
sameBookingTypeProduct.OrderRate &&
|
sameBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2740,11 +2773,11 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
if (
|
if (
|
||||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||||
cartItem.InwardDtlId ===
|
cartItem.InwardDtlId ===
|
||||||
otherBookingTypeProduct.InwardDtlId &&
|
otherBookingTypeProduct.InwardDtlId &&
|
||||||
cartItem.BookingTypeName ===
|
cartItem.BookingTypeName ===
|
||||||
otherBookingTypeProduct.BookingTypeName &&
|
otherBookingTypeProduct.BookingTypeName &&
|
||||||
cartItem.OrderRate ===
|
cartItem.OrderRate ===
|
||||||
otherBookingTypeProduct.OrderRate &&
|
otherBookingTypeProduct.OrderRate &&
|
||||||
cartItem.OfferMode &&
|
cartItem.OfferMode &&
|
||||||
cartItem.Offer > 0
|
cartItem.Offer > 0
|
||||||
) {
|
) {
|
||||||
|
|
@ -2816,12 +2849,12 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
product?.ProdId === editedProduct?.ProdId &&
|
product?.ProdId === editedProduct?.ProdId &&
|
||||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||||
product?.OfferId ===
|
product?.OfferId ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
product?.OfferMode ===
|
product?.OfferMode ===
|
||||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||||
otherBookingTypeFreeProduct?.OfferMode)
|
otherBookingTypeFreeProduct?.OfferMode)
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
...product,
|
...product,
|
||||||
|
|
@ -2855,12 +2888,12 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
// Also check main offer conditions
|
// Also check main offer conditions
|
||||||
const isMatchingOffer =
|
const isMatchingOffer =
|
||||||
offerProduct?.OfferId ===
|
offerProduct?.OfferId ===
|
||||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||||
?.OfferId) &&
|
?.OfferId) &&
|
||||||
offerProduct?.OfferMode ===
|
offerProduct?.OfferMode ===
|
||||||
(sameBookingTypeProduct?.OfferMode ||
|
(sameBookingTypeProduct?.OfferMode ||
|
||||||
otherBookingTypeProduct?.OfferMode);
|
otherBookingTypeProduct?.OfferMode);
|
||||||
|
|
||||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||||
// Get loyalty points from the matching free product
|
// Get loyalty points from the matching free product
|
||||||
|
|
@ -3014,17 +3047,17 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
changeOrderCardDetails(
|
changeOrderCardDetails(
|
||||||
CartOrderDetails?.map((i) =>
|
CartOrderDetails?.map((i) =>
|
||||||
i?.InwardDtlId == updatedProduct?.InwardDtlId &&
|
i?.InwardDtlId == updatedProduct?.InwardDtlId &&
|
||||||
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
||||||
i?.localId === updatedProduct?.localId
|
i?.localId === updatedProduct?.localId
|
||||||
? {
|
? {
|
||||||
...updatedProduct,
|
...updatedProduct,
|
||||||
Offer: 0,
|
Offer: 0,
|
||||||
OfferType:
|
OfferType:
|
||||||
updatedProduct?.Type === 'C'
|
updatedProduct?.Type === 'C'
|
||||||
? updatedProduct?.OfferType
|
? updatedProduct?.OfferType
|
||||||
: null,
|
: null,
|
||||||
OfferMessage: null,
|
OfferMessage: null,
|
||||||
}
|
}
|
||||||
: i
|
: i
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -3060,10 +3093,10 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
((c?.OfferModeType && c?.OfferMode === 'B'
|
((c?.OfferModeType && c?.OfferMode === 'B'
|
||||||
? true
|
? true
|
||||||
: c?.OfferMode !== 'B') &&
|
: c?.OfferMode !== 'B') &&
|
||||||
c?.OfferMode !== 'P' &&
|
c?.OfferMode !== 'P' &&
|
||||||
c?.OfferMode !== 'C' &&
|
c?.OfferMode !== 'C' &&
|
||||||
c?.OfferMode !== 'O' &&
|
c?.OfferMode !== 'O' &&
|
||||||
c?.OfferMode !== 'L'
|
c?.OfferMode !== 'L'
|
||||||
? true
|
? true
|
||||||
: c?.Offer === 0);
|
: c?.Offer === 0);
|
||||||
|
|
||||||
|
|
@ -3227,7 +3260,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
type="number"
|
type="number"
|
||||||
value={Quantity}
|
value={Quantity}
|
||||||
min="0"
|
min="0"
|
||||||
onChange={(e) => setQuantity(e.target.value)}
|
onChange={(e) => quantityValidation(e.target.value)}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
if (Quantity && Quantity.trim() !== '') {
|
if (Quantity && Quantity.trim() !== '') {
|
||||||
AddProductQuantity();
|
AddProductQuantity();
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,5 @@
|
||||||
|
export const calculateOverAllQtyLimit = (orders) => {
|
||||||
|
return orders?.reduce((acc, cartItem) => {
|
||||||
|
return acc + (cartItem?.OrderQty || 0);
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue