diff --git a/app/components/app/medical-action-src/entry-form.vue b/app/components/app/medical-action-src/entry-form.vue index 0a02ea85..f8bf87e4 100644 --- a/app/components/app/medical-action-src/entry-form.vue +++ b/app/components/app/medical-action-src/entry-form.vue @@ -5,14 +5,17 @@ import Cell from '~/components/pub/my-ui/doc-entry/cell.vue' import Field from '~/components/pub/my-ui/doc-entry/field.vue' import Label from '~/components/pub/my-ui/doc-entry/label.vue' import Button from '~/components/pub/ui/button/Button.vue' +import Select from '~/components/pub/my-ui/form/select.vue' // Types import type { MedicalActionSrcFormData } from '~/schemas/medical-action-src.schema' +import { medicalActionTypeCode } from '~/lib/constants' // Helpers import type z from 'zod' import { useForm } from 'vee-validate' import { toTypedSchema } from '@vee-validate/zod' +import { mapToComboboxOptList } from '~/lib/utils' interface Props { schema: z.ZodSchema @@ -24,6 +27,8 @@ interface Props { const props = defineProps() const isLoading = props.isLoading !== undefined ? props.isLoading : false const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false +const medicalActionTypeOptions = mapToComboboxOptList(medicalActionTypeCode) + const emit = defineEmits<{ submit: [values: MedicalActionSrcFormData, resetForm: () => void] cancel: [resetForm: () => void] @@ -34,26 +39,31 @@ const { defineField, errors, meta } = useForm({ initialValues: { code: '', name: '', + type_code: '', } as Partial, }) const [code, codeAttrs] = defineField('code') const [name, nameAttrs] = defineField('name') +const [typeCode, typeCodeAttrs] = defineField('type_code') if (props.values) { if (props.values.code !== undefined) code.value = props.values.code if (props.values.name !== undefined) name.value = props.values.name + if (props.values.type_code !== undefined) typeCode.value = props.values.type_code } const resetForm = () => { code.value = '' name.value = '' + typeCode.value = '' } function onSubmitForm() { const formData: MedicalActionSrcFormData = { code: code.value || '', name: name.value || '', + type_code: typeCode.value || '', } emit('submit', formData, resetForm) } @@ -95,6 +105,21 @@ function onCancelForm() { /> + + + +