Merge pull request 'customer price history modal added' (#82) from temp/customer-price-history into main

Reviewed-on: Pozomind/pozo-retail-app#82
This commit is contained in:
karthikalakshmi 2026-02-05 15:54:51 +05:30
commit a512216df4
13 changed files with 2380 additions and 1679 deletions

View File

@ -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();

View File

@ -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}`);
}
});

View File

@ -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 ? (
<Tooltip title="Quantity">Qty</Tooltip>
@ -2324,11 +2357,10 @@ const BSBillingTable1 = () => {
{OldtableDataTakeAway?.map((item, index) => (
<tr
key={index}
className={`${
item?.SalesId && OrderType !== 'Hold'
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
className={`${item?.SalesId && OrderType !== 'Hold'
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
`}
style={{
@ -2339,16 +2371,16 @@ const BSBillingTable1 = () => {
? 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',
@ -2356,9 +2388,9 @@ const BSBillingTable1 = () => {
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'
@ -2413,7 +2445,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)
}
@ -2463,21 +2495,21 @@ const BSBillingTable1 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{tableitem.OptionName == 'MRP' && (
@ -2562,18 +2594,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
)}
</td>
)}
@ -2608,11 +2643,10 @@ const BSBillingTable1 = () => {
{OldtableDataDinein?.map((item, index) => (
<tr
key={OldtableDataTakeAway?.length + index}
className={`${
item?.SalesId
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
className={`${item?.SalesId
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
`}
style={{
@ -2623,27 +2657,27 @@ const BSBillingTable1 = () => {
? 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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{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
)}
</td>
)}
@ -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'
) && (
<span>{item?.ProdVariantName} </span>
)}
<span>{item?.ProdVariantName} </span>
)}
{item?.Size}
{item?.SinglePc == 'Y'
? 'PCS'
@ -3080,21 +3116,21 @@ const BSBillingTable1 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{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
)}
</td>
)}
@ -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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{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
)}
</td>
)}
@ -3551,6 +3592,16 @@ const BSBillingTable1 = () => {
ProductDetail={Modaldata}
/>
)}
{(customerPriceHistoryOpen && GetCustId) &&
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
setCustomerPriceHistoryOpen={setCustomerPriceHistoryOpen}
customerProduct={customerProduct}
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
</div>
</div>
</>

View File

@ -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) => (
<tr
key={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={{
@ -2336,15 +2369,15 @@ const BSBillingTable3 = () => {
? 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',
@ -2352,9 +2385,9 @@ const BSBillingTable3 = () => {
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'
@ -2410,7 +2443,7 @@ const BSBillingTable3 = () => {
style={{ fontFamily: 'Poppins' }}
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
item.ProductIdentifierDtls?.length > 0
item.ProductIdentifierDtls?.length > 0
? handleImeiDetails(item)
: editField && handleEditQuantity(item)
}
@ -2457,21 +2490,21 @@ const BSBillingTable3 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
</>
)}
@ -2554,15 +2587,18 @@ const BSBillingTable3 = () => {
className="Table3-item-price"
style={{ width: '60px', fontFamily: 'Poppins' }}
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)}
</td>
)}
@ -2597,11 +2633,10 @@ const BSBillingTable3 = () => {
{OldtableDataDinein?.map((item, index) => (
<tr
key={OldtableDataTakeAway?.length + index}
className={`${
item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
className={`${item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
`}
style={{
@ -2612,26 +2647,26 @@ const BSBillingTable3 = () => {
? 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'
@ -2732,21 +2767,21 @@ const BSBillingTable3 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
</>
)}
@ -2829,15 +2864,18 @@ const BSBillingTable3 = () => {
className="Table3-item-price"
style={{ width: '60px', fontFamily: 'Poppins' }}
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)}
</td>
)}
@ -2877,11 +2915,10 @@ const BSBillingTable3 = () => {
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={{
@ -2892,38 +2929,38 @@ const BSBillingTable3 = () => {
? 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']
@ -2932,15 +2969,15 @@ const BSBillingTable3 = () => {
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']
@ -2949,9 +2986,9 @@ const BSBillingTable3 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataDinein?.length +
OldtableDataTakeAway?.length +
index ===
0 &&
OldtableDataTakeAway?.length +
index ===
0 &&
!item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@ -3000,7 +3037,7 @@ const BSBillingTable3 = () => {
style={{ fontFamily: 'Poppins' }}
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
item.ProductIdentifierDtls?.length > 0
item.ProductIdentifierDtls?.length > 0
? handleImeiDetails(item)
: editField && handleEditQuantity(item, index)
}
@ -3054,21 +3091,21 @@ const BSBillingTable3 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
</>
)}
@ -3152,15 +3189,18 @@ const BSBillingTable3 = () => {
className="Table3-item-price"
style={{ width: '60px', fontFamily: 'Poppins' }}
onClick={() => {
if (editField) {
handleEditQuantity(item, index);
// if (editField) {
// handleEditQuantity(item, index);
// }
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)}
</td>
)}
@ -3200,11 +3240,10 @@ const BSBillingTable3 = () => {
tableDataTakeAway?.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={{
@ -3217,44 +3256,44 @@ const BSBillingTable3 = () => {
!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']
@ -3263,10 +3302,10 @@ const BSBillingTable3 = () => {
BillOrderPre === 'Y' && !BookingTypeBoth
? triggerAnimation &&
OldtableDataTakeAway?.length +
OldtableDataDinein?.length +
tableDataTakeAway?.length +
index ===
0 &&
OldtableDataDinein?.length +
tableDataTakeAway?.length +
index ===
0 &&
!item?.SalesId &&
tableDataDinein?.length >= PreviousdataLength &&
!HoldOrderDtl &&
@ -3362,21 +3401,21 @@ const BSBillingTable3 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
</>
)}
@ -3459,15 +3498,18 @@ const BSBillingTable3 = () => {
className="Table3-item-price"
style={{ width: '60px', fontFamily: 'Poppins' }}
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)}
</td>
)}
@ -3510,6 +3552,16 @@ const BSBillingTable3 = () => {
ProductDetail={Modaldata}
/>
)}
{(customerPriceHistoryOpen && GetCustId) &&
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
setCustomerPriceHistoryOpen={setCustomerPriceHistoryOpen}
customerProduct={customerProduct}
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
</div>
);
};

View File

@ -44,6 +44,8 @@ import {
GlobalOtherSevices,
GlobalDefaultBookingType,
PostBlockSlots,
GlobalSelOption,
GlobalCustId,
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
import {
ChangeTotalAmount,
@ -72,6 +74,7 @@ import {
import { ApplicationPreferences } from '../../../../../Features/BrachLogin/BranchLogin.js';
import { useDateStore } from '../../../../../Features/BookingScreen/BookingData/DateStore.js';
import { useUtilsComponent } from '../../../../../Services/utils.js';
import CustomerPriceHistory from '../../UtillComponents/CustomerPriceHistory.jsx';
const BSBillingTable4 = () => {
const { removeExtraCharge } = useUtilsComponent();
@ -135,6 +138,11 @@ const BSBillingTable4 = () => {
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 [OpenEditTotalAmt, setOpenEditTotalAmt] = useState(false);
const [OpenImeiDetail, setOpenImeiDetail] = useState(false);
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
@ -170,16 +178,16 @@ const BSBillingTable4 = () => {
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
)
: [];
useEffect(() => {
@ -191,6 +199,26 @@ const BSBillingTable4 = () => {
});
}
}, [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());
@ -1088,9 +1116,9 @@ const BSBillingTable4 = () => {
)?.map((item, idx) =>
idx === 0
? {
...item,
FreeQty,
}
...item,
FreeQty,
}
: item
),
};
@ -2080,6 +2108,10 @@ const BSBillingTable4 = () => {
return allowDecimal ? num.toFixed(2) : Math.round(num).toString();
}
const handleCustomerProductPriceHistory = (item) => {
setCustomerPriceHistoryOpen(true);
setCustomerProduct(item?.ProdId);
}
const getstockbadge = async () => {
let data = {
@ -2088,9 +2120,9 @@ const BSBillingTable4 = () => {
AppId: AppId,
...(AvailableDate && selectedDate
? {
fromDate: selectedDate?.[0],
toDate: selectedDate?.[1],
}
fromDate: selectedDate?.[0],
toDate: selectedDate?.[1],
}
: {}),
};
await dispatch(getSelectedFavItems(data)).unwrap();
@ -2102,9 +2134,9 @@ const BSBillingTable4 = () => {
ProdSubCat: ProdSubCat,
...(AvailableDate && selectedDate
? {
fromDate: selectedDate?.[0],
toDate: selectedDate?.[1],
}
fromDate: selectedDate?.[0],
toDate: selectedDate?.[1],
}
: {}),
};
@ -2115,9 +2147,9 @@ const BSBillingTable4 = () => {
prodCat: prodCat,
...(AvailableDate && selectedDate
? {
fromDate: selectedDate?.[0],
toDate: selectedDate?.[1],
}
fromDate: selectedDate?.[0],
toDate: selectedDate?.[1],
}
: {}),
};
@ -2343,7 +2375,7 @@ const BSBillingTable4 = () => {
OpenEditTotalAmount();
}
}}
// onClick={tableData?.length>0? OpenEditTotalAmount :""}
// onClick={tableData?.length>0? OpenEditTotalAmount :""}
>
{!isMobile ? (
<Tooltip title="Quantity">Qty</Tooltip>
@ -2447,11 +2479,10 @@ const BSBillingTable4 = () => {
{OldtableDataTakeAway?.map((item, index) => (
<tr
key={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={{
@ -2461,17 +2492,17 @@ const BSBillingTable4 = () => {
? item?.SalesId && OrderType !== 'Hold'
? 'rgb(243, 248, 213)'
: BookingType === 'Dine In' &&
triggerAnimation &&
index === 0 &&
!item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength
triggerAnimation &&
index === 0 &&
!item?.SalesId &&
tableDataTakeAway?.length >= PreviousdataLength
? 'wheat'
: BookingType !== 'Dine In' &&
triggerAnimation &&
index === 0 &&
tableDataTakeAway?.length >= PreviousdataLength &&
!HoldOrderDtl &&
!UnpaidData
triggerAnimation &&
index === 0 &&
tableDataTakeAway?.length >= PreviousdataLength &&
!HoldOrderDtl &&
!UnpaidData
? 'wheat'
: 'inherit'
: 'none',
@ -2479,9 +2510,9 @@ const BSBillingTable4 = () => {
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'
@ -2532,7 +2563,7 @@ const BSBillingTable4 = () => {
style={{ fontFamily: 'Poppins' }}
onClick={() =>
item.FullProductIdentifierDtls?.length > 0 ||
item.ProductIdentifierDtls?.length > 0
item.ProductIdentifierDtls?.length > 0
? handleImeiDetails(item)
: editField && handleEditQuantity(item)
}
@ -2593,21 +2624,21 @@ const BSBillingTable4 = () => {
{productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
) !== undefined && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{tableitem.OptionName == 'MRP' && (
@ -2674,8 +2705,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);
}
}}
>
@ -2717,11 +2751,10 @@ const BSBillingTable4 = () => {
{OldtableDataDinein?.map((item, index) => (
<tr
key={OldtableDataTakeAway?.length + index}
className={`${
item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
className={`${item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
`}
style={{
@ -2731,26 +2764,26 @@ const BSBillingTable4 = () => {
? 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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{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) &&
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
setCustomerPriceHistoryOpen={setCustomerPriceHistoryOpen}
customerProduct={customerProduct}
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
</div>
);
};

View File

@ -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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{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) &&
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
setCustomerPriceHistoryOpen={setCustomerPriceHistoryOpen}
customerProduct={customerProduct}
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
</div>
);
};

View File

@ -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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{tableitem.OptionName == 'MRP' && (
@ -2451,7 +2484,14 @@ const BSBillingTable7 = () => {
</td>
)}
{tableitem.OptionName == 'Amount' && (
<td style={{ fontFamily: 'Poppins' }}>
<td
onClick={(e) => {
e.stopPropagation();
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
style={{ fontFamily: 'Poppins' }}>
{safeRound(item?.TotalAmt)}
</td>
)}
@ -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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{tableitem.OptionName == 'MRP' && (
@ -2665,7 +2704,12 @@ const BSBillingTable7 = () => {
</td>
)}
{tableitem.OptionName == 'Amount' && (
<td style={{ fontFamily: 'Poppins' }}>
<td onClick={(e) => {
e.stopPropagation();
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}} style={{ fontFamily: 'Poppins' }}>
{safeRound(item?.TotalAmt)}
</td>
)}
@ -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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{tableitem.OptionName == 'MRP' && (
@ -2942,7 +2985,12 @@ const BSBillingTable7 = () => {
</td>
)}
{tableitem.OptionName == 'Amount' && (
<td style={{ fontFamily: 'Poppins' }}>
<td onClick={(e) => {
e.stopPropagation();
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}} style={{ fontFamily: 'Poppins' }}>
{item?.TotalAmt}
</td>
)}
@ -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 && (
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
<div
style={{
fontSize: '10px',
fontWeight: '500',
whiteSpace: 'nowrap',
}}
>
Extra Charges :{' '}
{
productBasedExtraCharges?.find(
(find) => find.ProdId === item.ProdId
)?.TotalAmt
}
</div>
)}
</td>
)}
{tableitem.OptionName == 'MRP' && (
@ -3187,7 +3234,14 @@ const BSBillingTable7 = () => {
</td>
)}
{tableitem.OptionName == 'Amount' && (
<td style={{ fontFamily: 'Poppins' }}>
<td
onClick={(e) => {
e.stopPropagation();
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
style={{ fontFamily: 'Poppins' }}>
{safeRound(item?.TotalAmt)}
</td>
)}
@ -3221,6 +3275,16 @@ const BSBillingTable7 = () => {
ProductDetail={Modaldata}
/>
)}
{(customerPriceHistoryOpen && GetCustId) &&
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
setCustomerPriceHistoryOpen={setCustomerPriceHistoryOpen}
customerProduct={customerProduct}
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
</>
);
};

View File

@ -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 = () => {
<td
key={`total-${index}`}
className="totalTd"
onClick={() => 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) &&
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
setCustomerPriceHistoryOpen={setCustomerPriceHistoryOpen}
customerProduct={customerProduct}
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
</div>
);
};

View File

@ -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) &&
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
setCustomerPriceHistoryOpen={setCustomerPriceHistoryOpen}
customerProduct={customerProduct}
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
OrderCardDetail={OrderCardDetail}
/>
}
</div>
<div className="booking-table-footer">
<StandardTablePayment />

View File

@ -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 => <div style={{ color: 'green' }}>{value}</div>,
},
{
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 (
<>
<DefaultModal
width={1000}
title="Customer Price History"
open={open}
handleCancel={handlePriceHistoryClose}
footer={false}
children={<>
<div style={{ fontFamily: 'Poppins', display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '1rem', fontSize: '14px' }}>
{selectedCustomer?.CustName && <div>
<span style={{ fontWeight: '500' }}>Customer Name: </span>{selectedCustomer?.CustName}
</div>}
{selectedCustomer?.value && <div>
<span style={{ fontWeight: '500' }}>Customer Mobile: </span>{selectedCustomer?.value}
</div>}
</div>
<Tables
columns={columns}
data={priceHistory}
dataSource={priceHistory}
ownPagination={true}
pagination={{
current: page,
onChange: handlePageChange,
defaultPageSize: 10,
showSizeChanger: false,
hideOnSinglePage: true,
}}
/>
</>}
/>
</>
)
}
export default CustomerPriceHistory

View File

@ -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 (