This commit is contained in:
2019-05-02 22:45:51 +00:00
parent f935f3a66b
commit c90c915e1f
6 changed files with 65 additions and 27 deletions

View File

@@ -72,7 +72,7 @@ All platforms and browsers
- TO TEST: Calendar on iPad in two occasions with ff and opera the calendar date could not be selected until a time was changed then the date worked. Before that it would always stay the same no matter what selection was made and the UI would not show a change on select or press of date either. - TO TEST: Calendar on iPad in two occasions with ff and opera the calendar date could not be selected until a time was changed then the date worked. Before that it would always stay the same no matter what selection was made and the UI would not show a change on select or press of date either.
- Navigation guard: navigate away with unsaved changes should warn and prevent but have option to continue anyway - Navigation guard: navigate away with unsaved changes should warn and prevent but have option to continue anyway
- Logout needs the same request
### RETEST ALL DEVICES WHEN GET TO HERE ##### ### RETEST ALL DEVICES WHEN GET TO HERE #####

View File

@@ -53,9 +53,8 @@ export default {
}); });
}); });
}, },
/////////////////////////////////////
//////////////////////////// // Are you sure you want to delete?
//
// //
confirmDelete(vm) { confirmDelete(vm) {
//https://github.com/yariksav/vuetify-dialog#readme //https://github.com/yariksav/vuetify-dialog#readme
@@ -75,6 +74,26 @@ export default {
} }
] ]
}); });
}, /////////////////////////////////////
// Are you sure you want to delete?
//
confirmLeaveUnsaved(vm) {
return vm.$dialog.warning({
text: vm.$gzlocale.get("AreYouSureUnsavedChanges"),
title: vm.$gzlocale.get("Leave"),
icon: "fa-exclamation-triangle",
actions: [
{
text: vm.$gzlocale.get("Cancel"),
key: false
},
{
text: vm.$gzlocale.get("Leave"),
color: "red",
key: true
}
]
});
} }
//new functions above here //new functions above here
}; };

View File

