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.
- 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 #####

View File

@@ -53,9 +53,8 @@ export default {
});
});
},
////////////////////////////
//
/////////////////////////////////////
// Are you sure you want to delete?
//
confirmDelete(vm) {
//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
};

View File

@@ -1,5 +1,5 @@
/* Xeslint-disable */
import { processLogout } from "./authutil";
//import { processLogout } from "./authutil";
/////////////////////////////////
// Menu utils and handlers
@@ -123,8 +123,20 @@ export default {
window.open(helpurl, "_blank");
break;
case "logout":
processLogout();
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;
case "nav":
vm.$router.push({ name: item.data });

View File

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

View File

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

View File

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