diff --git a/src/Pages/BookingScreen/Components/BSBillingTables/ComboBillTableEdit/ComboEditQtyAndRate.jsx b/src/Pages/BookingScreen/Components/BSBillingTables/ComboBillTableEdit/ComboEditQtyAndRate.jsx index 243f7f4..532e812 100644 --- a/src/Pages/BookingScreen/Components/BSBillingTables/ComboBillTableEdit/ComboEditQtyAndRate.jsx +++ b/src/Pages/BookingScreen/Components/BSBillingTables/ComboBillTableEdit/ComboEditQtyAndRate.jsx @@ -36,8 +36,10 @@ const ComboEditQtyAndRate = (props) => { const formRef = useRef(null); const quantityInputRef = useRef(null); const priceChangeInputRef = useRef(null); + const modalRef = useRef(null); const { setIndex = () => {}, setEditQtyCombo = () => {}, setEditRateCombo = () => {} } = props; + const [disableSubmitButton, setDisableSubmitButton] = useState(false); const SessionData = useSelector(StoredSessionData); // const AppId = SessionData?.AppId; @@ -139,14 +141,21 @@ const ComboEditQtyAndRate = (props) => { }, [RadioBtnSelection, props.BSBillingEditQuantity, props.BSBillingEditRate]); useEffect(() => { - const handleKeyDown = (event) => { - if (preferenceshortcutkey && event.shiftKey && event.key === 'E') { - event.preventDefault(); - if (PriceChangeaccess && props.Productdata?.Offer <= 0) { - onRadioBtnChange('Price'); - } - } - }; +const handleKeyDown = (event) => { + const navigationKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']; + if (event.key === 'Escape' || navigationKeys.includes(event.key)) { + event.preventDefault(); + if (props.BSBillingEditQuantity) { + props.handleEditQuantityCancel?.(); + setEditQtyCombo(false); + } + if (props.BSBillingEditRate) { + props.handleEditRateComboCancel?.(); + setEditRateCombo(false); + } + return; + } +}; if (EditOpen) { document.addEventListener('keydown', handleKeyDown); @@ -160,8 +169,12 @@ const ComboEditQtyAndRate = (props) => { preferenceshortcutkey, PriceChangeaccess, props.Productdata?.Offer, + props.BSBillingEditQuantity, + props.BSBillingEditRate, ]); + + useEffect(() => { const BillOrder = SettingDataSelector?.[0]?.SettingDtlDetails?.find( (item) => item.SettingIdName === 'BillItemsOrder' @@ -3203,6 +3216,7 @@ const ComboEditQtyAndRate = (props) => { ref={quantityInputRef} type="number" value={Quantity} + min="0" onChange={(e) => setQuantity(e.target.value)} onBlur={() => { if (Quantity && Quantity.trim() !== '') {