This commit is contained in:
2020-12-15 01:25:55 +00:00
parent a014d28123
commit 329e3078e5
2 changed files with 37 additions and 34 deletions

View File

@@ -22,14 +22,23 @@ todo: All biz objects getasync should be notracking?
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?)
todo: biz rule like validatecansave and validatecandelete but validatecanFetch for things like own memos and conditional biz rules like subcontractor seeing only own shit etc?
............................................................
currently doing: MEMO -
Post redirect back to memo list or go back one nav item (probably best go backward)
READ format needs to show the wiki and custom fields and attached files
Read needs to set viewed flag on GET
READ menu items
Reply, Forward
compose - must filter OUT outside users, currently they show, new picklist I guess with extra criteria?
search results should not pull up other's memo's
exclude from searching? Not searchable??
Or post process??

View File

@@ -266,10 +266,10 @@ export default {
wiki: null,
customFields: "{}",
tags: [],
viewed: null,
replied: null,
fromId: null,
toId: null,
viewed: false,
replied: false,
fromId: 1,
toId: 1,
sent: null,
fromName: null
},
@@ -427,9 +427,13 @@ export default {
},
async submit() {
let vm = this;
if (vm.canSave == false) {
console.log("Can save is false");
return;
let userIdList = [];
if (vm.toUsers.length > 0) {
vm.toUsers.forEach(z => {
userIdList.push(z.id);
});
} else {
throw "No users selected";
}
try {
@@ -440,38 +444,28 @@ export default {
let url = API_BASE_URL; // + vm.$route.params.recordid;
//clear any errors vm might be around from previous submit
window.$gz.form.deleteAllErrorBoxErrors(vm);
let res = await window.$gz.api.upsert(url, vm.obj);
vm.obj.sent = window.$gz.locale.nowUTC8601String();
let res = await window.$gz.api.post(url, {
users: userIdList,
memo: vm.obj
});
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
//Logic for detecting if a post or put: if id then it was a post, if no id then it was a put
if (res.data.id) {
//POST - whole new object returned
vm.obj = res.data;
//Change URL to new record
//NOTE: will not cause a page re-render, almost nothing does unless forced with a KEY property or using router.GO()
this.$router.push({
name: "memo-edit",
params: {
recordid: res.data.id,
obj: res.data // Pass data object to new form
}
});
} else {
//PUT - only concurrency token is returned (**warning, if server changes object other fields then this needs to act more like POST above but is more efficient this way**)
//Handle "put" of an existing record (UPDATE)
vm.obj.concurrency = res.data.concurrency;
}
//Update the form status
window.$gz.form.setFormState({
vm: vm,
dirty: false,
valid: true
});
vm.$router.go(-1);
// vm.pickListSelectedUserId = null;
// vm.items = [];
// vm.toUsers = [];
// vm.obj.notes = null;
// vm.obj.name = null;
// //Only a post, no data returned
// window.$gz.form.setFormState({
// vm: vm,
// dirty: false
// });
// vm.updateSave();
}
} catch (ex) {
window.$gz.errorHandler.handleFormError(ex, vm);