Merge pull request 'Focus Clear In edit QTY and Serial Number' (#228) from OptimUpdate into main
Reviewed-on: Pozomind/pozo-retail-app#228
This commit is contained in:
commit
875da2dcfd
|
|
@ -12,6 +12,9 @@ import {
|
|||
GlobalReorderProductDetails,
|
||||
PreferenceData,
|
||||
getConfigType,
|
||||
changefocusStatusCust,
|
||||
changeCombofocus,
|
||||
GlobalfocusStatusCust,
|
||||
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
|
||||
import { ArrowRightOutlined } from '@ant-design/icons';
|
||||
import { Messages } from '../../../../../Components/Notifications/Messages';
|
||||
|
|
@ -66,13 +69,24 @@ const BSBillingEditQuantity = (props) => {
|
|||
shallowEqual
|
||||
);
|
||||
|
||||
const overAllLimitPreferenece =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y');
|
||||
const itemWiseLimitPreferenece =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y');
|
||||
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null;
|
||||
const overAllLimitPreferenece = preferenceDatas?.[0]?.[
|
||||
'SettingDtlDetails'
|
||||
]?.find(
|
||||
(item) =>
|
||||
item.SettingIdName?.toLowerCase() === 'overalllimit' &&
|
||||
item?.SettingValue === 'Y'
|
||||
);
|
||||
const itemWiseLimitPreferenece = preferenceDatas?.[0]?.[
|
||||
'SettingDtlDetails'
|
||||
]?.find(
|
||||
(item) =>
|
||||
item.SettingIdName?.toLowerCase() === 'itemwiselimit' &&
|
||||
item?.SettingValue === 'Y'
|
||||
);
|
||||
const maxQtyLimit =
|
||||
itemWiseLimitPreferenece?.SettingCount ||
|
||||
overAllLimitPreferenece?.SettingCount ||
|
||||
null;
|
||||
const preferenceOffer =
|
||||
preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
|
||||
(item) => item.SettingIdName === 'Offer'
|
||||
|
|
@ -86,7 +100,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
);
|
||||
console.log(preferenceshortcutkey, 'preferenceshortcutkey');
|
||||
const [PriceChangeaccess, setPriceChangeaccess] = useState(true);
|
||||
|
||||
const selectStatuscust = useSelector(GlobalfocusStatusCust);
|
||||
const [ConfigDataList, setConfigDataList] = useState([]);
|
||||
const [messageType, setMessageType] = useState(null);
|
||||
const [messageData, setMessageData] = useState(null);
|
||||
|
|
@ -115,7 +129,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
price: 'Price',
|
||||
quantity: 'qty',
|
||||
Parcel: 'Parcel',
|
||||
weightAmount: 'weightAmount'
|
||||
weightAmount: 'weightAmount',
|
||||
};
|
||||
const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
|
||||
if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
|
||||
|
|
@ -343,7 +357,6 @@ const BSBillingEditQuantity = (props) => {
|
|||
};
|
||||
|
||||
const calculateOverAllQty = (item, filterItems) => {
|
||||
|
||||
if (!item) return 0;
|
||||
|
||||
const totalUsedQty =
|
||||
|
|
@ -446,11 +459,18 @@ const BSBillingEditQuantity = (props) => {
|
|||
);
|
||||
const editedProduct = CartOrderDetails[editedProductIndex];
|
||||
|
||||
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) {
|
||||
if (
|
||||
(overAllLimitPreferenece || itemWiseLimitPreferenece) &&
|
||||
maxQtyLimit
|
||||
) {
|
||||
if (overAllLimitPreferenece) {
|
||||
const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex));
|
||||
if ((calculatedOverAllQty + editedQty) > maxQtyLimit) {
|
||||
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`);
|
||||
const calculatedOverAllQty = calculateOverAllQtyLimit(
|
||||
CartOrderDetails?.filter((_, index) => index !== editedProductIndex)
|
||||
);
|
||||
if (calculatedOverAllQty + editedQty > maxQtyLimit) {
|
||||
setMessageData(
|
||||
`Overall Quantity Limit Exceeds than ${maxQtyLimit}`
|
||||
);
|
||||
setMessageType('warning');
|
||||
return;
|
||||
}
|
||||
|
|
@ -722,7 +742,8 @@ const BSBillingEditQuantity = (props) => {
|
|||
newPrice,
|
||||
overrideQty = null
|
||||
) => {
|
||||
const editedQty = overrideQty !== null
|
||||
const editedQty =
|
||||
overrideQty !== null
|
||||
? overrideQty
|
||||
: props?.Productdata?.ScaleType !== 'weight'
|
||||
? parseInt(Quantity)
|
||||
|
|
@ -3481,16 +3502,21 @@ const BSBillingEditQuantity = (props) => {
|
|||
);
|
||||
const editedProduct = {
|
||||
...CartOrderDetails[editedProductIndex],
|
||||
OrderQty: qty
|
||||
OrderQty: qty,
|
||||
};
|
||||
|
||||
await handleEditQuantity(editedProduct, editedProductIndex, editedProduct.OrderRate, qty);
|
||||
await handleEditQuantity(
|
||||
editedProduct,
|
||||
editedProductIndex,
|
||||
editedProduct.OrderRate,
|
||||
qty
|
||||
);
|
||||
props.handleEditQuantityCancel();
|
||||
setClearQuantity(false);
|
||||
};
|
||||
const isKg =
|
||||
props?.Productdata?.Size == 1 &&
|
||||
["KG", "KGS"].includes(props?.Productdata?.UomName?.toUpperCase());
|
||||
['KG', 'KGS'].includes(props?.Productdata?.UomName?.toUpperCase());
|
||||
|
||||
return (
|
||||
<div className="BSBilling-EditQuantity-Modal">
|
||||
|
|
@ -3589,7 +3615,8 @@ const BSBillingEditQuantity = (props) => {
|
|||
Packing
|
||||
</button>
|
||||
|
||||
{isKg && (<button
|
||||
{isKg && (
|
||||
<button
|
||||
type="button"
|
||||
className={
|
||||
RadioBtnSelection === 'weightAmount'
|
||||
|
|
@ -3599,13 +3626,19 @@ const BSBillingEditQuantity = (props) => {
|
|||
onClick={() => onRadioBtnChange('weightAmount')}
|
||||
>
|
||||
Weight / Amount
|
||||
</button>)}
|
||||
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{RadioBtnSelection == 'Quantity' && (
|
||||
<>
|
||||
<div className="EditQuantity-Quantity">
|
||||
<div
|
||||
className="EditQuantity-Quantity"
|
||||
onBlur={() => {
|
||||
dispatch(changefocusStatusCust(!selectStatuscust));
|
||||
dispatch(changeCombofocus(false));
|
||||
}}
|
||||
>
|
||||
<label className="EditQuantity-itemname">
|
||||
Item Quantity:
|
||||
</label>
|
||||
|
|
@ -3614,6 +3647,10 @@ const BSBillingEditQuantity = (props) => {
|
|||
type="number"
|
||||
value={Quantity}
|
||||
onChange={(e) => setQuantity(e.target.value)}
|
||||
onBlur={() => {
|
||||
dispatch(changefocusStatusCust(!selectStatuscust));
|
||||
dispatch(changeCombofocus(false));
|
||||
}}
|
||||
className="EditQuantity-Quantitybox"
|
||||
/>
|
||||
<button
|
||||
|
|
@ -3806,7 +3843,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
/>
|
||||
</>
|
||||
)}
|
||||
{(RadioBtnSelection == 'weightAmount') && isKg && (
|
||||
{RadioBtnSelection == 'weightAmount' && isKg && (
|
||||
<>
|
||||
<WeightCalculatePrice
|
||||
CartOrderDetails={CartOrderDetails}
|
||||
|
|
|
|||
|
|
@ -11,17 +11,21 @@ import { InputField } from '../../../../../Components/Forms/InputField';
|
|||
import {
|
||||
GlobalOrderCardDetails,
|
||||
changeOrderCardDetails,
|
||||
changefocusStatusCust,
|
||||
changeCombofocus,
|
||||
GlobalfocusStatusCust,
|
||||
} from '../../../../../Features/BookingScreen/BookingData/BookingData';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { validateSafeInput } from '../../../../../Services/Others';
|
||||
import { TextAreaInput } from '../../../../../../ownLib/my-ui-lib';
|
||||
import "../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.scss"
|
||||
import '../../../../../Styles/BookingScreen/Components/BSBillingTables/BSBillingEditQuantity/BSBillingEditQuantity.scss';
|
||||
const BSImeiDetails = (props) => {
|
||||
const formRef = useRef(null);
|
||||
const dispatch = useDispatch();
|
||||
const [messageType, setMessageType] = useState(null);
|
||||
const [messageData, setMessageData] = useState(null);
|
||||
const CartOrderDetails = useSelector(GlobalOrderCardDetails);
|
||||
const selectStatuscust = useSelector(GlobalfocusStatusCust);
|
||||
const [DeviceDetailOpen, setDeviceDetailOpen] = useState(props.DeviceDetails);
|
||||
const [ProductDetail, setProductDetail] = useState(props.ProductDetail);
|
||||
const [RadioBtnSelection, setRadioBtnSelection] = useState('Serial');
|
||||
|
|
@ -51,8 +55,8 @@ const BSImeiDetails = (props) => {
|
|||
);
|
||||
|
||||
formRef?.current?.setFieldsValue({
|
||||
description: productidentifier?.[0]?.Description || "",
|
||||
})
|
||||
description: productidentifier?.[0]?.Description || '',
|
||||
});
|
||||
}, []);
|
||||
const CloseDeviceDetailModal = () => {
|
||||
props.handleDeviceDetailClose();
|
||||
|
|
@ -72,8 +76,7 @@ const BSImeiDetails = (props) => {
|
|||
} else {
|
||||
setSerialNumberList([...SerialNumberList, e]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setMessageType('error');
|
||||
setMessageData('Already Selected ');
|
||||
}
|
||||
|
|
@ -94,7 +97,6 @@ const BSImeiDetails = (props) => {
|
|||
setMessageData('you cant enter more than Order Qty');
|
||||
}
|
||||
formRef.current?.resetFields(['SerialNumbertext', 'IMEINumbertext']);
|
||||
|
||||
};
|
||||
|
||||
const IMEINumberOnchange = (e) => {
|
||||
|
|
@ -139,8 +141,10 @@ const BSImeiDetails = (props) => {
|
|||
setMessageType(null);
|
||||
}, []);
|
||||
const AddDeviceDetails = () => {
|
||||
|
||||
console.log(formRef?.current?.getFieldsValue, "formRef?.current?.getFieldsValue")
|
||||
console.log(
|
||||
formRef?.current?.getFieldsValue,
|
||||
'formRef?.current?.getFieldsValue'
|
||||
);
|
||||
const maxLength = Math.max(SerialNumberList.length, IMEINumberList.length);
|
||||
// Create the new object array
|
||||
const IdentifyDetails = Array.from({ length: maxLength }, (_, index) => {
|
||||
|
|
@ -173,9 +177,8 @@ const BSImeiDetails = (props) => {
|
|||
)
|
||||
)
|
||||
);
|
||||
formRef?.current?.resetFields()
|
||||
formRef?.current?.resetFields();
|
||||
CloseDeviceDetailModal();
|
||||
|
||||
};
|
||||
console.log(ProductDetail, 'ProductDetaildevice');
|
||||
return (
|
||||
|
|
@ -239,7 +242,7 @@ const BSImeiDetails = (props) => {
|
|||
{RadioBtnSelection == 'Serial' && (
|
||||
<div>
|
||||
<div className="SerialNumberColumn">
|
||||
{ProductDetail?.FullProductIdentifierDtls?.length > 0 &&
|
||||
{ProductDetail?.FullProductIdentifierDtls?.length > 0 && (
|
||||
<Form.Item name="SerialNumber">
|
||||
<DropDowns
|
||||
options={ProductDetail?.FullProductIdentifierDtls?.filter(
|
||||
|
|
@ -260,20 +263,24 @@ const BSImeiDetails = (props) => {
|
|||
onChangeFunction={(e) => SerialNumberOnchange(e)}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
}
|
||||
)}
|
||||
|
||||
<Form.Item
|
||||
name="SerialNumbertext"
|
||||
rules={[
|
||||
{
|
||||
validator: async (_, value) => {
|
||||
|
||||
await validateSafeInput(value);
|
||||
return Promise.resolve();
|
||||
},
|
||||
},
|
||||
]}
|
||||
>
|
||||
<div
|
||||
onBlur={() => {
|
||||
dispatch(changefocusStatusCust(!selectStatuscust));
|
||||
dispatch(changeCombofocus(false));
|
||||
}}
|
||||
>
|
||||
<InputField
|
||||
field="SerialNumbertext"
|
||||
|
|
@ -283,12 +290,12 @@ const BSImeiDetails = (props) => {
|
|||
fieldApi={true}
|
||||
autocomplete="off"
|
||||
type="text"
|
||||
// onKeyDown={(e) => {
|
||||
// if (['e', 'E', '+', '-', '.'].includes(e.key)) {
|
||||
// e.preventDefault();
|
||||
// }
|
||||
// }}
|
||||
onBlur={() => {
|
||||
dispatch(changefocusStatusCust(!selectStatuscust));
|
||||
dispatch(changeCombofocus(false));
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Form.Item>
|
||||
<Buttons
|
||||
buttonText="Add"
|
||||
|
|
@ -315,11 +322,10 @@ const BSImeiDetails = (props) => {
|
|||
</div>
|
||||
)}
|
||||
|
||||
|
||||
{RadioBtnSelection == 'IMEI' && (
|
||||
<div>
|
||||
<div className="SerialNumberColumn">
|
||||
{ProductDetail?.FullProductIdentifierDtls?.length > 0 &&
|
||||
{ProductDetail?.FullProductIdentifierDtls?.length > 0 && (
|
||||
<Form.Item name="IMEINumber">
|
||||
<DropDowns
|
||||
options={ProductDetail?.FullProductIdentifierDtls?.filter(
|
||||
|
|
@ -342,19 +348,25 @@ const BSImeiDetails = (props) => {
|
|||
className="field-DropDown"
|
||||
onChangeFunction={(e) => IMEINumberOnchange(e)}
|
||||
/>
|
||||
</Form.Item>}
|
||||
</Form.Item>
|
||||
)}
|
||||
|
||||
<Form.Item
|
||||
name="IMEINumbertext"
|
||||
rules={[
|
||||
{
|
||||
validator: async (_, value) => {
|
||||
|
||||
await validateSafeInput(value);
|
||||
return Promise.resolve();
|
||||
},
|
||||
},
|
||||
]}
|
||||
>
|
||||
<div
|
||||
onBlur={() => {
|
||||
dispatch(changefocusStatusCust(!selectStatuscust));
|
||||
dispatch(changeCombofocus(false));
|
||||
}}
|
||||
>
|
||||
<InputField
|
||||
field="IMEINumbertext"
|
||||
|
|
@ -364,12 +376,12 @@ const BSImeiDetails = (props) => {
|
|||
fieldApi={true}
|
||||
autocomplete="off"
|
||||
type="text"
|
||||
// onKeyDown={(e) => {
|
||||
// if (['e', 'E', '+', '-', '.'].includes(e.key)) {
|
||||
// e.preventDefault();
|
||||
// }
|
||||
// }}
|
||||
onBlur={() => {
|
||||
dispatch(changefocusStatusCust(!selectStatuscust));
|
||||
dispatch(changeCombofocus(false));
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Form.Item>
|
||||
<Buttons
|
||||
buttonText="Add"
|
||||
|
|
@ -395,12 +407,12 @@ const BSImeiDetails = (props) => {
|
|||
</div>
|
||||
)}
|
||||
|
||||
<div style={{ display: "flex", marginTop: "10px" }}>
|
||||
<div style={{ display: 'flex', marginTop: '10px' }}>
|
||||
<Form.Item name="description">
|
||||
<TextAreaInput
|
||||
disabled={
|
||||
(IMEINumberList?.length === 0) &&
|
||||
(SerialNumberList?.length === 0)
|
||||
IMEINumberList?.length === 0 &&
|
||||
SerialNumberList?.length === 0
|
||||
}
|
||||
autoComplete="off"
|
||||
label={<label>Description..</label>}
|
||||
|
|
@ -411,7 +423,6 @@ const BSImeiDetails = (props) => {
|
|||
</div>
|
||||
</Form>
|
||||
|
||||
|
||||
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
||||
<Buttons
|
||||
buttonText="Submit"
|
||||
|
|
|
|||
|
|
@ -514,6 +514,7 @@
|
|||
position: absolute;
|
||||
z-index: 10;
|
||||
left: 6px;
|
||||
background-color: unset !important;
|
||||
}
|
||||
.custom-input {
|
||||
padding: 10px 30px 10px 30px;
|
||||
|
|
|
|||
Loading…
Reference in New Issue