From 6a184ae3118fa44e63856085f2e3b042401d66e7 Mon Sep 17 00:00:00 2001 From: riefive Date: Thu, 23 Oct 2025 13:32:13 +0700 Subject: [PATCH] feat(sep): add error message --- app/components/app/sep/entry-form.vue | 69 +++++++++++++++++---------- app/components/content/sep/entry.vue | 38 +++++++++++---- app/services/vclaim-sep.service.ts | 47 +++++++++--------- 3 files changed, 97 insertions(+), 57 deletions(-) diff --git a/app/components/app/sep/entry-form.vue b/app/components/app/sep/entry-form.vue index bfef617c..b1b6ada7 100644 --- a/app/components/app/sep/entry-form.vue +++ b/app/components/app/sep/entry-form.vue @@ -19,11 +19,11 @@ import type { PatientEntity } from '~/models/patient' // Helpers import { toTypedSchema } from '@vee-validate/zod' import { useForm } from 'vee-validate' -import { is } from "date-fns/locale" const props = defineProps<{ isLoading?: boolean isReadonly?: boolean + isService?: boolean mode?: string doctors: any[] diagnoses: any[] @@ -43,6 +43,7 @@ const props = defineProps<{ cities: any[] districts: any[] patient?: PatientEntity | null | undefined + objects?: any values?: any }>() @@ -51,12 +52,8 @@ const emit = defineEmits<{ (e: 'fetch', value?: any): void }>() -const mode = props.mode !== undefined ? props.mode : 'add' -const isLoading = props.isLoading !== undefined ? props.isLoading : false -const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false - // Validation schema (moved to shared file) -const { handleSubmit, errors, defineField, meta } = useForm({ +const { handleSubmit, errors, defineField } = useForm({ validationSchema: toTypedSchema(IntegrationBpjsSchema), }) @@ -103,17 +100,15 @@ const titleLetterDate = computed(() => const isAccidentally = computed(() => accident.value === '1' || accident.value === '2') const isProvinceSelected = computed(() => accidentProvince.value !== '') const isCitySelected = computed(() => accidentCity.value !== '') +const mode = props.mode !== undefined ? props.mode : 'add' +const isLoading = props.isLoading !== undefined ? props.isLoading : false +const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false +const isService = ref(props.isService || false) if (mode === 'add') { // sepDate.value = new Date().toISOString() } -// Submit handler -const onSubmit = handleSubmit((values) => { - console.log('✅ Validated form values:', JSON.stringify(values, null, 2)) - emit('event', 'save-sep', values) -}) - watch(props, (value) => { const patient = value.patient || ({} as PatientEntity) if (Object.keys(patient).length > 0) { @@ -124,6 +119,18 @@ watch(props, (value) => { phoneNumber.value = '-' } }) + +// Submit handler +const onSubmit = handleSubmit((values) => { + console.log('✅ Validated form values:', JSON.stringify(values, null, 2)) + emit('event', 'save-sep', values) +}) + +onMounted(() => { + if (!isService.value) { + serviceType.value = '2' + } +})