Added prices change short cut funtionalies

This commit is contained in:
Srinath 2026-02-09 14:15:49 +05:30
parent 58c6404699
commit ef0245d862
1 changed files with 18 additions and 43 deletions

View File

@ -225,35 +225,6 @@ const BSBillingTable7 = () => {
setPreviousdataLength(PreviousOrderLength);
}, [PreviousOrderLength]);
// useEffect(() => {
// const handleKeyDown = (event) => {
// // Ctrl + Q
// if (event.ctrlKey && event.key.toLowerCase() === 'q') {
// event.preventDefault();
// const getItem = (data = []) => {
// if (!data.length) return null;
// return BillOrderPre === 'Y' ? data[0] : data[data.length - 1];
// };
// let item = null;
// if (tableDataTakeAway?.length > 0) {
// item = getItem(tableDataTakeAway);
// } else if (tableDataDinein?.length > 0) {
// item = getItem(tableDataDinein);
// }
// if (item) {
// handleEditQuantity(item);
// }
// }
// };
// window.addEventListener('keydown', handleKeyDown);
// return () => {
// window.removeEventListener('keydown', handleKeyDown);
// };
// }, [tableDataTakeAway, tableDataDinein, BillOrderPre]);
useEffect(() => {
if (!preferenceshortcutkey) return;
const getSelectedItem = () => {
@ -279,16 +250,20 @@ const BSBillingTable7 = () => {
};
const handleKeyDown = (event) => {
if (!preferenceshortcutkey) return;
if (!event.ctrlKey) return;
const key = event.key.toLowerCase();
// 👉 ALT + P Open Edit Total Amount
if (event.altKey && key === 'p') {
event.preventDefault();
if (tableData?.length > 0) {
OpenEditTotalAmount();
}
return;
}
if (!event.ctrlKey) return;
if (key === 'q') {
event.preventDefault();
handleShortcut('qty');
}
if (key === 'e') {
event.preventDefault();
handleShortcut('price');