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