diff --git a/src/Features/BookingScreen/BookingData/DateStore.js b/src/Features/BookingScreen/BookingData/DateStore.js
index 27a3f24..e39ba70 100644
--- a/src/Features/BookingScreen/BookingData/DateStore.js
+++ b/src/Features/BookingScreen/BookingData/DateStore.js
@@ -11,6 +11,30 @@ const formatDate = (date) => {
return `${year}-${month}-${day}`;
};
+export const formatDateShort = (dateStr) => {
+ if (!dateStr) return '';
+ const date = new Date(dateStr);
+ const day = String(date.getDate()).padStart(2, '0');
+ const month = date.toLocaleString('en-US', { month: 'short' });
+ const year = date.getFullYear();
+ return `${day} ${month} ${year}`;
+};
+
+export const formatTime12 = (dateString = '') => {
+ if (!dateString) return '-';
+
+ const date = new Date(dateString);
+ if (isNaN(date)) return '-';
+
+ let hours = date.getHours();
+ const minutes = date.getMinutes().toString().padStart(2, '0');
+ const ampm = hours >= 12 ? 'PM' : 'AM';
+
+ hours = hours % 12 || 12;
+
+ return `${hours}:${minutes} ${ampm}`;
+};
+
// Utility: get today's and tomorrow's date
const today = new Date();
const tomorrow = new Date();
@@ -26,7 +50,7 @@ export const useDateStore = create((set) => ({
set({ selectedDate: formattedDates });
},
invoiceDate: formatDate(today), // single date instead of array
-
+
setInvoiceDate: (date) => {
// Store as single date in YYYY-MM-DD format
const formattedDate = formatDate(date);
diff --git a/src/Features/CustMaster/CustMaster.js b/src/Features/CustMaster/CustMaster.js
index b4f1959..3265d09 100644
--- a/src/Features/CustMaster/CustMaster.js
+++ b/src/Features/CustMaster/CustMaster.js
@@ -57,3 +57,16 @@ export const delCust = createAsyncThunk('Cust/delcust', async (deleteData) => {
export const putCust = createAsyncThunk('putCust/putCust', async (putData) => {
return await axiosRetailInstanceData.put(`/customer`, putData);
});
+
+export const getCustomerProductPriceHistory = createAsyncThunk('GET/getCustomerProductPriceHistory', async (data) => {
+ const { AppId, CompId, BranchId, CustId, ProdId } = data;
+
+ if (CustId != null && CustId != undefined && ProdId != null &&
+ ProdId != undefined && AppId != null && AppId != undefined &&
+ CompId != null && CompId != undefined && BranchId != null &&
+ BranchId != undefined) {
+
+ return await axiosRetailInstanceData.get(`/CustomerLastProdRate?CustId=${CustId}&ProdId=${ProdId}&AppId=${AppId}&CompId=${CompId}&BranchId=${BranchId}`);
+
+ }
+});
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx
index 39d9056..bb0030b 100644
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx
+++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx
@@ -69,11 +69,14 @@ import {
changeSelProdWiseEst,
GlobalOtherSevices,
GlobalDefaultBookingType,
+ GlobalSelOption,
+ GlobalCustId,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.scss';
import { useUtilsComponent } from '../../../../../Services/utils.js';
+import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const BSBillingTable1 = () => {
const { removeExtraCharge } = useUtilsComponent();
@@ -131,6 +134,11 @@ const BSBillingTable1 = () => {
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
const OtherServicesglobal = useSelector(GlobalOtherSevices);
+ const GetCustId = useSelector(GlobalCustId);
+ const selectedCustomer = useSelector(GlobalSelOption);
+
+ const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
+ const [customerProduct, setCustomerProduct] = useState(null);
const tableDataDinein = tableData?.filter(
(a, b) => a.BookingTypeName === 'Dine In' && !a?.SalesId
@@ -139,8 +147,8 @@ const BSBillingTable1 = () => {
OrderType === 'Hold'
? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
: tableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
- );
+ (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
+ );
const OldtableDataDinein = tableData?.filter(
(a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId
@@ -148,8 +156,8 @@ const BSBillingTable1 = () => {
const OldtableDataTakeAway =
OrderType != 'Hold'
? tableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
- )
+ (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
+ )
: [];
const [OpenEditTotalAmt, setOpenEditTotalAmt] = useState(false);
const [OpenImeiDetail, setOpenImeiDetail] = useState(false);
@@ -174,6 +182,27 @@ const BSBillingTable1 = () => {
}
}, [SelectedFont]);
+ useEffect(() => {
+ const handleKeyDown = (e) => {
+ if (e.ctrlKey && e.key.toLowerCase() === 'i') {
+ e.preventDefault();
+
+ const prodId = tableData?.[0]?.ProdId;
+
+ if (GetCustId && prodId) {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(prodId);
+ }
+ }
+ };
+
+ window.addEventListener('keydown', handleKeyDown);
+
+ return () => {
+ window.removeEventListener('keydown', handleKeyDown);
+ };
+ }, [GetCustId, tableData]);
+
useEffect(() => {
if (tableData?.length === 0) {
dispatch(ClearOfferAppliedProducts());
@@ -282,6 +311,10 @@ const BSBillingTable1 = () => {
return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
}
+ const handleCustomerProductPriceHistory = (item) => {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(item?.ProdId);
+ }
const getstockbadge = async () => {
let data = {
@@ -1059,9 +1092,9 @@ const BSBillingTable1 = () => {
)?.map((item, idx) =>
idx === 0
? {
- ...item,
- FreeQty,
- }
+ ...item,
+ FreeQty,
+ }
: item
),
};
@@ -2216,7 +2249,7 @@ const BSBillingTable1 = () => {
OpenEditTotalAmount();
}
}}
- // onClick={tableData?.length>0? OpenEditTotalAmount :""}
+ // onClick={tableData?.length>0? OpenEditTotalAmount :""}
>
{!isMobile ? (
Qty
@@ -2324,11 +2357,10 @@ const BSBillingTable1 = () => {
{OldtableDataTakeAway?.map((item, index) => (
{
? item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- tableDataDinein?.length >=
- PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ tableDataDinein?.length >=
+ PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background: item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length + index) % 2 === 0
? 'white'
@@ -2747,21 +2781,21 @@ const BSBillingTable1 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -2846,18 +2880,21 @@ const BSBillingTable1 = () => {
textAlign: 'right',
}}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
{allowDecimal
? Number(
- item?.TotalAmt - (item?.Offer || 0) || 0
- ).toFixed(2)
+ item?.TotalAmt - (item?.Offer || 0) || 0
+ ).toFixed(2)
: Number(
- item?.TotalAmt - (item?.Offer || 0) || 0
- )}
+ item?.TotalAmt - (item?.Offer || 0) || 0
+ )}
)}
@@ -2897,11 +2934,10 @@ const BSBillingTable1 = () => {
OldtableDataTakeAway?.length +
index
}
- className={`${
- BookingType === 'Dine In' && item?.SalesId
- ? 'Billing-Table1-row-disabled'
- : 'Billing-Table1-row'
- }
+ className={`${BookingType === 'Dine In' && item?.SalesId
+ ? 'Billing-Table1-row-disabled'
+ : 'Billing-Table1-row'
+ }
`}
style={{
@@ -2912,43 +2948,43 @@ const BSBillingTable1 = () => {
? BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataTakeAway?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataTakeAway?.length >=
- PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataTakeAway?.length >=
+ PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.[
- 'OverallBackgroundColor'
- ]
+ 'OverallBackgroundColor'
+ ]
? SelectedBillColor?.[
- 'OverallBackgroundColor'
- ]
+ 'OverallBackgroundColor'
+ ]
: '#d6d6d6'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -2957,15 +2993,15 @@ const BSBillingTable1 = () => {
BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -2974,9 +3010,9 @@ const BSBillingTable1 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -3024,7 +3060,7 @@ const BSBillingTable1 = () => {
style={{ fontFamily: 'Poppins', textAlign: 'left' }}
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0
+ item.ProductIdentifierDtls?.length > 0
? handleImeiDetails(item)
: editField && handleEditQuantity(item)
}
@@ -3045,8 +3081,8 @@ const BSBillingTable1 = () => {
{!item?.ProdVariantName?.toLowerCase()?.includes(
'variant'
) && (
- {item?.ProdVariantName}
- )}
+ {item?.ProdVariantName}
+ )}
{item?.Size}
{item?.SinglePc == 'Y'
? 'PCS'
@@ -3080,21 +3116,21 @@ const BSBillingTable1 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -3179,18 +3215,21 @@ const BSBillingTable1 = () => {
textAlign: 'right',
}}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
{allowDecimal
? Number(
- item?.TotalAmt - (item?.Offer || 0) || 0
- ).toFixed(2)
+ item?.TotalAmt - (item?.Offer || 0) || 0
+ ).toFixed(2)
: Number(
- item?.TotalAmt - (item?.Offer || 0) || 0
- )}
+ item?.TotalAmt - (item?.Offer || 0) || 0
+ )}
)}
@@ -3231,11 +3270,10 @@ const BSBillingTable1 = () => {
tableDataTakeAway?.length +
index
}
- className={`${
- BookingType === 'Dine In' && item?.SalesId
- ? 'Billing-Table1-row-disabled'
- : 'Billing-Table1-row'
- }
+ className={`${BookingType === 'Dine In' && item?.SalesId
+ ? 'Billing-Table1-row-disabled'
+ : 'Billing-Table1-row'
+ }
`}
style={{
@@ -3248,45 +3286,45 @@ const BSBillingTable1 = () => {
!BookingTypeBoth
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataDinein?.length >=
- PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataDinein?.length >=
+ PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background:
BookingType === 'Dine In' &&
- item?.SalesId &&
- !BookingTypeBoth
+ item?.SalesId &&
+ !BookingTypeBoth
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -3295,10 +3333,10 @@ const BSBillingTable1 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataDinein?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -3396,21 +3434,21 @@ const BSBillingTable1 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -3495,18 +3533,21 @@ const BSBillingTable1 = () => {
textAlign: 'right',
}}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
{allowDecimal
? Number(
- item?.TotalAmt - (item?.Offer || 0) || 0
- ).toFixed(2)
+ item?.TotalAmt - (item?.Offer || 0) || 0
+ ).toFixed(2)
: Number(
- item?.TotalAmt - (item?.Offer || 0) || 0
- )}
+ item?.TotalAmt - (item?.Offer || 0) || 0
+ )}
)}
@@ -3551,6 +3592,16 @@ const BSBillingTable1 = () => {
ProductDetail={Modaldata}
/>
)}
+ {(customerPriceHistoryOpen && GetCustId) &&
+
+ }
>
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BsBill2.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BsBill2.jsx
index 786ad87..43937c0 100644
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BsBill2.jsx
+++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable2/BsBill2.jsx
@@ -31,6 +31,8 @@ import {
PreferenceData,
GlobalOtherSevices,
GlobalDefaultBookingType,
+ GlobalSelOption,
+ GlobalCustId,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import {
getTemplateData,
@@ -51,6 +53,7 @@ import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import { ClearOfferAppliedProducts } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { useUtilsComponent } from '../../../../../Services/utils.js';
+import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const MinusOutlined = React.lazy(
() => import('@ant-design/icons/MinusOutlined')
@@ -102,6 +105,11 @@ const BsBill2 = () => {
const GlobEstBooking = useSelector(GlobalEstimateBooking);
const OtherServicesglobal = useSelector(GlobalOtherSevices);
+ const GetCustId = useSelector(GlobalCustId);
+ const selectedCustomer = useSelector(GlobalSelOption);
+
+ const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
+ const [customerProduct, setCustomerProduct] = useState(null);
const BillOrderPre = preferenceDatas?.[0]?.SettingDtlDetails?.find(
(item) => item.SettingIdName === 'BillItemsOrder'
@@ -125,16 +133,16 @@ const BsBill2 = () => {
OrderType === 'Hold'
? CartOrderDetails?.filter((a, b) => a.BookingTypeName === 'TakeAway')
: CartOrderDetails?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
- );
+ (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
+ );
const OldtableDataDinein = CartOrderDetails?.filter(
(a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId
);
const OldtableDataTakeAway =
OrderType != 'Hold'
? CartOrderDetails?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
- )
+ (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
+ )
: [];
useEffect(() => {
@@ -147,6 +155,27 @@ const BsBill2 = () => {
}
}, [SelectedFont]);
+ useEffect(() => {
+ const handleKeyDown = (e) => {
+ if (e.ctrlKey && e.key.toLowerCase() === 'i') {
+ e.preventDefault();
+
+ const prodId = CartOrderDetails?.[0]?.ProdId;
+
+ if (GetCustId && prodId) {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(prodId);
+ }
+ }
+ };
+
+ window.addEventListener('keydown', handleKeyDown);
+
+ return () => {
+ window.removeEventListener('keydown', handleKeyDown);
+ };
+ }, [GetCustId, CartOrderDetails]);
+
useEffect(() => {
if (CartOrderDetails?.length === 0) {
dispatch(ClearOfferAppliedProducts());
@@ -233,6 +262,10 @@ const BsBill2 = () => {
const handleImeiDetailClose = () => {
setOpenImeiDetail(false);
};
+ const handleCustomerProductPriceHistory = (item) => {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(item?.ProdId);
+ }
const increase = async (item) => {
const OtherOrderDatas = CartOrderDetails?.filter(
(cartItem) =>
@@ -293,26 +326,26 @@ const BsBill2 = () => {
if (isItemInCart && BookingTypeProd != 'Dine In' && OrderType != 'Hold') {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty + 1,
- TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty + 1,
+ TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty + 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty + 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
@@ -323,26 +356,26 @@ const BsBill2 = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty + 1,
- TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty + 1,
+ TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty + 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty + 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@@ -361,26 +394,26 @@ const BsBill2 = () => {
) {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty + 1,
- TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty + 1,
+ TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty + 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty + 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
@@ -391,26 +424,26 @@ const BsBill2 = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty + 1,
- TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty + 1,
+ TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty + 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty + 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@@ -423,27 +456,27 @@ const BsBill2 = () => {
} else if (isItemInCartHold && OrderType === 'Hold') {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCartHold,
- OrderQty: isItemInCartHold?.OrderQty + 1,
- TotalAmt:
- (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCartHold,
+ OrderQty: isItemInCartHold?.OrderQty + 1,
+ TotalAmt:
+ (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
+ TaxAmt: (
+ ((isItemInCartHold?.OrderQty + 1) *
+ isItemInCartHold?.OrderRate *
+ isItemInCartHold?.TaxPercentage) /
+ (100 + isItemInCartHold?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
+ (
((isItemInCartHold?.OrderQty + 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
- (
- ((isItemInCartHold?.OrderQty + 1) *
- isItemInCartHold?.OrderRate *
- isItemInCartHold?.TaxPercentage) /
- (100 + isItemInCartHold?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [
UpdatedCartItem,
@@ -457,27 +490,27 @@ const BsBill2 = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCartHold,
- OrderQty: isItemInCartHold?.OrderQty + 1,
- TotalAmt:
- (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCartHold,
+ OrderQty: isItemInCartHold?.OrderQty + 1,
+ TotalAmt:
+ (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
+ TaxAmt: (
+ ((isItemInCartHold?.OrderQty + 1) *
+ isItemInCartHold?.OrderRate *
+ isItemInCartHold?.TaxPercentage) /
+ (100 + isItemInCartHold?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
+ (
((isItemInCartHold?.OrderQty + 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
- (
- ((isItemInCartHold?.OrderQty + 1) *
- isItemInCartHold?.OrderRate *
- isItemInCartHold?.TaxPercentage) /
- (100 + isItemInCartHold?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [
...OtherorderDataforNormalWithoutSalesId,
@@ -642,27 +675,27 @@ const BsBill2 = () => {
) {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty - 1,
- TotalAmt:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty - 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty - 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
@@ -673,27 +706,27 @@ const BsBill2 = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty - 1,
- TotalAmt:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty - 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty - 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@@ -712,27 +745,27 @@ const BsBill2 = () => {
) {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty - 1,
- TotalAmt:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty - 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty - 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
@@ -743,27 +776,27 @@ const BsBill2 = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty - 1,
- TotalAmt:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty - 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty - 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@@ -776,29 +809,29 @@ const BsBill2 = () => {
} else if (isItemInCartHold && OrderType === 'Hold') {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCartHold,
- OrderQty: isItemInCartHold?.OrderQty - 1,
- TotalAmt:
- (isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCartHold,
+ OrderQty: isItemInCartHold?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate,
+ TaxAmt: (
+ ((isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate *
+ isItemInCartHold?.TaxPercentage) /
+ (100 + isItemInCartHold?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate -
+ (
((isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate -
- (
- ((isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate *
- isItemInCartHold?.TaxPercentage) /
- (100 + isItemInCartHold?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [
UpdatedCartItem,
@@ -812,29 +845,29 @@ const BsBill2 = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCartHold,
- OrderQty: isItemInCartHold?.OrderQty - 1,
- TotalAmt:
- (isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCartHold,
+ OrderQty: isItemInCartHold?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate,
+ TaxAmt: (
+ ((isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate *
+ isItemInCartHold?.TaxPercentage) /
+ (100 + isItemInCartHold?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate -
+ (
((isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate -
- (
- ((isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate *
- isItemInCartHold?.TaxPercentage) /
- (100 + isItemInCartHold?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [
...OtherorderDataforNormalWithoutSalesId,
@@ -1229,8 +1262,8 @@ const BsBill2 = () => {
>
{index ===
Math.floor((OldtableDataTakeAway.length - 1) / 2) && (
-
- )}
+
+ )}
)}
{
? item?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)'
: triggerAnimation &&
- index === 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength
+ index === 0 &&
+ !item?.SalesId &&
+ tableDataTakeAway?.length >= PreviousdataLength
? 'wheat'
: triggerAnimation &&
- index === 0 &&
- tableDataTakeAway?.length >=
- PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ index === 0 &&
+ tableDataTakeAway?.length >=
+ PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
@@ -1264,9 +1297,9 @@ const BsBill2 = () => {
item?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: index % 2 === 0
? 'white'
@@ -1293,8 +1326,8 @@ const BsBill2 = () => {
loading="lazy"
src={
item?.ProdLogo &&
- item?.ProdLogo != null &&
- item?.ProdLogo != undefined
+ item?.ProdLogo != null &&
+ item?.ProdLogo != undefined
? item?.ProdLogo
: defaultimage
}
@@ -1356,26 +1389,32 @@ const BsBill2 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
{
+ e.stopPropagation();
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
+ }
+ }}
>
-{' '}
@@ -1451,8 +1490,8 @@ const BsBill2 = () => {
>
{index ==
Math.round(OldtableDataDinein?.length / 2 - 0.1) && (
-
- )}
+
+ )}
)}
{
? item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ tableDataDinein?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background: item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length + index) % 2 === 0
? 'white'
@@ -1515,8 +1554,8 @@ const BsBill2 = () => {
loading="lazy"
src={
item?.ProdLogo &&
- item?.ProdLogo != null &&
- item?.ProdLogo != undefined
+ item?.ProdLogo != null &&
+ item?.ProdLogo != undefined
? item?.ProdLogo
: defaultimage
}
@@ -1573,26 +1612,32 @@ const BsBill2 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
{
+ e.stopPropagation();
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
+ }
+ }}
>
-{' '}
@@ -1669,8 +1714,8 @@ const BsBill2 = () => {
>
{index ==
Math.round(tableDataTakeAway?.length / 2 - 0.1) && (
-
- )}
+
+ )}
)}
{
? BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataTakeAway?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataTakeAway?.length >=
- PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataTakeAway?.length >=
+ PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.[
- 'OverallBackgroundColor'
- ]
+ 'OverallBackgroundColor'
+ ]
: '#d6d6d6'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -1730,15 +1775,15 @@ const BsBill2 = () => {
BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -1747,9 +1792,9 @@ const BsBill2 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -1766,8 +1811,8 @@ const BsBill2 = () => {
loading="lazy"
src={
item?.ProdLogo &&
- item?.ProdLogo != null &&
- item?.ProdLogo != undefined
+ item?.ProdLogo != null &&
+ item?.ProdLogo != undefined
? item?.ProdLogo
: defaultimage
}
@@ -1822,26 +1867,32 @@ const BsBill2 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
{
+ e.stopPropagation();
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
+ }
+ }}
>
{item?.OfferPrice > 0 ||
@@ -1956,44 +2007,44 @@ const BsBill2 = () => {
!BookingTypeBoth
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataDinein?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background:
BookingType === 'Dine In' &&
- item?.SalesId &&
- !BookingTypeBoth
+ item?.SalesId &&
+ !BookingTypeBoth
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -2002,10 +2053,10 @@ const BsBill2 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataDinein?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -2022,8 +2073,8 @@ const BsBill2 = () => {
loading="lazy"
src={
item?.ProdLogo &&
- item?.ProdLogo != null &&
- item?.ProdLogo != undefined
+ item?.ProdLogo != null &&
+ item?.ProdLogo != undefined
? item?.ProdLogo
: defaultimage
}
@@ -2080,26 +2131,32 @@ const BsBill2 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
{
+ e.stopPropagation();
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
+ }
+ }}
>
-{' '}
@@ -2163,6 +2220,16 @@ const BsBill2 = () => {
ProductDetail={Modaldata}
/>
)}
+ {(customerPriceHistoryOpen && GetCustId) &&
+
+ }
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx
index 3e5c282..0e4f8df 100644
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx
+++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx
@@ -59,6 +59,8 @@ import {
changeSelProdWiseEst,
GlobalOtherSevices,
GlobalDefaultBookingType,
+ GlobalSelOption,
+ GlobalCustId,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingTables3/BSBillingTable3.scss';
import {
@@ -73,6 +75,7 @@ import {
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { useRemoveProducts } from './RemoveCartWithOffer.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js';
+import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const BSBillingTable3 = () => {
const { removeExtraCharge } = useUtilsComponent();
@@ -126,6 +129,11 @@ const BSBillingTable3 = () => {
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
const OfferFreeProduct = useSelector(GlobalFreeProdList, shallowEqual);
const OtherServicesglobal = useSelector(GlobalOtherSevices);
+ const GetCustId = useSelector(GlobalCustId);
+ const selectedCustomer = useSelector(GlobalSelOption);
+
+ const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
+ const [customerProduct, setCustomerProduct] = useState(null);
const preferenceshortcutkey = preferenceDatas?.[0]?.[
'SettingDtlDetails'
]?.some(
@@ -141,16 +149,16 @@ const BSBillingTable3 = () => {
OrderType === 'Hold'
? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
: tableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
- );
+ (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
+ );
const OldtableDataDinein = tableData?.filter(
(a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId
);
const OldtableDataTakeAway =
OrderType != 'Hold'
? tableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
- )
+ (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
+ )
: [];
const [EditQuantity, setEditQuantity] = useState(false);
const [Modaldata, setModaldata] = useState([]);
@@ -174,6 +182,27 @@ const BSBillingTable3 = () => {
}
}, [SelectedFont]);
+ useEffect(() => {
+ const handleKeyDown = (e) => {
+ if (e.ctrlKey && e.key.toLowerCase() === 'i') {
+ e.preventDefault();
+
+ const prodId = tableData?.[0]?.ProdId;
+
+ if (GetCustId && prodId) {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(prodId);
+ }
+ }
+ };
+
+ window.addEventListener('keydown', handleKeyDown);
+
+ return () => {
+ window.removeEventListener('keydown', handleKeyDown);
+ };
+ }, [GetCustId, tableData]);
+
useEffect(() => {
if (!preferenceshortcutkey) return;
@@ -334,6 +363,11 @@ const BSBillingTable3 = () => {
}
};
+ const handleCustomerProductPriceHistory = (item) => {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(item?.ProdId);
+ }
+
function safeRound(amountStr) {
if (amountStr == null) return allowDecimal ? '0.00' : '0';
@@ -1000,9 +1034,9 @@ const BSBillingTable3 = () => {
)?.map((item, idx) =>
idx === 0
? {
- ...item,
- FreeQty,
- }
+ ...item,
+ FreeQty,
+ }
: item
),
};
@@ -2321,11 +2355,10 @@ const BSBillingTable3 = () => {
{OldtableDataTakeAway?.map((item, index) => (
{
? item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ tableDataDinein?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background: item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length + index) % 2 === 0
? 'white'
@@ -2861,21 +2894,21 @@ const BSBillingTable4 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -2942,8 +2975,11 @@ const BSBillingTable4 = () => {
className="Table4-item-price"
style={{ width: '30px', fontFamily: 'Poppins' }}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -2989,11 +3025,10 @@ const BSBillingTable4 = () => {
OldtableDataTakeAway?.length +
index
}
- className={`${
- BookingType === 'Dine In' && item?.SalesId
- ? 'BSBill-Table3-content-Disabled'
- : 'BSBill-Table3-content'
- }
+ className={`${BookingType === 'Dine In' && item?.SalesId
+ ? 'BSBill-Table3-content-Disabled'
+ : 'BSBill-Table3-content'
+ }
`}
style={{
@@ -3003,38 +3038,38 @@ const BSBillingTable4 = () => {
? BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataTakeAway?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataTakeAway?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
: '#d6d6d6'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -3044,15 +3079,15 @@ const BSBillingTable4 = () => {
BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -3061,9 +3096,9 @@ const BSBillingTable4 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -3107,7 +3142,7 @@ const BSBillingTable4 = () => {
style={{ fontFamily: 'Poppins' }}
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0
+ item.ProductIdentifierDtls?.length > 0
? handleImeiDetails(item)
: editField && handleEditQuantity(item, index)
}
@@ -3177,21 +3212,21 @@ const BSBillingTable4 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -3258,8 +3293,11 @@ const BSBillingTable4 = () => {
className="Table4-item-price"
style={{ width: '30px', fontFamily: 'Poppins' }}
onClick={() => {
- if (editField) {
- handleEditQuantity(item, index);
+ // if (editField) {
+ // handleEditQuantity(item, index);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -3306,11 +3344,10 @@ const BSBillingTable4 = () => {
OldtableDataTakeAway?.length +
index
}
- className={`${
- item?.SalesId && OrderType !== 'Hold'
- ? 'BSBill-Table3-content-Disabled'
- : 'BSBill-Table3-content'
- }
+ className={`${item?.SalesId && OrderType !== 'Hold'
+ ? 'BSBill-Table3-content-Disabled'
+ : 'BSBill-Table3-content'
+ }
`}
style={{
@@ -3322,44 +3359,44 @@ const BSBillingTable4 = () => {
!BookingTypeBoth
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataDinein?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background:
BookingType === 'Dine In' &&
- item?.SalesId &&
- !BookingTypeBoth
+ item?.SalesId &&
+ !BookingTypeBoth
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -3368,10 +3405,10 @@ const BSBillingTable4 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataDinein?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -3476,21 +3513,21 @@ const BSBillingTable4 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -3557,8 +3594,11 @@ const BSBillingTable4 = () => {
className="Table4-item-price"
style={{ width: '30px', fontFamily: 'Poppins' }}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -3609,6 +3649,16 @@ const BSBillingTable4 = () => {
ProductDetail={Modaldata}
/>
)}
+ {(customerPriceHistoryOpen && GetCustId) &&
+
+ }
);
};
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BsBill.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BsBill.jsx
index 0c65f04..1320efe 100644
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BsBill.jsx
+++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BsBill.jsx
@@ -45,6 +45,8 @@ import {
getPreferenceData,
GlobalOtherSevices,
GlobalDefaultBookingType,
+ GlobalSelOption,
+ GlobalCustId,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import {
ChangeFullFreeProductList,
@@ -72,6 +74,7 @@ import { getCustomerDisplayWindow } from '../../../../../Features/customerDispla
import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js';
+import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const BsBill = () => {
const { removeExtraCharge } = useUtilsComponent();
@@ -113,6 +116,11 @@ const BsBill = () => {
const ReportholdData = useSelector(GlobalReorderHoldDetails);
const prodCat = useSelector(GlobalProductCategorie);
const ProdSubCat = useSelector(GlobalProductSubCategorie);
+ const GetCustId = useSelector(GlobalCustId);
+ const selectedCustomer = useSelector(GlobalSelOption);
+
+ const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
+ const [customerProduct, setCustomerProduct] = useState(null);
const [PreviousdataLength, setPreviousdataLength] =
useState(PreviousOrderLength);
const [triggerAnimation, setTriggerAnimation] = useState(true);
@@ -138,16 +146,16 @@ const BsBill = () => {
OrderType === 'Hold'
? TableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
: TableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
- );
+ (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
+ );
const OldtableDataDinein = TableData?.filter(
(a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId
);
const OldtableDataTakeAway =
OrderType != 'Hold'
? TableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
- )
+ (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
+ )
: [];
const BillOrderPre = preferenceDatas?.[0]?.SettingDtlDetails?.find(
(item) => item.SettingIdName === 'BillItemsOrder'
@@ -802,9 +810,9 @@ const BsBill = () => {
)?.map((item, idx) =>
idx === 0
? {
- ...item,
- FreeQty,
- }
+ ...item,
+ FreeQty,
+ }
: item
),
};
@@ -1837,6 +1845,26 @@ const BsBill = () => {
});
}
}, [SelectedFont]);
+ useEffect(() => {
+ const handleKeyDown = (e) => {
+ if (e.ctrlKey && e.key.toLowerCase() === 'i') {
+ e.preventDefault();
+
+ const prodId = TableData?.[0]?.ProdId;
+
+ if (GetCustId && prodId) {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(prodId);
+ }
+ }
+ };
+
+ window.addEventListener('keydown', handleKeyDown);
+
+ return () => {
+ window.removeEventListener('keydown', handleKeyDown);
+ };
+ }, [GetCustId, TableData]);
useEffect(() => {
if (TableData?.length === 0) {
dispatch(ClearOfferAppliedProducts());
@@ -2115,26 +2143,26 @@ const BsBill = () => {
if (isItemInCart && BookingTypeProd != 'Dine In' && OrderType != 'Hold') {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty + 1,
- TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty + 1,
+ TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty + 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty + 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
@@ -2145,26 +2173,26 @@ const BsBill = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty + 1,
- TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty + 1,
+ TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty + 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty + 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@@ -2183,26 +2211,26 @@ const BsBill = () => {
) {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty + 1,
- TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty + 1,
+ TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty + 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty + 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
@@ -2213,26 +2241,26 @@ const BsBill = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty + 1,
- TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty + 1,
+ TotalAmt: (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty + 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty + 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty + 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty + 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@@ -2245,27 +2273,27 @@ const BsBill = () => {
} else if (isItemInCartHold && OrderType === 'Hold') {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCartHold,
- OrderQty: isItemInCartHold?.OrderQty + 1,
- TotalAmt:
- (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCartHold,
+ OrderQty: isItemInCartHold?.OrderQty + 1,
+ TotalAmt:
+ (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
+ TaxAmt: (
+ ((isItemInCartHold?.OrderQty + 1) *
+ isItemInCartHold?.OrderRate *
+ isItemInCartHold?.TaxPercentage) /
+ (100 + isItemInCartHold?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
+ (
((isItemInCartHold?.OrderQty + 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
- (
- ((isItemInCartHold?.OrderQty + 1) *
- isItemInCartHold?.OrderRate *
- isItemInCartHold?.TaxPercentage) /
- (100 + isItemInCartHold?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [
UpdatedCartItem,
@@ -2279,27 +2307,27 @@ const BsBill = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCartHold,
- OrderQty: isItemInCartHold?.OrderQty + 1,
- TotalAmt:
- (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCartHold,
+ OrderQty: isItemInCartHold?.OrderQty + 1,
+ TotalAmt:
+ (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate,
+ TaxAmt: (
+ ((isItemInCartHold?.OrderQty + 1) *
+ isItemInCartHold?.OrderRate *
+ isItemInCartHold?.TaxPercentage) /
+ (100 + isItemInCartHold?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
+ (
((isItemInCartHold?.OrderQty + 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCartHold?.OrderQty + 1) * isItemInCartHold?.OrderRate -
- (
- ((isItemInCartHold?.OrderQty + 1) *
- isItemInCartHold?.OrderRate *
- isItemInCartHold?.TaxPercentage) /
- (100 + isItemInCartHold?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [
...OtherorderDataforNormalWithoutSalesId,
@@ -2412,6 +2440,10 @@ const BsBill = () => {
return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
}
+ const handleCustomerProductPriceHistory = (item) => {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(item?.ProdId);
+ }
const decline = async (item) => {
setPreviousdataLength(TableData?.length);
const isItemInCart = TableData?.find(
@@ -2487,27 +2519,27 @@ const BsBill = () => {
) {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty - 1,
- TotalAmt:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty - 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty - 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
@@ -2518,27 +2550,27 @@ const BsBill = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty - 1,
- TotalAmt:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty - 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty - 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@@ -2557,27 +2589,27 @@ const BsBill = () => {
) {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty - 1,
- TotalAmt:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty - 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty - 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [UpdatedCartItem, ...OtherorderDataforNormal];
if (OfferCheckedInSetup && preferenceOffer) {
@@ -2587,27 +2619,27 @@ const BsBill = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCart,
- OrderQty: isItemInCart?.OrderQty - 1,
- TotalAmt:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCart,
+ OrderQty: isItemInCart?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate,
+ TaxAmt: (
+ ((isItemInCart?.OrderQty - 1) *
+ isItemInCart?.OrderRate *
+ isItemInCart?.TaxPercentage) /
+ (100 + isItemInCart?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
+ (
((isItemInCart?.OrderQty - 1) *
isItemInCart?.OrderRate *
isItemInCart?.TaxPercentage) /
(100 + isItemInCart?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCart?.OrderQty - 1) * isItemInCart?.OrderRate -
- (
- ((isItemInCart?.OrderQty - 1) *
- isItemInCart?.OrderRate *
- isItemInCart?.TaxPercentage) /
- (100 + isItemInCart?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [...OtherorderDataforNormal, UpdatedCartItem];
@@ -2620,29 +2652,29 @@ const BsBill = () => {
} else if (isItemInCartHold && OrderType === 'Hold') {
if (BillOrderPre === 'Y') {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCartHold,
- OrderQty: isItemInCartHold?.OrderQty - 1,
- TotalAmt:
- (isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCartHold,
+ OrderQty: isItemInCartHold?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate,
+ TaxAmt: (
+ ((isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate *
+ isItemInCartHold?.TaxPercentage) /
+ (100 + isItemInCartHold?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate -
+ (
((isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate -
- (
- ((isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate *
- isItemInCartHold?.TaxPercentage) /
- (100 + isItemInCartHold?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [
UpdatedCartItem,
@@ -2656,29 +2688,29 @@ const BsBill = () => {
}
} else {
const UpdatedCartItem =
- // if the item is already in the cart, increase the quantity of the item
- {
- ...isItemInCartHold,
- OrderQty: isItemInCartHold?.OrderQty - 1,
- TotalAmt:
- (isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate,
- TaxAmt: (
+ // if the item is already in the cart, increase the quantity of the item
+ {
+ ...isItemInCartHold,
+ OrderQty: isItemInCartHold?.OrderQty - 1,
+ TotalAmt:
+ (isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate,
+ TaxAmt: (
+ ((isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate *
+ isItemInCartHold?.TaxPercentage) /
+ (100 + isItemInCartHold?.TaxPercentage)
+ ).toFixed(2),
+ WithoutTaxRate:
+ (isItemInCartHold?.OrderQty - 1) *
+ isItemInCartHold?.OrderRate -
+ (
((isItemInCartHold?.OrderQty - 1) *
isItemInCartHold?.OrderRate *
isItemInCartHold?.TaxPercentage) /
(100 + isItemInCartHold?.TaxPercentage)
).toFixed(2),
- WithoutTaxRate:
- (isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate -
- (
- ((isItemInCartHold?.OrderQty - 1) *
- isItemInCartHold?.OrderRate *
- isItemInCartHold?.TaxPercentage) /
- (100 + isItemInCartHold?.TaxPercentage)
- ).toFixed(2),
- };
+ };
const UpdatedData = [
...OtherorderDataforNormalWithoutSalesId,
@@ -3207,15 +3239,15 @@ const BsBill = () => {
? item?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)'
: triggerAnimation &&
- index === 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength
+ index === 0 &&
+ !item?.SalesId &&
+ tableDataTakeAway?.length >= PreviousdataLength
? 'wheat'
: triggerAnimation &&
- index === 0 &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ index === 0 &&
+ tableDataTakeAway?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
@@ -3223,9 +3255,9 @@ const BsBill = () => {
item?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: index % 2 === 0
? 'white'
@@ -3263,7 +3295,7 @@ const BsBill = () => {
{
className="BSBillingTable5-table-td for-combo"
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0
+ item.ProductIdentifierDtls?.length > 0
? handleImeiDetails(item)
: editField && handleEditQuantity(item)
}
@@ -3342,21 +3374,21 @@ const BsBill = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
|
)}
{tableitem.OptionName == 'MRP' && (
@@ -3469,8 +3501,11 @@ const BsBill = () => {
borderBottom: '1.9px dashed #000',
}}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -3524,26 +3559,26 @@ const BsBill = () => {
? item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ tableDataDinein?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background: item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length + index) % 2 === 0
? 'white'
@@ -3581,7 +3616,7 @@ const BsBill = () => {
{
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
|
)}
{tableitem.OptionName == 'MRP' && (
@@ -3783,8 +3818,11 @@ const BsBill = () => {
borderBottom: '1.9px dashed #000',
}}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -3838,38 +3876,38 @@ const BsBill = () => {
? BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataTakeAway?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataTakeAway?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
: '#d6d6d6'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -3878,15 +3916,15 @@ const BsBill = () => {
BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -3895,9 +3933,9 @@ const BsBill = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -3925,7 +3963,7 @@ const BsBill = () => {
{
className="BSBillingTable5-table-td for-combo"
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0
+ item.ProductIdentifierDtls?.length > 0
? handleImeiDetails(item)
: editField && handleEditQuantity(item)
}
@@ -3969,8 +4007,8 @@ const BsBill = () => {
{!item?.ProdVariantName?.toLowerCase()?.includes(
'variant'
) && (
- {item?.ProdVariantName}
- )}
+ {item?.ProdVariantName}
+ )}
{item?.Size}
{item?.SinglePc == 'Y'
? 'PCS'
@@ -4008,21 +4046,21 @@ const BsBill = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
|
)}
{tableitem.OptionName == 'MRP' && (
@@ -4147,8 +4185,11 @@ const BsBill = () => {
borderBottom: '1.9px dashed #000',
}}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -4204,44 +4245,44 @@ const BsBill = () => {
!BookingTypeBoth
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataDinein?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background:
BookingType === 'Dine In' &&
- item?.SalesId &&
- !BookingTypeBoth
+ item?.SalesId &&
+ !BookingTypeBoth
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -4250,10 +4291,10 @@ const BsBill = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataDinein?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -4281,7 +4322,7 @@ const BsBill = () => {
{
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
|
)}
{tableitem.OptionName == 'MRP' && (
@@ -4483,8 +4524,11 @@ const BsBill = () => {
borderBottom: '1.9px dashed #000',
}}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -4536,6 +4580,16 @@ const BsBill = () => {
ProductDetail={Modaldata}
/>
)}
+ {(customerPriceHistoryOpen && GetCustId) &&
+
+ }
);
};
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.jsx
index 73ed687..442f9aa 100644
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.jsx
+++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.jsx
@@ -45,6 +45,8 @@ import {
changeSelProdWiseEst,
GlobalOtherSevices,
GlobalDefaultBookingType,
+ GlobalSelOption,
+ GlobalCustId,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import {
ChangeFullFreeProductList,
@@ -69,6 +71,7 @@ import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import { useApplyOfferto_CardDetail } from '../../UtillComponents/BSNavBarOffer/BSNavBarOffer_CustomHooks.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js';
+import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const BSBillingTable6 = () => {
const { removeExtraCharge } = useUtilsComponent();
@@ -123,6 +126,11 @@ const BSBillingTable6 = () => {
const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
const OrderType = useSelector(GlobalOrderType);
const GlobEstBooking = useSelector(GlobalEstimateBooking);
+ const GetCustId = useSelector(GlobalCustId);
+ const selectedCustomer = useSelector(GlobalSelOption);
+
+ const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
+ const [customerProduct, setCustomerProduct] = useState(null);
const [OpenImeiDetail, setOpenImeiDetail] = useState(false);
const [shortKeyMethod, setshortKeyMethod] = useState(null);
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
@@ -144,16 +152,16 @@ const BSBillingTable6 = () => {
OrderType === 'Hold'
? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
: tableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
- );
+ (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
+ );
const OldtableDataDinein = tableData?.filter(
(a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId
);
const OldtableDataTakeAway =
OrderType != 'Hold'
? tableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
- )
+ (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
+ )
: [];
const [OpenEditTotalAmt, setOpenEditTotalAmt] = useState(false);
useEffect(() => {
@@ -165,6 +173,26 @@ const BSBillingTable6 = () => {
});
}
}, [SelectedFont]);
+ useEffect(() => {
+ const handleKeyDown = (e) => {
+ if (e.ctrlKey && e.key.toLowerCase() === 'i') {
+ e.preventDefault();
+
+ const prodId = tableData?.[0]?.ProdId;
+
+ if (GetCustId && prodId) {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(prodId);
+ }
+ }
+ };
+
+ window.addEventListener('keydown', handleKeyDown);
+
+ return () => {
+ window.removeEventListener('keydown', handleKeyDown);
+ };
+ }, [GetCustId, tableData]);
useEffect(() => {
if (tableData?.length === 0) {
dispatch(ClearOfferAppliedProducts());
@@ -1006,9 +1034,9 @@ const BSBillingTable6 = () => {
)?.map((item, idx) =>
idx === 0
? {
- ...item,
- FreeQty,
- }
+ ...item,
+ FreeQty,
+ }
: item
),
};
@@ -2049,6 +2077,11 @@ const BSBillingTable6 = () => {
return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
}
+ const handleCustomerProductPriceHistory = (item) => {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(item?.ProdId);
+ }
+
const OpenEditTotalAmount = () => {
setOpenEditTotalAmt(true);
};
@@ -2307,15 +2340,15 @@ const BSBillingTable6 = () => {
? item?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)'
: triggerAnimation &&
- index === 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength
+ index === 0 &&
+ !item?.SalesId &&
+ tableDataTakeAway?.length >= PreviousdataLength
? 'wheat'
: triggerAnimation &&
- index === 0 &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ index === 0 &&
+ tableDataTakeAway?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
@@ -2323,9 +2356,9 @@ const BSBillingTable6 = () => {
item?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: index % 2 === 0
? 'white'
@@ -2377,7 +2410,7 @@ const BSBillingTable6 = () => {
style={{ fontFamily: 'Poppins', textAlign: 'left' }}
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0
+ item.ProductIdentifierDtls?.length > 0
? handleImeiDetails(item)
: editField && handleEditQuantity(item)
}
@@ -2423,21 +2456,21 @@ const BSBillingTable6 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -2505,8 +2538,11 @@ const BSBillingTable6 = () => {
className="BillingTable6-table-td"
style={{ fontFamily: 'Poppins', textAlign: 'center' }}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -2559,26 +2595,26 @@ const BSBillingTable6 = () => {
? item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ tableDataDinein?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background: item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length + index) % 2 === 0
? 'white'
@@ -2674,21 +2710,21 @@ const BSBillingTable6 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -2756,8 +2792,11 @@ const BSBillingTable6 = () => {
className="BillingTable6-table-td"
style={{ fontFamily: 'Poppins', textAlign: 'center' }}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -2814,38 +2853,38 @@ const BSBillingTable6 = () => {
? BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataTakeAway?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataTakeAway?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataTakeAway?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
: '#d6d6d6'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -2854,15 +2893,15 @@ const BSBillingTable6 = () => {
BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -2871,9 +2910,9 @@ const BSBillingTable6 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -2917,7 +2956,7 @@ const BSBillingTable6 = () => {
style={{ fontFamily: 'Poppins', textAlign: 'left' }}
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
- item.ProductIdentifierDtls?.length > 0
+ item.ProductIdentifierDtls?.length > 0
? handleImeiDetails(item)
: editField && handleEditQuantity(item)
}
@@ -2968,21 +3007,21 @@ const BSBillingTable6 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -3050,8 +3089,11 @@ const BSBillingTable6 = () => {
className="BillingTable6-table-td"
style={{ fontFamily: 'Poppins', textAlign: 'center' }}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -3110,44 +3152,44 @@ const BSBillingTable6 = () => {
!BookingTypeBoth
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataDinein?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background:
BookingType === 'Dine In' &&
- item?.SalesId &&
- !BookingTypeBoth
+ item?.SalesId &&
+ !BookingTypeBoth
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -3156,10 +3198,10 @@ const BSBillingTable6 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataDinein?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -3248,21 +3290,21 @@ const BSBillingTable6 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -3330,8 +3372,11 @@ const BSBillingTable6 = () => {
className="BillingTable6-table-td"
style={{ fontFamily: 'Poppins', textAlign: 'center' }}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -3379,6 +3424,16 @@ const BSBillingTable6 = () => {
ProductDetail={Modaldata}
/>
)}
+ {(customerPriceHistoryOpen && GetCustId) &&
+
+ }
);
};
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.jsx
index 2177d62..0cbda12 100644
--- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.jsx
+++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.jsx
@@ -36,6 +36,8 @@ import {
changeUnpaidData,
GlobalOtherSevices,
GlobalDefaultBookingType,
+ GlobalCustId,
+ GlobalSelOption,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import {
ChangeFullFreeProductList,
@@ -60,6 +62,7 @@ import BSEditTotalAmt from '../BSEditTotalAmount/BSEditTotalAmt.jsx';
import BSImeiDetails from '../BSImeiDetails/BSImeiDetails.jsx';
import { getSession } from '../../../../../Services/Others.js';
import { useUtilsComponent } from '../../../../../Services/utils.js';
+import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const BSBillingTable7 = () => {
const { removeExtraCharge } = useUtilsComponent();
@@ -90,7 +93,11 @@ const BSBillingTable7 = () => {
);
const BookingType = useSelector(GlobalBookingType);
const defaultBookingType = useSelector(GlobalDefaultBookingType);
+ const GetCustId = useSelector(GlobalCustId);
+ const selectedCustomer = useSelector(GlobalSelOption);
+ const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
+ const [customerProduct, setCustomerProduct] = useState(null);
const [EditQuantity, setEditQuantity] = useState(false);
const [Modaldata, setModaldata] = useState([]);
const [editdelete, seteditdelete] = useState('');
@@ -123,16 +130,16 @@ const BSBillingTable7 = () => {
OrderType === 'Hold'
? tableData?.filter((a, b) => a.BookingTypeName === 'TakeAway')
: tableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
- );
+ (a, b) => a.BookingTypeName === 'TakeAway' && !a?.SalesId
+ );
const OldtableDataDinein = tableData?.filter(
(a, b) => a.BookingTypeName === 'Dine In' && a?.SalesId
);
const OldtableDataTakeAway =
OrderType != 'Hold'
? tableData?.filter(
- (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
- )
+ (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId
+ )
: [];
const productBasedExtraCharges = GlobalExtraCharge.filter(
(obj) => 'ProdName' in obj
@@ -151,6 +158,26 @@ const BSBillingTable7 = () => {
});
}
}, [SelectedFont]);
+ useEffect(() => {
+ const handleKeyDown = (e) => {
+ if (e.ctrlKey && e.key.toLowerCase() === 'i') {
+ e.preventDefault();
+
+ const prodId = tableData?.[0]?.ProdId;
+
+ if (GetCustId && prodId) {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(prodId);
+ }
+ }
+ };
+
+ window.addEventListener('keydown', handleKeyDown);
+
+ return () => {
+ window.removeEventListener('keydown', handleKeyDown);
+ };
+ }, [GetCustId, tableData]);
useEffect(() => {
if (tableData?.length === 0) {
dispatch(ClearOfferAppliedProducts());
@@ -925,9 +952,9 @@ const BSBillingTable7 = () => {
)?.map((item, idx) =>
idx === 0
? {
- ...item,
- FreeQty,
- }
+ ...item,
+ FreeQty,
+ }
: item
),
};
@@ -1970,6 +1997,13 @@ const BSBillingTable7 = () => {
return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
}
+
+
+ const handleCustomerProductPriceHistory = (item) => {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(item?.ProdId);
+ }
+
const handlechange33 = () => {
if (editdelete === 'Edit') {
seteditdelete('');
@@ -2256,16 +2290,16 @@ const BSBillingTable7 = () => {
? item?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)'
: triggerAnimation &&
- index === 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength
+ index === 0 &&
+ !item?.SalesId &&
+ tableDataTakeAway?.length >= PreviousdataLength
? 'wheat'
: triggerAnimation &&
- index === 0 &&
- tableDataTakeAway?.length >=
- PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ index === 0 &&
+ tableDataTakeAway?.length >=
+ PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
@@ -2273,9 +2307,9 @@ const BSBillingTable7 = () => {
item?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: index % 2 === 0
? 'white'
@@ -2300,15 +2334,14 @@ const BSBillingTable7 = () => {
? () => handleEditQuantity(item)
: editdelete === 'Delete'
? () => removeFromCart(item)
- : () => {}
+ : () => { }
}
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
- className={`${
- item?.SalesId && OrderType !== 'Hold'
- ? 'BSBill-Table7-content-disabled'
- : 'BSBill-Table7-content'
- }
+ className={`${item?.SalesId && OrderType !== 'Hold'
+ ? 'BSBill-Table7-content-disabled'
+ : 'BSBill-Table7-content'
+ }
`}
>
@@ -2389,21 +2422,21 @@ const BSBillingTable7 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -2451,7 +2484,14 @@ const BSBillingTable7 = () => {
)}
{tableitem.OptionName == 'Amount' && (
-
+ | {
+ e.stopPropagation();
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
+ }
+ }}
+ style={{ fontFamily: 'Poppins' }}>
{safeRound(item?.TotalAmt)}
|
)}
@@ -2474,26 +2514,26 @@ const BSBillingTable7 = () => {
? item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length + index === 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length + index === 0 &&
+ tableDataDinein?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background: item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length + index) % 2 === 0
? 'white'
@@ -2518,15 +2558,14 @@ const BSBillingTable7 = () => {
? () => handleEditQuantity(item)
: editdelete === 'Delete'
? () => removeFromCart(item)
- : () => {}
+ : () => { }
}
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
- className={`${
- item?.SalesId
- ? 'BSBill-Table7-content-disabled'
- : 'BSBill-Table7-content'
- }
+ className={`${item?.SalesId
+ ? 'BSBill-Table7-content-disabled'
+ : 'BSBill-Table7-content'
+ }
`}
>
@@ -2603,21 +2642,21 @@ const BSBillingTable7 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -2665,7 +2704,12 @@ const BSBillingTable7 = () => {
)}
{tableitem.OptionName == 'Amount' && (
-
+ | {
+ e.stopPropagation();
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
+ }
+ }} style={{ fontFamily: 'Poppins' }}>
{safeRound(item?.TotalAmt)}
|
)}
@@ -2688,41 +2732,41 @@ const BSBillingTable7 = () => {
? BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataTakeAway?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataTakeAway?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataTakeAway?.length >=
- PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataDinein?.length +
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataTakeAway?.length >=
+ PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.[
- 'OverallBackgroundColor'
- ]
+ 'OverallBackgroundColor'
+ ]
: '#d6d6d6'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -2731,15 +2775,15 @@ const BSBillingTable7 = () => {
BookingType === 'Dine In' && item?.SalesId
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -2748,9 +2792,9 @@ const BSBillingTable7 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataDinein?.length +
- OldtableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -2767,22 +2811,21 @@ const BSBillingTable7 = () => {
onClick={
editdelete === 'Edit'
? () =>
- item.Type == 'P' || item.Type == 'C'
+ item.Type == 'P' || item.Type == 'C'
+ ? handleEditQuantity(item)
+ : item.ServiceType == 'G'
? handleEditQuantity(item)
- : item.ServiceType == 'G'
- ? handleEditQuantity(item)
- : ''
+ : ''
: editdelete === 'Delete'
? () => removeFromCart(item)
- : () => {}
+ : () => { }
}
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
- className={`${
- BookingType === 'Dine In' && item?.SalesId
- ? 'BSBill-Table7-content-disabled'
- : 'BSBill-Table7-content'
- }
+ className={`${BookingType === 'Dine In' && item?.SalesId
+ ? 'BSBill-Table7-content-disabled'
+ : 'BSBill-Table7-content'
+ }
`}
>
@@ -2880,21 +2923,21 @@ const BSBillingTable7 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -2942,7 +2985,12 @@ const BSBillingTable7 = () => {
)}
{tableitem.OptionName == 'Amount' && (
-
+ | {
+ e.stopPropagation();
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
+ }
+ }} style={{ fontFamily: 'Poppins' }}>
{item?.TotalAmt}
|
)}
@@ -2967,44 +3015,44 @@ const BSBillingTable7 = () => {
!BookingTypeBoth
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- !item?.SalesId &&
- tableDataDinein?.length >= PreviousdataLength
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ !item?.SalesId &&
+ tableDataDinein?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
- triggerAnimation &&
- OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
- tableDataDinein?.length >= PreviousdataLength &&
- !HoldOrderDtl &&
- !UnpaidData
+ triggerAnimation &&
+ OldtableDataTakeAway?.length +
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
+ tableDataDinein?.length >= PreviousdataLength &&
+ !HoldOrderDtl &&
+ !UnpaidData
? 'wheat'
: 'inherit'
: 'none',
background:
BookingType === 'Dine In' &&
- item?.SalesId &&
- !BookingTypeBoth
+ item?.SalesId &&
+ !BookingTypeBoth
? 'rgb(243, 248, 213)'
: GlobEstBooking === 'ParEst' &&
- GlobProdwisedata?.includes(
- item?.InwardDtlId + ' ' + item?.BookingTypeName
- )
+ GlobProdwisedata?.includes(
+ item?.InwardDtlId + ' ' + item?.BookingTypeName
+ )
? '#b2d1f7'
: (OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index) %
- 2 ===
- 0
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index) %
+ 2 ===
+ 0
? 'white'
: SelectedBillColor?.['OverallBackgroundColor']
? SelectedBillColor?.['OverallBackgroundColor']
@@ -3013,10 +3061,10 @@ const BSBillingTable7 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataTakeAway?.length +
- OldtableDataDinein?.length +
- tableDataTakeAway?.length +
- index ===
- 0 &&
+ OldtableDataDinein?.length +
+ tableDataTakeAway?.length +
+ index ===
+ 0 &&
!item?.SalesId &&
tableDataDinein?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@@ -3036,15 +3084,14 @@ const BSBillingTable7 = () => {
? () => handleEditQuantity(item)
: editdelete === 'Delete'
? () => removeFromCart(item)
- : () => {}
+ : () => { }
}
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
- className={`${
- BookingType === 'Dine In' && item?.SalesId
- ? 'BSBill-Table7-content-disabled'
- : 'BSBill-Table7-content'
- }
+ className={`${BookingType === 'Dine In' && item?.SalesId
+ ? 'BSBill-Table7-content-disabled'
+ : 'BSBill-Table7-content'
+ }
`}
>
@@ -3125,21 +3172,21 @@ const BSBillingTable7 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
-
- Extra Charges :{' '}
- {
- productBasedExtraCharges?.find(
- (find) => find.ProdId === item.ProdId
- )?.TotalAmt
- }
-
- )}
+
+ Extra Charges :{' '}
+ {
+ productBasedExtraCharges?.find(
+ (find) => find.ProdId === item.ProdId
+ )?.TotalAmt
+ }
+
+ )}
)}
{tableitem.OptionName == 'MRP' && (
@@ -3187,7 +3234,14 @@ const BSBillingTable7 = () => {
)}
{tableitem.OptionName == 'Amount' && (
-
+ | {
+ e.stopPropagation();
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
+ }
+ }}
+ style={{ fontFamily: 'Poppins' }}>
{safeRound(item?.TotalAmt)}
|
)}
@@ -3221,6 +3275,16 @@ const BSBillingTable7 = () => {
ProductDetail={Modaldata}
/>
)}
+ {(customerPriceHistoryOpen && GetCustId) &&
+
+ }
>
);
};
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx
index 5047375..c980a85 100644
--- a/src/Pages/BookingScreen/Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx
+++ b/src/Pages/BookingScreen/Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx
@@ -58,6 +58,8 @@ import {
changeSelProdWiseEst,
GlobalOtherSevices,
GlobalDefaultBookingType,
+ GlobalCustId,
+ GlobalSelOption,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import {
ChangeOfferAppliedProducts,
@@ -71,6 +73,7 @@ import {
} from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { useRemoveProducts } from '../BSBillingTable3/RemoveCartWithOffer.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js';
+import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const ComboSalesBillTable = () => {
const { removeExtraCharge } = useUtilsComponent();
@@ -125,6 +128,11 @@ const ComboSalesBillTable = () => {
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
const OfferFreeProduct = useSelector(GlobalFreeProdList, shallowEqual);
const OtherServicesglobal = useSelector(GlobalOtherSevices);
+ const GetCustId = useSelector(GlobalCustId);
+ const selectedCustomer = useSelector(GlobalSelOption);
+
+ const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
+ const [customerProduct, setCustomerProduct] = useState(null);
const tableDataDinein = tableData?.filter(
(a, b) => a.BookingTypeName === 'Dine In' && !a?.SalesId
@@ -183,6 +191,27 @@ const ComboSalesBillTable = () => {
}
}, [SelectedFont]);
+ useEffect(() => {
+ const handleKeyDown = (e) => {
+ if (e.ctrlKey && e.key.toLowerCase() === 'i') {
+ e.preventDefault();
+
+ const prodId = tableData?.[0]?.ProdId;
+
+ if (GetCustId && prodId) {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(prodId);
+ }
+ }
+ };
+
+ window.addEventListener('keydown', handleKeyDown);
+
+ return () => {
+ window.removeEventListener('keydown', handleKeyDown);
+ };
+ }, [GetCustId, tableData]);
+
// useEffect(() => {
// const BillOrder = preferenceDatas?.[0]?.SettingDtlDetails?.find(
// (item) => item.SettingIdName === 'BillItemsOrder'
@@ -223,6 +252,12 @@ const ComboSalesBillTable = () => {
return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
}
+ const handleCustomerProductPriceHistory = (item) => {
+ debugger
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(item?.ProdId);
+ }
+
const handleEditQuantity = (value) => {
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
setEditQuantity(false);
@@ -2295,7 +2330,14 @@ const ComboSalesBillTable = () => {
editField && handleEditQuantity(row)}
+ onClick={() => {
+ // if (editField) {
+ // handleEditQuantity(row)
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(row);
+ }
+ }}
>
{allowDecimal
? Number(row.TotalAmt - (row?.Offer || 0)).toFixed(2)
@@ -2372,6 +2414,16 @@ const ComboSalesBillTable = () => {
Index={Index}
/>
)}
+ {(customerPriceHistoryOpen && GetCustId) &&
+
+ }
);
};
diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx
index 706af57..8136112 100644
--- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx
+++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx
@@ -66,6 +66,8 @@ import {
changeBillEditingMode,
changePreviousOrderPayment,
changePreviousOrderOfferDetail,
+ GlobalCustId,
+ GlobalSelOption,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import './StandardTable.scss';
import { IoClose } from 'react-icons/io5';
@@ -82,6 +84,7 @@ import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/
import { CiShop } from 'react-icons/ci';
import BranchName from '../../../Template/BranchName.jsx';
import { useUtilsComponent } from '../../../../../Services/utils.js';
+import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const StandardTable = () => {
const { removeExtraCharge } = useUtilsComponent();
@@ -135,6 +138,10 @@ const StandardTable = () => {
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
const OtherServicesglobal = useSelector(GlobalOtherSevices);
const totalItems = useSelector(GlobalSummeryTotalItems);
+ const GetCustId = useSelector(GlobalCustId);
+ const selectedCustomer = useSelector(GlobalSelOption);
+ const [customerPriceHistoryOpen, setCustomerPriceHistoryOpen] = useState(false);
+ const [customerProduct, setCustomerProduct] = useState(null);
const [tableCollapse, setTableCollapse] = useState(false);
const [shortKeyMethod, setshortKeyMethod] = useState(null);
@@ -209,6 +216,28 @@ const StandardTable = () => {
});
}
}, [SelectedFont]);
+
+ useEffect(() => {
+ const handleKeyDown = (e) => {
+ if (e.ctrlKey && e.key.toLowerCase() === 'i') {
+ e.preventDefault();
+
+ const prodId = OrderCardDetail?.[0]?.ProdId;
+
+ if (GetCustId && prodId) {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(prodId);
+ }
+ }
+ };
+
+ window.addEventListener('keydown', handleKeyDown);
+
+ return () => {
+ window.removeEventListener('keydown', handleKeyDown);
+ };
+ }, [GetCustId, OrderCardDetail]);
+
useEffect(() => {
if (!preferenceshortcutkey) return;
@@ -2223,6 +2252,11 @@ const StandardTable = () => {
}
};
+ const handleCustomerProductPriceHistory = (item) => {
+ setCustomerPriceHistoryOpen(true);
+ setCustomerProduct(item?.ProdId);
+ }
+
const handleEditQuantityCancel = () => {
setEditQuantity(false);
};
@@ -2787,8 +2821,11 @@ const StandardTable = () => {
"'Inter', ui-sans-serif, system-ui, sans-serif",
}}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -3101,8 +3138,11 @@ const StandardTable = () => {
"'Inter', ui-sans-serif, system-ui, sans-serif",
}}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -3463,8 +3503,11 @@ const StandardTable = () => {
"'Inter', ui-sans-serif, system-ui, sans-serif",
}}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -3806,8 +3849,11 @@ const StandardTable = () => {
"'Inter', ui-sans-serif, system-ui, sans-serif",
}}
onClick={() => {
- if (editField) {
- handleEditQuantity(item);
+ // if (editField) {
+ // handleEditQuantity(item);
+ // }
+ if (GetCustId) {
+ handleCustomerProductPriceHistory(item);
}
}}
>
@@ -3855,6 +3901,17 @@ const StandardTable = () => {
ProductDetail={Modaldata}
/>
)}
+ {(customerPriceHistoryOpen && GetCustId) &&
+
+ }
diff --git a/src/Pages/BookingScreen/Components/UtillComponents/CustomerPriceHistory.jsx b/src/Pages/BookingScreen/Components/UtillComponents/CustomerPriceHistory.jsx
new file mode 100644
index 0000000..e7db73f
--- /dev/null
+++ b/src/Pages/BookingScreen/Components/UtillComponents/CustomerPriceHistory.jsx
@@ -0,0 +1,161 @@
+import { useEffect, useState } from "react";
+import { DefaultModal } from "../../../../Components/Modal/DefaultModal"
+import { Tables } from "../../../../Components/Tables/Table"
+import { useDispatch } from "react-redux";
+import { getCustomerProductPriceHistory } from "../../../../Features/CustMaster/CustMaster";
+import { getSession } from "../../../../Services/Others";
+import { formatDateShort, formatTime12 } from "../../../../Features/BookingScreen/BookingData/DateStore";
+
+const CustomerPriceHistory = ({
+ open = false,
+ custId = null,
+ setCustomerPriceHistoryOpen = () => { },
+ customerProduct = null,
+ setCustomerProduct = () => { },
+ selectedCustomer = null,
+ OrderCardDetail = [],
+}
+) => {
+
+ const dispatch = useDispatch();
+ const AppId = getSession('AppId');
+ const CompId = getSession('CompId');
+ const BranchId = getSession('BranchId');
+ const [priceHistory, setPriceHistory] = useState([]);
+ const [page, setPage] = useState(1);
+
+ console.log(selectedCustomer, "selectedCustomer")
+
+ const columns = [
+ {
+ title: 'SL NO',
+ key: 'slno',
+ align: 'center',
+ width: '60px',
+ render: (_, __, index) => (page - 1) * 10 + index + 1,
+ },
+ {
+ title: 'Product',
+ key: 'product',
+ render: (_, record) =>
+ `${record?.ProdName || '-'} (${record?.UOMName || ''})`.trim(),
+ },
+ {
+ title: 'Variant',
+ dataIndex: 'ProdVariantName',
+ key: 'ProdVariantName',
+ align: 'center',
+ },
+ {
+ title: 'Qty',
+ dataIndex: 'Qty',
+ key: 'Qty',
+ align: 'center',
+ },
+ {
+ title: 'Rate ( ₹ )',
+ dataIndex: 'Rate',
+ key: 'Rate',
+ align: 'right',
+ width: '80px',
+ render: value => {value} ,
+ },
+ {
+ title: 'MRP ( ₹ )',
+ dataIndex: 'MRP',
+ key: 'MRP',
+ align: 'right',
+ width: '80px',
+ render: value => `${value}`,
+ },
+ {
+ title: 'Offer Price',
+ dataIndex: 'OfferPrice',
+ key: 'OfferPrice',
+ align: 'right',
+ width: '100px',
+ render: value => value > 0 ? `₹ ${value}` : '-',
+ },
+ {
+ title: 'Date',
+ key: 'SalesDate',
+ align: 'center',
+ width: '110px',
+ render: (_, record) => formatDateShort(record?.SalesDate),
+ },
+ {
+ title: 'Time',
+ key: 'SalesTime',
+ align: 'center',
+ width: '80px',
+ render: (_, record) => formatTime12(record?.SalesDate),
+ },
+ ];
+
+ const fetchCustomerPriceHistory = async () => {
+ const response = await dispatch(getCustomerProductPriceHistory({
+ CustId: custId,
+ ProdId: customerProduct,
+ AppId,
+ CompId,
+ BranchId
+ }))?.unwrap();
+ if (response?.data?.data?.length > 0 && response?.data?.statusCode === 1) {
+ setPriceHistory(response?.data?.data);
+ } else {
+ setPriceHistory([]);
+ }
+ }
+
+ useEffect(() => {
+ if (open && customerProduct) {
+ fetchCustomerPriceHistory();
+ }
+ }, [open, customerProduct]);
+
+ const handlePageChange = (current) => {
+ setPage(current);
+ };
+
+ const handlePriceHistoryClose = () => {
+ setCustomerPriceHistoryOpen(false);
+ setCustomerProduct(null);
+ }
+
+ return (
+ <>
+
+
+ {selectedCustomer?.CustName &&
+ Customer Name: {selectedCustomer?.CustName}
+ }
+ {selectedCustomer?.value &&
+ Customer Mobile: {selectedCustomer?.value}
+ }
+
+
+ >}
+ />
+ >
+ )
+}
+
+export default CustomerPriceHistory
\ No newline at end of file
diff --git a/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx b/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx
index b314106..77052b5 100644
--- a/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx
+++ b/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx
@@ -18,6 +18,7 @@ const ShortcutKeyHelper = ({}) => {
{ key: 'Alt + W', description: 'Hold and Recall' },
{ key: 'Ctrl + Q', description: 'Qty Change' },
{ key: 'Ctrl + E', description: 'Price Change' },
+ { key: 'Ctrl + I', description: 'Customer Rate History' },
];
return (
|