@@ -1,5 +1,5 @@
/* Xeslint-disable */ /* Xeslint-disable */
import { processLogout } from "./authutil"; //import { processLogout } from "./authutil";
///////////////////////////////// /////////////////////////////////
// Menu utils and handlers // Menu utils and handlers
@@ -123,8 +123,20 @@ export default {
window.open(helpurl, "_blank"); window.open(helpurl, "_blank");
break; break;
case "logout": case "logout":
processLogout();
vm.$router.push({ name: "login" }); vm.$router.push({ name: "login" });
// if (vm.formState && vm.formState.dirty) {
// vm.$gzdialog.confirmLeaveUnsaved(vm).then(dialogResult => {
// if (dialogResult == true) {
// processLogout();
// vm.$router.push({ name: "login" });
// } else {
// return;
// }
// });
// } else {
// processLogout();
// vm.$router.push({ name: "login" });
// }
break; break;
case "nav": case "nav":
vm.$router.push({ name: item.data }); vm.$router.push({ name: item.data });

View File

@@ -92,7 +92,9 @@ export default {
"ErrorServerUnresponsive", "ErrorServerUnresponsive",
"ErrorUserNotAuthenticated", "ErrorUserNotAuthenticated",
"ErrorUserNotAuthorized", "ErrorUserNotAuthorized",
"DeletePrompt" "DeletePrompt",
"AreYouSureUnsavedChanges",
"Leave"
], ],
decimalValidate(required) { decimalValidate(required) {
return { required: required, decimal: [2, this.formats.decimalSeparator] }; return { required: required, decimal: [2, this.formats.decimalSeparator] };

View File

@@ -10,17 +10,14 @@
transition="scale-transition" transition="scale-transition"
class="multi-line" class="multi-line"
outline outline
>{{ formState.errorBoxMessage }}</v-alert >{{ formState.errorBoxMessage }}</v-alert>
>
</v-flex> </v-flex>
<v-flex xs12 md12> <v-flex xs12 md12>
<div v-if="this.formState.ready"> <div v-if="this.formState.ready">
<v-toolbar flat> <v-toolbar flat>
<v-toolbar-title> <v-toolbar-title>
<v-icon large color="primary">fa-splotch</v-icon> <v-icon large color="primary">fa-splotch</v-icon>
<span class="hidden-sm-and-down"> <span class="hidden-sm-and-down">{{ this.$gzlocale.get("WidgetList") }}</span>
{{ this.$gzlocale.get("WidgetList") }}
</span>
</v-toolbar-title> </v-toolbar-title>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn icon @click="newItem()"> <v-btn icon @click="newItem()">
@@ -51,17 +48,13 @@
<template slot="items" slot-scope="props"> <template slot="items" slot-scope="props">
<td class="text-xs-left">{{ props.item.name | capitalize }}</td> <td class="text-xs-left">{{ props.item.name | capitalize }}</td>
<td class="text-xs-left">{{ props.item.serial }}</td> <td class="text-xs-left">{{ props.item.serial }}</td>
<td class="text-xs-left"> <td class="text-xs-left">{{ props.item.dollarAmount | currency }}</td>
{{ props.item.dollarAmount | currency }}
</td>
<td class="text-xs-left">{{ props.item.active | boolastext }}</td> <td class="text-xs-left">{{ props.item.active | boolastext }}</td>
<td class="text-xs-left">{{ props.item.roles }}</td> <td class="text-xs-left">{{ props.item.roles }}</td>
<td class="text-xs-left">{{ props.item.startDate | shortdate }}</td> <td class="text-xs-left">{{ props.item.startDate | shortdate }}</td>
<td class="text-xs-left">{{ props.item.endDate | shortdate }}</td> <td class="text-xs-left">{{ props.item.endDate | shortdate }}</td>
<td class="justify-center layout px-0"> <td class="justify-center layout px-0">
<v-icon class="mr-3" @click="editItem(props.item)" <v-icon class="mr-3" @click="editItem(props.item)">fa-pencil-alt</v-icon>
>fa-pencil-alt</v-icon
>
</td> </td>
</template> </template>
</v-data-table> </v-data-table>

View File

@@ -13,8 +13,7 @@
transition="scale-transition" transition="scale-transition"
class="multi-line" class="multi-line"
outline outline
>{{ formState.errorBoxMessage }}</v-alert >{{ formState.errorBoxMessage }}</v-alert>
>
</v-flex> </v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
<v-text-field <v-text-field
@@ -141,15 +140,15 @@
<v-layout align-left justify-center row wrap mt-5> <v-layout align-left justify-center row wrap mt-5>
<v-flex xs6 sm4> <v-flex xs6 sm4>
READY: {{ formState.ready }} READY: {{ formState.ready }}
<br /> <br>
LOADING: {{ formState.loading }} LOADING: {{ formState.loading }}
<br /> <br>
DIRTY: {{ formState.dirty }} DIRTY: {{ formState.dirty }}
<br /> <br>
VALID: {{ formState.valid }} VALID: {{ formState.valid }}
<br /> <br>
READONLY: {{ formState.readOnly }} READONLY: {{ formState.readOnly }}
<br /> <br>
</v-flex> </v-flex>
</v-layout> </v-layout>
</v-form> </v-form>
@@ -261,7 +260,7 @@ export default {
]; ];
var vm = this; var vm = this;
this.$gzlocale this.$gzlocale
.fetch(ltKeysRequired) .fetch(ltKeysRequired)
.then(() => (vm.formState.ready = true)) .then(() => (vm.formState.ready = true))
.catch(err => { .catch(err => {
vm.formState.ready = true; vm.formState.ready = true;
@@ -272,6 +271,20 @@ export default {
this.$gzevent.$on("menu-click", clickHandler); this.$gzevent.$on("menu-click", clickHandler);
this.getDataFromApi(); this.getDataFromApi();
}, },
beforeRouteLeave(to, from, next) {
var vm = this;
if (this.formState.dirty) {
vm.$gzdialog.confirmLeaveUnsaved(vm).then(dialogResult => {
if (dialogResult == true) {
next();
} else {
next(false);
}
});
} else {
next();
}
},
beforeDestroy() { beforeDestroy() {
this.$gzevent.$off("menu-click", clickHandler); this.$gzevent.$off("menu-click", clickHandler);
}, },
@@ -403,7 +416,6 @@ export default {
}, },
remove() { remove() {
var vm = this; var vm = this;
//Prompt:
vm.$gzdialog.confirmDelete(vm).then(dialogResult => { vm.$gzdialog.confirmDelete(vm).then(dialogResult => {
if (dialogResult == true) { if (dialogResult == true) {
//do the delete //do the delete