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

View File

@@ -485,7 +485,8 @@ export default {
// loading:bool | undefined}
//
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) {
newState.vm.formState.valid = newState.valid;
}

View File

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

View File

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