From 329e3078e5da5cf408c96fe9ebf6a813c618a803 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 15 Dec 2020 01:25:55 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 9 +++++ ayanova/src/views/home-memo.vue | 62 +++++++++++++++------------------ 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 983a12c1..395245ee 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -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?? diff --git a/ayanova/src/views/home-memo.vue b/ayanova/src/views/home-memo.vue index bb665b36..740faf03 100644 --- a/ayanova/src/views/home-memo.vue +++ b/ayanova/src/views/home-memo.vue @@ -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);