From 999cb2be295925727da5f5d1601c9797af81c476 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 3 Jan 2020 20:51:36 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 7 + ayanova/src/api/initialize.js | 254 +++++++++++++++++++++++----------- 2 files changed, 180 insertions(+), 81 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index f7c04fb3..02884ef7 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -52,6 +52,13 @@ SHELL / NAV / MENUS / LAYOUT TODO: Enforce role rights for menu items once it's stubbed out +TODO: Client login UI + - Maybe under HOME or maybe easier to control if there is no home? + - though dashboard is the default go to location..have to think on it + - Client CSRS + - Client Units + - Client workorders + TODO: Errors - make sure all user displayed errors have an error number if they might be something tech support needs to know (case 1854) - I guess this is a LT feature really - Once start then make sure documented in manual diff --git a/ayanova/src/api/initialize.js b/ayanova/src/api/initialize.js index c6ce5b22..18ad1af2 100644 --- a/ayanova/src/api/initialize.js +++ b/ayanova/src/api/initialize.js @@ -104,64 +104,100 @@ export default function initialize() { ); //****************** CUSTOMERS - //clear sublevel array - sub = []; + if ( + window.$gz.role.hasRole([ + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited, + window.$gz.role.AUTHORIZATION_ROLES.DispatchFull, + window.$gz.role.AUTHORIZATION_ROLES.DispatchLimited, + window.$gz.role.AUTHORIZATION_ROLES.TechFull, + window.$gz.role.AUTHORIZATION_ROLES.TechLimited, + window.$gz.role.AUTHORIZATION_ROLES.AccountingFull, + window.$gz.role.AUTHORIZATION_ROLES.SalesFull, + window.$gz.role.AUTHORIZATION_ROLES.SalesLimited + ]) + ) { + //clear sublevel array + sub = []; - //CUSTOMERS subitem - sub.push({ - title: window.$gz.locale.get("ClientList"), - icon: "address-card", - route: "/cust-customers", - key: key++ - }); + //CUSTOMERS subitem + sub.push({ + title: window.$gz.locale.get("ClientList"), + icon: "address-card", + route: "/cust-customers", + key: key++ + }); - //HEAD OFFICES subitem - sub.push({ - title: window.$gz.locale.get("HeadOfficeList"), - icon: "sitemap", - route: "/cust-headoffices", - key: key++ - }); + //HEAD OFFICES subitem + sub.push({ + title: window.$gz.locale.get("HeadOfficeList"), + icon: "sitemap", + route: "/cust-headoffices", + key: key++ + }); - // ** CUSTOMER (TOP) - addNavItem( - window.$gz.locale.get("ClientList"), - "address-book", - undefined, - sub, - key++ - ); + // ** CUSTOMER (TOP) + addNavItem( + window.$gz.locale.get("ClientList"), + "address-book", + undefined, + sub, + key++ + ); + } //****************** SERVICE if ( window.$gz.role.hasRole([ window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited, - window.$gz.role.AUTHORIZATION_ROLES.AccountingFull, window.$gz.role.AUTHORIZATION_ROLES.DispatchFull, window.$gz.role.AUTHORIZATION_ROLES.DispatchLimited, - window.$gz.role.AUTHORIZATION_ROLES.InventoryFull, - window.$gz.role.AUTHORIZATION_ROLES.InventoryLimitedKF + window.$gz.role.AUTHORIZATION_ROLES.TechFull, + window.$gz.role.AUTHORIZATION_ROLES.TechLimited, + window.$gz.role.AUTHORIZATION_ROLES.SalesFull, + window.$gz.role.AUTHORIZATION_ROLES.SalesLimited ]) ) { //clear sublevel array sub = []; - //SCHEDULE (combined) - sub.push({ - title: window.$gz.locale.get("Schedule"), - icon: "calendar-alt", - route: "/svc-schedule", - key: key++ - }); + if ( + window.$gz.role.hasRole([ + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited, + window.$gz.role.AUTHORIZATION_ROLES.DispatchFull, + window.$gz.role.AUTHORIZATION_ROLES.DispatchLimited, + window.$gz.role.AUTHORIZATION_ROLES.TechFull, + window.$gz.role.AUTHORIZATION_ROLES.TechLimited + ]) + ) { + sub.push({ + title: window.$gz.locale.get("Schedule"), + icon: "calendar-alt", + route: "/svc-schedule", + key: key++ + }); + } //WORKORDERS LIST (was service workorders) - sub.push({ - title: window.$gz.locale.get("WorkorderServiceList"), - icon: "tools", - route: "/svc-workorders", - key: key++ - }); + if ( + window.$gz.role.hasRole([ + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited, + window.$gz.role.AUTHORIZATION_ROLES.DispatchFull, + window.$gz.role.AUTHORIZATION_ROLES.DispatchLimited, + window.$gz.role.AUTHORIZATION_ROLES.TechFull, + window.$gz.role.AUTHORIZATION_ROLES.TechLimited + ]) + ) { + sub.push({ + title: window.$gz.locale.get("WorkorderServiceList"), + icon: "tools", + route: "/svc-workorders", + key: key++ + }); + } // //WORKORDER TEMPLATES LIST //this will be an item inside the workorders NEW menu or grid or wherever but it's not top level worthy @@ -174,6 +210,8 @@ export default function initialize() { // }); //QUOTE LIST + //NOTE: this is the only item in this service level area that is visible to Sales + //so there is no separate role check here as the service group role check supersedes this sub.push({ title: window.$gz.locale.get("WorkorderQuoteList"), icon: "edit", @@ -182,54 +220,108 @@ export default function initialize() { }); //PM LIST - sub.push({ - title: window.$gz.locale.get( - "WorkorderPreventiveMaintenanceList" - ), - icon: "business-time", - route: "/svc-pm-list", - key: key++ - }); + if ( + window.$gz.role.hasRole([ + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited, + window.$gz.role.AUTHORIZATION_ROLES.DispatchFull, + window.$gz.role.AUTHORIZATION_ROLES.DispatchLimited, + window.$gz.role.AUTHORIZATION_ROLES.TechFull, + window.$gz.role.AUTHORIZATION_ROLES.TechLimited + ]) + ) { + sub.push({ + title: window.$gz.locale.get( + "WorkorderPreventiveMaintenanceList" + ), + icon: "business-time", + route: "/svc-pm-list", + key: key++ + }); + } //UNITS subitem - sub.push({ - title: window.$gz.locale.get("UnitList"), - icon: "fan", - route: "/svc-units", - key: key++ - }); - - //UNIT MODELS subitem - sub.push({ - title: window.$gz.locale.get("UnitModels"), - icon: "dice-d20", - route: "/svc-unit-models", - key: key++ - }); + if ( + window.$gz.role.hasRole([ + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited, + window.$gz.role.AUTHORIZATION_ROLES.DispatchFull, + window.$gz.role.AUTHORIZATION_ROLES.DispatchLimited, + window.$gz.role.AUTHORIZATION_ROLES.TechFull, + window.$gz.role.AUTHORIZATION_ROLES.TechLimited + ]) + ) { + sub.push({ + title: window.$gz.locale.get("UnitList"), + icon: "fan", + route: "/svc-units", + key: key++ + }); + //UNIT MODELS subitem + sub.push({ + title: window.$gz.locale.get("UnitModels"), + icon: "dice-d20", + route: "/svc-unit-models", + key: key++ + }); + } //LOANERS subitem - sub.push({ - title: window.$gz.locale.get("LoanItemList"), - icon: "plug", - route: "/svc-loaners", - key: key++ - }); + if ( + window.$gz.role.hasRole([ + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited, + window.$gz.role.AUTHORIZATION_ROLES.DispatchFull, + window.$gz.role.AUTHORIZATION_ROLES.DispatchLimited, + window.$gz.role.AUTHORIZATION_ROLES.TechFull, + window.$gz.role.AUTHORIZATION_ROLES.TechLimited + ]) + ) { + sub.push({ + title: window.$gz.locale.get("LoanItemList"), + icon: "plug", + route: "/svc-loaners", + key: key++ + }); + } //CONTRACTS subitem - sub.push({ - title: window.$gz.locale.get("ContractList"), - icon: "file-contract", - route: "/svc-contracts", - key: key++ - }); + if ( + window.$gz.role.hasRole([ + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited, + window.$gz.role.AUTHORIZATION_ROLES.DispatchFull, + window.$gz.role.AUTHORIZATION_ROLES.DispatchLimited, + window.$gz.role.AUTHORIZATION_ROLES.TechFull, + window.$gz.role.AUTHORIZATION_ROLES.TechLimited + ]) + ) { + sub.push({ + title: window.$gz.locale.get("ContractList"), + icon: "file-contract", + route: "/svc-contracts", + key: key++ + }); + } //CUSTOMER SERVICE REQUESTS subitem - sub.push({ - title: window.$gz.locale.get("ClientServiceRequestList"), - icon: "child", - route: "/svc-csr-list", - key: key++ - }); + if ( + window.$gz.role.hasRole([ + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited, + window.$gz.role.AUTHORIZATION_ROLES.DispatchFull, + window.$gz.role.AUTHORIZATION_ROLES.DispatchLimited, + window.$gz.role.AUTHORIZATION_ROLES.TechFull, + window.$gz.role.AUTHORIZATION_ROLES.TechLimited + ]) + ) { + sub.push({ + title: window.$gz.locale.get("ClientServiceRequestList"), + icon: "child", + route: "/svc-csr-list", + key: key++ + }); + } //**** Service (TOP GROUP) addNavItem( @@ -326,7 +418,7 @@ export default function initialize() { window.$gz.role.AUTHORIZATION_ROLES.DispatchFull, window.$gz.role.AUTHORIZATION_ROLES.DispatchLimited, window.$gz.role.AUTHORIZATION_ROLES.InventoryFull, - window.$gz.role.AUTHORIZATION_ROLES.InventoryLimitedKF + window.$gz.role.AUTHORIZATION_ROLES.InventoryLimited ]) ) { addNavItem(