Focus Clear In edit QTY and Serial Number

This commit is contained in:
Your Name 2026-03-04 12:19:03 +05:30
parent fc34c1919b
commit 85cd9cd141
3 changed files with 239 additions and 190 deletions

View File

@ -12,6 +12,9 @@ import {
GlobalReorderProductDetails, GlobalReorderProductDetails,
PreferenceData, PreferenceData,
getConfigType, getConfigType,
changefocusStatusCust,
changeCombofocus,
GlobalfocusStatusCust,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import { ArrowRightOutlined } from '@ant-design/icons'; import { ArrowRightOutlined } from '@ant-design/icons';
import { Messages } from '../../../../../Components/Notifications/Messages'; import { Messages } from '../../../../../Components/Notifications/Messages';
@ -50,7 +53,7 @@ const BSBillingEditQuantity = (props) => {
const priceChangeInputRef = useRef(null); const priceChangeInputRef = useRef(null);
const reductionInputRef = useRef(null); const reductionInputRef = useRef(null);
const { setIndex = () => { } } = props; const { setIndex = () => {} } = props;
const [disableSubmitButton, setDisableSubmitButton] = useState(false); const [disableSubmitButton, setDisableSubmitButton] = useState(false);
const SessionData = useSelector(StoredSessionData); const SessionData = useSelector(StoredSessionData);
@ -66,13 +69,24 @@ const BSBillingEditQuantity = (props) => {
shallowEqual shallowEqual
); );
const overAllLimitPreferenece = const overAllLimitPreferenece = preferenceDatas?.[0]?.[
preferenceDatas?.[0]?.['SettingDtlDetails']?.find( 'SettingDtlDetails'
(item) => (item.SettingIdName?.toLowerCase() === 'overalllimit') && item?.SettingValue === 'Y'); ]?.find(
const itemWiseLimitPreferenece = (item) =>
preferenceDatas?.[0]?.['SettingDtlDetails']?.find( item.SettingIdName?.toLowerCase() === 'overalllimit' &&
(item) => item.SettingIdName?.toLowerCase() === 'itemwiselimit' && item?.SettingValue === 'Y'); item?.SettingValue === 'Y'
const maxQtyLimit = itemWiseLimitPreferenece?.SettingCount || overAllLimitPreferenece?.SettingCount || null; );
const itemWiseLimitPreferenece = preferenceDatas?.[0]?.[
'SettingDtlDetails'
]?.find(
(item) =>
item.SettingIdName?.toLowerCase() === 'itemwiselimit' &&
item?.SettingValue === 'Y'
);
const maxQtyLimit =
itemWiseLimitPreferenece?.SettingCount ||
overAllLimitPreferenece?.SettingCount ||
null;
const preferenceOffer = const preferenceOffer =
preferenceDatas?.[0]?.['SettingDtlDetails']?.find( preferenceDatas?.[0]?.['SettingDtlDetails']?.find(
(item) => item.SettingIdName === 'Offer' (item) => item.SettingIdName === 'Offer'
@ -86,7 +100,7 @@ const BSBillingEditQuantity = (props) => {
); );
console.log(preferenceshortcutkey, 'preferenceshortcutkey'); console.log(preferenceshortcutkey, 'preferenceshortcutkey');
const [PriceChangeaccess, setPriceChangeaccess] = useState(true); const [PriceChangeaccess, setPriceChangeaccess] = useState(true);
const selectStatuscust = useSelector(GlobalfocusStatusCust);
const [ConfigDataList, setConfigDataList] = useState([]); const [ConfigDataList, setConfigDataList] = useState([]);
const [messageType, setMessageType] = useState(null); const [messageType, setMessageType] = useState(null);
const [messageData, setMessageData] = useState(null); const [messageData, setMessageData] = useState(null);
@ -115,7 +129,7 @@ const BSBillingEditQuantity = (props) => {
price: 'Price', price: 'Price',
quantity: 'qty', quantity: 'qty',
Parcel: 'Parcel', Parcel: 'Parcel',
weightAmount: 'weightAmount' weightAmount: 'weightAmount',
}; };
const [RadioBtnSelection, setRadioBtnSelection] = useState(() => { const [RadioBtnSelection, setRadioBtnSelection] = useState(() => {
if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) { if (props?.shortKeyMethod && SHORTKEY_TO_RADIO[props.shortKeyMethod]) {
@ -343,7 +357,6 @@ const BSBillingEditQuantity = (props) => {
}; };
const calculateOverAllQty = (item, filterItems) => { const calculateOverAllQty = (item, filterItems) => {
if (!item) return 0; if (!item) return 0;
const totalUsedQty = const totalUsedQty =
@ -446,11 +459,18 @@ const BSBillingEditQuantity = (props) => {
); );
const editedProduct = CartOrderDetails[editedProductIndex]; const editedProduct = CartOrderDetails[editedProductIndex];
if ((overAllLimitPreferenece || itemWiseLimitPreferenece) && maxQtyLimit) { if (
(overAllLimitPreferenece || itemWiseLimitPreferenece) &&
maxQtyLimit
) {
if (overAllLimitPreferenece) { if (overAllLimitPreferenece) {
const calculatedOverAllQty = calculateOverAllQtyLimit(CartOrderDetails?.filter((_, index) => index !== editedProductIndex)); const calculatedOverAllQty = calculateOverAllQtyLimit(
if ((calculatedOverAllQty + editedQty) > maxQtyLimit) { CartOrderDetails?.filter((_, index) => index !== editedProductIndex)
setMessageData(`Overall Quantity Limit Exceeds than ${maxQtyLimit}`); );
if (calculatedOverAllQty + editedQty > maxQtyLimit) {
setMessageData(
`Overall Quantity Limit Exceeds than ${maxQtyLimit}`
);
setMessageType('warning'); setMessageType('warning');
return; return;
} }
@ -722,11 +742,12 @@ const BSBillingEditQuantity = (props) => {
newPrice, newPrice,
overrideQty = null overrideQty = null
) => { ) => {
const editedQty = overrideQty !== null const editedQty =
? overrideQty overrideQty !== null
: props?.Productdata?.ScaleType !== 'weight' ? overrideQty
? parseInt(Quantity) : props?.Productdata?.ScaleType !== 'weight'
: props.Productdata.OrderQty; ? parseInt(Quantity)
: props.Productdata.OrderQty;
const addFirst = BillOrderPre === 'Y'; const addFirst = BillOrderPre === 'Y';
const isExistsInFreeProdList = FreeProdList?.find( const isExistsInFreeProdList = FreeProdList?.find(
(product) => (product) =>
@ -750,7 +771,7 @@ const BSBillingEditQuantity = (props) => {
return ( return (
cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OfferMessage?.[0]?.OfferId === cartItem?.OfferMessage?.[0]?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId && editedProduct?.OfferMessage?.[0]?.OfferId &&
cartItem?.OfferMode === editedProduct?.OfferMode && cartItem?.OfferMode === editedProduct?.OfferMode &&
cartItem?.BookingTypeName !== editedProduct?.BookingTypeName cartItem?.BookingTypeName !== editedProduct?.BookingTypeName
); );
@ -884,7 +905,7 @@ const BSBillingEditQuantity = (props) => {
cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OrderRate === editedProduct?.OrderRate && cartItem?.OrderRate === editedProduct?.OrderRate &&
cartItem?.BookingTypeName !== cartItem?.BookingTypeName !==
editedProduct?.BookingTypeName && editedProduct?.BookingTypeName &&
!cartItem?.OfferMode && !cartItem?.OfferMode &&
cartItem?.Offer === 0 cartItem?.Offer === 0
); );
@ -898,7 +919,7 @@ const BSBillingEditQuantity = (props) => {
cartItem?.InwardDtlId === editedProduct?.InwardDtlId && cartItem?.InwardDtlId === editedProduct?.InwardDtlId &&
cartItem?.OrderRate === editedProduct?.OrderRate && cartItem?.OrderRate === editedProduct?.OrderRate &&
cartItem?.BookingTypeName !== cartItem?.BookingTypeName !==
editedProduct?.BookingTypeName && editedProduct?.BookingTypeName &&
cartItem?.OfferMode === editedProduct?.OfferMode && cartItem?.OfferMode === editedProduct?.OfferMode &&
cartItem?.Offer > 0 cartItem?.Offer > 0
); );
@ -1031,7 +1052,7 @@ const BSBillingEditQuantity = (props) => {
) )
) && ) &&
product?.OfferId === product?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId && editedProduct?.OfferMessage?.[0]?.OfferId &&
product?.OfferMode === editedProduct?.OfferMode product?.OfferMode === editedProduct?.OfferMode
) { ) {
const freeQty = const freeQty =
@ -1064,7 +1085,7 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions // Also check main offer conditions
const isMatchingOffer = const isMatchingOffer =
offerProduct?.OfferId === offerProduct?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId && editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode; offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) { if (hasMatchingFreeProduct && isMatchingOffer) {
@ -1147,7 +1168,7 @@ const BSBillingEditQuantity = (props) => {
) )
) && ) &&
product?.OfferId === product?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId && editedProduct?.OfferMessage?.[0]?.OfferId &&
product?.OfferMode === editedProduct?.OfferMode product?.OfferMode === editedProduct?.OfferMode
) { ) {
return { return {
@ -1177,7 +1198,7 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions // Also check main offer conditions
const isMatchingOffer = const isMatchingOffer =
offerProduct?.OfferId === offerProduct?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId && editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode; offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) { if (hasMatchingFreeProduct && isMatchingOffer) {
@ -1364,7 +1385,7 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions // Also check main offer conditions
const isMatchingOffer = const isMatchingOffer =
offerProduct?.OfferId === offerProduct?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId && editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode; offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) { if (hasMatchingFreeProduct && isMatchingOffer) {
@ -1466,7 +1487,7 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions // Also check main offer conditions
const isMatchingOffer = const isMatchingOffer =
offerProduct?.OfferId === offerProduct?.OfferId ===
editedProduct?.OfferMessage?.[0]?.OfferId && editedProduct?.OfferMessage?.[0]?.OfferId &&
offerProduct?.OfferMode === editedProduct?.OfferMode; offerProduct?.OfferMode === editedProduct?.OfferMode;
if (hasMatchingFreeProduct && isMatchingOffer) { if (hasMatchingFreeProduct && isMatchingOffer) {
@ -1620,7 +1641,7 @@ const BSBillingEditQuantity = (props) => {
) && ) &&
cartItem?.Offer && cartItem?.Offer &&
isFreeProductApplicable?.OfferId === isFreeProductApplicable?.OfferId ===
cartItem?.OfferMessage?.[0]?.OfferId cartItem?.OfferMessage?.[0]?.OfferId
); );
} }
); );
@ -1909,11 +1930,11 @@ const BSBillingEditQuantity = (props) => {
product?.ProdId === editedProduct?.ProdId && product?.ProdId === editedProduct?.ProdId &&
product?.InwardDtlId === editedProduct?.InwardDtlId && product?.InwardDtlId === editedProduct?.InwardDtlId &&
product?.OfferId === product?.OfferId ===
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
product?.OfferMode === product?.OfferMode ===
(sameBookingTypeProduct?.OfferMode || (sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode) otherBookingTypeProduct?.OfferMode)
) { ) {
return { return {
...product, ...product,
@ -1947,11 +1968,11 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions // Also check main offer conditions
const isMatchingOffer = const isMatchingOffer =
offerProduct?.OfferId === offerProduct?.OfferId ===
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) && otherBookingTypeProduct?.OfferMessage?.[0]?.OfferId) &&
offerProduct?.OfferMode === offerProduct?.OfferMode ===
(sameBookingTypeProduct?.OfferMode || (sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode); otherBookingTypeProduct?.OfferMode);
if (hasMatchingFreeProduct && isMatchingOffer) { if (hasMatchingFreeProduct && isMatchingOffer) {
// Get loyalty points from the matching free product // Get loyalty points from the matching free product
@ -2092,7 +2113,7 @@ const BSBillingEditQuantity = (props) => {
cartItem?.Offer > 0 && cartItem?.Offer > 0 &&
isFreeProductApplicable?.OfferMode === cartItem?.OfferMode && isFreeProductApplicable?.OfferMode === cartItem?.OfferMode &&
isFreeProductApplicable?.OfferId === isFreeProductApplicable?.OfferId ===
cartItem?.OfferMessage?.[0]?.OfferId cartItem?.OfferMessage?.[0]?.OfferId
); );
} }
); );
@ -2195,11 +2216,11 @@ const BSBillingEditQuantity = (props) => {
if ( if (
cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.ProdId === otherBookingTypeProduct.ProdId &&
cartItem.InwardDtlId === cartItem.InwardDtlId ===
otherBookingTypeProduct.InwardDtlId && otherBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName === cartItem.BookingTypeName ===
otherBookingTypeProduct.BookingTypeName && otherBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate === cartItem.OrderRate ===
otherBookingTypeProduct.OrderRate && otherBookingTypeProduct.OrderRate &&
cartItem.OfferMode && cartItem.OfferMode &&
cartItem.Offer > 0 cartItem.Offer > 0
) { ) {
@ -2270,12 +2291,12 @@ const BSBillingEditQuantity = (props) => {
product?.ProdId === editedProduct?.ProdId && product?.ProdId === editedProduct?.ProdId &&
product?.InwardDtlId === editedProduct?.InwardDtlId && product?.InwardDtlId === editedProduct?.InwardDtlId &&
product?.OfferId === product?.OfferId ===
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0] otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) && ?.OfferId) &&
product?.OfferMode === product?.OfferMode ===
(sameBookingTypeFreeProduct?.OfferMode || (sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode) otherBookingTypeFreeProduct?.OfferMode)
) { ) {
return { return {
...product, ...product,
@ -2309,13 +2330,13 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions // Also check main offer conditions
const isMatchingOffer = const isMatchingOffer =
offerProduct?.OfferId === offerProduct?.OfferId ===
(sameBookingTypeFreeProduct?.OfferMessage?.[0] (sameBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId || ?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0] otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) && ?.OfferId) &&
offerProduct?.OfferMode === offerProduct?.OfferMode ===
(sameBookingTypeFreeProduct?.OfferMode || (sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode); otherBookingTypeFreeProduct?.OfferMode);
if (hasMatchingFreeProduct && isMatchingOffer) { if (hasMatchingFreeProduct && isMatchingOffer) {
// Get loyalty points from the matching free product // Get loyalty points from the matching free product
@ -2397,11 +2418,11 @@ const BSBillingEditQuantity = (props) => {
if ( if (
cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.ProdId === sameBookingTypeProduct.ProdId &&
cartItem.InwardDtlId === cartItem.InwardDtlId ===
sameBookingTypeProduct.InwardDtlId && sameBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName === cartItem.BookingTypeName ===
sameBookingTypeProduct.BookingTypeName && sameBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate === cartItem.OrderRate ===
sameBookingTypeProduct.OrderRate && sameBookingTypeProduct.OrderRate &&
cartItem.OfferMode && cartItem.OfferMode &&
cartItem.Offer > 0 cartItem.Offer > 0
) { ) {
@ -2454,11 +2475,11 @@ const BSBillingEditQuantity = (props) => {
if ( if (
cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.ProdId === sameBookingTypeProduct.ProdId &&
cartItem.InwardDtlId === cartItem.InwardDtlId ===
sameBookingTypeProduct.InwardDtlId && sameBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName === cartItem.BookingTypeName ===
sameBookingTypeProduct.BookingTypeName && sameBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate === cartItem.OrderRate ===
sameBookingTypeProduct.OrderRate && sameBookingTypeProduct.OrderRate &&
cartItem.OfferMode && cartItem.OfferMode &&
cartItem.Offer > 0 cartItem.Offer > 0
) { ) {
@ -2547,11 +2568,11 @@ const BSBillingEditQuantity = (props) => {
if ( if (
cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.ProdId === otherBookingTypeProduct.ProdId &&
cartItem?.InwardDtlId === cartItem?.InwardDtlId ===
otherBookingTypeProduct.InwardDtlId && otherBookingTypeProduct.InwardDtlId &&
cartItem?.BookingTypeName === cartItem?.BookingTypeName ===
otherBookingTypeProduct.BookingTypeName && otherBookingTypeProduct.BookingTypeName &&
cartItem?.OrderRate === cartItem?.OrderRate ===
otherBookingTypeProduct.OrderRate && otherBookingTypeProduct.OrderRate &&
cartItem?.OfferMode && cartItem?.OfferMode &&
cartItem?.Offer > 0 cartItem?.Offer > 0
) { ) {
@ -2580,11 +2601,11 @@ const BSBillingEditQuantity = (props) => {
if ( if (
cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.ProdId === otherBookingTypeProduct.ProdId &&
cartItem.InwardDtlId === cartItem.InwardDtlId ===
otherBookingTypeProduct.InwardDtlId && otherBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName === cartItem.BookingTypeName ===
otherBookingTypeProduct.BookingTypeName && otherBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate === cartItem.OrderRate ===
otherBookingTypeProduct.OrderRate && otherBookingTypeProduct.OrderRate &&
cartItem.OfferMode && cartItem.OfferMode &&
cartItem.Offer > 0 cartItem.Offer > 0
) { ) {
@ -2614,11 +2635,11 @@ const BSBillingEditQuantity = (props) => {
if ( if (
cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.ProdId === otherBookingTypeProduct.ProdId &&
cartItem.InwardDtlId === cartItem.InwardDtlId ===
otherBookingTypeProduct.InwardDtlId && otherBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName === cartItem.BookingTypeName ===
otherBookingTypeProduct.BookingTypeName && otherBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate === cartItem.OrderRate ===
otherBookingTypeProduct.OrderRate && otherBookingTypeProduct.OrderRate &&
cartItem.OfferMode && cartItem.OfferMode &&
cartItem.Offer > 0 cartItem.Offer > 0
) { ) {
@ -2717,12 +2738,12 @@ const BSBillingEditQuantity = (props) => {
product?.ProdId === editedProduct?.ProdId && product?.ProdId === editedProduct?.ProdId &&
product?.InwardDtlId === editedProduct?.InwardDtlId && product?.InwardDtlId === editedProduct?.InwardDtlId &&
product?.OfferId === product?.OfferId ===
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0] otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) && ?.OfferId) &&
product?.OfferMode === product?.OfferMode ===
(sameBookingTypeFreeProduct?.OfferMode || (sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode) otherBookingTypeFreeProduct?.OfferMode)
) { ) {
return { return {
...product, ...product,
@ -2756,12 +2777,12 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions // Also check main offer conditions
const isMatchingOffer = const isMatchingOffer =
offerProduct?.OfferId === offerProduct?.OfferId ===
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0] otherBookingTypeProduct?.OfferMessage?.[0]
?.OfferId) && ?.OfferId) &&
offerProduct?.OfferMode === offerProduct?.OfferMode ===
(sameBookingTypeProduct?.OfferMode || (sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode); otherBookingTypeProduct?.OfferMode);
if (hasMatchingFreeProduct && isMatchingOffer) { if (hasMatchingFreeProduct && isMatchingOffer) {
// Get loyalty points from the matching free product // Get loyalty points from the matching free product
@ -2840,11 +2861,11 @@ const BSBillingEditQuantity = (props) => {
if ( if (
cartItem.ProdId === sameBookingTypeProduct.ProdId && cartItem.ProdId === sameBookingTypeProduct.ProdId &&
cartItem.InwardDtlId === cartItem.InwardDtlId ===
sameBookingTypeProduct.InwardDtlId && sameBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName === cartItem.BookingTypeName ===
sameBookingTypeProduct.BookingTypeName && sameBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate === cartItem.OrderRate ===
sameBookingTypeProduct.OrderRate && sameBookingTypeProduct.OrderRate &&
cartItem.OfferMode && cartItem.OfferMode &&
cartItem.Offer > 0 cartItem.Offer > 0
) { ) {
@ -2903,11 +2924,11 @@ const BSBillingEditQuantity = (props) => {
if ( if (
cartItem.ProdId === otherBookingTypeProduct.ProdId && cartItem.ProdId === otherBookingTypeProduct.ProdId &&
cartItem.InwardDtlId === cartItem.InwardDtlId ===
otherBookingTypeProduct.InwardDtlId && otherBookingTypeProduct.InwardDtlId &&
cartItem.BookingTypeName === cartItem.BookingTypeName ===
otherBookingTypeProduct.BookingTypeName && otherBookingTypeProduct.BookingTypeName &&
cartItem.OrderRate === cartItem.OrderRate ===
otherBookingTypeProduct.OrderRate && otherBookingTypeProduct.OrderRate &&
cartItem.OfferMode && cartItem.OfferMode &&
cartItem.Offer > 0 cartItem.Offer > 0
) { ) {
@ -2979,12 +3000,12 @@ const BSBillingEditQuantity = (props) => {
product?.ProdId === editedProduct?.ProdId && product?.ProdId === editedProduct?.ProdId &&
product?.InwardDtlId === editedProduct?.InwardDtlId && product?.InwardDtlId === editedProduct?.InwardDtlId &&
product?.OfferId === product?.OfferId ===
(sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId || (sameBookingTypeFreeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeFreeProduct?.OfferMessage?.[0] otherBookingTypeFreeProduct?.OfferMessage?.[0]
?.OfferId) && ?.OfferId) &&
product?.OfferMode === product?.OfferMode ===
(sameBookingTypeFreeProduct?.OfferMode || (sameBookingTypeFreeProduct?.OfferMode ||
otherBookingTypeFreeProduct?.OfferMode) otherBookingTypeFreeProduct?.OfferMode)
) { ) {
return { return {
...product, ...product,
@ -3018,12 +3039,12 @@ const BSBillingEditQuantity = (props) => {
// Also check main offer conditions // Also check main offer conditions
const isMatchingOffer = const isMatchingOffer =
offerProduct?.OfferId === offerProduct?.OfferId ===
(sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId || (sameBookingTypeProduct?.OfferMessage?.[0]?.OfferId ||
otherBookingTypeProduct?.OfferMessage?.[0] otherBookingTypeProduct?.OfferMessage?.[0]
?.OfferId) && ?.OfferId) &&
offerProduct?.OfferMode === offerProduct?.OfferMode ===
(sameBookingTypeProduct?.OfferMode || (sameBookingTypeProduct?.OfferMode ||
otherBookingTypeProduct?.OfferMode); otherBookingTypeProduct?.OfferMode);
if (hasMatchingFreeProduct && isMatchingOffer) { if (hasMatchingFreeProduct && isMatchingOffer) {
// Get loyalty points from the matching free product // Get loyalty points from the matching free product
@ -3178,17 +3199,17 @@ const BSBillingEditQuantity = (props) => {
changeOrderCardDetails( changeOrderCardDetails(
CartOrderDetails?.map((i) => CartOrderDetails?.map((i) =>
i?.InwardDtlId == updatedProduct?.InwardDtlId && i?.InwardDtlId == updatedProduct?.InwardDtlId &&
i?.BookingTypeName == updatedProduct?.BookingTypeName && i?.BookingTypeName == updatedProduct?.BookingTypeName &&
i?.localId === updatedProduct?.localId i?.localId === updatedProduct?.localId
? { ? {
...updatedProduct, ...updatedProduct,
Offer: 0, Offer: 0,
OfferType: OfferType:
updatedProduct?.Type === 'C' updatedProduct?.Type === 'C'
? updatedProduct?.OfferType ? updatedProduct?.OfferType
: null, : null,
OfferMessage: null, OfferMessage: null,
} }
: i : i
) )
) )
@ -3224,10 +3245,10 @@ const BSBillingEditQuantity = (props) => {
((c?.OfferModeType && c?.OfferMode === 'B' ((c?.OfferModeType && c?.OfferMode === 'B'
? true ? true
: c?.OfferMode !== 'B') && : c?.OfferMode !== 'B') &&
c?.OfferMode !== 'P' && c?.OfferMode !== 'P' &&
c?.OfferMode !== 'C' && c?.OfferMode !== 'C' &&
c?.OfferMode !== 'O' && c?.OfferMode !== 'O' &&
c?.OfferMode !== 'L' c?.OfferMode !== 'L'
? true ? true
: c?.Offer === 0); : c?.Offer === 0);
@ -3481,16 +3502,21 @@ const BSBillingEditQuantity = (props) => {
); );
const editedProduct = { const editedProduct = {
...CartOrderDetails[editedProductIndex], ...CartOrderDetails[editedProductIndex],
OrderQty: qty OrderQty: qty,
}; };
await handleEditQuantity(editedProduct, editedProductIndex, editedProduct.OrderRate, qty); await handleEditQuantity(
editedProduct,
editedProductIndex,
editedProduct.OrderRate,
qty
);
props.handleEditQuantityCancel(); props.handleEditQuantityCancel();
setClearQuantity(false); setClearQuantity(false);
}; };
const isKg = const isKg =
props?.Productdata?.Size == 1 && props?.Productdata?.Size == 1 &&
["KG", "KGS"].includes(props?.Productdata?.UomName?.toUpperCase()); ['KG', 'KGS'].includes(props?.Productdata?.UomName?.toUpperCase());
return ( return (
<div className="BSBilling-EditQuantity-Modal"> <div className="BSBilling-EditQuantity-Modal">
@ -3589,23 +3615,30 @@ const BSBillingEditQuantity = (props) => {
Packing Packing
</button> </button>
{isKg && (<button {isKg && (
type="button" <button
className={ type="button"
RadioBtnSelection === 'weightAmount' className={
? 'SelecBtn weightAmount' RadioBtnSelection === 'weightAmount'
: 'ChangeBtn' ? 'SelecBtn weightAmount'
} : 'ChangeBtn'
onClick={() => onRadioBtnChange('weightAmount')} }
> onClick={() => onRadioBtnChange('weightAmount')}
Weight / Amount >
</button>)} Weight / Amount
</button>
)}
</div> </div>
{RadioBtnSelection == 'Quantity' && ( {RadioBtnSelection == 'Quantity' && (
<> <>
<div className="EditQuantity-Quantity"> <div
className="EditQuantity-Quantity"
onBlur={() => {
dispatch(changefocusStatusCust(!selectStatuscust));
dispatch(changeCombofocus(false));
}}
>
<label className="EditQuantity-itemname"> <label className="EditQuantity-itemname">
Item Quantity: Item Quantity:
</label> </label>
@ -3614,6 +3647,10 @@ const BSBillingEditQuantity = (props) => {
type="number" type="number"
value={Quantity} value={Quantity}
onChange={(e) => setQuantity(e.target.value)} onChange={(e) => setQuantity(e.target.value)}
onBlur={() => {
dispatch(changefocusStatusCust(!selectStatuscust));
dispatch(changeCombofocus(false));
}}
className="EditQuantity-Quantitybox" className="EditQuantity-Quantitybox"
/> />
<button <button
@ -3710,7 +3747,7 @@ const BSBillingEditQuantity = (props) => {
? `${parts[0]}.${parts.slice(1).join('')}` ? `${parts[0]}.${parts.slice(1).join('')}`
: cleanedValue; : cleanedValue;
}} }}
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
/> />
</Form.Item> </Form.Item>
)} )}
@ -3773,7 +3810,7 @@ const BSBillingEditQuantity = (props) => {
? `${parts[0]}.${parts.slice(1).join('')}` ? `${parts[0]}.${parts.slice(1).join('')}`
: cleanedValue; : cleanedValue;
}} }}
// isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false} // isOnChange={formType == "edit" || formRef.current?.getFieldsValue()?.CustName ? true : false}
/> />
</Form.Item> </Form.Item>
{/* <input type="text" {/* <input type="text"
@ -3806,7 +3843,7 @@ const BSBillingEditQuantity = (props) => {
/> />
</> </>
)} )}
{(RadioBtnSelection == 'weightAmount') && isKg && ( {RadioBtnSelection == 'weightAmount' && isKg && (
<> <>
<WeightCalculatePrice <WeightCalculatePrice
CartOrderDetails={CartOrderDetails} CartOrderDetails={CartOrderDetails}
@ -3818,14 +3855,14 @@ const BSBillingEditQuantity = (props) => {
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
{((RadioBtnSelection == 'Price' && disableSubmitButton) || {((RadioBtnSelection == 'Price' && disableSubmitButton) ||
RadioBtnSelection == 'Quantity') && ( RadioBtnSelection == 'Quantity') && (
<Buttons <Buttons
buttonText="Submit" buttonText="Submit"
color="901D77" color="901D77"
htmlType htmlType
// handleSubmit={AddProductQuantity} // handleSubmit={AddProductQuantity}
icon={<ArrowRightOutlined />} icon={<ArrowRightOutlined />}
></Buttons> ></Buttons>
)} )}
</div> </div>
</Form> </Form>
</div> </div>

View File

@ -11,17 +11,21 @@ import { InputField } from '../../../../../Components/Forms/InputField';
import { import {
GlobalOrderCardDetails, GlobalOrderCardDetails,
changeOrderCardDetails, changeOrderCardDetails,
changefocusStatusCust,
changeCombofocus,
GlobalfocusStatusCust,
} from '../../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../../Features/BookingScreen/BookingData/BookingData';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { validateSafeInput } from '../../../../../Services/Others'; import { validateSafeInput } from '../../../../../Services/Others';
import { TextAreaInput } from '../../../../../../ownLib/my-ui-lib'; 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 BSImeiDetails = (props) => {
const formRef = useRef(null); const formRef = useRef(null);
const dispatch = useDispatch(); const dispatch = useDispatch();
const [messageType, setMessageType] = useState(null); const [messageType, setMessageType] = useState(null);
const [messageData, setMessageData] = useState(null); const [messageData, setMessageData] = useState(null);
const CartOrderDetails = useSelector(GlobalOrderCardDetails); const CartOrderDetails = useSelector(GlobalOrderCardDetails);
const selectStatuscust = useSelector(GlobalfocusStatusCust);
const [DeviceDetailOpen, setDeviceDetailOpen] = useState(props.DeviceDetails); const [DeviceDetailOpen, setDeviceDetailOpen] = useState(props.DeviceDetails);
const [ProductDetail, setProductDetail] = useState(props.ProductDetail); const [ProductDetail, setProductDetail] = useState(props.ProductDetail);
const [RadioBtnSelection, setRadioBtnSelection] = useState('Serial'); const [RadioBtnSelection, setRadioBtnSelection] = useState('Serial');
@ -51,8 +55,8 @@ const BSImeiDetails = (props) => {
); );
formRef?.current?.setFieldsValue({ formRef?.current?.setFieldsValue({
description: productidentifier?.[0]?.Description || "", description: productidentifier?.[0]?.Description || '',
}) });
}, []); }, []);
const CloseDeviceDetailModal = () => { const CloseDeviceDetailModal = () => {
props.handleDeviceDetailClose(); props.handleDeviceDetailClose();
@ -72,8 +76,7 @@ const BSImeiDetails = (props) => {
} else { } else {
setSerialNumberList([...SerialNumberList, e]); setSerialNumberList([...SerialNumberList, e]);
} }
} } else {
else {
setMessageType('error'); setMessageType('error');
setMessageData('Already Selected '); setMessageData('Already Selected ');
} }
@ -94,7 +97,6 @@ const BSImeiDetails = (props) => {
setMessageData('you cant enter more than Order Qty'); setMessageData('you cant enter more than Order Qty');
} }
formRef.current?.resetFields(['SerialNumbertext', 'IMEINumbertext']); formRef.current?.resetFields(['SerialNumbertext', 'IMEINumbertext']);
}; };
const IMEINumberOnchange = (e) => { const IMEINumberOnchange = (e) => {
@ -139,8 +141,10 @@ const BSImeiDetails = (props) => {
setMessageType(null); setMessageType(null);
}, []); }, []);
const AddDeviceDetails = () => { const AddDeviceDetails = () => {
console.log(
console.log(formRef?.current?.getFieldsValue, "formRef?.current?.getFieldsValue") formRef?.current?.getFieldsValue,
'formRef?.current?.getFieldsValue'
);
const maxLength = Math.max(SerialNumberList.length, IMEINumberList.length); const maxLength = Math.max(SerialNumberList.length, IMEINumberList.length);
// Create the new object array // Create the new object array
const IdentifyDetails = Array.from({ length: maxLength }, (_, index) => { 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 // if the item is already in the cart, increase the quantity of the item
) => ) =>
cartItem.ProdId === ProductDetail.ProdId && cartItem.ProdId === ProductDetail.ProdId &&
cartItem.InwardDtlId === ProductDetail.InwardDtlId && cartItem.InwardDtlId === ProductDetail.InwardDtlId &&
cartItem?.OrderRate === ProductDetail?.OrderRate && cartItem?.OrderRate === ProductDetail?.OrderRate &&
cartItem?.BookingTypeName === ProductDetail?.BookingTypeName cartItem?.BookingTypeName === ProductDetail?.BookingTypeName
? { ...cartItem, ProductIdentifierDtls: IdentifyDetails } ? { ...cartItem, ProductIdentifierDtls: IdentifyDetails }
: cartItem // otherwise, return the cart item : cartItem // otherwise, return the cart item
) )
) )
); );
formRef?.current?.resetFields() formRef?.current?.resetFields();
CloseDeviceDetailModal(); CloseDeviceDetailModal();
}; };
console.log(ProductDetail, 'ProductDetaildevice'); console.log(ProductDetail, 'ProductDetaildevice');
return ( return (
@ -239,7 +242,7 @@ const BSImeiDetails = (props) => {
{RadioBtnSelection == 'Serial' && ( {RadioBtnSelection == 'Serial' && (
<div> <div>
<div className="SerialNumberColumn"> <div className="SerialNumberColumn">
{ProductDetail?.FullProductIdentifierDtls?.length > 0 && {ProductDetail?.FullProductIdentifierDtls?.length > 0 && (
<Form.Item name="SerialNumber"> <Form.Item name="SerialNumber">
<DropDowns <DropDowns
options={ProductDetail?.FullProductIdentifierDtls?.filter( options={ProductDetail?.FullProductIdentifierDtls?.filter(
@ -260,35 +263,39 @@ const BSImeiDetails = (props) => {
onChangeFunction={(e) => SerialNumberOnchange(e)} onChangeFunction={(e) => SerialNumberOnchange(e)}
/> />
</Form.Item> </Form.Item>
)}
}
<Form.Item <Form.Item
name="SerialNumbertext" name="SerialNumbertext"
rules={[ rules={[
{ {
validator: async (_, value) => { validator: async (_, value) => {
await validateSafeInput(value); await validateSafeInput(value);
return Promise.resolve(); return Promise.resolve();
}, },
}, },
]} ]}
> >
<InputField <div
field="SerialNumbertext" onBlur={() => {
name="SerialNumbertext" dispatch(changefocusStatusCust(!selectStatuscust));
label="Serial Number" dispatch(changeCombofocus(false));
fieldState={true} }}
fieldApi={true} >
autocomplete="off" <InputField
type="text" field="SerialNumbertext"
// onKeyDown={(e) => { name="SerialNumbertext"
// if (['e', 'E', '+', '-', '.'].includes(e.key)) { label="Serial Number"
// e.preventDefault(); fieldState={true}
// } fieldApi={true}
// }} autocomplete="off"
/> type="text"
onBlur={() => {
dispatch(changefocusStatusCust(!selectStatuscust));
dispatch(changeCombofocus(false));
}}
/>
</div>
</Form.Item> </Form.Item>
<Buttons <Buttons
buttonText="Add" buttonText="Add"
@ -315,11 +322,10 @@ const BSImeiDetails = (props) => {
</div> </div>
)} )}
{RadioBtnSelection == 'IMEI' && ( {RadioBtnSelection == 'IMEI' && (
<div> <div>
<div className="SerialNumberColumn"> <div className="SerialNumberColumn">
{ProductDetail?.FullProductIdentifierDtls?.length > 0 && {ProductDetail?.FullProductIdentifierDtls?.length > 0 && (
<Form.Item name="IMEINumber"> <Form.Item name="IMEINumber">
<DropDowns <DropDowns
options={ProductDetail?.FullProductIdentifierDtls?.filter( options={ProductDetail?.FullProductIdentifierDtls?.filter(
@ -342,34 +348,40 @@ const BSImeiDetails = (props) => {
className="field-DropDown" className="field-DropDown"
onChangeFunction={(e) => IMEINumberOnchange(e)} onChangeFunction={(e) => IMEINumberOnchange(e)}
/> />
</Form.Item>} </Form.Item>
)}
<Form.Item <Form.Item
name="IMEINumbertext" name="IMEINumbertext"
rules={[ rules={[
{ {
validator: async (_, value) => { validator: async (_, value) => {
await validateSafeInput(value); await validateSafeInput(value);
return Promise.resolve(); return Promise.resolve();
}, },
}, },
]} ]}
> >
<InputField <div
field="IMEINumbertext" onBlur={() => {
name="IMEINumbertext" dispatch(changefocusStatusCust(!selectStatuscust));
label="IMEI Number" dispatch(changeCombofocus(false));
fieldState={true} }}
fieldApi={true} >
autocomplete="off" <InputField
type="text" field="IMEINumbertext"
// onKeyDown={(e) => { name="IMEINumbertext"
// if (['e', 'E', '+', '-', '.'].includes(e.key)) { label="IMEI Number"
// e.preventDefault(); fieldState={true}
// } fieldApi={true}
// }} autocomplete="off"
/> type="text"
onBlur={() => {
dispatch(changefocusStatusCust(!selectStatuscust));
dispatch(changeCombofocus(false));
}}
/>
</div>
</Form.Item> </Form.Item>
<Buttons <Buttons
buttonText="Add" buttonText="Add"
@ -395,12 +407,12 @@ const BSImeiDetails = (props) => {
</div> </div>
)} )}
<div style={{ display: "flex", marginTop: "10px" }}> <div style={{ display: 'flex', marginTop: '10px' }}>
<Form.Item name="description"> <Form.Item name="description">
<TextAreaInput <TextAreaInput
disabled={ disabled={
(IMEINumberList?.length === 0) && IMEINumberList?.length === 0 &&
(SerialNumberList?.length === 0) SerialNumberList?.length === 0
} }
autoComplete="off" autoComplete="off"
label={<label>Description..</label>} label={<label>Description..</label>}
@ -411,7 +423,6 @@ const BSImeiDetails = (props) => {
</div> </div>
</Form> </Form>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}> <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Buttons <Buttons
buttonText="Submit" buttonText="Submit"
@ -420,11 +431,11 @@ const BSImeiDetails = (props) => {
icon={<ArrowRightOutlined />} icon={<ArrowRightOutlined />}
></Buttons> ></Buttons>
</div> </div>
</div > </div>
} }
handleCancel={CloseDeviceDetailModal} handleCancel={CloseDeviceDetailModal}
/> />
</div > </div>
); );
}; };
export default BSImeiDetails; export default BSImeiDetails;

View File

@ -514,6 +514,7 @@
position: absolute; position: absolute;
z-index: 10; z-index: 10;
left: 6px; left: 6px;
background-color: unset !important;
} }
.custom-input { .custom-input {
padding: 10px 30px 10px 30px; padding: 10px 30px 10px 30px;