This commit is contained in:
2019-05-06 22:34:53 +00:00
parent f44e04ddc7
commit ec3631c833
5 changed files with 52 additions and 29 deletions

View File

@@ -30,6 +30,7 @@ TODO:
- Can the save button be enabled more quickly after losing focus on the edited field or should I revamp that? - Can the save button be enabled more quickly after losing focus on the edited field or should I revamp that?
- I can see users making a quick change clicking on save once and it won't save but they think it has. - I can see users making a quick change clicking on save once and it won't save but they think it has.
- Right now you need to click twice on save - Right now you need to click twice on save
- On object not found when deleting an item and trying to reload the edit page, shoudl redirect to home or back instead or just not there
### RETEST ALL DEVICES WHEN GET TO HERE ##### ### RETEST ALL DEVICES WHEN GET TO HERE #####

View File

@@ -485,7 +485,8 @@ export default {
// loading:bool | undefined} // loading:bool | undefined}
// //
setFormState(newState) { setFormState(newState) {
Vue.nextTick(function() { //this returns a promise so any function that needs to wait for this can utilize that
return Vue.nextTick(function() {
if (newState.valid != undefined) { if (newState.valid != undefined) {
newState.vm.formState.valid = newState.valid; newState.vm.formState.valid = newState.valid;
} }

View File

@@ -10,14 +10,17 @@
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">{{ this.$gzlocale.get("WidgetList") }}</span> <span class="hidden-sm-and-down">{{
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()">
@@ -48,13 +51,17 @@
<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">{{ 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.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)">fa-pencil-alt</v-icon> <v-icon class="mr-3" @click="editItem(props.item)"
>fa-pencil-alt</v-icon
>
</td> </td>
</template> </template>
</v-data-table> </v-data-table>

View File

@@ -13,7 +13,8 @@
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
@@ -140,15 +141,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>
@@ -228,6 +229,8 @@ function generateMenu(vm, readOnly) {
vm.$gzevent.$emit("menu-change", menuOptions); vm.$gzevent.$emit("menu-change", menuOptions);
} }
var JUST_DELETED=false;
export default { export default {
beforeCreate() { beforeCreate() {
//Cache all required lt keys //Cache all required lt keys
@@ -273,7 +276,7 @@ export default {
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
var vm = this; var vm = this;
if (this.formState.dirty) { if (this.formState.dirty && !JUST_DELETED) {
vm.$gzdialog.confirmLeaveUnsaved(vm).then(dialogResult => { vm.$gzdialog.confirmLeaveUnsaved(vm).then(dialogResult => {
if (dialogResult == true) { if (dialogResult == true) {
next(); next();
@@ -430,14 +433,25 @@ export default {
vm.formState.serverError = res.error; vm.formState.serverError = res.error;
vm.$gzform.setErrorBoxErrors(vm); vm.$gzform.setErrorBoxErrors(vm);
} else { } else {
//success set to not dirty so navigation guard is not triggered JUST_DELETED=true;
vm.$gzform.setFormState({ // navigate backwards
vm: vm, vm.$router.go(-1);
dirty: false
});
// navigate backwards
vm.$router.go(-1); // //es-lint-disable-next-line
// console.log(vm.$gzform.setFormState);
// //success set to not dirty so navigation guard is not triggered
// var that=vm;
// that.$gzform
// .setFormState({
// vm: that,
// dirty: false
// })
// .then(() =>{
// // navigate backwards
// that.$router.go(-1);
// }
// );
} }
}) })
.catch(function handleGetDataFromAPIError(error) { .catch(function handleGetDataFromAPIError(error) {

View File

@@ -12,13 +12,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>
<WidgetList/> <WidgetList />
<WarehouseTop/> <WarehouseTop />
<POTop/> <POTop />
<PartTop/> <PartTop />
<PartAssemblyTop/> <PartAssemblyTop />
<v-flex xs12 md4> <v-flex xs12 md4>
<v-card class="elevation-0 transparent"> <v-card class="elevation-0 transparent">
<v-card-text class="text-xs-center"> <v-card-text class="text-xs-center">
@@ -29,10 +30,9 @@
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
Cras facilisis mi vitae nunc lobortis pharetra. Nulla volutpat Cras facilisis mi vitae nunc lobortis pharetra. Nulla volutpat
tincidunt ornare. Pellentesque habitant morbi tristique senectus tincidunt ornare. Pellentesque habitant morbi tristique senectus et
et netus et malesuada fames ac turpis egestas. Nullam in aliquet netus et malesuada fames ac turpis egestas. Nullam in aliquet odio.
odio. Aliquam eu est vitae tellus bibendum tincidunt. Aliquam eu est vitae tellus bibendum tincidunt. Suspendisse potenti.
Suspendisse potenti.
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-flex> </v-flex>