diff --git a/src/Pages/BranchLogin/BranchLogin.jsx b/src/Pages/BranchLogin/BranchLogin.jsx index 27c6da5..6276da8 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) => 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) => ( -