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 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 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. todo: AyaFormFieldDefinitions looking a little suspect now as it gets huge.
should it really cache all of them all the time? should it really cache all of them all the time?
would it be faster / better for memory to return as requested dynamically (switch?) 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?? exclude from searching? Not searchable??
Or post process?? Or post process??
Customer users can memo - NO
Could they in v7? NO so not here either
EACH OBJECT DEV CYCLE: EACH OBJECT DEV CYCLE:
FIRST FIRST
Check cases, make sure not changing the object fundamentally, many v7 objects are going to change for cases (particularly inventory related) 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> <gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
<v-form ref="form"> <v-form ref="form">
<v-row> <template v-if="!composing">
<v-col cols="12"> <v-row>
<v-text-field <v-col cols="12">
v-model="obj.name" <p>
:readonly="formState.readOnly" <span class="text-h6">{{ $ay.t("MemoSent") }}<br /></span
:label="$ay.t('MemoSubject')" >{{ $ay.dt(obj.sent) }}
:rules="[form().required(this, 'name')]" </p>
:error-messages="form().serverErrors(this, 'name')" <p>
ref="name" <span class="text-h6">{{ $ay.t("MemoFromID") }}<br /></span
data-cy="name" >{{ obj.fromName }}
@input="fieldValueChanged('name')" </p>
></v-text-field> <p>
</v-col> <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-col cols="12">
<v-textarea <v-textarea
v-model="obj.notes" v-model="obj.notes"
:readonly="formState.readOnly" :readonly="formState.readOnly"
:label="$ay.t('MemoMessage')" :label="$ay.t('MemoMessage')"
:rules="[form().required(this, 'notes')]" :rules="[form().required(this, 'notes')]"
:error-messages="form().serverErrors(this, 'notes')" :error-messages="form().serverErrors(this, 'notes')"
ref="notes" ref="notes"
data-cy="notes" data-cy="notes"
@input="fieldValueChanged('notes')" @input="fieldValueChanged('notes')"
auto-grow auto-grow
></v-textarea> ></v-textarea>
</v-col> </v-col>
<!-- --------------------------------- --> <!-- --------------------------------- -->
<v-col v-if="form().showMe(this, 'Tags')" cols="12"> <v-col v-if="form().showMe(this, 'Tags')" cols="12">
<gz-tag-picker <gz-tag-picker
v-model="obj.tags" v-model="obj.tags"
:readonly="formState.readOnly" :readonly="formState.readOnly"
ref="tags" ref="tags"
data-cy="tags" data-cy="tags"
:error-messages="form().serverErrors(this, 'tags')" :error-messages="form().serverErrors(this, 'tags')"
@input="fieldValueChanged('tags')" @input="fieldValueChanged('tags')"
></gz-tag-picker> ></gz-tag-picker>
</v-col> </v-col>
<v-col cols="12"> <v-col cols="12">
<gz-custom-fields <gz-custom-fields
v-model="obj.customFields" v-model="obj.customFields"
:formKey="formCustomTemplateKey" :formKey="formCustomTemplateKey"
:readonly="formState.readOnly" :readonly="formState.readOnly"
:parentVM="this" :parentVM="this"
ref="customFields" ref="customFields"
data-cy="customFields" data-cy="customFields"
:error-messages="form().serverErrors(this, 'customFields')" :error-messages="form().serverErrors(this, 'customFields')"
@input="fieldValueChanged('customFields')" @input="fieldValueChanged('customFields')"
></gz-custom-fields> ></gz-custom-fields>
</v-col> </v-col>
<v-col v-if="form().showMe(this, 'Wiki')" cols="12"> <v-col v-if="form().showMe(this, 'Wiki')" cols="12">
<gz-wiki <gz-wiki
:ayaType="ayaType" :ayaType="ayaType"
:ayaId="obj.id" :ayaId="obj.id"
ref="wiki" ref="wiki"
v-model="obj.wiki" v-model="obj.wiki"
:readonly="formState.readOnly" :readonly="formState.readOnly"
@input="fieldValueChanged('wiki')" @input="fieldValueChanged('wiki')"
></gz-wiki ></gz-wiki
></v-col> ></v-col>
<v-col v-if="form().showMe(this, 'Attachments') && obj.id" cols="12"> <v-col
<gz-attachments v-if="form().showMe(this, 'Attachments') && obj.id"
:readonly="formState.readOnly" cols="12"
:ayaType="ayaType" >
:ayaId="obj.id" <gz-attachments
></gz-attachments :readonly="formState.readOnly"
></v-col> :ayaType="ayaType"
</v-row> :ayaId="obj.id"
></gz-attachments
></v-col>
</v-row>
</template>
</v-form> </v-form>
</div> </div>
<template v-if="!formState.ready"> <template v-if="!formState.ready">
@@ -108,11 +134,13 @@ export default {
await initForm(vm); await initForm(vm);
vm.rights = window.$gz.role.getRights(window.$gz.type.Memo); 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); window.$gz.eventBus.$on("menu-click", clickHandler);
//id 0 means create a new record don't load one //id 0 means create a new record don't load one
if (vm.$route.params.recordid != 0) { if (vm.$route.params.recordid != 0) {
vm.composing = false;
vm.formState.readOnly = true;
//is there already an obj from a prior operation? //is there already an obj from a prior operation?
if (this.$route.params.obj) { if (this.$route.params.obj) {
//yes, no need to fetch it //yes, no need to fetch it
@@ -126,7 +154,9 @@ export default {
} }
} else { } else {
//NEW MEMO, set defaults //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({ window.$gz.form.setFormState({
vm: vm, vm: vm,
loading: false loading: false
@@ -179,7 +209,8 @@ export default {
replied: null, replied: null,
fromId: null, fromId: null,
toId: null, toId: null,
sent: null sent: null,
fromName: null
}, },
tab: 0, tab: 0,
formState: { formState: {
@@ -193,7 +224,8 @@ export default {
serverError: {} serverError: {}
}, },
rights: window.$gz.role.defaultRightsObject(), rights: window.$gz.role.defaultRightsObject(),
ayaType: window.$gz.type.Memo ayaType: window.$gz.type.Memo,
composing: false
}; };
}, },
//WATCHERS //WATCHERS
@@ -222,6 +254,7 @@ export default {
deep: true deep: true
} }
}, },
methods: { methods: {
canSave: function() { canSave: function() {
return this.formState.valid && this.formState.dirty; 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 }); menuOptions.menuItems.push({ divider: true, inset: false });
window.$gz.eventBus.$emit("menu-change", menuOptions); window.$gz.eventBus.$emit("menu-change", menuOptions);
@@ -562,6 +577,8 @@ async function fetchTranslatedText(vm) {
"MemoSubject", "MemoSubject",
"MemoMessage", "MemoMessage",
"MemoToID", "MemoToID",
"MemoFromID",
"MemoSent",
"MemoCustom1", "MemoCustom1",
"MemoCustom2", "MemoCustom2",
"MemoCustom3", "MemoCustom3",