From 47b35ddd598da392655d25e87869d252e8d86815 Mon Sep 17 00:00:00 2001 From: Srinath Date: Thu, 5 Mar 2026 19:09:39 +0530 Subject: [PATCH 1/3] Added Warehouse getSession conditions --- src/ProtectedRoutes.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ProtectedRoutes.jsx b/src/ProtectedRoutes.jsx index 82a9e61..9636fc2 100644 --- a/src/ProtectedRoutes.jsx +++ b/src/ProtectedRoutes.jsx @@ -9,6 +9,7 @@ import { checkSession, getCompBranchData, getCommonAppPreference, + changeWarehouse, } from './Features/BrachLogin/BranchLogin.js'; import { clearSession, getSession } from './Services/Others'; import { @@ -39,6 +40,7 @@ const ProtectedRoutes = ({ routesConfig }) => { const BranchId = getSession('BranchId'); const UserId = getSession('UserId'); const sessionId = getSession('SessionId'); + const Warehouse = getSession('Warehouse'); const [accessCheckComplete, setAccessCheckComplete] = useState(false); const FeatureAddonData = useSelector(GlobalFeatAddOnData); useTemplate(CompId, BranchId, AppId); @@ -46,7 +48,12 @@ const ProtectedRoutes = ({ routesConfig }) => { useEffect(() => { getApplicationPreference(); }, []); - + //sri + useEffect(() => { + if (Warehouse) { + dispatch(changeWarehouse(true)); + } + }, [Warehouse]); const getApplicationPreference = async () => { await dispatch(getCommonAppPreference(AppId)).unwrap(); }; From 289e4744d312b6f421d4ff6b68caa3c0728d341f Mon Sep 17 00:00:00 2001 From: Srinath Date: Thu, 5 Mar 2026 19:10:38 +0530 Subject: [PATCH 2/3] Added Warehouse sessionStore --- src/Pages/BranchLogin/BranchLogin.jsx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Pages/BranchLogin/BranchLogin.jsx b/src/Pages/BranchLogin/BranchLogin.jsx index 391244f..700c86c 100644 --- a/src/Pages/BranchLogin/BranchLogin.jsx +++ b/src/Pages/BranchLogin/BranchLogin.jsx @@ -92,7 +92,6 @@ const BranchLogin = () => { setAftergetPin(true); } }, []); - useEffect(() => { if (aftergetPin == true && UserType == 'Super Admin User') { fetchData(seletedBranchData); @@ -117,7 +116,7 @@ const BranchLogin = () => { }; }, [seconds, disabled]); - const fetchData = async (e) => { + const fetchData = async (e, type) => { await sessionStore('BranchId', e); let data = { CompId: CompId, @@ -135,7 +134,7 @@ const BranchLogin = () => { (item) => item.SettingIdName === filterSettingIdName ); - if (res?.data?.statusCode == 1) { + if (res?.data?.statusCode == 1 && type !== 'W') { filteredDatas?.[0]?.SettingValue == 'Y' ? navigate(`${subDirectory}app-page/home`) : navigate(`${subDirectory}sales`); @@ -192,8 +191,12 @@ const BranchLogin = () => { const onChangeBranch = async (e) => { let data = CompBranchData?.find((a) => a?.BrId == e); - if (data?.LocationType == 'W') await dispatch(changeWarehouse(true)); + if (data?.LocationType == 'W') { + sessionStore("Warehouse", true) + await dispatch(changeWarehouse(true)); + } else { + sessionStore("Warehouse", false) await dispatch(changeWarehouse(false)); } @@ -204,7 +207,7 @@ const BranchLogin = () => { dispatch(changeOrderCardDetails([])); if (UserType != 'Super Admin User') { - await fetchData(e); + await fetchData(e, data?.LocationType); } else { const checkData = SAdminUserData?.filter( (item) => @@ -562,14 +565,12 @@ const BranchLogin = () => { {SelectTypeName === 'OTP' ? !FirstTimeOtp ? `send ${SelectTypeName.toLocaleLowerCase()}` - : `resend ${SelectTypeName.toLocaleLowerCase()}${ - seconds > 0 ? ` in ${seconds}s` : '' - }` + : `resend ${SelectTypeName.toLocaleLowerCase()}${seconds > 0 ? ` in ${seconds}s` : '' + }` : !FirstTimePin ? `send ${SelectTypeName.toLocaleLowerCase()}` - : `resend ${SelectTypeName.toLocaleLowerCase()}${ - seconds > 0 ? ` in ${seconds}s` : '' - }`} + : `resend ${SelectTypeName.toLocaleLowerCase()}${seconds > 0 ? ` in ${seconds}s` : '' + }`} From 770a65945a91e15a9fd82a2f81a7f5300477d663 Mon Sep 17 00:00:00 2001 From: Srinath Date: Thu, 5 Mar 2026 19:11:12 +0530 Subject: [PATCH 3/3] Added Warehouse condition --- src/Pages/DashBoard/RetailDashboard.jsx | 131 +++++++++++++----------- 1 file changed, 74 insertions(+), 57 deletions(-) diff --git a/src/Pages/DashBoard/RetailDashboard.jsx b/src/Pages/DashBoard/RetailDashboard.jsx index b4ce21e..f32fcfd 100644 --- a/src/Pages/DashBoard/RetailDashboard.jsx +++ b/src/Pages/DashBoard/RetailDashboard.jsx @@ -36,6 +36,7 @@ import { encryptedValuesUrlFun, ExtractDateFormate, getSession, + sessionStore, } from '../../Services/Others'; import { @@ -46,6 +47,7 @@ import { } from '../../Features/ProductPage/ProductPage.js'; import { ApplicationPreferences, + changeWarehouse, checkSession, GenerateLogout, getCompBranchData, @@ -308,6 +310,23 @@ const RetailDashboard = () => { isMountedRef.current = false; }; }, []); +//sri checkin warehouse condition + useEffect(() => { + const checkWarehouseorNot = async (e) => { + let data = CompBranchData?.find((a) => a?.BrId == e); + if (data?.LocationType == 'W') { + sessionStore("Warhouse", true) + await dispatch(changeWarehouse(true)); + } + else { + sessionStore("Warehouse", false) + await dispatch(changeWarehouse(false)); + } + } + if (CompBranchData?.length > 0 && BranchId) { + checkWarehouseorNot(BranchId) + } + }, [CompBranchData, BranchId]) useEffect(() => { if ( @@ -2183,24 +2202,24 @@ const RetailDashboard = () => { > {preorderData?.[0]?.BranchDtl ? preorderData?.[0]?.BranchDtl?.map( - (item, index) => ( -
- - {item.BranchName || 'N/A'} - -
- Total Orders: {item.TotalOrders || 0} -
-
- ) + (item, index) => ( +
+ + {item.BranchName || 'N/A'} + +
+ Total Orders: {item.TotalOrders || 0} +
+
) + ) : 'No Data'} } @@ -2223,24 +2242,24 @@ const RetailDashboard = () => { > {preorderData?.[0]?.BranchDtl ? preorderData?.[0]?.BranchDtl?.map( - (item, index) => ( -
- - {item.BranchName || 'N/A'} - -
- Total Orders: {item.PendingOrders || 0} -
-
- ) + (item, index) => ( +
+ + {item.BranchName || 'N/A'} + +
+ Total Orders: {item.PendingOrders || 0} +
+
) + ) : 'No Data'} } @@ -2263,24 +2282,24 @@ const RetailDashboard = () => { > {preorderData?.[0]?.BranchDtl ? preorderData?.[0]?.BranchDtl?.map( - (item, index) => ( -
- - {item.BranchName || 'N/A'} - -
- Total Orders: {item.CompletedOrders || 0} -
-
- ) + (item, index) => ( +
+ + {item.BranchName || 'N/A'} + +
+ Total Orders: {item.CompletedOrders || 0} +
+
) + ) : 'No Data'} } @@ -2440,14 +2459,12 @@ const RetailDashboard = () => { {SelectTypeName === 'OTP' ? !FirstTimeOtp ? `send ${SelectTypeName.toLocaleLowerCase()}` - : `resend ${SelectTypeName.toLocaleLowerCase()}${ - seconds > 0 ? ` in ${seconds}s` : '' - }` + : `resend ${SelectTypeName.toLocaleLowerCase()}${seconds > 0 ? ` in ${seconds}s` : '' + }` : !FirstTimePin ? `send ${SelectTypeName.toLocaleLowerCase()}` - : `resend ${SelectTypeName.toLocaleLowerCase()}${ - seconds > 0 ? ` in ${seconds}s` : '' - }`} + : `resend ${SelectTypeName.toLocaleLowerCase()}${seconds > 0 ? ` in ${seconds}s` : '' + }`}