From 459cc3b53faf0f261251c7aa625c15b4a7fa4cc7 Mon Sep 17 00:00:00 2001 From: Srinath Date: Mon, 9 Feb 2026 14:08:53 +0530 Subject: [PATCH 01/12] Added short key component --- .../BookingScreen/Template/SalesCountComponent.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Pages/BookingScreen/Template/SalesCountComponent.jsx b/src/Pages/BookingScreen/Template/SalesCountComponent.jsx index c247949..2fa0f76 100644 --- a/src/Pages/BookingScreen/Template/SalesCountComponent.jsx +++ b/src/Pages/BookingScreen/Template/SalesCountComponent.jsx @@ -85,6 +85,13 @@ const SalesCountComponent = React.memo( type?.PreferredSubCatName?.toLowerCase() === 'take away' && type?.PreferredStatus === 'Y' ); + const preferenceshortcutkey = preferencedata?.[0]?.[ + 'SettingDtlDetails' + ]?.some( + (item) => + item.SettingIdName.toLowerCase() === 'shortcutkeys' && + item.SettingValue === 'Y' + ); const [messageType, setMessageType] = useState(null); @@ -1085,6 +1092,11 @@ const SalesCountComponent = React.memo( )} + {/* {preferenceshortcutkey && } */} + {preferenceshortcutkey && ( +
+ +
)} Date: Mon, 9 Feb 2026 14:12:14 +0530 Subject: [PATCH 02/12] Added prices change short cut funtionalies --- src/Pages/BookingScreen/Template/BSLayout7/BSCombo1.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Pages/BookingScreen/Template/BSLayout7/BSCombo1.jsx b/src/Pages/BookingScreen/Template/BSLayout7/BSCombo1.jsx index 162aa39..66e23f3 100644 --- a/src/Pages/BookingScreen/Template/BSLayout7/BSCombo1.jsx +++ b/src/Pages/BookingScreen/Template/BSLayout7/BSCombo1.jsx @@ -543,10 +543,10 @@ export default function BSCombo1() { )} - {preferenceshortcutkey && ( + {/* {preferenceshortcutkey && (
-
)} + )} */} {/* */} From f13eb99a92eafb0691a483cf83aaa4a025a2efd2 Mon Sep 17 00:00:00 2001 From: Srinath Date: Mon, 9 Feb 2026 14:12:33 +0530 Subject: [PATCH 03/12] Added prices change short cut funtionalies --- .../Components/UtillComponents/ShortcutKeyHelper.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx b/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx index 9e3eade..360ae3e 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/ShortcutKeyHelper.jsx @@ -15,6 +15,7 @@ const ShortcutKeyHelper = ({ }) => { { key: 'F4', description: 'Quick Pay' }, { key: 'Alt + W', description: 'Hold and Recall' }, { key: 'Ctrl + Q', description: 'Qty Change' }, + { key: 'Alt + P', description: 'Change Total Amount' }, { key: 'Ctrl + E', description: 'Price Change' }, { key: 'Ctrl + I', description: 'Customer Rate History' }, ]; From 9ae30c81b99bc0b0e907ba2995e58d0cc35ceb66 Mon Sep 17 00:00:00 2001 From: Srinath Date: Mon, 9 Feb 2026 14:12:59 +0530 Subject: [PATCH 04/12] Added prices change short cut funtionalies --- .../BSEditTotalAmount/BSEditTotalAmt.jsx | 185 ++++++++++++++---- 1 file changed, 142 insertions(+), 43 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSEditTotalAmount/BSEditTotalAmt.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSEditTotalAmount/BSEditTotalAmt.jsx index 049f2e9..431dab8 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSEditTotalAmount/BSEditTotalAmt.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSEditTotalAmount/BSEditTotalAmt.jsx @@ -38,6 +38,10 @@ const BSEditTotalAmt = (props) => { console.log(OverAllSales, 'OverAllEstimateOverAllEstimate'); const formRef = useRef(null); const formEstRef = useRef(null); + const salesDiscInputRef = useRef(null); + const salesMoreOptInputRef = useRef(null); + const estDiscInputRef = useRef(null); + const estMoreOptInputRef = useRef(null); const dispatch = useDispatch(); const [messageType, setMessageType] = useState(null); const [messageData, setMessageData] = useState(null); @@ -87,6 +91,29 @@ const BSEditTotalAmt = (props) => { return () => clearInterval(timer); }, [timeLeft]); + useEffect(() => { + const focusInput = (ref) => { + setTimeout(() => { + const inputElement = ref.current?.querySelector('input'); + inputElement?.focus(); + }, 100); + }; + + if (SalesData?.length > 0) { + if (MoreOpt) { + focusInput(salesMoreOptInputRef); + } else if (EditTotalAmt) { + focusInput(salesDiscInputRef); + } + } else if (EstimateData?.length > 0 && EditTotalAmt) { + if (ESTMoreOpt) { + focusInput(estMoreOptInputRef); + } else { + focusInput(estDiscInputRef); + } + } + }, [EditTotalAmt, MoreOpt, ESTMoreOpt, SalesData, EstimateData]); + const handleOtpChange = (index, value) => { // Allow empty value for clearing if (value === '' || value.match(/^[0-9]$/)) { @@ -201,6 +228,10 @@ const BSEditTotalAmt = (props) => { setMessageData('Please Give less than value for sell price'); setESTSellingPrice(0); formEstRef?.current?.resetFields(); + setTimeout(() => { + const inputElement = estDiscInputRef.current?.querySelector('input'); + inputElement?.focus(); + }, 100); } else { setESTSellingPrice(inputValue); // Check if entered amount is 0 or equals total amount @@ -214,6 +245,13 @@ const BSEditTotalAmt = (props) => { handleOk(); } }; + + const handleEstKeyDown = (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + SetTotalDiscount(); + } + }; const SalesChangefun = (e) => { const inputValue = e.target.value.trim(); console.log(e, e.target.value, 'SalesChangefun'); @@ -223,6 +261,10 @@ const BSEditTotalAmt = (props) => { setMessageData('Please Give less than value for sell price'); setSellingPrice(0); formRef?.current?.resetFields(); + setTimeout(() => { + const inputElement = salesDiscInputRef.current?.querySelector('input'); + inputElement?.focus(); + }, 100); } else { setSellingPrice(inputValue); // SalesTotalAmount() @@ -232,6 +274,13 @@ const BSEditTotalAmt = (props) => { // setSalesDiscAmount(0) } }; + + const handleSalesKeyDown = (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + SetTotalDiscount(); + } + }; const orderscolumns = [ { title: 'Sl.No', @@ -347,6 +396,10 @@ const BSEditTotalAmt = (props) => { setSalesDiscAmount(0); // setFinalTotalAmt() formRef.current?.resetFields(); + setTimeout(() => { + const inputElement = salesMoreOptInputRef.current?.querySelector('input'); + inputElement?.focus(); + }, 100); }; const onEstPercentageSelectionChange = (data) => { setESTPercentageSelection(data); @@ -354,6 +407,10 @@ const BSEditTotalAmt = (props) => { setEstDiscAmount(0); // setFinalTotalAmt() formEstRef.current?.resetFields(); + setTimeout(() => { + const inputElement = estMoreOptInputRef.current?.querySelector('input'); + inputElement?.focus(); + }, 100); }; const PriceChangefun = (data) => { @@ -375,6 +432,10 @@ const BSEditTotalAmt = (props) => { setSalesDiscAmount(0); // setNewPrice1(0) formRef.current?.resetFields(); + setTimeout(() => { + const inputElement = salesMoreOptInputRef.current?.querySelector('input'); + inputElement?.focus(); + }, 100); } } else { // Percentage mode @@ -391,6 +452,10 @@ const BSEditTotalAmt = (props) => { setMessageData('Please Give less than or equal to 100'); setSalesDiscAmount(0); formRef.current?.resetFields(); + setTimeout(() => { + const inputElement = salesMoreOptInputRef.current?.querySelector('input'); + inputElement?.focus(); + }, 100); } } } else { @@ -400,6 +465,13 @@ const BSEditTotalAmt = (props) => { } }; + const handlePriceKeyDown = (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + SetTotalDiscount(); + } + }; + const PriceChangefunEst = (data) => { console.log(data?.target.value, PercentageSelection, 'datadata'); if (data?.target.value) { @@ -418,6 +490,10 @@ const BSEditTotalAmt = (props) => { setMessageData('Please Give less than value for sell price'); setEstDiscAmount(0); formEstRef.current?.resetFields(); + setTimeout(() => { + const inputElement = estMoreOptInputRef.current?.querySelector('input'); + inputElement?.focus(); + }, 100); } } else { // Percentage mode @@ -434,6 +510,10 @@ const BSEditTotalAmt = (props) => { setMessageData('Please Give less than or equal to 100'); setEstDiscAmount(0); formEstRef.current?.resetFields(); + setTimeout(() => { + const inputElement = estMoreOptInputRef.current?.querySelector('input'); + inputElement?.focus(); + }, 100); } } } else { @@ -444,6 +524,13 @@ const BSEditTotalAmt = (props) => { } }; + const handlePriceEstKeyDown = (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + SetTotalDiscount(); + } + }; + const moreOptions = () => { setMoreOpt((prev) => !prev); setSalesDiscAmount(0); @@ -535,15 +622,18 @@ const BSEditTotalAmt = (props) => { }, ]} > - SalesChangefun(e)} - maxLength={8} - /> +
+ SalesChangefun(e)} + onKeyDown={(e) => handleSalesKeyDown(e)} + maxLength={8} + /> +
{' '} @@ -593,18 +683,21 @@ const BSEditTotalAmt = (props) => { }, ]} > - PriceChangefun(e)} - // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} - /> +
+ PriceChangefun(e)} + onKeyDown={(e) => handlePriceKeyDown(e)} + // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} + /> +
{/* PriceChangefun(e)} @@ -684,16 +777,19 @@ const BSEditTotalAmt = (props) => { }, ]} > - EstChangefun(e)} - maxLength={8} - /> +
+ EstChangefun(e)} + onKeyDown={(e) => handleEstKeyDown(e)} + maxLength={8} + /> +
@@ -742,18 +838,21 @@ const BSEditTotalAmt = (props) => { }, ]} > - PriceChangefunEst(e)} - // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} - /> +
+ PriceChangefunEst(e)} + onKeyDown={(e) => handlePriceEstKeyDown(e)} + // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} + /> +
{/* PriceChangefun(e)} From 54d90ffa8ee169e98f2b268af3fbc1449fb7c92f Mon Sep 17 00:00:00 2001 From: Srinath Date: Mon, 9 Feb 2026 14:13:40 +0530 Subject: [PATCH 05/12] Added prices change short cut funtionalies --- .../StandardTable/StandardTable.jsx | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx index 8136112..4708782 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/StandardTable/StandardTable.jsx @@ -262,22 +262,29 @@ const StandardTable = () => { handleEditQuantity(item); setshortKeyMethod(method); }; - - const handleKeyDown = (event) => { - if (!event.ctrlKey) return; - - const key = event.key.toLowerCase(); - - if (key === 'q') { - event.preventDefault(); - handleShortcut('qty'); + const handleKeyDown = (event) => { + const key = event.key.toLowerCase(); + // 👉 ALT + P → Open Edit Total Amount + if (event.altKey && key === 'p') { + event.preventDefault(); + if (OrderCardDetail?.length > 0) { + OpenEditTotalAmount(); } + return; + } + // 👉 CTRL shortcuts + if (!event.ctrlKey) return; - if (key === 'e') { - event.preventDefault(); - handleShortcut('price'); - } - }; + if (key === 'q') { + event.preventDefault(); + handleShortcut('qty'); + } + + if (key === 'e') { + event.preventDefault(); + handleShortcut('price'); + } + }; window.addEventListener('keydown', handleKeyDown); From 735ad35c450592e4a86354c0342aab81c1c046a0 Mon Sep 17 00:00:00 2001 From: Srinath Date: Mon, 9 Feb 2026 14:14:03 +0530 Subject: [PATCH 06/12] Added prices change short cut funtionalies --- .../BSBillingTable1/BSBillingTable1.jsx | 47 ++++++++++++++----- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx index bb0030b..1622ded 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable1/BSBillingTable1.jsx @@ -274,21 +274,44 @@ const BSBillingTable1 = () => { setshortKeyMethod(method); }; + // const handleKeyDown = (event) => { + // if (!event.ctrlKey) return; + + // const key = event.key.toLowerCase(); + + // if (key === 'q') { + // event.preventDefault(); + // handleShortcut('qty'); + // } + + // if (key === 'e') { + // event.preventDefault(); + // handleShortcut('price'); + // } + // }; const handleKeyDown = (event) => { - if (!event.ctrlKey) return; - - const key = event.key.toLowerCase(); - - if (key === 'q') { - event.preventDefault(); - handleShortcut('qty'); + const key = event.key.toLowerCase(); + // 👉 ALT + P → Open Edit Total Amount + if (event.altKey && key === 'p') { + event.preventDefault(); + if (tableData?.length > 0) { + OpenEditTotalAmount(); } + return; + } + // 👉 CTRL shortcuts + if (!event.ctrlKey) return; - if (key === 'e') { - event.preventDefault(); - handleShortcut('price'); - } - }; + if (key === 'q') { + event.preventDefault(); + handleShortcut('qty'); + } + + if (key === 'e') { + event.preventDefault(); + handleShortcut('price'); + } + }; window.addEventListener('keydown', handleKeyDown); return () => { From b02e2e84f35fd5caf511835c0a68cc72ce8c8545 Mon Sep 17 00:00:00 2001 From: Srinath Date: Mon, 9 Feb 2026 14:14:26 +0530 Subject: [PATCH 07/12] Added prices change short cut funtionalies --- .../BSBillingTable3/BSBillingTable3.jsx | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx index 0e4f8df..298f997 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable3/BSBillingTable3.jsx @@ -228,22 +228,29 @@ const BSBillingTable3 = () => { handleEditQuantity(item); setshortKeyMethod(method); }; - - const handleKeyDown = (event) => { - if (!event.ctrlKey) return; - - const key = event.key.toLowerCase(); - - if (key === 'q') { - event.preventDefault(); - handleShortcut('qty'); + const handleKeyDown = (event) => { + const key = event.key.toLowerCase(); + // 👉 ALT + P → Open Edit Total Amount + if (event.altKey && key === 'p') { + event.preventDefault(); + if (tableData?.length > 0) { + OpenEditTotalAmount(); } + return; + } + // 👉 CTRL shortcuts + if (!event.ctrlKey) return; - if (key === 'e') { - event.preventDefault(); - handleShortcut('price'); - } - }; + if (key === 'q') { + event.preventDefault(); + handleShortcut('qty'); + } + + if (key === 'e') { + event.preventDefault(); + handleShortcut('price'); + } + }; window.addEventListener('keydown', handleKeyDown); return () => { From 7b61ca2da7fc801ddf9fcedb62a34aba847bf481 Mon Sep 17 00:00:00 2001 From: Srinath Date: Mon, 9 Feb 2026 14:14:41 +0530 Subject: [PATCH 08/12] Added prices change short cut funtionalies --- .../BSBillingTable4/BSBillingTable4.jsx | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.jsx index 29fb64e..c0665f2 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable4/BSBillingTable4.jsx @@ -281,22 +281,29 @@ const BSBillingTable4 = () => { setshortKeyMethod(method); }; - const handleKeyDown = (event) => { - if (!preferenceshortcutkey) return; - if (!event.ctrlKey) return; - - const key = event.key.toLowerCase(); - - if (key === 'q') { - event.preventDefault(); - handleShortcut('qty'); + const handleKeyDown = (event) => { + const key = event.key.toLowerCase(); + // 👉 ALT + P → Open Edit Total Amount + if (event.altKey && key === 'p') { + event.preventDefault(); + if (tableData?.length > 0) { + OpenEditTotalAmount(); } + return; + } + // 👉 CTRL shortcuts + if (!event.ctrlKey) return; - if (key === 'e') { - event.preventDefault(); - handleShortcut('price'); - } - }; + if (key === 'q') { + event.preventDefault(); + handleShortcut('qty'); + } + + if (key === 'e') { + event.preventDefault(); + handleShortcut('price'); + } + }; window.addEventListener('keydown', handleKeyDown); From 7421780920102799a042439d88ce7f9c0892f925 Mon Sep 17 00:00:00 2001 From: Srinath Date: Mon, 9 Feb 2026 14:14:57 +0530 Subject: [PATCH 09/12] Added prices change short cut funtionalies --- .../BSBillingTable5/BsBill.jsx | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BsBill.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BsBill.jsx index 1320efe..a6a4784 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BsBill.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable5/BsBill.jsx @@ -1927,22 +1927,29 @@ const BsBill = () => { setshortKeyMethod(method); }; - const handleKeyDown = (event) => { - if (!preferenceshortcutkey) return; - if (!event.ctrlKey) return; - - const key = event.key.toLowerCase(); - - if (key === 'q') { - event.preventDefault(); - handleShortcut('qty'); + const handleKeyDown = (event) => { + const key = event.key.toLowerCase(); + // 👉 ALT + P → Open Edit Total Amount + if (event.altKey && key === 'p') { + event.preventDefault(); + if (TableData?.length > 0) { + OpenEditTotalAmount(); } + return; + } + // 👉 CTRL shortcuts + if (!event.ctrlKey) return; - if (key === 'e') { - event.preventDefault(); - handleShortcut('price'); - } - }; + if (key === 'q') { + event.preventDefault(); + handleShortcut('qty'); + } + + if (key === 'e') { + event.preventDefault(); + handleShortcut('price'); + } + }; window.addEventListener('keydown', handleKeyDown); return () => { From 58c6404699ad824781482bb0090d2c75c403a964 Mon Sep 17 00:00:00 2001 From: Srinath Date: Mon, 9 Feb 2026 14:15:28 +0530 Subject: [PATCH 10/12] Added prices change short cut funtionalies --- .../BSBillingTable6/BSBillingTable6.jsx | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.jsx index 442f9aa..f6263dd 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable6/BSBillingTable6.jsx @@ -255,24 +255,29 @@ const BSBillingTable6 = () => { setshortKeyMethod(method); }; - const handleKeyDown = (event) => { - - if (!preferenceshortcutkey) return - if (!event.ctrlKey) return; - - const key = event.key.toLowerCase(); - - if (key === 'q') { - event.preventDefault(); - handleShortcut('qty'); + const handleKeyDown = (event) => { + const key = event.key.toLowerCase(); + // 👉 ALT + P → Open Edit Total Amount + if (event.altKey && key === 'p') { + event.preventDefault(); + if (tableData?.length > 0) { + OpenEditTotalAmount(); } + return; + } + // 👉 CTRL shortcuts + if (!event.ctrlKey) return; - if (key === 'e') { - event.preventDefault(); - handleShortcut('price'); - } - }; + if (key === 'q') { + event.preventDefault(); + handleShortcut('qty'); + } + if (key === 'e') { + event.preventDefault(); + handleShortcut('price'); + } + }; window.addEventListener('keydown', handleKeyDown); return () => { From ef0245d86232d7e2da636a7791854cb7f5310186 Mon Sep 17 00:00:00 2001 From: Srinath Date: Mon, 9 Feb 2026 14:15:49 +0530 Subject: [PATCH 11/12] Added prices change short cut funtionalies --- .../BSBillingTable7/BSBillingTable7.jsx | 61 ++++++------------- 1 file changed, 18 insertions(+), 43 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.jsx index 0cbda12..e1fd535 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/BSBillingTable7/BSBillingTable7.jsx @@ -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,21 +250,25 @@ const BSBillingTable7 = () => { }; const handleKeyDown = (event) => { - if (!preferenceshortcutkey) return; - if (!event.ctrlKey) return; - - const key = event.key.toLowerCase(); - - if (key === 'q') { - event.preventDefault(); - handleShortcut('qty'); + const key = event.key.toLowerCase(); + // 👉 ALT + P → Open Edit Total Amount + if (event.altKey && key === 'p') { + event.preventDefault(); + if (tableData?.length > 0) { + OpenEditTotalAmount(); } - - if (key === 'e') { - event.preventDefault(); - handleShortcut('price'); - } - }; + return; + } + if (!event.ctrlKey) return; + if (key === 'q') { + event.preventDefault(); + handleShortcut('qty'); + } + if (key === 'e') { + event.preventDefault(); + handleShortcut('price'); + } + }; window.addEventListener('keydown', handleKeyDown); return () => { From 231b6ba523e0852de490dff84e7fde8d4f43881f Mon Sep 17 00:00:00 2001 From: Srinath Date: Mon, 9 Feb 2026 14:16:08 +0530 Subject: [PATCH 12/12] Added prices change short cut funtionalies --- .../ComboSalesBillTable.jsx | 155 ++++++++++-------- 1 file changed, 91 insertions(+), 64 deletions(-) diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx index 91e2bff..e7530b9 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/ComboSalesBillTable/ComboSalesBillTable.jsx @@ -148,13 +148,13 @@ const ComboSalesBillTable = () => { 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 OldtableDataTakeAway = OrderType != 'Hold' ? tableData?.filter( - (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId - ) + (a, b) => a.BookingTypeName === 'TakeAway' && a?.SalesId + ) : []; const [EditQuantity, setEditQuantity] = useState(false); @@ -249,27 +249,54 @@ const ComboSalesBillTable = () => { // ); // setBillOrderPre(BillOrder?.SettingValue); // }, [preferenceDatas]); - useEffect(() => { + const getSelectedItem = () => { + const getItem = (data = []) => { + if (!data.length) return null; + return BillOrderPre === 'Y' ? data[0] : data[data.length - 1]; + }; + + if (tableDataTakeAway?.length > 0) { + return getItem(tableDataTakeAway); + } else if (tableDataDinein?.length > 0) { + return getItem(tableDataDinein); + } + return null; + }; + + const handleShortcut = (method) => { + const item = getSelectedItem(); + if (!item) return; + + handleEditQuantity(item); + setshortKeyMethod(method); + }; + const handleKeyDown = (event) => { - if (event.ctrlKey && event.key.toLowerCase() === 'q') { + const key = event.key.toLowerCase(); + // 👉 ALT + P → Open Edit Total Amount + if (event.altKey && key === 'p') { 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); + if (tableData?.length > 0) { + OpenEditTotalAmount(); } + return; + } + // 👉 CTRL shortcuts + if (!event.ctrlKey) return; + + if (key === 'q') { + event.preventDefault(); + handleShortcut('qty'); + } + + if (key === 'e') { + event.preventDefault(); + handleShortcut('price'); } }; window.addEventListener('keydown', handleKeyDown); + return () => { window.removeEventListener('keydown', handleKeyDown); }; @@ -1122,9 +1149,9 @@ const ComboSalesBillTable = () => { )?.map((item, idx) => idx === 0 ? { - ...item, - FreeQty, - } + ...item, + FreeQty, + } : item ), }; @@ -2246,20 +2273,20 @@ const ComboSalesBillTable = () => { 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: row?.SalesId ? 'rgb(243, 248, 213)' : GlobEstBooking === 'ParEst' && - GlobProdwisedata?.includes( - row?.InwardDtlId + ' ' + row?.BookingTypeName - ) + GlobProdwisedata?.includes( + row?.InwardDtlId + ' ' + row?.BookingTypeName + ) ? '#b2d1f7' : (OldtableDataTakeAway?.length + index) % 2 === 0 ? 'white' @@ -2294,37 +2321,37 @@ const ComboSalesBillTable = () => { {/* Product Name / Item */} {(item.OptionName === 'Item' || item.OptionName === 'Product Name') && ( - - row.FullProductIdentifierDtls?.length > 0 || - row.ProductIdentifierDtls?.length > 0 - ? handleImeiDetails(row) - : editField && handleEditQuantity(row) - } - > - {row?.Type !== 'OS' ? row.ProdName : row.ServiceName} - {row?.BrandName ? ` ${row.BrandName}` : ''} - {row?.Type !== 'C' && ( -

- {/* {row?.ProdVariantName} {row?.Size} {row?.UomName} */} - ( - {!row?.ProdVariantName?.toLowerCase()?.includes( - 'variant' - ) && {row?.ProdVariantName} } - {row?.Size} - {row?.SinglePc == 'Y' ? 'PCS' : row?.UomName}) -

- )} - {row?.Type === 'C' && - row.ProdDetail?.map((prod, idx) => ( -

- {prod.ProdName} - {prod.Size} {prod.UomName} + + row.FullProductIdentifierDtls?.length > 0 || + row.ProductIdentifierDtls?.length > 0 + ? handleImeiDetails(row) + : editField && handleEditQuantity(row) + } + > + {row?.Type !== 'OS' ? row.ProdName : row.ServiceName} + {row?.BrandName ? ` ${row.BrandName}` : ''} + {row?.Type !== 'C' && ( +

+ {/* {row?.ProdVariantName} {row?.Size} {row?.UomName} */} + ( + {!row?.ProdVariantName?.toLowerCase()?.includes( + 'variant' + ) && {row?.ProdVariantName} } + {row?.Size} + {row?.SinglePc == 'Y' ? 'PCS' : row?.UomName})

- ))} - - )} + )} + {row?.Type === 'C' && + row.ProdDetail?.map((prod, idx) => ( +

+ {prod.ProdName} - {prod.Size} {prod.UomName} +

+ ))} + + )} {/* Barcode */} {item.OptionName === 'Barcode' && ( @@ -2351,7 +2378,7 @@ const ComboSalesBillTable = () => { onClick={() => editField && handleEditQuantityCombo(row) } - // onClick={() => handleEditQTYcombo()} + // onClick={() => handleEditQTYcombo()} > {(!EditQtyCombo || row?.localId !== Index) && ( <>{row.OrderQty} @@ -2367,7 +2394,7 @@ const ComboSalesBillTable = () => { Index={Index} setIndex={setIndex} setEditQtyCombo={setEditQtyCombo} - // id={`qty-${index}`} + // id={`qty-${index}`} /> )} @@ -2414,9 +2441,9 @@ const ComboSalesBillTable = () => { > {row?.Offer > 0 ? `${( - (row.Offer / (row?.OrderQty * row?.OrderRate)) * - 100 - ).toFixed(2)}%` + (row.Offer / (row?.OrderQty * row?.OrderRate)) * + 100 + ).toFixed(2)}%` : '-'} )}