Update src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BsBill2.jsx

This commit is contained in:
Gokul Erusappan 2026-02-24 15:47:37 +05:30
parent 5f5ca99409
commit 03fb7f9d6f
1 changed files with 25 additions and 7 deletions

View File

@ -1,6 +1,6 @@
import React, { useEffect, useState, Suspense } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { Badge } from 'antd';
import { Badge, message } from 'antd';
import defaultimage from '../../../../../Images/defaultItemImg.png';
import {
GlobalOrderCardDetails,
@ -57,6 +57,7 @@ import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/
import { ClearOfferAppliedProducts } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { useUtilsComponent } from '../../../../../Services/utils.js';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
import { calculateOverAllQtyLimit } from '../../../../../utils/calculations.js';
const MinusOutlined = React.lazy(
() => import('@ant-design/icons/MinusOutlined')
@ -110,8 +111,17 @@ const BsBill2 = () => {
const OtherServicesglobal = useSelector(GlobalOtherSevices);
const GetCustId = useSelector(GlobalCustId);
const selectedCustomer = useSelector(GlobalSelOption);
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 [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] =
useState(false);
const [customerProduct, setCustomerProduct] = useState(null);
const BillOrderPre = preferenceDatas?.[0]?.SettingDtlDetails?.find(
@ -268,8 +278,18 @@ const BsBill2 = () => {
const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId);
}
};
const increase = async (item) => {
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
if (overAllLimitPreferenece) {
const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails);
if ((calculatedOverAllQty + 1) > maxQtyLimit) {
message.warning(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`)
return;
}
}
}
const OtherOrderDatas = CartOrderDetails?.filter(
(cartItem) =>
!(
@ -1003,8 +1023,6 @@ const BsBill2 = () => {
} else {
dispatch(changeOrderCardDetails(UpdatedData));
}
} else if (
item?.BookingTypeName !== 'Dine In' &&
OrderType === 'Hold'
@ -2233,7 +2251,7 @@ const BsBill2 = () => {
ProductDetail={Modaldata}
/>
)}
{(customerPriceHistoryOpen && GetCustId) &&
{customerPriceHistoryOpen && GetCustId && (
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
@ -2242,7 +2260,7 @@ const BsBill2 = () => {
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
)}
</div>
</div>
</div>