i added Constrain for quick add

This commit is contained in:
Tamilselvan 2026-02-09 15:43:03 +05:30
parent 6e269ca679
commit c0e79a668f
6 changed files with 1325 additions and 1224 deletions

View File

@ -1609,6 +1609,7 @@ const initialState = {
salesBillEdit: false, salesBillEdit: false,
previousOrderPayment: [], previousOrderPayment: [],
previousOrderOfferDetails: [], previousOrderOfferDetails: [],
getmultipleSearchDatas: []
}; };
const BookingData = createSlice({ const BookingData = createSlice({
@ -2110,6 +2111,13 @@ const BookingData = createSlice({
state.AllCustomers = []; state.AllCustomers = [];
} }
}); });
builder.addCase(getmultipleSearch.fulfilled, (state, action) => {
if (action?.payload?.data?.statusCode === 1) {
state.getmultipleSearchDatas = action?.payload?.data?.data[0]?.SearchTermDtl?.map((e) => e?.SearchTerm) || [];
} else {
state.getmultipleSearchDatas = [];
}
});
}, },
}); });
@ -2387,5 +2395,7 @@ export const GlobalPreviousOrderPayment = (state) =>
state?.BookingData?.previousOrderPayment; state?.BookingData?.previousOrderPayment;
export const GlobalPreviousOrderOfferDetails = (state) => export const GlobalPreviousOrderOfferDetails = (state) =>
state?.BookingData?.previousOrderOfferDetails; state?.BookingData?.previousOrderOfferDetails;
export const GlobalGetmultipleSearchDatas = (state) =>
state?.BookingData?.getmultipleSearchDatas;
export default BookingData.reducer; export default BookingData.reducer;

View File

@ -59,6 +59,8 @@ import {
changeCardData, changeCardData,
GlobaldraggingComponent, GlobaldraggingComponent,
GlobalCombocarddata, GlobalCombocarddata,
GlobalGetmultipleSearchDatas,
getmultipleSearch,
} from '../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../Features/BookingScreen/BookingData/BookingData';
import { import {
GlobalPreOrderAdditem, GlobalPreOrderAdditem,
@ -223,6 +225,7 @@ const BSComboItemCard = (props) => {
SelectedGlobalCardColorDetail, SelectedGlobalCardColorDetail,
shallowEqual shallowEqual
); );
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual)
const SelectedCardFont = useSelector(SelectedGlobalCardFont, shallowEqual); const SelectedCardFont = useSelector(SelectedGlobalCardFont, shallowEqual);
const CartOrderDetails = useSelector(GlobalOrderCardDetails, shallowEqual); const CartOrderDetails = useSelector(GlobalOrderCardDetails, shallowEqual);
const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual); const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual);
@ -307,10 +310,25 @@ console.log(cardData, 'cardData combo card');
useEffect(() => { useEffect(() => {
if (AppId && CompId && BranchId) { if (AppId && CompId && BranchId) {
fetchedit(); fetchedit();
GetmultipleSearchData()
} }
// dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission // dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission
}, [AppId, CompId, BranchId]); }, [AppId, CompId, BranchId]);
const GetmultipleSearchData = async () => {
const data = {
AppId,
CompId,
BranchId,
};
try {
const response = await dispatch(getmultipleSearch(data))
} catch (error) {
console.error("Get Search Terms Error:", error);
}
};
useEffect(() => { useEffect(() => {
setPreOrderSelectedProdNames([]); setPreOrderSelectedProdNames([]);
@ -328,10 +346,13 @@ console.log(cardData, 'cardData combo card');
if (noSubcatCardData) { if (noSubcatCardData) {
setNoSubcatCardData(); setNoSubcatCardData();
} }
if (ProductSearch?.length > 5) {
if (ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
e => e.toLowerCase() === "qrcode"
)) {
setQuickAdd(true); setQuickAdd(true);
} }
}, [ProductSearch]); }, [ProductSearch,GetmultipleSearchDatas]);
// useEffect(() => { // useEffect(() => {
// if ( // if (
@ -4620,7 +4641,9 @@ console.log(cardData, 'cardData combo card');
</SortableContext> </SortableContext>
</DndContext> </DndContext>
</> </>
) : ProductSearch?.length > 5 && ) : ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
e => e.toLowerCase() === "qrcode"
) &&
(cardData?.length == 0 || cardData == undefined) ? ( (cardData?.length == 0 || cardData == undefined) ? (
<div> <div>
{/* cardData mohan 18-04-2025 */} {/* cardData mohan 18-04-2025 */}

View File

@ -64,6 +64,8 @@ import {
GlobalCategorieData, GlobalCategorieData,
GlobalSubcategorieData, GlobalSubcategorieData,
GlobalProductCardTrigger, GlobalProductCardTrigger,
GlobalGetmultipleSearchDatas,
getmultipleSearch,
} from '../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../Features/BookingScreen/BookingData/BookingData';
import { import {
GlobalPreOrderAdditem, GlobalPreOrderAdditem,
@ -244,6 +246,7 @@ const BSItemCard = (props) => {
SelectedGlobalCardColorDetail, SelectedGlobalCardColorDetail,
shallowEqual shallowEqual
); );
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual)
const SelectedCardFont = useSelector(SelectedGlobalCardFont, shallowEqual); const SelectedCardFont = useSelector(SelectedGlobalCardFont, shallowEqual);
const CartOrderDetails = useSelector(GlobalOrderCardDetails, shallowEqual); const CartOrderDetails = useSelector(GlobalOrderCardDetails, shallowEqual);
const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual); const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual);
@ -251,6 +254,7 @@ const BSItemCard = (props) => {
const WSProductdata = useSelector(GlobalWSProduct, shallowEqual); const WSProductdata = useSelector(GlobalWSProduct, shallowEqual);
const NewQrProductData = useSelector(GlobalNewQrProduct, shallowEqual); const NewQrProductData = useSelector(GlobalNewQrProduct, shallowEqual);
const ReportholdData = useSelector(GlobalReorderHoldDetails, shallowEqual); const ReportholdData = useSelector(GlobalReorderHoldDetails, shallowEqual);
console.log(GetmultipleSearchDatas, "GetmultipleSearchDatas")
const ReorderProductData = useSelector( const ReorderProductData = useSelector(
GlobalReorderProductDetails, GlobalReorderProductDetails,
shallowEqual shallowEqual
@ -1025,10 +1029,27 @@ const BSItemCard = (props) => {
useEffect(() => { useEffect(() => {
if (AppId && CompId && BranchId) { if (AppId && CompId && BranchId) {
fetchedit(); fetchedit();
GetmultipleSearchData()
} }
// dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission // dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission
}, [AppId, CompId, BranchId]); }, [AppId, CompId, BranchId]);
const GetmultipleSearchData = async () => {
const data = {
AppId,
CompId,
BranchId,
};
try {
const response = await dispatch(getmultipleSearch(data))
} catch (error) {
console.error("Get Search Terms Error:", error);
}
};
useEffect(() => { useEffect(() => {
setPreOrderSelectedProdNames([]); setPreOrderSelectedProdNames([]);
// dispatch(changePreOrderAdditem(null)); // dispatch(changePreOrderAdditem(null));
@ -1043,10 +1064,14 @@ const BSItemCard = (props) => {
if (noSubcatCardData) { if (noSubcatCardData) {
setNoSubcatCardData(); setNoSubcatCardData();
} }
if (ProductSearch?.length > 5) {
if (ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
e => e.toLowerCase() === "qrcode"
)) {
setQuickAdd(true); setQuickAdd(true);
} }
}, [ProductSearch]); }, [ProductSearch, GetmultipleSearchDatas]);
useEffect(() => { useEffect(() => {
if ( if (
!initialRun && !initialRun &&
@ -7433,7 +7458,12 @@ const BSItemCard = (props) => {
</SortableContext> </SortableContext>
</DndContext> </DndContext>
</> </>
) : ProductSearch?.length > 5 && )
: ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
e => e.toLowerCase() === "qrcode"
) &&
(cardData?.length == 0 || cardData == undefined) ? ( (cardData?.length == 0 || cardData == undefined) ? (
<div> <div>
{/* cardData mohan 18-04-2025 */} {/* cardData mohan 18-04-2025 */}

View File

@ -59,6 +59,8 @@ import {
changeCardData, changeCardData,
GlobaldraggingComponent, GlobaldraggingComponent,
GlobalCombocarddata, GlobalCombocarddata,
GlobalGetmultipleSearchDatas,
getmultipleSearch,
} from '../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../Features/BookingScreen/BookingData/BookingData';
import { import {
GlobalPreOrderAdditem, GlobalPreOrderAdditem,
@ -183,6 +185,7 @@ const BSOtherServiceItemCard = (props) => {
SelectedGlobalCardColorDetail, SelectedGlobalCardColorDetail,
shallowEqual shallowEqual
); );
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual)
const SelectedCardFont = useSelector(SelectedGlobalCardFont, shallowEqual); const SelectedCardFont = useSelector(SelectedGlobalCardFont, shallowEqual);
const CartOrderDetails = useSelector(GlobalOrderCardDetails, shallowEqual); const CartOrderDetails = useSelector(GlobalOrderCardDetails, shallowEqual);
console.log(CartOrderDetails, "CartOrderDetailsOTHERSERVICESITEMCARD"); console.log(CartOrderDetails, "CartOrderDetailsOTHERSERVICESITEMCARD");
@ -269,11 +272,25 @@ const BSOtherServiceItemCard = (props) => {
useEffect(() => { useEffect(() => {
if (AppId && CompId && BranchId) { if (AppId && CompId && BranchId) {
fetchedit(); fetchedit();
GetmultipleSearchData()
} }
// dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission // dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission
}, [AppId, CompId, BranchId]); }, [AppId, CompId, BranchId]);
const GetmultipleSearchData = async () => {
const data = {
AppId,
CompId,
BranchId,
};
try {
const response = await dispatch(getmultipleSearch(data))
} catch (error) {
console.error("Get Search Terms Error:", error);
}
};
useEffect(() => { useEffect(() => {
setPreOrderSelectedProdNames([]); setPreOrderSelectedProdNames([]);
// dispatch(changePreOrderAdditem(null)); // dispatch(changePreOrderAdditem(null));
@ -290,10 +307,13 @@ const BSOtherServiceItemCard = (props) => {
if (noSubcatCardData) { if (noSubcatCardData) {
setNoSubcatCardData(); setNoSubcatCardData();
} }
if (ProductSearch?.length > 5) { if (ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
e => e.toLowerCase() === "qrcode"
)) {
setQuickAdd(true); setQuickAdd(true);
} }
}, [ProductSearch]);
}, [ProductSearch, GetmultipleSearchDatas]);
useEffect(() => { useEffect(() => {
if ( if (
@ -4493,7 +4513,9 @@ console.log("AddOrderDetails item",item)
</SortableContext> </SortableContext>
</DndContext> </DndContext>
</> </>
) : ProductSearch?.length > 5 && ) : ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
e => e.toLowerCase() === "qrcode"
) &&
(cardData?.length == 0 || cardData == undefined) ? ( (cardData?.length == 0 || cardData == undefined) ? (
<div> <div>
{/* cardData mohan 18-04-2025 */} {/* cardData mohan 18-04-2025 */}

View File

@ -69,6 +69,8 @@ import {
slotTimeStatus, slotTimeStatus,
changeAddBookingDetailsTrigger, changeAddBookingDetailsTrigger,
GlobalAddBookingDetailsTrigger, GlobalAddBookingDetailsTrigger,
GlobalGetmultipleSearchDatas,
getmultipleSearch,
} from '../../../../Features/BookingScreen/BookingData/BookingData'; } from '../../../../Features/BookingScreen/BookingData/BookingData';
import { import {
GlobalPreOrderAdditem, GlobalPreOrderAdditem,
@ -216,6 +218,7 @@ const BsBookingitemCard = (props) => {
shallowEqual shallowEqual
); );
// const SelectedCust = useSelector(GlobalSelOption, shallowEqual); // const SelectedCust = useSelector(GlobalSelOption, shallowEqual);
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual)
const RetailWSSalesType = useSelector(GlobalRetailWSSalesType, shallowEqual); const RetailWSSalesType = useSelector(GlobalRetailWSSalesType, shallowEqual);
// const CustDetails = SelectedCust ? SelectedCust : AddCustomerDetails?.[0]; // const CustDetails = SelectedCust ? SelectedCust : AddCustomerDetails?.[0];
const BookingTypeBoth = useSelector(GlobalBookingTypeBoth); const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
@ -1090,10 +1093,25 @@ const BsBookingitemCard = (props) => {
useEffect(() => { useEffect(() => {
if (AppId && CompId && BranchId) { if (AppId && CompId && BranchId) {
fetchedit(); fetchedit();
GetmultipleSearchData()
} }
// dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission // dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission
}, [AppId, CompId, BranchId]); }, [AppId, CompId, BranchId]);
const GetmultipleSearchData = async () => {
const data = {
AppId,
CompId,
BranchId,
};
try {
const response = await dispatch(getmultipleSearch(data))
} catch (error) {
console.error("Get Search Terms Error:", error);
}
};
useEffect(() => { useEffect(() => {
setPreOrderSelectedProdNames([]); setPreOrderSelectedProdNames([]);
// dispatch(changePreOrderAdditem(null)); // dispatch(changePreOrderAdditem(null));
@ -1126,10 +1144,12 @@ const BsBookingitemCard = (props) => {
if (noSubcatCardData) { if (noSubcatCardData) {
setNoSubcatCardData(); setNoSubcatCardData();
} }
if (ProductSearch?.length > 5) { if (ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
e => e.toLowerCase() === "qrcode"
)) {
setQuickAdd(true); setQuickAdd(true);
} }
}, [ProductSearch]); }, [ProductSearch, GetmultipleSearchDatas]);
useEffect(() => { useEffect(() => {
if ( if (
!initialRun && !initialRun &&
@ -5340,7 +5360,9 @@ const BsBookingitemCard = (props) => {
</SortableContext> </SortableContext>
</DndContext> </DndContext>
</> </>
) : ProductSearch?.length > 5 && ) : ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
e => e.toLowerCase() === "qrcode"
) &&
(cardData?.length == 0 || cardData == undefined) ? ( (cardData?.length == 0 || cardData == undefined) ? (
<div> <div>
{/* cardData mohan 18-04-2025 */} {/* cardData mohan 18-04-2025 */}
@ -6072,8 +6094,7 @@ const BsBookingitemCard = (props) => {
return ( return (
<div <div
key={idx} key={idx}
className={`slotTimingSelect ${ className={`slotTimingSelect ${isBooked
isBooked
? 'booked' ? 'booked'
: isAlreadyAdded : isAlreadyAdded
? 'incart' ? 'incart'

View File

@ -1,8 +1,9 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { getSession } from "../../../../Services/Others"; import { getSession } from "../../../../Services/Others";
import { useDispatch } from "react-redux"; import { shallowEqual, useDispatch, useSelector } from "react-redux";
import { import {
getmultipleSearch, getmultipleSearch,
GlobalGetmultipleSearchDatas,
PostProductSearch, PostProductSearch,
} from "../../../../Features/BookingScreen/BookingData/BookingData"; } from "../../../../Features/BookingScreen/BookingData/BookingData";
import Buttons from "../../../../Components/Forms/Buttons"; import Buttons from "../../../../Components/Forms/Buttons";
@ -12,6 +13,7 @@ const MultipleSearch = ({ close }) => {
const BranchId = getSession("BranchId"); const BranchId = getSession("BranchId");
const AppId = getSession("AppId"); const AppId = getSession("AppId");
const dispatch = useDispatch(); const dispatch = useDispatch();
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual)
const options = [ const options = [
{ label: "Product Name", value: "ProdName" }, { label: "Product Name", value: "ProdName" },
@ -29,7 +31,8 @@ const MultipleSearch = ({ close }) => {
console.log(selectedValues, "selectedValuesselectedValues"); console.log(selectedValues, "selectedValuesselectedValues");
useEffect(() => { useEffect(() => {
GetmultipleSearchData(); // GetmultipleSearchData();
setSelectedValues(GetmultipleSearchDatas)
}, []); }, []);
const postMultipleSearch = async () => { const postMultipleSearch = async () => {
@ -47,6 +50,7 @@ const MultipleSearch = ({ close }) => {
const response = await dispatch(PostProductSearch(data)).unwrap(); const response = await dispatch(PostProductSearch(data)).unwrap();
console.log("Search Response:", response); console.log("Search Response:", response);
if (response?.data?.statusCode == 1) { if (response?.data?.statusCode == 1) {
GetmultipleSearchData();
setSelectedValues(""); setSelectedValues("");
close(false); close(false);
} }
@ -63,21 +67,12 @@ const MultipleSearch = ({ close }) => {
}; };
try { try {
const response = await dispatch(getmultipleSearch(data)).unwrap(); const response = await dispatch(getmultipleSearch(data))
if (response?.data?.statusCode === 1) {
const selected =
response?.data?.data?.[0]?.SearchTermDtl?.map(
(item) => item?.SearchTerm,
) || [];
setSelectedValues(selected);
}
} catch (error) { } catch (error) {
console.error("Get Search Terms Error:", error); console.error("Get Search Terms Error:", error);
} }
}; };
return ( return (
<> <>
<div <div