scan page laoding issue
This commit is contained in:
parent
7b0485fefc
commit
0144a75c62
|
|
@ -22,6 +22,7 @@
|
|||
"@reduxjs/toolkit": "^1.9.5",
|
||||
"@tanstack/react-query": "^5.90.11",
|
||||
"@tanstack/react-query-devtools": "^5.91.1",
|
||||
"@tanstack/react-virtual": "^3.13.18",
|
||||
"antd": "^5.17.4",
|
||||
"antd-img-crop": "^4.22.0",
|
||||
"aos": "^2.3.4",
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,12 +1,10 @@
|
|||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
||||
import moment from 'moment';
|
||||
import { Badge, Modal, Tooltip } from 'antd';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
||||
import { Badge, Tooltip } from 'antd';
|
||||
import defaultimage from '../../../../Images/defaultItemImg.png';
|
||||
import FormHeader from '../../../PageComponents/FormHeader';
|
||||
import {
|
||||
GlobalPricingAppPricingName,
|
||||
SelectedGlobalCardColorDetail,
|
||||
SelectedGlobalCardFont,
|
||||
StoredSessionData,
|
||||
|
|
@ -44,15 +42,12 @@ import {
|
|||
GlobalReorderHoldDetails,
|
||||
GlobalWeightScalePort,
|
||||
GlobalWeightScaleWeight,
|
||||
changeWeightScaleWeight,
|
||||
GlobalExpDateforHeight,
|
||||
GlobalBookingTypeBoth,
|
||||
GlobalOrderType,
|
||||
GlobalReorderProductDetails,
|
||||
getConfigType,
|
||||
GlobalPayementloader,
|
||||
GlobalPaymentTransactionNumber,
|
||||
GlobalSelOption,
|
||||
PreferenceData,
|
||||
changeCardData,
|
||||
GlobaldraggingComponent,
|
||||
|
|
@ -125,6 +120,7 @@ import AddProduct from '../../../../Components/AddProduct/AddProduct.jsx';
|
|||
import { MdOutlineAddShoppingCart } from 'react-icons/md';
|
||||
import { bulkpostdata } from '../../../../Features/ProductPage/ProductPage.js';
|
||||
import ProductPriceChange from '../UtillComponents/ProductPriceChange.jsx';
|
||||
import ExpireConfirmModal from '../BookingFunctionality/ExpireConfirmModal.jsx';
|
||||
|
||||
export function SortableCard({ id, children, item }) {
|
||||
const {
|
||||
|
|
@ -191,18 +187,14 @@ const BSItemCard = (props) => {
|
|||
const AllCategoryDatas = useSelector(GlobalCategorieData, shallowEqual);
|
||||
const AllsubcatgoryDatas = useSelector(GlobalSubcategorieData, shallowEqual);
|
||||
const RetailWSSalesType = useSelector(GlobalRetailWSSalesType, shallowEqual);
|
||||
// const CustDetails = SelectedCust ? SelectedCust : AddCustomerDetails?.[0];
|
||||
const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
|
||||
|
||||
const GPreOrderList = useSelector(GlobalPreOrderList, shallowEqual);
|
||||
const [modelQty, setModelQty] = useState(false);
|
||||
const [modelstock, setModelstock] = useState(false);
|
||||
const [ModalVarient, setModalVarient] = useState(false);
|
||||
const [QtyIndex, setQtyIndex] = useState(0);
|
||||
const [VarientIndex, setVarientIndex] = useState(0);
|
||||
const [expModel, setexpModel] = useState(false);
|
||||
const [prodexpir, setProdexpir] = useState(false);
|
||||
const [expVarModel, setexpVarModel] = useState(false);
|
||||
const [expStockModel, setexpStockModel] = useState(false);
|
||||
const [initialRun, setInitialRun] = useState(false);
|
||||
const [Item, setItem] = useState();
|
||||
const [VarItem, setVarItem] = useState(0);
|
||||
|
|
@ -281,12 +273,11 @@ const BSItemCard = (props) => {
|
|||
const [QuickAdd, setQuickAdd] = useState(true);
|
||||
const [onePeiceFlow, setOnePeiceFlow] = useState(false);
|
||||
const [BillOrderPre, setBillOrderPre] = useState();
|
||||
const [expQtyModel, setExpQtyModel] = useState(false);
|
||||
const [qtyExpData, setQtyExpData] = useState();
|
||||
const OrderOfferDetail = useSelector(Global_OrderOfferDetail);
|
||||
const [freeProductsOffers, setfreeProductsOffers] = useState([]);
|
||||
// const [freeProductsOffers, setfreeProductsOffers] = useState([]);
|
||||
const [screenWidth, setScreenWidth] = useState(window.innerWidth);
|
||||
const [screenHeight, setScreenHeight] = useState(window.innerHeight);
|
||||
// const [screenHeight, setScreenHeight] = useState(window.innerHeight);
|
||||
const ProdCat = useSelector(GlobalProductCategorie, shallowEqual);
|
||||
const paymentloader = useSelector(GlobalPayementloader, shallowEqual);
|
||||
const SessionData = useSelector(StoredSessionData, shallowEqual);
|
||||
|
|
@ -314,6 +305,12 @@ const BSItemCard = (props) => {
|
|||
const triggerOfferFree = useSelector(GlobalTriggerOfferFree);
|
||||
const productCardTrigger = useSelector(GlobalProductCardTrigger);
|
||||
const appPreferences = useSelector(ApplicationPreferences);
|
||||
const [expireModal, setExpireModal] = useState({
|
||||
open: false,
|
||||
title: '',
|
||||
onOk: null,
|
||||
onCancel: null,
|
||||
});
|
||||
const salespagefields = appPreferences?.find(
|
||||
(pref) => pref?.PreferredCatName === 'Sales Page Fields'
|
||||
)?.PreferenceCatDetails;
|
||||
|
|
@ -322,7 +319,7 @@ const BSItemCard = (props) => {
|
|||
type?.PreferredSubCatName?.toLowerCase() === 'available date' &&
|
||||
type?.PreferredStatus === 'Y'
|
||||
);
|
||||
console.log(AvailableDate, salespagefields, 'Available Date');
|
||||
|
||||
const SingleMember = salespagefields?.find(
|
||||
(type) =>
|
||||
type?.PreferredSubCatName?.toLowerCase() === 'single member' &&
|
||||
|
|
@ -930,6 +927,19 @@ const BSItemCard = (props) => {
|
|||
};
|
||||
}
|
||||
|
||||
const openExpireModal = ({ title, onOk, onCancel }) => {
|
||||
setExpireModal({
|
||||
open: true,
|
||||
title,
|
||||
onOk,
|
||||
onCancel,
|
||||
});
|
||||
};
|
||||
|
||||
const closeExpireModal = () => {
|
||||
setExpireModal((prev) => ({ ...prev, open: false }));
|
||||
};
|
||||
|
||||
// Usage example:
|
||||
// const result = handleLoyaltyFreeProducts(orderCardDtls, freeProdDtls);
|
||||
// console.log(result.ModifiedData);
|
||||
|
|
@ -937,13 +947,9 @@ const BSItemCard = (props) => {
|
|||
// console.log(result.AppliedOffers);
|
||||
|
||||
async function getOffers() {
|
||||
let response = await dispatch(
|
||||
await dispatch(
|
||||
getOfferinBooking({ AppId: AppId, CompId: CompId, BranchId: BranchId })
|
||||
).unwrap();
|
||||
|
||||
if (response?.data?.statusCode == 1) {
|
||||
let expiredProd = response?.data?.data;
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -964,7 +970,7 @@ const BSItemCard = (props) => {
|
|||
if (TableName === 'BuyXGetXOffers') return true;
|
||||
}
|
||||
);
|
||||
setfreeProductsOffers(filteredOffers);
|
||||
// setfreeProductsOffers(filteredOffers);
|
||||
|
||||
getOffers();
|
||||
}, [OrderOfferDetail]);
|
||||
|
|
@ -978,12 +984,7 @@ const BSItemCard = (props) => {
|
|||
});
|
||||
}
|
||||
}, [SelectedCardFont]);
|
||||
// const cardData = !globalAccessForOthers
|
||||
// ? CardAccess
|
||||
// ? SelectedDatas
|
||||
// : ItemCard?.length == 0 ? noSubcatCardData : ItemCard
|
||||
// : "";
|
||||
//mohan 18-04-2025
|
||||
|
||||
const cardData = !globalAccessForOthers
|
||||
? CardAccess
|
||||
? SelectedDatas?.length > 1
|
||||
|
|
@ -1155,13 +1156,6 @@ const BSItemCard = (props) => {
|
|||
|
||||
if (tempconfigdata?.data?.statusCode == 1) {
|
||||
setConfigDataList(tempconfigdata?.data?.data);
|
||||
let configdata = tempconfigdata?.data?.data;
|
||||
let checkName = BookingTypeBoth ? 'DineIn,TakeAway' : BookingType;
|
||||
|
||||
let filterconfigdata = configdata?.find(
|
||||
(a) => a?.ConfigName === checkName
|
||||
);
|
||||
// setSelectedBookingType(filterconfigdata?.ConfigId);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1195,7 +1189,10 @@ const BSItemCard = (props) => {
|
|||
useEffect(() => {
|
||||
if (ItemCard?.[0]?.QrBasedSearch === 'Y') {
|
||||
if (ItemCard?.[0]?.OverAllExpStatus == 'Y' && ExpiredProduct) {
|
||||
setexpModel(true);
|
||||
openExpireModal({
|
||||
title: 'Product Expires',
|
||||
onOk: () => expFun(Item),
|
||||
});
|
||||
setItem(ItemCard?.[0]);
|
||||
} else {
|
||||
setQtydata(ItemCard?.[0]);
|
||||
|
|
@ -1203,7 +1200,10 @@ const BSItemCard = (props) => {
|
|||
}
|
||||
} else if (ItemCard?.[0]?.OnePcQRBased === 'Y') {
|
||||
if (ItemCard?.[0]?.OverAllExpStatus == 'Y' && ExpiredProduct) {
|
||||
setexpModel(true);
|
||||
openExpireModal({
|
||||
title: 'Product Expires',
|
||||
onOk: () => expFun(Item),
|
||||
});
|
||||
setItem(ItemCard?.[0]);
|
||||
setOnePeiceFlow(true);
|
||||
} else {
|
||||
|
|
@ -1295,14 +1295,6 @@ const BSItemCard = (props) => {
|
|||
)?.SettingValue === 'Y';
|
||||
setExpiredProduct(expiredDate);
|
||||
};
|
||||
const to12Hour = (timeStr) => {
|
||||
if (!timeStr) return '';
|
||||
let [h, m] = timeStr.split(':');
|
||||
h = parseInt(h, 10);
|
||||
const suffix = h >= 12 ? 'PM' : 'AM';
|
||||
h = h % 12 || 12; // 0 → 12
|
||||
return `${h}${suffix}`;
|
||||
};
|
||||
|
||||
const CloseModal = () => {
|
||||
setModelQty(false);
|
||||
|
|
@ -1464,55 +1456,6 @@ const BSItemCard = (props) => {
|
|||
}
|
||||
};
|
||||
|
||||
// const Stockfun = (index) => {
|
||||
// setVarientIndex(index.key)
|
||||
// let count = qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]?.StockDetails?.length;
|
||||
// if (StockPreferenceDetail?.SettingValue === "Y") {
|
||||
// if (count > 1) {
|
||||
// if (qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]?.OverAllExpStatus == 'N') {
|
||||
// setModalVarient(false)
|
||||
// setModelstock(true)
|
||||
// setVarItem(index.key)
|
||||
// }
|
||||
// else if (qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]?.OverAllExpStatus == 'Y') {
|
||||
// if (prodexpir) {
|
||||
// setRepeatedModel(true)
|
||||
// setModalVarient(false)
|
||||
// setModelstock(true)
|
||||
// setVarItem(index.key)
|
||||
// }
|
||||
// else {
|
||||
// setexpVarModel(true);
|
||||
// setVarItem(index.key)
|
||||
// }
|
||||
// }
|
||||
// // setVarientIndex(index.key)
|
||||
// }
|
||||
// else {
|
||||
// if (qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]?.OverAllExpStatus == 'N') {
|
||||
// dataTransfer(qtydata, QtyIndex, index.key, 0);
|
||||
// setModelQty(false)
|
||||
// setVarItem(index.key)
|
||||
// }
|
||||
// else if (qtydata?.ProductDetail?.[QtyIndex]?.ProdVariantDetails?.[index.key]?.OverAllExpStatus == 'Y') {
|
||||
// if (prodexpir) {
|
||||
// setProdexpir(false)
|
||||
// setRepeatedModel(true)
|
||||
// dataTransfer(qtydata, QtyIndex, index.key, 0);
|
||||
// setModelQty(false)
|
||||
// setVarItem(index.key)
|
||||
// }
|
||||
// else{
|
||||
// setexpVarModel(true);
|
||||
// setVarItem(index.key)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// dataTransfer(qtydata, QtyIndex, index.key, 0);
|
||||
// setModelQty(false)
|
||||
// }
|
||||
// }
|
||||
const Stockfun = (index) => {
|
||||
setVarientIndex(index.key);
|
||||
const variantDetails =
|
||||
|
|
@ -1537,7 +1480,14 @@ const BSItemCard = (props) => {
|
|||
}
|
||||
} else if (overallExpStatus === 'Y' && ExpiredProduct) {
|
||||
setVarItem(index.key);
|
||||
setexpVarModel(true);
|
||||
openExpireModal({
|
||||
title: 'Variant Expires',
|
||||
onOk: () => expVerFun(VarItem),
|
||||
onCancel: () => {
|
||||
setRepeatedModel(false);
|
||||
setProdexpir(false);
|
||||
},
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
|
|
@ -1613,7 +1563,14 @@ const BSItemCard = (props) => {
|
|||
}
|
||||
} else if (overallExpStatus === 'Y' && ExpiredProduct) {
|
||||
setVarItem(index.key);
|
||||
setexpVarModel(true);
|
||||
openExpireModal({
|
||||
title: 'Variant Expires',
|
||||
onOk: () => expVerFun(VarItem),
|
||||
onCancel: () => {
|
||||
setRepeatedModel(false);
|
||||
setProdexpir(false);
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1670,16 +1627,6 @@ const BSItemCard = (props) => {
|
|||
dataTransfer(qtydata, QtyIndex, index.key, 0, onePeiceFlow);
|
||||
}
|
||||
} else {
|
||||
// if (Isincart && Isincart?.StockAvailable === 'Y') {
|
||||
// if (Isincart?.BalanceQty > Isincart?.OrderQty) {
|
||||
// dataTransfer(qtydata, QtyIndex, index.key, 0, onePeiceFlow);
|
||||
// } else {
|
||||
// dataTransfer(qtydata, QtyIndex, index.key, 1, onePeiceFlow);
|
||||
// }
|
||||
// } else {
|
||||
// dataTransfer(qtydata, QtyIndex, index.key, 0, onePeiceFlow);
|
||||
// }
|
||||
|
||||
const findNextAvailableStockIndex = (
|
||||
stockDetails,
|
||||
CartOrderDetails,
|
||||
|
|
@ -1745,7 +1692,14 @@ const BSItemCard = (props) => {
|
|||
}
|
||||
} else if (overallExpStatus === 'Y' && ExpiredProduct) {
|
||||
setVarItem(index.key);
|
||||
setexpVarModel(true);
|
||||
openExpireModal({
|
||||
title: 'Variant Expires',
|
||||
onOk: () => expVerFun(VarItem),
|
||||
onCancel: () => {
|
||||
setRepeatedModel(false);
|
||||
setProdexpir(false);
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
setModelQty(false);
|
||||
|
|
@ -1757,7 +1711,14 @@ const BSItemCard = (props) => {
|
|||
(item) => item.OverAllExpStatus === 'Y'
|
||||
);
|
||||
if (QtyExpire && ExpiredProduct) {
|
||||
setExpQtyModel(true);
|
||||
openExpireModal({
|
||||
title: 'Quantity Expires',
|
||||
onOk: () => expQtyFun(qtyExpData),
|
||||
onCancel: () => {
|
||||
setRepeatedModel(false);
|
||||
(setProdexpir(false),closeExpireModal());
|
||||
},
|
||||
});
|
||||
setQtyExpData(index);
|
||||
} else {
|
||||
const selectedProIndex = qtydata?.ProductDetail?.findIndex(
|
||||
|
|
@ -2023,7 +1984,14 @@ const BSItemCard = (props) => {
|
|||
} else if (overallExpStatus === 'Y' && repeatedModel) {
|
||||
dataTransfer(qtydata, QtyIndex, VarientIndex, item.key, onePeiceFlow);
|
||||
} else {
|
||||
setexpStockModel(true);
|
||||
openExpireModal({
|
||||
title: 'Stock Expires',
|
||||
onOk: () => expStockFun(StockItem),
|
||||
onCancel: () => {
|
||||
setRepeatedModel(false);
|
||||
setProdexpir(false);
|
||||
},
|
||||
});
|
||||
setStockItem(item.key);
|
||||
}
|
||||
}
|
||||
|
|
@ -2032,178 +2000,9 @@ const BSItemCard = (props) => {
|
|||
setRepeatedModel(false);
|
||||
};
|
||||
|
||||
const pressTimer = useRef(null);
|
||||
const isLongPress = useRef(false);
|
||||
const [priceChangeProduct, setPriceChangeProduct] = useState([]);
|
||||
const [productPriceChange, setProductPriceChange] = useState(false);
|
||||
|
||||
const handleMouseDownItemCard = (e, item) => {
|
||||
isLongPress.current = false;
|
||||
|
||||
pressTimer.current = setTimeout(() => {
|
||||
if (
|
||||
!(
|
||||
(item?.OverAllQty !== undefined && !preferenceSingleSales
|
||||
? returnCount(
|
||||
item?.ProductDetail?.[0]?.ProdName,
|
||||
item?.OverAllQty,
|
||||
CartOrderDetails
|
||||
)
|
||||
: returnOnepcCount(
|
||||
item?.ProductDetail?.[0]?.ProdName,
|
||||
item?.OverAllPcs,
|
||||
CartOrderDetails
|
||||
)) > 0 ||
|
||||
item?.ProductDetail?.some((item) => item?.StockAvailable !== 'Y')
|
||||
)
|
||||
) {
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
isLongPress.current = true;
|
||||
handleLongPress(item);
|
||||
}
|
||||
}, 1000); // Adjust duration as needed
|
||||
};
|
||||
|
||||
const handleMouseUpItemCard = (e, item, check) => {
|
||||
clearTimeout(pressTimer.current);
|
||||
|
||||
if (!isLongPress.current) {
|
||||
// Your existing onClick logic
|
||||
if (
|
||||
!(
|
||||
(item?.OverAllQty !== undefined && !preferenceSingleSales
|
||||
? returnCount(
|
||||
item?.ProductDetail?.[0]?.ProdName,
|
||||
item?.OverAllQty,
|
||||
CartOrderDetails
|
||||
)
|
||||
: returnOnepcCount(
|
||||
item?.ProductDetail?.[0]?.ProdName,
|
||||
item?.OverAllPcs,
|
||||
CartOrderDetails
|
||||
)) > 0 ||
|
||||
item?.ProductDetail?.some((item) => item?.StockAvailable !== 'Y')
|
||||
)
|
||||
) {
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
if (check && !e.target.closest('.card4Main-onepiece')) {
|
||||
CardOnclick(
|
||||
item,
|
||||
item?.OnePcsAvailable === 'Y' &&
|
||||
preferenceSingleSales &&
|
||||
'OnePeiceProduct'
|
||||
);
|
||||
} else if (!check) {
|
||||
CardOnclick(
|
||||
item,
|
||||
item?.OnePcsAvailable === 'Y' &&
|
||||
preferenceSingleSales &&
|
||||
'OnePeiceProduct'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isLongPress.current = false;
|
||||
};
|
||||
|
||||
const handleMouseLeave = () => {
|
||||
clearTimeout(pressTimer.current);
|
||||
isLongPress.current = false;
|
||||
};
|
||||
|
||||
// Mobile - Touch Start
|
||||
const handleTouchStartItemCard = (e, item) => {
|
||||
e.preventDefault();
|
||||
isLongPress.current = false;
|
||||
|
||||
pressTimer.current = setTimeout(() => {
|
||||
if (
|
||||
!(
|
||||
(item?.OverAllQty !== undefined && !preferenceSingleSales
|
||||
? returnCount(
|
||||
item?.ProductDetail?.[0]?.ProdName,
|
||||
item?.OverAllQty,
|
||||
CartOrderDetails
|
||||
)
|
||||
: returnOnepcCount(
|
||||
item?.ProductDetail?.[0]?.ProdName,
|
||||
item?.OverAllPcs,
|
||||
CartOrderDetails
|
||||
)) > 0 ||
|
||||
item?.ProductDetail?.some((item) => item?.StockAvailable !== 'Y')
|
||||
)
|
||||
) {
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
isLongPress.current = true;
|
||||
handleLongPress(item);
|
||||
}
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
// Mobile - Touch End
|
||||
const handleTouchEndItemCard = (e, item, check = false) => {
|
||||
e.preventDefault();
|
||||
clearTimeout(pressTimer.current);
|
||||
|
||||
if (!isLongPress.current) {
|
||||
// Same logic as mouse up
|
||||
if (
|
||||
!(
|
||||
(item?.OverAllQty !== undefined && !preferenceSingleSales
|
||||
? returnCount(
|
||||
item?.ProductDetail?.[0]?.ProdName,
|
||||
item?.OverAllQty,
|
||||
CartOrderDetails
|
||||
)
|
||||
: returnOnepcCount(
|
||||
item?.ProductDetail?.[0]?.ProdName,
|
||||
item?.OverAllPcs,
|
||||
CartOrderDetails
|
||||
)) > 0 ||
|
||||
item?.ProductDetail?.some((item) => item?.StockAvailable !== 'Y')
|
||||
)
|
||||
) {
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
if (check && !e.target.closest('.card4Main-onepiece')) {
|
||||
CardOnclick(
|
||||
item,
|
||||
item?.OnePcsAvailable === 'Y' &&
|
||||
preferenceSingleSales &&
|
||||
'OnePeiceProduct'
|
||||
);
|
||||
} else if (!check) {
|
||||
CardOnclick(
|
||||
item,
|
||||
item?.OnePcsAvailable === 'Y' &&
|
||||
preferenceSingleSales &&
|
||||
'OnePeiceProduct'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isLongPress.current = false;
|
||||
};
|
||||
|
||||
// Mobile - Touch Cancel (when interrupted)
|
||||
const handleTouchCancelItemCard = () => {
|
||||
clearTimeout(pressTimer.current);
|
||||
isLongPress.current = false;
|
||||
};
|
||||
|
||||
const handleLongPress = (item) => {
|
||||
console.log('Long press triggered for:', item);
|
||||
setPriceChangeProduct([item]);
|
||||
setProductPriceChange(true);
|
||||
// Add your long press logic here
|
||||
// For example: open a context menu, show options, etc.
|
||||
};
|
||||
|
||||
const CardOnclick = async (item, Parameter) => {
|
||||
setOnePeiceFlow(Parameter === 'OnePeiceProduct');
|
||||
|
||||
|
|
@ -2223,7 +2022,10 @@ const BSItemCard = (props) => {
|
|||
Parameter === 'OnePeiceProduct' ? transformedItem : item;
|
||||
setQtydata(modiffiedData);
|
||||
if (modiffiedData.OverAllExpStatus === 'Y' && ExpiredProduct) {
|
||||
setexpModel(true);
|
||||
openExpireModal({
|
||||
title: 'Product Expires',
|
||||
onOk: () => expFun(Item),
|
||||
});
|
||||
setItem(modiffiedData);
|
||||
} else if (modiffiedData) {
|
||||
setQtydata(modiffiedData);
|
||||
|
|
@ -2345,19 +2147,6 @@ const BSItemCard = (props) => {
|
|||
)
|
||||
: [];
|
||||
|
||||
const freeProductAvailableForThisItem = hasOffer
|
||||
? OverAllproductBasedOfferDatas?.ProdDtl?.filter(
|
||||
(o) =>
|
||||
o?.ProdId === item?.ProdId &&
|
||||
o?.ProdVariantDetails?.some((variant) =>
|
||||
variant?.StockDetails?.some(
|
||||
(stock) =>
|
||||
stock?.InwardDtlId === item?.InwardDtlId && o?.MinQty > 0
|
||||
)
|
||||
)
|
||||
)
|
||||
: [];
|
||||
|
||||
const calculateTaxAmounts = (qty, rate, taxPercentage) => {
|
||||
const totalAmount = qty * rate;
|
||||
const taxAmount = (
|
||||
|
|
@ -2422,7 +2211,8 @@ const BSItemCard = (props) => {
|
|||
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||
? true
|
||||
: cartItem?.OfferMode !== 'B') &&
|
||||
cartItem?.OfferMode !== 'P' && cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O' &&
|
||||
cartItem?.OfferMode !== 'L'
|
||||
? true
|
||||
|
|
@ -2435,7 +2225,8 @@ const BSItemCard = (props) => {
|
|||
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||
? true
|
||||
: cartItem?.OfferMode !== 'B') &&
|
||||
cartItem?.OfferMode !== 'P' && cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O' &&
|
||||
cartItem?.OfferMode !== 'L'
|
||||
? true
|
||||
|
|
@ -2451,7 +2242,8 @@ const BSItemCard = (props) => {
|
|||
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||
? true
|
||||
: cartItem?.OfferMode !== 'B') &&
|
||||
cartItem?.OfferMode !== 'P' && cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O' &&
|
||||
cartItem?.OfferMode !== 'L'
|
||||
? true
|
||||
|
|
@ -2466,7 +2258,8 @@ const BSItemCard = (props) => {
|
|||
((cartItem?.OfferModeType && cartItem?.OfferMode === 'B'
|
||||
? true
|
||||
: cartItem?.OfferMode !== 'B') &&
|
||||
cartItem?.OfferMode !== 'P' && cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'P' &&
|
||||
cartItem?.OfferMode !== 'C' &&
|
||||
cartItem?.OfferMode !== 'O' &&
|
||||
cartItem?.OfferMode !== 'L'
|
||||
? true
|
||||
|
|
@ -2800,9 +2593,12 @@ const BSItemCard = (props) => {
|
|||
|
||||
const UpdatedCartItemWithOffer = {
|
||||
...item,
|
||||
Offer: (sameProduct || bestOffer?.OfferMode === 'I' || bestOffer?.OfferMode === 'Q')
|
||||
? (bestOffer?.OfferAmount || item.Offer)
|
||||
: (item.Offer || bestOffer?.OfferAmount),
|
||||
Offer:
|
||||
sameProduct ||
|
||||
bestOffer?.OfferMode === 'I' ||
|
||||
bestOffer?.OfferMode === 'Q'
|
||||
? bestOffer?.OfferAmount || item.Offer
|
||||
: item.Offer || bestOffer?.OfferAmount,
|
||||
OfferType: item?.OfferType || bestOffer?.OfferType,
|
||||
OfferMessage: item?.OfferMessage || bestOffer?.OfferMessage,
|
||||
OfferMode: item?.OfferMode || bestOffer?.OfferMode,
|
||||
|
|
@ -2817,7 +2613,8 @@ const BSItemCard = (props) => {
|
|||
((c?.OfferModeType && c?.OfferMode === 'B'
|
||||
? true
|
||||
: c?.OfferMode !== 'B') &&
|
||||
c?.OfferMode !== 'P' && c?.OfferMode !== 'C' &&
|
||||
c?.OfferMode !== 'P' &&
|
||||
c?.OfferMode !== 'C' &&
|
||||
c?.OfferMode !== 'O' &&
|
||||
c?.OfferMode !== 'L'
|
||||
? true
|
||||
|
|
@ -3134,7 +2931,6 @@ const BSItemCard = (props) => {
|
|||
};
|
||||
});
|
||||
|
||||
console.log(Postdata, 'Postdata');
|
||||
const response = await dispatch(
|
||||
bulkpostdata({ ProdDetails: Postdata })
|
||||
).unwrap();
|
||||
|
|
@ -5303,7 +5099,8 @@ const BSItemCard = (props) => {
|
|||
setVarItem(0);
|
||||
SingleQuantity(item, onePeiceFlow);
|
||||
}
|
||||
setexpModel(false);
|
||||
|
||||
closeExpireModal();
|
||||
setProdexpir(true);
|
||||
setQtydata(item);
|
||||
};
|
||||
|
|
@ -5409,7 +5206,7 @@ const BSItemCard = (props) => {
|
|||
|
||||
setQtyIndex(selectedProIndex);
|
||||
setRepeatedModel(true);
|
||||
setExpQtyModel(false);
|
||||
closeExpireModal()
|
||||
};
|
||||
|
||||
const expVerFun = (item) => {
|
||||
|
|
@ -5426,12 +5223,12 @@ const BSItemCard = (props) => {
|
|||
setModelQty(false);
|
||||
setSelectedBrand('Others');
|
||||
}
|
||||
setexpVarModel(false);
|
||||
closeExpireModal();
|
||||
};
|
||||
|
||||
const expStockFun = (item) => {
|
||||
dataTransfer(qtydata, QtyIndex, VarientIndex, item, onePeiceFlow);
|
||||
setexpStockModel(false);
|
||||
closeExpireModal();
|
||||
};
|
||||
|
||||
const getMaxBrandWidth = () => {
|
||||
|
|
@ -5463,17 +5260,7 @@ const BSItemCard = (props) => {
|
|||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
function handleResize() {
|
||||
setScreenHeight(window.innerHeight);
|
||||
}
|
||||
|
||||
window.addEventListener('resize', handleResize);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', handleResize);
|
||||
};
|
||||
}, []);
|
||||
|
||||
// Example usage for checking the length of 'ProdVariantDetails'
|
||||
const widthBasedOnProdVariantDetails = getMaxBrandWidth();
|
||||
|
|
@ -7502,107 +7289,19 @@ const BSItemCard = (props) => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{expModel && (
|
||||
<Modal
|
||||
title={
|
||||
<div
|
||||
style={{ display: 'flex', gap: '1rem', flexDirection: 'row' }}
|
||||
>
|
||||
<div>
|
||||
<ExclamationCircleOutlined
|
||||
style={{ color: 'rgb(231 176 12)', fontSize: '30px' }}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Product Expires</h4>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
open={expModel}
|
||||
onOk={() => expFun(Item)}
|
||||
onCancel={() => setexpModel(false)}
|
||||
okText="Submit"
|
||||
cancelText="Don't Submit"
|
||||
maskTransitionName="" // Remove animation for the mask
|
||||
transitionName=""
|
||||
></Modal>
|
||||
)}
|
||||
|
||||
{expQtyModel && (
|
||||
<Modal
|
||||
title={
|
||||
<div
|
||||
style={{ display: 'flex', gap: '1rem', flexDirection: 'row' }}
|
||||
>
|
||||
<ExclamationCircleOutlined
|
||||
style={{ color: 'rgb(231 176 12)', fontSize: '30px' }}
|
||||
/>
|
||||
<h3>Quantity Expires</h3>
|
||||
</div>
|
||||
}
|
||||
open={expQtyModel}
|
||||
onOk={() => expQtyFun(qtyExpData)}
|
||||
onCancel={() => {
|
||||
(setRepeatedModel(false),
|
||||
setProdexpir(false),
|
||||
setExpQtyModel(false));
|
||||
{expireModal?.open && (
|
||||
<ExpireConfirmModal
|
||||
open={expireModal?.open}
|
||||
title={expireModal?.title}
|
||||
onOk={() => {
|
||||
expireModal.onOk?.();
|
||||
closeExpireModal();
|
||||
}}
|
||||
okText="Submit"
|
||||
cancelText="Don't Submit"
|
||||
maskTransitionName=""
|
||||
transitionName=""
|
||||
></Modal>
|
||||
)}
|
||||
|
||||
{expVarModel && (
|
||||
<Modal
|
||||
title={
|
||||
<div
|
||||
style={{ display: 'flex', gap: '1rem', flexDirection: 'row' }}
|
||||
>
|
||||
<ExclamationCircleOutlined
|
||||
style={{ color: 'rgb(231 176 12)', fontSize: '30px' }}
|
||||
/>
|
||||
<h3>Variant Expires</h3>
|
||||
</div>
|
||||
}
|
||||
open={expVarModel}
|
||||
onOk={() => expVerFun(VarItem)}
|
||||
onCancel={() => {
|
||||
(setexpVarModel(false),
|
||||
setRepeatedModel(false),
|
||||
setProdexpir(false));
|
||||
expireModal.onCancel?.();
|
||||
closeExpireModal();
|
||||
}}
|
||||
okText="Submit"
|
||||
cancelText="Don't Submit"
|
||||
maskTransitionName=""
|
||||
transitionName=""
|
||||
></Modal>
|
||||
)}
|
||||
{expStockModel && (
|
||||
<Modal
|
||||
title={
|
||||
<div
|
||||
style={{ display: 'flex', gap: '1rem', flexDirection: 'row' }}
|
||||
>
|
||||
<ExclamationCircleOutlined
|
||||
style={{ color: 'rgb(231 176 12)', fontSize: '30px' }}
|
||||
/>
|
||||
<h3>Stock Expires</h3>
|
||||
</div>
|
||||
}
|
||||
open={expStockModel}
|
||||
onOk={() => expStockFun(StockItem)}
|
||||
onCancel={() => {
|
||||
(setexpStockModel(false),
|
||||
setRepeatedModel(false),
|
||||
setProdexpir(false));
|
||||
}}
|
||||
okText="Submit"
|
||||
cancelText="Don't Submit"
|
||||
maskTransitionName=""
|
||||
transitionName=""
|
||||
></Modal>
|
||||
)}
|
||||
|
||||
{modelQty && (
|
||||
|
|
|
|||
Loading…
Reference in New Issue