From 72f2e866013c9042eaab8960c1251b3866a90ea2 Mon Sep 17 00:00:00 2001 From: Munawwirul Jamal Date: Thu, 16 Oct 2025 04:46:06 +0700 Subject: [PATCH] feat/consultation-82: wip --- app/components/app/consultation/entry.vue | 18 +++++++---- app/components/content/consultation/list.vue | 34 +++++++++++--------- app/components/content/encounter/process.vue | 3 +- app/models/consultation.ts | 2 ++ app/schemas/consultation.schema.ts | 3 +- 5 files changed, 36 insertions(+), 24 deletions(-) diff --git a/app/components/app/consultation/entry.vue b/app/components/app/consultation/entry.vue index db983ef1..db93e1e2 100644 --- a/app/components/app/consultation/entry.vue +++ b/app/components/app/consultation/entry.vue @@ -27,16 +27,19 @@ const emit = defineEmits<{ cancel: [resetForm: () => void] }>() +const today = new Date() const { defineField, errors, meta } = useForm({ validationSchema: toTypedSchema(props.schema), initialValues: { id: 0, encounter_id: 0, + date: props.values.date || today.toISOString().slice(0, 10), problem: '', unit_id: 0, } as Partial, }) +const [date, dateAttrs] = defineField('date') const [unit_id, unitAttrs] = defineField('unit_id') const [problem, problemAttrs] = defineField('problem') @@ -47,6 +50,7 @@ if (props.values) { } const resetForm = () => { + date.value = date.value ?? today.toISOString().slice(0, 10) unit_id.value = 0 problem.value = '' } @@ -56,6 +60,7 @@ function onSubmitForm(values: any) { const formData: ConsultationFormData = { id: 0, encounter_id: 0, + date: date.value || '', problem: problem.value || '', unit_id: unit_id.value || 0, } @@ -71,16 +76,15 @@ function onCancelForm() {