Merge pull request 'Constrain quantityFix' (#166) from quantityFix into main
Reviewed-on: Pozomind/pozo-retail-app#166
This commit is contained in:
commit
f1e8442872
|
|
@ -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>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
||||||
import { Popconfirm, Tooltip } from 'antd';
|
import { Popconfirm, Tooltip } from 'antd';
|
||||||
import { AiOutlineClose, AiFillDelete } from 'react-icons/ai';
|
import { AiOutlineClose, AiFillDelete } from 'react-icons/ai';
|
||||||
|
|
@ -79,6 +79,8 @@ import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
|
||||||
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
|
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
|
||||||
import { useUtilsComponent } from '../../../../../Services/utils.js';
|
import { useUtilsComponent } from '../../../../../Services/utils.js';
|
||||||
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
|
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
|
||||||
|
import { Messages } from '../../../../../../ownLib/my-ui-lib.js';
|
||||||
|
|
||||||
const BsBill = () => {
|
const BsBill = () => {
|
||||||
const { removeExtraCharge } = useUtilsComponent();
|
const { removeExtraCharge } = useUtilsComponent();
|
||||||
|
|
@ -108,6 +110,8 @@ const BsBill = () => {
|
||||||
setting?.SettingValue === 'Y'
|
setting?.SettingValue === 'Y'
|
||||||
);
|
);
|
||||||
const [count, setCount] = useState(1);
|
const [count, setCount] = useState(1);
|
||||||
|
const [messageType, setMessageType] = useState(null);
|
||||||
|
const [messageData, setMessageData] = useState(null);
|
||||||
const [EditQuantity, setEditQuantity] = useState(false);
|
const [EditQuantity, setEditQuantity] = useState(false);
|
||||||
const [Modaldata, setModaldata] = useState([]);
|
const [Modaldata, setModaldata] = useState([]);
|
||||||
const TableData = useSelector(GlobalOrderCardDetails);
|
const TableData = useSelector(GlobalOrderCardDetails);
|
||||||
|
|
@ -141,6 +145,14 @@ const BsBill = () => {
|
||||||
const OrderType = useSelector(GlobalOrderType);
|
const OrderType = useSelector(GlobalOrderType);
|
||||||
const GlobEstBooking = useSelector(GlobalEstimateBooking);
|
const GlobEstBooking = useSelector(GlobalEstimateBooking);
|
||||||
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
|
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
|
||||||
|
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 OtherServicesglobal = useSelector(GlobalOtherSevices);
|
const OtherServicesglobal = useSelector(GlobalOtherSevices);
|
||||||
|
|
||||||
|
|
@ -2123,8 +2135,22 @@ const BsBill = () => {
|
||||||
const handleEditQuantityCancel = () => {
|
const handleEditQuantityCancel = () => {
|
||||||
setEditQuantity(false);
|
setEditQuantity(false);
|
||||||
};
|
};
|
||||||
|
const onComplete = useCallback(() => {
|
||||||
|
setMessageData(null);
|
||||||
|
setMessageType(null);
|
||||||
|
}, []);
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(TableData);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||||
|
setMessageType('warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const OtherOrderDatas = TableData?.filter(
|
const OtherOrderDatas = TableData?.filter(
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
!(
|
!(
|
||||||
|
|
@ -3049,6 +3075,11 @@ const BsBill = () => {
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div className="BSBillingTable5-billtable">
|
<div className="BSBillingTable5-billtable">
|
||||||
|
<Messages
|
||||||
|
messageType={messageType}
|
||||||
|
messageData={messageData}
|
||||||
|
onComplete={onComplete}
|
||||||
|
/>
|
||||||
<table className="BSBillingTable5-tablediv">
|
<table className="BSBillingTable5-tablediv">
|
||||||
<thead className="BSBillingTable5-thead">
|
<thead className="BSBillingTable5-thead">
|
||||||
<tr
|
<tr
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ import {
|
||||||
import { Global_PromoCodeOffers } from '../../../../Features/Offer/Offer.js';
|
import { Global_PromoCodeOffers } from '../../../../Features/Offer/Offer.js';
|
||||||
import { validateOffers } from '../BSItemCards/ValidateOffer.jsx';
|
import { validateOffers } from '../BSItemCards/ValidateOffer.jsx';
|
||||||
import { useSaleswiseOfferWatcher } from '../BSItemCards/SalesWiseOffer.jsx';
|
import { useSaleswiseOfferWatcher } from '../BSItemCards/SalesWiseOffer.jsx';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../../utils/calculations.js';
|
||||||
const ExpireConfirmModal = lazy(
|
const ExpireConfirmModal = lazy(
|
||||||
() => import('../BookingFunctionality/ExpireConfirmModal.jsx')
|
() => import('../BookingFunctionality/ExpireConfirmModal.jsx')
|
||||||
);
|
);
|
||||||
|
|
@ -132,6 +133,13 @@ export default function BSC1Search(props) {
|
||||||
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
||||||
useSaleswiseOfferWatcher();
|
useSaleswiseOfferWatcher();
|
||||||
const preferenceDatas = useSelector(PreferenceData);
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
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'
|
||||||
|
|
@ -703,7 +711,7 @@ export default function BSC1Search(props) {
|
||||||
WithoutTaxRate:
|
WithoutTaxRate:
|
||||||
availableFreeQty * item.OrderRate -
|
availableFreeQty * item.OrderRate -
|
||||||
(availableFreeQty * item.OrderRate * item.TaxPercentage) /
|
(availableFreeQty * item.OrderRate * item.TaxPercentage) /
|
||||||
100,
|
100,
|
||||||
Offer: availableFreeQty * item.OrderRate,
|
Offer: availableFreeQty * item.OrderRate,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -752,7 +760,7 @@ export default function BSC1Search(props) {
|
||||||
((existingPaidItem.OrderQty + excessQty) *
|
((existingPaidItem.OrderQty + excessQty) *
|
||||||
item.OrderRate *
|
item.OrderRate *
|
||||||
item.TaxPercentage) /
|
item.TaxPercentage) /
|
||||||
100,
|
100,
|
||||||
};
|
};
|
||||||
|
|
||||||
ModifiedData.push(mergedPaidItem);
|
ModifiedData.push(mergedPaidItem);
|
||||||
|
|
@ -787,7 +795,7 @@ export default function BSC1Search(props) {
|
||||||
data?.InwardDtlId === item?.InwardDtlId &&
|
data?.InwardDtlId === item?.InwardDtlId &&
|
||||||
data?.ProdId === item?.ProdId &&
|
data?.ProdId === item?.ProdId &&
|
||||||
data?.OfferMessage?.[0]?.OfferId ===
|
data?.OfferMessage?.[0]?.OfferId ===
|
||||||
item?.OfferMessage?.[0]?.OfferId
|
item?.OfferMessage?.[0]?.OfferId
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isAlreadyExists !== -1) {
|
if (isAlreadyExists !== -1) {
|
||||||
|
|
@ -807,11 +815,11 @@ export default function BSC1Search(props) {
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
WithoutTaxRate:
|
||||||
(ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
|
(ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
|
||||||
item.OrderRate -
|
item.OrderRate -
|
||||||
((ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
|
((ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
|
||||||
item.OrderRate *
|
item.OrderRate *
|
||||||
item.TaxPercentage) /
|
item.TaxPercentage) /
|
||||||
100,
|
100,
|
||||||
Offer:
|
Offer:
|
||||||
(ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
|
(ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
|
||||||
item.OrderRate,
|
item.OrderRate,
|
||||||
|
|
@ -837,10 +845,10 @@ export default function BSC1Search(props) {
|
||||||
const appliedOfferAlreadyExists = AppliedOffers.findIndex(
|
const appliedOfferAlreadyExists = AppliedOffers.findIndex(
|
||||||
(offer) =>
|
(offer) =>
|
||||||
offer?.FreeProductsList?.FreeProdId ===
|
offer?.FreeProductsList?.FreeProdId ===
|
||||||
matchingFreeProduct?.FreeProdId &&
|
matchingFreeProduct?.FreeProdId &&
|
||||||
offer?.TableName === matchingFreeProduct?.TableName &&
|
offer?.TableName === matchingFreeProduct?.TableName &&
|
||||||
offer?.TableUniqueName ===
|
offer?.TableUniqueName ===
|
||||||
matchingFreeProduct?.TableUniqueName &&
|
matchingFreeProduct?.TableUniqueName &&
|
||||||
offer?.OfferId === matchingFreeProduct?.OfferId &&
|
offer?.OfferId === matchingFreeProduct?.OfferId &&
|
||||||
offer?.OfferMode === matchingFreeProduct?.OfferMode &&
|
offer?.OfferMode === matchingFreeProduct?.OfferMode &&
|
||||||
offer?.FreeProductsList?.ProdVariantDetails?.[0]
|
offer?.FreeProductsList?.ProdVariantDetails?.[0]
|
||||||
|
|
@ -1169,7 +1177,7 @@ export default function BSC1Search(props) {
|
||||||
|
|
||||||
const getPreferenceStock = async () => {
|
const getPreferenceStock = async () => {
|
||||||
const PreferenceStckDtl = preferenceDatas?.[0]?.SettingDtlDetails;
|
const PreferenceStckDtl = preferenceDatas?.[0]?.SettingDtlDetails;
|
||||||
const StockPreference = PreferenceStckDtl.find(
|
const StockPreference = PreferenceStckDtl?.find(
|
||||||
(item) => item.SettingIdName === 'StockSelection'
|
(item) => item.SettingIdName === 'StockSelection'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1671,7 +1679,7 @@ export default function BSC1Search(props) {
|
||||||
<span
|
<span
|
||||||
style={
|
style={
|
||||||
record.StockCount > 0 ||
|
record.StockCount > 0 ||
|
||||||
record.StockCount === 'Stock Not Maintained'
|
record.StockCount === 'Stock Not Maintained'
|
||||||
? { color: '#000', cursor: 'pointer' }
|
? { color: '#000', cursor: 'pointer' }
|
||||||
: { color: '#f49898', cursor: 'not-allowed' }
|
: { color: '#f49898', cursor: 'not-allowed' }
|
||||||
}
|
}
|
||||||
|
|
@ -1701,7 +1709,7 @@ export default function BSC1Search(props) {
|
||||||
<span
|
<span
|
||||||
style={
|
style={
|
||||||
record.StockCount > 0 ||
|
record.StockCount > 0 ||
|
||||||
record.StockCount === 'Stock Not Maintained'
|
record.StockCount === 'Stock Not Maintained'
|
||||||
? { color: '#000', cursor: 'pointer' }
|
? { color: '#000', cursor: 'pointer' }
|
||||||
: { color: '#f49898', cursor: 'not-allowed' }
|
: { color: '#f49898', cursor: 'not-allowed' }
|
||||||
}
|
}
|
||||||
|
|
@ -1731,7 +1739,7 @@ export default function BSC1Search(props) {
|
||||||
<span
|
<span
|
||||||
style={
|
style={
|
||||||
record.StockCount > 0 ||
|
record.StockCount > 0 ||
|
||||||
record.StockCount === 'Stock Not Maintained'
|
record.StockCount === 'Stock Not Maintained'
|
||||||
? { color: '#000', cursor: 'pointer' }
|
? { color: '#000', cursor: 'pointer' }
|
||||||
: { color: '#f49898', cursor: 'not-allowed' }
|
: { color: '#f49898', cursor: 'not-allowed' }
|
||||||
}
|
}
|
||||||
|
|
@ -1895,11 +1903,11 @@ export default function BSC1Search(props) {
|
||||||
StockCount:
|
StockCount:
|
||||||
qtydata?.ProductDetail?.[0]?.StockAvailable === 'Y'
|
qtydata?.ProductDetail?.[0]?.StockAvailable === 'Y'
|
||||||
? returnVariantStock(
|
? returnVariantStock(
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdId,
|
qtydata?.ProductDetail?.[QtyIndex]?.ProdId,
|
||||||
item?.OverAllQty,
|
item?.OverAllQty,
|
||||||
CartOrderDetails,
|
CartOrderDetails,
|
||||||
item?.ProdVariantName
|
item?.ProdVariantName
|
||||||
)
|
)
|
||||||
: 'Stock Not Maintained',
|
: 'Stock Not Maintained',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -1915,17 +1923,17 @@ export default function BSC1Search(props) {
|
||||||
'Batch No': item?.BatchRef,
|
'Batch No': item?.BatchRef,
|
||||||
StockCount: onePeiceFlow
|
StockCount: onePeiceFlow
|
||||||
? returnCountStock(
|
? returnCountStock(
|
||||||
item?.ProdId,
|
item?.ProdId,
|
||||||
item?.BalanceQty,
|
item?.BalanceQty,
|
||||||
CartOrderDetails,
|
CartOrderDetails,
|
||||||
item?.InwardDtlId
|
item?.InwardDtlId
|
||||||
) * item?.NoOfPcs
|
) * item?.NoOfPcs
|
||||||
: returnCountStock(
|
: returnCountStock(
|
||||||
item?.ProdId,
|
item?.ProdId,
|
||||||
item?.BalanceQty,
|
item?.BalanceQty,
|
||||||
CartOrderDetails,
|
CartOrderDetails,
|
||||||
item?.InwardDtlId
|
item?.InwardDtlId
|
||||||
),
|
),
|
||||||
'Stock Date': StockDate(item?.InwardDate),
|
'Stock Date': StockDate(item?.InwardDate),
|
||||||
Price: onePeiceFlow ? item?.OnePcsPrice : item?.SellPrice,
|
Price: onePeiceFlow ? item?.OnePcsPrice : item?.SellPrice,
|
||||||
ExpDate:
|
ExpDate:
|
||||||
|
|
@ -1979,13 +1987,13 @@ export default function BSC1Search(props) {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||||
VarientIndex
|
VarientIndex
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||||
VarientIndex
|
VarientIndex
|
||||||
]?.StockDetails?.[0]?.SellPrice &&
|
]?.StockDetails?.[0]?.SellPrice &&
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1994,9 +2002,9 @@ export default function BSC1Search(props) {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||||
VarientIndex
|
VarientIndex
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
@ -2038,11 +2046,11 @@ export default function BSC1Search(props) {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[0]?.InwardDtlId &&
|
?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[0]?.SellPrice &&
|
?.StockDetails?.[0]?.SellPrice &&
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -2051,9 +2059,9 @@ export default function BSC1Search(props) {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||||
VarientIndex
|
VarientIndex
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
@ -2131,13 +2139,13 @@ export default function BSC1Search(props) {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||||
index.key
|
index.key
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||||
index.key
|
index.key
|
||||||
]?.StockDetails?.[0]?.SellPrice &&
|
]?.StockDetails?.[0]?.SellPrice &&
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -2145,11 +2153,11 @@ export default function BSC1Search(props) {
|
||||||
let Isincartonepc = CartOrderDetails?.filter(
|
let Isincartonepc = CartOrderDetails?.filter(
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId ===
|
cartItem?.ProdId ===
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||||
VarientIndex
|
VarientIndex
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
@ -2213,11 +2221,11 @@ export default function BSC1Search(props) {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]
|
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]
|
||||||
?.StockDetails?.[0]?.InwardDtlId &&
|
?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]
|
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]
|
||||||
?.StockDetails?.[0]?.SellPrice &&
|
?.StockDetails?.[0]?.SellPrice &&
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -2226,9 +2234,9 @@ export default function BSC1Search(props) {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||||
VarientIndex
|
VarientIndex
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
@ -2303,15 +2311,15 @@ export default function BSC1Search(props) {
|
||||||
let Isincart = CartOrderDetails?.find(
|
let Isincart = CartOrderDetails?.find(
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId ===
|
cartItem?.ProdId ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndex
|
item?.VarientIndex
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndex
|
item?.VarientIndex
|
||||||
]?.StockDetails?.[0]?.SellPrice &&
|
]?.StockDetails?.[0]?.SellPrice &&
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -2319,11 +2327,11 @@ export default function BSC1Search(props) {
|
||||||
let Isincartonepc = CartOrderDetails?.filter(
|
let Isincartonepc = CartOrderDetails?.filter(
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId ===
|
cartItem?.ProdId ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndexs
|
item?.VarientIndexs
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
@ -2401,15 +2409,15 @@ export default function BSC1Search(props) {
|
||||||
let Isincart = CartOrderDetails?.find(
|
let Isincart = CartOrderDetails?.find(
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId ===
|
cartItem?.ProdId ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndex
|
item?.VarientIndex
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndex
|
item?.VarientIndex
|
||||||
]?.StockDetails?.[0]?.SellPrice &&
|
]?.StockDetails?.[0]?.SellPrice &&
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -2417,11 +2425,11 @@ export default function BSC1Search(props) {
|
||||||
let Isincartonepc = CartOrderDetails?.filter(
|
let Isincartonepc = CartOrderDetails?.filter(
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId ===
|
cartItem?.ProdId ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndex
|
item?.VarientIndex
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||||
!cartItem?.SalesId
|
!cartItem?.SalesId
|
||||||
);
|
);
|
||||||
|
|
@ -2541,7 +2549,7 @@ export default function BSC1Search(props) {
|
||||||
const isKgsProduct =
|
const isKgsProduct =
|
||||||
(a?.ProductDetail?.[QtyIndex]?.UomName?.toLowerCase() === 'kgs' ||
|
(a?.ProductDetail?.[QtyIndex]?.UomName?.toLowerCase() === 'kgs' ||
|
||||||
a?.ProductDetail?.[QtyIndex]?.UomName?.toLowerCase() ===
|
a?.ProductDetail?.[QtyIndex]?.UomName?.toLowerCase() ===
|
||||||
'kg'?.toLowerCase()) &&
|
'kg'?.toLowerCase()) &&
|
||||||
a?.ProductDetail?.[QtyIndex]?.Size === '1';
|
a?.ProductDetail?.[QtyIndex]?.Size === '1';
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
@ -2554,11 +2562,11 @@ export default function BSC1Search(props) {
|
||||||
parseFloat(
|
parseFloat(
|
||||||
onePcs
|
onePcs
|
||||||
? (a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? (a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.OnePcsPrice /
|
?.StockDetails?.[stockIndex]?.OnePcsPrice /
|
||||||
1000) *
|
1000) *
|
||||||
(parseFloat(WeightScaleWeight) * 1000)
|
(parseFloat(WeightScaleWeight) * 1000)
|
||||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.SellPrice / 1000
|
?.StockDetails?.[stockIndex]?.SellPrice / 1000
|
||||||
) *
|
) *
|
||||||
(parseFloat(WeightScaleWeight) * 1000);
|
(parseFloat(WeightScaleWeight) * 1000);
|
||||||
let data = {
|
let data = {
|
||||||
|
|
@ -2614,9 +2622,9 @@ export default function BSC1Search(props) {
|
||||||
?.StockDetails?.[stockIndex]?.InwardId,
|
?.StockDetails?.[stockIndex]?.InwardId,
|
||||||
MRP: onePcs
|
MRP: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.MRP,
|
?.StockDetails?.[stockIndex]?.MRP,
|
||||||
FullProductIdentifierDtls:
|
FullProductIdentifierDtls:
|
||||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.ProductIdentifierDtls,
|
?.StockDetails?.[stockIndex]?.ProductIdentifierDtls,
|
||||||
|
|
@ -2724,19 +2732,19 @@ export default function BSC1Search(props) {
|
||||||
?.StockDetails?.[stockIndex]?.InwardId,
|
?.StockDetails?.[stockIndex]?.InwardId,
|
||||||
MRP: onePcs
|
MRP: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.MRP,
|
?.StockDetails?.[stockIndex]?.MRP,
|
||||||
OrderRate: onePcs
|
OrderRate: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||||
SellingPrice: onePcs
|
SellingPrice: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||||
SuppId:
|
SuppId:
|
||||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.SuppId,
|
?.StockDetails?.[stockIndex]?.SuppId,
|
||||||
|
|
@ -2819,6 +2827,18 @@ export default function BSC1Search(props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const AddOrderDetails = async (item) => {
|
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) {
|
if (preOrder) {
|
||||||
await handlePreOrder(item);
|
await handlePreOrder(item);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2909,15 +2929,15 @@ export default function BSC1Search(props) {
|
||||||
|
|
||||||
const isExistsInFreeProdList = hasOffer
|
const isExistsInFreeProdList = hasOffer
|
||||||
? FreeProdList?.filter(
|
? FreeProdList?.filter(
|
||||||
(f) =>
|
(f) =>
|
||||||
f?.FreeProdId === item?.ProdId &&
|
f?.FreeProdId === item?.ProdId &&
|
||||||
f?.ProdVariantDetails?.some((variant) =>
|
f?.ProdVariantDetails?.some((variant) =>
|
||||||
variant?.StockDetails?.some(
|
variant?.StockDetails?.some(
|
||||||
(stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
|
(stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
|
||||||
)
|
)
|
||||||
) &&
|
) &&
|
||||||
f?.RemainingQty > 0
|
f?.RemainingQty > 0
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const calculateTaxAmounts = (qty, rate, taxPercentage) => {
|
const calculateTaxAmounts = (qty, rate, taxPercentage) => {
|
||||||
|
|
@ -2984,10 +3004,10 @@ export default function BSC1Search(props) {
|
||||||
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||||
? true
|
? true
|
||||||
: cartItem?.OfferMode !== 'B') &&
|
: cartItem?.OfferMode !== 'B') &&
|
||||||
cartItem?.OfferMode !== 'P' &&
|
cartItem?.OfferMode !== 'P' &&
|
||||||
cartItem?.OfferMode !== 'C' &&
|
cartItem?.OfferMode !== 'C' &&
|
||||||
cartItem?.OfferMode !== 'O' &&
|
cartItem?.OfferMode !== 'O' &&
|
||||||
cartItem?.OfferMode !== 'L'
|
cartItem?.OfferMode !== 'L'
|
||||||
? true
|
? true
|
||||||
: cartItem?.Offer === 0)
|
: cartItem?.Offer === 0)
|
||||||
);
|
);
|
||||||
|
|
@ -3004,10 +3024,10 @@ export default function BSC1Search(props) {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
itemMatchCondition(cartItem) &&
|
itemMatchCondition(cartItem) &&
|
||||||
(cartItem?.OfferMode !== 'B' &&
|
(cartItem?.OfferMode !== 'B' &&
|
||||||
cartItem?.OfferMode !== 'P' &&
|
cartItem?.OfferMode !== 'P' &&
|
||||||
cartItem?.OfferMode !== 'C' &&
|
cartItem?.OfferMode !== 'C' &&
|
||||||
cartItem?.OfferMode !== 'O' &&
|
cartItem?.OfferMode !== 'O' &&
|
||||||
cartItem?.OfferMode !== 'L'
|
cartItem?.OfferMode !== 'L'
|
||||||
? true
|
? true
|
||||||
: cartItem?.Offer === 0)
|
: cartItem?.Offer === 0)
|
||||||
);
|
);
|
||||||
|
|
@ -3021,10 +3041,10 @@ export default function BSC1Search(props) {
|
||||||
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||||
? true
|
? true
|
||||||
: cartItem?.OfferMode !== 'B') &&
|
: cartItem?.OfferMode !== 'B') &&
|
||||||
cartItem?.OfferMode !== 'P' &&
|
cartItem?.OfferMode !== 'P' &&
|
||||||
cartItem?.OfferMode !== 'L' &&
|
cartItem?.OfferMode !== 'L' &&
|
||||||
cartItem?.OfferMode !== 'C' &&
|
cartItem?.OfferMode !== 'C' &&
|
||||||
cartItem?.OfferMode !== 'O'
|
cartItem?.OfferMode !== 'O'
|
||||||
? true
|
? true
|
||||||
: cartItem?.Offer === 0)
|
: cartItem?.Offer === 0)
|
||||||
)
|
)
|
||||||
|
|
@ -3035,10 +3055,10 @@ export default function BSC1Search(props) {
|
||||||
!(
|
!(
|
||||||
itemMatchCondition(cartItem) &&
|
itemMatchCondition(cartItem) &&
|
||||||
(cartItem?.OfferMode !== 'B' &&
|
(cartItem?.OfferMode !== 'B' &&
|
||||||
cartItem?.OfferMode !== 'P' &&
|
cartItem?.OfferMode !== 'P' &&
|
||||||
cartItem?.OfferMode !== 'L' &&
|
cartItem?.OfferMode !== 'L' &&
|
||||||
cartItem?.OfferMode !== 'C' &&
|
cartItem?.OfferMode !== 'C' &&
|
||||||
cartItem?.OfferMode !== 'O'
|
cartItem?.OfferMode !== 'O'
|
||||||
? true
|
? true
|
||||||
: cartItem?.Offer === 0)
|
: cartItem?.Offer === 0)
|
||||||
)
|
)
|
||||||
|
|
@ -3111,8 +3131,8 @@ export default function BSC1Search(props) {
|
||||||
isItemInCart,
|
isItemInCart,
|
||||||
item?.OtherProduct === 'Others' || item?.ScaleType === 'weight'
|
item?.OtherProduct === 'Others' || item?.ScaleType === 'weight'
|
||||||
? (
|
? (
|
||||||
(item?.OrderQty || 0) + parseFloat(isItemInCart?.OrderQty)
|
(item?.OrderQty || 0) + parseFloat(isItemInCart?.OrderQty)
|
||||||
)?.toFixed(3)
|
)?.toFixed(3)
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
const updatedData = addFirst
|
const updatedData = addFirst
|
||||||
|
|
@ -3239,9 +3259,9 @@ export default function BSC1Search(props) {
|
||||||
isItemInCartHold,
|
isItemInCartHold,
|
||||||
item?.OtherProduct === 'Others' || item?.ScaleType === 'weight'
|
item?.OtherProduct === 'Others' || item?.ScaleType === 'weight'
|
||||||
? (
|
? (
|
||||||
(item?.OrderQty || 0) +
|
(item?.OrderQty || 0) +
|
||||||
parseFloat(isItemInCartHold?.OrderQty)
|
parseFloat(isItemInCartHold?.OrderQty)
|
||||||
)?.toFixed(3)
|
)?.toFixed(3)
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
const updatedData = addFirst
|
const updatedData = addFirst
|
||||||
|
|
@ -3493,14 +3513,14 @@ export default function BSC1Search(props) {
|
||||||
updatedCartData = cartData.map((item, idx) =>
|
updatedCartData = cartData.map((item, idx) =>
|
||||||
idx === indexToCheck
|
idx === indexToCheck
|
||||||
? {
|
? {
|
||||||
...item,
|
...item,
|
||||||
Offer: null,
|
Offer: null,
|
||||||
OfferMessage: undefined,
|
OfferMessage: undefined,
|
||||||
OfferMode: undefined,
|
OfferMode: undefined,
|
||||||
OfferModeType: false,
|
OfferModeType: false,
|
||||||
OfferType: undefined,
|
OfferType: undefined,
|
||||||
OfferValue: null,
|
OfferValue: null,
|
||||||
}
|
}
|
||||||
: item
|
: item
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -3551,8 +3571,8 @@ export default function BSC1Search(props) {
|
||||||
...item,
|
...item,
|
||||||
Offer:
|
Offer:
|
||||||
sameProduct ||
|
sameProduct ||
|
||||||
bestOffer?.OfferMode === 'I' ||
|
bestOffer?.OfferMode === 'I' ||
|
||||||
bestOffer?.OfferMode === 'Q'
|
bestOffer?.OfferMode === 'Q'
|
||||||
? bestOffer?.OfferAmount || item.Offer
|
? bestOffer?.OfferAmount || item.Offer
|
||||||
: item.Offer || bestOffer?.OfferAmount,
|
: item.Offer || bestOffer?.OfferAmount,
|
||||||
OfferType: item?.OfferType || bestOffer?.OfferType,
|
OfferType: item?.OfferType || bestOffer?.OfferType,
|
||||||
|
|
@ -3569,10 +3589,10 @@ export default function BSC1Search(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);
|
||||||
|
|
||||||
|
|
@ -3880,10 +3900,10 @@ export default function BSC1Search(props) {
|
||||||
return FreeProdList.map((f, i) =>
|
return FreeProdList.map((f, i) =>
|
||||||
i === index
|
i === index
|
||||||
? {
|
? {
|
||||||
...existing,
|
...existing,
|
||||||
...newFreeProd,
|
...newFreeProd,
|
||||||
ProdVariantDetails: existing.ProdVariantDetails,
|
ProdVariantDetails: existing.ProdVariantDetails,
|
||||||
}
|
}
|
||||||
: f
|
: f
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -3953,7 +3973,7 @@ export default function BSC1Search(props) {
|
||||||
const cycleSize = buyQty + getQty;
|
const cycleSize = buyQty + getQty;
|
||||||
const fullCycles = Math.floor(
|
const fullCycles = Math.floor(
|
||||||
freeCartItem?.reduce((acc, fc) => acc + (fc?.OrderQty || 0), 0) /
|
freeCartItem?.reduce((acc, fc) => acc + (fc?.OrderQty || 0), 0) /
|
||||||
cycleSize
|
cycleSize
|
||||||
);
|
);
|
||||||
const totalFreeQty = fullCycles * getQty;
|
const totalFreeQty = fullCycles * getQty;
|
||||||
|
|
||||||
|
|
@ -4557,15 +4577,15 @@ export default function BSC1Search(props) {
|
||||||
{option.ProductDetail?.filter(
|
{option.ProductDetail?.filter(
|
||||||
(item) => item.OnePcsAvailable == 'Y'
|
(item) => item.OnePcsAvailable == 'Y'
|
||||||
).length !== 0 && (
|
).length !== 0 && (
|
||||||
<GoTriangleRight
|
<GoTriangleRight
|
||||||
style={{
|
style={{
|
||||||
fontSize: '25px',
|
fontSize: '25px',
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOnePeiceFlow(true);
|
setOnePeiceFlow(true);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
|
|
@ -4599,7 +4619,7 @@ export default function BSC1Search(props) {
|
||||||
|
|
||||||
<FiSearch
|
<FiSearch
|
||||||
className="BSC1Search-searchicon"
|
className="BSC1Search-searchicon"
|
||||||
// onClick={() => OnfocusTrue()}
|
// onClick={() => OnfocusTrue()}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{ProductSearch?.length > 5 &&
|
{ProductSearch?.length > 5 &&
|
||||||
|
|
@ -4695,8 +4715,8 @@ export default function BSC1Search(props) {
|
||||||
<img
|
<img
|
||||||
src={
|
src={
|
||||||
item?.ProdLogo &&
|
item?.ProdLogo &&
|
||||||
item?.ProdLogo != null &&
|
item?.ProdLogo != null &&
|
||||||
item?.ProdLogo != undefined
|
item?.ProdLogo != undefined
|
||||||
? item?.ProdLogo
|
? item?.ProdLogo
|
||||||
: defaultimage
|
: defaultimage
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { Drawer } from 'antd';
|
import { Drawer, message } from 'antd';
|
||||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||||
import {
|
import {
|
||||||
changeKioskPageName,
|
changeKioskPageName,
|
||||||
|
|
@ -16,10 +16,12 @@ import {
|
||||||
GlobalBookingTypeKiosk,
|
GlobalBookingTypeKiosk,
|
||||||
} from '../../../Features/BookingScreen/BookingData/KioskBookingData';
|
} from '../../../Features/BookingScreen/BookingData/KioskBookingData';
|
||||||
import horizontal from '../../../Images/defaultItemImg.png';
|
import horizontal from '../../../Images/defaultItemImg.png';
|
||||||
import { getConfigType } from '../../../Features/BookingScreen/BookingData/BookingData';
|
import { getConfigType, PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations.js';
|
||||||
|
|
||||||
const CardPage1 = (props) => {
|
const CardPage1 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||||
|
|
@ -35,7 +37,13 @@ const CardPage1 = (props) => {
|
||||||
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||||
(i) => i.SettingIdName === 'PrintUom'
|
(i) => i.SettingIdName === 'PrintUom'
|
||||||
)?.[0];
|
)?.[0];
|
||||||
|
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;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getBookingTypeId();
|
getBookingTypeId();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -49,6 +57,15 @@ const CardPage1 = (props) => {
|
||||||
//Card on click function
|
//Card on click function
|
||||||
|
|
||||||
const CardOnClick = async (item, Parameter) => {
|
const CardOnClick = async (item, Parameter) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||||
|
|
||||||
const transformedItem = {
|
const transformedItem = {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { Drawer } from 'antd';
|
import { Drawer, message } from 'antd';
|
||||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||||
import {
|
import {
|
||||||
changeKioskPageName,
|
changeKioskPageName,
|
||||||
|
|
@ -15,10 +15,12 @@ import {
|
||||||
changeKioskOrderDetails,
|
changeKioskOrderDetails,
|
||||||
} from '../../../Features/BookingScreen/BookingData/KioskBookingData';
|
} from '../../../Features/BookingScreen/BookingData/KioskBookingData';
|
||||||
import horizontal from '../../../Images/defaultItemImg.png';
|
import horizontal from '../../../Images/defaultItemImg.png';
|
||||||
import { getConfigType } from '../../../Features/BookingScreen/BookingData/BookingData';
|
import { getConfigType, PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations.js';
|
||||||
|
|
||||||
const CardPage2 = (props) => {
|
const CardPage2 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||||
|
|
@ -35,6 +37,13 @@ const CardPage2 = (props) => {
|
||||||
(i) => i.SettingIdName === 'PrintUom'
|
(i) => i.SettingIdName === 'PrintUom'
|
||||||
)?.[0];
|
)?.[0];
|
||||||
|
|
||||||
|
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;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getBookingTypeId();
|
getBookingTypeId();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -48,6 +57,16 @@ const CardPage2 = (props) => {
|
||||||
//Card on click function
|
//Card on click function
|
||||||
|
|
||||||
const CardOnClick = async (item, Parameter) => {
|
const CardOnClick = async (item, Parameter) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||||
|
|
||||||
const transformedItem = {
|
const transformedItem = {
|
||||||
|
|
@ -81,11 +100,11 @@ const CardPage2 = (props) => {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId &&
|
cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||||
?.InwardDtlId &&
|
?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||||
?.SellPrice
|
?.SellPrice
|
||||||
);
|
);
|
||||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||||
if (Isincart?.BalanceQty > Isincart?.OrderQty) {
|
if (Isincart?.BalanceQty > Isincart?.OrderQty) {
|
||||||
|
|
@ -131,13 +150,13 @@ const CardPage2 = (props) => {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
cartItem?.ProdId === qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndex
|
item?.VarientIndex
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndex
|
item?.VarientIndex
|
||||||
]?.StockDetails?.[0]?.SellPrice
|
]?.StockDetails?.[0]?.SellPrice
|
||||||
);
|
);
|
||||||
console.log(Isincart, item, KioskOrderDetails, 'IsincartsingleVarient');
|
console.log(Isincart, item, KioskOrderDetails, 'IsincartsingleVarient');
|
||||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||||
|
|
@ -236,7 +255,7 @@ const CardPage2 = (props) => {
|
||||||
SinglePc: onePcs ? 'Y' : 'N',
|
SinglePc: onePcs ? 'Y' : 'N',
|
||||||
NoOfPcs: onePcs
|
NoOfPcs: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.NoOfPcs
|
?.StockDetails?.[stockIndex]?.NoOfPcs
|
||||||
: null,
|
: null,
|
||||||
ProdVariantName:
|
ProdVariantName:
|
||||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
|
|
@ -261,14 +280,14 @@ const CardPage2 = (props) => {
|
||||||
?.StockDetails?.[stockIndex]?.InwardId,
|
?.StockDetails?.[stockIndex]?.InwardId,
|
||||||
MRP: onePcs
|
MRP: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.MRP,
|
?.StockDetails?.[stockIndex]?.MRP,
|
||||||
OrderRate: onePcs
|
OrderRate: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||||
SuppId:
|
SuppId:
|
||||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.SuppId,
|
?.StockDetails?.[stockIndex]?.SuppId,
|
||||||
|
|
@ -312,28 +331,28 @@ const CardPage2 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem.BookingTypeName === item.BookingTypeName
|
cartItem.BookingTypeName === item.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty + 1,
|
OrderQty: cartItem.OrderQty + 1,
|
||||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty + 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty + 1) *
|
((cartItem.OrderQty + 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty + 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -515,9 +534,9 @@ const CardPage2 = (props) => {
|
||||||
card?.OverAllQty,
|
card?.OverAllQty,
|
||||||
KioskOrderDetails
|
KioskOrderDetails
|
||||||
) > 0) ||
|
) > 0) ||
|
||||||
card?.ProductDetail?.some(
|
card?.ProductDetail?.some(
|
||||||
(item) => item?.StockAvailable !== 'Y'
|
(item) => item?.StockAvailable !== 'Y'
|
||||||
)
|
)
|
||||||
? 'CardPage2-container'
|
? 'CardPage2-container'
|
||||||
: 'CardPage2-container-dis '
|
: 'CardPage2-container-dis '
|
||||||
}
|
}
|
||||||
|
|
@ -540,9 +559,9 @@ const CardPage2 = (props) => {
|
||||||
card?.OverAllQty,
|
card?.OverAllQty,
|
||||||
KioskOrderDetails
|
KioskOrderDetails
|
||||||
) > 0) ||
|
) > 0) ||
|
||||||
card?.ProductDetail?.some(
|
card?.ProductDetail?.some(
|
||||||
(item) => item?.StockAvailable !== 'Y'
|
(item) => item?.StockAvailable !== 'Y'
|
||||||
) ? (
|
) ? (
|
||||||
''
|
''
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
|
|
@ -560,17 +579,17 @@ const CardPage2 = (props) => {
|
||||||
card?.ProductDetail?.some(
|
card?.ProductDetail?.some(
|
||||||
(item) => item?.StockAvailable !== 'Y'
|
(item) => item?.StockAvailable !== 'Y'
|
||||||
)) && (
|
)) && (
|
||||||
<p className="CardPage2-container-price">
|
<p className="CardPage2-container-price">
|
||||||
{' '}
|
{' '}
|
||||||
<span style={{ fontSize: '16px', fontFamily: 'gilroy' }}>
|
<span style={{ fontSize: '16px', fontFamily: 'gilroy' }}>
|
||||||
₹
|
₹
|
||||||
</span>
|
</span>
|
||||||
{ItemSellingPrice(card)}
|
{ItemSellingPrice(card)}
|
||||||
<span className="BSItemCard-itemCount">
|
<span className="BSItemCard-itemCount">
|
||||||
({ItemSize(card)} {ItemUomName(card)})
|
({ItemSize(card)} {ItemUomName(card)})
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
|
|
@ -723,7 +742,7 @@ const CardPage2 = (props) => {
|
||||||
KioskOrderDetails,
|
KioskOrderDetails,
|
||||||
item?.ProdVariantName
|
item?.ProdVariantName
|
||||||
) > 0 ||
|
) > 0 ||
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||||
'Y'
|
'Y'
|
||||||
? 'ProVariantCard'
|
? 'ProVariantCard'
|
||||||
: 'ProVariantCard-dis'
|
: 'ProVariantCard-dis'
|
||||||
|
|
@ -739,7 +758,7 @@ const CardPage2 = (props) => {
|
||||||
KioskOrderDetails,
|
KioskOrderDetails,
|
||||||
item?.ProdVariantName
|
item?.ProdVariantName
|
||||||
) > 0 ||
|
) > 0 ||
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||||
'Y' ? (
|
'Y' ? (
|
||||||
<div>₹ {item?.StockDetails?.[0]?.SellPrice}</div>
|
<div>₹ {item?.StockDetails?.[0]?.SellPrice}</div>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Drawer } from 'antd';
|
import { Drawer, message } from 'antd';
|
||||||
import { IoCheckmarkCircle } from 'react-icons/io5';
|
import { IoCheckmarkCircle } from 'react-icons/io5';
|
||||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||||
import defaultimage from '../../../Images/defaultItemImg.png';
|
import defaultimage from '../../../Images/defaultItemImg.png';
|
||||||
|
|
@ -14,10 +14,12 @@ import {
|
||||||
import { settingDataSelector } from '../../../Features/PreferenceMaster/PreferenceMaster.js';
|
import { settingDataSelector } from '../../../Features/PreferenceMaster/PreferenceMaster.js';
|
||||||
import horizontal from '../../../Images/defaultItemImg.png';
|
import horizontal from '../../../Images/defaultItemImg.png';
|
||||||
import { getKioskLightColour } from '../../../Features/Kiosk/kiosk';
|
import { getKioskLightColour } from '../../../Features/Kiosk/kiosk';
|
||||||
import { getConfigType } from '../../../Features/BookingScreen/BookingData/BookingData';
|
import { getConfigType, PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations.js';
|
||||||
|
|
||||||
const CardPage3 = (props) => {
|
const CardPage3 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
console.log(KioskOrderDetails, 'KioskOrderDetailsKioskOrderDetails');
|
console.log(KioskOrderDetails, 'KioskOrderDetailsKioskOrderDetails');
|
||||||
|
|
@ -35,6 +37,13 @@ const CardPage3 = (props) => {
|
||||||
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||||
(i) => i.SettingIdName === 'PrintUom'
|
(i) => i.SettingIdName === 'PrintUom'
|
||||||
)?.[0];
|
)?.[0];
|
||||||
|
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 onClose = () => {
|
const onClose = () => {
|
||||||
setopenQuantity(false);
|
setopenQuantity(false);
|
||||||
};
|
};
|
||||||
|
|
@ -47,6 +56,15 @@ const CardPage3 = (props) => {
|
||||||
}, []);
|
}, []);
|
||||||
//Card on click function
|
//Card on click function
|
||||||
const CardOnClick = async (item, Parameter) => {
|
const CardOnClick = async (item, Parameter) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||||
|
|
||||||
const transformedItem = {
|
const transformedItem = {
|
||||||
|
|
@ -80,11 +98,11 @@ const CardPage3 = (props) => {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId &&
|
cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||||
?.InwardDtlId &&
|
?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||||
?.SellPrice
|
?.SellPrice
|
||||||
);
|
);
|
||||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||||
if (Isincart?.BalanceQty > Isincart?.OrderQty) {
|
if (Isincart?.BalanceQty > Isincart?.OrderQty) {
|
||||||
|
|
@ -131,13 +149,13 @@ const CardPage3 = (props) => {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
cartItem?.ProdId === qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndex
|
item?.VarientIndex
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndex
|
item?.VarientIndex
|
||||||
]?.StockDetails?.[0]?.SellPrice
|
]?.StockDetails?.[0]?.SellPrice
|
||||||
);
|
);
|
||||||
console.log(Isincart, item, KioskOrderDetails, 'IsincartsingleVarient');
|
console.log(Isincart, item, KioskOrderDetails, 'IsincartsingleVarient');
|
||||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||||
|
|
@ -234,7 +252,7 @@ const CardPage3 = (props) => {
|
||||||
SinglePc: onePcs ? 'Y' : 'N',
|
SinglePc: onePcs ? 'Y' : 'N',
|
||||||
NoOfPcs: onePcs
|
NoOfPcs: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.NoOfPcs
|
?.StockDetails?.[stockIndex]?.NoOfPcs
|
||||||
: null,
|
: null,
|
||||||
ProdVariantName:
|
ProdVariantName:
|
||||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
|
|
@ -259,14 +277,14 @@ const CardPage3 = (props) => {
|
||||||
?.StockDetails?.[stockIndex]?.InwardId,
|
?.StockDetails?.[stockIndex]?.InwardId,
|
||||||
MRP: onePcs
|
MRP: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.MRP,
|
?.StockDetails?.[stockIndex]?.MRP,
|
||||||
OrderRate: onePcs
|
OrderRate: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||||
SuppId:
|
SuppId:
|
||||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.SuppId,
|
?.StockDetails?.[stockIndex]?.SuppId,
|
||||||
|
|
@ -310,28 +328,28 @@ const CardPage3 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem.BookingTypeName === item.BookingTypeName
|
cartItem.BookingTypeName === item.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty + 1,
|
OrderQty: cartItem.OrderQty + 1,
|
||||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty + 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty + 1) *
|
((cartItem.OrderQty + 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty + 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -516,9 +534,9 @@ const CardPage3 = (props) => {
|
||||||
card?.OverAllQty,
|
card?.OverAllQty,
|
||||||
KioskOrderDetails
|
KioskOrderDetails
|
||||||
) > 0) ||
|
) > 0) ||
|
||||||
card?.ProductDetail?.some(
|
card?.ProductDetail?.some(
|
||||||
(item) => item?.StockAvailable !== 'Y'
|
(item) => item?.StockAvailable !== 'Y'
|
||||||
)
|
)
|
||||||
? 'CardPage3-container'
|
? 'CardPage3-container'
|
||||||
: 'CardPage3-container-dis'
|
: 'CardPage3-container-dis'
|
||||||
}
|
}
|
||||||
|
|
@ -529,10 +547,10 @@ const CardPage3 = (props) => {
|
||||||
{KioskOrderDetails?.some(
|
{KioskOrderDetails?.some(
|
||||||
(item) => item?.ProdName === card?.ProdName
|
(item) => item?.ProdName === card?.ProdName
|
||||||
) && (
|
) && (
|
||||||
<div className="CardPage3-check-symbol">
|
<div className="CardPage3-check-symbol">
|
||||||
<IoCheckmarkCircle />
|
<IoCheckmarkCircle />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<img
|
<img
|
||||||
src={
|
src={
|
||||||
card?.ProductDetail?.[0]?.ProdLogo
|
card?.ProductDetail?.[0]?.ProdLogo
|
||||||
|
|
@ -548,9 +566,9 @@ const CardPage3 = (props) => {
|
||||||
card?.OverAllQty,
|
card?.OverAllQty,
|
||||||
KioskOrderDetails
|
KioskOrderDetails
|
||||||
) > 0) ||
|
) > 0) ||
|
||||||
card?.ProductDetail?.some(
|
card?.ProductDetail?.some(
|
||||||
(item) => item?.StockAvailable !== 'Y'
|
(item) => item?.StockAvailable !== 'Y'
|
||||||
) ? (
|
) ? (
|
||||||
''
|
''
|
||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
|
|
@ -568,13 +586,13 @@ const CardPage3 = (props) => {
|
||||||
card?.ProductDetail?.some(
|
card?.ProductDetail?.some(
|
||||||
(item) => item?.StockAvailable !== 'Y'
|
(item) => item?.StockAvailable !== 'Y'
|
||||||
)) && (
|
)) && (
|
||||||
<p className="CardPage3-container-price">
|
<p className="CardPage3-container-price">
|
||||||
₹{ItemSellingPrice(card)}
|
₹{ItemSellingPrice(card)}
|
||||||
<span className="BSItemCard-itemCount">
|
<span className="BSItemCard-itemCount">
|
||||||
({ItemSize(card)} {ItemUomName(card)})
|
({ItemSize(card)} {ItemUomName(card)})
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
|
|
@ -724,7 +742,7 @@ const CardPage3 = (props) => {
|
||||||
KioskOrderDetails,
|
KioskOrderDetails,
|
||||||
item?.ProdVariantName
|
item?.ProdVariantName
|
||||||
) > 0 ||
|
) > 0 ||
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||||
'Y'
|
'Y'
|
||||||
? 'ProVariantCard'
|
? 'ProVariantCard'
|
||||||
: 'ProVariantCard-dis'
|
: 'ProVariantCard-dis'
|
||||||
|
|
@ -740,7 +758,7 @@ const CardPage3 = (props) => {
|
||||||
KioskOrderDetails,
|
KioskOrderDetails,
|
||||||
item?.ProdVariantName
|
item?.ProdVariantName
|
||||||
) > 0 ||
|
) > 0 ||
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||||
'Y' ? (
|
'Y' ? (
|
||||||
<div>₹{item?.StockDetails?.[0]?.SellPrice}</div>
|
<div>₹{item?.StockDetails?.[0]?.SellPrice}</div>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { AiFillPlusCircle, AiFillMinusCircle } from 'react-icons/ai';
|
import { AiFillPlusCircle, AiFillMinusCircle } from 'react-icons/ai';
|
||||||
import { BsHandbag } from 'react-icons/bs';
|
import { BsHandbag } from 'react-icons/bs';
|
||||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||||
import { Drawer } from 'antd';
|
import { Drawer, message } from 'antd';
|
||||||
import '../../../Styles/Kiosk/CardPage/CardPage4.scss';
|
import '../../../Styles/Kiosk/CardPage/CardPage4.scss';
|
||||||
import {
|
import {
|
||||||
GlobalBookingTypeKiosk,
|
GlobalBookingTypeKiosk,
|
||||||
|
|
@ -14,10 +14,12 @@ import {
|
||||||
import { settingDataSelector } from '../../../Features/PreferenceMaster/PreferenceMaster.js';
|
import { settingDataSelector } from '../../../Features/PreferenceMaster/PreferenceMaster.js';
|
||||||
import horizontal from '../../../Images/defaultItemImg.png';
|
import horizontal from '../../../Images/defaultItemImg.png';
|
||||||
import { getKioskLightColour } from '../../../Features/Kiosk/kiosk';
|
import { getKioskLightColour } from '../../../Features/Kiosk/kiosk';
|
||||||
import { getConfigType } from '../../../Features/BookingScreen/BookingData/BookingData';
|
import { getConfigType, PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations.js';
|
||||||
|
|
||||||
const CardPage4 = (props) => {
|
const CardPage4 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
console.log(KioskOrderDetails, 'KioskOrderDetails');
|
console.log(KioskOrderDetails, 'KioskOrderDetails');
|
||||||
|
|
@ -36,7 +38,13 @@ const CardPage4 = (props) => {
|
||||||
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||||
(i) => i.SettingIdName === 'PrintUom'
|
(i) => i.SettingIdName === 'PrintUom'
|
||||||
)?.[0];
|
)?.[0];
|
||||||
|
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;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getBookingTypeId();
|
getBookingTypeId();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -79,6 +87,15 @@ const CardPage4 = (props) => {
|
||||||
//Card on click function
|
//Card on click function
|
||||||
|
|
||||||
const CardOnClick = async (item, Parameter) => {
|
const CardOnClick = async (item, Parameter) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||||
|
|
||||||
const transformedItem = {
|
const transformedItem = {
|
||||||
|
|
@ -112,11 +129,11 @@ const CardPage4 = (props) => {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId &&
|
cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||||
?.InwardDtlId &&
|
?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||||
?.SellPrice
|
?.SellPrice
|
||||||
);
|
);
|
||||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||||
if (Isincart?.BalanceQty > Isincart?.OrderQty) {
|
if (Isincart?.BalanceQty > Isincart?.OrderQty) {
|
||||||
|
|
@ -162,13 +179,13 @@ const CardPage4 = (props) => {
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
cartItem?.ProdId === qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
cartItem?.ProdId === qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||||
cartItem?.InwardDtlId ===
|
cartItem?.InwardDtlId ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndex
|
item?.VarientIndex
|
||||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||||
cartItem?.OrderRate ===
|
cartItem?.OrderRate ===
|
||||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||||
item?.VarientIndex
|
item?.VarientIndex
|
||||||
]?.StockDetails?.[0]?.SellPrice
|
]?.StockDetails?.[0]?.SellPrice
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||||
|
|
@ -259,7 +276,7 @@ const CardPage4 = (props) => {
|
||||||
SinglePc: onePcs ? 'Y' : 'N',
|
SinglePc: onePcs ? 'Y' : 'N',
|
||||||
NoOfPcs: onePcs
|
NoOfPcs: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.NoOfPcs
|
?.StockDetails?.[stockIndex]?.NoOfPcs
|
||||||
: null,
|
: null,
|
||||||
ProdVariantName:
|
ProdVariantName:
|
||||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
|
|
@ -284,14 +301,14 @@ const CardPage4 = (props) => {
|
||||||
?.StockDetails?.[stockIndex]?.InwardId,
|
?.StockDetails?.[stockIndex]?.InwardId,
|
||||||
MRP: onePcs
|
MRP: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.MRP,
|
?.StockDetails?.[stockIndex]?.MRP,
|
||||||
OrderRate: onePcs
|
OrderRate: onePcs
|
||||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||||
SuppId:
|
SuppId:
|
||||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||||
?.StockDetails?.[stockIndex]?.SuppId,
|
?.StockDetails?.[stockIndex]?.SuppId,
|
||||||
|
|
@ -335,28 +352,28 @@ const CardPage4 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty + 1,
|
OrderQty: cartItem.OrderQty + 1,
|
||||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty + 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty + 1) *
|
((cartItem.OrderQty + 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty + 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -583,9 +600,9 @@ const CardPage4 = (props) => {
|
||||||
card?.OverAllQty,
|
card?.OverAllQty,
|
||||||
KioskOrderDetails
|
KioskOrderDetails
|
||||||
) > 0) ||
|
) > 0) ||
|
||||||
card?.ProductDetail?.some(
|
card?.ProductDetail?.some(
|
||||||
(item) => item?.StockAvailable !== 'Y'
|
(item) => item?.StockAvailable !== 'Y'
|
||||||
) ? (
|
) ? (
|
||||||
<div
|
<div
|
||||||
className="CardPage4-addbutton"
|
className="CardPage4-addbutton"
|
||||||
onClick={() => CardOnClick(card)}
|
onClick={() => CardOnClick(card)}
|
||||||
|
|
@ -745,7 +762,7 @@ const CardPage4 = (props) => {
|
||||||
KioskOrderDetails,
|
KioskOrderDetails,
|
||||||
item?.ProdVariantName
|
item?.ProdVariantName
|
||||||
) > 0 ||
|
) > 0 ||
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||||
'Y'
|
'Y'
|
||||||
? 'ProVariantCard'
|
? 'ProVariantCard'
|
||||||
: 'ProVariantCard-dis'
|
: 'ProVariantCard-dis'
|
||||||
|
|
@ -761,7 +778,7 @@ const CardPage4 = (props) => {
|
||||||
KioskOrderDetails,
|
KioskOrderDetails,
|
||||||
item?.ProdVariantName
|
item?.ProdVariantName
|
||||||
) > 0 ||
|
) > 0 ||
|
||||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||||
'Y' ? (
|
'Y' ? (
|
||||||
<div>₹{item?.StockDetails?.[0]?.SellPrice} </div>
|
<div>₹{item?.StockDetails?.[0]?.SellPrice} </div>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useSelector, useDispatch } from 'react-redux';
|
import { useSelector, useDispatch } from 'react-redux';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { Skeleton } from 'antd';
|
import { Skeleton } from 'antd';
|
||||||
|
|
@ -70,6 +70,11 @@ const KioskBookingPage = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
dispatch(getPreferenceData({
|
||||||
|
CompId: SessionDtl?.CompId,
|
||||||
|
BranchId: SessionDtl?.BranchId,
|
||||||
|
AppId: SessionDtl?.AppId,
|
||||||
|
})).unwrap();
|
||||||
const queryParams = await getQueryParams();
|
const queryParams = await getQueryParams();
|
||||||
|
|
||||||
console.log('queryParams', queryParams);
|
console.log('queryParams', queryParams);
|
||||||
|
|
@ -143,7 +148,7 @@ const KioskBookingPage = () => {
|
||||||
responseData?.SessionId != null &&
|
responseData?.SessionId != null &&
|
||||||
responseData?.SessionId != undefined &&
|
responseData?.SessionId != undefined &&
|
||||||
sessionStore('SessionId', responseData?.SessionId);
|
sessionStore('SessionId', responseData?.SessionId);
|
||||||
responseData?.DeviceAddress != null &&
|
responseData?.DeviceAddress != null &&
|
||||||
responseData?.DeviceAddress != undefined &&
|
responseData?.DeviceAddress != undefined &&
|
||||||
sessionStore('DeviceAddress', MACAddress);
|
sessionStore('DeviceAddress', MACAddress);
|
||||||
sessionStore('hasRefreshed', true);
|
sessionStore('hasRefreshed', true);
|
||||||
|
|
@ -160,10 +165,12 @@ const KioskBookingPage = () => {
|
||||||
AppId: responseData?.AppId,
|
AppId: responseData?.AppId,
|
||||||
DeviceMacAddress: MACAddress
|
DeviceMacAddress: MACAddress
|
||||||
})).unwrap();
|
})).unwrap();
|
||||||
|
|
||||||
dispatch(getPreferenceData({ CompId: responseData?.CompId,
|
dispatch(getPreferenceData({
|
||||||
|
CompId: responseData?.CompId,
|
||||||
BranchId: responseData?.BranchId,
|
BranchId: responseData?.BranchId,
|
||||||
AppId: responseData?.AppId,})).unwrap();
|
AppId: responseData?.AppId,
|
||||||
|
})).unwrap();
|
||||||
dispatch(
|
dispatch(
|
||||||
getProductCategories({
|
getProductCategories({
|
||||||
CompId: responseData?.CompId,
|
CompId: responseData?.CompId,
|
||||||
|
|
@ -274,7 +281,7 @@ const KioskBookingPage = () => {
|
||||||
AppId: AppId,
|
AppId: AppId,
|
||||||
})
|
})
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
|
||||||
if (Response?.data?.statusCode == 1) {
|
if (Response?.data?.statusCode == 1) {
|
||||||
dispatch(
|
dispatch(
|
||||||
getProductCardListKiosk({
|
getProductCardListKiosk({
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,22 @@ import { changeKioskOrderDetails } from '../../../Features/BookingScreen/Booking
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
import '../../../Styles/Kiosk/OrderCart/OrderCart1.scss';
|
import '../../../Styles/Kiosk/OrderCart/OrderCart1.scss';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { message } from 'antd';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
|
||||||
const KisokOrderCart1 = (props) => {
|
const KisokOrderCart1 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
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 KioskOrderDetails = props?.KioskOrderDetails;
|
const KioskOrderDetails = props?.KioskOrderDetails;
|
||||||
const removeFromCart = async (item) => {
|
const removeFromCart = async (item) => {
|
||||||
await dispatch(
|
await dispatch(
|
||||||
|
|
@ -24,6 +37,15 @@ const KisokOrderCart1 = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
@ -31,28 +53,28 @@ const KisokOrderCart1 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty + 1,
|
OrderQty: cartItem.OrderQty + 1,
|
||||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty + 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty + 1) *
|
((cartItem.OrderQty + 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty + 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -76,28 +98,28 @@ const KisokOrderCart1 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty - 1,
|
OrderQty: cartItem.OrderQty - 1,
|
||||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty - 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty - 1) *
|
((cartItem.OrderQty - 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty - 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,22 @@ import '../../../Styles/Kiosk/OrderCart/OrderCart2.scss';
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
import { color } from 'highcharts';
|
import { color } from 'highcharts';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import { message } from 'antd';
|
||||||
|
|
||||||
const KisokOrderCart2 = (props) => {
|
const KisokOrderCart2 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
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 KioskOrderDetails = props?.KioskOrderDetails;
|
const KioskOrderDetails = props?.KioskOrderDetails;
|
||||||
|
|
||||||
const removeFromCart = async (item) => {
|
const removeFromCart = async (item) => {
|
||||||
|
|
@ -27,6 +40,16 @@ const KisokOrderCart2 = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
@ -34,28 +57,28 @@ const KisokOrderCart2 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty + 1,
|
OrderQty: cartItem.OrderQty + 1,
|
||||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty + 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty + 1) *
|
((cartItem.OrderQty + 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty + 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -79,28 +102,28 @@ const KisokOrderCart2 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem.BookingTypeName === item.BookingTypeName
|
cartItem.BookingTypeName === item.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty - 1,
|
OrderQty: cartItem.OrderQty - 1,
|
||||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty - 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty - 1) *
|
((cartItem.OrderQty - 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty - 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,22 @@ import {
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
import '../../../Styles/Kiosk/OrderCart/OrderCart3.scss';
|
import '../../../Styles/Kiosk/OrderCart/OrderCart3.scss';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
import { message } from 'antd';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
|
||||||
const KisokOrderCart3 = (props) => {
|
const KisokOrderCart3 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const getKioskDarkColourdata = useSelector(getKioskDarkColour);
|
const getKioskDarkColourdata = useSelector(getKioskDarkColour);
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
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 BookingTypeBoth = useSelector(GlobalKioskBookingTypeBoth);
|
const BookingTypeBoth = useSelector(GlobalKioskBookingTypeBoth);
|
||||||
const KioskOrderDetails = props?.KioskOrderDetails;
|
const KioskOrderDetails = props?.KioskOrderDetails;
|
||||||
|
|
||||||
|
|
@ -31,6 +43,15 @@ const KisokOrderCart3 = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
@ -38,28 +59,28 @@ const KisokOrderCart3 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty + 1,
|
OrderQty: cartItem.OrderQty + 1,
|
||||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty + 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty + 1) *
|
((cartItem.OrderQty + 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty + 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -81,28 +102,28 @@ const KisokOrderCart3 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty - 1,
|
OrderQty: cartItem.OrderQty - 1,
|
||||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty - 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty - 1) *
|
((cartItem.OrderQty - 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty - 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,9 @@ import KioskFooter3 from '../Components/KioskFooter3';
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
import '../../../Styles/Kiosk/OrderView/OrderView1.scss';
|
import '../../../Styles/Kiosk/OrderView/OrderView1.scss';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
import { message } from 'antd';
|
||||||
|
|
||||||
const OrderView1 = (props) => {
|
const OrderView1 = (props) => {
|
||||||
const KioskThemeData = props?.hasOwnProperty('KioskThemeData')
|
const KioskThemeData = props?.hasOwnProperty('KioskThemeData')
|
||||||
|
|
@ -24,6 +27,14 @@ const OrderView1 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
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 BackToCategory = async () => {
|
const BackToCategory = async () => {
|
||||||
await dispatch(changeKioskPageName('categoryPage'));
|
await dispatch(changeKioskPageName('categoryPage'));
|
||||||
|
|
@ -44,6 +55,17 @@ const OrderView1 = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
|
||||||
|
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
@ -51,28 +73,28 @@ const OrderView1 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty + 1,
|
OrderQty: cartItem.OrderQty + 1,
|
||||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty + 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty + 1) *
|
((cartItem.OrderQty + 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty + 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -96,28 +118,28 @@ const OrderView1 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty - 1,
|
OrderQty: cartItem.OrderQty - 1,
|
||||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty - 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty - 1) *
|
((cartItem.OrderQty - 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty - 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ import { IoMdClose } from 'react-icons/io';
|
||||||
import defaultImg from '../../../Images/defaultItemImg.png';
|
import defaultImg from '../../../Images/defaultItemImg.png';
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
import { message } from 'antd';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
|
||||||
const KioskOrderView2 = (props) => {
|
const KioskOrderView2 = (props) => {
|
||||||
console.log(props, 'propsprops');
|
console.log(props, 'propsprops');
|
||||||
|
|
@ -25,6 +28,15 @@ const KioskOrderView2 = (props) => {
|
||||||
? props['KioskThemeData']
|
? props['KioskThemeData']
|
||||||
: null;
|
: null;
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
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 KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||||
console.log(KioskOrderDetails, 'KioskOrderDetailsh');
|
console.log(KioskOrderDetails, 'KioskOrderDetailsh');
|
||||||
|
|
@ -54,6 +66,15 @@ const KioskOrderView2 = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
@ -61,28 +82,28 @@ const KioskOrderView2 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty + 1,
|
OrderQty: cartItem.OrderQty + 1,
|
||||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty + 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty + 1) *
|
((cartItem.OrderQty + 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty + 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -106,28 +127,28 @@ const KioskOrderView2 = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem.BookingTypeName === item.BookingTypeName
|
cartItem.BookingTypeName === item.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty - 1,
|
OrderQty: cartItem.OrderQty - 1,
|
||||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty - 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty - 1) *
|
((cartItem.OrderQty - 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty - 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ import {
|
||||||
import KioskFooter3 from '../Components/KioskFooter3';
|
import KioskFooter3 from '../Components/KioskFooter3';
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
import { message } from 'antd';
|
||||||
|
|
||||||
const KioskOrderView = (props) => {
|
const KioskOrderView = (props) => {
|
||||||
console.log(props, 'propsprops');
|
console.log(props, 'propsprops');
|
||||||
|
|
@ -27,6 +30,14 @@ const KioskOrderView = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
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 BackToCategory = async () => {
|
const BackToCategory = async () => {
|
||||||
await dispatch(changeKioskPageName('categoryPage'));
|
await dispatch(changeKioskPageName('categoryPage'));
|
||||||
|
|
@ -47,6 +58,16 @@ const KioskOrderView = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
@ -54,28 +75,28 @@ const KioskOrderView = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty + 1,
|
OrderQty: cartItem.OrderQty + 1,
|
||||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty + 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty + 1) *
|
((cartItem.OrderQty + 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty + 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -98,28 +119,28 @@ const KioskOrderView = (props) => {
|
||||||
cartItem // if the item is already in the cart, increase the quantity of the item
|
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||||
) =>
|
) =>
|
||||||
cartItem.ProdId === item.ProdId &&
|
cartItem.ProdId === item.ProdId &&
|
||||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||||
cartItem.OrderRate === item.OrderRate &&
|
cartItem.OrderRate === item.OrderRate &&
|
||||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||||
? {
|
? {
|
||||||
...cartItem,
|
...cartItem,
|
||||||
OrderQty: cartItem.OrderQty - 1,
|
OrderQty: cartItem.OrderQty - 1,
|
||||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||||
TaxAmt: (
|
TaxAmt: (
|
||||||
|
((cartItem.OrderQty - 1) *
|
||||||
|
cartItem.OrderRate *
|
||||||
|
cartItem.TaxPercentage) /
|
||||||
|
(100 + cartItem.TaxPercentage)
|
||||||
|
).toFixed(2),
|
||||||
|
WithoutTaxRate:
|
||||||
|
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||||
|
(
|
||||||
((cartItem.OrderQty - 1) *
|
((cartItem.OrderQty - 1) *
|
||||||
cartItem.OrderRate *
|
cartItem.OrderRate *
|
||||||
cartItem.TaxPercentage) /
|
cartItem.TaxPercentage) /
|
||||||
(100 + cartItem.TaxPercentage)
|
(100 + cartItem.TaxPercentage)
|
||||||
).toFixed(2),
|
).toFixed(2),
|
||||||
WithoutTaxRate:
|
}
|
||||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
|
||||||
(
|
|
||||||
((cartItem.OrderQty - 1) *
|
|
||||||
cartItem.OrderRate *
|
|
||||||
cartItem.TaxPercentage) /
|
|
||||||
(100 + cartItem.TaxPercentage)
|
|
||||||
).toFixed(2),
|
|
||||||
}
|
|
||||||
: cartItem // otherwise, return the cart item
|
: cartItem // otherwise, return the cart item
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -201,10 +222,10 @@ const KioskOrderView = (props) => {
|
||||||
{!item?.ProdVariantName?.toLowerCase().includes(
|
{!item?.ProdVariantName?.toLowerCase().includes(
|
||||||
'variant'
|
'variant'
|
||||||
) && (
|
) && (
|
||||||
<span style={{ color: 'black' }}>
|
<span style={{ color: 'black' }}>
|
||||||
{item?.ProdVariantName}{' '}
|
{item?.ProdVariantName}{' '}
|
||||||
</span>
|
</span>
|
||||||
)}{' '}
|
)}{' '}
|
||||||
{item?.Size}{' '}
|
{item?.Size}{' '}
|
||||||
{item?.SinglePc == 'Y' ? 'PCS' : item?.UomName}
|
{item?.SinglePc == 'Y' ? 'PCS' : item?.UomName}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { Form, Checkbox, Radio, Divider } from 'antd';
|
import { Form, Checkbox, Radio, Divider, InputNumber } from 'antd';
|
||||||
import { ArrowRightOutlined } from '@ant-design/icons';
|
import { ArrowRightOutlined } from '@ant-design/icons';
|
||||||
import FormHeader from '../PageComponents/FormHeader.jsx';
|
import FormHeader from '../PageComponents/FormHeader.jsx';
|
||||||
import Buttons from '../../Components/Forms/Buttons.jsx';
|
import Buttons from '../../Components/Forms/Buttons.jsx';
|
||||||
|
|
@ -57,68 +57,71 @@ const PreferenceList = () => {
|
||||||
const settingsList = tableValue[0]?.SettingDtlDetails ?? preferenceConfigs;
|
const settingsList = tableValue[0]?.SettingDtlDetails ?? preferenceConfigs;
|
||||||
|
|
||||||
const allSettingsMap = {};
|
const allSettingsMap = {};
|
||||||
settingsList?.forEach(({ SettingIdName, SettingValue }) => {
|
settingsList?.forEach(({ SettingIdName, SettingValue, SettingCount }) => {
|
||||||
allSettingsMap[SettingIdName?.toLowerCase()] = SettingValue;
|
allSettingsMap[SettingIdName?.toLowerCase()] = { value: SettingValue, count: SettingCount };
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(allSettingsMap, 'allSettingsMapallSettingsMapallSettingsMap');
|
console.log(settingsList, 'settingsList');
|
||||||
|
|
||||||
const buildInitialValues = () => ({
|
const buildInitialValues = () => ({
|
||||||
dashboard: allSettingsMap['dashboard'] === 'Y',
|
dashboard: allSettingsMap['dashboard']?.value === 'Y',
|
||||||
shortcutkeys: allSettingsMap['shortcutkeys'] === 'Y',
|
shortcutkeys: allSettingsMap['shortcutkeys']?.value === 'Y',
|
||||||
autoreceivestock: allSettingsMap['autoreceivestock'] === 'Y',
|
autoreceivestock: allSettingsMap['autoreceivestock']?.value === 'Y',
|
||||||
decimal: allSettingsMap['decimal'] === 'Y',
|
decimal: allSettingsMap['decimal']?.value === 'Y',
|
||||||
enabledModules: [
|
enabledModules: [
|
||||||
...(allSettingsMap['dinein'] === 'Y' ? ['dinein'] : []),
|
...(allSettingsMap['dinein']?.value === 'Y' ? ['dinein'] : []),
|
||||||
...(allSettingsMap['estimation'] === 'Y' ? ['estimation'] : []),
|
...(allSettingsMap['estimation']?.value === 'Y' ? ['estimation'] : []),
|
||||||
],
|
],
|
||||||
searchfocus: allSettingsMap['searchfocus'] === 'Y',
|
searchfocus: allSettingsMap['searchfocus']?.value === 'Y',
|
||||||
addproductcard: allSettingsMap['addproductcard'] === 'Y',
|
addproductcard: allSettingsMap['addproductcard']?.value === 'Y',
|
||||||
enabledFeatures: [
|
enabledFeatures: [
|
||||||
...(allSettingsMap['parking'] === 'Y' ? ['parking'] : []),
|
...(allSettingsMap['parking']?.value === 'Y' ? ['parking'] : []),
|
||||||
...(allSettingsMap['offer'] === 'Y' ? ['offer'] : []),
|
...(allSettingsMap['offer']?.value === 'Y' ? ['offer'] : []),
|
||||||
],
|
],
|
||||||
stockselection: allSettingsMap['stockselection'] === 'Y',
|
stockselection: allSettingsMap['stockselection']?.value === 'Y',
|
||||||
weightasquantity: allSettingsMap['weightasquantity'] === 'Y',
|
weightasquantity: allSettingsMap['weightasquantity']?.value === 'Y',
|
||||||
expiredselection: allSettingsMap['expiredselection'] === 'Y',
|
expiredselection: allSettingsMap['expiredselection']?.value === 'Y',
|
||||||
'sales mode': allSettingsMap['sales mode'] === 'Y',
|
'sales mode': allSettingsMap['sales mode']?.value === 'Y',
|
||||||
billitemsorder: allSettingsMap['billitemsorder'] === 'Y',
|
billitemsorder: allSettingsMap['billitemsorder']?.value === 'Y',
|
||||||
preorderpricechange: allSettingsMap['preorderpricechange'] === 'Y',
|
preorderpricechange: allSettingsMap['preorderpricechange']?.value === 'Y',
|
||||||
|
quantityrestriction: allSettingsMap['overalllimit']?.value === 'Y' || allSettingsMap['itemwiselimit']?.value === 'Y',
|
||||||
|
quantityrestrictiontype: allSettingsMap['overalllimit']?.value === 'Y' ? 'overall' : allSettingsMap['itemwiselimit']?.value === 'Y' ? 'itemwise' : 'overall',
|
||||||
|
maxquantity: allSettingsMap['overalllimit']?.value === 'Y' ? allSettingsMap['overalllimit']?.count || 1 : allSettingsMap['itemwiselimit']?.value === 'Y' ? allSettingsMap['itemwiselimit']?.count || 1 : 1,
|
||||||
billOption: ['whatsapp', 'sms', 'email'].some(
|
billOption: ['whatsapp', 'sms', 'email'].some(
|
||||||
(k) => allSettingsMap[k] === 'Y'
|
(k) => allSettingsMap[k]?.value === 'Y'
|
||||||
)
|
)
|
||||||
? 'pdf'
|
? 'pdf'
|
||||||
: 'print',
|
: 'print',
|
||||||
pdfSendOptions: ['whatsapp', 'email', 'sms'].filter(
|
pdfSendOptions: ['whatsapp', 'email', 'sms'].filter(
|
||||||
(k) => allSettingsMap[k] === 'Y'
|
(k) => allSettingsMap[k]?.value === 'Y'
|
||||||
),
|
),
|
||||||
tokenonly: allSettingsMap['tokenonly'] === 'Y',
|
tokenonly: allSettingsMap['tokenonly']?.value === 'Y',
|
||||||
allproductindividualtoken:
|
allproductindividualtoken:
|
||||||
allSettingsMap['allproductindividualtoken'] === 'Y',
|
allSettingsMap['allproductindividualtoken']?.value === 'Y',
|
||||||
printOptions: ['printuom', 'printlogo', 'printgreetings'].filter(
|
printOptions: ['printuom', 'printlogo', 'printgreetings'].filter(
|
||||||
(k) => allSettingsMap[k] === 'Y'
|
(k) => allSettingsMap[k]?.value === 'Y'
|
||||||
),
|
),
|
||||||
mobilea4: allSettingsMap['mobilea4'] === 'Y',
|
mobilea4: allSettingsMap['mobilea4']?.value === 'Y',
|
||||||
estimateprintheader: allSettingsMap['estimateprintheader'] === 'Y',
|
estimateprintheader: allSettingsMap['estimateprintheader']?.value === 'Y',
|
||||||
scanlayout: allSettingsMap['scanlayout'] === 'Y',
|
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
|
||||||
verifyproduct: allSettingsMap['verifyproduct'] === 'Y',
|
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
|
||||||
customisedbillnumber: allSettingsMap['customisedbillnumber'] === 'Y',
|
customisedbillnumber: allSettingsMap['customisedbillnumber']?.value === 'Y',
|
||||||
upiqr: allSettingsMap['upiqr'] === 'Y',
|
upiqr: allSettingsMap['upiqr']?.value === 'Y',
|
||||||
lowstockreport: allSettingsMap['lowstockreport'] === 'Y',
|
lowstockreport: allSettingsMap['lowstockreport']?.value === 'Y',
|
||||||
weeklysalesreport: allSettingsMap['weeklysalesreport'] === 'Y',
|
weeklysalesreport: allSettingsMap['weeklysalesreport']?.value === 'Y',
|
||||||
notificationblink: allSettingsMap['notificationblink'] === 'Y',
|
notificationblink: allSettingsMap['notificationblink']?.value === 'Y',
|
||||||
onlineindivdualslots: allSettingsMap['onlineindivdualslots'] === 'Y',
|
onlineindivdualslots: allSettingsMap['onlineindivdualslots']?.value === 'Y',
|
||||||
editbill: allSettingsMap['editbill'] === 'Y',
|
editbill: allSettingsMap['editbill']?.value === 'Y',
|
||||||
notification: [
|
notification: [
|
||||||
...(allSettingsMap['onbilltime'] === 'Y' ? ['onbilltime'] : []),
|
...(allSettingsMap['onbilltime']?.value === 'Y' ? ['onbilltime'] : []),
|
||||||
...(allSettingsMap['1daybefore'] === 'Y' ? ['1daybefore'] : []),
|
...(allSettingsMap['1daybefore']?.value === 'Y' ? ['1daybefore'] : []),
|
||||||
...(allSettingsMap['1hourbefore'] === 'Y' ? ['1hourbefore'] : []),
|
...(allSettingsMap['1hourbefore']?.value === 'Y' ? ['1hourbefore'] : []),
|
||||||
],
|
],
|
||||||
BookingOptionsandmethod: [
|
BookingOptionsandmethod: [
|
||||||
...(allSettingsMap['allow individual booking'] === 'Y'
|
...(allSettingsMap['allow individual booking']?.value === 'Y'
|
||||||
? ['allow individual booking']
|
? ['allow individual booking']
|
||||||
: []),
|
: []),
|
||||||
...(allSettingsMap['single booking only'] === 'Y'
|
...(allSettingsMap['single booking only']?.value === 'Y'
|
||||||
? ['single booking only']
|
? ['single booking only']
|
||||||
: []),
|
: []),
|
||||||
],
|
],
|
||||||
|
|
@ -310,6 +313,8 @@ const PreferenceList = () => {
|
||||||
weeklysalesreport: values.weeklysalesreport,
|
weeklysalesreport: values.weeklysalesreport,
|
||||||
notificationblink: values.notificationblink,
|
notificationblink: values.notificationblink,
|
||||||
editbill: values.editbill,
|
editbill: values.editbill,
|
||||||
|
overalllimit: values.quantityrestriction && values.quantityrestrictiontype === 'overall',
|
||||||
|
itemwiselimit: values.quantityrestriction && values.quantityrestrictiontype === 'itemwise',
|
||||||
};
|
};
|
||||||
|
|
||||||
const arrayValues = {
|
const arrayValues = {
|
||||||
|
|
@ -340,6 +345,7 @@ const PreferenceList = () => {
|
||||||
SettingId: setting.SettingId,
|
SettingId: setting.SettingId,
|
||||||
Comments: setting.Comments || 'Enter Comment',
|
Comments: setting.Comments || 'Enter Comment',
|
||||||
SettingValue: isChecked ? 'Y' : 'N',
|
SettingValue: isChecked ? 'Y' : 'N',
|
||||||
|
SettingCount: ((key === 'overalllimit' || key === 'itemwiselimit') && isChecked) ? parseFloat(values.maxquantity) || null : null
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -482,25 +488,25 @@ const PreferenceList = () => {
|
||||||
{(allSettingsMap['onlineindividualslots'] !== undefined ||
|
{(allSettingsMap['onlineindividualslots'] !== undefined ||
|
||||||
allSettingsMap['allow individual booking'] !== undefined ||
|
allSettingsMap['allow individual booking'] !== undefined ||
|
||||||
allSettingsMap['single booking only'] !== undefined) && (
|
allSettingsMap['single booking only'] !== undefined) && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="BookingOptionsandmethod"
|
name="BookingOptionsandmethod"
|
||||||
label="Individual Selling Setup"
|
label="Individual Selling Setup"
|
||||||
>
|
>
|
||||||
<Checkbox.Group>
|
<Checkbox.Group>
|
||||||
{allSettingsMap['allow individual booking'] !==
|
{allSettingsMap['allow individual booking'] !==
|
||||||
undefined && (
|
undefined && (
|
||||||
<Checkbox value="allow individual booking">
|
<Checkbox value="allow individual booking">
|
||||||
Allow online individual booking
|
Allow online individual booking
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
)}
|
)}
|
||||||
{allSettingsMap['single booking only'] !== undefined && (
|
{allSettingsMap['single booking only'] !== undefined && (
|
||||||
<Checkbox value="single booking only">
|
<Checkbox value="single booking only">
|
||||||
Allow single booking Only
|
Allow single booking Only
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
)}
|
)}
|
||||||
</Checkbox.Group>
|
</Checkbox.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
@ -532,23 +538,23 @@ const PreferenceList = () => {
|
||||||
{(allSettingsMap['onbilltime'] !== undefined ||
|
{(allSettingsMap['onbilltime'] !== undefined ||
|
||||||
allSettingsMap['1daybefore'] !== undefined ||
|
allSettingsMap['1daybefore'] !== undefined ||
|
||||||
allSettingsMap['1hourbefore'] !== undefined) && (
|
allSettingsMap['1hourbefore'] !== undefined) && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="notification"
|
name="notification"
|
||||||
label="Choose notification timing:"
|
label="Choose notification timing:"
|
||||||
>
|
>
|
||||||
<Checkbox.Group>
|
<Checkbox.Group>
|
||||||
{allSettingsMap['onbilltime'] !== undefined && (
|
{allSettingsMap['onbilltime'] !== undefined && (
|
||||||
<Checkbox value="onbilltime">On Bill Time</Checkbox>
|
<Checkbox value="onbilltime">On Bill Time</Checkbox>
|
||||||
)}
|
)}
|
||||||
{allSettingsMap['1daybefore'] !== undefined && (
|
{allSettingsMap['1daybefore'] !== undefined && (
|
||||||
<Checkbox value="1daybefore">1 Day Before</Checkbox>
|
<Checkbox value="1daybefore">1 Day Before</Checkbox>
|
||||||
)}
|
)}
|
||||||
{allSettingsMap['1hourbefore'] !== undefined && (
|
{allSettingsMap['1hourbefore'] !== undefined && (
|
||||||
<Checkbox value="1hourbefore">1 Hour Before</Checkbox>
|
<Checkbox value="1hourbefore">1 Hour Before</Checkbox>
|
||||||
)}
|
)}
|
||||||
</Checkbox.Group>
|
</Checkbox.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|
@ -575,37 +581,37 @@ const PreferenceList = () => {
|
||||||
|
|
||||||
{(allSettingsMap['offer'] !== undefined ||
|
{(allSettingsMap['offer'] !== undefined ||
|
||||||
allSettingsMap['parking'] !== undefined) && (
|
allSettingsMap['parking'] !== undefined) && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="enabledFeatures"
|
name="enabledFeatures"
|
||||||
label="Select the features you want to enable:"
|
label="Select the features you want to enable:"
|
||||||
>
|
>
|
||||||
<Checkbox.Group>
|
<Checkbox.Group>
|
||||||
{allSettingsMap['parking'] !== undefined && (
|
{allSettingsMap['parking'] !== undefined && (
|
||||||
<Checkbox value="parking">Parking</Checkbox>
|
<Checkbox value="parking">Parking</Checkbox>
|
||||||
)}
|
)}
|
||||||
{allSettingsMap['offer'] !== undefined && (
|
{allSettingsMap['offer'] !== undefined && (
|
||||||
<Checkbox value="offer">Offer</Checkbox>
|
<Checkbox value="offer">Offer</Checkbox>
|
||||||
)}
|
)}
|
||||||
</Checkbox.Group>
|
</Checkbox.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
{((allSettingsMap['dinein'] !== undefined && dinePreference) ||
|
{((allSettingsMap['dinein'] !== undefined && dinePreference) ||
|
||||||
allSettingsMap['estimation'] !== undefined) && (
|
allSettingsMap['estimation'] !== undefined) && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="enabledModules"
|
name="enabledModules"
|
||||||
label="Select the modules you want to enable:"
|
label="Select the modules you want to enable:"
|
||||||
>
|
>
|
||||||
<Checkbox.Group>
|
<Checkbox.Group>
|
||||||
{allSettingsMap['dinein'] !== undefined &&
|
{allSettingsMap['dinein'] !== undefined &&
|
||||||
dinePreference && (
|
dinePreference && (
|
||||||
<Checkbox value="dinein">Dine-In</Checkbox>
|
<Checkbox value="dinein">Dine-In</Checkbox>
|
||||||
|
)}
|
||||||
|
{allSettingsMap['estimation'] !== undefined && (
|
||||||
|
<Checkbox value="estimation">Estimation</Checkbox>
|
||||||
)}
|
)}
|
||||||
{allSettingsMap['estimation'] !== undefined && (
|
</Checkbox.Group>
|
||||||
<Checkbox value="estimation">Estimation</Checkbox>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
</Checkbox.Group>
|
|
||||||
</Form.Item>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{renderCheckbox('stockselection', 'Enable stock selection?')}
|
{renderCheckbox('stockselection', 'Enable stock selection?')}
|
||||||
{renderCheckbox('weightasquantity', 'Use Weight as Quantity?')}
|
{renderCheckbox('weightasquantity', 'Use Weight as Quantity?')}
|
||||||
|
|
@ -630,6 +636,38 @@ const PreferenceList = () => {
|
||||||
{renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')}
|
{renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')}
|
||||||
{renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')}
|
{renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')}
|
||||||
{/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */}
|
{/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */}
|
||||||
|
|
||||||
|
{(allSettingsMap['overalllimit'] !== undefined || allSettingsMap['itemwiselimit'] !== undefined) && (
|
||||||
|
<>
|
||||||
|
<Form.Item name="quantityrestriction" label="Do you want to restrict the quantity that can be sold in a single order?" valuePropName="checked">
|
||||||
|
<Checkbox>Yes</Checkbox>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item noStyle shouldUpdate={(prev, curr) => prev.quantityrestriction !== curr.quantityrestriction}>
|
||||||
|
{({ getFieldValue }) => getFieldValue('quantityrestriction') && (
|
||||||
|
<>
|
||||||
|
<Form.Item name="quantityrestrictiontype" label="How would you like to apply the quantity restriction?">
|
||||||
|
<Radio.Group onChange={() => formRef.current?.setFieldsValue({ maxquantity: undefined })}>
|
||||||
|
<Radio value="overall">Overall Order Quantity</Radio>
|
||||||
|
<Radio value="itemwise">Item-wise Quantity</Radio>
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="maxquantity"
|
||||||
|
label="Maximum quantity allowed:"
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: 'Please enter maximum quantity' },
|
||||||
|
{ type: 'number', min: 1, message: 'Quantity must be greater than 0' }
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<InputNumber min={1} style={{ width: '200px' }} />
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
@ -652,46 +690,46 @@ const PreferenceList = () => {
|
||||||
{['whatsapp', 'sms', 'email'].some(
|
{['whatsapp', 'sms', 'email'].some(
|
||||||
(k) => allSettingsMap[k] !== undefined
|
(k) => allSettingsMap[k] !== undefined
|
||||||
) && (
|
) && (
|
||||||
<>
|
<>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="billOption"
|
name="billOption"
|
||||||
label="Choose how to handle bills:"
|
label="Choose how to handle bills:"
|
||||||
>
|
>
|
||||||
<Radio.Group>
|
<Radio.Group>
|
||||||
<Radio value="print">Print Bill</Radio>
|
<Radio value="print">Print Bill</Radio>
|
||||||
<Radio value="pdf">Send PDF</Radio>
|
<Radio value="pdf">Send PDF</Radio>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
noStyle
|
noStyle
|
||||||
shouldUpdate={(prev, curr) =>
|
shouldUpdate={(prev, curr) =>
|
||||||
prev.billOption !== curr.billOption
|
prev.billOption !== curr.billOption
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{({ getFieldValue }) =>
|
{({ getFieldValue }) =>
|
||||||
getFieldValue('billOption') === 'pdf' && (
|
getFieldValue('billOption') === 'pdf' && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="pdfSendOptions"
|
name="pdfSendOptions"
|
||||||
label="Select how to send the PDF:"
|
label="Select how to send the PDF:"
|
||||||
>
|
>
|
||||||
<Checkbox.Group>
|
<Checkbox.Group>
|
||||||
{allSettingsMap['whatsapp'] !== undefined && (
|
{allSettingsMap['whatsapp'] !== undefined && (
|
||||||
<Checkbox value="whatsapp">WhatsApp</Checkbox>
|
<Checkbox value="whatsapp">WhatsApp</Checkbox>
|
||||||
)}
|
)}
|
||||||
{allSettingsMap['email'] !== undefined && (
|
{allSettingsMap['email'] !== undefined && (
|
||||||
<Checkbox value="email">Email</Checkbox>
|
<Checkbox value="email">Email</Checkbox>
|
||||||
)}
|
)}
|
||||||
{allSettingsMap['sms'] !== undefined && (
|
{allSettingsMap['sms'] !== undefined && (
|
||||||
<Checkbox value="sms">SMS</Checkbox>
|
<Checkbox value="sms">SMS</Checkbox>
|
||||||
)}
|
)}
|
||||||
</Checkbox.Group>
|
</Checkbox.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{renderCheckbox(
|
{renderCheckbox(
|
||||||
'tokenonly',
|
'tokenonly',
|
||||||
|
|
@ -721,25 +759,25 @@ const PreferenceList = () => {
|
||||||
{['printuom', 'printlogo', 'printgreetings'].some(
|
{['printuom', 'printlogo', 'printgreetings'].some(
|
||||||
(k) => allSettingsMap[k] !== undefined
|
(k) => allSettingsMap[k] !== undefined
|
||||||
) && (
|
) && (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="printOptions"
|
name="printOptions"
|
||||||
label="Select what you want to include in the print:"
|
label="Select what you want to include in the print:"
|
||||||
>
|
>
|
||||||
<Checkbox.Group>
|
<Checkbox.Group>
|
||||||
{allSettingsMap['printuom'] !== undefined && (
|
{allSettingsMap['printuom'] !== undefined && (
|
||||||
<Checkbox value="printuom">
|
<Checkbox value="printuom">
|
||||||
Unit of Measure (UOM)
|
Unit of Measure (UOM)
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
)}
|
)}
|
||||||
{allSettingsMap['printlogo'] !== undefined && (
|
{allSettingsMap['printlogo'] !== undefined && (
|
||||||
<Checkbox value="printlogo">Branch Logo</Checkbox>
|
<Checkbox value="printlogo">Branch Logo</Checkbox>
|
||||||
)}
|
)}
|
||||||
{allSettingsMap['printgreetings'] !== undefined && (
|
{allSettingsMap['printgreetings'] !== undefined && (
|
||||||
<Checkbox value="printgreetings">Greetings</Checkbox>
|
<Checkbox value="printgreetings">Greetings</Checkbox>
|
||||||
)}
|
)}
|
||||||
</Checkbox.Group>
|
</Checkbox.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{renderCheckbox(
|
{renderCheckbox(
|
||||||
'mobilea4',
|
'mobilea4',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
export const calculateOverAllQtyLimit = (orders) => {
|
||||||
|
return orders?.reduce((acc, cartItem) => {
|
||||||
|
return acc + (cartItem?.OrderQty || 0);
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue