This commit is contained in:
2021-06-16 17:52:58 +00:00
parent 165d877b69
commit f1da826781
9 changed files with 57 additions and 29 deletions

View File

@@ -152,6 +152,7 @@
>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn text icon to="/home-notifications" data-cy="notification">
<v-badge color="deep-purple" :value="newNotificationCount() > 0">
<template v-slot:badge>

View File

@@ -33,13 +33,9 @@ function initNavPanel() {
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;
//########## OUTSIDE USERS GROUP (CUSTOMER / HEADOFFICE) ###
if (isCustomerTypeUser) {
if (window.$gz.store.state.isCustomerUser == true) {
//clear sublevel array
sub = [];
@@ -57,6 +53,9 @@ function initNavPanel() {
route: "/home-user-settings",
key: key++
});
window.$gz.store.commit("setHomePage", "/home-user-settings");
CustomerHomePageSet = true;
}
if (
@@ -71,6 +70,23 @@ function initNavPanel() {
route: "/home-notify-subscriptions",
key: key++
});
window.$gz.store.commit("setHomePage", "/home-notify-subscriptions");
CustomerHomePageSet = true;
}
//WORKORDERS subitem
if (window.$gz.store.state.customerRights.userSettings == true) {
if (window.$gz.role.canOpen(window.$gz.type.WorkOrder)) {
sub.push({
title: "WorkOrderList",
icon: "$ayiTools",
route: "/customer-workorders",
key: key++
});
window.$gz.store.commit("setHomePage", "/customer-workorders");
CustomerHomePageSet = true;
}
}
//CSR LIST subitem
@@ -89,25 +105,12 @@ function initNavPanel() {
CustomerHomePageSet = true;
}
//WORKORDERS subitem
if (window.$gz.store.state.customerRights.userSettings == true) {
if (window.$gz.role.canOpen(window.$gz.type.WorkOrder)) {
sub.push({
title: "WorkOrderList",
icon: "$ayiTools",
route: "/customer-workorders",
key: key++
});
}
}
//** CUSTOMER LOGIN HOME (TOP)
addNavItem("Home", "$ayiHome", undefined, sub, key++, "homecustomer");
//last resort home page if user has no roles set
//TODO: Needs to be no rights page, not user settings
//last resort home page if nothing else kicked in
if (!CustomerHomePageSet) {
window.$gz.store.commit("setHomePage", "/no-rights");
window.$gz.store.commit("setHomePage", "/no-features-available");
}
return;
@@ -705,7 +708,10 @@ function initNavPanel() {
//*** 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) {
if (
(licenseState == 1) &
(window.$gz.store.state.isSubContractorUser == false)
) {
addNavItem(
"Evaluate",
"$ayiRocket",

View File

@@ -26,6 +26,9 @@ export default new Vuex.Store({
apiToken: "-",
downloadToken: "-",
tfaEnabled: undefined,
notifyAvailable: true,
isCustomerUser: false,
isSubContractorUser: false,
customerRights: {},
userId: 0,
userName: "NOT AUTHENTICATED",
@@ -69,10 +72,18 @@ export default new Vuex.Store({
state.apiToken = data.apiToken;
state.userName = data.userName;
state.userType = data.userType;
state.isSubContractorUser = data.userType == 5;
state.isCustomerUser = data.userType == 3 || data.userType == 4;
state.downloadToken = data.dlt;
state.tfaEnabled = data.tfaEnabled;
if (data.customerRights) {
state.customerRights = data.customerRights;
//only a customer user could have zero access to notifications
state.notifyAvailable =
data.customerRights.notifyServiceImminent == true ||
data.customerRights.notifyCSRAccepted == true ||
data.customerRights.notifyCSRRejected == true ||
data.customerRights.notifyWOCreated == true;
}
},
logout(state) {
@@ -86,6 +97,9 @@ export default new Vuex.Store({
state.userName = "NOT AUTHENTICATED";
state.roles = 0;
state.userType = 0;
state.notifyAvailable = true;
state.isCustomerUser = false;
state.isSubContractorUser = false;
state.homePage = undefined;
state.navItems = [];
state.translationText = {};

View File

@@ -1,6 +1,7 @@
<template>
<div>
{{ $store.state.customerRights }}
todo: backend customer rights checks in conjunction with this form
<UnderConstruction data-cy="underconstruction" />
</div>
</template>

View File

@@ -8,8 +8,9 @@
<h1>UNDER CONSTRUCTION</h1>
<h2>
Copied from inv part assembly and not implemented as customer work
order yet
order yet. Backend customer rights check in conjunction with this
</h2>
{{ $store.state.customerRights }}
</v-row>
</v-form>
</div>

View File

@@ -1,5 +1,9 @@
<template>
<UnderConstruction data-cy="underconstruction" />
<div>
{{ $store.state.customerRights }}
todo: backend customer rights check in addition to here
<UnderConstruction data-cy="underconstruction" />
</div>
</template>
<script>

View File

@@ -77,6 +77,9 @@ export default {
vm.formState.ready = true;
}
},
beforeRouteEnter(to, from, next) {
next(window.$gz.store.state.notifyAvailable);
},
beforeDestroy() {
window.$gz.eventBus.$off("menu-click", clickHandler);
},

View File

@@ -2,7 +2,7 @@
<v-row justify-center>
<v-col cols="12">
<div class="text-center">
<v-icon color="red" size="100">$ayiDragon</v-icon>
<v-icon color="primary" size="100">$ayiEgg</v-icon>
<div class="text-h5 mt-8" v-if="ready">
{{ $ay.t("NoFeaturesAvailable") }}
</div>