Merge pull request 'added item wise qty limit' (#220) from item-wise-limit-added into main
Reviewed-on: Pozomind/pozo-retail-app#220
This commit is contained in:
commit
984f6ede1c
|
|
@ -301,7 +301,39 @@ const BsBill2 = () => {
|
|||
const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails);
|
||||
if (calculatedOverAllQty + 1 > maxQtyLimit) {
|
||||
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = CartOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr.InwardDtlId;
|
||||
const qty = Number(curr.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
message.warning(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,14 +198,12 @@ import CardPopover from '../StandardTable/Utils/CardPopover.jsx';
|
|||
import UpiPopover from '../StandardTable/Utils/UpiPopOver.jsx';
|
||||
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
|
||||
import BillingTableSkeleton from '../../../../../Components/Skeleton/BillingTableSkeleton.jsx';
|
||||
import OtherServiceMobilePrint from '../../BookingFunctionality/OtherServiceMobilePrint.jsx';
|
||||
// Jsx Files
|
||||
const OtherServicePrintStyle1 = lazy(
|
||||
() =>
|
||||
import('../../../PrintTemplates/ThermalPrinter/OtherServicePrintStyle1.jsx')
|
||||
);
|
||||
const OtherServiceMobilePrint = lazy(
|
||||
() => import('../../BookingFunctionality/OtherServiceMobilePrint.jsx')
|
||||
);
|
||||
const BSOtherServiceClaim = lazy(
|
||||
() => import('../../UtillComponents/BSOtherServiceClaim.jsx')
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2161,6 +2161,39 @@ const BsBill = () => {
|
|||
setMessageType('warning');
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
const inwardQtyMap = TableData.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMessageData(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setMessageType('warning');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
const OtherOrderDatas = TableData?.filter(
|
||||
|
|
|
|||
|
|
@ -2851,6 +2851,40 @@ export default function BSC1Search(props) {
|
|||
setMessageType('warning');
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = CartOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMessageData(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setMessageType('warning');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ const CardPage1 = (props) => {
|
|||
const [QtyIndex, setQtyIndex] = useState(0);
|
||||
const [ConfigDataList, setConfigDataList] = useState([]);
|
||||
const [maxLimitExceeded, setMaxLimitExceeded] = useState(false);
|
||||
const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null);
|
||||
const kioskTemplateData = props?.data;
|
||||
const SettingDataSelector = useSelector(settingDataSelector);
|
||||
const UomPrint = SettingDataSelector?.[0]?.SettingDtlDetails.filter(
|
||||
|
|
@ -60,20 +61,6 @@ 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) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
}, 2000);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||
|
||||
const transformedItem = {
|
||||
|
|
@ -321,6 +308,61 @@ const CardPage1 = (props) => {
|
|||
};
|
||||
// add Product in cart state
|
||||
const AddOrderDetails = (item) => {
|
||||
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||
if (overAllLimitPreferenece) {
|
||||
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
const isItemInCart = KioskOrderDetails?.find(
|
||||
(cartItem) =>
|
||||
cartItem.ProdId === item.ProdId &&
|
||||
|
|
@ -792,7 +834,7 @@ const CardPage1 = (props) => {
|
|||
/>
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />Maximum Quantity ({maxQtyLimit}) Reached
|
||||
<IoIosWarning size={30} color='#b99400' />{maxLimitExceededMessage}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ const CardPage2 = (props) => {
|
|||
const BookingType = useSelector(GlobalBookingTypeKiosk);
|
||||
const kioskTemplateData = props?.data;
|
||||
const [maxLimitExceeded, setMaxLimitExceeded] = useState(false);
|
||||
const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null);
|
||||
const [openQuantity, setopenQuantity] = useState(false);
|
||||
const [VariantOpen, setVariantOpen] = useState(false);
|
||||
const [onePeiceFlow, setOnePeiceFlow] = useState(false);
|
||||
|
|
@ -59,20 +60,6 @@ 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) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||
|
||||
const transformedItem = {
|
||||
|
|
@ -321,6 +308,61 @@ const CardPage2 = (props) => {
|
|||
};
|
||||
// add Product in cart state
|
||||
const AddOrderDetails = (item) => {
|
||||
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||
if (overAllLimitPreferenece) {
|
||||
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
const isItemInCart = KioskOrderDetails?.find(
|
||||
(cartItem) =>
|
||||
cartItem.ProdId === item.ProdId &&
|
||||
|
|
@ -601,7 +643,7 @@ const CardPage2 = (props) => {
|
|||
)}
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />Maximum Quantity ({maxQtyLimit}) Reached
|
||||
<IoIosWarning size={30} color='#b99400' />{maxLimitExceededMessage}
|
||||
</p>
|
||||
</div>
|
||||
<Drawer
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ const CardPage3 = (props) => {
|
|||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||
const BookingType = useSelector(GlobalBookingTypeKiosk);
|
||||
const [maxLimitExceeded, setMaxLimitExceeded] = useState(false);
|
||||
const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null);
|
||||
const [openQuantity, setopenQuantity] = useState(false);
|
||||
const [VariantOpen, setVariantOpen] = useState(false);
|
||||
const [onePeiceFlow, setOnePeiceFlow] = useState(false);
|
||||
|
|
@ -58,19 +59,6 @@ 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) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||
|
||||
const transformedItem = {
|
||||
|
|
@ -318,6 +306,61 @@ const CardPage3 = (props) => {
|
|||
};
|
||||
// add Product in cart state
|
||||
const AddOrderDetails = (item) => {
|
||||
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||
if (overAllLimitPreferenece) {
|
||||
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
const isItemInCart = KioskOrderDetails?.find(
|
||||
(cartItem) =>
|
||||
cartItem.ProdId === item.ProdId &&
|
||||
|
|
@ -604,7 +647,7 @@ const CardPage3 = (props) => {
|
|||
)}
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />Maximum Quantity ({maxQtyLimit}) Reached
|
||||
<IoIosWarning size={30} color='#b99400' />{maxLimitExceededMessage}
|
||||
</p>
|
||||
</div>
|
||||
<Drawer
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ const CardPage4 = (props) => {
|
|||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||
const BookingType = useSelector(GlobalBookingTypeKiosk);
|
||||
const [maxLimitExceeded, setMaxLimitExceeded] = useState(false);
|
||||
const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null);
|
||||
const [quantities, setQuantities] = useState({});
|
||||
const [openQuantity, setopenQuantity] = useState(false);
|
||||
const [VariantOpen, setVariantOpen] = useState(false);
|
||||
|
|
@ -89,19 +90,6 @@ 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) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||
|
||||
const transformedItem = {
|
||||
|
|
@ -342,6 +330,61 @@ const CardPage4 = (props) => {
|
|||
};
|
||||
// add Product in cart state
|
||||
const AddOrderDetails = (item) => {
|
||||
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||
if (overAllLimitPreferenece) {
|
||||
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
const isItemInCart = KioskOrderDetails?.find(
|
||||
(cartItem) =>
|
||||
cartItem.ProdId === item.ProdId &&
|
||||
|
|
@ -625,7 +668,7 @@ const CardPage4 = (props) => {
|
|||
)}
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />Maximum Quantity ({maxQtyLimit}) Reached
|
||||
<IoIosWarning size={30} color='#b99400' />{maxLimitExceededMessage}
|
||||
</p>
|
||||
</div>
|
||||
<Drawer
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@ import { PreferenceData } from '../../../Features/BookingScreen/BookingData/Book
|
|||
import { calculateOverAllQtyLimit } from '../../../utils/calculations';
|
||||
import { IoIosWarning } from 'react-icons/io';
|
||||
import { useState } from 'react';
|
||||
import { message } from 'antd';
|
||||
|
||||
const KisokOrderCart1 = (props) => {
|
||||
const dispatch = useDispatch();
|
||||
const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null);
|
||||
const [maxLimitExceeded, setMaxLimitExceeded] = useState(false);
|
||||
const preferenceDatas = useSelector(PreferenceData);
|
||||
const overAllLimitPreferenece =
|
||||
|
|
@ -45,10 +47,51 @@ const KisokOrderCart1 = (props) => {
|
|||
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -209,13 +252,14 @@ const KisokOrderCart1 = (props) => {
|
|||
remove
|
||||
</div>
|
||||
</div>
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />Maximum Quantity ({maxQtyLimit}) Reached
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
))}
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />{maxLimitExceededMessage}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ const KisokOrderCart2 = (props) => {
|
|||
const dispatch = useDispatch();
|
||||
const preferenceDatas = useSelector(PreferenceData);
|
||||
const [maxLimitExceeded, setMaxLimitExceeded] = useState(false);
|
||||
const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null);
|
||||
const overAllLimitPreferenece =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||
|
|
@ -49,8 +50,50 @@ const KisokOrderCart2 = (props) => {
|
|||
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
|
|
@ -232,7 +275,7 @@ const KisokOrderCart2 = (props) => {
|
|||
</div>
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />Maximum Quantity ({maxQtyLimit}) Reached
|
||||
<IoIosWarning size={30} color='#b99400' />{maxLimitExceededMessage}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ const KisokOrderCart3 = (props) => {
|
|||
const [maxLimitExceeded, setMaxLimitExceeded] = useState(false);
|
||||
const getKioskDarkColourdata = useSelector(getKioskDarkColour);
|
||||
const preferenceDatas = useSelector(PreferenceData);
|
||||
const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null);
|
||||
const overAllLimitPreferenece =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||
|
|
@ -52,8 +53,50 @@ const KisokOrderCart3 = (props) => {
|
|||
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
|
|
@ -245,7 +288,7 @@ const KisokOrderCart3 = (props) => {
|
|||
</div>
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />Maximum Quantity ({maxQtyLimit}) Reached
|
||||
<IoIosWarning size={30} color='#b99400' />{maxLimitExceededMessage}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ const OrderView1 = (props) => {
|
|||
: null;
|
||||
const dispatch = useDispatch();
|
||||
const [maxLimitExceeded, setMaxLimitExceeded] = useState(false);
|
||||
const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null);
|
||||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||
const preferenceDatas = useSelector(PreferenceData);
|
||||
|
|
@ -57,16 +58,56 @@ const OrderView1 = (props) => {
|
|||
);
|
||||
};
|
||||
const increase = async (item) => {
|
||||
|
||||
|
||||
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||
if (overAllLimitPreferenece) {
|
||||
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
|
|
@ -258,13 +299,14 @@ const OrderView1 = (props) => {
|
|||
remove
|
||||
</div>
|
||||
</div>
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />Maximum Quantity ({maxQtyLimit}) Reached
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
))}
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />{maxLimitExceededMessage}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ const KioskOrderView2 = (props) => {
|
|||
: null;
|
||||
const dispatch = useDispatch();
|
||||
const preferenceDatas = useSelector(PreferenceData);
|
||||
const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null);
|
||||
const [maxLimitExceeded, setMaxLimitExceeded] = useState(false);
|
||||
const overAllLimitPreferenece =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
|
|
@ -73,8 +74,50 @@ const KioskOrderView2 = (props) => {
|
|||
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
|
|
@ -339,7 +382,7 @@ const KioskOrderView2 = (props) => {
|
|||
</div>
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />Maximum Quantity ({maxQtyLimit}) Reached
|
||||
<IoIosWarning size={30} color='#b99400' />{maxLimitExceededMessage}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ const KioskOrderView = (props) => {
|
|||
const KioskOrderDetails = useSelector(GlobalKioskOrderDetails);
|
||||
const getKioskLightColourdata = useSelector(getKioskLightColour);
|
||||
const preferenceDatas = useSelector(PreferenceData);
|
||||
const [maxLimitExceededMessage, setMaxLimitExceededMessage] = useState(null);
|
||||
const [maxLimitExceeded, setMaxLimitExceeded] = useState(false);
|
||||
const overAllLimitPreferenece =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
|
|
@ -60,15 +61,56 @@ const KioskOrderView = (props) => {
|
|||
);
|
||||
};
|
||||
const increase = async (item) => {
|
||||
|
||||
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||
if (overAllLimitPreferenece) {
|
||||
const calculatedOverAllQty = calculateOverAllQtyLimit(KioskOrderDetails);
|
||||
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Maximum Quantity (${maxQtyLimit}) Reached`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (itemWiseLimitPreferenece) {
|
||||
|
||||
const inwardQtyMap = KioskOrderDetails.reduce((acc, curr) => {
|
||||
const inwardId = curr?.InwardDtlId;
|
||||
const qty = Number(curr?.OrderQty) || 0;
|
||||
|
||||
if (acc[inwardId]) {
|
||||
acc[inwardId] += qty;
|
||||
} else {
|
||||
acc[inwardId] = qty;
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const currentInwardId = item?.InwardDtlId;
|
||||
const addQty = 1;
|
||||
|
||||
if (inwardQtyMap[currentInwardId]) {
|
||||
inwardQtyMap[currentInwardId] += addQty;
|
||||
} else {
|
||||
inwardQtyMap[currentInwardId] = addQty;
|
||||
}
|
||||
|
||||
console.log("Final InwardDtlId Qty Map:", inwardQtyMap);
|
||||
const isExceeded = Object.values(inwardQtyMap).some(
|
||||
(qty) => qty > maxQtyLimit
|
||||
);
|
||||
|
||||
if (isExceeded) {
|
||||
setMaxLimitExceeded(true);
|
||||
// Reset after 3 seconds
|
||||
setMaxLimitExceededMessage(`Item Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
setTimeout(() => {
|
||||
setMaxLimitExceeded(false);
|
||||
setMaxLimitExceededMessage(null);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
|
|
@ -331,7 +373,7 @@ const KioskOrderView = (props) => {
|
|||
</div>
|
||||
<div className={`Item3Warning ${maxLimitExceeded ? 'showing' : ''}`}>
|
||||
<p>
|
||||
<IoIosWarning size={30} color='#b99400' />Maximum Quantity ({maxQtyLimit}) Reached
|
||||
<IoIosWarning size={30} color='#b99400' />{maxLimitExceededMessage}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue