feat(sep): add value of patient when click search patient
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
// Components
|
||||
// Components
|
||||
import Block from '~/components/pub/my-ui/doc-entry/block.vue'
|
||||
import Cell from '~/components/pub/my-ui/doc-entry/cell.vue'
|
||||
import Field from '~/components/pub/my-ui/doc-entry/field.vue'
|
||||
@@ -13,7 +13,7 @@ import DatepickerSingle from '~/components/pub/my-ui/datepicker/datepicker-singl
|
||||
|
||||
// Types
|
||||
import { IntegrationBpjsSchema, type IntegrationBpjsFormData } from '~/schemas/integration-bpjs.schema'
|
||||
import type { PatientEntity } from "~/models/patient"
|
||||
import type { PatientEntity } from '~/models/patient'
|
||||
|
||||
// Helpers
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
@@ -22,7 +22,7 @@ import { useForm } from 'vee-validate'
|
||||
const props = defineProps<{
|
||||
isLoading?: boolean
|
||||
isReadonly?: boolean
|
||||
patient?: PatientEntity | null
|
||||
patient?: PatientEntity | null | undefined
|
||||
values?: any
|
||||
}>()
|
||||
|
||||
@@ -32,6 +32,7 @@ const emit = defineEmits<{
|
||||
|
||||
const isLoading = props.isLoading !== undefined ? props.isLoading : false
|
||||
const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false
|
||||
const patient = props.patient || ({} as PatientEntity)
|
||||
|
||||
const items = [
|
||||
{ value: 'item-1', label: 'Item 1' },
|
||||
@@ -62,6 +63,14 @@ const [cataract, cataractAttrs] = defineField('cataract')
|
||||
const [procedureType, procedureTypeAttrs] = defineField('procedureType')
|
||||
const [supportCode, supportCodeAttrs] = defineField('supportCode')
|
||||
|
||||
if (Object.keys(patient).length > 0) {
|
||||
bpjsNumber.value = '-'
|
||||
nationalId.value = patient?.person?.residentIdentityNumber || '-'
|
||||
medicalRecordNumber.value = patient?.number || '-'
|
||||
patientName.value = patient?.person?.name || '-'
|
||||
phoneNumber.value = '-'
|
||||
}
|
||||
|
||||
// Submit handler
|
||||
const onSubmit = handleSubmit((values) => {
|
||||
console.log('✅ Validated form values:', values)
|
||||
@@ -119,6 +128,7 @@ const onSubmit = handleSubmit((values) => {
|
||||
<h3 class="text-lg font-semibold">Data Pasien</h3>
|
||||
<Button
|
||||
variant="outline"
|
||||
type="button"
|
||||
class="h-[40px] rounded-md border-orange-400 text-orange-400 hover:bg-green-50"
|
||||
@click="emit('event', 'search-patient')"
|
||||
>
|
||||
@@ -146,7 +156,7 @@ const onSubmit = handleSubmit((values) => {
|
||||
id="bpjsNumber"
|
||||
v-model="bpjsNumber"
|
||||
v-bind="bpjsNumberAttrs"
|
||||
:disabled="isLoading || isReadonly"
|
||||
:disabled="true"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
@@ -160,7 +170,7 @@ const onSubmit = handleSubmit((values) => {
|
||||
id="nationalId"
|
||||
v-model="nationalId"
|
||||
v-bind="nationalIdAttrs"
|
||||
:disabled="isLoading || isReadonly"
|
||||
:disabled="true"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
@@ -174,7 +184,7 @@ const onSubmit = handleSubmit((values) => {
|
||||
id="medicalRecordNumber"
|
||||
v-model="medicalRecordNumber"
|
||||
v-bind="medicalRecordNumberAttrs"
|
||||
:disabled="isLoading || isReadonly"
|
||||
:disabled="true"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
@@ -188,7 +198,7 @@ const onSubmit = handleSubmit((values) => {
|
||||
id="patientName"
|
||||
v-model="patientName"
|
||||
v-bind="patientNameAttrs"
|
||||
:disabled="isLoading || isReadonly"
|
||||
:disabled="true"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
@@ -202,7 +212,7 @@ const onSubmit = handleSubmit((values) => {
|
||||
id="phoneNumber"
|
||||
v-model="phoneNumber"
|
||||
v-bind="phoneNumberAttrs"
|
||||
:disabled="isLoading || isReadonly"
|
||||
:disabled="true"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
@@ -360,7 +370,7 @@ const onSubmit = handleSubmit((values) => {
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<Cell>
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
COB
|
||||
<span class="text-red-500">*</span>
|
||||
|
||||
Reference in New Issue
Block a user