This commit is contained in:
2020-04-04 22:53:22 +00:00
parent 5124aed04b
commit a065571e8b
4 changed files with 46 additions and 12 deletions

View File

@@ -24,6 +24,8 @@
item-value="id"
:label="$ay.t('PickListTemplates')"
@input="templateSelected"
:data-cy="!!$ay.dev ? 'SelectTemplate' : false"
:disabled="formState.dirty"
>
</v-select>
</v-col>
@@ -143,6 +145,7 @@ export default {
workingArray: [],
fieldKeys: [],
templateId: 0,
lastFetchedTemplateId: 0,
formState: {
ready: false,
dirty: false,
@@ -226,14 +229,17 @@ export default {
});
},
templateSelected: function() {
if (this.formState.dirty) {
window.$gz.dialog.confirmLeaveUnsaved().then(dialogResult => {
if (dialogResult != true) {
return;
}
});
let vm = this;
if (vm.lastFetchedTemplateId == vm.templateId) {
return; //no change
}
vm.workingArray = [];
if (!vm.templateId || vm.templateId == 0) {
vm.lastFetchedTemplateId = 0;
return;
} else {
vm.getDataFromApi();
}
this.getDataFromApi();
},
getDataFromApi() {
let vm = this;
@@ -241,7 +247,7 @@ export default {
if (!vm.templateId || vm.templateId == 0) {
return;
}
vm.lastFetchedTemplateId = vm.templateId;
window.$gz.form.deleteAllErrorBoxErrors(vm);
//get available fields

View File

@@ -2,7 +2,11 @@
<v-card class="mx-auto" v-if="formState.ready">
<v-list subheader>
<v-subheader>{{ $ay.t("UserInterfaceSettings") }}</v-subheader>
<v-list-item link to="adm-global-select-templates">
<v-list-item
link
to="adm-global-select-templates"
:data-cy="!!$ay.dev ? 'picklisttemplates' : false"
>
<v-list-item-title>{{ $ay.t("PickListTemplates") }}</v-list-item-title>
</v-list-item>
</v-list>