Merge pull request 'Fix #110 : Open Quick Add modal only when QRCode is selected' (#111) from enhancement/entryandquickadd into main
Reviewed-on: Pozomind/pozo-retail-app#111
This commit is contained in:
commit
4304076c8d
|
|
@ -1609,6 +1609,7 @@ const initialState = {
|
|||
salesBillEdit: false,
|
||||
previousOrderPayment: [],
|
||||
previousOrderOfferDetails: [],
|
||||
getmultipleSearchDatas: []
|
||||
};
|
||||
|
||||
const BookingData = createSlice({
|
||||
|
|
@ -2110,6 +2111,13 @@ const BookingData = createSlice({
|
|||
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;
|
||||
export const GlobalPreviousOrderOfferDetails = (state) =>
|
||||
state?.BookingData?.previousOrderOfferDetails;
|
||||
export const GlobalGetmultipleSearchDatas = (state) =>
|
||||
state?.BookingData?.getmultipleSearchDatas;
|
||||
|
||||
export default BookingData.reducer;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ import {
|
|||
changeCardData,
|
||||
GlobaldraggingComponent,
|
||||
GlobalCombocarddata,
|
||||
GlobalGetmultipleSearchDatas,
|
||||
getmultipleSearch,
|
||||
} from '../../../../Features/BookingScreen/BookingData/BookingData';
|
||||
import {
|
||||
GlobalPreOrderAdditem,
|
||||
|
|
@ -223,6 +225,7 @@ const BSComboItemCard = (props) => {
|
|||
SelectedGlobalCardColorDetail,
|
||||
shallowEqual
|
||||
);
|
||||
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual)
|
||||
const SelectedCardFont = useSelector(SelectedGlobalCardFont, shallowEqual);
|
||||
const CartOrderDetails = useSelector(GlobalOrderCardDetails, shallowEqual);
|
||||
const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual);
|
||||
|
|
@ -307,10 +310,25 @@ console.log(cardData, 'cardData combo card');
|
|||
useEffect(() => {
|
||||
if (AppId && CompId && BranchId) {
|
||||
fetchedit();
|
||||
GetmultipleSearchData()
|
||||
}
|
||||
|
||||
// dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission
|
||||
}, [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(() => {
|
||||
setPreOrderSelectedProdNames([]);
|
||||
|
|
@ -328,10 +346,13 @@ console.log(cardData, 'cardData combo card');
|
|||
if (noSubcatCardData) {
|
||||
setNoSubcatCardData();
|
||||
}
|
||||
if (ProductSearch?.length > 5) {
|
||||
|
||||
if (ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
|
||||
e => e.toLowerCase() === "qrcode"
|
||||
)) {
|
||||
setQuickAdd(true);
|
||||
}
|
||||
}, [ProductSearch]);
|
||||
}, [ProductSearch,GetmultipleSearchDatas]);
|
||||
|
||||
// useEffect(() => {
|
||||
// if (
|
||||
|
|
@ -4620,7 +4641,9 @@ console.log(cardData, 'cardData combo card');
|
|||
</SortableContext>
|
||||
</DndContext>
|
||||
</>
|
||||
) : ProductSearch?.length > 5 &&
|
||||
) : ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
|
||||
e => e.toLowerCase() === "qrcode"
|
||||
) &&
|
||||
(cardData?.length == 0 || cardData == undefined) ? (
|
||||
<div>
|
||||
{/* cardData mohan 18-04-2025 */}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ import {
|
|||
GlobalCategorieData,
|
||||
GlobalSubcategorieData,
|
||||
GlobalProductCardTrigger,
|
||||
GlobalGetmultipleSearchDatas,
|
||||
getmultipleSearch,
|
||||
} from '../../../../Features/BookingScreen/BookingData/BookingData';
|
||||
import {
|
||||
GlobalPreOrderAdditem,
|
||||
|
|
@ -244,6 +246,7 @@ const BSItemCard = (props) => {
|
|||
SelectedGlobalCardColorDetail,
|
||||
shallowEqual
|
||||
);
|
||||
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual)
|
||||
const SelectedCardFont = useSelector(SelectedGlobalCardFont, shallowEqual);
|
||||
const CartOrderDetails = useSelector(GlobalOrderCardDetails, shallowEqual);
|
||||
const SelectedDatas = useSelector(GlobalSelectedDatas, shallowEqual);
|
||||
|
|
@ -251,6 +254,7 @@ const BSItemCard = (props) => {
|
|||
const WSProductdata = useSelector(GlobalWSProduct, shallowEqual);
|
||||
const NewQrProductData = useSelector(GlobalNewQrProduct, shallowEqual);
|
||||
const ReportholdData = useSelector(GlobalReorderHoldDetails, shallowEqual);
|
||||
console.log(GetmultipleSearchDatas, "GetmultipleSearchDatas")
|
||||
const ReorderProductData = useSelector(
|
||||
GlobalReorderProductDetails,
|
||||
shallowEqual
|
||||
|
|
@ -1025,10 +1029,27 @@ const BSItemCard = (props) => {
|
|||
useEffect(() => {
|
||||
if (AppId && CompId && BranchId) {
|
||||
fetchedit();
|
||||
GetmultipleSearchData()
|
||||
}
|
||||
|
||||
// dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission
|
||||
}, [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(() => {
|
||||
setPreOrderSelectedProdNames([]);
|
||||
// dispatch(changePreOrderAdditem(null));
|
||||
|
|
@ -1043,10 +1064,14 @@ const BSItemCard = (props) => {
|
|||
if (noSubcatCardData) {
|
||||
setNoSubcatCardData();
|
||||
}
|
||||
if (ProductSearch?.length > 5) {
|
||||
|
||||
if (ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
|
||||
e => e.toLowerCase() === "qrcode"
|
||||
)) {
|
||||
setQuickAdd(true);
|
||||
}
|
||||
}, [ProductSearch]);
|
||||
}, [ProductSearch, GetmultipleSearchDatas]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
!initialRun &&
|
||||
|
|
@ -7433,7 +7458,12 @@ const BSItemCard = (props) => {
|
|||
</SortableContext>
|
||||
</DndContext>
|
||||
</>
|
||||
) : ProductSearch?.length > 5 &&
|
||||
)
|
||||
|
||||
|
||||
: ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
|
||||
e => e.toLowerCase() === "qrcode"
|
||||
) &&
|
||||
(cardData?.length == 0 || cardData == undefined) ? (
|
||||
<div>
|
||||
{/* cardData mohan 18-04-2025 */}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ import {
|
|||
changeCardData,
|
||||
GlobaldraggingComponent,
|
||||
GlobalCombocarddata,
|
||||
GlobalGetmultipleSearchDatas,
|
||||
getmultipleSearch,
|
||||
} from '../../../../Features/BookingScreen/BookingData/BookingData';
|
||||
import {
|
||||
GlobalPreOrderAdditem,
|
||||
|
|
@ -183,6 +185,7 @@ const BSOtherServiceItemCard = (props) => {
|
|||
SelectedGlobalCardColorDetail,
|
||||
shallowEqual
|
||||
);
|
||||
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual)
|
||||
const SelectedCardFont = useSelector(SelectedGlobalCardFont, shallowEqual);
|
||||
const CartOrderDetails = useSelector(GlobalOrderCardDetails, shallowEqual);
|
||||
console.log(CartOrderDetails, "CartOrderDetailsOTHERSERVICESITEMCARD");
|
||||
|
|
@ -269,11 +272,25 @@ const BSOtherServiceItemCard = (props) => {
|
|||
useEffect(() => {
|
||||
if (AppId && CompId && BranchId) {
|
||||
fetchedit();
|
||||
GetmultipleSearchData()
|
||||
}
|
||||
|
||||
// dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission
|
||||
}, [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(() => {
|
||||
setPreOrderSelectedProdNames([]);
|
||||
// dispatch(changePreOrderAdditem(null));
|
||||
|
|
@ -290,10 +307,13 @@ const BSOtherServiceItemCard = (props) => {
|
|||
if (noSubcatCardData) {
|
||||
setNoSubcatCardData();
|
||||
}
|
||||
if (ProductSearch?.length > 5) {
|
||||
if (ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
|
||||
e => e.toLowerCase() === "qrcode"
|
||||
)) {
|
||||
setQuickAdd(true);
|
||||
}
|
||||
}, [ProductSearch]);
|
||||
|
||||
}, [ProductSearch, GetmultipleSearchDatas]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
|
|
@ -4493,7 +4513,9 @@ console.log("AddOrderDetails item",item)
|
|||
</SortableContext>
|
||||
</DndContext>
|
||||
</>
|
||||
) : ProductSearch?.length > 5 &&
|
||||
) : ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
|
||||
e => e.toLowerCase() === "qrcode"
|
||||
) &&
|
||||
(cardData?.length == 0 || cardData == undefined) ? (
|
||||
<div>
|
||||
{/* cardData mohan 18-04-2025 */}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ import {
|
|||
slotTimeStatus,
|
||||
changeAddBookingDetailsTrigger,
|
||||
GlobalAddBookingDetailsTrigger,
|
||||
GlobalGetmultipleSearchDatas,
|
||||
getmultipleSearch,
|
||||
} from '../../../../Features/BookingScreen/BookingData/BookingData';
|
||||
import {
|
||||
GlobalPreOrderAdditem,
|
||||
|
|
@ -216,6 +218,7 @@ const BsBookingitemCard = (props) => {
|
|||
shallowEqual
|
||||
);
|
||||
// const SelectedCust = useSelector(GlobalSelOption, shallowEqual);
|
||||
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual)
|
||||
const RetailWSSalesType = useSelector(GlobalRetailWSSalesType, shallowEqual);
|
||||
// const CustDetails = SelectedCust ? SelectedCust : AddCustomerDetails?.[0];
|
||||
const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
|
||||
|
|
@ -1090,10 +1093,25 @@ const BsBookingitemCard = (props) => {
|
|||
useEffect(() => {
|
||||
if (AppId && CompId && BranchId) {
|
||||
fetchedit();
|
||||
GetmultipleSearchData()
|
||||
}
|
||||
|
||||
// dispatch(changepreOrder(false)); Commented to Add Normal Produts After Adding the Combo Pack !!!!!! Dont Touch Without Shifayath Permission
|
||||
}, [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(() => {
|
||||
setPreOrderSelectedProdNames([]);
|
||||
// dispatch(changePreOrderAdditem(null));
|
||||
|
|
@ -1126,10 +1144,12 @@ const BsBookingitemCard = (props) => {
|
|||
if (noSubcatCardData) {
|
||||
setNoSubcatCardData();
|
||||
}
|
||||
if (ProductSearch?.length > 5) {
|
||||
if (ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
|
||||
e => e.toLowerCase() === "qrcode"
|
||||
)) {
|
||||
setQuickAdd(true);
|
||||
}
|
||||
}, [ProductSearch]);
|
||||
}, [ProductSearch, GetmultipleSearchDatas]);
|
||||
useEffect(() => {
|
||||
if (
|
||||
!initialRun &&
|
||||
|
|
@ -5340,7 +5360,9 @@ const BsBookingitemCard = (props) => {
|
|||
</SortableContext>
|
||||
</DndContext>
|
||||
</>
|
||||
) : ProductSearch?.length > 5 &&
|
||||
) : ProductSearch?.length > 5 && GetmultipleSearchDatas.some(
|
||||
e => e.toLowerCase() === "qrcode"
|
||||
) &&
|
||||
(cardData?.length == 0 || cardData == undefined) ? (
|
||||
<div>
|
||||
{/* cardData mohan 18-04-2025 */}
|
||||
|
|
@ -6072,8 +6094,7 @@ const BsBookingitemCard = (props) => {
|
|||
return (
|
||||
<div
|
||||
key={idx}
|
||||
className={`slotTimingSelect ${
|
||||
isBooked
|
||||
className={`slotTimingSelect ${isBooked
|
||||
? 'booked'
|
||||
: isAlreadyAdded
|
||||
? 'incart'
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import React, { useEffect, useState } from "react";
|
||||
import { getSession } from "../../../../Services/Others";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { shallowEqual, useDispatch, useSelector } from "react-redux";
|
||||
import {
|
||||
getmultipleSearch,
|
||||
GlobalGetmultipleSearchDatas,
|
||||
PostProductSearch,
|
||||
} from "../../../../Features/BookingScreen/BookingData/BookingData";
|
||||
import Buttons from "../../../../Components/Forms/Buttons";
|
||||
|
|
@ -12,6 +13,7 @@ const MultipleSearch = ({ close }) => {
|
|||
const BranchId = getSession("BranchId");
|
||||
const AppId = getSession("AppId");
|
||||
const dispatch = useDispatch();
|
||||
const GetmultipleSearchDatas = useSelector(GlobalGetmultipleSearchDatas, shallowEqual)
|
||||
|
||||
const options = [
|
||||
{ label: "Product Name", value: "ProdName" },
|
||||
|
|
@ -29,7 +31,8 @@ const MultipleSearch = ({ close }) => {
|
|||
console.log(selectedValues, "selectedValuesselectedValues");
|
||||
|
||||
useEffect(() => {
|
||||
GetmultipleSearchData();
|
||||
// GetmultipleSearchData();
|
||||
setSelectedValues(GetmultipleSearchDatas)
|
||||
}, []);
|
||||
|
||||
const postMultipleSearch = async () => {
|
||||
|
|
@ -47,6 +50,7 @@ const MultipleSearch = ({ close }) => {
|
|||
const response = await dispatch(PostProductSearch(data)).unwrap();
|
||||
console.log("Search Response:", response);
|
||||
if (response?.data?.statusCode == 1) {
|
||||
GetmultipleSearchData();
|
||||
setSelectedValues("");
|
||||
close(false);
|
||||
}
|
||||
|
|
@ -63,21 +67,12 @@ const MultipleSearch = ({ close }) => {
|
|||
};
|
||||
|
||||
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) {
|
||||
console.error("Get Search Terms Error:", error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
|
|
|
|||
Loading…
Reference in New Issue