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