diff --git a/app/components/app/sep/list-patient.vue b/app/components/app/sep/list-patient.vue index f61011b6..2b9902f2 100644 --- a/app/components/app/sep/list-patient.vue +++ b/app/components/app/sep/list-patient.vue @@ -11,6 +11,7 @@ import { config } from './list-cfg.patient' const props = defineProps<{ data: PatientData[] + selected?: string paginationMeta?: PaginationMeta }>() @@ -27,6 +28,7 @@ function handlePageChange(page: number) { +import { computed, inject, type Ref } from 'vue' // Components import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group' const props = defineProps<{ rec: { id: string; name: string; menu: string } + selected?: string +}>() + +const emit = defineEmits<{ + // No emits needed - using provide/inject }>() const record = props.rec || {} -const recId = inject>('rec_select_id')! -const recMenu = inject>('rec_select_menu')! -const selected = ref('') +const recId = inject('rec_select_id') as Ref +const recMenu = inject('rec_select_menu') as Ref +const selected = computed(() => recId.value === Number(record.id) ? record.id : '') + +function handleSelection(value: string) { + if (value === record.id) { + recId.value = Number(record.id) || 0 + recMenu.value = record.menu || '' + } +}