customer price history modal added

This commit is contained in:
unknown 2026-02-05 15:53:37 +05:30
parent ea144ce81b
commit 1ef3aa23b4
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
@ -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 = {
@ -2324,8 +2357,7 @@ const BSBillingTable1 = () => {
{OldtableDataTakeAway?.map((item, index) => (
<tr
key={index}
className={`${
item?.SalesId && OrderType !== 'Hold'
className={`${item?.SalesId && OrderType !== 'Hold'
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
@ -2562,8 +2594,11 @@ const BSBillingTable1 = () => {
textAlign: 'right',
}}
onClick={() => {
if (editField) {
handleEditQuantity(item);
// if (editField) {
// handleEditQuantity(item);
// }
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
@ -2608,8 +2643,7 @@ const BSBillingTable1 = () => {
{OldtableDataDinein?.map((item, index) => (
<tr
key={OldtableDataTakeAway?.length + index}
className={`${
item?.SalesId
className={`${item?.SalesId
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
@ -2846,8 +2880,11 @@ const BSBillingTable1 = () => {
textAlign: 'right',
}}
onClick={() => {
if (editField) {
handleEditQuantity(item);
// if (editField) {
// handleEditQuantity(item);
// }
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
@ -2897,8 +2934,7 @@ const BSBillingTable1 = () => {
OldtableDataTakeAway?.length +
index
}
className={`${
BookingType === 'Dine In' && item?.SalesId
className={`${BookingType === 'Dine In' && item?.SalesId
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
@ -3179,8 +3215,11 @@ const BSBillingTable1 = () => {
textAlign: 'right',
}}
onClick={() => {
if (editField) {
handleEditQuantity(item);
// if (editField) {
// handleEditQuantity(item);
// }
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
@ -3231,8 +3270,7 @@ const BSBillingTable1 = () => {
tableDataTakeAway?.length +
index
}
className={`${
BookingType === 'Dine In' && item?.SalesId
className={`${BookingType === 'Dine In' && item?.SalesId
? 'Billing-Table1-row-disabled'
: 'Billing-Table1-row'
}
@ -3495,8 +3533,11 @@ const BSBillingTable1 = () => {
textAlign: 'right',
}}
onClick={() => {
if (editField) {
handleEditQuantity(item);
// if (editField) {
// handleEditQuantity(item);
// }
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
@ -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

@ -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'
@ -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) =>
@ -1376,6 +1409,12 @@ const BsBill2 = () => {
<p
className="sum-item-amt"
style={{ fontFamily: SelectedFont }}
onClick={(e) => {
e.stopPropagation();
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
<span style={{ color: '#FF4D4F', marginRight: '0.5rem' }}>
-{' '}
@ -1593,6 +1632,12 @@ const BsBill2 = () => {
<p
className="sum-item-amt"
style={{ fontFamily: SelectedFont }}
onClick={(e) => {
e.stopPropagation();
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
<span style={{ color: '#FF4D4F', marginRight: '0.5rem' }}>
-{' '}
@ -1842,6 +1887,12 @@ const BsBill2 = () => {
<p
className="sum-item-amt"
style={{ fontFamily: SelectedFont }}
onClick={(e) => {
e.stopPropagation();
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
<span style={{ color: '#FF4D4F', marginRight: '0.5rem' }}>
{item?.OfferPrice > 0 ||
@ -2100,6 +2151,12 @@ const BsBill2 = () => {
<p
className="sum-item-amt"
style={{ fontFamily: SelectedFont }}
onClick={(e) => {
e.stopPropagation();
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
<span style={{ color: '#FF4D4F', marginRight: '0.5rem' }}>
-{' '}
@ -2163,6 +2220,16 @@ const BsBill2 = () => {
ProductDetail={Modaldata}
/>
)}
{(customerPriceHistoryOpen && GetCustId) &&
<CustomerPriceHistory
open={customerPriceHistoryOpen}
custId={GetCustId}
setCustomerPriceHistoryOpen={setCustomerPriceHistoryOpen}
customerProduct={customerProduct}
setCustomerProduct={setCustomerProduct}
selectedCustomer={selectedCustomer}
/>
}
</div>
</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(
@ -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';
@ -2321,8 +2355,7 @@ const BSBillingTable3 = () => {
{OldtableDataTakeAway?.map((item, index) => (
<tr
key={index}
className={`${
item?.SalesId && OrderType !== 'Hold'
className={`${item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -2554,8 +2587,11 @@ const BSBillingTable3 = () => {
className="Table3-item-price"
style={{ width: '60px', fontFamily: 'Poppins' }}
onClick={() => {
if (editField) {
handleEditQuantity(item);
// if (editField) {
// handleEditQuantity(item);
// }
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
@ -2597,8 +2633,7 @@ const BSBillingTable3 = () => {
{OldtableDataDinein?.map((item, index) => (
<tr
key={OldtableDataTakeAway?.length + index}
className={`${
item?.SalesId
className={`${item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -2829,8 +2864,11 @@ const BSBillingTable3 = () => {
className="Table3-item-price"
style={{ width: '60px', fontFamily: 'Poppins' }}
onClick={() => {
if (editField) {
handleEditQuantity(item);
// if (editField) {
// handleEditQuantity(item);
// }
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
@ -2877,8 +2915,7 @@ const BSBillingTable3 = () => {
OldtableDataTakeAway?.length +
index
}
className={`${
BookingType === 'Dine In' && item?.SalesId
className={`${BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -3152,8 +3189,11 @@ 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);
}
}}
>
@ -3200,8 +3240,7 @@ const BSBillingTable3 = () => {
tableDataTakeAway?.length +
index
}
className={`${
BookingType === 'Dine In' && item?.SalesId
className={`${BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -3459,8 +3498,11 @@ const BSBillingTable3 = () => {
className="Table3-item-price"
style={{ width: '60px', fontFamily: 'Poppins' }}
onClick={() => {
if (editField) {
handleEditQuantity(item);
// if (editField) {
// handleEditQuantity(item);
// }
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
@ -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);
@ -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());
@ -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 = {
@ -2447,8 +2479,7 @@ const BSBillingTable4 = () => {
{OldtableDataTakeAway?.map((item, index) => (
<tr
key={index}
className={`${
item?.SalesId && OrderType !== 'Hold'
className={`${item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -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,8 +2751,7 @@ const BSBillingTable4 = () => {
{OldtableDataDinein?.map((item, index) => (
<tr
key={OldtableDataTakeAway?.length + index}
className={`${
item?.SalesId
className={`${item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -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,8 +3025,7 @@ const BSBillingTable4 = () => {
OldtableDataTakeAway?.length +
index
}
className={`${
BookingType === 'Dine In' && item?.SalesId
className={`${BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -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,8 +3344,7 @@ const BSBillingTable4 = () => {
OldtableDataTakeAway?.length +
index
}
className={`${
item?.SalesId && OrderType !== 'Hold'
className={`${item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table3-content-Disabled'
: 'BSBill-Table3-content'
}
@ -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 {
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);
@ -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());
@ -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(
@ -3469,8 +3501,11 @@ const BsBill = () => {
borderBottom: '1.9px dashed #000',
}}
onClick={() => {
if (editField) {
handleEditQuantity(item);
// if (editField) {
// handleEditQuantity(item);
// }
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
@ -3783,8 +3818,11 @@ const BsBill = () => {
borderBottom: '1.9px dashed #000',
}}
onClick={() => {
if (editField) {
handleEditQuantity(item);
// if (editField) {
// handleEditQuantity(item);
// }
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
@ -4147,8 +4185,11 @@ const BsBill = () => {
borderBottom: '1.9px dashed #000',
}}
onClick={() => {
if (editField) {
handleEditQuantity(item);
// if (editField) {
// handleEditQuantity(item);
// }
if (GetCustId) {
handleCustomerProductPriceHistory(item);
}
}}
>
@ -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) &&
<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);
@ -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());
@ -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);
};
@ -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);
}
}}
>
@ -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);
}
}}
>
@ -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);
}
}}
>
@ -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('');
@ -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());
@ -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('');
@ -2300,12 +2334,11 @@ const BSBillingTable7 = () => {
? () => handleEditQuantity(item)
: editdelete === 'Delete'
? () => removeFromCart(item)
: () => {}
: () => { }
}
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${
item?.SalesId && OrderType !== 'Hold'
className={`${item?.SalesId && OrderType !== 'Hold'
? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content'
}
@ -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>
)}
@ -2518,12 +2558,11 @@ const BSBillingTable7 = () => {
? () => handleEditQuantity(item)
: editdelete === 'Delete'
? () => removeFromCart(item)
: () => {}
: () => { }
}
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${
item?.SalesId
className={`${item?.SalesId
? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content'
}
@ -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>
)}
@ -2774,12 +2818,11 @@ const BSBillingTable7 = () => {
: ''
: editdelete === 'Delete'
? () => removeFromCart(item)
: () => {}
: () => { }
}
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${
BookingType === 'Dine In' && item?.SalesId
className={`${BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content'
}
@ -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>
)}
@ -3036,12 +3084,11 @@ const BSBillingTable7 = () => {
? () => handleEditQuantity(item)
: editdelete === 'Delete'
? () => removeFromCart(item)
: () => {}
: () => { }
}
// onClick={editdelete === "Edit" ? () => handleEditQuantity(item) : editdelete === "Delete" ? () => removeFromCart(item) : ""}
className={`${
BookingType === 'Dine In' && item?.SalesId
className={`${BookingType === 'Dine In' && item?.SalesId
? 'BSBill-Table7-content-disabled'
: 'BSBill-Table7-content'
}
@ -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 (