Added Emplyee Access missing names

This commit is contained in:
Srinath 2026-01-28 19:33:42 +05:30
parent f709705062
commit 966e582fa5
1 changed files with 33 additions and 16 deletions

View File

@ -5,7 +5,7 @@ import { DeleteFilled, PlusOutlined, ReloadOutlined } from '@ant-design/icons';
import { Messages } from '../../Components/Notifications/Messages'; import { Messages } from '../../Components/Notifications/Messages';
import { Tables } from '../../Components/Tables/Table'; import { Tables } from '../../Components/Tables/Table';
import { Search } from '../../Components/Forms/Search'; import { Search } from '../../Components/Forms/Search';
import { changeBreadCrumb } from '../../Features/AppPage/CenterPage.js'; import { changeBreadCrumb, getEmpAccess } from '../../Features/AppPage/CenterPage.js';
import Buttons from '../../Components/Forms/Buttons'; import Buttons from '../../Components/Forms/Buttons';
import { ExtractDateFormate, getSession } from '../../Services/Others'; import { ExtractDateFormate, getSession } from '../../Services/Others';
import FormHeader from '../PageComponents/FormHeader.jsx'; import FormHeader from '../PageComponents/FormHeader.jsx';
@ -34,7 +34,7 @@ const items = [
const SupplierProductMapping = () => { const SupplierProductMapping = () => {
const { SadminuserAccess } = useAuth(); const { SadminuserAccess } = useAuth();
const SAAccessCommonMaster = SadminuserAccess?.find( const SAAccessCommonMaster = SadminuserAccess?.find(
(e) => e?.MenuName === 'Supplier Product Mapping' (e) => e?.MenuName === 'Product Mapping'
); );
const [page, setpage] = useState(1); const [page, setpage] = useState(1);
@ -132,14 +132,13 @@ const SupplierProductMapping = () => {
}} }}
onClick={ onClick={
() => () =>
// ( ((UserType === 'Super Admin') ||
// (UserType === 'Super Admin') || (UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") ||
// (UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") || (UserType === 'Employee' && empData?.DeleteAccess === "Y") ||
// (UserType === 'Employee' && empData?.DeleteAccess === "Y") || (UserType === 'Admin'))
// (UserType === 'Admin')) ?
// ?
statusFormatter(record) statusFormatter(record)
// : null : null
} }
/> />
) : ( ) : (
@ -149,14 +148,13 @@ const SupplierProductMapping = () => {
}} }}
onClick={ onClick={
() => () =>
// ( ((UserType === 'Super Admin') ||
// (UserType === 'Super Admin') || (UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") ||
// (UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") || (UserType === 'Employee' && empData?.DeleteAccess === "Y") ||
// (UserType === 'Employee' && empData?.DeleteAccess === "Y") || (UserType === 'Admin'))
// (UserType === 'Admin')) ?
// ?
statusFormatter(record) statusFormatter(record)
// : null : null
} }
/> />
)} )}
@ -186,6 +184,25 @@ const SupplierProductMapping = () => {
setaddnewAccess(!hasAccess); setaddnewAccess(!hasAccess);
}, [empData, SAAccessCommonMaster, UserType]); }, [empData, SAAccessCommonMaster, UserType]);
useEffect(() => {
if (UserType === "Employee") {
fetchApi()
}
}, [UserType])
const fetchApi = async () => {
let data = {
CompId: CompId,
BranchId: BranchId,
AppId: AppId,
EmpId: UserId,
};
let response = await dispatch(getEmpAccess(data)).unwrap();
let datas = response?.data?.data?.[0]?.EmpAccessDetails?.filter(
(item) => item.ConfigName === 'Product Mapping'
);
setEmpData(datas?.[0]);
};
const handleModalCancel = () => { const handleModalCancel = () => {
setIsModalOpen(false); setIsModalOpen(false);
setModalSelectedSupplier(null); setModalSelectedSupplier(null);