From 5088549672e0fcadc97fc31c068be9342214a4e0 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 3 Jan 2020 20:31:26 +0000 Subject: [PATCH] --- ayanova/src/api/initialize.js | 505 +++++++++++++++++++--------------- 1 file changed, 278 insertions(+), 227 deletions(-) diff --git a/ayanova/src/api/initialize.js b/ayanova/src/api/initialize.js index 0a4bfce2..c6ce5b22 100644 --- a/ayanova/src/api/initialize.js +++ b/ayanova/src/api/initialize.js @@ -133,273 +133,324 @@ export default function initialize() { ); //****************** SERVICE - //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.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 + ]) + ) { + //clear sublevel array + sub = []; - //SCHEDULE (combined) - sub.push({ - title: window.$gz.locale.get("Schedule"), - icon: "calendar-alt", - route: "/svc-schedule", - key: key++ - }); + //SCHEDULE (combined) + 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++ - }); + //WORKORDERS LIST (was service workorders) + 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 - //there used to be an array for 3rd level shit but that's whack yo! ;) - // subSub.push({ - // title: window.$gz.locale.get("WorkorderServiceTemplate"), - // icon: "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: window.$gz.locale.get("WorkorderServiceTemplate"), + // icon: "stamp", + // route: "/svc-workorder-templates", + // key: key++ + // }); - //QUOTE LIST - sub.push({ - title: window.$gz.locale.get("WorkorderQuoteList"), - icon: "edit", - route: "/svc-quotes", - key: key++ - }); + //QUOTE LIST + sub.push({ + title: window.$gz.locale.get("WorkorderQuoteList"), + icon: "edit", + route: "/svc-quotes", + key: key++ + }); - //PM LIST - sub.push({ - title: window.$gz.locale.get("WorkorderPreventiveMaintenanceList"), - icon: "business-time", - route: "/svc-pm-list", - key: key++ - }); + //PM LIST + 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++ - }); + //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++ - }); + //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++ - }); + //LOANERS subitem + 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++ - }); + //CONTRACTS subitem + 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++ - }); + //CUSTOMER SERVICE REQUESTS subitem + sub.push({ + title: window.$gz.locale.get("ClientServiceRequestList"), + icon: "child", + route: "/svc-csr-list", + key: key++ + }); - //**** Service (TOP GROUP) - addNavItem( - window.$gz.locale.get("Service"), - "toolbox", - undefined, - sub, - key++ - ); + //**** Service (TOP GROUP) + addNavItem( + window.$gz.locale.get("Service"), + "toolbox", + undefined, + sub, + key++ + ); + } //****************** INVENTORY - //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.InventoryFull, + window.$gz.role.AUTHORIZATION_ROLES.InventoryLimited + ]) + ) { + //clear sublevel array + sub = []; - //PARTS (part list) - sub.push({ - title: window.$gz.locale.get("PartList"), - icon: "boxes", - route: "/inv-parts", - key: key++ - }); + //PARTS (part list) + sub.push({ + title: window.$gz.locale.get("PartList"), + icon: "boxes", + route: "/inv-parts", + key: key++ + }); - //INVENTORY - sub.push({ - title: window.$gz.locale.get("PartByWarehouseInventoryList"), - icon: "pallet", - route: "/inv-part-inventory", - key: key++ - }); + //INVENTORY + sub.push({ + title: window.$gz.locale.get("PartByWarehouseInventoryList"), + icon: "pallet", + route: "/inv-part-inventory", + key: key++ + }); - //PART REQUESTS - sub.push({ - title: window.$gz.locale.get("WorkorderItemPartRequestList"), - icon: "paper-plane", - route: "/inv-part-requests", - key: key++ - }); + //PART REQUESTS + sub.push({ + title: window.$gz.locale.get("WorkorderItemPartRequestList"), + icon: "paper-plane", + route: "/inv-part-requests", + key: key++ + }); - //PURCHASE ORDERS - sub.push({ - title: window.$gz.locale.get("InventoryPurchaseOrders"), - icon: "shipping-fast", - route: "/inv-purchase-orders", - key: key++ - }); + //PURCHASE ORDERS + sub.push({ + title: window.$gz.locale.get("InventoryPurchaseOrders"), + icon: "shipping-fast", + route: "/inv-purchase-orders", + key: key++ + }); - //NOTE: V7 HAD POITEMS, THAT MAY BE AN ANACHRONISM NOW SO NOT PUTTING HERE + //NOTE: V7 HAD POITEMS, THAT MAY BE AN ANACHRONISM NOW SO NOT PUTTING HERE - //PURCHASE ORDER RECEIPTS - sub.push({ - title: window.$gz.locale.get("InventoryPurchaseOrderReceipts"), - icon: "dolly-flatbed", - route: "/inv-purchase-order-receipts", - key: key++ - }); + //PURCHASE ORDER RECEIPTS + sub.push({ + title: window.$gz.locale.get("InventoryPurchaseOrderReceipts"), + icon: "dolly-flatbed", + route: "/inv-purchase-order-receipts", + key: key++ + }); - //NOTE: V7 HAD PORECEIPTITEMS, THAT MAY BE AN ANACHRONISM NOW SO NOT PUTTING HERE + //NOTE: V7 HAD PORECEIPTITEMS, THAT MAY BE AN ANACHRONISM NOW SO NOT PUTTING HERE - //ADJUSTMENTS - sub.push({ - title: window.$gz.locale.get("InventoryPartInventoryAdjustments"), - icon: "dolly", - route: "/inv-adjustments", - key: key++ - }); + //NOTE: Warehouses? Shouldn't they be here as well?? - //**** INVENTORY (TOP GROUP) - addNavItem( - window.$gz.locale.get("Inventory"), - "box", - undefined, - sub, - key++ - ); + //ADJUSTMENTS + sub.push({ + title: window.$gz.locale.get("InventoryPartInventoryAdjustments"), + icon: "dolly", + route: "/inv-adjustments", + key: key++ + }); + + //**** INVENTORY (TOP GROUP) + addNavItem( + window.$gz.locale.get("Inventory"), + "box", + undefined, + sub, + key++ + ); + } //**** VENDORS (TOP GROUP) - addNavItem( - window.$gz.locale.get("VendorList"), - "store", - "/vendors", - [], - key++ - ); + 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 + ]) + ) { + addNavItem( + window.$gz.locale.get("VendorList"), + "store", + "/vendors", + [], + key++ + ); + } //****************** ACCOUNTING + if ( + window.$gz.role.hasRole([ + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, + window.$gz.role.AUTHORIZATION_ROLES.AccountingFull, + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited + ]) + ) { + sub = []; - sub = []; + //FAKE subitem as is still TBD + sub.push({ + title: window.$gz.locale.get("Accounting"), + icon: "calculator", + route: "/acc-accounting", + key: key++ + }); - //FAKE subitem as is still TBD - sub.push({ - title: window.$gz.locale.get("Accounting"), - icon: "calculator", - route: "/acc-accounting", - key: key++ - }); - - // ** CUSTOMER (TOP) - addNavItem( - window.$gz.locale.get("Accounting"), - "calculator", - undefined, - sub, - key++ - ); + // ** ACCOUNTING (TOP) + addNavItem( + window.$gz.locale.get("Accounting"), + "calculator", + undefined, + sub, + key++ + ); + } //****************** ADMINISTRATION - //clear sublevel array - sub = []; + if ( + window.$gz.role.hasRole([ + window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, + window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited + ]) + ) { + //clear sublevel array + sub = []; - // GLOBAL SETTINGS - sub.push({ - title: window.$gz.locale.get("AdministrationGlobalSettings"), - icon: "cogs", - route: "/adm-global-settings", - key: key++ - }); + // GLOBAL SETTINGS + sub.push({ + title: window.$gz.locale.get("AdministrationGlobalSettings"), + icon: "cogs", + route: "/adm-global-settings", + key: key++ + }); - // LICENSE - sub.push({ - title: window.$gz.locale.get("HelpLicense"), - icon: "ticket-alt", - route: "/adm-license", - key: key++ - }); + // LICENSE + sub.push({ + title: window.$gz.locale.get("HelpLicense"), + icon: "ticket-alt", + route: "/adm-license", + key: key++ + }); - // USERS - sub.push({ - title: window.$gz.locale.get("UserList"), - icon: "users", - route: "/adm-users", - key: key++ - }); + // USERS + sub.push({ + title: window.$gz.locale.get("UserList"), + icon: "users", + route: "/adm-users", + key: key++ + }); - // CUSTOM FIELD DESIGNER NOT REQUIRED, OPENS FROM INDIVIDUAL FORMS + // CUSTOM FIELD DESIGNER NOT REQUIRED, OPENS FROM INDIVIDUAL FORMS - //LOCALIZED TEXT DESIGNER - sub.push({ - title: window.$gz.locale.get("LocalizedTextDesign"), - icon: "language", - route: "/adm-localized-text", - key: key++ - }); + //LOCALIZED TEXT DESIGNER + sub.push({ + title: window.$gz.locale.get("LocalizedTextDesign"), + icon: "language", + route: "/adm-localized-text", + key: key++ + }); - //REPORT TEMPLATES - sub.push({ - title: window.$gz.locale.get("ReportList"), - icon: "th-list", - route: "/adm-report-templates", - key: key++ - }); + //REPORT TEMPLATES + sub.push({ + title: window.$gz.locale.get("ReportList"), + icon: "th-list", + route: "/adm-report-templates", + key: key++ + }); - //FILES IN DATABASE - sub.push({ - title: window.$gz.locale.get("Attachments"), - icon: "folder", - route: "/adm-attachments", - key: key++ - }); + //FILES IN DATABASE + sub.push({ + title: window.$gz.locale.get("Attachments"), + icon: "folder", + route: "/adm-attachments", + key: key++ + }); - //EVENT LOG / HISTORY - sub.push({ - title: window.$gz.locale.get("History"), - icon: "history", - route: "/adm-history", - key: key++ - }); + //EVENT LOG / HISTORY + sub.push({ + title: window.$gz.locale.get("History"), + icon: "history", + route: "/adm-history", + key: key++ + }); - //KPI / METRICS / CHARTS AND STUFF - sub.push({ - title: window.$gz.locale.get("Statistics"), - icon: "chart-line", - route: "/adm-statistics", - key: key++ - }); + //KPI / METRICS / CHARTS AND STUFF + sub.push({ + title: window.$gz.locale.get("Statistics"), + icon: "chart-line", + route: "/adm-statistics", + key: key++ + }); - // ** ADMINISTRATION (TOP) - addNavItem( - window.$gz.locale.get("Administration"), - "user-tie", - undefined, - sub, - key++ - ); + // ** ADMINISTRATION (TOP) + addNavItem( + window.$gz.locale.get("Administration"), + "user-tie", + undefined, + sub, + key++ + ); + } //****************** OPERATIONS if (