From 39b5587f4eae7b81078382baeb5e1318b9ea89b2 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sat, 5 Dec 2020 01:17:25 +0000 Subject: [PATCH] --- ayanova/src/api/initialize.js | 420 +++++++++++++++------------------- 1 file changed, 179 insertions(+), 241 deletions(-) diff --git a/ayanova/src/api/initialize.js b/ayanova/src/api/initialize.js index 8342af61..5bfb1a2b 100644 --- a/ayanova/src/api/initialize.js +++ b/ayanova/src/api/initialize.js @@ -37,7 +37,7 @@ function initNavPanel() { window.$gz.store.state.userType == 4; let isSubcontractorTypeUser = window.$gz.store.state.userType == 5; - //### ALL OUTSIDE TYPE USERS (CUSTOMER / HEADOFFICE) ### + //########## OUTSIDE USERS GROUP (CUSTOMER / HEADOFFICE) ### if (isCustomerTypeUser) { //clear sublevel array sub = []; @@ -86,7 +86,7 @@ function initNavPanel() { //###### ALL INSIDE USERS FROM HERE DOWN ############### - //******* EXPIRED LICENSE BLOCK + //###### EXPIRED LICENSE GROUP //Status NONE, EXPIREDTRIAL, EXPIREDPURCHASE, REVOKED //only show license and logout @@ -119,14 +119,9 @@ function initNavPanel() { return; } - //******* LICENSE OK, set up menu options for inside users... - - //####### HOME - - //all inside users + //####### HOME GROUP //DASHBOARD - //KPI / METRICS / CHARTS AND STUFF APPROPRIATE TO ROLE sub.push({ title: "Dashboard", icon: "$ayiTachometer", @@ -135,7 +130,6 @@ function initNavPanel() { }); //SEARCH - sub.push({ title: "Search", icon: "$ayiSearch", @@ -184,7 +178,6 @@ function initNavPanel() { }); //USER NOTIFICATION SUBSCRIPTIONS - sub.push({ title: "NotifySubscriptionList", icon: "$ayiBullhorn", @@ -199,9 +192,8 @@ function initNavPanel() { addNavItem("Home", "$ayiHome", undefined, sub, key++, "home"); } - //######### CUSTOMERS + //######### CUSTOMER GROUP if (window.$gz.role.canOpen(window.$gz.type.Customer)) { - //these all require Customer rights so all in the same block //clear sublevel array @@ -242,222 +234,154 @@ function initNavPanel() { ); } - //****************** SERVICE + //####### SERVICE GROUP + + sub = []; + + //SCHEDULE (service) if ( - window.$gz.role.hasRole([ - role.BizAdminFull, - role.BizAdminLimited, - role.DispatchFull, - role.DispatchLimited, - role.TechFull, - role.TechLimited, - role.SalesFull, - role.SalesLimited - ]) + window.$gz.role.canOpen(window.$gz.type.WorkOrder) || + window.$gz.role.canOpen(window.$gz.type.Quote) || + window.$gz.role.canOpen(window.$gz.type.PM) ) { - //clear sublevel array - sub = []; - //SCHEDULE (combined) - if ( - window.$gz.role.hasRole([ - role.BizAdminFull, - role.BizAdminLimited, - role.DispatchFull, - role.DispatchLimited, - role.TechFull, - role.TechLimited - ]) - ) { - sub.push({ - title: "Schedule", - icon: "$ayiCalendarAlt", - route: "/svc-schedule", - key: key++ - }); - } + sub.push({ + title: "Schedule", + icon: "$ayiCalendarAlt", + route: "/svc-schedule", + key: key++ + }); + } - //WORKORDERS LIST (was service workorders) - if ( - window.$gz.role.hasRole([ - role.BizAdminFull, - role.BizAdminLimited, - role.DispatchFull, - role.DispatchLimited, - role.TechFull, - role.TechLimited - ]) - ) { - sub.push({ - title: "WorkOrderList", - icon: "$ayiTools", - route: "/svc-workorders", - key: key++ - }); - } + //WORKORDERS LIST (was service workorders) + if (window.$gz.role.canOpen(window.$gz.type.WorkOrder)) { + sub.push({ + title: "WorkOrderList", + icon: "$ayiTools", + 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 - //there used to be an array for 3rd level shit but that's whack yo! ;) - // subSub.push({ - // title: "WorkOrderServiceTemplate", - // icon: "fa - stamp", - // route: "/svc-workorder-templates", - // 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 + //there used to be an array for 3rd level shit but that's whack yo! ;) + // subSub.push({ + // title: "WorkOrderServiceTemplate", + // icon: "fa - stamp", + // route: "/svc-workorder-templates", + // key: key++ + // }); - //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 + //QUOTE LIST + if (window.$gz.role.canOpen(window.$gz.type.Quote)) { sub.push({ title: "QuoteList", icon: "$ayiPencilAlt", route: "/svc-quotes", key: key++ }); + } - //PM LIST - if ( - window.$gz.role.hasRole([ - role.BizAdminFull, - role.BizAdminLimited, - role.DispatchFull, - role.DispatchLimited, - role.TechFull, - role.TechLimited - ]) - ) { - sub.push({ - title: "PMList", - icon: "$ayiBusinessTime", - route: "/svc-pm-list", - key: key++ - }); - } + //PM LIST + if (window.$gz.role.canOpen(window.$gz.type.PM)) { + sub.push({ + title: "PMList", + icon: "$ayiBusinessTime", + route: "/svc-pm-list", + key: key++ + }); + } - //UNITS subitem - if ( - window.$gz.role.hasRole([ - role.BizAdminFull, - role.BizAdminLimited, - role.DispatchFull, - role.DispatchLimited, - role.TechFull, - role.TechLimited - ]) - ) { - sub.push({ - title: "UnitList", - icon: "$ayiFan", - route: "/svc-units", - key: key++ - }); + //UNITS subitem + if (window.$gz.role.canOpen(window.$gz.type.Unit)) { + sub.push({ + title: "UnitList", + icon: "$ayiFan", + route: "/svc-units", + key: key++ + }); - //UNIT MODELS subitem - sub.push({ - title: "UnitModels", - icon: "$ayiDiceD20", - route: "/svc-unit-models", - key: key++ - }); - } - //LOANERS subitem - if ( - window.$gz.role.hasRole([ - role.BizAdminFull, - role.BizAdminLimited, - role.DispatchFull, - role.DispatchLimited, - role.TechFull, - role.TechLimited - ]) - ) { - sub.push({ - title: "LoanUnitList", - icon: "$ayiPlug", - route: "/svc-loaners", - key: key++ - }); - } + //UNIT MODELS subitem + sub.push({ + title: "UnitModels", + icon: "$ayiDiceD20", + route: "/svc-unit-models", + key: key++ + }); + } - //CONTRACTS subitem - if ( - window.$gz.role.hasRole([ - role.BizAdminFull, - role.BizAdminLimited, - role.DispatchFull, - role.DispatchLimited, - role.TechFull, - role.TechLimited - ]) - ) { - sub.push({ - title: "ContractList", - icon: "$ayiFileContract", - route: "/svc-contracts", - key: key++ - }); - } + //LOANERS subitem + if (window.$gz.role.canOpen(window.$gz.type.LoanUnit)) { + sub.push({ + title: "LoanUnitList", + icon: "$ayiPlug", + route: "/svc-loaners", + key: key++ + }); + } - //CUSTOMER SERVICE REQUESTS subitem - if ( - window.$gz.role.hasRole([ - role.BizAdminFull, - role.BizAdminLimited, - role.DispatchFull, - role.DispatchLimited, - role.TechFull, - role.TechLimited - ]) - ) { - sub.push({ - title: "CustomerServiceRequestList", - icon: "$ayiConciergeBell", - route: "/svc-csr-list", - key: key++ - }); - } + //CONTRACTS subitem + if (window.$gz.role.canOpen(window.$gz.type.Contract)) { + sub.push({ + title: "ContractList", + icon: "$ayiFileContract", + route: "/svc-contracts", + key: key++ + }); + } - //**** Service (TOP GROUP) + //CUSTOMER SERVICE REQUESTS subitem + if (window.$gz.role.canOpen(window.$gz.type.CustomerServiceRequest)) { + sub.push({ + title: "CustomerServiceRequestList", + icon: "$ayiConciergeBell", + route: "/svc-csr-list", + key: key++ + }); + } + + //**** Service (TOP GROUP) + if (sub.length > 0) { addNavItem("Service", "$ayiToolbox", undefined, sub, key++, "service"); } - //****************** INVENTORY - if ( - window.$gz.role.hasRole([ - role.BizAdminFull, - role.BizAdminLimited, - role.InventoryFull, - role.InventoryLimited - ]) - ) { - //clear sublevel array - sub = []; + //######### INVENTORY GROUP - //PARTS (part list) + //clear sublevel array + sub = []; + + //PARTS (part list) + if (window.$gz.role.canOpen(window.$gz.type.Part)) { sub.push({ title: "PartList", icon: "$ayiBoxes", route: "/inv-parts", key: key++ }); + } - //INVENTORY + //INVENTORY + if (window.$gz.role.canOpen(window.$gz.type.Part)) { sub.push({ title: "PartByWarehouseInventoryList", icon: "$ayiPallet", route: "/inv-part-inventory", key: key++ }); + } - //PART REQUESTS + //PART REQUESTS + if (window.$gz.role.canOpen(window.$gz.type.WorkOrderItemPartRequest)) { sub.push({ title: "WorkOrderItemPartRequestList", icon: "$ayiPaperPlane", route: "/inv-part-requests", key: key++ }); + } - //PURCHASE ORDERS + //PURCHASE ORDERS + if (window.$gz.role.canOpen(window.$gz.type.PurchaseOrder)) { sub.push({ title: "InventoryPurchaseOrders", icon: "$ayiShippingFast", @@ -486,27 +410,21 @@ function initNavPanel() { route: "/inv-adjustments", key: key++ }); + } - //**** INVENTORY (TOP GROUP) + //**** INVENTORY (TOP GROUP) + if (sub.length > 0) { addNavItem("Inventory", "$ayiBox", undefined, sub, key++, "inventory"); } - //**** VENDORS (TOP GROUP) - if ( - window.$gz.role.hasRole([ - role.BizAdminFull, - role.BizAdminLimited, - role.AccountingFull, - role.DispatchFull, - role.DispatchLimited, - role.InventoryFull, - role.InventoryLimited - ]) - ) { + //######### VENDORS (TOP GROUP) + if (window.$gz.role.canOpen(window.$gz.type.Vendor)) { addNavItem("VendorList", "$ayiStore", "/vendors", [], key++, "vendor"); } //****************** ACCOUNTING + //TODO: NO specific objects yet to check rights for so keeping this as originally written until we get there + //Not sure what this is exactly, probably to do with integration if ( window.$gz.role.hasRole([ role.BizAdminFull, @@ -535,78 +453,95 @@ function initNavPanel() { ); } - //****************** ADMINISTRATION - if (window.$gz.role.hasRole([role.BizAdminFull, role.BizAdminLimited])) { - //clear sublevel array - sub = []; + //############# ADMINISTRATION - // GLOBAL SETTINGS + //clear sublevel array + sub = []; + + // GLOBAL SETTINGS + if (window.$gz.role.canOpen(window.$gz.type.Global)) { sub.push({ title: "AdministrationGlobalSettings", icon: "$ayiCogs", route: "/adm-global-settings", key: key++ }); + } - // LICENSE + // LICENSE + if (window.$gz.role.canOpen(window.$gz.type.License)) { sub.push({ title: "HelpLicense", icon: "$ayiTicket", route: "/adm-license", key: key++ }); + } - // USERS + // USERS + if (window.$gz.role.canOpen(window.$gz.type.User)) { sub.push({ title: "UserList", icon: "$ayiUsers", route: "/adm-users", key: key++ }); + } - // CUSTOM FIELD DESIGNER NOT REQUIRED, OPENS FROM INDIVIDUAL FORMS - - //TRANSLATION + //TRANSLATION + if (window.$gz.role.canOpen(window.$gz.type.Translation)) { sub.push({ title: "TranslationList", icon: "$ayiLanguage", route: "/adm-translations", key: key++ }); + } - //REPORT TEMPLATES + //REPORT TEMPLATES + if (window.$gz.role.canOpen(window.$gz.type.Report)) { sub.push({ title: "ReportList", icon: "$ayiThList", route: "/adm-report-templates", key: key++ }); + } - //FILES IN DATABASE + //FILES IN DATABASE + if (window.$gz.role.canOpen(window.$gz.type.FileAttachment)) { sub.push({ title: "Attachments", icon: "$ayiFolder", route: "/adm-attachments", key: key++ }); + } - //EVENT LOG / HISTORY + //EVENT LOG / HISTORY + if (window.$gz.role.canOpen(window.$gz.type.Global)) { + //not really an appropriate object here just guessing sub.push({ title: "History", icon: "$ayiHistory", route: "/adm-history", key: key++ }); + } - //IMPORT + //IMPORT + if (window.$gz.role.canOpen(window.$gz.type.Global)) { + //again, not really an appropriate object type sub.push({ title: "Import", icon: "$ayiFileImport", route: "/adm-import", key: key++ }); + } - // ** ADMINISTRATION (TOP) + // ** ADMINISTRATION (TOP) + if (sub.length > 0) { addNavItem( "Administration", "$ayiUserTie", @@ -617,50 +552,53 @@ function initNavPanel() { ); } - //****************** OPERATIONS - if (window.$gz.role.hasRole([role.OpsAdminFull, role.OpsAdminLimited])) { - //clear sublevel array - sub = []; + //############ OPERATIONS - // ARCHIVE + //clear sublevel array + sub = []; + + // BACKUP + if (window.$gz.role.canOpen(window.$gz.type.Backup)) { sub.push({ title: "Backup", icon: "$ayiFileArchive", route: "/ops-backup", key: key++ }); + } - //Set home page if they don't already have the dashboard set above - if (!window.$gz.store.state.homePage) { - //Set homePage in store to Backup - window.$gz.store.commit("setHomePage", "/ops-BACKUP"); - } - - // SERVER STATE + // SERVER STATE + if (window.$gz.role.canOpen(window.$gz.type.ServerState)) { sub.push({ title: "ServerState", icon: "$ayiDoorOpen", route: "/ops-server-state", key: key++ }); + } - // JOBS + // JOBS + if (window.$gz.role.canOpen(window.$gz.type.ServerJob)) { sub.push({ title: "ServerJobs", icon: "$ayiRobot", route: "/ops-jobs", key: key++ }); + } - // LOGS + // LOGS + if (window.$gz.role.canOpen(window.$gz.type.LogFile)) { sub.push({ title: "ServerLog", icon: "$ayiHistory", route: "/ops-log", key: key++ }); + } - //METRICS + //METRICS + if (window.$gz.role.canOpen(window.$gz.type.ServerMetrics)) { sub.push({ title: "ServerMetrics", icon: "$ayiFileMedicalAlt", @@ -669,42 +607,42 @@ function initNavPanel() { }); //PROFILE + //metrics rights sub.push({ title: "ServerProfiler", icon: "$ayiBinoculars", route: "/ops-profile", key: key++ }); + } - //NOTIFICATION CONFIG AND HISTORY + //NOTIFICATION CONFIG AND HISTORY + if (window.$gz.role.canOpen(window.$gz.type.OpsNotificationSettings)) { sub.push({ title: "NotificationSettings", icon: "$ayiBullhorn", route: "/ops-notification-settings", key: key++ }); + } - // OPS VIEW SERVER CONFIGURATION + // OPS VIEW SERVER CONFIGURATION + if (window.$gz.role.canOpen(window.$gz.type.ServerState)) { sub.push({ title: "ViewServerConfiguration", icon: "$ayiInfoCircle", route: "/ops-view-configuration", key: key++ }); + } - // ** OPERATIONS (TOP) + // ** OPERATIONS (TOP) + if (sub.length > 0) { addNavItem("Operations", "$ayiServer", undefined, sub, key++, "operations"); } - //**** WIDGETS (TOP GROUP) - if ( - window.$gz.role.hasRole([ - role.BizAdminFull, - role.BizAdminLimited, - role.InventoryFull, - role.InventoryLimited - ]) - ) { + //############ WIDGETS (TOP GROUP) + if (window.$gz.role.canOpen(window.$gz.type.Widget)) { addNavItem("WidgetList", "$ayiVial", "/widgets", [], key++, "widgets"); }