From 02e33c4f61b6e548d54da57b1319b7c61365241d Mon Sep 17 00:00:00 2001 From: riefive Date: Wed, 29 Oct 2025 13:22:06 +0700 Subject: [PATCH] fix: refactor view letter --- app/components/app/sep/entry-form.vue | 6 ++- app/components/app/sep/list-cfg.control.ts | 51 ++++++++++++++++++++++ app/components/app/sep/list-cfg.letter.ts | 14 +++--- app/components/app/sep/list-letter.vue | 8 +++- app/components/app/sep/view-letter.vue | 2 + app/components/content/sep/entry.vue | 14 +++--- 6 files changed, 78 insertions(+), 17 deletions(-) create mode 100644 app/components/app/sep/list-cfg.control.ts diff --git a/app/components/app/sep/entry-form.vue b/app/components/app/sep/entry-form.vue index cb56443e..61da3282 100644 --- a/app/components/app/sep/entry-form.vue +++ b/app/components/app/sep/entry-form.vue @@ -131,8 +131,10 @@ watch(props, (value) => { nationalId.value = objects?.nationalIdentity || '-' medicalRecordNumber.value = objects?.medicalRecordNumber || '-' patientName.value = objects?.patientName || '-' - // Set admission type to 1 (rujukan) if sepType exists in query params - if (objects?.sepType) { + if (objects?.sepType === 'internal') { + admissionType.value = '4' + } + if (objects?.sepType === 'external') { admissionType.value = '1' } isDateReload.value = true diff --git a/app/components/app/sep/list-cfg.control.ts b/app/components/app/sep/list-cfg.control.ts new file mode 100644 index 00000000..40156465 --- /dev/null +++ b/app/components/app/sep/list-cfg.control.ts @@ -0,0 +1,51 @@ +import type { Config } from '~/components/pub/my-ui/data-table' +import { defineAsyncComponent } from 'vue' + +const SelectedRadio = defineAsyncComponent(() => import('~/components/pub/my-ui/data/select-radio.vue')) + +export const config: Config = { + cols: [ + { width: 50 }, + { width: 150 }, + { width: 120 }, + { width: 120 }, + { width: 120 }, + { width: 120 }, + { width: 120 }, + { width: 150 }, + ], + + headers: [ + [ + { label: '' }, + { label: 'NO. SURAT KONTROL' }, + { label: 'TANGGAL SURAT KONTROL' }, + { label: 'NO. SEP' }, + { label: 'NAMA PASIEN' }, + { label: 'NO. KARTU BPJS' }, + { label: 'KLINIK TUJUAN' }, + { label: 'DOKTER' }, + ], + ], + + keys: ['check', 'letterNumber', 'plannedDate', 'sepNumber', 'patientName', 'bpjsCardNo', 'clinic', 'doctor'], + + delKeyNames: [ + { key: 'code', label: 'Code' }, + { key: 'name', label: 'Name' }, + ], + + parses: {}, + + components: { + check(rec, idx) { + return { + idx, + rec: { ...(rec as object), menu: 'letter' }, + component: SelectedRadio, + } + }, + }, + + htmls: {}, +} diff --git a/app/components/app/sep/list-cfg.letter.ts b/app/components/app/sep/list-cfg.letter.ts index a1b20b9b..44458afc 100644 --- a/app/components/app/sep/list-cfg.letter.ts +++ b/app/components/app/sep/list-cfg.letter.ts @@ -10,26 +10,25 @@ export interface LetterData { patientName: string bpjsCardNo: string clinic: string - doctor: string + doctor?: string } export const config: Config = { - cols: [{ width: 50 }, { width: 150 }, { width: 120 }, { width: 120 }, { width: 120 }, { width: 120 }, { width: 150 }, { width: 200 }], + cols: [{ width: 50 }, { width: 150 }, { width: 120 }, { width: 120 }, { width: 120 }, { width: 120 }, { width: 120 }], headers: [ [ { label: '' }, - { label: 'NO. SURAT' }, - { label: 'TANGGAL SURAT' }, + { label: 'NO. SURAT RUJUKAN' }, + { label: 'TANGGAL SURAT RUJUKAN' }, { label: 'NO. SEP' }, { label: 'NAMA PASIEN' }, { label: 'NO. KARTU BPJS' }, { label: 'KLINIK TUJUAN' }, - { label: 'DOKTER' }, ], ], - keys: ['check', 'letterNumber', 'plannedDate', 'sepNumber', 'patientName', 'bpjsCardNo', 'clinic', 'doctor'], + keys: ['check', 'letterNumber', 'plannedDate', 'sepNumber', 'patientName', 'bpjsCardNo', 'clinic'], delKeyNames: [ { key: 'code', label: 'Code' }, @@ -42,7 +41,7 @@ export const config: Config = { check(rec, idx) { return { idx, - rec: { ...rec as object, menu: 'letter' }, + rec: { ...(rec as object), menu: 'letter' }, component: SelectedRadio, } }, @@ -50,4 +49,3 @@ export const config: Config = { htmls: {}, } - diff --git a/app/components/app/sep/list-letter.vue b/app/components/app/sep/list-letter.vue index ba39babf..b4b9b3fe 100644 --- a/app/components/app/sep/list-letter.vue +++ b/app/components/app/sep/list-letter.vue @@ -7,14 +7,18 @@ import type { LetterData } from './list-cfg.letter' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type' // Configs -import { config } from './list-cfg.letter' +import { config as configControl } from './list-cfg.control' +import { config as configLetter } from './list-cfg.letter' const props = defineProps<{ data: LetterData[] + menu?: string selected?: string paginationMeta?: PaginationMeta }>() +const menu = props.menu || 'control' + const emit = defineEmits<{ pageChange: [page: number] }>() @@ -26,7 +30,7 @@ function handlePageChange(page: number) {