brancloginfix
This commit is contained in:
parent
5b2367fe73
commit
3a35ed540c
|
|
@ -2,12 +2,14 @@ import { useState, useRef, useEffect } from 'react';
|
||||||
import { FaCaretRight } from "react-icons/fa";
|
import { FaCaretRight } from "react-icons/fa";
|
||||||
|
|
||||||
import './PozoMenu.scss';
|
import './PozoMenu.scss';
|
||||||
|
import { getSession, sessionStore } from '../../Services/Others';
|
||||||
|
|
||||||
const PozoMenu = ({ items = [], mode = "vertical", style = {}, onClick, collapse = false, selectedKey: propSelectedKey, isBottomMenu = false }) => {
|
const PozoMenu = ({ items = [], mode = "vertical", style = {}, onClick, collapse = false, selectedKey: propSelectedKey, isBottomMenu = false }) => {
|
||||||
const [openKeys, setOpenKeys] = useState([]);
|
const [openKeys, setOpenKeys] = useState([]);
|
||||||
const [selectedKey, setSelectedKey] = useState('');
|
const [selectedKey, setSelectedKey] = useState('');
|
||||||
const [dropdownPositions, setDropdownPositions] = useState({});
|
const [dropdownPositions, setDropdownPositions] = useState({});
|
||||||
const [isMobile, setIsMobile] = useState(window.innerWidth <= 768);
|
const [isMobile, setIsMobile] = useState(window.innerWidth <= 768);
|
||||||
|
const BranchId = getSession("BranchId");
|
||||||
const menuRef = useRef();
|
const menuRef = useRef();
|
||||||
|
|
||||||
// Update selected key when prop changes
|
// Update selected key when prop changes
|
||||||
|
|
@ -203,6 +205,11 @@ const PozoMenu = ({ items = [], mode = "vertical", style = {}, onClick, collapse
|
||||||
|
|
||||||
// Handle menu item click
|
// Handle menu item click
|
||||||
const handleMenuClick = (item, event, parentKeys = []) => {
|
const handleMenuClick = (item, event, parentKeys = []) => {
|
||||||
|
if (item?.label === "Branch Signin") {
|
||||||
|
if (BranchId) {
|
||||||
|
sessionStorage.removeItem("BranchId")
|
||||||
|
}
|
||||||
|
}
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
if (item.children && item.children.length > 0) {
|
if (item.children && item.children.length > 0) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState, lazy } from 'react';
|
||||||
import { useNavigate, useOutletContext } from 'react-router-dom';
|
import { useNavigate, useOutletContext } from 'react-router-dom';
|
||||||
import { shallowEqual, useDispatch } from 'react-redux';
|
import { shallowEqual, useDispatch } from 'react-redux';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { DatePicker, Tooltip } from 'antd';
|
import { DatePicker, message, Tooltip } from 'antd';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import '../../Styles/DashBoard/RetailDashBoard.scss';
|
import '../../Styles/DashBoard/RetailDashBoard.scss';
|
||||||
const GraphChart = lazy(() => import('./Chart/GraphChart'));
|
const GraphChart = lazy(() => import('./Chart/GraphChart'));
|
||||||
|
|
@ -128,6 +128,7 @@ const RetailDashboard = () => {
|
||||||
|
|
||||||
const CompId = getSession('CompId');
|
const CompId = getSession('CompId');
|
||||||
const BranchId = getSession('BranchId');
|
const BranchId = getSession('BranchId');
|
||||||
|
console.log(BranchId, "BranchId")
|
||||||
const AppId = getSession('AppId');
|
const AppId = getSession('AppId');
|
||||||
const UserId = getSession('UserId');
|
const UserId = getSession('UserId');
|
||||||
const UserType = getSession('UserType');
|
const UserType = getSession('UserType');
|
||||||
|
|
@ -310,7 +311,7 @@ const RetailDashboard = () => {
|
||||||
isMountedRef.current = false;
|
isMountedRef.current = false;
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
//sri checkin warehouse condition
|
//sri checkin warehouse condition
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const checkWarehouseorNot = async (e) => {
|
const checkWarehouseorNot = async (e) => {
|
||||||
let data = CompBranchData?.find((a) => a?.BrId == e);
|
let data = CompBranchData?.find((a) => a?.BrId == e);
|
||||||
|
|
@ -1652,6 +1653,10 @@ const RetailDashboard = () => {
|
||||||
<div className="quickActionsRow">
|
<div className="quickActionsRow">
|
||||||
<div
|
<div
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
if (!BranchId) {
|
||||||
|
message.error("Please log in to a branch first.");
|
||||||
|
return null
|
||||||
|
}
|
||||||
const hasEmpAccess = EmpData?.find(
|
const hasEmpAccess = EmpData?.find(
|
||||||
(item) =>
|
(item) =>
|
||||||
item.ConfigName === 'Add Product' &&
|
item.ConfigName === 'Add Product' &&
|
||||||
|
|
@ -1687,6 +1692,10 @@ const RetailDashboard = () => {
|
||||||
{!isCheckSportsApp && (
|
{!isCheckSportsApp && (
|
||||||
<div
|
<div
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
if (!BranchId) {
|
||||||
|
message.error("Please log in to a branch first.");
|
||||||
|
return null
|
||||||
|
}
|
||||||
const hasEmpAccess = EmpData?.find(
|
const hasEmpAccess = EmpData?.find(
|
||||||
(item) =>
|
(item) =>
|
||||||
item.ConfigName === 'Product Receipt' &&
|
item.ConfigName === 'Product Receipt' &&
|
||||||
|
|
@ -1715,6 +1724,10 @@ const RetailDashboard = () => {
|
||||||
)}
|
)}
|
||||||
<div
|
<div
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
if (!BranchId) {
|
||||||
|
message.error("Please log in to a branch first.");
|
||||||
|
return null
|
||||||
|
}
|
||||||
const hasEmpAccess = EmpData?.find(
|
const hasEmpAccess = EmpData?.find(
|
||||||
(item) =>
|
(item) =>
|
||||||
item.ConfigName === 'Daily Sales' &&
|
item.ConfigName === 'Daily Sales' &&
|
||||||
|
|
@ -1741,6 +1754,10 @@ const RetailDashboard = () => {
|
||||||
<div
|
<div
|
||||||
className="quickActionBox"
|
className="quickActionBox"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
if (!BranchId) {
|
||||||
|
message.error("Please log in to a branch first.");
|
||||||
|
return null
|
||||||
|
}
|
||||||
const hasEmpAccess = EmpData?.find(
|
const hasEmpAccess = EmpData?.find(
|
||||||
(item) =>
|
(item) =>
|
||||||
item.ConfigName === 'Sales' && item.ReadAccess === 'Y'
|
item.ConfigName === 'Sales' && item.ReadAccess === 'Y'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue