From 3ae81c29fd7e11d890ab9fbe90f606622ba11b88 Mon Sep 17 00:00:00 2001 From: Khafid Prayoga Date: Tue, 4 Nov 2025 09:23:26 +0700 Subject: [PATCH] feat(subspecialist): enhance specialist details with unit and installation info - Update Unit interface to allow null installation - Include specialist.Unit and specialist.Unit.Installation in API includes - Add Unit and Installation fields to subspecialist detail view - Simplify list configuration headers and update keys for specialist name --- app/components/app/subspecialist/detail/index.vue | 12 ++++++++++++ app/components/app/subspecialist/list-cfg.ts | 11 ++--------- app/components/content/subspecialist/detail.vue | 2 +- app/models/unit.ts | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/components/app/subspecialist/detail/index.vue b/app/components/app/subspecialist/detail/index.vue index ed3f1478..154acf75 100644 --- a/app/components/app/subspecialist/detail/index.vue +++ b/app/components/app/subspecialist/detail/index.vue @@ -32,6 +32,18 @@ defineProps<{ {{ [subspecialist.specialist?.code, subspecialist.specialist?.name].filter(Boolean).join(' / ') || '-' }} + + {{ + [subspecialist.specialist?.unit?.code, subspecialist.specialist?.unit?.name].filter(Boolean).join(' / ') || '-' + }} + + + {{ + [subspecialist.specialist?.unit?.installation?.code, subspecialist.specialist?.unit?.installation?.name] + .filter(Boolean) + .join(' / ') || '-' + }} + diff --git a/app/components/app/subspecialist/list-cfg.ts b/app/components/app/subspecialist/list-cfg.ts index 7e9e7b79..99d34169 100644 --- a/app/components/app/subspecialist/list-cfg.ts +++ b/app/components/app/subspecialist/list-cfg.ts @@ -8,16 +8,9 @@ const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dr export const config: Config = { cols: [{}, {}, {}, { width: 50 }], - headers: [ - [ - { label: 'Kode' }, - { label: 'Nama' }, - { label: 'Specialis' }, - { label: '' }, - ], - ], + headers: [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Specialis' }, { label: '' }]], - keys: ['code', 'name', 'specialist', 'action'], + keys: ['code', 'name', 'specialist.name', 'action'], delKeyNames: [ { key: 'code', label: 'Kode' }, diff --git a/app/components/content/subspecialist/detail.vue b/app/components/content/subspecialist/detail.vue index ccecaa0d..d432eb22 100644 --- a/app/components/content/subspecialist/detail.vue +++ b/app/components/content/subspecialist/detail.vue @@ -121,7 +121,7 @@ const headerPrep: HeaderPrep = { onMounted(async () => { try { const result = await getDetailSubSpecialist(props.subspecialistId, { - includes: 'specialist', + includes: 'specialist,specialist.Unit,specialist.Unit.Installation', }) if (result.success) { subSpecialist.value = result.body.data || {} diff --git a/app/models/unit.ts b/app/models/unit.ts index 0588dd80..ba8ba5a1 100644 --- a/app/models/unit.ts +++ b/app/models/unit.ts @@ -5,7 +5,7 @@ export interface Unit extends Base { name: string installation_id?: number | string | null - installation?: Installation + installation?: Installation | null } export function genUnit(): Unit {