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 { v4 as uuidv4 } from 'uuid';
|
||||
import WeightCalculatePrice from './WeightCalculatePrice.jsx';
|
||||
import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
|
||||
|
||||
const BSBillingEditQuantity = (props) => {
|
||||
const dispatch = useDispatch();
|
||||
|
|
@ -49,7 +50,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
const priceChangeInputRef = useRef(null);
|
||||
const reductionInputRef = useRef(null);
|
||||
|
||||
const { setIndex = () => {} } = props;
|
||||
const { setIndex = () => { } } = props;
|
||||
|
||||
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
||||
const SessionData = useSelector(StoredSessionData);
|
||||
|
|
@ -64,6 +65,14 @@ const BSBillingEditQuantity = (props) => {
|
|||
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
|
||||
shallowEqual
|
||||
);
|
||||
|
||||
const overAllLimitPreferenece =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||
const itemWiseLimitPreferenece =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||
const preferenceOffer =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => item.SettingIdName === 'Offer'
|
||||
|
|
@ -103,23 +112,23 @@ const BSBillingEditQuantity = (props) => {
|
|||
const OrderType = useSelector(GlobalOrderType);
|
||||
const [BillOrderPre, setBillOrderPre] = useState(null);
|
||||
const SHORTKEY_TO_RADIO = {
|
||||
price: 'Price',
|
||||
quantity: 'qty',
|
||||
Parcel: 'Parcel',
|
||||
weightAmount: 'weightAmount'
|
||||
};
|
||||
const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||
if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
|
||||
return SHORTKEY_TO_RADIO[props.shortKeyMethod];
|
||||
}
|
||||
if (ItemData?.ScaleType !== 'weight') {
|
||||
return 'Quantity';
|
||||
}
|
||||
if (PriceChangeaccess) {
|
||||
return 'Price';
|
||||
}
|
||||
return 'Parcel';
|
||||
});
|
||||
price: 'Price',
|
||||
quantity: 'qty',
|
||||
Parcel: 'Parcel',
|
||||
weightAmount: 'weightAmount'
|
||||
};
|
||||
const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||
if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
|
||||
return SHORTKEY_TO_RADIO[props.shortKeyMethod];
|
||||
}
|
||||
if (ItemData?.ScaleType !== 'weight') {
|
||||
return 'Quantity';
|
||||
}
|
||||
if (PriceChangeaccess) {
|
||||
return 'Price';
|
||||
}
|
||||
return 'Parcel';
|
||||
});
|
||||
// const [RadioBtnSelection, setRadioBtnSelection] = useState(
|
||||
// props?.shortKeyMethod == 'price'
|
||||
// ? 'Price'
|
||||
|
|
@ -334,6 +343,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
};
|
||||
|
||||
const calculateOverAllQty = (item, filterItems) => {
|
||||
|
||||
if (!item) return 0;
|
||||
|
||||
const totalUsedQty =
|
||||
|
|
@ -435,6 +445,18 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
(e) => e?.localId == localId
|
||||
);
|
||||
const editedProduct = CartOrderDetails[editedProductIndex];
|
||||
|
||||
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||
if (overAllLimitPreferenece) {
|
||||
const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex));
|
||||
if ((calculatedOverAllQty + editedQty) > maxQtyLimit) {
|
||||
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setMessageType('warning');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const productBookingType = editedProduct?.BookingTypeName;
|
||||
const isItemInCart = CartOrderDetails?.find(
|
||||
(cartItem) =>
|
||||
|
|
@ -728,7 +750,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
return (
|
||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
cartItem?.OfferMessage?.[0]?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||
cartItem?.BookingTypeName !== editedProduct?.BookingTypeName
|
||||
);
|
||||
|
|
@ -862,7 +884,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||
cartItem?.BookingTypeName !==
|
||||
editedProduct?.BookingTypeName &&
|
||||
editedProduct?.BookingTypeName &&
|
||||
!cartItem?.OfferMode &&
|
||||
cartItem?.Offer === 0
|
||||
);
|
||||
|
|
@ -876,7 +898,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||
cartItem?.BookingTypeName !==
|
||||
editedProduct?.BookingTypeName &&
|
||||
editedProduct?.BookingTypeName &&
|
||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||
cartItem?.Offer > 0
|
||||
);
|
||||
|
|
@ -1009,7 +1031,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
)
|
||||
) &&
|
||||
product?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
product?.OfferMode === editedProduct?.OfferMode
|
||||
) {
|
||||
const freeQty =
|
||||
|
|
@ -1042,7 +1064,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -1125,7 +1147,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
)
|
||||
) &&
|
||||
product?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
product?.OfferMode === editedProduct?.OfferMode
|
||||
) {
|
||||
return {
|
||||
|
|
@ -1155,7 +1177,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -1342,7 +1364,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -1444,7 +1466,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -1598,7 +1620,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
) &&
|
||||
cartItem?.Offer &&
|
||||
isFreeProductApplicable?.OfferId ===
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
@ -1887,11 +1909,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode)
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -1925,11 +1947,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -2070,7 +2092,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
cartItem?.Offer > 0 &&
|
||||
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
|
||||
isFreeProductApplicable?.OfferId ===
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
@ -2173,11 +2195,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2248,12 +2270,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -2287,13 +2309,13 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode);
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -2375,11 +2397,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
if (
|
||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2432,11 +2454,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
if (
|
||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2525,11 +2547,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem?.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem?.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem?.OfferMode &&
|
||||
cartItem?.Offer > 0
|
||||
) {
|
||||
|
|
@ -2558,11 +2580,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2592,11 +2614,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2695,12 +2717,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -2734,12 +2756,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -2818,11 +2840,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
if (
|
||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2881,11 +2903,11 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2957,12 +2979,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -2996,12 +3018,12 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -3156,17 +3178,17 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
changeOrderCardDetails(
|
||||
CartOrderDetails?.map((i) =>
|
||||
i?.InwardDtlId == updatedProduct?.InwardDtlId &&
|
||||
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
||||
i?.localId === updatedProduct?.localId
|
||||
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
||||
i?.localId === updatedProduct?.localId
|
||||
? {
|
||||
...updatedProduct,
|
||||
Offer: 0,
|
||||
OfferType:
|
||||
updatedProduct?.Type === 'C'
|
||||
? updatedProduct?.OfferType
|
||||
: null,
|
||||
OfferMessage: null,
|
||||
}
|
||||
...updatedProduct,
|
||||
Offer: 0,
|
||||
OfferType:
|
||||
updatedProduct?.Type === 'C'
|
||||
? updatedProduct?.OfferType
|
||||
: null,
|
||||
OfferMessage: null,
|
||||
}
|
||||
: i
|
||||
)
|
||||
)
|
||||
|
|
@ -3202,10 +3224,10 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
((c?.OfferModeType && c?.OfferMode === 'B'
|
||||
? true
|
||||
: c?.OfferMode !== 'B') &&
|
||||
c?.OfferMode !== 'P' &&
|
||||
c?.OfferMode !== 'C' &&
|
||||
c?.OfferMode !== 'O' &&
|
||||
c?.OfferMode !== 'L'
|
||||
c?.OfferMode !== 'P' &&
|
||||
c?.OfferMode !== 'C' &&
|
||||
c?.OfferMode !== 'O' &&
|
||||
c?.OfferMode !== 'L'
|
||||
? true
|
||||
: c?.Offer === 0);
|
||||
|
||||
|
|
@ -3397,8 +3419,8 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
// parseFloat(enteredDiscount) < parseFloat(sellingPrice) ||
|
||||
// parseFloat(enteredDiscount) === parseFloat(sellingPrice)
|
||||
// ) {
|
||||
setEditedPrice(enteredDiscount);
|
||||
setDisableSubmitButton(true);
|
||||
setEditedPrice(enteredDiscount);
|
||||
setDisableSubmitButton(true);
|
||||
// } else {
|
||||
// setMessageType('error');
|
||||
// setMessageData('Please Give less than value for sell price');
|
||||
|
|
@ -3467,8 +3489,8 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
setClearQuantity(false);
|
||||
};
|
||||
const isKg =
|
||||
props?.Productdata?.Size == 1 &&
|
||||
["KG", "KGS"].includes(props?.Productdata?.UomName?.toUpperCase());
|
||||
props?.Productdata?.Size == 1 &&
|
||||
["KG", "KGS"].includes(props?.Productdata?.UomName?.toUpperCase());
|
||||
|
||||
return (
|
||||
<div className="BSBilling-EditQuantity-Modal">
|
||||
|
|
@ -3688,7 +3710,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
? `${parts[0]}.${parts.slice(1).join('')}`
|
||||
: cleanedValue;
|
||||
}}
|
||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
||||
/>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
|
@ -3751,7 +3773,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
? `${parts[0]}.${parts.slice(1).join('')}`
|
||||
: cleanedValue;
|
||||
}}
|
||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
||||
/>
|
||||
</Form.Item>
|
||||
{/* <input type="text"
|
||||
|
|
@ -3796,14 +3818,14 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
|||
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
||||
{((RadioBtnSelection == 'Price' && disableSubmitButton) ||
|
||||
RadioBtnSelection == 'Quantity') && (
|
||||
<Buttons
|
||||
buttonText="Submit"
|
||||
color="901D77"
|
||||
htmlType
|
||||
// handleSubmit={AddProductQuantity}
|
||||
icon={<ArrowRightOutlined />}
|
||||
></Buttons>
|
||||
)}
|
||||
<Buttons
|
||||
buttonText="Submit"
|
||||
color="901D77"
|
||||
htmlType
|
||||
// handleSubmit={AddProductQuantity}
|
||||
icon={<ArrowRightOutlined />}
|
||||
></Buttons>
|
||||
)}
|
||||
</div>
|
||||
</Form>
|
||||
</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 { Popconfirm, Tooltip } from 'antd';
|
||||
import { AiOutlineClose, AiFillDelete } from 'react-icons/ai';
|
||||
|
|
@ -79,6 +79,8 @@ import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
|
|||
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
|
||||
import { useUtilsComponent } from '../../../../../Services/utils.js';
|
||||
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
|
||||
import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
|
||||
import { Messages } from '../../../../../../ownLib/my-ui-lib.js';
|
||||
|
||||
const BsBill = () => {
|
||||
const { removeExtraCharge } = useUtilsComponent();
|
||||
|
|
@ -108,6 +110,8 @@ const BsBill = () => {
|
|||
setting?.SettingValue === 'Y'
|
||||
);
|
||||
const [count, setCount] = useState(1);
|
||||
const [messageType, setMessageType] = useState(null);
|
||||
const [messageData, setMessageData] = useState(null);
|
||||
const [EditQuantity, setEditQuantity] = useState(false);
|
||||
const [Modaldata, setModaldata] = useState([]);
|
||||
const TableData = useSelector(GlobalOrderCardDetails);
|
||||
|
|
@ -141,6 +145,14 @@ const BsBill = () => {
|
|||
const OrderType = useSelector(GlobalOrderType);
|
||||
const GlobEstBooking = useSelector(GlobalEstimateBooking);
|
||||
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);
|
||||
|
||||
|
|
@ -2123,8 +2135,22 @@ const BsBill = () => {
|
|||
const handleEditQuantityCancel = () => {
|
||||
setEditQuantity(false);
|
||||
};
|
||||
|
||||
const onComplete = useCallback(() => {
|
||||
setMessageData(null);
|
||||
setMessageType(null);
|
||||
}, []);
|
||||
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(
|
||||
(cartItem) =>
|
||||
!(
|
||||
|
|
@ -3049,6 +3075,11 @@ const BsBill = () => {
|
|||
};
|
||||
return (
|
||||
<div className="BSBillingTable5-billtable">
|
||||
<Messages
|
||||
messageType={messageType}
|
||||
messageData={messageData}
|
||||
onComplete={onComplete}
|
||||
/>
|
||||
<table className="BSBillingTable5-tablediv">
|
||||
<thead className="BSBillingTable5-thead">
|
||||
<tr
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import {
|
|||
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import './ComboBillTableEdit.scss';
|
||||
import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
|
||||
|
||||
const ComboEditQtyAndRate = (props) => {
|
||||
const dispatch = useDispatch();
|
||||
|
|
@ -37,9 +38,9 @@ const ComboEditQtyAndRate = (props) => {
|
|||
const quantityInputRef = useRef(null);
|
||||
const priceChangeInputRef = useRef(null);
|
||||
const {
|
||||
setIndex = () => {},
|
||||
setEditQtyCombo = () => {},
|
||||
setEditRateCombo = () => {},
|
||||
setIndex = () => { },
|
||||
setEditQtyCombo = () => { },
|
||||
setEditRateCombo = () => { },
|
||||
} = props;
|
||||
|
||||
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
||||
|
|
@ -51,10 +52,19 @@ const ComboEditQtyAndRate = (props) => {
|
|||
const applyOffer = useApplyOfferto_CardDetail();
|
||||
const preferenceDatas = useSelector(PreferenceData);
|
||||
const EmpAccessDetail = useSelector(GlobalEmpAccessDetail);
|
||||
const overAllLimitPreferenece =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||
const itemWiseLimitPreferenece =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||
|
||||
const OverAllproductBasedOfferDatas = useSelector(
|
||||
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
|
||||
shallowEqual
|
||||
);
|
||||
console.log(overAllLimitPreferenece, "itemWiseLimitPreferenece")
|
||||
const preferenceOffer =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => item.SettingIdName === 'Offer'
|
||||
|
|
@ -251,7 +261,16 @@ const ComboEditQtyAndRate = (props) => {
|
|||
item?.SinglePc === 'Y' ? item?.OverAllPcs : item?.BalanceQty;
|
||||
return availableQty - totalUsedQty;
|
||||
};
|
||||
|
||||
const quantityValidation = async (val) => {
|
||||
|
||||
setQuantity(val)
|
||||
|
||||
}
|
||||
const AddProductQuantity = async () => {
|
||||
// debugger
|
||||
|
||||
|
||||
let newPrice = editedPrice > 0 ? editedPrice : props.Productdata.OrderRate;
|
||||
await dispatch(changeHoldOrderDtl(false));
|
||||
await dispatch(changePreviousOrderLength(CartOrderDetails?.length));
|
||||
|
|
@ -312,6 +331,20 @@ const ComboEditQtyAndRate = (props) => {
|
|||
let editedProductIndex = CartOrderDetails?.findIndex(
|
||||
(e) => e?.localId == localId
|
||||
);
|
||||
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||
if (overAllLimitPreferenece) {
|
||||
let removeProds1 = CartOrderDetails?.find((_, index) => index == editedProductIndex)
|
||||
let removeProds = CartOrderDetails?.filter((_, index) => index !== editedProductIndex)
|
||||
|
||||
const calculatedOverAllQty = calculateOverAllQtyLimit(removeProds);
|
||||
if ((calculatedOverAllQty + editedQty) > maxQtyLimit) {
|
||||
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setMessageType('warning');
|
||||
setQuantity(removeProds1?.OrderQty || 1)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
const editedProduct = CartOrderDetails[editedProductIndex];
|
||||
const productBookingType = editedProduct?.BookingTypeName;
|
||||
const isItemInCart = CartOrderDetails?.find(
|
||||
|
|
@ -591,7 +624,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
return (
|
||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
cartItem?.OfferMessage?.[0]?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||
cartItem?.BookingTypeName !== editedProduct?.BookingTypeName
|
||||
);
|
||||
|
|
@ -725,7 +758,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||
cartItem?.BookingTypeName !==
|
||||
editedProduct?.BookingTypeName &&
|
||||
editedProduct?.BookingTypeName &&
|
||||
!cartItem?.OfferMode &&
|
||||
cartItem?.Offer === 0
|
||||
);
|
||||
|
|
@ -739,7 +772,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||
cartItem?.BookingTypeName !==
|
||||
editedProduct?.BookingTypeName &&
|
||||
editedProduct?.BookingTypeName &&
|
||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||
cartItem?.Offer > 0
|
||||
);
|
||||
|
|
@ -872,7 +905,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
)
|
||||
) &&
|
||||
product?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
product?.OfferMode === editedProduct?.OfferMode
|
||||
) {
|
||||
const freeQty =
|
||||
|
|
@ -905,7 +938,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -984,7 +1017,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
)
|
||||
) &&
|
||||
product?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
product?.OfferMode === editedProduct?.OfferMode
|
||||
) {
|
||||
return {
|
||||
|
|
@ -1014,7 +1047,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -1201,7 +1234,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -1303,7 +1336,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -1457,7 +1490,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
) &&
|
||||
cartItem?.Offer &&
|
||||
isFreeProductApplicable?.OfferId ===
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
@ -1746,11 +1779,11 @@ const ComboEditQtyAndRate = (props) => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode)
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -1784,11 +1817,11 @@ const ComboEditQtyAndRate = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -1929,7 +1962,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
cartItem?.Offer > 0 &&
|
||||
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
|
||||
isFreeProductApplicable?.OfferId ===
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
@ -2032,11 +2065,11 @@ const ComboEditQtyAndRate = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2107,12 +2140,12 @@ const ComboEditQtyAndRate = (props) => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -2146,13 +2179,13 @@ const ComboEditQtyAndRate = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode);
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -2234,11 +2267,11 @@ const ComboEditQtyAndRate = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2291,11 +2324,11 @@ const ComboEditQtyAndRate = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2384,11 +2417,11 @@ const ComboEditQtyAndRate = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem?.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem?.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem?.OfferMode &&
|
||||
cartItem?.Offer > 0
|
||||
) {
|
||||
|
|
@ -2417,11 +2450,11 @@ const ComboEditQtyAndRate = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2451,11 +2484,11 @@ const ComboEditQtyAndRate = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2554,12 +2587,12 @@ const ComboEditQtyAndRate = (props) => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -2593,12 +2626,12 @@ const ComboEditQtyAndRate = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -2677,11 +2710,11 @@ const ComboEditQtyAndRate = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2740,11 +2773,11 @@ const ComboEditQtyAndRate = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2816,12 +2849,12 @@ const ComboEditQtyAndRate = (props) => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -2855,12 +2888,12 @@ const ComboEditQtyAndRate = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -3014,17 +3047,17 @@ const ComboEditQtyAndRate = (props) => {
|
|||
changeOrderCardDetails(
|
||||
CartOrderDetails?.map((i) =>
|
||||
i?.InwardDtlId == updatedProduct?.InwardDtlId &&
|
||||
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
||||
i?.localId === updatedProduct?.localId
|
||||
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
||||
i?.localId === updatedProduct?.localId
|
||||
? {
|
||||
...updatedProduct,
|
||||
Offer: 0,
|
||||
OfferType:
|
||||
updatedProduct?.Type === 'C'
|
||||
? updatedProduct?.OfferType
|
||||
: null,
|
||||
OfferMessage: null,
|
||||
}
|
||||
...updatedProduct,
|
||||
Offer: 0,
|
||||
OfferType:
|
||||
updatedProduct?.Type === 'C'
|
||||
? updatedProduct?.OfferType
|
||||
: null,
|
||||
OfferMessage: null,
|
||||
}
|
||||
: i
|
||||
)
|
||||
)
|
||||
|
|
@ -3060,10 +3093,10 @@ const ComboEditQtyAndRate = (props) => {
|
|||
((c?.OfferModeType && c?.OfferMode === 'B'
|
||||
? true
|
||||
: c?.OfferMode !== 'B') &&
|
||||
c?.OfferMode !== 'P' &&
|
||||
c?.OfferMode !== 'C' &&
|
||||
c?.OfferMode !== 'O' &&
|
||||
c?.OfferMode !== 'L'
|
||||
c?.OfferMode !== 'P' &&
|
||||
c?.OfferMode !== 'C' &&
|
||||
c?.OfferMode !== 'O' &&
|
||||
c?.OfferMode !== 'L'
|
||||
? true
|
||||
: c?.Offer === 0);
|
||||
|
||||
|
|
@ -3227,7 +3260,7 @@ const ComboEditQtyAndRate = (props) => {
|
|||
type="number"
|
||||
value={Quantity}
|
||||
min="0"
|
||||
onChange={(e) => setQuantity(e.target.value)}
|
||||
onChange={(e) => quantityValidation(e.target.value)}
|
||||
onBlur={() => {
|
||||
if (Quantity && Quantity.trim() !== '') {
|
||||
AddProductQuantity();
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ import {
|
|||
import { Global_PromoCodeOffers } from '../../../../Features/Offer/Offer.js';
|
||||
import { validateOffers } from '../BSItemCards/ValidateOffer.jsx';
|
||||
import { useSaleswiseOfferWatcher } from '../BSItemCards/SalesWiseOffer.jsx';
|
||||
import { calculateOverAllQtyLimit } from '../../../../utils/calculations.js';
|
||||
const ExpireConfirmModal = lazy(
|
||||
() => import('../BookingFunctionality/ExpireConfirmModal.jsx')
|
||||
);
|
||||
|
|
@ -132,6 +133,13 @@ export default function BSC1Search(props) {
|
|||
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
||||
useSaleswiseOfferWatcher();
|
||||
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 =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => item.SettingIdName === 'Offer'
|
||||
|
|
@ -703,7 +711,7 @@ export default function BSC1Search(props) {
|
|||
WithoutTaxRate:
|
||||
availableFreeQty * item.OrderRate -
|
||||
(availableFreeQty * item.OrderRate * item.TaxPercentage) /
|
||||
100,
|
||||
100,
|
||||
Offer: availableFreeQty * item.OrderRate,
|
||||
};
|
||||
|
||||
|
|
@ -752,7 +760,7 @@ export default function BSC1Search(props) {
|
|||
((existingPaidItem.OrderQty + excessQty) *
|
||||
item.OrderRate *
|
||||
item.TaxPercentage) /
|
||||
100,
|
||||
100,
|
||||
};
|
||||
|
||||
ModifiedData.push(mergedPaidItem);
|
||||
|
|
@ -787,7 +795,7 @@ export default function BSC1Search(props) {
|
|||
data?.InwardDtlId === item?.InwardDtlId &&
|
||||
data?.ProdId === item?.ProdId &&
|
||||
data?.OfferMessage?.[0]?.OfferId ===
|
||||
item?.OfferMessage?.[0]?.OfferId
|
||||
item?.OfferMessage?.[0]?.OfferId
|
||||
);
|
||||
|
||||
if (isAlreadyExists !== -1) {
|
||||
|
|
@ -807,11 +815,11 @@ export default function BSC1Search(props) {
|
|||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
|
||||
item.OrderRate -
|
||||
item.OrderRate -
|
||||
((ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
|
||||
item.OrderRate *
|
||||
item.TaxPercentage) /
|
||||
100,
|
||||
100,
|
||||
Offer:
|
||||
(ModifiedData[isAlreadyExists].OrderQty + item.OrderQty) *
|
||||
item.OrderRate,
|
||||
|
|
@ -837,10 +845,10 @@ export default function BSC1Search(props) {
|
|||
const appliedOfferAlreadyExists = AppliedOffers.findIndex(
|
||||
(offer) =>
|
||||
offer?.FreeProductsList?.FreeProdId ===
|
||||
matchingFreeProduct?.FreeProdId &&
|
||||
matchingFreeProduct?.FreeProdId &&
|
||||
offer?.TableName === matchingFreeProduct?.TableName &&
|
||||
offer?.TableUniqueName ===
|
||||
matchingFreeProduct?.TableUniqueName &&
|
||||
matchingFreeProduct?.TableUniqueName &&
|
||||
offer?.OfferId === matchingFreeProduct?.OfferId &&
|
||||
offer?.OfferMode === matchingFreeProduct?.OfferMode &&
|
||||
offer?.FreeProductsList?.ProdVariantDetails?.[0]
|
||||
|
|
@ -1169,7 +1177,7 @@ export default function BSC1Search(props) {
|
|||
|
||||
const getPreferenceStock = async () => {
|
||||
const PreferenceStckDtl = preferenceDatas?.[0]?.SettingDtlDetails;
|
||||
const StockPreference = PreferenceStckDtl.find(
|
||||
const StockPreference = PreferenceStckDtl?.find(
|
||||
(item) => item.SettingIdName === 'StockSelection'
|
||||
);
|
||||
|
||||
|
|
@ -1671,7 +1679,7 @@ export default function BSC1Search(props) {
|
|||
<span
|
||||
style={
|
||||
record.StockCount > 0 ||
|
||||
record.StockCount === 'Stock Not Maintained'
|
||||
record.StockCount === 'Stock Not Maintained'
|
||||
? { color: '#000', cursor: 'pointer' }
|
||||
: { color: '#f49898', cursor: 'not-allowed' }
|
||||
}
|
||||
|
|
@ -1701,7 +1709,7 @@ export default function BSC1Search(props) {
|
|||
<span
|
||||
style={
|
||||
record.StockCount > 0 ||
|
||||
record.StockCount === 'Stock Not Maintained'
|
||||
record.StockCount === 'Stock Not Maintained'
|
||||
? { color: '#000', cursor: 'pointer' }
|
||||
: { color: '#f49898', cursor: 'not-allowed' }
|
||||
}
|
||||
|
|
@ -1731,7 +1739,7 @@ export default function BSC1Search(props) {
|
|||
<span
|
||||
style={
|
||||
record.StockCount > 0 ||
|
||||
record.StockCount === 'Stock Not Maintained'
|
||||
record.StockCount === 'Stock Not Maintained'
|
||||
? { color: '#000', cursor: 'pointer' }
|
||||
: { color: '#f49898', cursor: 'not-allowed' }
|
||||
}
|
||||
|
|
@ -1895,11 +1903,11 @@ export default function BSC1Search(props) {
|
|||
StockCount:
|
||||
qtydata?.ProductDetail?.[0]?.StockAvailable === 'Y'
|
||||
? returnVariantStock(
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdId,
|
||||
item?.OverAllQty,
|
||||
CartOrderDetails,
|
||||
item?.ProdVariantName
|
||||
)
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdId,
|
||||
item?.OverAllQty,
|
||||
CartOrderDetails,
|
||||
item?.ProdVariantName
|
||||
)
|
||||
: 'Stock Not Maintained',
|
||||
});
|
||||
});
|
||||
|
|
@ -1915,17 +1923,17 @@ export default function BSC1Search(props) {
|
|||
'Batch No': item?.BatchRef,
|
||||
StockCount: onePeiceFlow
|
||||
? returnCountStock(
|
||||
item?.ProdId,
|
||||
item?.BalanceQty,
|
||||
CartOrderDetails,
|
||||
item?.InwardDtlId
|
||||
) * item?.NoOfPcs
|
||||
item?.ProdId,
|
||||
item?.BalanceQty,
|
||||
CartOrderDetails,
|
||||
item?.InwardDtlId
|
||||
) * item?.NoOfPcs
|
||||
: returnCountStock(
|
||||
item?.ProdId,
|
||||
item?.BalanceQty,
|
||||
CartOrderDetails,
|
||||
item?.InwardDtlId
|
||||
),
|
||||
item?.ProdId,
|
||||
item?.BalanceQty,
|
||||
CartOrderDetails,
|
||||
item?.InwardDtlId
|
||||
),
|
||||
'Stock Date': StockDate(item?.InwardDate),
|
||||
Price: onePeiceFlow ? item?.OnePcsPrice : item?.SellPrice,
|
||||
ExpDate:
|
||||
|
|
@ -1979,13 +1987,13 @@ export default function BSC1Search(props) {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice &&
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice &&
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
||||
|
|
@ -1994,9 +2002,9 @@ export default function BSC1Search(props) {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
|
@ -2038,11 +2046,11 @@ export default function BSC1Search(props) {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[0]?.InwardDtlId &&
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[0]?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[0]?.SellPrice &&
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[0]?.SellPrice &&
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
||||
|
|
@ -2051,9 +2059,9 @@ export default function BSC1Search(props) {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === item?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
|
@ -2131,13 +2139,13 @@ export default function BSC1Search(props) {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
index.key
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
index.key
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
index.key
|
||||
]?.StockDetails?.[0]?.SellPrice &&
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
index.key
|
||||
]?.StockDetails?.[0]?.SellPrice &&
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
||||
|
|
@ -2145,11 +2153,11 @@ export default function BSC1Search(props) {
|
|||
let Isincartonepc = CartOrderDetails?.filter(
|
||||
(cartItem) =>
|
||||
cartItem?.ProdId ===
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
|
@ -2213,11 +2221,11 @@ export default function BSC1Search(props) {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]
|
||||
?.StockDetails?.[0]?.InwardDtlId &&
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]
|
||||
?.StockDetails?.[0]?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]
|
||||
?.StockDetails?.[0]?.SellPrice &&
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]
|
||||
?.StockDetails?.[0]?.SellPrice &&
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
||||
|
|
@ -2226,9 +2234,9 @@ export default function BSC1Search(props) {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === qtydata?.ProductDetail?.[QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[
|
||||
VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
|
@ -2303,15 +2311,15 @@ export default function BSC1Search(props) {
|
|||
let Isincart = CartOrderDetails?.find(
|
||||
(cartItem) =>
|
||||
cartItem?.ProdId ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice &&
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
||||
|
|
@ -2319,11 +2327,11 @@ export default function BSC1Search(props) {
|
|||
let Isincartonepc = CartOrderDetails?.filter(
|
||||
(cartItem) =>
|
||||
cartItem?.ProdId ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndexs
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndexs
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
|
@ -2401,15 +2409,15 @@ export default function BSC1Search(props) {
|
|||
let Isincart = CartOrderDetails?.find(
|
||||
(cartItem) =>
|
||||
cartItem?.ProdId ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice &&
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
||||
|
|
@ -2417,11 +2425,11 @@ export default function BSC1Search(props) {
|
|||
let Isincartonepc = CartOrderDetails?.filter(
|
||||
(cartItem) =>
|
||||
cartItem?.ProdId ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
// (cartItem?.OrderRate === item?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]?.StockDetails?.[0]?.SellPrice)
|
||||
!cartItem?.SalesId
|
||||
);
|
||||
|
|
@ -2541,7 +2549,7 @@ export default function BSC1Search(props) {
|
|||
const isKgsProduct =
|
||||
(a?.ProductDetail?.[QtyIndex]?.UomName?.toLowerCase() === 'kgs' ||
|
||||
a?.ProductDetail?.[QtyIndex]?.UomName?.toLowerCase() ===
|
||||
'kg'?.toLowerCase()) &&
|
||||
'kg'?.toLowerCase()) &&
|
||||
a?.ProductDetail?.[QtyIndex]?.Size === '1';
|
||||
|
||||
if (
|
||||
|
|
@ -2554,11 +2562,11 @@ export default function BSC1Search(props) {
|
|||
parseFloat(
|
||||
onePcs
|
||||
? (a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice /
|
||||
1000) *
|
||||
(parseFloat(WeightScaleWeight) * 1000)
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice /
|
||||
1000) *
|
||||
(parseFloat(WeightScaleWeight) * 1000)
|
||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.SellPrice / 1000
|
||||
?.StockDetails?.[stockIndex]?.SellPrice / 1000
|
||||
) *
|
||||
(parseFloat(WeightScaleWeight) * 1000);
|
||||
let data = {
|
||||
|
|
@ -2614,9 +2622,9 @@ export default function BSC1Search(props) {
|
|||
?.StockDetails?.[stockIndex]?.InwardId,
|
||||
MRP: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.MRP,
|
||||
?.StockDetails?.[stockIndex]?.MRP,
|
||||
FullProductIdentifierDtls:
|
||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.ProductIdentifierDtls,
|
||||
|
|
@ -2724,19 +2732,19 @@ export default function BSC1Search(props) {
|
|||
?.StockDetails?.[stockIndex]?.InwardId,
|
||||
MRP: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.MRP,
|
||||
?.StockDetails?.[stockIndex]?.MRP,
|
||||
OrderRate: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||
SellingPrice: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||
SuppId:
|
||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.SuppId,
|
||||
|
|
@ -2819,6 +2827,18 @@ export default function BSC1Search(props) {
|
|||
};
|
||||
|
||||
const AddOrderDetails = async (item) => {
|
||||
|
||||
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||
if (overAllLimitPreferenece) {
|
||||
const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails);
|
||||
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setMessageType('warning');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (preOrder) {
|
||||
await handlePreOrder(item);
|
||||
} else {
|
||||
|
|
@ -2909,15 +2929,15 @@ export default function BSC1Search(props) {
|
|||
|
||||
const isExistsInFreeProdList = hasOffer
|
||||
? FreeProdList?.filter(
|
||||
(f) =>
|
||||
f?.FreeProdId === item?.ProdId &&
|
||||
f?.ProdVariantDetails?.some((variant) =>
|
||||
variant?.StockDetails?.some(
|
||||
(stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
|
||||
)
|
||||
) &&
|
||||
f?.RemainingQty > 0
|
||||
)
|
||||
(f) =>
|
||||
f?.FreeProdId === item?.ProdId &&
|
||||
f?.ProdVariantDetails?.some((variant) =>
|
||||
variant?.StockDetails?.some(
|
||||
(stock) => stock?.FreeInwardDtlId === item?.InwardDtlId
|
||||
)
|
||||
) &&
|
||||
f?.RemainingQty > 0
|
||||
)
|
||||
: [];
|
||||
|
||||
const calculateTaxAmounts = (qty, rate, taxPercentage) => {
|
||||
|
|
@ -2984,10 +3004,10 @@ export default function BSC1Search(props) {
|
|||
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||
? true
|
||||
: cartItem?.OfferMode !== 'B') &&
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O' &&
|
||||
cartItem?.OfferMode !== 'L'
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O' &&
|
||||
cartItem?.OfferMode !== 'L'
|
||||
? true
|
||||
: cartItem?.Offer === 0)
|
||||
);
|
||||
|
|
@ -3004,10 +3024,10 @@ export default function BSC1Search(props) {
|
|||
(cartItem) =>
|
||||
itemMatchCondition(cartItem) &&
|
||||
(cartItem?.OfferMode !== 'B' &&
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O' &&
|
||||
cartItem?.OfferMode !== 'L'
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O' &&
|
||||
cartItem?.OfferMode !== 'L'
|
||||
? true
|
||||
: cartItem?.Offer === 0)
|
||||
);
|
||||
|
|
@ -3021,10 +3041,10 @@ export default function BSC1Search(props) {
|
|||
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||
? true
|
||||
: cartItem?.OfferMode !== 'B') &&
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'L' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O'
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'L' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O'
|
||||
? true
|
||||
: cartItem?.Offer === 0)
|
||||
)
|
||||
|
|
@ -3035,10 +3055,10 @@ export default function BSC1Search(props) {
|
|||
!(
|
||||
itemMatchCondition(cartItem) &&
|
||||
(cartItem?.OfferMode !== 'B' &&
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'L' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O'
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'L' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O'
|
||||
? true
|
||||
: cartItem?.Offer === 0)
|
||||
)
|
||||
|
|
@ -3111,8 +3131,8 @@ export default function BSC1Search(props) {
|
|||
isItemInCart,
|
||||
item?.OtherProduct === 'Others' || item?.ScaleType === 'weight'
|
||||
? (
|
||||
(item?.OrderQty || 0) + parseFloat(isItemInCart?.OrderQty)
|
||||
)?.toFixed(3)
|
||||
(item?.OrderQty || 0) + parseFloat(isItemInCart?.OrderQty)
|
||||
)?.toFixed(3)
|
||||
: null
|
||||
);
|
||||
const updatedData = addFirst
|
||||
|
|
@ -3239,9 +3259,9 @@ export default function BSC1Search(props) {
|
|||
isItemInCartHold,
|
||||
item?.OtherProduct === 'Others' || item?.ScaleType === 'weight'
|
||||
? (
|
||||
(item?.OrderQty || 0) +
|
||||
parseFloat(isItemInCartHold?.OrderQty)
|
||||
)?.toFixed(3)
|
||||
(item?.OrderQty || 0) +
|
||||
parseFloat(isItemInCartHold?.OrderQty)
|
||||
)?.toFixed(3)
|
||||
: null
|
||||
);
|
||||
const updatedData = addFirst
|
||||
|
|
@ -3493,14 +3513,14 @@ export default function BSC1Search(props) {
|
|||
updatedCartData = cartData.map((item, idx) =>
|
||||
idx === indexToCheck
|
||||
? {
|
||||
...item,
|
||||
Offer: null,
|
||||
OfferMessage: undefined,
|
||||
OfferMode: undefined,
|
||||
OfferModeType: false,
|
||||
OfferType: undefined,
|
||||
OfferValue: null,
|
||||
}
|
||||
...item,
|
||||
Offer: null,
|
||||
OfferMessage: undefined,
|
||||
OfferMode: undefined,
|
||||
OfferModeType: false,
|
||||
OfferType: undefined,
|
||||
OfferValue: null,
|
||||
}
|
||||
: item
|
||||
);
|
||||
}
|
||||
|
|
@ -3551,8 +3571,8 @@ export default function BSC1Search(props) {
|
|||
...item,
|
||||
Offer:
|
||||
sameProduct ||
|
||||
bestOffer?.OfferMode === 'I' ||
|
||||
bestOffer?.OfferMode === 'Q'
|
||||
bestOffer?.OfferMode === 'I' ||
|
||||
bestOffer?.OfferMode === 'Q'
|
||||
? bestOffer?.OfferAmount || item.Offer
|
||||
: item.Offer || bestOffer?.OfferAmount,
|
||||
OfferType: item?.OfferType || bestOffer?.OfferType,
|
||||
|
|
@ -3569,10 +3589,10 @@ export default function BSC1Search(props) {
|
|||
((c?.OfferModeType && c?.OfferMode === 'B'
|
||||
? true
|
||||
: c?.OfferMode !== 'B') &&
|
||||
c?.OfferMode !== 'P' &&
|
||||
c?.OfferMode !== 'C' &&
|
||||
c?.OfferMode !== 'O' &&
|
||||
c?.OfferMode !== 'L'
|
||||
c?.OfferMode !== 'P' &&
|
||||
c?.OfferMode !== 'C' &&
|
||||
c?.OfferMode !== 'O' &&
|
||||
c?.OfferMode !== 'L'
|
||||
? true
|
||||
: c?.Offer === 0);
|
||||
|
||||
|
|
@ -3880,10 +3900,10 @@ export default function BSC1Search(props) {
|
|||
return FreeProdList.map((f, i) =>
|
||||
i === index
|
||||
? {
|
||||
...existing,
|
||||
...newFreeProd,
|
||||
ProdVariantDetails: existing.ProdVariantDetails,
|
||||
}
|
||||
...existing,
|
||||
...newFreeProd,
|
||||
ProdVariantDetails: existing.ProdVariantDetails,
|
||||
}
|
||||
: f
|
||||
);
|
||||
} else {
|
||||
|
|
@ -3953,7 +3973,7 @@ export default function BSC1Search(props) {
|
|||
const cycleSize = buyQty + getQty;
|
||||
const fullCycles = Math.floor(
|
||||
freeCartItem?.reduce((acc, fc) => acc + (fc?.OrderQty || 0), 0) /
|
||||
cycleSize
|
||||
cycleSize
|
||||
);
|
||||
const totalFreeQty = fullCycles * getQty;
|
||||
|
||||
|
|
@ -4557,15 +4577,15 @@ export default function BSC1Search(props) {
|
|||
{option.ProductDetail?.filter(
|
||||
(item) => item.OnePcsAvailable == 'Y'
|
||||
).length !== 0 && (
|
||||
<GoTriangleRight
|
||||
style={{
|
||||
fontSize: '25px',
|
||||
}}
|
||||
onClick={() => {
|
||||
setOnePeiceFlow(true);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<GoTriangleRight
|
||||
style={{
|
||||
fontSize: '25px',
|
||||
}}
|
||||
onClick={() => {
|
||||
setOnePeiceFlow(true);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
|
|
@ -4599,7 +4619,7 @@ export default function BSC1Search(props) {
|
|||
|
||||
<FiSearch
|
||||
className="BSC1Search-searchicon"
|
||||
// onClick={() => OnfocusTrue()}
|
||||
// onClick={() => OnfocusTrue()}
|
||||
/>
|
||||
</div>
|
||||
{ProductSearch?.length > 5 &&
|
||||
|
|
@ -4695,8 +4715,8 @@ export default function BSC1Search(props) {
|
|||
<img
|
||||
src={
|
||||
item?.ProdLogo &&
|
||||
item?.ProdLogo != null &&
|
||||
item?.ProdLogo != undefined
|
||||
item?.ProdLogo != null &&
|
||||
item?.ProdLogo != undefined
|
||||
? item?.ProdLogo
|
||||
: defaultimage
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { Drawer } from 'antd';
|
||||
import { Drawer, message } from 'antd';
|
||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||
import {
|
||||
changeKioskPageName,
|
||||
|
|
@ -16,10 +16,12 @@ import {
|
|||
GlobalBookingTypeKiosk,
|
||||
} from '../../../Features/BookingScreen/BookingData/KioskBookingData';
|
||||
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 dispatch = useDispatch();
|
||||
const preferenceDatas = useSelector(PreferenceData);
|
||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||
|
|
@ -35,7 +37,13 @@ const CardPage1 = (props) => {
|
|||
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||
(i) => i.SettingIdName === 'PrintUom'
|
||||
)?.[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(() => {
|
||||
getBookingTypeId();
|
||||
}, []);
|
||||
|
|
@ -49,6 +57,15 @@ const CardPage1 = (props) => {
|
|||
//Card on click function
|
||||
|
||||
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');
|
||||
|
||||
const transformedItem = {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { Drawer } from 'antd';
|
||||
import { Drawer, message } from 'antd';
|
||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||
import {
|
||||
changeKioskPageName,
|
||||
|
|
@ -15,10 +15,12 @@ import {
|
|||
changeKioskOrderDetails,
|
||||
} from '../../../Features/BookingScreen/BookingData/KioskBookingData';
|
||||
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 dispatch = useDispatch();
|
||||
const preferenceDatas = useSelector(PreferenceData);
|
||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||
|
|
@ -35,6 +37,13 @@ const CardPage2 = (props) => {
|
|||
(i) => i.SettingIdName === 'PrintUom'
|
||||
)?.[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(() => {
|
||||
getBookingTypeId();
|
||||
}, []);
|
||||
|
|
@ -48,6 +57,16 @@ const CardPage2 = (props) => {
|
|||
//Card on click function
|
||||
|
||||
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');
|
||||
|
||||
const transformedItem = {
|
||||
|
|
@ -81,11 +100,11 @@ const CardPage2 = (props) => {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.InwardDtlId &&
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.SellPrice
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.SellPrice
|
||||
);
|
||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||
if (Isincart?.BalanceQty > Isincart?.OrderQty) {
|
||||
|
|
@ -131,13 +150,13 @@ const CardPage2 = (props) => {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice
|
||||
);
|
||||
console.log(Isincart, item, KioskOrderDetails, 'IsincartsingleVarient');
|
||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||
|
|
@ -236,7 +255,7 @@ const CardPage2 = (props) => {
|
|||
SinglePc: onePcs ? 'Y' : 'N',
|
||||
NoOfPcs: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.NoOfPcs
|
||||
?.StockDetails?.[stockIndex]?.NoOfPcs
|
||||
: null,
|
||||
ProdVariantName:
|
||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
|
|
@ -261,14 +280,14 @@ const CardPage2 = (props) => {
|
|||
?.StockDetails?.[stockIndex]?.InwardId,
|
||||
MRP: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.MRP,
|
||||
?.StockDetails?.[stockIndex]?.MRP,
|
||||
OrderRate: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||
SuppId:
|
||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.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.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem.BookingTypeName === item.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem.BookingTypeName === item.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
@ -515,9 +534,9 @@ const CardPage2 = (props) => {
|
|||
card?.OverAllQty,
|
||||
KioskOrderDetails
|
||||
) > 0) ||
|
||||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
)
|
||||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
)
|
||||
? 'CardPage2-container'
|
||||
: 'CardPage2-container-dis '
|
||||
}
|
||||
|
|
@ -540,9 +559,9 @@ const CardPage2 = (props) => {
|
|||
card?.OverAllQty,
|
||||
KioskOrderDetails
|
||||
) > 0) ||
|
||||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
) ? (
|
||||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
) ? (
|
||||
''
|
||||
) : (
|
||||
<div
|
||||
|
|
@ -560,17 +579,17 @@ const CardPage2 = (props) => {
|
|||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
)) && (
|
||||
<p className="CardPage2-container-price">
|
||||
{' '}
|
||||
<span style={{ fontSize: '16px', fontFamily: 'gilroy' }}>
|
||||
₹
|
||||
</span>
|
||||
{ItemSellingPrice(card)}
|
||||
<span className="BSItemCard-itemCount">
|
||||
({ItemSize(card)} {ItemUomName(card)})
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
<p className="CardPage2-container-price">
|
||||
{' '}
|
||||
<span style={{ fontSize: '16px', fontFamily: 'gilroy' }}>
|
||||
₹
|
||||
</span>
|
||||
{ItemSellingPrice(card)}
|
||||
<span className="BSItemCard-itemCount">
|
||||
({ItemSize(card)} {ItemUomName(card)})
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
|
|
@ -723,7 +742,7 @@ const CardPage2 = (props) => {
|
|||
KioskOrderDetails,
|
||||
item?.ProdVariantName
|
||||
) > 0 ||
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
'Y'
|
||||
? 'ProVariantCard'
|
||||
: 'ProVariantCard-dis'
|
||||
|
|
@ -739,7 +758,7 @@ const CardPage2 = (props) => {
|
|||
KioskOrderDetails,
|
||||
item?.ProdVariantName
|
||||
) > 0 ||
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
'Y' ? (
|
||||
<div>₹ {item?.StockDetails?.[0]?.SellPrice}</div>
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useEffect, useState } from 'react';
|
||||
import { Drawer } from 'antd';
|
||||
import { Drawer, message } from 'antd';
|
||||
import { IoCheckmarkCircle } from 'react-icons/io5';
|
||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||
import defaultimage from '../../../Images/defaultItemImg.png';
|
||||
|
|
@ -14,10 +14,12 @@ import {
|
|||
import { settingDataSelector } from '../../../Features/PreferenceMaster/PreferenceMaster.js';
|
||||
import horizontal from '../../../Images/defaultItemImg.png';
|
||||
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 dispatch = useDispatch();
|
||||
const preferenceDatas = useSelector(PreferenceData);
|
||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||
console.log(KioskOrderDetails, 'KioskOrderDetailsKioskOrderDetails');
|
||||
|
|
@ -35,6 +37,13 @@ const CardPage3 = (props) => {
|
|||
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||
(i) => i.SettingIdName === 'PrintUom'
|
||||
)?.[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 = () => {
|
||||
setopenQuantity(false);
|
||||
};
|
||||
|
|
@ -47,6 +56,15 @@ const CardPage3 = (props) => {
|
|||
}, []);
|
||||
//Card on click function
|
||||
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');
|
||||
|
||||
const transformedItem = {
|
||||
|
|
@ -80,11 +98,11 @@ const CardPage3 = (props) => {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.InwardDtlId &&
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.SellPrice
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.SellPrice
|
||||
);
|
||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||
if (Isincart?.BalanceQty > Isincart?.OrderQty) {
|
||||
|
|
@ -131,13 +149,13 @@ const CardPage3 = (props) => {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice
|
||||
);
|
||||
console.log(Isincart, item, KioskOrderDetails, 'IsincartsingleVarient');
|
||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||
|
|
@ -234,7 +252,7 @@ const CardPage3 = (props) => {
|
|||
SinglePc: onePcs ? 'Y' : 'N',
|
||||
NoOfPcs: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.NoOfPcs
|
||||
?.StockDetails?.[stockIndex]?.NoOfPcs
|
||||
: null,
|
||||
ProdVariantName:
|
||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
|
|
@ -259,14 +277,14 @@ const CardPage3 = (props) => {
|
|||
?.StockDetails?.[stockIndex]?.InwardId,
|
||||
MRP: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.MRP,
|
||||
?.StockDetails?.[stockIndex]?.MRP,
|
||||
OrderRate: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||
SuppId:
|
||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.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.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem.BookingTypeName === item.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem.BookingTypeName === item.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
@ -516,9 +534,9 @@ const CardPage3 = (props) => {
|
|||
card?.OverAllQty,
|
||||
KioskOrderDetails
|
||||
) > 0) ||
|
||||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
)
|
||||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
)
|
||||
? 'CardPage3-container'
|
||||
: 'CardPage3-container-dis'
|
||||
}
|
||||
|
|
@ -529,10 +547,10 @@ const CardPage3 = (props) => {
|
|||
{KioskOrderDetails?.some(
|
||||
(item) => item?.ProdName === card?.ProdName
|
||||
) && (
|
||||
<div className="CardPage3-check-symbol">
|
||||
<IoCheckmarkCircle />
|
||||
</div>
|
||||
)}
|
||||
<div className="CardPage3-check-symbol">
|
||||
<IoCheckmarkCircle />
|
||||
</div>
|
||||
)}
|
||||
<img
|
||||
src={
|
||||
card?.ProductDetail?.[0]?.ProdLogo
|
||||
|
|
@ -548,9 +566,9 @@ const CardPage3 = (props) => {
|
|||
card?.OverAllQty,
|
||||
KioskOrderDetails
|
||||
) > 0) ||
|
||||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
) ? (
|
||||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
) ? (
|
||||
''
|
||||
) : (
|
||||
<div
|
||||
|
|
@ -568,13 +586,13 @@ const CardPage3 = (props) => {
|
|||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
)) && (
|
||||
<p className="CardPage3-container-price">
|
||||
₹{ItemSellingPrice(card)}
|
||||
<span className="BSItemCard-itemCount">
|
||||
({ItemSize(card)} {ItemUomName(card)})
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
<p className="CardPage3-container-price">
|
||||
₹{ItemSellingPrice(card)}
|
||||
<span className="BSItemCard-itemCount">
|
||||
({ItemSize(card)} {ItemUomName(card)})
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
|
|
@ -724,7 +742,7 @@ const CardPage3 = (props) => {
|
|||
KioskOrderDetails,
|
||||
item?.ProdVariantName
|
||||
) > 0 ||
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
'Y'
|
||||
? 'ProVariantCard'
|
||||
: 'ProVariantCard-dis'
|
||||
|
|
@ -740,7 +758,7 @@ const CardPage3 = (props) => {
|
|||
KioskOrderDetails,
|
||||
item?.ProdVariantName
|
||||
) > 0 ||
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
'Y' ? (
|
||||
<div>₹{item?.StockDetails?.[0]?.SellPrice}</div>
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { useDispatch, useSelector } from 'react-redux';
|
|||
import { AiFillPlusCircle, AiFillMinusCircle } from 'react-icons/ai';
|
||||
import { BsHandbag } from 'react-icons/bs';
|
||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||
import { Drawer } from 'antd';
|
||||
import { Drawer, message } from 'antd';
|
||||
import '../../../Styles/Kiosk/CardPage/CardPage4.scss';
|
||||
import {
|
||||
GlobalBookingTypeKiosk,
|
||||
|
|
@ -14,10 +14,12 @@ import {
|
|||
import { settingDataSelector } from '../../../Features/PreferenceMaster/PreferenceMaster.js';
|
||||
import horizontal from '../../../Images/defaultItemImg.png';
|
||||
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 dispatch = useDispatch();
|
||||
const preferenceDatas = useSelector(PreferenceData);
|
||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||
console.log(KioskOrderDetails, 'KioskOrderDetails');
|
||||
|
|
@ -36,7 +38,13 @@ const CardPage4 = (props) => {
|
|||
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||
(i) => i.SettingIdName === 'PrintUom'
|
||||
)?.[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(() => {
|
||||
getBookingTypeId();
|
||||
}, []);
|
||||
|
|
@ -79,6 +87,15 @@ const CardPage4 = (props) => {
|
|||
//Card on click function
|
||||
|
||||
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');
|
||||
|
||||
const transformedItem = {
|
||||
|
|
@ -112,11 +129,11 @@ const CardPage4 = (props) => {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === item?.ProductDetail?.[0]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.InwardDtlId &&
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.SellPrice
|
||||
item?.ProductDetail?.[0]?.ProdVariantDetails?.[0]?.StockDetails?.[0]
|
||||
?.SellPrice
|
||||
);
|
||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||
if (Isincart?.BalanceQty > Isincart?.OrderQty) {
|
||||
|
|
@ -162,13 +179,13 @@ const CardPage4 = (props) => {
|
|||
(cartItem) =>
|
||||
cartItem?.ProdId === qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.InwardDtlId &&
|
||||
cartItem?.OrderRate ===
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice
|
||||
qtydata?.ProductDetail?.[item?.QtyIndex]?.ProdVariantDetails?.[
|
||||
item?.VarientIndex
|
||||
]?.StockDetails?.[0]?.SellPrice
|
||||
);
|
||||
|
||||
if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||
|
|
@ -259,7 +276,7 @@ const CardPage4 = (props) => {
|
|||
SinglePc: onePcs ? 'Y' : 'N',
|
||||
NoOfPcs: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.NoOfPcs
|
||||
?.StockDetails?.[stockIndex]?.NoOfPcs
|
||||
: null,
|
||||
ProdVariantName:
|
||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
|
|
@ -284,14 +301,14 @@ const CardPage4 = (props) => {
|
|||
?.StockDetails?.[stockIndex]?.InwardId,
|
||||
MRP: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.MRP,
|
||||
?.StockDetails?.[stockIndex]?.MRP,
|
||||
OrderRate: onePcs
|
||||
? a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
?.StockDetails?.[stockIndex]?.OnePcsPrice
|
||||
: a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||
?.StockDetails?.[stockIndex]?.SellPrice,
|
||||
SuppId:
|
||||
a?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[VarientIndex]
|
||||
?.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.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
@ -583,9 +600,9 @@ const CardPage4 = (props) => {
|
|||
card?.OverAllQty,
|
||||
KioskOrderDetails
|
||||
) > 0) ||
|
||||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
) ? (
|
||||
card?.ProductDetail?.some(
|
||||
(item) => item?.StockAvailable !== 'Y'
|
||||
) ? (
|
||||
<div
|
||||
className="CardPage4-addbutton"
|
||||
onClick={() => CardOnClick(card)}
|
||||
|
|
@ -745,7 +762,7 @@ const CardPage4 = (props) => {
|
|||
KioskOrderDetails,
|
||||
item?.ProdVariantName
|
||||
) > 0 ||
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
'Y'
|
||||
? 'ProVariantCard'
|
||||
: 'ProVariantCard-dis'
|
||||
|
|
@ -761,7 +778,7 @@ const CardPage4 = (props) => {
|
|||
KioskOrderDetails,
|
||||
item?.ProdVariantName
|
||||
) > 0 ||
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
qtydata?.ProductDetail?.[QtyIndex]?.StockAvailable !==
|
||||
'Y' ? (
|
||||
<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 axios from 'axios';
|
||||
import { Skeleton } from 'antd';
|
||||
|
|
@ -70,6 +70,11 @@ const KioskBookingPage = () => {
|
|||
}, []);
|
||||
|
||||
const fetchData = async () => {
|
||||
dispatch(getPreferenceData({
|
||||
CompId: SessionDtl?.CompId,
|
||||
BranchId: SessionDtl?.BranchId,
|
||||
AppId: SessionDtl?.AppId,
|
||||
})).unwrap();
|
||||
const queryParams = await getQueryParams();
|
||||
|
||||
console.log('queryParams', queryParams);
|
||||
|
|
@ -143,7 +148,7 @@ const KioskBookingPage = () => {
|
|||
responseData?.SessionId != null &&
|
||||
responseData?.SessionId != undefined &&
|
||||
sessionStore('SessionId', responseData?.SessionId);
|
||||
responseData?.DeviceAddress != null &&
|
||||
responseData?.DeviceAddress != null &&
|
||||
responseData?.DeviceAddress != undefined &&
|
||||
sessionStore('DeviceAddress', MACAddress);
|
||||
sessionStore('hasRefreshed', true);
|
||||
|
|
@ -160,10 +165,12 @@ const KioskBookingPage = () => {
|
|||
AppId: responseData?.AppId,
|
||||
DeviceMacAddress: MACAddress
|
||||
})).unwrap();
|
||||
|
||||
dispatch(getPreferenceData({ CompId: responseData?.CompId,
|
||||
|
||||
dispatch(getPreferenceData({
|
||||
CompId: responseData?.CompId,
|
||||
BranchId: responseData?.BranchId,
|
||||
AppId: responseData?.AppId,})).unwrap();
|
||||
AppId: responseData?.AppId,
|
||||
})).unwrap();
|
||||
dispatch(
|
||||
getProductCategories({
|
||||
CompId: responseData?.CompId,
|
||||
|
|
@ -274,7 +281,7 @@ const KioskBookingPage = () => {
|
|||
AppId: AppId,
|
||||
})
|
||||
).unwrap();
|
||||
|
||||
|
||||
if (Response?.data?.statusCode == 1) {
|
||||
dispatch(
|
||||
getProductCardListKiosk({
|
||||
|
|
|
|||
|
|
@ -4,9 +4,22 @@ import { changeKioskOrderDetails } from '../../../Features/BookingScreen/Booking
|
|||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||
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 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 removeFromCart = async (item) => {
|
||||
await dispatch(
|
||||
|
|
@ -24,6 +37,15 @@ const KisokOrderCart1 = (props) => {
|
|||
);
|
||||
};
|
||||
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(
|
||||
changeKioskOrderDetails(
|
||||
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.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
@ -76,28 +98,28 @@ const KisokOrderCart1 = (props) => {
|
|||
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||
) =>
|
||||
cartItem.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,9 +6,22 @@ import '../../../Styles/Kiosk/OrderCart/OrderCart2.scss';
|
|||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||
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 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 removeFromCart = async (item) => {
|
||||
|
|
@ -27,6 +40,16 @@ const KisokOrderCart2 = (props) => {
|
|||
);
|
||||
};
|
||||
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(
|
||||
changeKioskOrderDetails(
|
||||
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.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
@ -79,28 +102,28 @@ const KisokOrderCart2 = (props) => {
|
|||
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||
) =>
|
||||
cartItem.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem.BookingTypeName === item.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem.BookingTypeName === item.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -8,10 +8,22 @@ import {
|
|||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||
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 dispatch = useDispatch();
|
||||
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 KioskOrderDetails = props?.KioskOrderDetails;
|
||||
|
||||
|
|
@ -31,6 +43,15 @@ const KisokOrderCart3 = (props) => {
|
|||
);
|
||||
};
|
||||
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(
|
||||
changeKioskOrderDetails(
|
||||
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.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
@ -81,28 +102,28 @@ const KisokOrderCart3 = (props) => {
|
|||
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||
) =>
|
||||
cartItem.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ import KioskFooter3 from '../Components/KioskFooter3';
|
|||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||
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 KioskThemeData = props?.hasOwnProperty('KioskThemeData')
|
||||
|
|
@ -24,6 +27,14 @@ const OrderView1 = (props) => {
|
|||
const dispatch = useDispatch();
|
||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||
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 () => {
|
||||
await dispatch(changeKioskPageName('categoryPage'));
|
||||
|
|
@ -44,6 +55,17 @@ const OrderView1 = (props) => {
|
|||
);
|
||||
};
|
||||
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(
|
||||
changeKioskOrderDetails(
|
||||
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.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
@ -96,28 +118,28 @@ const OrderView1 = (props) => {
|
|||
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||
) =>
|
||||
cartItem.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ import { IoMdClose } from 'react-icons/io';
|
|||
import defaultImg from '../../../Images/defaultItemImg.png';
|
||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||
import { message } from 'antd';
|
||||
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||
|
||||
const KioskOrderView2 = (props) => {
|
||||
console.log(props, 'propsprops');
|
||||
|
|
@ -25,6 +28,15 @@ const KioskOrderView2 = (props) => {
|
|||
? props['KioskThemeData']
|
||||
: null;
|
||||
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 getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||
console.log(KioskOrderDetails, 'KioskOrderDetailsh');
|
||||
|
|
@ -54,6 +66,15 @@ const KioskOrderView2 = (props) => {
|
|||
);
|
||||
};
|
||||
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(
|
||||
changeKioskOrderDetails(
|
||||
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.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
@ -106,28 +127,28 @@ const KioskOrderView2 = (props) => {
|
|||
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||
) =>
|
||||
cartItem.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem.BookingTypeName === item.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem.BookingTypeName === item.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ import {
|
|||
import KioskFooter3 from '../Components/KioskFooter3';
|
||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||
import { message } from 'antd';
|
||||
|
||||
const KioskOrderView = (props) => {
|
||||
console.log(props, 'propsprops');
|
||||
|
|
@ -27,6 +30,14 @@ const KioskOrderView = (props) => {
|
|||
const dispatch = useDispatch();
|
||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||
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 () => {
|
||||
await dispatch(changeKioskPageName('categoryPage'));
|
||||
|
|
@ -47,6 +58,16 @@ const KioskOrderView = (props) => {
|
|||
);
|
||||
};
|
||||
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(
|
||||
changeKioskOrderDetails(
|
||||
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.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty + 1,
|
||||
TotalAmt: (cartItem.OrderQty + 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty + 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty + 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
@ -98,28 +119,28 @@ const KioskOrderView = (props) => {
|
|||
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||
) =>
|
||||
cartItem.ProdId === item.ProdId &&
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
cartItem.InwardDtlId === item.InwardDtlId &&
|
||||
cartItem.OrderRate === item.OrderRate &&
|
||||
cartItem?.BookingTypeName === item?.BookingTypeName
|
||||
? {
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
...cartItem,
|
||||
OrderQty: cartItem.OrderQty - 1,
|
||||
TotalAmt: (cartItem.OrderQty - 1) * cartItem.OrderRate,
|
||||
TaxAmt: (
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).toFixed(2),
|
||||
WithoutTaxRate:
|
||||
(cartItem.OrderQty - 1) * cartItem.OrderRate -
|
||||
(
|
||||
((cartItem.OrderQty - 1) *
|
||||
cartItem.OrderRate *
|
||||
cartItem.TaxPercentage) /
|
||||
(100 + cartItem.TaxPercentage)
|
||||
).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
|
||||
)
|
||||
)
|
||||
|
|
@ -201,10 +222,10 @@ const KioskOrderView = (props) => {
|
|||
{!item?.ProdVariantName?.toLowerCase().includes(
|
||||
'variant'
|
||||
) && (
|
||||
<span style={{ color: 'black' }}>
|
||||
{item?.ProdVariantName}{' '}
|
||||
</span>
|
||||
)}{' '}
|
||||
<span style={{ color: 'black' }}>
|
||||
{item?.ProdVariantName}{' '}
|
||||
</span>
|
||||
)}{' '}
|
||||
{item?.Size}{' '}
|
||||
{item?.SinglePc == 'Y' ? 'PCS' : item?.UomName}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
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 FormHeader from '../PageComponents/FormHeader.jsx';
|
||||
import Buttons from '../../Components/Forms/Buttons.jsx';
|
||||
|
|
@ -57,68 +57,71 @@ const PreferenceList = () => {
|
|||
const settingsList = tableValue[0]?.SettingDtlDetails ?? preferenceConfigs;
|
||||
|
||||
const allSettingsMap = {};
|
||||
settingsList?.forEach(({ SettingIdName, SettingValue }) => {
|
||||
allSettingsMap[SettingIdName?.toLowerCase()] = SettingValue;
|
||||
settingsList?.forEach(({ SettingIdName, SettingValue, SettingCount }) => {
|
||||
allSettingsMap[SettingIdName?.toLowerCase()] = { value: SettingValue, count: SettingCount };
|
||||
});
|
||||
|
||||
console.log(allSettingsMap, 'allSettingsMapallSettingsMapallSettingsMap');
|
||||
console.log(settingsList, 'settingsList');
|
||||
|
||||
const buildInitialValues = () => ({
|
||||
dashboard: allSettingsMap['dashboard'] === 'Y',
|
||||
shortcutkeys: allSettingsMap['shortcutkeys'] === 'Y',
|
||||
autoreceivestock: allSettingsMap['autoreceivestock'] === 'Y',
|
||||
decimal: allSettingsMap['decimal'] === 'Y',
|
||||
dashboard: allSettingsMap['dashboard']?.value === 'Y',
|
||||
shortcutkeys: allSettingsMap['shortcutkeys']?.value === 'Y',
|
||||
autoreceivestock: allSettingsMap['autoreceivestock']?.value === 'Y',
|
||||
decimal: allSettingsMap['decimal']?.value === 'Y',
|
||||
enabledModules: [
|
||||
...(allSettingsMap['dinein'] === 'Y' ? ['dinein'] : []),
|
||||
...(allSettingsMap['estimation'] === 'Y' ? ['estimation'] : []),
|
||||
...(allSettingsMap['dinein']?.value === 'Y' ? ['dinein'] : []),
|
||||
...(allSettingsMap['estimation']?.value === 'Y' ? ['estimation'] : []),
|
||||
],
|
||||
searchfocus: allSettingsMap['searchfocus'] === 'Y',
|
||||
addproductcard: allSettingsMap['addproductcard'] === 'Y',
|
||||
searchfocus: allSettingsMap['searchfocus']?.value === 'Y',
|
||||
addproductcard: allSettingsMap['addproductcard']?.value === 'Y',
|
||||
enabledFeatures: [
|
||||
...(allSettingsMap['parking'] === 'Y' ? ['parking'] : []),
|
||||
...(allSettingsMap['offer'] === 'Y' ? ['offer'] : []),
|
||||
...(allSettingsMap['parking']?.value === 'Y' ? ['parking'] : []),
|
||||
...(allSettingsMap['offer']?.value === 'Y' ? ['offer'] : []),
|
||||
],
|
||||
stockselection: allSettingsMap['stockselection'] === 'Y',
|
||||
weightasquantity: allSettingsMap['weightasquantity'] === 'Y',
|
||||
expiredselection: allSettingsMap['expiredselection'] === 'Y',
|
||||
'sales mode': allSettingsMap['sales mode'] === 'Y',
|
||||
billitemsorder: allSettingsMap['billitemsorder'] === 'Y',
|
||||
preorderpricechange: allSettingsMap['preorderpricechange'] === 'Y',
|
||||
stockselection: allSettingsMap['stockselection']?.value === 'Y',
|
||||
weightasquantity: allSettingsMap['weightasquantity']?.value === 'Y',
|
||||
expiredselection: allSettingsMap['expiredselection']?.value === 'Y',
|
||||
'sales mode': allSettingsMap['sales mode']?.value === 'Y',
|
||||
billitemsorder: allSettingsMap['billitemsorder']?.value === 'Y',
|
||||
preorderpricechange: allSettingsMap['preorderpricechange']?.value === 'Y',
|
||||
quantityrestriction: allSettingsMap['overalllimit']?.value === 'Y' || allSettingsMap['itemwiselimit']?.value === 'Y',
|
||||
quantityrestrictiontype: allSettingsMap['overalllimit']?.value === 'Y' ? 'overall' : allSettingsMap['itemwiselimit']?.value === 'Y' ? 'itemwise' : 'overall',
|
||||
maxquantity: allSettingsMap['overalllimit']?.value === 'Y' ? allSettingsMap['overalllimit']?.count || 1 : allSettingsMap['itemwiselimit']?.value === 'Y' ? allSettingsMap['itemwiselimit']?.count || 1 : 1,
|
||||
billOption: ['whatsapp', 'sms', 'email'].some(
|
||||
(k) => allSettingsMap[k] === 'Y'
|
||||
(k) => allSettingsMap[k]?.value === 'Y'
|
||||
)
|
||||
? 'pdf'
|
||||
: 'print',
|
||||
pdfSendOptions: ['whatsapp', 'email', 'sms'].filter(
|
||||
(k) => allSettingsMap[k] === 'Y'
|
||||
(k) => allSettingsMap[k]?.value === 'Y'
|
||||
),
|
||||
tokenonly: allSettingsMap['tokenonly'] === 'Y',
|
||||
tokenonly: allSettingsMap['tokenonly']?.value === 'Y',
|
||||
allproductindividualtoken:
|
||||
allSettingsMap['allproductindividualtoken'] === 'Y',
|
||||
allSettingsMap['allproductindividualtoken']?.value === 'Y',
|
||||
printOptions: ['printuom', 'printlogo', 'printgreetings'].filter(
|
||||
(k) => allSettingsMap[k] === 'Y'
|
||||
(k) => allSettingsMap[k]?.value === 'Y'
|
||||
),
|
||||
mobilea4: allSettingsMap['mobilea4'] === 'Y',
|
||||
estimateprintheader: allSettingsMap['estimateprintheader'] === 'Y',
|
||||
scanlayout: allSettingsMap['scanlayout'] === 'Y',
|
||||
verifyproduct: allSettingsMap['verifyproduct'] === 'Y',
|
||||
customisedbillnumber: allSettingsMap['customisedbillnumber'] === 'Y',
|
||||
upiqr: allSettingsMap['upiqr'] === 'Y',
|
||||
lowstockreport: allSettingsMap['lowstockreport'] === 'Y',
|
||||
weeklysalesreport: allSettingsMap['weeklysalesreport'] === 'Y',
|
||||
notificationblink: allSettingsMap['notificationblink'] === 'Y',
|
||||
onlineindivdualslots: allSettingsMap['onlineindivdualslots'] === 'Y',
|
||||
editbill: allSettingsMap['editbill'] === 'Y',
|
||||
mobilea4: allSettingsMap['mobilea4']?.value === 'Y',
|
||||
estimateprintheader: allSettingsMap['estimateprintheader']?.value === 'Y',
|
||||
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
|
||||
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
|
||||
customisedbillnumber: allSettingsMap['customisedbillnumber']?.value === 'Y',
|
||||
upiqr: allSettingsMap['upiqr']?.value === 'Y',
|
||||
lowstockreport: allSettingsMap['lowstockreport']?.value === 'Y',
|
||||
weeklysalesreport: allSettingsMap['weeklysalesreport']?.value === 'Y',
|
||||
notificationblink: allSettingsMap['notificationblink']?.value === 'Y',
|
||||
onlineindivdualslots: allSettingsMap['onlineindivdualslots']?.value === 'Y',
|
||||
editbill: allSettingsMap['editbill']?.value === 'Y',
|
||||
notification: [
|
||||
...(allSettingsMap['onbilltime'] === 'Y' ? ['onbilltime'] : []),
|
||||
...(allSettingsMap['1daybefore'] === 'Y' ? ['1daybefore'] : []),
|
||||
...(allSettingsMap['1hourbefore'] === 'Y' ? ['1hourbefore'] : []),
|
||||
...(allSettingsMap['onbilltime']?.value === 'Y' ? ['onbilltime'] : []),
|
||||
...(allSettingsMap['1daybefore']?.value === 'Y' ? ['1daybefore'] : []),
|
||||
...(allSettingsMap['1hourbefore']?.value === 'Y' ? ['1hourbefore'] : []),
|
||||
],
|
||||
BookingOptionsandmethod: [
|
||||
...(allSettingsMap['allow individual booking'] === 'Y'
|
||||
...(allSettingsMap['allow individual booking']?.value === 'Y'
|
||||
? ['allow individual booking']
|
||||
: []),
|
||||
...(allSettingsMap['single booking only'] === 'Y'
|
||||
...(allSettingsMap['single booking only']?.value === 'Y'
|
||||
? ['single booking only']
|
||||
: []),
|
||||
],
|
||||
|
|
@ -310,6 +313,8 @@ const PreferenceList = () => {
|
|||
weeklysalesreport: values.weeklysalesreport,
|
||||
notificationblink: values.notificationblink,
|
||||
editbill: values.editbill,
|
||||
overalllimit: values.quantityrestriction && values.quantityrestrictiontype === 'overall',
|
||||
itemwiselimit: values.quantityrestriction && values.quantityrestrictiontype === 'itemwise',
|
||||
};
|
||||
|
||||
const arrayValues = {
|
||||
|
|
@ -340,6 +345,7 @@ const PreferenceList = () => {
|
|||
SettingId: setting.SettingId,
|
||||
Comments: setting.Comments || 'Enter Comment',
|
||||
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['allow individual booking'] !== undefined ||
|
||||
allSettingsMap['single booking only'] !== undefined) && (
|
||||
<Form.Item
|
||||
name="BookingOptionsandmethod"
|
||||
label="Individual Selling Setup"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['allow individual booking'] !==
|
||||
undefined && (
|
||||
<Checkbox value="allow individual booking">
|
||||
Allow online individual booking
|
||||
</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['single booking only'] !== undefined && (
|
||||
<Checkbox value="single booking only">
|
||||
Allow single booking Only
|
||||
</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item
|
||||
name="BookingOptionsandmethod"
|
||||
label="Individual Selling Setup"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['allow individual booking'] !==
|
||||
undefined && (
|
||||
<Checkbox value="allow individual booking">
|
||||
Allow online individual booking
|
||||
</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['single booking only'] !== undefined && (
|
||||
<Checkbox value="single booking only">
|
||||
Allow single booking Only
|
||||
</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Divider />
|
||||
|
|
@ -532,23 +538,23 @@ const PreferenceList = () => {
|
|||
{(allSettingsMap['onbilltime'] !== undefined ||
|
||||
allSettingsMap['1daybefore'] !== undefined ||
|
||||
allSettingsMap['1hourbefore'] !== undefined) && (
|
||||
<Form.Item
|
||||
name="notification"
|
||||
label="Choose notification timing:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['onbilltime'] !== undefined && (
|
||||
<Checkbox value="onbilltime">On Bill Time</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['1daybefore'] !== undefined && (
|
||||
<Checkbox value="1daybefore">1 Day Before</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['1hourbefore'] !== undefined && (
|
||||
<Checkbox value="1hourbefore">1 Hour Before</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item
|
||||
name="notification"
|
||||
label="Choose notification timing:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['onbilltime'] !== undefined && (
|
||||
<Checkbox value="onbilltime">On Bill Time</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['1daybefore'] !== undefined && (
|
||||
<Checkbox value="1daybefore">1 Day Before</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['1hourbefore'] !== undefined && (
|
||||
<Checkbox value="1hourbefore">1 Hour Before</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div
|
||||
|
|
@ -575,37 +581,37 @@ const PreferenceList = () => {
|
|||
|
||||
{(allSettingsMap['offer'] !== undefined ||
|
||||
allSettingsMap['parking'] !== undefined) && (
|
||||
<Form.Item
|
||||
name="enabledFeatures"
|
||||
label="Select the features you want to enable:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['parking'] !== undefined && (
|
||||
<Checkbox value="parking">Parking</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['offer'] !== undefined && (
|
||||
<Checkbox value="offer">Offer</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item
|
||||
name="enabledFeatures"
|
||||
label="Select the features you want to enable:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['parking'] !== undefined && (
|
||||
<Checkbox value="parking">Parking</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['offer'] !== undefined && (
|
||||
<Checkbox value="offer">Offer</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
{((allSettingsMap['dinein'] !== undefined && dinePreference) ||
|
||||
allSettingsMap['estimation'] !== undefined) && (
|
||||
<Form.Item
|
||||
name="enabledModules"
|
||||
label="Select the modules you want to enable:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['dinein'] !== undefined &&
|
||||
dinePreference && (
|
||||
<Checkbox value="dinein">Dine-In</Checkbox>
|
||||
<Form.Item
|
||||
name="enabledModules"
|
||||
label="Select the modules you want to enable:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['dinein'] !== undefined &&
|
||||
dinePreference && (
|
||||
<Checkbox value="dinein">Dine-In</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['estimation'] !== undefined && (
|
||||
<Checkbox value="estimation">Estimation</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['estimation'] !== undefined && (
|
||||
<Checkbox value="estimation">Estimation</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
{renderCheckbox('stockselection', 'Enable stock selection?')}
|
||||
{renderCheckbox('weightasquantity', 'Use Weight as Quantity?')}
|
||||
|
|
@ -630,6 +636,38 @@ const PreferenceList = () => {
|
|||
{renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')}
|
||||
{renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')}
|
||||
{/* {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>
|
||||
|
||||
<Divider />
|
||||
|
|
@ -652,46 +690,46 @@ const PreferenceList = () => {
|
|||
{['whatsapp', 'sms', 'email'].some(
|
||||
(k) => allSettingsMap[k] !== undefined
|
||||
) && (
|
||||
<>
|
||||
<Form.Item
|
||||
name="billOption"
|
||||
label="Choose how to handle bills:"
|
||||
>
|
||||
<Radio.Group>
|
||||
<Radio value="print">Print Bill</Radio>
|
||||
<Radio value="pdf">Send PDF</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<>
|
||||
<Form.Item
|
||||
name="billOption"
|
||||
label="Choose how to handle bills:"
|
||||
>
|
||||
<Radio.Group>
|
||||
<Radio value="print">Print Bill</Radio>
|
||||
<Radio value="pdf">Send PDF</Radio>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, curr) =>
|
||||
prev.billOption !== curr.billOption
|
||||
}
|
||||
>
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('billOption') === 'pdf' && (
|
||||
<Form.Item
|
||||
name="pdfSendOptions"
|
||||
label="Select how to send the PDF:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['whatsapp'] !== undefined && (
|
||||
<Checkbox value="whatsapp">WhatsApp</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['email'] !== undefined && (
|
||||
<Checkbox value="email">Email</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['sms'] !== undefined && (
|
||||
<Checkbox value="sms">SMS</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)
|
||||
}
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
<Form.Item
|
||||
noStyle
|
||||
shouldUpdate={(prev, curr) =>
|
||||
prev.billOption !== curr.billOption
|
||||
}
|
||||
>
|
||||
{({ getFieldValue }) =>
|
||||
getFieldValue('billOption') === 'pdf' && (
|
||||
<Form.Item
|
||||
name="pdfSendOptions"
|
||||
label="Select how to send the PDF:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['whatsapp'] !== undefined && (
|
||||
<Checkbox value="whatsapp">WhatsApp</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['email'] !== undefined && (
|
||||
<Checkbox value="email">Email</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['sms'] !== undefined && (
|
||||
<Checkbox value="sms">SMS</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)
|
||||
}
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
|
||||
{renderCheckbox(
|
||||
'tokenonly',
|
||||
|
|
@ -721,25 +759,25 @@ const PreferenceList = () => {
|
|||
{['printuom', 'printlogo', 'printgreetings'].some(
|
||||
(k) => allSettingsMap[k] !== undefined
|
||||
) && (
|
||||
<Form.Item
|
||||
name="printOptions"
|
||||
label="Select what you want to include in the print:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['printuom'] !== undefined && (
|
||||
<Checkbox value="printuom">
|
||||
Unit of Measure (UOM)
|
||||
</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['printlogo'] !== undefined && (
|
||||
<Checkbox value="printlogo">Branch Logo</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['printgreetings'] !== undefined && (
|
||||
<Checkbox value="printgreetings">Greetings</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item
|
||||
name="printOptions"
|
||||
label="Select what you want to include in the print:"
|
||||
>
|
||||
<Checkbox.Group>
|
||||
{allSettingsMap['printuom'] !== undefined && (
|
||||
<Checkbox value="printuom">
|
||||
Unit of Measure (UOM)
|
||||
</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['printlogo'] !== undefined && (
|
||||
<Checkbox value="printlogo">Branch Logo</Checkbox>
|
||||
)}
|
||||
{allSettingsMap['printgreetings'] !== undefined && (
|
||||
<Checkbox value="printgreetings">Greetings</Checkbox>
|
||||
)}
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
{renderCheckbox(
|
||||
'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