From e6b8c8a1b6bcd43825aa1eea19aeb136ae97bd6c Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Sat, 30 Apr 2022 00:34:08 +0530 Subject: [PATCH] incr: get JournalEntryForm to render --- fyo/utils/index.ts | 11 ++- src/components/Controls/AutoComplete.vue | 1 - src/components/Controls/Select.vue | 8 +- src/components/Controls/Table.vue | 8 +- src/pages/JournalEntryForm.vue | 115 ++++++++++++++--------- src/pages/QuickEditForm.vue | 24 +++-- src/renderer.ts | 1 + src/router.ts | 6 +- 8 files changed, 98 insertions(+), 76 deletions(-) diff --git a/fyo/utils/index.ts b/fyo/utils/index.ts index f59170df..ba7bb131 100644 --- a/fyo/utils/index.ts +++ b/fyo/utils/index.ts @@ -3,6 +3,7 @@ import { Doc } from 'fyo/model/doc'; import { Action } from 'fyo/model/types'; import { pesa } from 'pesa'; import { Field, OptionField, SelectOption } from 'schemas/types'; +import { getIsNullOrUndef } from 'utils'; export function slug(str: string) { return str @@ -77,7 +78,7 @@ export async function getSingleValue( export function getOptionList( field: Field, - doc: Doc | undefined + doc: Doc | undefined | null ): SelectOption[] { const list = getRawOptionList(field, doc); return list.map((option) => { @@ -92,17 +93,17 @@ export function getOptionList( }); } -function getRawOptionList(field: Field, doc: Doc | undefined) { +function getRawOptionList(field: Field, doc: Doc | undefined | null) { const options = (field as OptionField).options; if (options && options.length > 0) { return (field as OptionField).options; } - if (doc === undefined) { + if (getIsNullOrUndef(doc)) { return []; } - const Model = doc.fyo.models[doc.schemaName]; + const Model = doc!.fyo.models[doc!.schemaName]; if (Model === undefined) { return []; } @@ -112,5 +113,5 @@ function getRawOptionList(field: Field, doc: Doc | undefined) { return []; } - return getList(doc); + return getList(doc!); } diff --git a/src/components/Controls/AutoComplete.vue b/src/components/Controls/AutoComplete.vue index d317d526..f4eb00a8 100644 --- a/src/components/Controls/AutoComplete.vue +++ b/src/components/Controls/AutoComplete.vue @@ -16,7 +16,6 @@ flex items-center justify-between - bg-white focus-within:bg-gray-200 pr-2 rounded diff --git a/src/components/Controls/Select.vue b/src/components/Controls/Select.vue index 871e47ec..b30964db 100644 --- a/src/components/Controls/Select.vue +++ b/src/components/Controls/Select.vue @@ -4,13 +4,7 @@ {{ df.label }}