Added qty edit click funtions

This commit is contained in:
Srinath 2026-02-16 18:35:38 +05:30
parent a2bdb67940
commit 167b3196db
1 changed files with 22 additions and 8 deletions

View File

@ -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() !== '') {