brancloginfix

This commit is contained in:
Tamilselvan 2026-03-10 15:49:03 +05:30
parent 5b2367fe73
commit 3a35ed540c
2 changed files with 31 additions and 7 deletions

View File

@ -2,12 +2,14 @@ import { useState, useRef, useEffect } from 'react';
import { FaCaretRight } from "react-icons/fa";
import './PozoMenu.scss';
import { getSession, sessionStore } from '../../Services/Others';
const PozoMenu = ({ items = [], mode = "vertical", style = {}, onClick, collapse = false, selectedKey: propSelectedKey, isBottomMenu = false }) => {
const [openKeys, setOpenKeys] = useState([]);
const [selectedKey, setSelectedKey] = useState('');
const [dropdownPositions, setDropdownPositions] = useState({});
const [isMobile, setIsMobile] = useState(window.innerWidth <= 768);
const BranchId = getSession("BranchId");
const menuRef = useRef();
// Update selected key when prop changes
@ -203,6 +205,11 @@ const PozoMenu = ({ items = [], mode = "vertical", style = {}, onClick, collapse
// Handle menu item click
const handleMenuClick = (item, event, parentKeys = []) => {
if (item?.label === "Branch Signin") {
if (BranchId) {
sessionStorage.removeItem("BranchId")
}
}
event.stopPropagation();
if (item.children && item.children.length > 0) {
@ -368,7 +375,7 @@ const PozoMenu = ({ items = [], mode = "vertical", style = {}, onClick, collapse
}
return defaultTop;
})(),
left: positions[item.key]?.left + 5 || 0,
left: positions[item.key]?.left + 5 || 0,
// width: 220,
width: 200,
maxHeight: 400,

View File

@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState, lazy } from 'react';
import { useNavigate, useOutletContext } from 'react-router-dom';
import { shallowEqual, useDispatch } from 'react-redux';
import { useSelector } from 'react-redux';
import { DatePicker, Tooltip } from 'antd';
import { DatePicker, message, Tooltip } from 'antd';
import dayjs from 'dayjs';
import '../../Styles/DashBoard/RetailDashBoard.scss';
const GraphChart = lazy(() => import('./Chart/GraphChart'));
@ -128,6 +128,7 @@ const RetailDashboard = () => {
const CompId = getSession('CompId');
const BranchId = getSession('BranchId');
console.log(BranchId, "BranchId")
const AppId = getSession('AppId');
const UserId = getSession('UserId');
const UserType = getSession('UserType');
@ -310,7 +311,7 @@ const RetailDashboard = () => {
isMountedRef.current = false;
};
}, []);
//sri checkin warehouse condition
//sri checkin warehouse condition
useEffect(() => {
const checkWarehouseorNot = async (e) => {
let data = CompBranchData?.find((a) => a?.BrId == e);
@ -318,10 +319,10 @@ const RetailDashboard = () => {
sessionStore("Warhouse", true)
await dispatch(changeWarehouse(true));
}
else {
sessionStore("Warehouse", false)
await dispatch(changeWarehouse(false));
}
else {
sessionStore("Warehouse", false)
await dispatch(changeWarehouse(false));
}
}
if (CompBranchData?.length > 0 && BranchId) {
checkWarehouseorNot(BranchId)
@ -1652,6 +1653,10 @@ const RetailDashboard = () => {
<div className="quickActionsRow">
<div
onClick={() => {
if (!BranchId) {
message.error("Please log in to a branch first.");
return null
}
const hasEmpAccess = EmpData?.find(
(item) =>
item.ConfigName === 'Add Product' &&
@ -1687,6 +1692,10 @@ const RetailDashboard = () => {
{!isCheckSportsApp && (
<div
onClick={() => {
if (!BranchId) {
message.error("Please log in to a branch first.");
return null
}
const hasEmpAccess = EmpData?.find(
(item) =>
item.ConfigName === 'Product Receipt' &&
@ -1715,6 +1724,10 @@ const RetailDashboard = () => {
)}
<div
onClick={() => {
if (!BranchId) {
message.error("Please log in to a branch first.");
return null
}
const hasEmpAccess = EmpData?.find(
(item) =>
item.ConfigName === 'Daily Sales' &&
@ -1741,6 +1754,10 @@ const RetailDashboard = () => {
<div
className="quickActionBox"
onClick={() => {
if (!BranchId) {
message.error("Please log in to a branch first.");
return null
}
const hasEmpAccess = EmpData?.find(
(item) =>
item.ConfigName === 'Sales' && item.ReadAccess === 'Y'