i added Constrain for quick add
This commit is contained in:
parent
6e269ca679
commit
c0e79a668f
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -244,7 +247,7 @@ const BSComboItemCard = (props) => {
|
||||||
const paymentloader = useSelector(GlobalPayementloader, shallowEqual);
|
const paymentloader = useSelector(GlobalPayementloader, shallowEqual);
|
||||||
const SessionData = useSelector(StoredSessionData, shallowEqual);
|
const SessionData = useSelector(StoredSessionData, shallowEqual);
|
||||||
const GlobalCombocarddatas = useSelector(GlobalCombocarddata);
|
const GlobalCombocarddatas = useSelector(GlobalCombocarddata);
|
||||||
console.log(GlobalCombocarddatas, 'GlobalCombocarddatas combo card');
|
console.log(GlobalCombocarddatas, 'GlobalCombocarddatas combo card');
|
||||||
const [messageType, setMessageType] = useState(null);
|
const [messageType, setMessageType] = useState(null);
|
||||||
const [messageData, setMessageData] = useState(null);
|
const [messageData, setMessageData] = useState(null);
|
||||||
const [repeatedModel, setRepeatedModel] = useState(false);
|
const [repeatedModel, setRepeatedModel] = useState(false);
|
||||||
|
|
@ -297,7 +300,7 @@ console.log(GlobalCombocarddatas, 'GlobalCombocarddatas combo card');
|
||||||
: GlobalCombocarddatas
|
: GlobalCombocarddatas
|
||||||
: '';
|
: '';
|
||||||
//
|
//
|
||||||
console.log(cardData, 'cardData combo card');
|
console.log(cardData, 'cardData combo card');
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// fetchedit();
|
// fetchedit();
|
||||||
getPreferenceStock();
|
getPreferenceStock();
|
||||||
|
|
@ -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 */}
|
||||||
|
|
@ -4632,7 +4655,7 @@ console.log(cardData, 'cardData combo card');
|
||||||
cardData={cardDataForNewPrd}
|
cardData={cardDataForNewPrd}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
className={!temp5 ? 'NodataFound' : 'NodataFound5'}
|
className={!temp5 ? 'NodataFound' : 'NodataFound5'}
|
||||||
|
|
|
||||||
|
|
@ -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,45 +7458,50 @@ const BSItemCard = (props) => {
|
||||||
</SortableContext>
|
</SortableContext>
|
||||||
</DndContext>
|
</DndContext>
|
||||||
</>
|
</>
|
||||||
) : ProductSearch?.length > 5 &&
|
)
|
||||||
(cardData?.length == 0 || cardData == undefined) ? (
|
|
||||||
<div>
|
|
||||||
{/* cardData mohan 18-04-2025 */}
|
: ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
|
||||||
<FeaturesFunctionalities
|
e => e.toLowerCase() === "qrcode"
|
||||||
handleQuickAddCancel={handleQuickCancel}
|
) &&
|
||||||
QuickAdd={QuickAdd}
|
(cardData?.length == 0 || cardData == undefined) ? (
|
||||||
ProductSearch={true}
|
<div>
|
||||||
ProductSearchType={'I'}
|
{/* cardData mohan 18-04-2025 */}
|
||||||
cardData={cardDataForNewPrd}
|
<FeaturesFunctionalities
|
||||||
/>
|
handleQuickAddCancel={handleQuickCancel}
|
||||||
</div>
|
QuickAdd={QuickAdd}
|
||||||
) : (
|
ProductSearch={true}
|
||||||
<>
|
ProductSearchType={'I'}
|
||||||
<div
|
cardData={cardDataForNewPrd}
|
||||||
className={!temp5 ? 'NodataFound' : 'NodataFound5'}
|
/>
|
||||||
style={{
|
</div>
|
||||||
display: globalAccessForOthers && 'none',
|
) : (
|
||||||
}}
|
<>
|
||||||
>
|
<div
|
||||||
<div align="center" class="fond">
|
className={!temp5 ? 'NodataFound' : 'NodataFound5'}
|
||||||
<div class="contener_general">
|
style={{
|
||||||
<div class="contener_mixte">
|
display: globalAccessForOthers && 'none',
|
||||||
<div class="ballcolor ball_1"> </div>
|
}}
|
||||||
</div>
|
>
|
||||||
<div class="contener_mixte">
|
<div align="center" class="fond">
|
||||||
<div class="ballcolor ball_2"> </div>
|
<div class="contener_general">
|
||||||
</div>
|
<div class="contener_mixte">
|
||||||
<div class="contener_mixte">
|
<div class="ballcolor ball_1"> </div>
|
||||||
<div class="ballcolor ball_3"> </div>
|
</div>
|
||||||
</div>
|
<div class="contener_mixte">
|
||||||
<div class="contener_mixte">
|
<div class="ballcolor ball_2"> </div>
|
||||||
<div class="ballcolor ball_4"> </div>
|
</div>
|
||||||
|
<div class="contener_mixte">
|
||||||
|
<div class="ballcolor ball_3"> </div>
|
||||||
|
</div>
|
||||||
|
<div class="contener_mixte">
|
||||||
|
<div class="ballcolor ball_4"> </div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</>
|
||||||
</>
|
)}
|
||||||
)}
|
|
||||||
{paymentloader === true && (
|
{paymentloader === true && (
|
||||||
<div class="Payment-loader1">
|
<div class="Payment-loader1">
|
||||||
<div class="Payment-loader">
|
<div class="Payment-loader">
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +59,7 @@ const MultipleSearch = ({ close }) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const GetmultipleSearchData = async () => {
|
const GetmultipleSearchData = async () => {
|
||||||
const data = {
|
const data = {
|
||||||
AppId,
|
AppId,
|
||||||
CompId,
|
CompId,
|
||||||
|
|
@ -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
|
||||||
|
|
@ -115,7 +110,7 @@ const MultipleSearch = ({ close }) => {
|
||||||
<Buttons
|
<Buttons
|
||||||
buttonText={"Submit"}
|
buttonText={"Submit"}
|
||||||
handleSubmit={postMultipleSearch}
|
handleSubmit={postMultipleSearch}
|
||||||
color="901D77"
|
color="901D77"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue