From 966e582fa5a453139686ab2d91154402a551b9fc Mon Sep 17 00:00:00 2001 From: Srinath Date: Wed, 28 Jan 2026 19:33:42 +0530 Subject: [PATCH] Added Emplyee Access missing names --- .../SupplierProductMapping.jsx | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/src/Pages/SupplierProductMapping/SupplierProductMapping.jsx b/src/Pages/SupplierProductMapping/SupplierProductMapping.jsx index 1919b91..22dc242 100644 --- a/src/Pages/SupplierProductMapping/SupplierProductMapping.jsx +++ b/src/Pages/SupplierProductMapping/SupplierProductMapping.jsx @@ -5,7 +5,7 @@ import { DeleteFilled, PlusOutlined, ReloadOutlined } from '@ant-design/icons'; import { Messages } from '../../Components/Notifications/Messages'; import { Tables } from '../../Components/Tables/Table'; 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 { ExtractDateFormate, getSession } from '../../Services/Others'; import FormHeader from '../PageComponents/FormHeader.jsx'; @@ -34,7 +34,7 @@ const items = [ const SupplierProductMapping = () => { const { SadminuserAccess } = useAuth(); const SAAccessCommonMaster = SadminuserAccess?.find( - (e) => e?.MenuName === 'Supplier Product Mapping' + (e) => e?.MenuName === 'Product Mapping' ); const [page, setpage] = useState(1); @@ -132,14 +132,13 @@ const SupplierProductMapping = () => { }} onClick={ () => - // ( - // (UserType === 'Super Admin') || - // (UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") || - // (UserType === 'Employee' && empData?.DeleteAccess === "Y") || - // (UserType === 'Admin')) - // ? + ((UserType === 'Super Admin') || + (UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") || + (UserType === 'Employee' && empData?.DeleteAccess === "Y") || + (UserType === 'Admin')) + ? statusFormatter(record) - // : null + : null } /> ) : ( @@ -149,14 +148,13 @@ const SupplierProductMapping = () => { }} onClick={ () => - // ( - // (UserType === 'Super Admin') || - // (UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") || - // (UserType === 'Employee' && empData?.DeleteAccess === "Y") || - // (UserType === 'Admin')) - // ? + ((UserType === 'Super Admin') || + (UserType === "Super Admin User" && SAAccessCommonMaster?.DeleteAccess === "Y") || + (UserType === 'Employee' && empData?.DeleteAccess === "Y") || + (UserType === 'Admin')) + ? statusFormatter(record) - // : null + : null } /> )} @@ -186,6 +184,25 @@ const SupplierProductMapping = () => { setaddnewAccess(!hasAccess); }, [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 = () => { setIsModalOpen(false); setModalSelectedSupplier(null);