860 lines
19 KiB
JavaScript
860 lines
19 KiB
JavaScript
/* Xeslint-disable */
|
|
|
|
function addNavItem(title, icon, route, navItems, key, testid, color = null) {
|
|
if (!testid) {
|
|
testid = route;
|
|
}
|
|
|
|
let o = {
|
|
title,
|
|
icon,
|
|
route,
|
|
navItems,
|
|
key: key,
|
|
testid: testid
|
|
};
|
|
if (color != null) {
|
|
o["color"] = color;
|
|
}
|
|
|
|
window.$gz.store.commit("addNavItem", o);
|
|
}
|
|
|
|
function initNavPanel() {
|
|
let key = 0;
|
|
let sub = [];
|
|
|
|
let t = window.$gz.translation.get;
|
|
let role = window.$gz.role.AUTHORIZATION_ROLES;
|
|
let licenseState = window.$gz.store.state.globalSettings.licenseStatus;
|
|
/*Service = 1,
|
|
NotService = 2,
|
|
Customer = 3,
|
|
HeadOffice = 4,
|
|
ServiceContractor = 5 */
|
|
let isCustomerTypeUser =
|
|
window.$gz.store.state.userType == 3 ||
|
|
window.$gz.store.state.userType == 4;
|
|
let isSubcontractorTypeUser = window.$gz.store.state.userType == 5;
|
|
|
|
//Customer "outside user" options
|
|
if (isCustomerTypeUser) {
|
|
//clear sublevel array
|
|
sub = [];
|
|
|
|
//Set homePage in store to customer csr for this user type
|
|
|
|
window.$gz.store.commit("setHomePage", "/customer-csr-list");
|
|
|
|
//USER SETTINGS
|
|
sub.push({
|
|
title: "UserSettings",
|
|
icon: "$ayiUserCog",
|
|
route: "/home-user-settings",
|
|
key: key++
|
|
});
|
|
|
|
sub.push({
|
|
title: "NotifySubscriptionList",
|
|
icon: "$ayiBullhorn",
|
|
route: "/home-notify-subscriptions",
|
|
key: key++
|
|
});
|
|
|
|
//CSR LIST subitem
|
|
sub.push({
|
|
title: "CustomerServiceRequestList",
|
|
icon: "$ayiChild",
|
|
route: "/customer-csr-list",
|
|
key: key++
|
|
});
|
|
|
|
//WORKORDERS subitem
|
|
sub.push({
|
|
title: "WorkOrderList",
|
|
icon: "$ayiTools",
|
|
route: "/customer-workorders",
|
|
key: key++
|
|
});
|
|
|
|
//** CUSTOMER LOGIN HOME (TOP)
|
|
|
|
addNavItem("Home", "$ayiHome", undefined, sub, key++, "homecustomer");
|
|
|
|
return;
|
|
}
|
|
|
|
//Non-customer ("inside user") options
|
|
|
|
//******* License issue
|
|
//Status NONE, EXPIREDTRIAL, EXPIREDPURCHASE, REVOKED
|
|
//only show license and logout
|
|
/* public enum LicenseStatus
|
|
{
|
|
NONE = 0,
|
|
ActiveTrial = 1,
|
|
ExpiredTrial = 2,
|
|
ActivePurchased = 3,
|
|
ExpiredPurchased = 4,
|
|
Revoked = 5
|
|
}
|
|
*/
|
|
|
|
if (
|
|
licenseState == 0 ||
|
|
licenseState == 2 ||
|
|
licenseState == 4 ||
|
|
licenseState == 5
|
|
) {
|
|
addNavItem(
|
|
"HelpLicense",
|
|
"$ayiTicket",
|
|
"/adm-license",
|
|
[],
|
|
key++,
|
|
"license"
|
|
);
|
|
window.$gz.store.commit("setHomePage", "/adm-license");
|
|
return;
|
|
}
|
|
|
|
//****************** HOME
|
|
//Most users except ops and client logins
|
|
if (
|
|
window.$gz.role.hasRole([
|
|
role.BizAdminFull,
|
|
role.BizAdminLimited,
|
|
role.DispatchFull,
|
|
role.DispatchLimited,
|
|
role.InventoryLimited,
|
|
role.InventoryFull,
|
|
role.AccountingFull,
|
|
role.TechLimited,
|
|
role.TechFull,
|
|
role.SubContractorLimited,
|
|
role.SubContractorFull,
|
|
role.SalesFull,
|
|
role.SalesLimited
|
|
])
|
|
) {
|
|
//DASHBOARD
|
|
//KPI / METRICS / CHARTS AND STUFF APPROPRIATE TO ROLE
|
|
sub.push({
|
|
title: "Dashboard",
|
|
icon: "$ayiTachometer",
|
|
route: "/home-dashboard",
|
|
key: key++
|
|
});
|
|
|
|
//Set homePage in store to dashboard
|
|
window.$gz.store.commit("setHomePage", "/home-dashboard");
|
|
|
|
//SEARCH
|
|
if (
|
|
window.$gz.role.hasRole([
|
|
role.BizAdminFull,
|
|
role.BizAdminLimited,
|
|
role.DispatchFull,
|
|
role.DispatchLimited,
|
|
role.InventoryLimited,
|
|
role.InventoryFull,
|
|
role.AccountingFull,
|
|
role.TechLimited,
|
|
role.TechFull,
|
|
role.SalesFull,
|
|
role.SalesLimited
|
|
])
|
|
) {
|
|
sub.push({
|
|
title: "Search",
|
|
icon: "$ayiSearch",
|
|
route: "/home-search",
|
|
key: key++
|
|
});
|
|
}
|
|
|
|
//HISTORY / MRU / ACTIVITY (personal)
|
|
sub.push({
|
|
title: "History",
|
|
icon: "$ayiHistory",
|
|
route: `/history/3/${window.$gz.store.state.userId}/true`,
|
|
key: key++
|
|
});
|
|
|
|
//SCHEDULE (personal)
|
|
sub.push({
|
|
title: "Schedule",
|
|
icon: "$ayiCalendarDay",
|
|
route: "/home-schedule",
|
|
key: key++
|
|
});
|
|
|
|
//MEMOS
|
|
sub.push({
|
|
title: "MemoList",
|
|
icon: "$ayiInbox",
|
|
route: "/home-memos",
|
|
key: key++
|
|
});
|
|
|
|
//REMINDERS (SCHEDULE MARKERS)
|
|
sub.push({
|
|
title: "ReminderList",
|
|
icon: "$ayiStickyNote",
|
|
route: "/home-reminders",
|
|
key: key++
|
|
});
|
|
|
|
//USER SETTINGS
|
|
sub.push({
|
|
title: "UserSettings",
|
|
icon: "$ayiUserCog",
|
|
route: "/home-user-settings",
|
|
key: key++
|
|
});
|
|
|
|
//USER NOTIFICATION SUBSCRIPTIONS
|
|
if (
|
|
//all but subcontractors (arbitrary decision without any facts ;)
|
|
window.$gz.role.hasRole([
|
|
role.BizAdminFull,
|
|
role.BizAdminLimited,
|
|
role.DispatchFull,
|
|
role.DispatchLimited,
|
|
role.InventoryLimited,
|
|
role.InventoryFull,
|
|
role.AccountingFull,
|
|
role.TechLimited,
|
|
role.TechFull,
|
|
role.SalesFull,
|
|
role.SalesLimited
|
|
])
|
|
) {
|
|
sub.push({
|
|
title: "NotifySubscriptionList",
|
|
icon: "$ayiBullhorn",
|
|
route: "/home-notify-subscriptions",
|
|
key: key++
|
|
});
|
|
}
|
|
|
|
//HOME
|
|
addNavItem("Home", "$ayiHome", undefined, sub, key++, "home");
|
|
}
|
|
|
|
//****************** CUSTOMERS
|
|
if (
|
|
window.$gz.role.hasRole([
|
|
role.BizAdminFull,
|
|
role.BizAdminLimited,
|
|
role.DispatchFull,
|
|
role.DispatchLimited,
|
|
role.TechFull,
|
|
role.TechLimited,
|
|
role.AccountingFull,
|
|
role.SalesFull,
|
|
role.SalesLimited
|
|
])
|
|
) {
|
|
//clear sublevel array
|
|
sub = [];
|
|
|
|
//CUSTOMERS subitem
|
|
sub.push({
|
|
title: "CustomerList",
|
|
icon: "$ayiAddressCard",
|
|
route: "/cust-customers",
|
|
key: key++
|
|
});
|
|
|
|
//HEAD OFFICES subitem
|
|
sub.push({
|
|
title: "HeadOfficeList",
|
|
icon: "$ayiSitemap",
|
|
route: "/cust-headoffices",
|
|
key: key++
|
|
});
|
|
|
|
//Customer / Headoffice Users subitem
|
|
sub.push({
|
|
title: "UserList",
|
|
icon: "$ayiUsers",
|
|
route: "/cust-users",
|
|
key: key++
|
|
});
|
|
|
|
// ** CUSTOMER (TOP)
|
|
addNavItem(
|
|
"CustomerList",
|
|
"$ayiAddressBook",
|
|
undefined,
|
|
sub,
|
|
key++,
|
|
"customer"
|
|
);
|
|
}
|
|
|
|
//****************** SERVICE
|
|
if (
|
|
window.$gz.role.hasRole([
|
|
role.BizAdminFull,
|
|
role.BizAdminLimited,
|
|
role.DispatchFull,
|
|
role.DispatchLimited,
|
|
role.TechFull,
|
|
role.TechLimited,
|
|
role.SalesFull,
|
|
role.SalesLimited
|
|
])
|
|
) {
|
|
//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++
|
|
});
|
|
}
|
|
|
|
//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++
|
|
});
|
|
}
|
|
|
|
// //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
|
|
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++
|
|
});
|
|
}
|
|
|
|
//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++
|
|
});
|
|
|
|
//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++
|
|
});
|
|
}
|
|
|
|
//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++
|
|
});
|
|
}
|
|
|
|
//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: "$ayiChild",
|
|
route: "/svc-csr-list",
|
|
key: key++
|
|
});
|
|
}
|
|
|
|
//**** Service (TOP GROUP)
|
|
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 = [];
|
|
|
|
//PARTS (part list)
|
|
sub.push({
|
|
title: "PartList",
|
|
icon: "$ayiBoxes",
|
|
route: "/inv-parts",
|
|
key: key++
|
|
});
|
|
|
|
//INVENTORY
|
|
sub.push({
|
|
title: "PartByWarehouseInventoryList",
|
|
icon: "$ayiPallet",
|
|
route: "/inv-part-inventory",
|
|
key: key++
|
|
});
|
|
|
|
//PART REQUESTS
|
|
sub.push({
|
|
title: "WorkOrderItemPartRequestList",
|
|
icon: "$ayiPaperPlane",
|
|
route: "/inv-part-requests",
|
|
key: key++
|
|
});
|
|
|
|
//PURCHASE ORDERS
|
|
sub.push({
|
|
title: "InventoryPurchaseOrders",
|
|
icon: "$ayiShippingFast",
|
|
route: "/inv-purchase-orders",
|
|
key: key++
|
|
});
|
|
|
|
//NOTE: V7 HAD POITEMS, THAT MAY BE AN ANACHRONISM NOW SO NOT PUTTING HERE
|
|
|
|
//PURCHASE ORDER RECEIPTS
|
|
sub.push({
|
|
title: "InventoryPurchaseOrderReceipts",
|
|
icon: "$ayiDollyFlatbed",
|
|
route: "/inv-purchase-order-receipts",
|
|
key: key++
|
|
});
|
|
|
|
//NOTE: V7 HAD PORECEIPTITEMS, THAT MAY BE AN ANACHRONISM NOW SO NOT PUTTING HERE
|
|
|
|
//NOTE: Warehouses? Shouldn't they be here as well??
|
|
|
|
//ADJUSTMENTS
|
|
sub.push({
|
|
title: "InventoryPartInventoryAdjustments",
|
|
icon: "$ayiDolly",
|
|
route: "/inv-adjustments",
|
|
key: key++
|
|
});
|
|
|
|
//**** INVENTORY (TOP GROUP)
|
|
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
|
|
])
|
|
) {
|
|
addNavItem("VendorList", "$ayiStore", "/vendors", [], key++, "vendor");
|
|
}
|
|
|
|
//****************** ACCOUNTING
|
|
if (
|
|
window.$gz.role.hasRole([
|
|
role.BizAdminFull,
|
|
role.AccountingFull,
|
|
role.BizAdminLimited
|
|
])
|
|
) {
|
|
sub = [];
|
|
|
|
//FAKE subitem as is still TBD
|
|
sub.push({
|
|
title: "Accounting",
|
|
icon: "$ayiCalculator",
|
|
route: "/acc-accounting",
|
|
key: key++
|
|
});
|
|
|
|
// ** ACCOUNTING (TOP)
|
|
addNavItem(
|
|
"Accounting",
|
|
"$ayiCalculator",
|
|
undefined,
|
|
sub,
|
|
key++,
|
|
"accounting"
|
|
);
|
|
}
|
|
|
|
//****************** ADMINISTRATION
|
|
if (window.$gz.role.hasRole([role.BizAdminFull, role.BizAdminLimited])) {
|
|
//clear sublevel array
|
|
sub = [];
|
|
|
|
// GLOBAL SETTINGS
|
|
sub.push({
|
|
title: "AdministrationGlobalSettings",
|
|
icon: "$ayiCogs",
|
|
route: "/adm-global-settings",
|
|
key: key++
|
|
});
|
|
|
|
// LICENSE
|
|
sub.push({
|
|
title: "HelpLicense",
|
|
icon: "$ayiTicket",
|
|
route: "/adm-license",
|
|
key: key++
|
|
});
|
|
|
|
// USERS
|
|
sub.push({
|
|
title: "UserList",
|
|
icon: "$ayiUsers",
|
|
route: "/adm-users",
|
|
key: key++
|
|
});
|
|
|
|
// CUSTOM FIELD DESIGNER NOT REQUIRED, OPENS FROM INDIVIDUAL FORMS
|
|
|
|
//TRANSLATION
|
|
sub.push({
|
|
title: "TranslationList",
|
|
icon: "$ayiLanguage",
|
|
route: "/adm-translations",
|
|
key: key++
|
|
});
|
|
|
|
//REPORT TEMPLATES
|
|
sub.push({
|
|
title: "ReportList",
|
|
icon: "$ayiThList",
|
|
route: "/adm-report-templates",
|
|
key: key++
|
|
});
|
|
|
|
//FILES IN DATABASE
|
|
sub.push({
|
|
title: "Attachments",
|
|
icon: "$ayiFolder",
|
|
route: "/adm-attachments",
|
|
key: key++
|
|
});
|
|
|
|
//EVENT LOG / HISTORY
|
|
sub.push({
|
|
title: "History",
|
|
icon: "$ayiHistory",
|
|
route: "/adm-history",
|
|
key: key++
|
|
});
|
|
|
|
// ** ADMINISTRATION (TOP)
|
|
addNavItem(
|
|
"Administration",
|
|
"$ayiUserTie",
|
|
undefined,
|
|
sub,
|
|
key++,
|
|
"administration"
|
|
);
|
|
}
|
|
|
|
//****************** OPERATIONS
|
|
if (window.$gz.role.hasRole([role.OpsAdminFull, role.OpsAdminLimited])) {
|
|
//clear sublevel array
|
|
sub = [];
|
|
|
|
// ARCHIVE
|
|
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
|
|
sub.push({
|
|
title: "ServerState",
|
|
icon: "$ayiDoorOpen",
|
|
route: "/ops-server-state",
|
|
key: key++
|
|
});
|
|
|
|
// JOBS
|
|
sub.push({
|
|
title: "ServerJobs",
|
|
icon: "$ayiRobot",
|
|
route: "/ops-jobs",
|
|
key: key++
|
|
});
|
|
|
|
// LOGS
|
|
sub.push({
|
|
title: "ServerLog",
|
|
icon: "$ayiHistory",
|
|
route: "/ops-log",
|
|
key: key++
|
|
});
|
|
|
|
//METRICS
|
|
sub.push({
|
|
title: "ServerMetrics",
|
|
icon: "$ayiFileMedicalAlt",
|
|
route: "/ops-metrics",
|
|
key: key++
|
|
});
|
|
|
|
//PROFILE
|
|
sub.push({
|
|
title: "ServerProfiler",
|
|
icon: "$ayiBinoculars",
|
|
route: "/ops-profile",
|
|
key: key++
|
|
});
|
|
|
|
//NOTIFICATION CONFIG AND HISTORY
|
|
sub.push({
|
|
title: "NotificationSettings",
|
|
icon: "$ayiBullhorn",
|
|
route: "/ops-notification-settings",
|
|
key: key++
|
|
});
|
|
|
|
// OPS VIEW SERVER CONFIGURATION
|
|
sub.push({
|
|
title: "ViewServerConfiguration",
|
|
icon: "$ayiInfoCircle",
|
|
route: "/ops-view-configuration",
|
|
key: key++
|
|
});
|
|
|
|
// ** OPERATIONS (TOP)
|
|
addNavItem("Operations", "$ayiServer", undefined, sub, key++, "operations");
|
|
}
|
|
|
|
//**** WIDGETS (TOP GROUP)
|
|
if (
|
|
window.$gz.role.hasRole([
|
|
role.BizAdminFull,
|
|
role.BizAdminLimited,
|
|
role.InventoryFull,
|
|
role.InventoryLimited
|
|
])
|
|
) {
|
|
addNavItem("WidgetList", "$ayiVial", "/widgets", [], key++, "widgets");
|
|
}
|
|
|
|
//*** EVALUATION active trial license should always go to evaluation as home page
|
|
//as long as they are a normal User type and not a subcontractor type
|
|
if ((licenseState == 1) & !isSubcontractorTypeUser) {
|
|
addNavItem(
|
|
"Evaluate",
|
|
"$ayiRocket",
|
|
"/ay-evaluate",
|
|
[],
|
|
key++,
|
|
"evaluate",
|
|
"secondary"
|
|
);
|
|
window.$gz.store.commit("setHomePage", "/ay-evaluate");
|
|
}
|
|
}
|
|
|
|
async function getUserOptions() {
|
|
try {
|
|
let res = await window.$gz.api.get(
|
|
"user-option/" + window.$gz.store.state.userId
|
|
);
|
|
|
|
if (res.error) {
|
|
//In a form this would trigger a bunch of validation or error display code but for here and now:
|
|
//convert error to human readable string for display and popup a notification to user
|
|
let msg = window.$gz.api.apiErrorToHumanString(res.error);
|
|
window.$gz.store.commit(
|
|
"logItem",
|
|
"Initialize::() fetch useroptions -> error" + msg
|
|
);
|
|
window.$gz.eventBus.$emit("notify-error", msg);
|
|
} else {
|
|
//Check if overrides and use them here
|
|
//or else use browser defaults
|
|
|
|
let l = {
|
|
languageOverride: null,
|
|
timeZoneOverride: null,
|
|
currencyName: null,
|
|
hour12: true,
|
|
uiColor: "#000000",
|
|
emailAddress: null
|
|
};
|
|
|
|
//get language to use, try user set override first, if empty then browser set, if empty then default to en-us
|
|
l.languageOverride =
|
|
res.data.languageOverride ||
|
|
window.$gz.locale.getBrowserFirstLanguage() ||
|
|
"en-US";
|
|
|
|
l.timeZoneOverride =
|
|
res.data.timeZoneOverride ||
|
|
window.$gz.locale.getBrowserTimeZoneName() ||
|
|
"America/New_York";
|
|
|
|
//No browser setting for this so meh
|
|
l.currencyName = res.data.currencyName || "USD";
|
|
if (res.data.hour12 != null) {
|
|
l.hour12 = res.data.hour12;
|
|
}
|
|
|
|
l.uiColor = res.data.uiColor || "#000000";
|
|
l.emailAddress = res.data.emailAddress || null;
|
|
|
|
window.$gz.store.commit("setUserOptions", l);
|
|
}
|
|
} catch (error) {
|
|
window.$gz.store.commit(
|
|
"logItem",
|
|
"Initialize::() fetch useroptions -> error" + error
|
|
);
|
|
throw new Error(error);
|
|
}
|
|
}
|
|
|
|
/////////////////////////////////////
|
|
// Initialize the app
|
|
// on change of authentication status
|
|
export default function initialize() {
|
|
return new Promise(async function(resolve, reject) {
|
|
if (!window.$gz.store.state.authenticated) {
|
|
throw new Error("initialize: Error, called but user not authenticated!");
|
|
}
|
|
try {
|
|
await window.$gz.translation.cacheTranslations(
|
|
window.$gz.translation.coreKeys
|
|
);
|
|
initNavPanel();
|
|
await getUserOptions();
|
|
|
|
//check for known password and a purchased licensed mode
|
|
if (
|
|
window.$gz.store.state.knownPassword &&
|
|
(window.$gz.store.state.globalSettings.licenseStatus == 3 || //ActivePurchased = 3,
|
|
window.$gz.store.state.globalSettings.licenseStatus == 4) // ExpiredPurchased = 4
|
|
) {
|
|
window.$gz.store.commit("setHomePage", "/home-password");
|
|
}
|
|
|
|
resolve();
|
|
} catch (err) {
|
|
reject(err);
|
|
}
|
|
});
|
|
}
|