diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx
index 4a3942d..d309960 100644
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx
+++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.jsx
@@ -41,6 +41,7 @@ import {
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
import { v4 as uuidv4 } from 'uuid';
import WeightCalculatePrice from './WeightCalculatePrice.jsx';
+import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
const BSBillingEditQuantity = (props) => {
const dispatch = useDispatch();
@@ -49,7 +50,7 @@ const BSBillingEditQuantity = (props) => {
const priceChangeInputRef = useRef(null);
const reductionInputRef = useRef(null);
- const { setIndex = () => {} } = props;
+ const { setIndex = () => { } } = props;
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
const SessionData = useSelector(StoredSessionData);
@@ -64,6 +65,14 @@ const BSBillingEditQuantity = (props) => {
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
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 =
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
(item) => item.SettingIdName === 'Offer'
@@ -103,23 +112,23 @@ const BSBillingEditQuantity = (props) => {
const OrderType = useSelector(GlobalOrderType);
const [BillOrderPre, setBillOrderPre] = useState(null);
const SHORTKEY_TO_RADIO = {
- price: 'Price',
- quantity: 'qty',
- Parcel: 'Parcel',
- weightAmount: 'weightAmount'
-};
-const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
- if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
- return SHORTKEY_TO_RADIO[props.shortKeyMethod];
- }
- if (ItemData?.ScaleType !== 'weight') {
- return 'Quantity';
- }
- if (PriceChangeaccess) {
- return 'Price';
- }
- return 'Parcel';
-});
+ price: 'Price',
+ quantity: 'qty',
+ Parcel: 'Parcel',
+ weightAmount: 'weightAmount'
+ };
+ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
+ if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
+ return SHORTKEY_TO_RADIO[props.shortKeyMethod];
+ }
+ if (ItemData?.ScaleType !== 'weight') {
+ return 'Quantity';
+ }
+ if (PriceChangeaccess) {
+ return 'Price';
+ }
+ return 'Parcel';
+ });
// const [RadioBtnSelection, setRadioBtnSelection] = useState(
// props?.shortKeyMethod == 'price'
// ? 'Price'
@@ -334,6 +343,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
};
const calculateOverAllQty = (item, filterItems) => {
+
if (!item) return 0;
const totalUsedQty =
@@ -435,6 +445,18 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
(e) => e?.localId == localId
);
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 isItemInCart = CartOrderDetails?.find(
(cartItem) =>
@@ -728,7 +750,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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
);
@@ -862,7 +884,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OrderRate === editedProduct?.OrderRate &&
cartItem?.BookingTypeName !==
- editedProduct?.BookingTypeName &&
+ editedProduct?.BookingTypeName &&
!cartItem?.OfferMode &&
cartItem?.Offer === 0
);
@@ -876,7 +898,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OrderRate === editedProduct?.OrderRate &&
cartItem?.BookingTypeName !==
- editedProduct?.BookingTypeName &&
+ editedProduct?.BookingTypeName &&
cartItem?.OfferMode === editedProduct?.OfferMode &&
cartItem?.Offer > 0
);
@@ -1009,7 +1031,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
)
) &&
product?.OfferId ===
- editedProduct?.OfferMessage?.[0]?.OfferId &&
+ editedProduct?.OfferMessage?.[0]?.OfferId &&
product?.OfferMode === editedProduct?.OfferMode
) {
const freeQty =
@@ -1042,7 +1064,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
- editedProduct?.OfferMessage?.[0]?.OfferId &&
+ editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) {
@@ -1125,7 +1147,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
)
) &&
product?.OfferId ===
- editedProduct?.OfferMessage?.[0]?.OfferId &&
+ editedProduct?.OfferMessage?.[0]?.OfferId &&
product?.OfferMode === editedProduct?.OfferMode
) {
return {
@@ -1155,7 +1177,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
- editedProduct?.OfferMessage?.[0]?.OfferId &&
+ editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) {
@@ -1342,7 +1364,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
- editedProduct?.OfferMessage?.[0]?.OfferId &&
+ editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) {
@@ -1444,7 +1466,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
// Also check main offer conditions
const isMatchingOffer =
offerProduct?.OfferId ===
- editedProduct?.OfferMessage?.[0]?.OfferId &&
+ editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) {
@@ -1598,7 +1620,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
) &&
cartItem?.Offer &&
isFreeProductApplicable?.OfferId ===
- cartItem?.OfferMessage?.[0]?.OfferId
+ cartItem?.OfferMessage?.[0]?.OfferId
);
}
);
@@ -1887,11 +1909,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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,
@@ -1925,11 +1947,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
// 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
@@ -2070,7 +2092,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
cartItem?.Offer > 0 &&
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
isFreeProductApplicable?.OfferId ===
- cartItem?.OfferMessage?.[0]?.OfferId
+ cartItem?.OfferMessage?.[0]?.OfferId
);
}
);
@@ -2173,11 +2195,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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
) {
@@ -2248,12 +2270,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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,
@@ -2287,13 +2309,13 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
// 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
@@ -2375,11 +2397,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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
) {
@@ -2432,11 +2454,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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
) {
@@ -2525,11 +2547,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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
) {
@@ -2558,11 +2580,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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
) {
@@ -2592,11 +2614,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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
) {
@@ -2695,12 +2717,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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,
@@ -2734,12 +2756,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
// 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
@@ -2818,11 +2840,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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
) {
@@ -2881,11 +2903,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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
) {
@@ -2957,12 +2979,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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,
@@ -2996,12 +3018,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
// 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
@@ -3156,17 +3178,17 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
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
)
)
@@ -3202,10 +3224,10 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
((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);
@@ -3397,8 +3419,8 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
// parseFloat(enteredDiscount) < parseFloat(sellingPrice) ||
// parseFloat(enteredDiscount) === parseFloat(sellingPrice)
// ) {
- setEditedPrice(enteredDiscount);
- setDisableSubmitButton(true);
+ setEditedPrice(enteredDiscount);
+ setDisableSubmitButton(true);
// } else {
// setMessageType('error');
// setMessageData('Please Give less than value for sell price');
@@ -3467,8 +3489,8 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
setClearQuantity(false);
};
const isKg =
- props?.Productdata?.Size == 1 &&
- ["KG", "KGS"].includes(props?.Productdata?.UomName?.toUpperCase());
+ props?.Productdata?.Size == 1 &&
+ ["KG", "KGS"].includes(props?.Productdata?.UomName?.toUpperCase());
return (
@@ -3688,7 +3710,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
? `${parts[0]}.${parts.slice(1).join('')}`
: cleanedValue;
}}
- // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
+ // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
/>
)}
@@ -3751,7 +3773,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
? `${parts[0]}.${parts.slice(1).join('')}`
: cleanedValue;
}}
- // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
+ // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
/>
{/*
{
{((RadioBtnSelection == 'Price' && disableSubmitButton) ||
RadioBtnSelection == 'Quantity') && (
- }
- >
- )}
+ }
+ >
+ )}
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/ComboBillTableEdit/ComboEditQtyAndRate.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/ComboBillTableEdit/ComboEditQtyAndRate.jsx
index 4d274fc..6f699c1 100644
--- a/src/Pages/BookingScreen/Components/BSBillingTables/ComboBillTableEdit/ComboEditQtyAndRate.jsx
+++ b/src/Pages/BookingScreen/Components/BSBillingTables/ComboBillTableEdit/ComboEditQtyAndRate.jsx
@@ -30,6 +30,7 @@ import {
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
import { v4 as uuidv4 } from 'uuid';
import './ComboBillTableEdit.scss';
+import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
const ComboEditQtyAndRate = (props) => {
const dispatch = useDispatch();
@@ -37,9 +38,9 @@ const ComboEditQtyAndRate = (props) => {
const quantityInputRef = useRef(null);
const priceChangeInputRef = useRef(null);
const {
- setIndex = () => {},
- setEditQtyCombo = () => {},
- setEditRateCombo = () => {},
+ setIndex = () => { },
+ setEditQtyCombo = () => { },
+ setEditRateCombo = () => { },
} = props;
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
@@ -51,10 +52,19 @@ const ComboEditQtyAndRate = (props) => {
const applyOffer = useApplyOfferto_CardDetail();
const preferenceDatas = useSelector(PreferenceData);
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(
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
shallowEqual
);
+ console.log(overAllLimitPreferenece, "itemWiseLimitPreferenece")
const preferenceOffer =
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
(item) => item.SettingIdName === 'Offer'
@@ -251,7 +261,16 @@ const ComboEditQtyAndRate = (props) => {
item?.SinglePc === 'Y' ? item?.OverAllPcs : item?.BalanceQty;
return availableQty - totalUsedQty;
};
+
+ const quantityValidation = async (val) => {
+
+ setQuantity(val)
+
+ }
const AddProductQuantity = async () => {
+ // debugger
+
+
let newPrice = editedPrice > 0 ? editedPrice : props.Productdata.OrderRate;
await dispatch(changeHoldOrderDtl(false));
await dispatch(changePreviousOrderLength(CartOrderDetails?.length));
@@ -312,6 +331,20 @@ const ComboEditQtyAndRate = (props) => {
let editedProductIndex = CartOrderDetails?.findIndex(
(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 productBookingType = editedProduct?.BookingTypeName;
const isItemInCart = CartOrderDetails?.find(
@@ -591,7 +624,7 @@ const ComboEditQtyAndRate = (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
);
@@ -725,7 +758,7 @@ const ComboEditQtyAndRate = (props) => {
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OrderRate === editedProduct?.OrderRate &&
cartItem?.BookingTypeName !==
- editedProduct?.BookingTypeName &&
+ editedProduct?.BookingTypeName &&
!cartItem?.OfferMode &&
cartItem?.Offer === 0
);
@@ -739,7 +772,7 @@ const ComboEditQtyAndRate = (props) => {
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OrderRate === editedProduct?.OrderRate &&
cartItem?.BookingTypeName !==
- editedProduct?.BookingTypeName &&
+ editedProduct?.BookingTypeName &&
cartItem?.OfferMode === editedProduct?.OfferMode &&
cartItem?.Offer > 0
);
@@ -872,7 +905,7 @@ const ComboEditQtyAndRate = (props) => {
)
) &&
product?.OfferId ===
- editedProduct?.OfferMessage?.[0]?.OfferId &&
+ editedProduct?.OfferMessage?.[0]?.OfferId &&
product?.OfferMode === editedProduct?.OfferMode
) {
const freeQty =
@@ -905,7 +938,7 @@ const ComboEditQtyAndRate = (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) {
@@ -984,7 +1017,7 @@ const ComboEditQtyAndRate = (props) => {
)
) &&
product?.OfferId ===
- editedProduct?.OfferMessage?.[0]?.OfferId &&
+ editedProduct?.OfferMessage?.[0]?.OfferId &&
product?.OfferMode === editedProduct?.OfferMode
) {
return {
@@ -1014,7 +1047,7 @@ const ComboEditQtyAndRate = (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) {
@@ -1201,7 +1234,7 @@ const ComboEditQtyAndRate = (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) {
@@ -1303,7 +1336,7 @@ const ComboEditQtyAndRate = (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) {
@@ -1457,7 +1490,7 @@ const ComboEditQtyAndRate = (props) => {
) &&
cartItem?.Offer &&
isFreeProductApplicable?.OfferId ===
- cartItem?.OfferMessage?.[0]?.OfferId
+ cartItem?.OfferMessage?.[0]?.OfferId
);
}
);
@@ -1746,11 +1779,11 @@ const ComboEditQtyAndRate = (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,
@@ -1784,11 +1817,11 @@ const ComboEditQtyAndRate = (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
@@ -1929,7 +1962,7 @@ const ComboEditQtyAndRate = (props) => {
cartItem?.Offer > 0 &&
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
isFreeProductApplicable?.OfferId ===
- cartItem?.OfferMessage?.[0]?.OfferId
+ cartItem?.OfferMessage?.[0]?.OfferId
);
}
);
@@ -2032,11 +2065,11 @@ const ComboEditQtyAndRate = (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
) {
@@ -2107,12 +2140,12 @@ const ComboEditQtyAndRate = (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,
@@ -2146,13 +2179,13 @@ const ComboEditQtyAndRate = (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
@@ -2234,11 +2267,11 @@ const ComboEditQtyAndRate = (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
) {
@@ -2291,11 +2324,11 @@ const ComboEditQtyAndRate = (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
) {
@@ -2384,11 +2417,11 @@ const ComboEditQtyAndRate = (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
) {
@@ -2417,11 +2450,11 @@ const ComboEditQtyAndRate = (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
) {
@@ -2451,11 +2484,11 @@ const ComboEditQtyAndRate = (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
) {
@@ -2554,12 +2587,12 @@ const ComboEditQtyAndRate = (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,
@@ -2593,12 +2626,12 @@ const ComboEditQtyAndRate = (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
@@ -2677,11 +2710,11 @@ const ComboEditQtyAndRate = (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
) {
@@ -2740,11 +2773,11 @@ const ComboEditQtyAndRate = (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
) {
@@ -2816,12 +2849,12 @@ const ComboEditQtyAndRate = (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,
@@ -2855,12 +2888,12 @@ const ComboEditQtyAndRate = (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
@@ -3014,17 +3047,17 @@ const ComboEditQtyAndRate = (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
)
)
@@ -3060,10 +3093,10 @@ const ComboEditQtyAndRate = (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);
@@ -3227,7 +3260,7 @@ const ComboEditQtyAndRate = (props) => {
type="number"
value={Quantity}
min="0"
- onChange={(e) => setQuantity(e.target.value)}
+ onChange={(e) => quantityValidation(e.target.value)}
onBlur={() => {
if (Quantity && Quantity.trim() !== '') {
AddProductQuantity();
diff --git a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx
index b120a6c..7740cbe 100644
--- a/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx
+++ b/src/Pages/BookingScreen/Components/BSItemCards/BSItemCard.jsx
@@ -123,6 +123,7 @@ import { MdOutlineAddShoppingCart } from 'react-icons/md';
import { bulkpostdata } from '../../../../Features/ProductPage/ProductPage.js';
import ProductPriceChange from '../UtillComponents/ProductPriceChange.jsx';
import ExpireConfirmModal from '../BookingFunctionality/ExpireConfirmModal.jsx';
+import { calculateOverAllQtyLimit } from '../../../../utils/calculations.js';
export function SortableCard({ id, children, item }) {
const {
@@ -164,6 +165,13 @@ const BSItemCard = (props) => {
// const applyOffer = useApplyOfferto_CardDetail();
const preferenceDatas = useSelector(PreferenceData, shallowEqual);
const { selectedDate } = useDateStore();
+ 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 =
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
(item) => item.SettingIdName === 'Offer'
@@ -180,7 +188,6 @@ const BSItemCard = (props) => {
// GlobalAddCustomerDetails,
// shallowEqual
// );
-
const offerAppliedProducts = useSelector(
GlobalOfferAppliedProducts,
shallowEqual
@@ -618,7 +625,7 @@ const BSItemCard = (props) => {
WithoutTaxRate:
availableFreeQty * item.OrderRate -
(availableFreeQty * item.OrderRate * item.TaxPercentage) /
- 100,
+ 100,
Offer: availableFreeQty * item.OrderRate,
};
@@ -667,7 +674,7 @@ const BSItemCard = (props) => {
((existingPaidItem.OrderQty + excessQty) *
item.OrderRate *
item.TaxPercentage) /
- 100,
+ 100,
};
ModifiedData.push(mergedPaidItem);
@@ -702,7 +709,7 @@ const BSItemCard = (props) => {
data?.InwardDtlId === item?.InwardDtlId &&
data?.ProdId === item?.ProdId &&
data?.OfferMessage?.[0]?.OfferId ===
- item?.OfferMessage?.[0]?.OfferId
+ item?.OfferMessage?.[0]?.OfferId
);
if (isAlreadyExists !== -1) {
@@ -722,11 +729,11 @@ const BSItemCard = (props) => {
).toFixed(2),
WithoutTaxRate:
(ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
- item.OrderRate -
+ item.OrderRate -
((ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
item.OrderRate *
item.TaxPercentage) /
- 100,
+ 100,
Offer:
(ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
item.OrderRate,
@@ -752,10 +759,10 @@ const BSItemCard = (props) => {
const appliedOfferAlreadyExists = AppliedOffers.findIndex(
(offer) =>
offer?.FreeProductsList?.FreeProdId ===
- matchingFreeProduct?.FreeProdId &&
+ matchingFreeProduct?.FreeProdId &&
offer?.TableName === matchingFreeProduct?.TableName &&
offer?.TableUniqueName ===
- matchingFreeProduct?.TableUniqueName &&
+ matchingFreeProduct?.TableUniqueName &&
offer?.OfferId === matchingFreeProduct?.OfferId &&
offer?.OfferMode === matchingFreeProduct?.OfferMode &&
offer?.FreeProductsList?.ProdVariantDetails?.[0]
@@ -1001,7 +1008,7 @@ const BSItemCard = (props) => {
? []
: SelectedDatas
: ItemCard?.length == 0 ||
- (ItemCard?.[0]?.AppId === 0 && ItemCard?.[0]?.CompId === 0)
+ (ItemCard?.[0]?.AppId === 0 && ItemCard?.[0]?.CompId === 0)
? noSubcatCardData
: ItemCard
: '';
@@ -1106,14 +1113,14 @@ const BSItemCard = (props) => {
ProdSubCat: ProdSubCat,
...(AvailableDate && selectedDate
? {
- date: Array.isArray(selectedDate)
- ? selectedDate
- .map((d) => (d?.format ? d.format('YYYY-MM-DD') : d))
- .join(',')
- : selectedDate?.format
- ? selectedDate.format('YYYY-MM-DD')
- : selectedDate,
- }
+ date: Array.isArray(selectedDate)
+ ? selectedDate
+ .map((d) => (d?.format ? d.format('YYYY-MM-DD') : d))
+ .join(',')
+ : selectedDate?.format
+ ? selectedDate.format('YYYY-MM-DD')
+ : selectedDate,
+ }
: {}),
};
//mohan
@@ -1160,14 +1167,14 @@ const BSItemCard = (props) => {
prodCat: ProdCat,
...(AvailableDate && selectedDate
? {
- date: Array.isArray(selectedDate)
- ? selectedDate
- .map((d) => (d?.format ? d.format('YYYY-MM-DD') : d))
- .join(',')
- : selectedDate?.format
- ? selectedDate.format('YYYY-MM-DD')
- : selectedDate,
- }
+ date: Array.isArray(selectedDate)
+ ? selectedDate
+ .map((d) => (d?.format ? d.format('YYYY-MM-DD') : d))
+ .join(',')
+ : selectedDate?.format
+ ? selectedDate.format('YYYY-MM-DD')
+ : selectedDate,
+ }
: {}),
};
@@ -1372,13 +1379,13 @@ const BSItemCard = (props) => {
(cartItem) =>
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
- VarientIndex
- ]?.StockDetails?.[0]?.InwardDtlId &&
+ item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
+ VarientIndex
+ ]?.StockDetails?.[0]?.InwardDtlId &&
cartItem?.OrderRate ===
- item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
- VarientIndex
- ]?.StockDetails?.[0]?.SellPrice &&
+ item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
+ VarientIndex
+ ]?.StockDetails?.[0]?.SellPrice &&
!cartItem?.SalesId
);
@@ -1387,9 +1394,9 @@ const BSItemCard = (props) => {
(cartItem) =>
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
- VarientIndex
- ]?.StockDetails?.[0]?.InwardDtlId &&
+ item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
+ VarientIndex
+ ]?.StockDetails?.[0]?.InwardDtlId &&
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
!cartItem?.SalesId
);
@@ -1431,11 +1438,11 @@ const BSItemCard = (props) => {
(cartItem) =>
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
- ?.StockDetails?.[0]?.InwardDtlId &&
+ item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
+ ?.StockDetails?.[0]?.InwardDtlId &&
cartItem?.OrderRate ===
- item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
- ?.StockDetails?.[0]?.SellPrice &&
+ item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
+ ?.StockDetails?.[0]?.SellPrice &&
!cartItem?.SalesId
);
@@ -1444,9 +1451,9 @@ const BSItemCard = (props) => {
(cartItem) =>
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
- VarientIndex
- ]?.StockDetails?.[0]?.InwardDtlId &&
+ item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
+ VarientIndex
+ ]?.StockDetails?.[0]?.InwardDtlId &&
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
!cartItem?.SalesId
);
@@ -1527,13 +1534,13 @@ const BSItemCard = (props) => {
(cartItem) =>
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
- index.key
- ]?.StockDetails?.[0]?.InwardDtlId &&
+ qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
+ index.key
+ ]?.StockDetails?.[0]?.InwardDtlId &&
cartItem?.OrderRate ===
- qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
- index.key
- ]?.StockDetails?.[0]?.SellPrice &&
+ qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
+ index.key
+ ]?.StockDetails?.[0]?.SellPrice &&
!cartItem?.SalesId
);
@@ -1541,11 +1548,11 @@ const BSItemCard = (props) => {
let Isincartonepc = CartOrderDetails?.filter(
(cartItem) =>
cartItem?.ProdId ===
- qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
+ qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
- index.key
- ]?.StockDetails?.[0]?.InwardDtlId &&
+ qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
+ index.key
+ ]?.StockDetails?.[0]?.InwardDtlId &&
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
!cartItem?.SalesId
);
@@ -1613,13 +1620,13 @@ const BSItemCard = (props) => {
(cartItem) =>
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
- index.key
- ]?.StockDetails?.[0]?.InwardDtlId &&
+ qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
+ index.key
+ ]?.StockDetails?.[0]?.InwardDtlId &&
cartItem?.OrderRate ===
- qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
- index.key
- ]?.StockDetails?.[0]?.SellPrice &&
+ qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
+ index.key
+ ]?.StockDetails?.[0]?.SellPrice &&
!cartItem?.SalesId
);
@@ -1628,9 +1635,9 @@ const BSItemCard = (props) => {
(cartItem) =>
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
- index.key
- ]?.StockDetails?.[0]?.InwardDtlId &&
+ qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
+ index.key
+ ]?.StockDetails?.[0]?.InwardDtlId &&
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
!cartItem?.SalesId
);
@@ -1798,15 +1805,15 @@ const BSItemCard = (props) => {
let Isincart = CartOrderDetails?.find(
(cartItem) =>
cartItem?.ProdId ===
- qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
+ qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
- item?.VarientIndex
- ]?.StockDetails?.[0]?.InwardDtlId &&
+ qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
+ item?.VarientIndex
+ ]?.StockDetails?.[0]?.InwardDtlId &&
cartItem?.OrderRate ===
- qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
- item?.VarientIndex
- ]?.StockDetails?.[0]?.SellPrice &&
+ qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
+ item?.VarientIndex
+ ]?.StockDetails?.[0]?.SellPrice &&
!cartItem?.SalesId
);
@@ -1814,11 +1821,11 @@ const BSItemCard = (props) => {
let Isincartonepc = CartOrderDetails?.filter(
(cartItem) =>
cartItem?.ProdId ===
- qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
+ qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
- item?.VarientIndex
- ]?.StockDetails?.[0]?.InwardDtlId &&
+ qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
+ item?.VarientIndex
+ ]?.StockDetails?.[0]?.InwardDtlId &&
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
!cartItem?.SalesId
);
@@ -1897,15 +1904,15 @@ const BSItemCard = (props) => {
let Isincart = CartOrderDetails?.find(
(cartItem) =>
cartItem?.ProdId ===
- qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
+ qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
- item?.VarientIndex
- ]?.StockDetails?.[0]?.InwardDtlId &&
+ qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
+ item?.VarientIndex
+ ]?.StockDetails?.[0]?.InwardDtlId &&
cartItem?.OrderRate ===
- qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
- item?.VarientIndex
- ]?.StockDetails?.[0]?.SellPrice &&
+ qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
+ item?.VarientIndex
+ ]?.StockDetails?.[0]?.SellPrice &&
!cartItem?.SalesId
);
@@ -1913,11 +1920,11 @@ const BSItemCard = (props) => {
let Isincartonepc = CartOrderDetails?.filter(
(cartItem) =>
cartItem?.ProdId ===
- qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
+ qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
cartItem?.InwardDtlId ===
- qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
- item?.VarientIndex
- ]?.StockDetails?.[0]?.InwardDtlId &&
+ qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
+ item?.VarientIndex
+ ]?.StockDetails?.[0]?.InwardDtlId &&
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
!cartItem?.SalesId
);
@@ -2073,6 +2080,18 @@ const BSItemCard = (props) => {
};
const AddOrderDetails = async (item) => {
+
+ if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
+ if (overAllLimitPreferenece) {
+ const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails);
+ if ((calculatedOverAllQty + 1) > maxQtyLimit) {
+ setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
+ setMessageType('warning');
+ return;
+ }
+ }
+ }
+
if (preOrder) {
await handlePreOrder(item);
} else {
@@ -2165,15 +2184,15 @@ const BSItemCard = (props) => {
const isExistsInFreeProdList = hasOffer
? FreeProdList?.filter(
- (f) =>
- f?.FreeProdId === item?.ProdId &&
- f?.ProdVariantDetails?.some((variant) =>
- variant?.StockDetails?.some(
- (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
- )
- ) &&
- f?.RemainingQty > 0
- )
+ (f) =>
+ f?.FreeProdId === item?.ProdId &&
+ f?.ProdVariantDetails?.some((variant) =>
+ variant?.StockDetails?.some(
+ (stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
+ )
+ ) &&
+ f?.RemainingQty > 0
+ )
: [];
const calculateTaxAmounts = (qty, rate, taxPercentage) => {
@@ -2240,10 +2259,10 @@ const BSItemCard = (props) => {
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
? true
: cartItem?.OfferMode !== 'B') &&
- cartItem?.OfferMode !== 'P' &&
- cartItem?.OfferMode !== 'C' &&
- cartItem?.OfferMode !== 'O' &&
- cartItem?.OfferMode !== 'L'
+ cartItem?.OfferMode !== 'P' &&
+ cartItem?.OfferMode !== 'C' &&
+ cartItem?.OfferMode !== 'O' &&
+ cartItem?.OfferMode !== 'L'
? true
: cartItem?.Offer === 0)
);
@@ -2254,10 +2273,10 @@ const BSItemCard = (props) => {
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
? true
: cartItem?.OfferMode !== 'B') &&
- cartItem?.OfferMode !== 'P' &&
- cartItem?.OfferMode !== 'C' &&
- cartItem?.OfferMode !== 'O' &&
- cartItem?.OfferMode !== 'L'
+ cartItem?.OfferMode !== 'P' &&
+ cartItem?.OfferMode !== 'C' &&
+ cartItem?.OfferMode !== 'O' &&
+ cartItem?.OfferMode !== 'L'
? true
: cartItem?.Offer === 0)
);
@@ -2271,10 +2290,10 @@ const BSItemCard = (props) => {
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
? true
: cartItem?.OfferMode !== 'B') &&
- cartItem?.OfferMode !== 'P' &&
- cartItem?.OfferMode !== 'C' &&
- cartItem?.OfferMode !== 'O' &&
- cartItem?.OfferMode !== 'L'
+ cartItem?.OfferMode !== 'P' &&
+ cartItem?.OfferMode !== 'C' &&
+ cartItem?.OfferMode !== 'O' &&
+ cartItem?.OfferMode !== 'L'
? true
: cartItem?.Offer === 0)
)
@@ -2287,10 +2306,10 @@ const BSItemCard = (props) => {
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
? true
: cartItem?.OfferMode !== 'B') &&
- cartItem?.OfferMode !== 'P' &&
- cartItem?.OfferMode !== 'C' &&
- cartItem?.OfferMode !== 'O' &&
- cartItem?.OfferMode !== 'L'
+ cartItem?.OfferMode !== 'P' &&
+ cartItem?.OfferMode !== 'C' &&
+ cartItem?.OfferMode !== 'O' &&
+ cartItem?.OfferMode !== 'L'
? true
: cartItem?.Offer === 0)
)
@@ -2311,8 +2330,8 @@ const BSItemCard = (props) => {
isItemInCart,
item?.OtherProduct === 'Others' || item?.ScaleType === 'weight'
? (
- (item?.OrderQty || 0) + parseFloat(isItemInCart?.OrderQty)
- )?.toFixed(3)
+ (item?.OrderQty || 0) + parseFloat(isItemInCart?.OrderQty)
+ )?.toFixed(3)
: null
);
const updatedData = addFirst
@@ -2338,8 +2357,8 @@ const BSItemCard = (props) => {
isItemInCartHold,
item?.OtherProduct === 'Others' || item?.ScaleType === 'weight'
? (
- (item?.OrderQty || 0) + parseFloat(isItemInCartHold?.OrderQty)
- )?.toFixed(3)
+ (item?.OrderQty || 0) + parseFloat(isItemInCartHold?.OrderQty)
+ )?.toFixed(3)
: null
);
const updatedData = addFirst
@@ -2566,14 +2585,14 @@ const BSItemCard = (props) => {
updatedCartData = cartData.map((item, idx) =>
idx === indexToCheck
? {
- ...item,
- Offer: null,
- OfferMessage: undefined,
- OfferMode: undefined,
- OfferModeType: false,
- OfferType: undefined,
- OfferValue: null,
- }
+ ...item,
+ Offer: null,
+ OfferMessage: undefined,
+ OfferMode: undefined,
+ OfferModeType: false,
+ OfferType: undefined,
+ OfferValue: null,
+ }
: item
);
}
@@ -2624,8 +2643,8 @@ const BSItemCard = (props) => {
...item,
Offer:
sameProduct ||
- bestOffer?.OfferMode === 'I' ||
- bestOffer?.OfferMode === 'Q'
+ bestOffer?.OfferMode === 'I' ||
+ bestOffer?.OfferMode === 'Q'
? bestOffer?.OfferAmount || item.Offer
: item.Offer || bestOffer?.OfferAmount,
OfferType: item?.OfferType || bestOffer?.OfferType,
@@ -2642,10 +2661,10 @@ const BSItemCard = (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);
@@ -3032,10 +3051,10 @@ const BSItemCard = (props) => {
return FreeProdList.map((f, i) =>
i === index
? {
- ...existing,
- ...newFreeProd,
- ProdVariantDetails: existing.ProdVariantDetails,
- }
+ ...existing,
+ ...newFreeProd,
+ ProdVariantDetails: existing.ProdVariantDetails,
+ }
: f
);
} else {
@@ -3105,7 +3124,7 @@ const BSItemCard = (props) => {
const cycleSize = buyQty + getQty;
const fullCycles = Math.floor(
freeCartItem?.reduce((acc, fc) => acc + (fc?.OrderQty || 0), 0) /
- cycleSize
+ cycleSize
);
const totalFreeQty = fullCycles * getQty;
@@ -3663,7 +3682,7 @@ const BSItemCard = (props) => {
parseInt(totalSelectedProductQty || 0) +
parseInt(reorderComboConsumed || 0);
}
- } catch (_) {}
+ } catch (_) { }
let getCurrentProdDtl = orderDetails?.filter(
(a) => a?.ProdName === ProdName
);
@@ -3864,7 +3883,7 @@ const BSItemCard = (props) => {
parseInt(totalSelectedProductQty || 0) +
parseInt(reorderComboConsumed || 0);
}
- } catch (_) {}
+ } catch (_) { }
let getCurrentProdDtl = orderDetails?.filter((a) => a?.ProdId === ProdId);
let totalOrderQty = getCurrentProdDtl?.reduce((accumulator, card) => {
return (
@@ -3900,7 +3919,7 @@ const BSItemCard = (props) => {
}, 0);
totalOrderQty =
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
- } catch (_) {}
+ } catch (_) { }
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
if (
parseInt(ItemQuantity) >
@@ -3986,7 +4005,7 @@ const BSItemCard = (props) => {
parseInt(totalSelectedProductQty || 0) +
parseInt(reorderComboConsumed || 0);
}
- } catch (_) {}
+ } catch (_) { }
let getCurrentProdDtl = orderDetails?.filter((a) => a?.ProdId === ProdId);
let totalOrderQty = getCurrentProdDtl?.reduce((accumulator, card) => {
return (
@@ -4025,7 +4044,7 @@ const BSItemCard = (props) => {
}, 0);
totalOrderQty =
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
- } catch (_) {}
+ } catch (_) { }
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
if (
parseInt(ItemQuantity) >
@@ -4117,7 +4136,7 @@ const BSItemCard = (props) => {
parseInt(totalSelectedProductQty || 0) +
parseInt(reorderComboConsumed || 0);
}
- } catch (_) {}
+ } catch (_) { }
let getCurrentProdDtl = orderDetails?.filter(
(a) => a?.ProdId === ProdId && a?.InwardDtlId === InwardDtlId
);
@@ -4160,7 +4179,7 @@ const BSItemCard = (props) => {
}, 0);
totalOrderQty =
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
- } catch (_) {}
+ } catch (_) { }
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
if (
@@ -4244,7 +4263,7 @@ const BSItemCard = (props) => {
parseInt(totalSelectedProductQty || 0) +
parseInt(reorderComboConsumed || 0);
}
- } catch (_) {}
+ } catch (_) { }
let getCurrentProdDtl = orderDetails?.filter(
(a) => a?.ProdId === ProdId && a?.InwardDtlId === InwardDtlId
);
@@ -4291,7 +4310,7 @@ const BSItemCard = (props) => {
}, 0);
totalOrderQty =
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
- } catch (_) {}
+ } catch (_) { }
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
if (
@@ -4469,7 +4488,7 @@ const BSItemCard = (props) => {
0 ||
- record.StockCount === 'Stock Not Maintained'
+ record.StockCount === 'Stock Not Maintained'
? { color: '#000', cursor: 'pointer' }
: { color: '#f49898', cursor: 'not-allowed' }
}
@@ -4499,7 +4518,7 @@ const BSItemCard = (props) => {
0 ||
- record.StockCount === 'Stock Not Maintained'
+ record.StockCount === 'Stock Not Maintained'
? { color: '#000', cursor: 'pointer' }
: { color: '#f49898', cursor: 'not-allowed' }
}
@@ -4529,7 +4548,7 @@ const BSItemCard = (props) => {
0 ||
- record.StockCount === 'Stock Not Maintained'
+ record.StockCount === 'Stock Not Maintained'
? { color: '#000', cursor: 'pointer' }
: { color: '#f49898', cursor: 'not-allowed' }
}
@@ -4704,17 +4723,17 @@ const BSItemCard = (props) => {
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable === 'Y'
? onePeiceFlow
? returnVariantStock(
- qtydata?.ProductDetail?.[QtyIndex]?.ProdId,
- item?.OverAllPcs,
- CartOrderDetails,
- item?.ProdVariantName
- )
+ qtydata?.ProductDetail?.[QtyIndex]?.ProdId,
+ item?.OverAllPcs,
+ CartOrderDetails,
+ item?.ProdVariantName
+ )
: returnVariantStock(
- qtydata?.ProductDetail?.[QtyIndex]?.ProdId,
- item?.OverAllQty,
- CartOrderDetails,
- item?.ProdVariantName
- )
+ qtydata?.ProductDetail?.[QtyIndex]?.ProdId,
+ item?.OverAllQty,
+ CartOrderDetails,
+ item?.ProdVariantName
+ )
: 'Stock Not Maintained',
VariantAvailableFrom: item?.AvailableFrom,
VariantAvailableTo: item?.AvailableTo,
@@ -4736,20 +4755,20 @@ const BSItemCard = (props) => {
'Batch No': item?.BatchRef,
StockCount: onePeiceFlow
? returnCountStock(
- item?.ProdId,
- item?.OverAllPcs,
- CartOrderDetails,
- item?.InwardDtlId,
- 'Y'
- )
+ item?.ProdId,
+ item?.OverAllPcs,
+ CartOrderDetails,
+ item?.InwardDtlId,
+ 'Y'
+ )
: returnCountStock(
- item?.ProdId,
- item?.BalanceQty,
- CartOrderDetails,
- item?.InwardDtlId,
- 'N',
- item?.OverAllPcs
- ),
+ item?.ProdId,
+ item?.BalanceQty,
+ CartOrderDetails,
+ item?.InwardDtlId,
+ 'N',
+ item?.OverAllPcs
+ ),
'Stock Date': ExtractDateFormate(item?.InwardDate),
Price: onePeiceFlow ? item?.OnePcsPrice : item?.SellPrice,
ExpDate:
@@ -5899,9 +5918,9 @@ const BSItemCard = (props) => {
allProducts.forEach((product) => {
const brandName =
product.BrandName &&
- product.BrandName !== 'null' &&
- product.BrandName !== 'undefined' &&
- product.BrandName.trim() !== ''
+ product.BrandName !== 'null' &&
+ product.BrandName !== 'undefined' &&
+ product.BrandName.trim() !== ''
? product.BrandName
: 'Others';
@@ -5935,13 +5954,13 @@ const BSItemCard = (props) => {
const result = prodname
? (cardData || [])?.filter(
- (item) =>
- normalize(item.ProdName).includes(normalize(prodname)) ||
- normalize(item.ProdCatName).includes(normalize(prodname)) ||
- item.ProductDetail?.some((detail) =>
- normalize(detail.ProdName).includes(normalize(prodname))
- )
- )
+ (item) =>
+ normalize(item.ProdName).includes(normalize(prodname)) ||
+ normalize(item.ProdCatName).includes(normalize(prodname)) ||
+ item.ProductDetail?.some((detail) =>
+ normalize(detail.ProdName).includes(normalize(prodname))
+ )
+ )
: cardData;
console.log(prodQty, 'cardDatacardData', result, prodname);
@@ -5961,8 +5980,8 @@ const BSItemCard = (props) => {
CardOnclick(
result?.[0],
result?.[0]?.OnePcsAvailable === 'Y' &&
- preferenceSingleSales &&
- 'OnePeiceProduct'
+ preferenceSingleSales &&
+ 'OnePeiceProduct'
);
// AddOrderDetails2(result?.[0])
} else if (item?.OverAllQty < prodQty) {
@@ -6021,8 +6040,8 @@ const BSItemCard = (props) => {
zIndex: '12',
top:
templateData?.BookingLayout?.[0] === 'Layout5' ||
- templateData?.BookingLayout?.[0] === 'Layout4' ||
- templateData?.BookingLayout?.[0] === 'Layout6'
+ templateData?.BookingLayout?.[0] === 'Layout4' ||
+ templateData?.BookingLayout?.[0] === 'Layout6'
? '2.5rem'
: '',
}}
@@ -6102,21 +6121,21 @@ const BSItemCard = (props) => {
}}
className={
(item?.OverAllQty !== undefined &&
- !preferenceSingleSales
+ !preferenceSingleSales
? returnCount(
- item?.ProductDetail?.[0]?.ProdName,
- item?.OverAllQty,
- CartOrderDetails,
- item?.OverAllPcs
- )
+ item?.ProductDetail?.[0]?.ProdName,
+ item?.OverAllQty,
+ CartOrderDetails,
+ item?.OverAllPcs
+ )
: returnOnepcCount(
- item?.ProductDetail?.[0]?.ProdName,
- item?.OverAllPcs,
- CartOrderDetails
- ) > 0) ||
- item?.ProductDetail?.some(
- (item) => item?.StockAvailable !== 'Y'
- )
+ item?.ProductDetail?.[0]?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ ) > 0) ||
+ item?.ProductDetail?.some(
+ (item) => item?.StockAvailable !== 'Y'
+ )
? 'BkPrdCardActive'
: 'BkPrdCardDeActive'
}
@@ -6154,39 +6173,39 @@ const BSItemCard = (props) => {
cardFunction?.Background &&
(SelectedCardColor
? SelectedCardColor?.[
- 'BackgroundColor'
- ]
+ 'BackgroundColor'
+ ]
: ''),
padding:
!cardFunction?.ImageUp &&
- !cardFunction?.ImageDown
+ !cardFunction?.ImageDown
? cardFunction?.SmallImage &&
- '5px 9px'
+ '5px 9px'
: '8px 2px',
flexDirection:
cardFunction?.ImageRight &&
- 'row-reverse'
+ 'row-reverse'
? cardFunction?.ImageRight &&
- 'row-reverse'
+ 'row-reverse'
: cardFunction?.ImageUp && 'column'
? cardFunction?.ImageUp &&
- 'column'
+ 'column'
: cardFunction?.ImageDown &&
- 'column-reverse'
+ 'column-reverse'
? cardFunction?.ImageDown &&
- 'column-reverse'
+ 'column-reverse'
: cardFunction?.ImageLeft &&
- 'row',
+ 'row',
borderRadius:
cardFunction?.EdgeCurve && '6px',
width:
!cardFunction?.ImageUp &&
- !cardFunction?.ImageDown &&
- !cardFunction?.BigImage &&
- !cardFunction?.ImageRight &&
- cardFunction?.SmallImage &&
- (cardFunction?.ImageUp ||
- cardFunction?.ImageDown)
+ !cardFunction?.ImageDown &&
+ !cardFunction?.BigImage &&
+ !cardFunction?.ImageRight &&
+ cardFunction?.SmallImage &&
+ (cardFunction?.ImageUp ||
+ cardFunction?.ImageDown)
? '6rem'
: cardFunction?.BigImage && '9rem',
height:
@@ -6219,19 +6238,19 @@ const BSItemCard = (props) => {
if (
!(
(item?.OverAllQty !== undefined &&
- !preferenceSingleSales
+ !preferenceSingleSales
? returnCount(
- item?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllQty,
- CartOrderDetails
- )
+ item?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllQty,
+ CartOrderDetails
+ )
: returnOnepcCount(
- item?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllPcs,
- CartOrderDetails
- ) > 0) ||
+ item?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ ) > 0) ||
item?.ProductDetail?.some(
(item) =>
item?.StockAvailable !== 'Y'
@@ -6243,8 +6262,8 @@ const BSItemCard = (props) => {
CardOnclick(
item,
item?.OnePcsAvailable === 'Y' &&
- preferenceSingleSales &&
- 'OnePeiceProduct'
+ preferenceSingleSales &&
+ 'OnePeiceProduct'
);
}
}}
@@ -6253,39 +6272,39 @@ const BSItemCard = (props) => {
>
{(cardFunction?.BigImage ||
cardFunction?.SmallImage) && (
-
- )}
+ : defaultimage
+ }
+ alt=""
+ />
+ )}
{
cardFunction?.Background &&
(SelectedCardColor
? SelectedCardColor?.[
- 'BackgroundColor'
- ]
+ 'BackgroundColor'
+ ]
: ''),
position: !cardFunction?.BigImage
@@ -6319,7 +6338,7 @@ const BSItemCard = (props) => {
height: cardFunction?.SmallImage
? '5.5rem'
: !cardFunction?.BigImage &&
- '5.5rem',
+ '5.5rem',
alignItems:
!cardFunction?.BigImage &&
!cardFunction?.SmallImage &&
@@ -6342,11 +6361,11 @@ const BSItemCard = (props) => {
'uppercase',
width: !cardFunction?.SmallImage
? cardFunction?.BigImage &&
- '120px'
+ '120px'
: cardFunction?.SmallImage &&
- !cardFunction?.ImageUp &&
- !cardFunction?.ImageDown &&
- '85px',
+ !cardFunction?.ImageUp &&
+ !cardFunction?.ImageDown &&
+ '85px',
// Width: cardFunction?.BigImage && "70px",
fontSize:
!cardFunction?.BigImage &&
@@ -6368,24 +6387,24 @@ const BSItemCard = (props) => {
>
{item?.ProdName}{' '}
{(item?.OverAllQty !== undefined &&
- !preferenceSingleSales
+ !preferenceSingleSales
? returnCount(
- item?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllQty,
- CartOrderDetails,
- item
- )
+ item?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllQty,
+ CartOrderDetails,
+ item
+ )
: returnOnepcCount(
- item?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllPcs,
- CartOrderDetails
- ) > 0) ||
- item?.ProductDetail?.some(
- (item) =>
- item?.StockAvailable !== 'Y'
- ) ? (
+ item?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ ) > 0) ||
+ item?.ProductDetail?.some(
+ (item) =>
+ item?.StockAvailable !== 'Y'
+ ) ? (
''
) : (
{
fontSize:
!cardFunction?.SmallImage
? cardFunction?.BigImage &&
- '12px'
+ '12px'
: '12px',
textAlign: 'center',
lineHeight: '2',
@@ -6424,8 +6443,8 @@ const BSItemCard = (props) => {
: '',
color: SelectedCardColor
? SelectedCardColor?.[
- 'FontColor'
- ]
+ 'FontColor'
+ ]
: '',
}}
>
@@ -6473,19 +6492,19 @@ const BSItemCard = (props) => {
count={
!preferenceSingleSales
? returnCount(
- item
- ?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllQty,
- CartOrderDetails
- )
+ item
+ ?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllQty,
+ CartOrderDetails
+ )
: returnOnepcCount(
- item
- ?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllPcs,
- CartOrderDetails
- )
+ item
+ ?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ )
}
overflowCount={10000}
>
@@ -6537,14 +6556,14 @@ const BSItemCard = (props) => {
item?.OverAllPcs,
CartOrderDetails
) > 0 ||
- item?.ProductDetail?.some(
- (product) =>
- product?.StockAvailable !==
- 'Y'
- )
+ item?.ProductDetail?.some(
+ (product) =>
+ product?.StockAvailable !==
+ 'Y'
+ )
? cardFunction?.Background
? SelectedCardColor?.BackgroundColor ||
- '#000000'
+ '#000000'
: '#fff'
: '#ff4d4f',
}}
@@ -6586,39 +6605,39 @@ const BSItemCard = (props) => {
cardFunction?.Background &&
(SelectedCardColor
? SelectedCardColor?.[
- 'BackgroundColor'
- ]
+ 'BackgroundColor'
+ ]
: ''),
padding:
!cardFunction?.ImageUp &&
- !cardFunction?.ImageDown
+ !cardFunction?.ImageDown
? cardFunction?.SmallImage &&
- '5px 9px'
+ '5px 9px'
: '8px 2px',
flexDirection:
cardFunction?.ImageRight &&
- 'row-reverse'
+ 'row-reverse'
? cardFunction?.ImageRight &&
- 'row-reverse'
+ 'row-reverse'
: cardFunction?.ImageUp && 'column'
? cardFunction?.ImageUp &&
- 'column'
+ 'column'
: cardFunction?.ImageDown &&
- 'column-reverse'
+ 'column-reverse'
? cardFunction?.ImageDown &&
- 'column-reverse'
+ 'column-reverse'
: cardFunction?.ImageLeft &&
- 'row',
+ 'row',
borderRadius:
cardFunction?.EdgeCurve && '6px',
width:
!cardFunction?.ImageUp &&
- !cardFunction?.ImageDown &&
- !cardFunction?.BigImage &&
- !cardFunction?.ImageRight &&
- cardFunction?.SmallImage &&
- (cardFunction?.ImageUp ||
- cardFunction?.ImageDown)
+ !cardFunction?.ImageDown &&
+ !cardFunction?.BigImage &&
+ !cardFunction?.ImageRight &&
+ cardFunction?.SmallImage &&
+ (cardFunction?.ImageUp ||
+ cardFunction?.ImageDown)
? '6rem'
: cardFunction?.BigImage && '9rem',
height:
@@ -6636,19 +6655,19 @@ const BSItemCard = (props) => {
if (
!(
(item?.OverAllQty !== undefined &&
- !preferenceSingleSales
+ !preferenceSingleSales
? returnCount(
- item?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllQty,
- CartOrderDetails
- )
+ item?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllQty,
+ CartOrderDetails
+ )
: returnOnepcCount(
- item?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllPcs,
- CartOrderDetails
- ) > 0) ||
+ item?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ ) > 0) ||
item?.ProductDetail?.some(
(item) =>
item?.StockAvailable !== 'Y'
@@ -6660,48 +6679,48 @@ const BSItemCard = (props) => {
CardOnclick(
item,
item?.OnePcsAvailable === 'Y' &&
- preferenceSingleSales &&
- 'OnePeiceProduct'
+ preferenceSingleSales &&
+ 'OnePeiceProduct'
);
}
}}
- // data-aos="zoom-in" data-aos-duration="600"
+ // data-aos="zoom-in" data-aos-duration="600"
>
{(cardFunction?.BigImage ||
cardFunction?.SmallImage) && (
-
- )}
+ : defaultimage
+ }
+ alt=""
+ />
+ )}
{
cardFunction?.Background &&
(SelectedCardColor
? SelectedCardColor?.[
- 'BackgroundColor'
- ]
+ 'BackgroundColor'
+ ]
: ''),
position: !cardFunction?.BigImage
@@ -6735,7 +6754,7 @@ const BSItemCard = (props) => {
height: cardFunction?.SmallImage
? '5.5rem'
: !cardFunction?.BigImage &&
- '4.5rem',
+ '4.5rem',
alignItems:
!cardFunction?.BigImage &&
!cardFunction?.SmallImage &&
@@ -6755,11 +6774,11 @@ const BSItemCard = (props) => {
'uppercase',
width: !cardFunction?.SmallImage
? cardFunction?.BigImage &&
- '120px'
+ '120px'
: cardFunction?.SmallImage &&
- !cardFunction?.ImageUp &&
- !cardFunction?.ImageDown &&
- '85px',
+ !cardFunction?.ImageUp &&
+ !cardFunction?.ImageDown &&
+ '85px',
// Width: cardFunction?.BigImage && "70px",
fontSize:
!cardFunction?.BigImage &&
@@ -6781,24 +6800,24 @@ const BSItemCard = (props) => {
>
{item?.ProdName}{' '}
{(item?.OverAllQty !== undefined &&
- !preferenceSingleSales
+ !preferenceSingleSales
? returnCount(
- item?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllQty,
- CartOrderDetails,
- item
- )
+ item?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllQty,
+ CartOrderDetails,
+ item
+ )
: returnOnepcCount(
- item?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllPcs,
- CartOrderDetails
- ) > 0) ||
- item?.ProductDetail?.some(
- (item) =>
- item?.StockAvailable !== 'Y'
- ) ? (
+ item?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ ) > 0) ||
+ item?.ProductDetail?.some(
+ (item) =>
+ item?.StockAvailable !== 'Y'
+ ) ? (
''
) : (
{
fontSize:
!cardFunction?.SmallImage
? cardFunction?.BigImage &&
- '12px'
+ '12px'
: '12px',
textAlign: 'center',
lineHeight: '2',
@@ -6837,8 +6856,8 @@ const BSItemCard = (props) => {
: '',
color: SelectedCardColor
? SelectedCardColor?.[
- 'FontColor'
- ]
+ 'FontColor'
+ ]
: '',
}}
>
@@ -6883,19 +6902,19 @@ const BSItemCard = (props) => {
count={
!preferenceSingleSales
? returnCount(
- item
- ?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllQty,
- CartOrderDetails
- )
+ item
+ ?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllQty,
+ CartOrderDetails
+ )
: returnOnepcCount(
- item
- ?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllPcs,
- CartOrderDetails
- )
+ item
+ ?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ )
}
overflowCount={10000}
>
@@ -6946,14 +6965,14 @@ const BSItemCard = (props) => {
item?.OverAllPcs,
CartOrderDetails
) > 0 ||
- item?.ProductDetail?.some(
- (product) =>
- product?.StockAvailable !==
- 'Y'
- )
+ item?.ProductDetail?.some(
+ (product) =>
+ product?.StockAvailable !==
+ 'Y'
+ )
? cardFunction?.Background
? SelectedCardColor?.BackgroundColor ||
- '#000000'
+ '#000000'
: '#fff'
: '#ff4d4f',
}}
@@ -6968,21 +6987,21 @@ const BSItemCard = (props) => {
0) ||
- item?.ProductDetail?.some(
- (item) => item?.StockAvailable !== 'Y'
- )
+ item?.ProductDetail?.[0]?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ ) > 0) ||
+ item?.ProductDetail?.some(
+ (item) => item?.StockAvailable !== 'Y'
+ )
? 'card4Main card4Main-active'
: 'card4Main card4Main-deactive'
}
@@ -7005,17 +7024,17 @@ const BSItemCard = (props) => {
if (
!(
(item?.OverAllQty !== undefined &&
- !preferenceSingleSales
+ !preferenceSingleSales
? returnCount(
- item?.ProductDetail?.[0]?.ProdName,
- item?.OverAllQty,
- CartOrderDetails
- )
+ item?.ProductDetail?.[0]?.ProdName,
+ item?.OverAllQty,
+ CartOrderDetails
+ )
: returnOnepcCount(
- item?.ProductDetail?.[0]?.ProdName,
- item?.OverAllPcs,
- CartOrderDetails
- ) > 0) ||
+ item?.ProductDetail?.[0]?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ ) > 0) ||
item?.ProductDetail?.some(
(item) => item?.StockAvailable !== 'Y'
)
@@ -7030,8 +7049,8 @@ const BSItemCard = (props) => {
CardOnclick(
item,
item?.OnePcsAvailable === 'Y' &&
- preferenceSingleSales &&
- 'OnePeiceProduct'
+ preferenceSingleSales &&
+ 'OnePeiceProduct'
);
// This will trigger if you're clicking outside the "One Piece" button
}
@@ -7073,7 +7092,7 @@ const BSItemCard = (props) => {
height={60}
src={
item?.ProductDetail?.[0]?.ProdLogo ===
- ''
+ ''
? defaultimage
: item?.ProductDetail?.[0]?.ProdLogo
? item?.ProductDetail?.[0]?.ProdLogo
@@ -7088,21 +7107,21 @@ const BSItemCard = (props) => {
{item?.ProdName}
{(item?.OverAllQty !== undefined &&
- !preferenceSingleSales
+ !preferenceSingleSales
? returnCount(
- item?.ProductDetail?.[0]?.ProdName,
- item?.OverAllQty,
- CartOrderDetails,
- item
- )
+ item?.ProductDetail?.[0]?.ProdName,
+ item?.OverAllQty,
+ CartOrderDetails,
+ item
+ )
: returnOnepcCount(
- item?.ProductDetail?.[0]?.ProdName,
- item?.OverAllPcs,
- CartOrderDetails
- ) > 0) ||
- item?.ProductDetail?.some(
- (item) => item?.StockAvailable !== 'Y'
- ) ? (
+ item?.ProductDetail?.[0]?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ ) > 0) ||
+ item?.ProductDetail?.some(
+ (item) => item?.StockAvailable !== 'Y'
+ ) ? (
''
) : (
{
)}
{((item?.OverAllQty !== undefined &&
- !preferenceSingleSales
+ !preferenceSingleSales
? returnCount(
- item?.ProductDetail?.[0]?.ProdName,
- item?.OverAllQty,
- CartOrderDetails,
- item
- )
+ item?.ProductDetail?.[0]?.ProdName,
+ item?.OverAllQty,
+ CartOrderDetails,
+ item
+ )
: returnOnepcCount(
- item?.ProductDetail?.[0]?.ProdName,
- item?.OverAllPcs,
- CartOrderDetails
- ) > 0) ||
+ item?.ProductDetail?.[0]?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ ) > 0) ||
item?.ProductDetail?.some(
(item) => item?.StockAvailable !== 'Y'
)) && (
-
-
- ₹ {ItemSellingPrice(item)}
-
+
+
+ ₹ {ItemSellingPrice(item)}
+
-
- <>
- ({ItemSize(item)} {ItemUomName(item)})
- >
+
+ <>
+ ({ItemSize(item)} {ItemUomName(item)})
+ >
+
-
- )}
+ )}
{/* Stock Count Badge */}
@@ -7168,17 +7187,17 @@ const BSItemCard = (props) => {
count={
!preferenceSingleSales
? returnCount(
- item?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllQty,
- CartOrderDetails
- )
+ item?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllQty,
+ CartOrderDetails
+ )
: returnOnepcCount(
- item?.ProductDetail?.[0]
- ?.ProdName,
- item?.OverAllPcs,
- CartOrderDetails
- )
+ item?.ProductDetail?.[0]
+ ?.ProdName,
+ item?.OverAllPcs,
+ CartOrderDetails
+ )
}
overflowCount={10000}
>
@@ -7227,13 +7246,13 @@ const BSItemCard = (props) => {
item?.OverAllPcs,
CartOrderDetails
) > 0 ||
- item?.ProductDetail?.some(
- (product) =>
- product?.StockAvailable !== 'Y'
- )
+ item?.ProductDetail?.some(
+ (product) =>
+ product?.StockAvailable !== 'Y'
+ )
? cardFunction?.Background
? SelectedCardColor?.BackgroundColor ||
- '#000000'
+ '#000000'
: '#fff'
: '#ff4d4f',
}}
@@ -7624,16 +7643,16 @@ const BSItemCard = (props) => {
]?.ProdVariantName?.toLowerCase()?.includes(
'variant'
) && (
-
- (
- {
- qtydata?.ProductDetail?.[QtyIndex]
- ?.ProdVariantDetails?.[VarientIndex]
- ?.ProdVariantName
- }
- ){' '}
-
- )}
+
+ (
+ {
+ qtydata?.ProductDetail?.[QtyIndex]
+ ?.ProdVariantDetails?.[VarientIndex]
+ ?.ProdVariantName
+ }
+ ){' '}
+
+ )}
diff --git a/src/utils/calculations.js b/src/utils/calculations.js
new file mode 100644
index 0000000..8643d30
--- /dev/null
+++ b/src/utils/calculations.js
@@ -0,0 +1,5 @@
+export const calculateOverAllQtyLimit = (orders) => {
+ return orders?.reduce((acc, cartItem) => {
+ return acc + (cartItem?.OrderQty || 0);
+ }, 0)
+}
\ No newline at end of file