From c754fd35ce2a554ee2e820a651501133ee5f9e03 Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Mon, 17 Apr 2023 10:56:00 +0530 Subject: [PATCH] fix: simplify QuickEditForm and usage - type QuickEditForm, TwoColumnForm - dont use QuickEditForm for tables - dont keep-alice QuickEditForm --- src/components/Controls/Link.vue | 17 +-- src/components/TwoColumnForm.vue | 29 +++-- src/pages/CommonForm/CommonForm.vue | 16 +-- src/pages/Desk.vue | 10 +- src/pages/QuickEditForm.vue | 178 ++++++++++++++-------------- src/utils/types.ts | 5 +- src/utils/ui.ts | 61 ++-------- 7 files changed, 130 insertions(+), 186 deletions(-) diff --git a/src/components/Controls/Link.vue b/src/components/Controls/Link.vue index a42e9140..03a0683f 100644 --- a/src/components/Controls/Link.vue +++ b/src/components/Controls/Link.vue @@ -131,24 +131,17 @@ export default { }, async openNewDoc() { const schemaName = this.df.target; - const linkDoc = fyo.doc.getNewDoc(schemaName); - + const name = this.linkValue; const filters = await this.getCreateFilters(); - const { openQuickEdit } = await import('src/utils/ui'); - openQuickEdit({ - schemaName, - name: linkDoc.name, - defaults: Object.assign({}, filters, { - name: this.linkValue, - }), - }); + const doc = fyo.doc.getNewDoc(schemaName, { name, ...filters }); + openQuickEdit({ doc }); - linkDoc.once('afterSync', () => { + doc.once('afterSync', () => { this.$router.back(); this.results = []; - this.triggerChange(linkDoc.name); + this.triggerChange(doc.name); }); }, async getCreateFilters() { diff --git a/src/components/TwoColumnForm.vue b/src/components/TwoColumnForm.vue index 4c6de11f..8f9ada7f 100644 --- a/src/components/TwoColumnForm.vue +++ b/src/components/TwoColumnForm.vue @@ -8,7 +8,7 @@ ref="controls" size="small" :df="df" - :value="doc[df.fieldname]" + :value="(doc[df.fieldname] ?? []) as unknown[]" @change="async (value) => await onChange(df, value)" /> @@ -52,21 +52,25 @@ - diff --git a/src/pages/CommonForm/CommonForm.vue b/src/pages/CommonForm/CommonForm.vue index 16297d8a..4e5ef216 100644 --- a/src/pages/CommonForm/CommonForm.vue +++ b/src/pages/CommonForm/CommonForm.vue @@ -120,20 +120,7 @@