employee view
parent
7cff157014
commit
a88c95c90b
|
@ -75,7 +75,12 @@ export default function App() {
|
||||||
return (
|
return (
|
||||||
<Layout style={{ minHeight: "100vh" }}>
|
<Layout style={{ minHeight: "100vh" }}>
|
||||||
<HeaderProvider>
|
<HeaderProvider>
|
||||||
<SideBarProvider options={{ username: appUserData.user.username }}>
|
<SideBarProvider
|
||||||
|
options={{
|
||||||
|
username: appUserData.user.username,
|
||||||
|
permissions: appUserData.permissions,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<UserProfileProvider>
|
<UserProfileProvider>
|
||||||
<UsersProvider>
|
<UsersProvider>
|
||||||
<AppProvider>
|
<AppProvider>
|
||||||
|
|
|
@ -91,29 +91,37 @@ export function SideMenuContent({
|
||||||
children: [],
|
children: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (sideBarContext.permissions.includes("settings")) {
|
||||||
groupStore.children.push({
|
groupStore.children.push({
|
||||||
label: t("sideMenu.store.settings"),
|
label: t("sideMenu.store.settings"),
|
||||||
icon: <SettingOutlined />,
|
icon: <SettingOutlined />,
|
||||||
key: `${Constants.ROUTE_PATHS.STORE.SETTINGS}/${store.store_id}`,
|
key: `${Constants.ROUTE_PATHS.STORE.SETTINGS}/${store.store_id}`,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sideBarContext.permissions.includes("employees")) {
|
||||||
groupStore.children.push({
|
groupStore.children.push({
|
||||||
label: t("sideMenu.store.employees"),
|
label: t("sideMenu.store.employees"),
|
||||||
icon: <TeamOutlined />,
|
icon: <TeamOutlined />,
|
||||||
key: `${Constants.ROUTE_PATHS.STORE.EMPLOYEES}/${store.store_id}`,
|
key: `${Constants.ROUTE_PATHS.STORE.EMPLOYEES}/${store.store_id}`,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sideBarContext.permissions.includes("services")) {
|
||||||
groupStore.children.push({
|
groupStore.children.push({
|
||||||
label: t("sideMenu.store.services"),
|
label: t("sideMenu.store.services"),
|
||||||
icon: <ScissorOutlined />,
|
icon: <ScissorOutlined />,
|
||||||
key: `${Constants.ROUTE_PATHS.STORE.SERVICES}/${store.store_id}`,
|
key: `${Constants.ROUTE_PATHS.STORE.SERVICES}/${store.store_id}`,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sideBarContext.permissions.includes("calendar")) {
|
||||||
groupStore.children.push({
|
groupStore.children.push({
|
||||||
label: t("sideMenu.store.calendar"),
|
label: t("sideMenu.store.calendar"),
|
||||||
icon: <CalendarOutlined />,
|
icon: <CalendarOutlined />,
|
||||||
key: `${Constants.ROUTE_PATHS.STORE.CALENDAR}/${store.store_id}`,
|
key: `${Constants.ROUTE_PATHS.STORE.CALENDAR}/${store.store_id}`,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
stores.children.push(groupStore);
|
stores.children.push(groupStore);
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,6 +3,8 @@ import { createContext, useContext, useState } from "react";
|
||||||
const preview = {
|
const preview = {
|
||||||
username: "",
|
username: "",
|
||||||
setUsername: () => {},
|
setUsername: () => {},
|
||||||
|
permissions: [],
|
||||||
|
setPermissions: () => {},
|
||||||
};
|
};
|
||||||
|
|
||||||
const SideBarContext = createContext(preview);
|
const SideBarContext = createContext(preview);
|
||||||
|
@ -11,12 +13,15 @@ export const useSideBarContext = () => useContext(SideBarContext);
|
||||||
|
|
||||||
export default function SideBarProvider({ children, options }) {
|
export default function SideBarProvider({ children, options }) {
|
||||||
const [username, setUsername] = useState(options.username);
|
const [username, setUsername] = useState(options.username);
|
||||||
|
const [permissions, setPermissions] = useState(options.permissions);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SideBarContext.Provider
|
<SideBarContext.Provider
|
||||||
value={{
|
value={{
|
||||||
username,
|
username,
|
||||||
setUsername,
|
setUsername,
|
||||||
|
permissions,
|
||||||
|
setPermissions,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|
Loading…
Reference in New Issue