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. 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?)
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 - 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 READ menu items
Reply, Forward 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 search results should not pull up other's memo's
exclude from searching? Not searchable?? exclude from searching? Not searchable??
Or post process?? Or post process??

View File

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