Merge pull request 'Constrain quantityFix' (#166) from quantityFix into main
Reviewed-on: Pozomind/pozo-retail-app#166
This commit is contained in:
commit
f1e8442872
|
|
@ -41,6 +41,7 @@ import {
|
||||||
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
|
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import WeightCalculatePrice from './WeightCalculatePrice.jsx';
|
import WeightCalculatePrice from './WeightCalculatePrice.jsx';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
|
||||||
|
|
||||||
const BSBillingEditQuantity = (props) => {
|
const BSBillingEditQuantity = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
@ -49,7 +50,7 @@ const BSBillingEditQuantity = (props) => {
|
||||||
const priceChangeInputRef = useRef(null);
|
const priceChangeInputRef = useRef(null);
|
||||||
const reductionInputRef = useRef(null);
|
const reductionInputRef = useRef(null);
|
||||||
|
|
||||||
const { setIndex = () => {} } = props;
|
const { setIndex = () => { } } = props;
|
||||||
|
|
||||||
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
||||||
const SessionData = useSelector(StoredSessionData);
|
const SessionData = useSelector(StoredSessionData);
|
||||||
|
|
@ -64,6 +65,14 @@ const BSBillingEditQuantity = (props) => {
|
||||||
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
|
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
|
||||||
shallowEqual
|
shallowEqual
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
const preferenceOffer =
|
const preferenceOffer =
|
||||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
(item) => item.SettingIdName === 'Offer'
|
(item) => item.SettingIdName === 'Offer'
|
||||||
|
|
@ -107,8 +116,8 @@ const BSBillingEditQuantity = (props) => {
|
||||||
quantity: 'qty',
|
quantity: 'qty',
|
||||||
Parcel: 'Parcel',
|
Parcel: 'Parcel',
|
||||||
weightAmount: 'weightAmount'
|
weightAmount: 'weightAmount'
|
||||||
};
|
};
|
||||||
const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
|
if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
|
||||||
return SHORTKEY_TO_RADIO[props.shortKeyMethod];
|
return SHORTKEY_TO_RADIO[props.shortKeyMethod];
|
||||||
}
|
}
|
||||||
|
|
@ -119,7 +128,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
return 'Price';
|
return 'Price';
|
||||||
}
|
}
|
||||||
return 'Parcel';
|
return 'Parcel';
|
||||||
});
|
});
|
||||||
// const [RadioBtnSelection, setRadioBtnSelection] = useState(
|
// const [RadioBtnSelection, setRadioBtnSelection] = useState(
|
||||||
// props?.shortKeyMethod == 'price'
|
// props?.shortKeyMethod == 'price'
|
||||||
// ? 'Price'
|
// ? 'Price'
|
||||||
|
|
@ -334,6 +343,7 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const calculateOverAllQty = (item, filterItems) => {
|
const calculateOverAllQty = (item, filterItems) => {
|
||||||
|
|
||||||
if (!item) return 0;
|
if (!item) return 0;
|
||||||
|
|
||||||
const totalUsedQty =
|
const totalUsedQty =
|
||||||
|
|
@ -435,6 +445,18 @@ const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||||
(e) => e?.localId == localId
|
(e) => e?.localId == localId
|
||||||
);
|
);
|
||||||
const editedProduct = CartOrderDetails[editedProductIndex];
|
const editedProduct = CartOrderDetails[editedProductIndex];
|
||||||
|
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex));
|
||||||
|
if ((calculatedOverAllQty + editedQty) > maxQtyLimit) {
|
||||||
|
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||||
|
setMessageType('warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const productBookingType = editedProduct?.BookingTypeName;
|
const productBookingType = editedProduct?.BookingTypeName;
|
||||||
const isItemInCart = CartOrderDetails?.find(
|
const isItemInCart = CartOrderDetails?.find(
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
||||||
import { Popconfirm, Tooltip } from 'antd';
|
import { Popconfirm, Tooltip } from 'antd';
|
||||||
import { AiOutlineClose, AiFillDelete } from 'react-icons/ai';
|
import { AiOutlineClose, AiFillDelete } from 'react-icons/ai';
|
||||||
|
|
@ -79,6 +79,8 @@ import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
|
||||||
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
|
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
|
||||||
import { useUtilsComponent } from '../../../../../Services/utils.js';
|
import { useUtilsComponent } from '../../../../../Services/utils.js';
|
||||||
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
|
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
|
||||||
|
import { Messages } from '../../../../../../ownLib/my-ui-lib.js';
|
||||||
|
|
||||||
const BsBill = () => {
|
const BsBill = () => {
|
||||||
const { removeExtraCharge } = useUtilsComponent();
|
const { removeExtraCharge } = useUtilsComponent();
|
||||||
|
|
@ -108,6 +110,8 @@ const BsBill = () => {
|
||||||
setting?.SettingValue === 'Y'
|
setting?.SettingValue === 'Y'
|
||||||
);
|
);
|
||||||
const [count, setCount] = useState(1);
|
const [count, setCount] = useState(1);
|
||||||
|
const [messageType, setMessageType] = useState(null);
|
||||||
|
const [messageData, setMessageData] = useState(null);
|
||||||
const [EditQuantity, setEditQuantity] = useState(false);
|
const [EditQuantity, setEditQuantity] = useState(false);
|
||||||
const [Modaldata, setModaldata] = useState([]);
|
const [Modaldata, setModaldata] = useState([]);
|
||||||
const TableData = useSelector(GlobalOrderCardDetails);
|
const TableData = useSelector(GlobalOrderCardDetails);
|
||||||
|
|
@ -141,6 +145,14 @@ const BsBill = () => {
|
||||||
const OrderType = useSelector(GlobalOrderType);
|
const OrderType = useSelector(GlobalOrderType);
|
||||||
const GlobEstBooking = useSelector(GlobalEstimateBooking);
|
const GlobEstBooking = useSelector(GlobalEstimateBooking);
|
||||||
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
|
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
|
|
||||||
|
|
||||||
const OtherServicesglobal = useSelector(GlobalOtherSevices);
|
const OtherServicesglobal = useSelector(GlobalOtherSevices);
|
||||||
|
|
||||||
|
|
@ -2123,8 +2135,22 @@ const BsBill = () => {
|
||||||
const handleEditQuantityCancel = () => {
|
const handleEditQuantityCancel = () => {
|
||||||
setEditQuantity(false);
|
setEditQuantity(false);
|
||||||
};
|
};
|
||||||
|
const onComplete = useCallback(() => {
|
||||||
|
setMessageData(null);
|
||||||
|
setMessageType(null);
|
||||||
|
}, []);
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(TableData);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||||
|
setMessageType('warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const OtherOrderDatas = TableData?.filter(
|
const OtherOrderDatas = TableData?.filter(
|
||||||
(cartItem) =>
|
(cartItem) =>
|
||||||
!(
|
!(
|
||||||
|
|
@ -3049,6 +3075,11 @@ const BsBill = () => {
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div className="BSBillingTable5-billtable">
|
<div className="BSBillingTable5-billtable">
|
||||||
|
<Messages
|
||||||
|
messageType={messageType}
|
||||||
|
messageData={messageData}
|
||||||
|
onComplete={onComplete}
|
||||||
|
/>
|
||||||
<table className="BSBillingTable5-tablediv">
|
<table className="BSBillingTable5-tablediv">
|
||||||
<thead className="BSBillingTable5-thead">
|
<thead className="BSBillingTable5-thead">
|
||||||
<tr
|
<tr
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import {
|
||||||
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
|
import { validateOffers } from '../../BSItemCards/ValidateOffer.jsx';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import './ComboBillTableEdit.scss';
|
import './ComboBillTableEdit.scss';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
|
||||||
|
|
||||||
const ComboEditQtyAndRate = (props) => {
|
const ComboEditQtyAndRate = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
@ -37,9 +38,9 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
const quantityInputRef = useRef(null);
|
const quantityInputRef = useRef(null);
|
||||||
const priceChangeInputRef = useRef(null);
|
const priceChangeInputRef = useRef(null);
|
||||||
const {
|
const {
|
||||||
setIndex = () => {},
|
setIndex = () => { },
|
||||||
setEditQtyCombo = () => {},
|
setEditQtyCombo = () => { },
|
||||||
setEditRateCombo = () => {},
|
setEditRateCombo = () => { },
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
||||||
|
|
@ -51,10 +52,19 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
const applyOffer = useApplyOfferto_CardDetail();
|
const applyOffer = useApplyOfferto_CardDetail();
|
||||||
const preferenceDatas = useSelector(PreferenceData);
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
const EmpAccessDetail = useSelector(GlobalEmpAccessDetail);
|
const EmpAccessDetail = useSelector(GlobalEmpAccessDetail);
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
|
|
||||||
const OverAllproductBasedOfferDatas = useSelector(
|
const OverAllproductBasedOfferDatas = useSelector(
|
||||||
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
|
(state) => state?.BookingOFferNew?.OverAllProductBasedProducts,
|
||||||
shallowEqual
|
shallowEqual
|
||||||
);
|
);
|
||||||
|
console.log(overAllLimitPreferenece, "itemWiseLimitPreferenece")
|
||||||
const preferenceOffer =
|
const preferenceOffer =
|
||||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
(item) => item.SettingIdName === 'Offer'
|
(item) => item.SettingIdName === 'Offer'
|
||||||
|
|
@ -251,7 +261,16 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
item?.SinglePc === 'Y' ? item?.OverAllPcs : item?.BalanceQty;
|
item?.SinglePc === 'Y' ? item?.OverAllPcs : item?.BalanceQty;
|
||||||
return availableQty - totalUsedQty;
|
return availableQty - totalUsedQty;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const quantityValidation = async (val) => {
|
||||||
|
|
||||||
|
setQuantity(val)
|
||||||
|
|
||||||
|
}
|
||||||
const AddProductQuantity = async () => {
|
const AddProductQuantity = async () => {
|
||||||
|
// debugger
|
||||||
|
|
||||||
|
|
||||||
let newPrice = editedPrice > 0 ? editedPrice : props.Productdata.OrderRate;
|
let newPrice = editedPrice > 0 ? editedPrice : props.Productdata.OrderRate;
|
||||||
await dispatch(changeHoldOrderDtl(false));
|
await dispatch(changeHoldOrderDtl(false));
|
||||||
await dispatch(changePreviousOrderLength(CartOrderDetails?.length));
|
await dispatch(changePreviousOrderLength(CartOrderDetails?.length));
|
||||||
|
|
@ -312,6 +331,20 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
let editedProductIndex = CartOrderDetails?.findIndex(
|
let editedProductIndex = CartOrderDetails?.findIndex(
|
||||||
(e) => e?.localId == localId
|
(e) => e?.localId == localId
|
||||||
);
|
);
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
let removeProds1 = CartOrderDetails?.find((_, index) => index == editedProductIndex)
|
||||||
|
let removeProds = CartOrderDetails?.filter((_, index) => index !== editedProductIndex)
|
||||||
|
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(removeProds);
|
||||||
|
if ((calculatedOverAllQty + editedQty) > maxQtyLimit) {
|
||||||
|
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||||
|
setMessageType('warning');
|
||||||
|
setQuantity(removeProds1?.OrderQty || 1)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const editedProduct = CartOrderDetails[editedProductIndex];
|
const editedProduct = CartOrderDetails[editedProductIndex];
|
||||||
const productBookingType = editedProduct?.BookingTypeName;
|
const productBookingType = editedProduct?.BookingTypeName;
|
||||||
const isItemInCart = CartOrderDetails?.find(
|
const isItemInCart = CartOrderDetails?.find(
|
||||||
|
|
@ -3227,7 +3260,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
type="number"
|
type="number"
|
||||||
value={Quantity}
|
value={Quantity}
|
||||||
min="0"
|
min="0"
|
||||||
onChange={(e) => setQuantity(e.target.value)}
|
onChange={(e) => quantityValidation(e.target.value)}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
if (Quantity && Quantity.trim() !== '') {
|
if (Quantity && Quantity.trim() !== '') {
|
||||||
AddProductQuantity();
|
AddProductQuantity();
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ import {
|
||||||
import { Global_PromoCodeOffers } from '../../../../Features/Offer/Offer.js';
|
import { Global_PromoCodeOffers } from '../../../../Features/Offer/Offer.js';
|
||||||
import { validateOffers } from '../BSItemCards/ValidateOffer.jsx';
|
import { validateOffers } from '../BSItemCards/ValidateOffer.jsx';
|
||||||
import { useSaleswiseOfferWatcher } from '../BSItemCards/SalesWiseOffer.jsx';
|
import { useSaleswiseOfferWatcher } from '../BSItemCards/SalesWiseOffer.jsx';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../../utils/calculations.js';
|
||||||
const ExpireConfirmModal = lazy(
|
const ExpireConfirmModal = lazy(
|
||||||
() => import('../BookingFunctionality/ExpireConfirmModal.jsx')
|
() => import('../BookingFunctionality/ExpireConfirmModal.jsx')
|
||||||
);
|
);
|
||||||
|
|
@ -132,6 +133,13 @@ export default function BSC1Search(props) {
|
||||||
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
const FeatureAddonData = useSelector(GlobalFeatAddOnData);
|
||||||
useSaleswiseOfferWatcher();
|
useSaleswiseOfferWatcher();
|
||||||
const preferenceDatas = useSelector(PreferenceData);
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
const preferenceOffer =
|
const preferenceOffer =
|
||||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
(item) => item.SettingIdName === 'Offer'
|
(item) => item.SettingIdName === 'Offer'
|
||||||
|
|
@ -1169,7 +1177,7 @@ export default function BSC1Search(props) {
|
||||||
|
|
||||||
const getPreferenceStock = async () => {
|
const getPreferenceStock = async () => {
|
||||||
const PreferenceStckDtl = preferenceDatas?.[0]?.SettingDtlDetails;
|
const PreferenceStckDtl = preferenceDatas?.[0]?.SettingDtlDetails;
|
||||||
const StockPreference = PreferenceStckDtl.find(
|
const StockPreference = PreferenceStckDtl?.find(
|
||||||
(item) => item.SettingIdName === 'StockSelection'
|
(item) => item.SettingIdName === 'StockSelection'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -2819,6 +2827,18 @@ export default function BSC1Search(props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const AddOrderDetails = async (item) => {
|
const AddOrderDetails = async (item) => {
|
||||||
|
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||||
|
setMessageType('warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (preOrder) {
|
if (preOrder) {
|
||||||
await handlePreOrder(item);
|
await handlePreOrder(item);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ import { MdOutlineAddShoppingCart } from 'react-icons/md';
|
||||||
import { bulkpostdata } from '../../../../Features/ProductPage/ProductPage.js';
|
import { bulkpostdata } from '../../../../Features/ProductPage/ProductPage.js';
|
||||||
import ProductPriceChange from '../UtillComponents/ProductPriceChange.jsx';
|
import ProductPriceChange from '../UtillComponents/ProductPriceChange.jsx';
|
||||||
import ExpireConfirmModal from '../BookingFunctionality/ExpireConfirmModal.jsx';
|
import ExpireConfirmModal from '../BookingFunctionality/ExpireConfirmModal.jsx';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../../utils/calculations.js';
|
||||||
|
|
||||||
export function SortableCard({ id, children, item }) {
|
export function SortableCard({ id, children, item }) {
|
||||||
const {
|
const {
|
||||||
|
|
@ -164,6 +165,13 @@ const BSItemCard = (props) => {
|
||||||
// const applyOffer = useApplyOfferto_CardDetail();
|
// const applyOffer = useApplyOfferto_CardDetail();
|
||||||
const preferenceDatas = useSelector(PreferenceData, shallowEqual);
|
const preferenceDatas = useSelector(PreferenceData, shallowEqual);
|
||||||
const { selectedDate } = useDateStore();
|
const { selectedDate } = useDateStore();
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
const preferenceOffer =
|
const preferenceOffer =
|
||||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
(item) => item.SettingIdName === 'Offer'
|
(item) => item.SettingIdName === 'Offer'
|
||||||
|
|
@ -180,7 +188,6 @@ const BSItemCard = (props) => {
|
||||||
// GlobalAddCustomerDetails,
|
// GlobalAddCustomerDetails,
|
||||||
// shallowEqual
|
// shallowEqual
|
||||||
// );
|
// );
|
||||||
|
|
||||||
const offerAppliedProducts = useSelector(
|
const offerAppliedProducts = useSelector(
|
||||||
GlobalOfferAppliedProducts,
|
GlobalOfferAppliedProducts,
|
||||||
shallowEqual
|
shallowEqual
|
||||||
|
|
@ -2073,6 +2080,18 @@ const BSItemCard = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const AddOrderDetails = async (item) => {
|
const AddOrderDetails = async (item) => {
|
||||||
|
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||||
|
setMessageType('warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (preOrder) {
|
if (preOrder) {
|
||||||
await handlePreOrder(item);
|
await handlePreOrder(item);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -3663,7 +3682,7 @@ const BSItemCard = (props) => {
|
||||||
parseInt(totalSelectedProductQty || 0) +
|
parseInt(totalSelectedProductQty || 0) +
|
||||||
parseInt(reorderComboConsumed || 0);
|
parseInt(reorderComboConsumed || 0);
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) { }
|
||||||
let getCurrentProdDtl = orderDetails?.filter(
|
let getCurrentProdDtl = orderDetails?.filter(
|
||||||
(a) => a?.ProdName === ProdName
|
(a) => a?.ProdName === ProdName
|
||||||
);
|
);
|
||||||
|
|
@ -3864,7 +3883,7 @@ const BSItemCard = (props) => {
|
||||||
parseInt(totalSelectedProductQty || 0) +
|
parseInt(totalSelectedProductQty || 0) +
|
||||||
parseInt(reorderComboConsumed || 0);
|
parseInt(reorderComboConsumed || 0);
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) { }
|
||||||
let getCurrentProdDtl = orderDetails?.filter((a) => a?.ProdId === ProdId);
|
let getCurrentProdDtl = orderDetails?.filter((a) => a?.ProdId === ProdId);
|
||||||
let totalOrderQty = getCurrentProdDtl?.reduce((accumulator, card) => {
|
let totalOrderQty = getCurrentProdDtl?.reduce((accumulator, card) => {
|
||||||
return (
|
return (
|
||||||
|
|
@ -3900,7 +3919,7 @@ const BSItemCard = (props) => {
|
||||||
}, 0);
|
}, 0);
|
||||||
totalOrderQty =
|
totalOrderQty =
|
||||||
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
|
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
|
||||||
} catch (_) {}
|
} catch (_) { }
|
||||||
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
|
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
|
||||||
if (
|
if (
|
||||||
parseInt(ItemQuantity) >
|
parseInt(ItemQuantity) >
|
||||||
|
|
@ -3986,7 +4005,7 @@ const BSItemCard = (props) => {
|
||||||
parseInt(totalSelectedProductQty || 0) +
|
parseInt(totalSelectedProductQty || 0) +
|
||||||
parseInt(reorderComboConsumed || 0);
|
parseInt(reorderComboConsumed || 0);
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) { }
|
||||||
let getCurrentProdDtl = orderDetails?.filter((a) => a?.ProdId === ProdId);
|
let getCurrentProdDtl = orderDetails?.filter((a) => a?.ProdId === ProdId);
|
||||||
let totalOrderQty = getCurrentProdDtl?.reduce((accumulator, card) => {
|
let totalOrderQty = getCurrentProdDtl?.reduce((accumulator, card) => {
|
||||||
return (
|
return (
|
||||||
|
|
@ -4025,7 +4044,7 @@ const BSItemCard = (props) => {
|
||||||
}, 0);
|
}, 0);
|
||||||
totalOrderQty =
|
totalOrderQty =
|
||||||
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
|
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
|
||||||
} catch (_) {}
|
} catch (_) { }
|
||||||
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
|
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
|
||||||
if (
|
if (
|
||||||
parseInt(ItemQuantity) >
|
parseInt(ItemQuantity) >
|
||||||
|
|
@ -4117,7 +4136,7 @@ const BSItemCard = (props) => {
|
||||||
parseInt(totalSelectedProductQty || 0) +
|
parseInt(totalSelectedProductQty || 0) +
|
||||||
parseInt(reorderComboConsumed || 0);
|
parseInt(reorderComboConsumed || 0);
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) { }
|
||||||
let getCurrentProdDtl = orderDetails?.filter(
|
let getCurrentProdDtl = orderDetails?.filter(
|
||||||
(a) => a?.ProdId === ProdId && a?.InwardDtlId === InwardDtlId
|
(a) => a?.ProdId === ProdId && a?.InwardDtlId === InwardDtlId
|
||||||
);
|
);
|
||||||
|
|
@ -4160,7 +4179,7 @@ const BSItemCard = (props) => {
|
||||||
}, 0);
|
}, 0);
|
||||||
totalOrderQty =
|
totalOrderQty =
|
||||||
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
|
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
|
||||||
} catch (_) {}
|
} catch (_) { }
|
||||||
|
|
||||||
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
|
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
|
||||||
if (
|
if (
|
||||||
|
|
@ -4244,7 +4263,7 @@ const BSItemCard = (props) => {
|
||||||
parseInt(totalSelectedProductQty || 0) +
|
parseInt(totalSelectedProductQty || 0) +
|
||||||
parseInt(reorderComboConsumed || 0);
|
parseInt(reorderComboConsumed || 0);
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) { }
|
||||||
let getCurrentProdDtl = orderDetails?.filter(
|
let getCurrentProdDtl = orderDetails?.filter(
|
||||||
(a) => a?.ProdId === ProdId && a?.InwardDtlId === InwardDtlId
|
(a) => a?.ProdId === ProdId && a?.InwardDtlId === InwardDtlId
|
||||||
);
|
);
|
||||||
|
|
@ -4291,7 +4310,7 @@ const BSItemCard = (props) => {
|
||||||
}, 0);
|
}, 0);
|
||||||
totalOrderQty =
|
totalOrderQty =
|
||||||
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
|
parseInt(totalOrderQty || 0) + parseInt(comboConsumed || 0);
|
||||||
} catch (_) {}
|
} catch (_) { }
|
||||||
|
|
||||||
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
|
let OverallProdQty = totalOrderQty - totalSelectedProductQty;
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { Drawer } from 'antd';
|
import { Drawer, message } from 'antd';
|
||||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||||
import {
|
import {
|
||||||
changeKioskPageName,
|
changeKioskPageName,
|
||||||
|
|
@ -16,10 +16,12 @@ import {
|
||||||
GlobalBookingTypeKiosk,
|
GlobalBookingTypeKiosk,
|
||||||
} from '../../../Features/BookingScreen/BookingData/KioskBookingData';
|
} from '../../../Features/BookingScreen/BookingData/KioskBookingData';
|
||||||
import horizontal from '../../../Images/defaultItemImg.png';
|
import horizontal from '../../../Images/defaultItemImg.png';
|
||||||
import { getConfigType } from '../../../Features/BookingScreen/BookingData/BookingData';
|
import { getConfigType, PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations.js';
|
||||||
|
|
||||||
const CardPage1 = (props) => {
|
const CardPage1 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||||
|
|
@ -35,7 +37,13 @@ const CardPage1 = (props) => {
|
||||||
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||||
(i) => i.SettingIdName === 'PrintUom'
|
(i) => i.SettingIdName === 'PrintUom'
|
||||||
)?.[0];
|
)?.[0];
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getBookingTypeId();
|
getBookingTypeId();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -49,6 +57,15 @@ const CardPage1 = (props) => {
|
||||||
//Card on click function
|
//Card on click function
|
||||||
|
|
||||||
const CardOnClick = async (item, Parameter) => {
|
const CardOnClick = async (item, Parameter) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||||
|
|
||||||
const transformedItem = {
|
const transformedItem = {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { Drawer } from 'antd';
|
import { Drawer, message } from 'antd';
|
||||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||||
import {
|
import {
|
||||||
changeKioskPageName,
|
changeKioskPageName,
|
||||||
|
|
@ -15,10 +15,12 @@ import {
|
||||||
changeKioskOrderDetails,
|
changeKioskOrderDetails,
|
||||||
} from '../../../Features/BookingScreen/BookingData/KioskBookingData';
|
} from '../../../Features/BookingScreen/BookingData/KioskBookingData';
|
||||||
import horizontal from '../../../Images/defaultItemImg.png';
|
import horizontal from '../../../Images/defaultItemImg.png';
|
||||||
import { getConfigType } from '../../../Features/BookingScreen/BookingData/BookingData';
|
import { getConfigType, PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations.js';
|
||||||
|
|
||||||
const CardPage2 = (props) => {
|
const CardPage2 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||||
|
|
@ -35,6 +37,13 @@ const CardPage2 = (props) => {
|
||||||
(i) => i.SettingIdName === 'PrintUom'
|
(i) => i.SettingIdName === 'PrintUom'
|
||||||
)?.[0];
|
)?.[0];
|
||||||
|
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getBookingTypeId();
|
getBookingTypeId();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -48,6 +57,16 @@ const CardPage2 = (props) => {
|
||||||
//Card on click function
|
//Card on click function
|
||||||
|
|
||||||
const CardOnClick = async (item, Parameter) => {
|
const CardOnClick = async (item, Parameter) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||||
|
|
||||||
const transformedItem = {
|
const transformedItem = {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Drawer } from 'antd';
|
import { Drawer, message } from 'antd';
|
||||||
import { IoCheckmarkCircle } from 'react-icons/io5';
|
import { IoCheckmarkCircle } from 'react-icons/io5';
|
||||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||||
import defaultimage from '../../../Images/defaultItemImg.png';
|
import defaultimage from '../../../Images/defaultItemImg.png';
|
||||||
|
|
@ -14,10 +14,12 @@ import {
|
||||||
import { settingDataSelector } from '../../../Features/PreferenceMaster/PreferenceMaster.js';
|
import { settingDataSelector } from '../../../Features/PreferenceMaster/PreferenceMaster.js';
|
||||||
import horizontal from '../../../Images/defaultItemImg.png';
|
import horizontal from '../../../Images/defaultItemImg.png';
|
||||||
import { getKioskLightColour } from '../../../Features/Kiosk/kiosk';
|
import { getKioskLightColour } from '../../../Features/Kiosk/kiosk';
|
||||||
import { getConfigType } from '../../../Features/BookingScreen/BookingData/BookingData';
|
import { getConfigType, PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations.js';
|
||||||
|
|
||||||
const CardPage3 = (props) => {
|
const CardPage3 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
console.log(KioskOrderDetails, 'KioskOrderDetailsKioskOrderDetails');
|
console.log(KioskOrderDetails, 'KioskOrderDetailsKioskOrderDetails');
|
||||||
|
|
@ -35,6 +37,13 @@ const CardPage3 = (props) => {
|
||||||
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||||
(i) => i.SettingIdName === 'PrintUom'
|
(i) => i.SettingIdName === 'PrintUom'
|
||||||
)?.[0];
|
)?.[0];
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
setopenQuantity(false);
|
setopenQuantity(false);
|
||||||
};
|
};
|
||||||
|
|
@ -47,6 +56,15 @@ const CardPage3 = (props) => {
|
||||||
}, []);
|
}, []);
|
||||||
//Card on click function
|
//Card on click function
|
||||||
const CardOnClick = async (item, Parameter) => {
|
const CardOnClick = async (item, Parameter) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||||
|
|
||||||
const transformedItem = {
|
const transformedItem = {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { AiFillPlusCircle, AiFillMinusCircle } from 'react-icons/ai';
|
import { AiFillPlusCircle, AiFillMinusCircle } from 'react-icons/ai';
|
||||||
import { BsHandbag } from 'react-icons/bs';
|
import { BsHandbag } from 'react-icons/bs';
|
||||||
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
import { DefaultModal } from '../../../Components/Modal/DefaultModal';
|
||||||
import { Drawer } from 'antd';
|
import { Drawer, message } from 'antd';
|
||||||
import '../../../Styles/Kiosk/CardPage/CardPage4.scss';
|
import '../../../Styles/Kiosk/CardPage/CardPage4.scss';
|
||||||
import {
|
import {
|
||||||
GlobalBookingTypeKiosk,
|
GlobalBookingTypeKiosk,
|
||||||
|
|
@ -14,10 +14,12 @@ import {
|
||||||
import { settingDataSelector } from '../../../Features/PreferenceMaster/PreferenceMaster.js';
|
import { settingDataSelector } from '../../../Features/PreferenceMaster/PreferenceMaster.js';
|
||||||
import horizontal from '../../../Images/defaultItemImg.png';
|
import horizontal from '../../../Images/defaultItemImg.png';
|
||||||
import { getKioskLightColour } from '../../../Features/Kiosk/kiosk';
|
import { getKioskLightColour } from '../../../Features/Kiosk/kiosk';
|
||||||
import { getConfigType } from '../../../Features/BookingScreen/BookingData/BookingData';
|
import { getConfigType, PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations.js';
|
||||||
|
|
||||||
const CardPage4 = (props) => {
|
const CardPage4 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
const kioskCategoriesCard = useSelector(GlobalProductCardListKiosk);
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
console.log(KioskOrderDetails, 'KioskOrderDetails');
|
console.log(KioskOrderDetails, 'KioskOrderDetails');
|
||||||
|
|
@ -36,7 +38,13 @@ const CardPage4 = (props) => {
|
||||||
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||||
(i) => i.SettingIdName === 'PrintUom'
|
(i) => i.SettingIdName === 'PrintUom'
|
||||||
)?.[0];
|
)?.[0];
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getBookingTypeId();
|
getBookingTypeId();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -79,6 +87,15 @@ const CardPage4 = (props) => {
|
||||||
//Card on click function
|
//Card on click function
|
||||||
|
|
||||||
const CardOnClick = async (item, Parameter) => {
|
const CardOnClick = async (item, Parameter) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||||
|
|
||||||
const transformedItem = {
|
const transformedItem = {
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,11 @@ const KioskBookingPage = () => {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
|
dispatch(getPreferenceData({
|
||||||
|
CompId: SessionDtl?.CompId,
|
||||||
|
BranchId: SessionDtl?.BranchId,
|
||||||
|
AppId: SessionDtl?.AppId,
|
||||||
|
})).unwrap();
|
||||||
const queryParams = await getQueryParams();
|
const queryParams = await getQueryParams();
|
||||||
|
|
||||||
console.log('queryParams', queryParams);
|
console.log('queryParams', queryParams);
|
||||||
|
|
@ -161,9 +166,11 @@ const KioskBookingPage = () => {
|
||||||
DeviceMacAddress: MACAddress
|
DeviceMacAddress: MACAddress
|
||||||
})).unwrap();
|
})).unwrap();
|
||||||
|
|
||||||
dispatch(getPreferenceData({ CompId: responseData?.CompId,
|
dispatch(getPreferenceData({
|
||||||
|
CompId: responseData?.CompId,
|
||||||
BranchId: responseData?.BranchId,
|
BranchId: responseData?.BranchId,
|
||||||
AppId: responseData?.AppId,})).unwrap();
|
AppId: responseData?.AppId,
|
||||||
|
})).unwrap();
|
||||||
dispatch(
|
dispatch(
|
||||||
getProductCategories({
|
getProductCategories({
|
||||||
CompId: responseData?.CompId,
|
CompId: responseData?.CompId,
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,22 @@ import { changeKioskOrderDetails } from '../../../Features/BookingScreen/Booking
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
import '../../../Styles/Kiosk/OrderCart/OrderCart1.scss';
|
import '../../../Styles/Kiosk/OrderCart/OrderCart1.scss';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { message } from 'antd';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
|
||||||
const KisokOrderCart1 = (props) => {
|
const KisokOrderCart1 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
|
|
||||||
const KioskOrderDetails = props?.KioskOrderDetails;
|
const KioskOrderDetails = props?.KioskOrderDetails;
|
||||||
const removeFromCart = async (item) => {
|
const removeFromCart = async (item) => {
|
||||||
await dispatch(
|
await dispatch(
|
||||||
|
|
@ -24,6 +37,15 @@ const KisokOrderCart1 = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,22 @@ import '../../../Styles/Kiosk/OrderCart/OrderCart2.scss';
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
import { color } from 'highcharts';
|
import { color } from 'highcharts';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import { message } from 'antd';
|
||||||
|
|
||||||
const KisokOrderCart2 = (props) => {
|
const KisokOrderCart2 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
|
|
||||||
const KioskOrderDetails = props?.KioskOrderDetails;
|
const KioskOrderDetails = props?.KioskOrderDetails;
|
||||||
|
|
||||||
const removeFromCart = async (item) => {
|
const removeFromCart = async (item) => {
|
||||||
|
|
@ -27,6 +40,16 @@ const KisokOrderCart2 = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,22 @@ import {
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
import '../../../Styles/Kiosk/OrderCart/OrderCart3.scss';
|
import '../../../Styles/Kiosk/OrderCart/OrderCart3.scss';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
import { message } from 'antd';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
|
||||||
const KisokOrderCart3 = (props) => {
|
const KisokOrderCart3 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const getKioskDarkColourdata = useSelector(getKioskDarkColour);
|
const getKioskDarkColourdata = useSelector(getKioskDarkColour);
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
|
|
||||||
const BookingTypeBoth = useSelector(GlobalKioskBookingTypeBoth);
|
const BookingTypeBoth = useSelector(GlobalKioskBookingTypeBoth);
|
||||||
const KioskOrderDetails = props?.KioskOrderDetails;
|
const KioskOrderDetails = props?.KioskOrderDetails;
|
||||||
|
|
||||||
|
|
@ -31,6 +43,15 @@ const KisokOrderCart3 = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,9 @@ import KioskFooter3 from '../Components/KioskFooter3';
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
import '../../../Styles/Kiosk/OrderView/OrderView1.scss';
|
import '../../../Styles/Kiosk/OrderView/OrderView1.scss';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
import { message } from 'antd';
|
||||||
|
|
||||||
const OrderView1 = (props) => {
|
const OrderView1 = (props) => {
|
||||||
const KioskThemeData = props?.hasOwnProperty('KioskThemeData')
|
const KioskThemeData = props?.hasOwnProperty('KioskThemeData')
|
||||||
|
|
@ -24,6 +27,14 @@ const OrderView1 = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
|
|
||||||
const BackToCategory = async () => {
|
const BackToCategory = async () => {
|
||||||
await dispatch(changeKioskPageName('categoryPage'));
|
await dispatch(changeKioskPageName('categoryPage'));
|
||||||
|
|
@ -44,6 +55,17 @@ const OrderView1 = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
|
||||||
|
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ import { IoMdClose } from 'react-icons/io';
|
||||||
import defaultImg from '../../../Images/defaultItemImg.png';
|
import defaultImg from '../../../Images/defaultItemImg.png';
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
import { message } from 'antd';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
|
||||||
const KioskOrderView2 = (props) => {
|
const KioskOrderView2 = (props) => {
|
||||||
console.log(props, 'propsprops');
|
console.log(props, 'propsprops');
|
||||||
|
|
@ -25,6 +28,15 @@ const KioskOrderView2 = (props) => {
|
||||||
? props['KioskThemeData']
|
? props['KioskThemeData']
|
||||||
: null;
|
: null;
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
|
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||||
console.log(KioskOrderDetails, 'KioskOrderDetailsh');
|
console.log(KioskOrderDetails, 'KioskOrderDetailsh');
|
||||||
|
|
@ -54,6 +66,15 @@ const KioskOrderView2 = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ import {
|
||||||
import KioskFooter3 from '../Components/KioskFooter3';
|
import KioskFooter3 from '../Components/KioskFooter3';
|
||||||
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
import PozoDineInIcon from '../KioskIcons/KioskDineIn';
|
||||||
import TakeAway from '../KioskIcons/KioskTakeAway';
|
import TakeAway from '../KioskIcons/KioskTakeAway';
|
||||||
|
import { PreferenceData } from '../../../Features/BookingScreen/BookingData/BookingData';
|
||||||
|
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||||
|
import { message } from 'antd';
|
||||||
|
|
||||||
const KioskOrderView = (props) => {
|
const KioskOrderView = (props) => {
|
||||||
console.log(props, 'propsprops');
|
console.log(props, 'propsprops');
|
||||||
|
|
@ -27,6 +30,14 @@ const KioskOrderView = (props) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||||
|
const preferenceDatas = useSelector(PreferenceData);
|
||||||
|
const overAllLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||||
|
const itemWiseLimitPreferenece =
|
||||||
|
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||||
|
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||||
|
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||||
|
|
||||||
const BackToCategory = async () => {
|
const BackToCategory = async () => {
|
||||||
await dispatch(changeKioskPageName('categoryPage'));
|
await dispatch(changeKioskPageName('categoryPage'));
|
||||||
|
|
@ -47,6 +58,16 @@ const KioskOrderView = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const increase = async (item) => {
|
const increase = async (item) => {
|
||||||
|
|
||||||
|
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||||
|
if (overAllLimitPreferenece) {
|
||||||
|
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||||
|
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||||
|
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await dispatch(
|
await dispatch(
|
||||||
changeKioskOrderDetails(
|
changeKioskOrderDetails(
|
||||||
KioskOrderDetails?.map(
|
KioskOrderDetails?.map(
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { Form, Checkbox, Radio, Divider } from 'antd';
|
import { Form, Checkbox, Radio, Divider, InputNumber } from 'antd';
|
||||||
import { ArrowRightOutlined } from '@ant-design/icons';
|
import { ArrowRightOutlined } from '@ant-design/icons';
|
||||||
import FormHeader from '../PageComponents/FormHeader.jsx';
|
import FormHeader from '../PageComponents/FormHeader.jsx';
|
||||||
import Buttons from '../../Components/Forms/Buttons.jsx';
|
import Buttons from '../../Components/Forms/Buttons.jsx';
|
||||||
|
|
@ -57,68 +57,71 @@ const PreferenceList = () => {
|
||||||
const settingsList = tableValue[0]?.SettingDtlDetails ?? preferenceConfigs;
|
const settingsList = tableValue[0]?.SettingDtlDetails ?? preferenceConfigs;
|
||||||
|
|
||||||
const allSettingsMap = {};
|
const allSettingsMap = {};
|
||||||
settingsList?.forEach(({ SettingIdName, SettingValue }) => {
|
settingsList?.forEach(({ SettingIdName, SettingValue, SettingCount }) => {
|
||||||
allSettingsMap[SettingIdName?.toLowerCase()] = SettingValue;
|
allSettingsMap[SettingIdName?.toLowerCase()] = { value: SettingValue, count: SettingCount };
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(allSettingsMap, 'allSettingsMapallSettingsMapallSettingsMap');
|
console.log(settingsList, 'settingsList');
|
||||||
|
|
||||||
const buildInitialValues = () => ({
|
const buildInitialValues = () => ({
|
||||||
dashboard: allSettingsMap['dashboard'] === 'Y',
|
dashboard: allSettingsMap['dashboard']?.value === 'Y',
|
||||||
shortcutkeys: allSettingsMap['shortcutkeys'] === 'Y',
|
shortcutkeys: allSettingsMap['shortcutkeys']?.value === 'Y',
|
||||||
autoreceivestock: allSettingsMap['autoreceivestock'] === 'Y',
|
autoreceivestock: allSettingsMap['autoreceivestock']?.value === 'Y',
|
||||||
decimal: allSettingsMap['decimal'] === 'Y',
|
decimal: allSettingsMap['decimal']?.value === 'Y',
|
||||||
enabledModules: [
|
enabledModules: [
|
||||||
...(allSettingsMap['dinein'] === 'Y' ? ['dinein'] : []),
|
...(allSettingsMap['dinein']?.value === 'Y' ? ['dinein'] : []),
|
||||||
...(allSettingsMap['estimation'] === 'Y' ? ['estimation'] : []),
|
...(allSettingsMap['estimation']?.value === 'Y' ? ['estimation'] : []),
|
||||||
],
|
],
|
||||||
searchfocus: allSettingsMap['searchfocus'] === 'Y',
|
searchfocus: allSettingsMap['searchfocus']?.value === 'Y',
|
||||||
addproductcard: allSettingsMap['addproductcard'] === 'Y',
|
addproductcard: allSettingsMap['addproductcard']?.value === 'Y',
|
||||||
enabledFeatures: [
|
enabledFeatures: [
|
||||||
...(allSettingsMap['parking'] === 'Y' ? ['parking'] : []),
|
...(allSettingsMap['parking']?.value === 'Y' ? ['parking'] : []),
|
||||||
...(allSettingsMap['offer'] === 'Y' ? ['offer'] : []),
|
...(allSettingsMap['offer']?.value === 'Y' ? ['offer'] : []),
|
||||||
],
|
],
|
||||||
stockselection: allSettingsMap['stockselection'] === 'Y',
|
stockselection: allSettingsMap['stockselection']?.value === 'Y',
|
||||||
weightasquantity: allSettingsMap['weightasquantity'] === 'Y',
|
weightasquantity: allSettingsMap['weightasquantity']?.value === 'Y',
|
||||||
expiredselection: allSettingsMap['expiredselection'] === 'Y',
|
expiredselection: allSettingsMap['expiredselection']?.value === 'Y',
|
||||||
'sales mode': allSettingsMap['sales mode'] === 'Y',
|
'sales mode': allSettingsMap['sales mode']?.value === 'Y',
|
||||||
billitemsorder: allSettingsMap['billitemsorder'] === 'Y',
|
billitemsorder: allSettingsMap['billitemsorder']?.value === 'Y',
|
||||||
preorderpricechange: allSettingsMap['preorderpricechange'] === 'Y',
|
preorderpricechange: allSettingsMap['preorderpricechange']?.value === 'Y',
|
||||||
|
quantityrestriction: allSettingsMap['overalllimit']?.value === 'Y' || allSettingsMap['itemwiselimit']?.value === 'Y',
|
||||||
|
quantityrestrictiontype: allSettingsMap['overalllimit']?.value === 'Y' ? 'overall' : allSettingsMap['itemwiselimit']?.value === 'Y' ? 'itemwise' : 'overall',
|
||||||
|
maxquantity: allSettingsMap['overalllimit']?.value === 'Y' ? allSettingsMap['overalllimit']?.count || 1 : allSettingsMap['itemwiselimit']?.value === 'Y' ? allSettingsMap['itemwiselimit']?.count || 1 : 1,
|
||||||
billOption: ['whatsapp', 'sms', 'email'].some(
|
billOption: ['whatsapp', 'sms', 'email'].some(
|
||||||
(k) => allSettingsMap[k] === 'Y'
|
(k) => allSettingsMap[k]?.value === 'Y'
|
||||||
)
|
)
|
||||||
? 'pdf'
|
? 'pdf'
|
||||||
: 'print',
|
: 'print',
|
||||||
pdfSendOptions: ['whatsapp', 'email', 'sms'].filter(
|
pdfSendOptions: ['whatsapp', 'email', 'sms'].filter(
|
||||||
(k) => allSettingsMap[k] === 'Y'
|
(k) => allSettingsMap[k]?.value === 'Y'
|
||||||
),
|
),
|
||||||
tokenonly: allSettingsMap['tokenonly'] === 'Y',
|
tokenonly: allSettingsMap['tokenonly']?.value === 'Y',
|
||||||
allproductindividualtoken:
|
allproductindividualtoken:
|
||||||
allSettingsMap['allproductindividualtoken'] === 'Y',
|
allSettingsMap['allproductindividualtoken']?.value === 'Y',
|
||||||
printOptions: ['printuom', 'printlogo', 'printgreetings'].filter(
|
printOptions: ['printuom', 'printlogo', 'printgreetings'].filter(
|
||||||
(k) => allSettingsMap[k] === 'Y'
|
(k) => allSettingsMap[k]?.value === 'Y'
|
||||||
),
|
),
|
||||||
mobilea4: allSettingsMap['mobilea4'] === 'Y',
|
mobilea4: allSettingsMap['mobilea4']?.value === 'Y',
|
||||||
estimateprintheader: allSettingsMap['estimateprintheader'] === 'Y',
|
estimateprintheader: allSettingsMap['estimateprintheader']?.value === 'Y',
|
||||||
scanlayout: allSettingsMap['scanlayout'] === 'Y',
|
scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
|
||||||
verifyproduct: allSettingsMap['verifyproduct'] === 'Y',
|
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
|
||||||
customisedbillnumber: allSettingsMap['customisedbillnumber'] === 'Y',
|
customisedbillnumber: allSettingsMap['customisedbillnumber']?.value === 'Y',
|
||||||
upiqr: allSettingsMap['upiqr'] === 'Y',
|
upiqr: allSettingsMap['upiqr']?.value === 'Y',
|
||||||
lowstockreport: allSettingsMap['lowstockreport'] === 'Y',
|
lowstockreport: allSettingsMap['lowstockreport']?.value === 'Y',
|
||||||
weeklysalesreport: allSettingsMap['weeklysalesreport'] === 'Y',
|
weeklysalesreport: allSettingsMap['weeklysalesreport']?.value === 'Y',
|
||||||
notificationblink: allSettingsMap['notificationblink'] === 'Y',
|
notificationblink: allSettingsMap['notificationblink']?.value === 'Y',
|
||||||
onlineindivdualslots: allSettingsMap['onlineindivdualslots'] === 'Y',
|
onlineindivdualslots: allSettingsMap['onlineindivdualslots']?.value === 'Y',
|
||||||
editbill: allSettingsMap['editbill'] === 'Y',
|
editbill: allSettingsMap['editbill']?.value === 'Y',
|
||||||
notification: [
|
notification: [
|
||||||
...(allSettingsMap['onbilltime'] === 'Y' ? ['onbilltime'] : []),
|
...(allSettingsMap['onbilltime']?.value === 'Y' ? ['onbilltime'] : []),
|
||||||
...(allSettingsMap['1daybefore'] === 'Y' ? ['1daybefore'] : []),
|
...(allSettingsMap['1daybefore']?.value === 'Y' ? ['1daybefore'] : []),
|
||||||
...(allSettingsMap['1hourbefore'] === 'Y' ? ['1hourbefore'] : []),
|
...(allSettingsMap['1hourbefore']?.value === 'Y' ? ['1hourbefore'] : []),
|
||||||
],
|
],
|
||||||
BookingOptionsandmethod: [
|
BookingOptionsandmethod: [
|
||||||
...(allSettingsMap['allow individual booking'] === 'Y'
|
...(allSettingsMap['allow individual booking']?.value === 'Y'
|
||||||
? ['allow individual booking']
|
? ['allow individual booking']
|
||||||
: []),
|
: []),
|
||||||
...(allSettingsMap['single booking only'] === 'Y'
|
...(allSettingsMap['single booking only']?.value === 'Y'
|
||||||
? ['single booking only']
|
? ['single booking only']
|
||||||
: []),
|
: []),
|
||||||
],
|
],
|
||||||
|
|
@ -310,6 +313,8 @@ const PreferenceList = () => {
|
||||||
weeklysalesreport: values.weeklysalesreport,
|
weeklysalesreport: values.weeklysalesreport,
|
||||||
notificationblink: values.notificationblink,
|
notificationblink: values.notificationblink,
|
||||||
editbill: values.editbill,
|
editbill: values.editbill,
|
||||||
|
overalllimit: values.quantityrestriction && values.quantityrestrictiontype === 'overall',
|
||||||
|
itemwiselimit: values.quantityrestriction && values.quantityrestrictiontype === 'itemwise',
|
||||||
};
|
};
|
||||||
|
|
||||||
const arrayValues = {
|
const arrayValues = {
|
||||||
|
|
@ -340,6 +345,7 @@ const PreferenceList = () => {
|
||||||
SettingId: setting.SettingId,
|
SettingId: setting.SettingId,
|
||||||
Comments: setting.Comments || 'Enter Comment',
|
Comments: setting.Comments || 'Enter Comment',
|
||||||
SettingValue: isChecked ? 'Y' : 'N',
|
SettingValue: isChecked ? 'Y' : 'N',
|
||||||
|
SettingCount: ((key === 'overalllimit' || key === 'itemwiselimit') && isChecked) ? parseFloat(values.maxquantity) || null : null
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -630,6 +636,38 @@ const PreferenceList = () => {
|
||||||
{renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')}
|
{renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')}
|
||||||
{renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')}
|
{renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')}
|
||||||
{/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */}
|
{/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */}
|
||||||
|
|
||||||
|
{(allSettingsMap['overalllimit'] !== undefined || allSettingsMap['itemwiselimit'] !== undefined) && (
|
||||||
|
<>
|
||||||
|
<Form.Item name="quantityrestriction" label="Do you want to restrict the quantity that can be sold in a single order?" valuePropName="checked">
|
||||||
|
<Checkbox>Yes</Checkbox>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item noStyle shouldUpdate={(prev, curr) => prev.quantityrestriction !== curr.quantityrestriction}>
|
||||||
|
{({ getFieldValue }) => getFieldValue('quantityrestriction') && (
|
||||||
|
<>
|
||||||
|
<Form.Item name="quantityrestrictiontype" label="How would you like to apply the quantity restriction?">
|
||||||
|
<Radio.Group onChange={() => formRef.current?.setFieldsValue({ maxquantity: undefined })}>
|
||||||
|
<Radio value="overall">Overall Order Quantity</Radio>
|
||||||
|
<Radio value="itemwise">Item-wise Quantity</Radio>
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<Form.Item
|
||||||
|
name="maxquantity"
|
||||||
|
label="Maximum quantity allowed:"
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: 'Please enter maximum quantity' },
|
||||||
|
{ type: 'number', min: 1, message: 'Quantity must be greater than 0' }
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<InputNumber min={1} style={{ width: '200px' }} />
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
export const calculateOverAllQtyLimit = (orders) => {
|
||||||
|
return orders?.reduce((acc, cartItem) => {
|
||||||
|
return acc + (cartItem?.OrderQty || 0);
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue