This commit is contained in:
2020-12-14 20:32:12 +00:00
parent 98e83a54e1
commit a19e1b273f
2 changed files with 113 additions and 89 deletions

View File

@@ -15,6 +15,10 @@ todo: v8Migrate must be used with SuperUser account, make sure that the plugin c
this way we don't need as many checks for some things such as migrating user memos on behalf of other users which is normally a security violation etc
also will ensure not just any user can start migration and fuck up the target server
todo: All biz objects getasync should be notracking?
or would thast fuck up internal ops like batch jobs or duplicate?
todo: AyaFormFieldDefinitions looking a little suspect now as it gets huge.
should it really cache all of them all the time?
would it be faster / better for memory to return as requested dynamically (switch?)
@@ -30,6 +34,9 @@ currently doing: MEMO -
exclude from searching? Not searchable??
Or post process??
Customer users can memo - NO
Could they in v7? NO so not here either
EACH OBJECT DEV CYCLE:
FIRST
Check cases, make sure not changing the object fundamentally, many v7 objects are going to change for cases (particularly inventory related)

View File

@@ -5,79 +5,105 @@
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
<v-form ref="form">
<v-row>
<v-col cols="12">
<v-text-field
v-model="obj.name"
:readonly="formState.readOnly"
:label="$ay.t('MemoSubject')"
:rules="[form().required(this, 'name')]"
:error-messages="form().serverErrors(this, 'name')"
ref="name"
data-cy="name"
@input="fieldValueChanged('name')"
></v-text-field>
</v-col>
<template v-if="!composing">
<v-row>
<v-col cols="12">
<p>
<span class="text-h6">{{ $ay.t("MemoSent") }}<br /></span
>{{ $ay.dt(obj.sent) }}
</p>
<p>
<span class="text-h6">{{ $ay.t("MemoFromID") }}<br /></span
>{{ obj.fromName }}
</p>
<p>
<span class="text-h6">{{ $ay.t("MemoSubject") }}<br /></span
>{{ obj.name }}
</p>
</v-col>
<v-col cols="12">
<v-textarea v-model="obj.notes" readonly auto-grow></v-textarea>
</v-col>
</v-row>
</template>
<template v-else>
<v-row>
<v-col cols="12">
<v-text-field
v-model="obj.name"
:readonly="formState.readOnly"
:label="$ay.t('MemoSubject')"
:rules="[form().required(this, 'name')]"
:error-messages="form().serverErrors(this, 'name')"
ref="name"
data-cy="name"
@input="fieldValueChanged('name')"
></v-text-field>
</v-col>
<v-col cols="12">
<v-textarea
v-model="obj.notes"
:readonly="formState.readOnly"
:label="$ay.t('MemoMessage')"
:rules="[form().required(this, 'notes')]"
:error-messages="form().serverErrors(this, 'notes')"
ref="notes"
data-cy="notes"
@input="fieldValueChanged('notes')"
auto-grow
></v-textarea>
</v-col>
<v-col cols="12">
<v-textarea
v-model="obj.notes"
:readonly="formState.readOnly"
:label="$ay.t('MemoMessage')"
:rules="[form().required(this, 'notes')]"
:error-messages="form().serverErrors(this, 'notes')"
ref="notes"
data-cy="notes"
@input="fieldValueChanged('notes')"
auto-grow
></v-textarea>
</v-col>
<!-- --------------------------------- -->
<!-- --------------------------------- -->
<v-col v-if="form().showMe(this, 'Tags')" cols="12">
<gz-tag-picker
v-model="obj.tags"
:readonly="formState.readOnly"
ref="tags"
data-cy="tags"
:error-messages="form().serverErrors(this, 'tags')"
@input="fieldValueChanged('tags')"
></gz-tag-picker>
</v-col>
<v-col v-if="form().showMe(this, 'Tags')" cols="12">
<gz-tag-picker
v-model="obj.tags"
:readonly="formState.readOnly"
ref="tags"
data-cy="tags"
:error-messages="form().serverErrors(this, 'tags')"
@input="fieldValueChanged('tags')"
></gz-tag-picker>
</v-col>
<v-col cols="12">
<gz-custom-fields
v-model="obj.customFields"
:formKey="formCustomTemplateKey"
:readonly="formState.readOnly"
:parentVM="this"
ref="customFields"
data-cy="customFields"
:error-messages="form().serverErrors(this, 'customFields')"
@input="fieldValueChanged('customFields')"
></gz-custom-fields>
</v-col>
<v-col cols="12">
<gz-custom-fields
v-model="obj.customFields"
:formKey="formCustomTemplateKey"
:readonly="formState.readOnly"
:parentVM="this"
ref="customFields"
data-cy="customFields"
:error-messages="form().serverErrors(this, 'customFields')"
@input="fieldValueChanged('customFields')"
></gz-custom-fields>
</v-col>
<v-col v-if="form().showMe(this, 'Wiki')" cols="12">
<gz-wiki
:ayaType="ayaType"
:ayaId="obj.id"
ref="wiki"
v-model="obj.wiki"
:readonly="formState.readOnly"
@input="fieldValueChanged('wiki')"
></gz-wiki
></v-col>
<v-col v-if="form().showMe(this, 'Wiki')" cols="12">
<gz-wiki
:ayaType="ayaType"
:ayaId="obj.id"
ref="wiki"
v-model="obj.wiki"
:readonly="formState.readOnly"
@input="fieldValueChanged('wiki')"
></gz-wiki
></v-col>
<v-col v-if="form().showMe(this, 'Attachments') && obj.id" cols="12">
<gz-attachments
:readonly="formState.readOnly"
:ayaType="ayaType"
:ayaId="obj.id"
></gz-attachments
></v-col>
</v-row>
<v-col
v-if="form().showMe(this, 'Attachments') && obj.id"
cols="12"
>
<gz-attachments
:readonly="formState.readOnly"
:ayaType="ayaType"
:ayaId="obj.id"
></gz-attachments
></v-col>
</v-row>
</template>
</v-form>
</div>
<template v-if="!formState.ready">
@@ -108,11 +134,13 @@ export default {
await initForm(vm);
vm.rights = window.$gz.role.getRights(window.$gz.type.Memo);
vm.formState.readOnly = !vm.rights.change;
// vm.formState.readOnly = !vm.rights.change;
window.$gz.eventBus.$on("menu-click", clickHandler);
//id 0 means create a new record don't load one
if (vm.$route.params.recordid != 0) {
vm.composing = false;
vm.formState.readOnly = true;
//is there already an obj from a prior operation?
if (this.$route.params.obj) {
//yes, no need to fetch it
@@ -126,7 +154,9 @@ export default {
}
} else {
//NEW MEMO, set defaults
this.obj.fromId = window.$gz.store.state.userId;
vm.composing = true;
vm.formState.readOnly = false;
vm.obj.fromId = window.$gz.store.state.userId;
window.$gz.form.setFormState({
vm: vm,
loading: false
@@ -179,7 +209,8 @@ export default {
replied: null,
fromId: null,
toId: null,
sent: null
sent: null,
fromName: null
},
tab: 0,
formState: {
@@ -193,7 +224,8 @@ export default {
serverError: {}
},
rights: window.$gz.role.defaultRightsObject(),
ayaType: window.$gz.type.Memo
ayaType: window.$gz.type.Memo,
composing: false
};
},
//WATCHERS
@@ -222,6 +254,7 @@ export default {
deep: true
}
},
methods: {
canSave: function() {
return this.formState.valid && this.formState.dirty;
@@ -519,24 +552,6 @@ function generateMenu(vm) {
});
}
if (vm.rights.change) {
menuOptions.menuItems.push({
title: "Duplicate",
icon: "$ayiClone",
key: FORM_KEY + ":duplicate",
vm: vm
});
}
menuOptions.menuItems.push({ divider: true, inset: false });
menuOptions.menuItems.push({
title: "GeoView",
icon: "$ayiMapMarked",
key: FORM_KEY + ":geoview",
vm: vm
});
menuOptions.menuItems.push({ divider: true, inset: false });
window.$gz.eventBus.$emit("menu-change", menuOptions);
@@ -562,6 +577,8 @@ async function fetchTranslatedText(vm) {
"MemoSubject",
"MemoMessage",
"MemoToID",
"MemoFromID",
"MemoSent",
"MemoCustom1",
"MemoCustom2",
"MemoCustom3",