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';
|
||||
|
|
@ -50,7 +53,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
const priceChangeInputRef = useRef(null);
|
||||
const reductionInputRef = useRef(null);
|
||||
|
||||
const { setIndex = () => { } } = props;
|
||||
const { setIndex = () => {} } = props;
|
||||
|
||||
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
||||
const SessionData = useSelector(StoredSessionData);
|
||||
|
|
@ -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,11 +742,12 @@ const BSBillingEditQuantity = (props) => {
|
|||
newPrice,
|
||||
overrideQty = null
|
||||
) => {
|
||||
const editedQty = overrideQty !== null
|
||||
? overrideQty
|
||||
: props?.Productdata?.ScaleType !== 'weight'
|
||||
? parseInt(Quantity)
|
||||
: props.Productdata.OrderQty;
|
||||
const editedQty =
|
||||
overrideQty !== null
|
||||
? overrideQty
|
||||
: props?.Productdata?.ScaleType !== 'weight'
|
||||
? parseInt(Quantity)
|
||||
: props.Productdata.OrderQty;
|
||||
const addFirst = BillOrderPre === 'Y';
|
||||
const isExistsInFreeProdList = FreeProdList?.find(
|
||||
(product) =>
|
||||
|
|
@ -750,7 +771,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
return (
|
||||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
cartItem?.OfferMessage?.[0]?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||
cartItem?.BookingTypeName !== editedProduct?.BookingTypeName
|
||||
);
|
||||
|
|
@ -884,7 +905,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||
cartItem?.BookingTypeName !==
|
||||
editedProduct?.BookingTypeName &&
|
||||
editedProduct?.BookingTypeName &&
|
||||
!cartItem?.OfferMode &&
|
||||
cartItem?.Offer === 0
|
||||
);
|
||||
|
|
@ -898,7 +919,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
cartItem?.OrderRate === editedProduct?.OrderRate &&
|
||||
cartItem?.BookingTypeName !==
|
||||
editedProduct?.BookingTypeName &&
|
||||
editedProduct?.BookingTypeName &&
|
||||
cartItem?.OfferMode === editedProduct?.OfferMode &&
|
||||
cartItem?.Offer > 0
|
||||
);
|
||||
|
|
@ -1031,7 +1052,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
)
|
||||
) &&
|
||||
product?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
product?.OfferMode === editedProduct?.OfferMode
|
||||
) {
|
||||
const freeQty =
|
||||
|
|
@ -1064,7 +1085,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -1147,7 +1168,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
)
|
||||
) &&
|
||||
product?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
product?.OfferMode === editedProduct?.OfferMode
|
||||
) {
|
||||
return {
|
||||
|
|
@ -1177,7 +1198,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -1364,7 +1385,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -1466,7 +1487,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
editedProduct?.OfferMessage?.[0]?.OfferId &&
|
||||
offerProduct?.OfferMode === editedProduct?.OfferMode;
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
|
|
@ -1620,7 +1641,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
) &&
|
||||
cartItem?.Offer &&
|
||||
isFreeProductApplicable?.OfferId ===
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
@ -1909,11 +1930,11 @@ const BSBillingEditQuantity = (props) => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode)
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -1947,11 +1968,11 @@ const BSBillingEditQuantity = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -2092,7 +2113,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
cartItem?.Offer > 0 &&
|
||||
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
|
||||
isFreeProductApplicable?.OfferId ===
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
cartItem?.OfferMessage?.[0]?.OfferId
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
@ -2195,11 +2216,11 @@ const BSBillingEditQuantity = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2270,12 +2291,12 @@ const BSBillingEditQuantity = (props) => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -2309,13 +2330,13 @@ const BSBillingEditQuantity = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode);
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -2397,11 +2418,11 @@ const BSBillingEditQuantity = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2454,11 +2475,11 @@ const BSBillingEditQuantity = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2547,11 +2568,11 @@ const BSBillingEditQuantity = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem?.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem?.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem?.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem?.OfferMode &&
|
||||
cartItem?.Offer > 0
|
||||
) {
|
||||
|
|
@ -2580,11 +2601,11 @@ const BSBillingEditQuantity = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2614,11 +2635,11 @@ const BSBillingEditQuantity = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2717,12 +2738,12 @@ const BSBillingEditQuantity = (props) => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -2756,12 +2777,12 @@ const BSBillingEditQuantity = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -2840,11 +2861,11 @@ const BSBillingEditQuantity = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === sameBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
sameBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
sameBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
sameBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2903,11 +2924,11 @@ const BSBillingEditQuantity = (props) => {
|
|||
if (
|
||||
cartItem.ProdId === otherBookingTypeProduct.ProdId &&
|
||||
cartItem.InwardDtlId ===
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
otherBookingTypeProduct.InwardDtlId &&
|
||||
cartItem.BookingTypeName ===
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
otherBookingTypeProduct.BookingTypeName &&
|
||||
cartItem.OrderRate ===
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
otherBookingTypeProduct.OrderRate &&
|
||||
cartItem.OfferMode &&
|
||||
cartItem.Offer > 0
|
||||
) {
|
||||
|
|
@ -2979,12 +3000,12 @@ const BSBillingEditQuantity = (props) => {
|
|||
product?.ProdId === editedProduct?.ProdId &&
|
||||
product?.InwardDtlId === editedProduct?.InwardDtlId &&
|
||||
product?.OfferId ===
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeFreeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
product?.OfferMode ===
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
(sameBookingTypeFreeProduct?.OfferMode ||
|
||||
otherBookingTypeFreeProduct?.OfferMode)
|
||||
) {
|
||||
return {
|
||||
...product,
|
||||
|
|
@ -3018,12 +3039,12 @@ const BSBillingEditQuantity = (props) => {
|
|||
// Also check main offer conditions
|
||||
const isMatchingOffer =
|
||||
offerProduct?.OfferId ===
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
|
||||
otherBookingTypeProduct?.OfferMessage?.[0]
|
||||
?.OfferId) &&
|
||||
offerProduct?.OfferMode ===
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
(sameBookingTypeProduct?.OfferMode ||
|
||||
otherBookingTypeProduct?.OfferMode);
|
||||
|
||||
if (hasMatchingFreeProduct && isMatchingOffer) {
|
||||
// Get loyalty points from the matching free product
|
||||
|
|
@ -3178,17 +3199,17 @@ const BSBillingEditQuantity = (props) => {
|
|||
changeOrderCardDetails(
|
||||
CartOrderDetails?.map((i) =>
|
||||
i?.InwardDtlId == updatedProduct?.InwardDtlId &&
|
||||
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
||||
i?.localId === updatedProduct?.localId
|
||||
i?.BookingTypeName == updatedProduct?.BookingTypeName &&
|
||||
i?.localId === updatedProduct?.localId
|
||||
? {
|
||||
...updatedProduct,
|
||||
Offer: 0,
|
||||
OfferType:
|
||||
updatedProduct?.Type === 'C'
|
||||
? updatedProduct?.OfferType
|
||||
: null,
|
||||
OfferMessage: null,
|
||||
}
|
||||
...updatedProduct,
|
||||
Offer: 0,
|
||||
OfferType:
|
||||
updatedProduct?.Type === 'C'
|
||||
? updatedProduct?.OfferType
|
||||
: null,
|
||||
OfferMessage: null,
|
||||
}
|
||||
: i
|
||||
)
|
||||
)
|
||||
|
|
@ -3224,10 +3245,10 @@ const BSBillingEditQuantity = (props) => {
|
|||
((c?.OfferModeType && c?.OfferMode === 'B'
|
||||
? true
|
||||
: c?.OfferMode !== 'B') &&
|
||||
c?.OfferMode !== 'P' &&
|
||||
c?.OfferMode !== 'C' &&
|
||||
c?.OfferMode !== 'O' &&
|
||||
c?.OfferMode !== 'L'
|
||||
c?.OfferMode !== 'P' &&
|
||||
c?.OfferMode !== 'C' &&
|
||||
c?.OfferMode !== 'O' &&
|
||||
c?.OfferMode !== 'L'
|
||||
? true
|
||||
: c?.Offer === 0);
|
||||
|
||||
|
|
@ -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,23 +3615,30 @@ const BSBillingEditQuantity = (props) => {
|
|||
Packing
|
||||
</button>
|
||||
|
||||
{isKg && (<button
|
||||
type="button"
|
||||
className={
|
||||
RadioBtnSelection === 'weightAmount'
|
||||
? 'SelecBtn weightAmount'
|
||||
: 'ChangeBtn'
|
||||
}
|
||||
onClick={() => onRadioBtnChange('weightAmount')}
|
||||
>
|
||||
Weight / Amount
|
||||
</button>)}
|
||||
|
||||
{isKg && (
|
||||
<button
|
||||
type="button"
|
||||
className={
|
||||
RadioBtnSelection === 'weightAmount'
|
||||
? 'SelecBtn weightAmount'
|
||||
: 'ChangeBtn'
|
||||
}
|
||||
onClick={() => onRadioBtnChange('weightAmount')}
|
||||
>
|
||||
Weight / Amount
|
||||
</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
|
||||
|
|
@ -3710,7 +3747,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
? `${parts[0]}.${parts.slice(1).join('')}`
|
||||
: cleanedValue;
|
||||
}}
|
||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
||||
/>
|
||||
</Form.Item>
|
||||
)}
|
||||
|
|
@ -3773,7 +3810,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
? `${parts[0]}.${parts.slice(1).join('')}`
|
||||
: cleanedValue;
|
||||
}}
|
||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
||||
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
|
||||
/>
|
||||
</Form.Item>
|
||||
{/* <input type="text"
|
||||
|
|
@ -3806,7 +3843,7 @@ const BSBillingEditQuantity = (props) => {
|
|||
/>
|
||||
</>
|
||||
)}
|
||||
{(RadioBtnSelection == 'weightAmount') && isKg && (
|
||||
{RadioBtnSelection == 'weightAmount' && isKg && (
|
||||
<>
|
||||
<WeightCalculatePrice
|
||||
CartOrderDetails={CartOrderDetails}
|
||||
|
|
@ -3818,14 +3855,14 @@ const BSBillingEditQuantity = (props) => {
|
|||
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
|
||||
{((RadioBtnSelection == 'Price' && disableSubmitButton) ||
|
||||
RadioBtnSelection == 'Quantity') && (
|
||||
<Buttons
|
||||
buttonText="Submit"
|
||||
color="901D77"
|
||||
htmlType
|
||||
// handleSubmit={AddProductQuantity}
|
||||
icon={<ArrowRightOutlined />}
|
||||
></Buttons>
|
||||
)}
|
||||
<Buttons
|
||||
buttonText="Submit"
|
||||
color="901D77"
|
||||
htmlType
|
||||
// handleSubmit={AddProductQuantity}
|
||||
icon={<ArrowRightOutlined />}
|
||||
></Buttons>
|
||||
)}
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
@ -165,17 +169,16 @@ const BSImeiDetails = (props) => {
|
|||
cartItem // if the item is already in the cart, increase the quantity of the item
|
||||
) =>
|
||||
cartItem.ProdId === ProductDetail.ProdId &&
|
||||
cartItem.InwardDtlId === ProductDetail.InwardDtlId &&
|
||||
cartItem?.OrderRate === ProductDetail?.OrderRate &&
|
||||
cartItem?.BookingTypeName === ProductDetail?.BookingTypeName
|
||||
cartItem.InwardDtlId === ProductDetail.InwardDtlId &&
|
||||
cartItem?.OrderRate === ProductDetail?.OrderRate &&
|
||||
cartItem?.BookingTypeName === ProductDetail?.BookingTypeName
|
||||
? { ...cartItem, ProductIdentifierDtls: IdentifyDetails }
|
||||
: cartItem // otherwise, return the cart item
|
||||
)
|
||||
)
|
||||
);
|
||||
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,35 +263,39 @@ const BSImeiDetails = (props) => {
|
|||
onChangeFunction={(e) => SerialNumberOnchange(e)}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
}
|
||||
)}
|
||||
|
||||
<Form.Item
|
||||
name="SerialNumbertext"
|
||||
rules={[
|
||||
{
|
||||
validator: async (_, value) => {
|
||||
|
||||
await validateSafeInput(value);
|
||||
return Promise.resolve();
|
||||
},
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputField
|
||||
field="SerialNumbertext"
|
||||
name="SerialNumbertext"
|
||||
label="Serial Number"
|
||||
fieldState={true}
|
||||
fieldApi={true}
|
||||
autocomplete="off"
|
||||
type="text"
|
||||
// onKeyDown={(e) => {
|
||||
// if (['e', 'E', '+', '-', '.'].includes(e.key)) {
|
||||
// e.preventDefault();
|
||||
// }
|
||||
// }}
|
||||
/>
|
||||
<div
|
||||
onBlur={() => {
|
||||
dispatch(changefocusStatusCust(!selectStatuscust));
|
||||
dispatch(changeCombofocus(false));
|
||||
}}
|
||||
>
|
||||
<InputField
|
||||
field="SerialNumbertext"
|
||||
name="SerialNumbertext"
|
||||
label="Serial Number"
|
||||
fieldState={true}
|
||||
fieldApi={true}
|
||||
autocomplete="off"
|
||||
type="text"
|
||||
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,34 +348,40 @@ 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();
|
||||
},
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputField
|
||||
field="IMEINumbertext"
|
||||
name="IMEINumbertext"
|
||||
label="IMEI Number"
|
||||
fieldState={true}
|
||||
fieldApi={true}
|
||||
autocomplete="off"
|
||||
type="text"
|
||||
// onKeyDown={(e) => {
|
||||
// if (['e', 'E', '+', '-', '.'].includes(e.key)) {
|
||||
// e.preventDefault();
|
||||
// }
|
||||
// }}
|
||||
/>
|
||||
<div
|
||||
onBlur={() => {
|
||||
dispatch(changefocusStatusCust(!selectStatuscust));
|
||||
dispatch(changeCombofocus(false));
|
||||
}}
|
||||
>
|
||||
<InputField
|
||||
field="IMEINumbertext"
|
||||
name="IMEINumbertext"
|
||||
label="IMEI Number"
|
||||
fieldState={true}
|
||||
fieldApi={true}
|
||||
autocomplete="off"
|
||||
type="text"
|
||||
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"
|
||||
|
|
@ -420,11 +431,11 @@ const BSImeiDetails = (props) => {
|
|||
icon={<ArrowRightOutlined />}
|
||||
></Buttons>
|
||||
</div>
|
||||
</div >
|
||||
</div>
|
||||
}
|
||||
handleCancel={CloseDeviceDetailModal}
|
||||
/>
|
||||
</div >
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default BSImeiDetails;
|
||||
|
|
|
|||
|
|
@ -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