This commit is contained in:
2020-12-05 01:17:25 +00:00
parent 59f784829b
commit 39b5587f4e

View File

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