This commit is contained in:
@@ -25,6 +25,8 @@ todo: Administration - translation
|
||||
|
||||
todo: help links for User, Users, Translations, Translation
|
||||
|
||||
|
||||
todo: set network speed in dev console of firefox to regular 2g then go through all forms and confirm all still works as this will expose any await issues
|
||||
todo: Administration - Attached files manager
|
||||
|
||||
todo: Administration - History
|
||||
|
||||
@@ -34,6 +34,12 @@ export default {
|
||||
params: { recordid: tid.id }
|
||||
});
|
||||
break;
|
||||
case ayatype.Translation:
|
||||
vm.$router.push({
|
||||
name: "adm-translation",
|
||||
params: { recordid: tid.id }
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
window.$gz.eventBus.$emit(
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<template>
|
||||
<v-container fluid>
|
||||
<gz-report-selector ref="reportSelector"></gz-report-selector>
|
||||
{{ formState }}
|
||||
<v-row v-if="formState.ready">
|
||||
<v-col>
|
||||
<v-form ref="form">
|
||||
<v-row>
|
||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||
|
||||
<!-- <v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||
<v-text-field
|
||||
v-model="obj.name"
|
||||
:readonly="formState.readOnly"
|
||||
@@ -25,7 +26,7 @@
|
||||
:data-cy="!!$ay.dev ? 'name' : false"
|
||||
@input="fieldValueChanged('name')"
|
||||
></v-text-field>
|
||||
</v-col> -->
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-form>
|
||||
</v-col>
|
||||
@@ -141,7 +142,7 @@ export default {
|
||||
}
|
||||
|
||||
//enable / disable duplicate / new button
|
||||
if (!val.dirty && val.valid && !val.readOnly) {
|
||||
if (!val.dirty && val.valid) {
|
||||
window.$gz.eventBus.$emit(
|
||||
"menu-enable-item",
|
||||
FORM_KEY + ":duplicate"
|
||||
@@ -163,7 +164,7 @@ export default {
|
||||
return this.formState.valid && this.formState.dirty;
|
||||
},
|
||||
canDuplicate: function() {
|
||||
return this.formState.valid && !this.formState.dirty;
|
||||
return this.formState.valid && !this.formState.dirty && vm.rights.change;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -206,22 +207,22 @@ export default {
|
||||
}
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
vm.formState.loading = false;
|
||||
} else {
|
||||
vm.obj = res.data;
|
||||
//modify the menu as necessary
|
||||
generateMenu(vm);
|
||||
|
||||
//Update the form status
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false,
|
||||
valid: true,
|
||||
loading: false
|
||||
loading: false,
|
||||
readOnly: !vm.rights.change || res.data.stock == true
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
} finally {
|
||||
vm.formState.loading = false;
|
||||
}
|
||||
},
|
||||
@@ -491,7 +492,7 @@ let JUST_DELETED = false;
|
||||
//
|
||||
async function initForm(vm) {
|
||||
await fetchTranslatedText(vm);
|
||||
await window.$gz.formCustomTemplate.get(FORM_CUSTOM_TEMPLATE_KEY);
|
||||
//await window.$gz.formCustomTemplate.get(FORM_CUSTOM_TEMPLATE_KEY);
|
||||
await populateSelectionLists(vm);
|
||||
}
|
||||
|
||||
@@ -500,7 +501,7 @@ async function initForm(vm) {
|
||||
// Ensures UI translated text is available
|
||||
//
|
||||
async function fetchTranslatedText(vm) {
|
||||
await window.$gz.translation.cacheTranslations(["Translation"]);
|
||||
await window.$gz.translation.cacheTranslations(["Translation", "Name"]);
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
<script>
|
||||
const FORM_KEY = "adm-translations";
|
||||
export default {
|
||||
created() {
|
||||
async created() {
|
||||
this.rights = window.$gz.role.getRights(window.$gz.type.Translation);
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
await fetchTranslatedText(this);
|
||||
generateMenu(this);
|
||||
},
|
||||
beforeDestroy() {
|
||||
@@ -106,4 +107,12 @@ function generateMenu(vm) {
|
||||
|
||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// Ensures UI translated text is available
|
||||
//
|
||||
async function fetchTranslatedText(vm) {
|
||||
await window.$gz.translation.cacheTranslations(["ReadOnly"]);
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user