This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import store from "../store";
|
||||
import roles from "./roles";
|
||||
import lt from "../api/locale";
|
||||
|
||||
function addNavItem(title, icon, route) {
|
||||
store.state.navItems.push({
|
||||
@@ -15,11 +16,25 @@ function addNavItem(title, icon, route) {
|
||||
export default function initialize() {
|
||||
//clear the nav items either way
|
||||
store.state.navItems = [];
|
||||
//clear the locale text cache
|
||||
lt.ClearCache();
|
||||
if (store.state.authenticated) {
|
||||
//prefetch the always required localized text keys into the cache
|
||||
lt.PreFetch([
|
||||
"Service",
|
||||
"Dispatch",
|
||||
"Inventory",
|
||||
"Accounting",
|
||||
"Administration",
|
||||
"Operations",
|
||||
"HelpAboutAyaNova",
|
||||
"Logout"
|
||||
]);
|
||||
|
||||
//put nav items into store
|
||||
|
||||
//Everyone has a home
|
||||
addNavItem("Home", "home", "/");
|
||||
addNavItem(lt.Get("Home"), "home", "/");
|
||||
|
||||
if (
|
||||
roles.hasRole(roles.AuthorizationRoles.TechLimited) ||
|
||||
@@ -27,44 +42,44 @@ export default function initialize() {
|
||||
roles.hasRole(roles.AuthorizationRoles.SubContractorLimited) ||
|
||||
roles.hasRole(roles.AuthorizationRoles.SubContractorFull)
|
||||
) {
|
||||
addNavItem("Service", "toolbox", "/service");
|
||||
addNavItem(lt.Get("Service"), "toolbox", "/service");
|
||||
}
|
||||
|
||||
if (
|
||||
roles.hasRole(roles.AuthorizationRoles.DispatchLimited) ||
|
||||
roles.hasRole(roles.AuthorizationRoles.DispatchFull)
|
||||
) {
|
||||
addNavItem("Dispatch", "shipping-fast", "/dispatch");
|
||||
addNavItem(lt.Get("Dispatch"), "shipping-fast", "/dispatch");
|
||||
}
|
||||
|
||||
if (
|
||||
roles.hasRole(roles.AuthorizationRoles.InventoryLimited) ||
|
||||
roles.hasRole(roles.AuthorizationRoles.InventoryFull)
|
||||
) {
|
||||
addNavItem("Inventory", "dolly", "/inventory");
|
||||
addNavItem(lt.Get("Inventory"), "dolly", "/inventory");
|
||||
}
|
||||
|
||||
if (roles.hasRole(roles.AuthorizationRoles.AccountingFull)) {
|
||||
addNavItem("Accounting", "file-invoice-dollar", "/accounting");
|
||||
addNavItem(lt.Get("Accounting"), "file-invoice-dollar", "/accounting");
|
||||
}
|
||||
|
||||
if (
|
||||
roles.hasRole(roles.AuthorizationRoles.BizAdminLimited) ||
|
||||
roles.hasRole(roles.AuthorizationRoles.BizAdminFull)
|
||||
) {
|
||||
addNavItem("Administration", "user-tie", "/admin");
|
||||
addNavItem(lt.Get("Administration"), "user-tie", "/admin");
|
||||
}
|
||||
|
||||
if (
|
||||
roles.hasRole(roles.AuthorizationRoles.OpsAdminFull) ||
|
||||
roles.hasRole(roles.AuthorizationRoles.OpsAdminLimited)
|
||||
) {
|
||||
addNavItem("Operations", "cogs", "ops");
|
||||
addNavItem(lt.Get("Operations"), "cogs", "ops");
|
||||
}
|
||||
|
||||
//Everyone can see about and logout
|
||||
addNavItem("About", "info-circle", "/about");
|
||||
addNavItem("Log out", "sign-out-alt", "/login");
|
||||
addNavItem(lt.Get("HelpAboutAyaNova"), "info-circle", "/about");
|
||||
addNavItem(lt.Get("Logout"), "sign-out-alt", "/login");
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user