Added Emplyee Access missing names
This commit is contained in:
parent
f9a491ce01
commit
da44ac7535
|
|
@ -17,10 +17,15 @@ import { getSession } from '../../../../Services/Others';
|
|||
import Buttons from '../../../../Components/Forms/Buttons';
|
||||
import { BiSkipNext, BiSkipPrevious } from 'react-icons/bi';
|
||||
import { MdOutlineDisplaySettings } from "react-icons/md";
|
||||
import { useAuth } from '../../../../AuthContext';
|
||||
import { getEmpAccess } from '../../../../Features/AppPage/CenterPage';
|
||||
|
||||
|
||||
const BookingSelectionPage = (props) => {
|
||||
|
||||
const { SadminuserAccess } = useAuth();
|
||||
let SAAccessCommonMaster = SadminuserAccess?.find(
|
||||
(e) => e?.MenuName === 'Sales Screen'
|
||||
);
|
||||
const AppId = getSession('AppId');
|
||||
const UserId = getSession('UserId');
|
||||
const CompId = getSession('CompId');
|
||||
|
|
@ -42,6 +47,8 @@ const BookingSelectionPage = (props) => {
|
|||
console.log(SelectedTheme, "currentSlide")
|
||||
const [OthersCount, setOthersCount] = useState(1);
|
||||
const [isNext, isSetNext] = useState(true);
|
||||
const [empData, setEmpData] = useState();
|
||||
const [addnewAccess, setaddnewAccess] = useState(true);
|
||||
const rightIsLastSlide = currentSlide === mergedThemes.length - 1;
|
||||
const leftIsFirstSlide = currentSlide === 0 && OthersCount > 1;
|
||||
const [pendingSlide, setPendingSlide] = useState(null);
|
||||
|
|
@ -64,6 +71,40 @@ const BookingSelectionPage = (props) => {
|
|||
GetOthersTemplate()
|
||||
// gettemplatedetail()
|
||||
}, [])
|
||||
useEffect(() => {
|
||||
if (UserType === 'Employee') {
|
||||
fetchApi();
|
||||
}
|
||||
}, [UserType]);
|
||||
|
||||
useEffect(() => {
|
||||
let hasAccess = false;
|
||||
|
||||
if (UserType === 'Admin' || UserType === 'Super Admin') {
|
||||
hasAccess = true;
|
||||
} else if (UserType === 'Employee') {
|
||||
hasAccess = empData?.AddAccess === 'Y';
|
||||
} else if (UserType === 'Super Admin User') {
|
||||
hasAccess = SAAccessCommonMaster?.AddAccess === 'Y';
|
||||
}
|
||||
|
||||
setaddnewAccess(!hasAccess);
|
||||
}, [empData, SAAccessCommonMaster, 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 === 'Sales Screen'
|
||||
);
|
||||
setEmpData(datas?.[0]);
|
||||
};
|
||||
|
||||
const gettemplatedetail = async () => {
|
||||
let tempdetail = await dispatch(
|
||||
getTemplate({ CompId: CompId, BranchId: BranchId, AppId: AppId })
|
||||
|
|
@ -305,6 +346,7 @@ const BookingSelectionPage = (props) => {
|
|||
<Buttons
|
||||
buttonText="Save"
|
||||
color="901D77"
|
||||
disabled = {addnewAccess}
|
||||
handleSubmit={handleMainSubmit}
|
||||
icon={<ArrowRightOutlined />}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue