diff --git a/app/components/app/divison/list.vue b/app/components/app/divison/list.vue index cf0d5ea2..e2540e85 100644 --- a/app/components/app/divison/list.vue +++ b/app/components/app/divison/list.vue @@ -1,10 +1,11 @@ + + diff --git a/app/components/app/specialist/list-cfg.ts b/app/components/app/specialist/list-cfg.ts new file mode 100644 index 00000000..367d4d9f --- /dev/null +++ b/app/components/app/specialist/list-cfg.ts @@ -0,0 +1,50 @@ +import type { + Col, + KeyLabel, + RecComponent, + RecStrFuncComponent, + RecStrFuncUnknown, + Th, +} from '~/components/pub/custom-ui/data/types' +import { defineAsyncComponent } from 'vue' + +type SmallDetailDto = any + +const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-ud.vue')) + +export const cols: Col[] = [{ width: 100 }, {}, {}, {}, { width: 50 }] + +export const header: Th[][] = [ + [{ label: 'Id' }, { label: 'Name' }, { label: 'Code' }, { label: 'Unit' }, { label: '' }], +] + +export const keys = ['id', 'name', 'cellphone', 'religion_code', 'action'] + +export const delKeyNames: KeyLabel[] = [ + { key: 'code', label: 'Kode' }, + { key: 'name', label: 'Nama' }, +] + +export const funcParsed: RecStrFuncUnknown = { + name: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + return `${recX.firstName} ${recX.lastName || ''}`.trim() + }, +} + +export const funcComponent: RecStrFuncComponent = { + action(rec, idx) { + const res: RecComponent = { + idx, + rec: rec as object, + component: action, + props: { + size: 'sm', + }, + } + return res + }, +} + +export const funcHtml: RecStrFuncUnknown = { +} diff --git a/app/components/app/specialist/list.vue b/app/components/app/specialist/list.vue new file mode 100644 index 00000000..e9489ef1 --- /dev/null +++ b/app/components/app/specialist/list.vue @@ -0,0 +1,31 @@ + + + diff --git a/app/components/app/subspecialist/entry-form.vue b/app/components/app/subspecialist/entry-form.vue new file mode 100644 index 00000000..9d31fd3f --- /dev/null +++ b/app/components/app/subspecialist/entry-form.vue @@ -0,0 +1,213 @@ + + + diff --git a/app/components/app/subspecialist/list-cfg.ts b/app/components/app/subspecialist/list-cfg.ts new file mode 100644 index 00000000..eb25f5d0 --- /dev/null +++ b/app/components/app/subspecialist/list-cfg.ts @@ -0,0 +1,56 @@ +import type { + Col, + KeyLabel, + RecComponent, + RecStrFuncComponent, + RecStrFuncUnknown, + Th, +} from '~/components/pub/custom-ui/data/types' +import { defineAsyncComponent } from 'vue' + +type SmallDetailDto = any + +const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-ud.vue')) + +export const cols: Col[] = [{ width: 100 }, {}, {}, {}, { width: 50 }] + +export const header: Th[][] = [ + [{ label: 'Id' }, { label: 'Nama' }, { label: 'Kode' }, { label: 'Specialist' }, { label: '' }], +] +export const keys = ['id', 'name', 'cellphone', 'religion_code', 'action'] + +export const delKeyNames: KeyLabel[] = [ + { key: 'code', label: 'Kode' }, + { key: 'name', label: 'Nama' }, +] + +export const funcParsed: RecStrFuncUnknown = { + name: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + return `${recX.firstName} ${recX.lastName || ''}`.trim() + }, + unit: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + return recX.unit?.name || '-' + }, + specialist: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + return recX.specialist?.name || '-' + }, +} + +export const funcComponent: RecStrFuncComponent = { + action(rec, idx) { + const res: RecComponent = { + idx, + rec: rec as object, + component: action, + props: { + size: 'sm', + }, + } + return res + }, +} + +export const funcHtml: RecStrFuncUnknown = {} diff --git a/app/components/app/subspecialist/list.vue b/app/components/app/subspecialist/list.vue new file mode 100644 index 00000000..e9489ef1 --- /dev/null +++ b/app/components/app/subspecialist/list.vue @@ -0,0 +1,31 @@ + + + diff --git a/app/components/app/tools/list.vue b/app/components/app/tools/list.vue index 5e6d4382..076f0f41 100644 --- a/app/components/app/tools/list.vue +++ b/app/components/app/tools/list.vue @@ -1,10 +1,11 @@ diff --git a/app/components/app/unit/list.vue b/app/components/app/unit/list.vue index 1baaa6ba..e9489ef1 100644 --- a/app/components/app/unit/list.vue +++ b/app/components/app/unit/list.vue @@ -1,10 +1,11 @@ + + + + diff --git a/app/components/content/subspecialist/entry.ts b/app/components/content/subspecialist/entry.ts new file mode 100644 index 00000000..5a93847d --- /dev/null +++ b/app/components/content/subspecialist/entry.ts @@ -0,0 +1,98 @@ +import * as z from 'zod' + +export const schemaConf = z.object({ + name: z + .string({ + required_error: 'Nama spesialisasi harus diisi', + }) + .min(3, 'Nama spesialisasi minimal 3 karakter'), + + code: z + .string({ + required_error: 'Kode spesialisasi harus diisi', + }) + .min(3, 'Kode spesialisasi minimal 3 karakter'), + + installationId: z + .string({ + required_error: 'Instalasi harus dipilih', + }) + .min(1, 'Instalasi harus dipilih'), + + unitId: z + .string({ + required_error: 'Unit harus dipilih', + }) + .min(1, 'Unit harus dipilih'), + specialistId: z + .string({ + required_error: 'Specialist harus dipilih', + }) + .min(1, 'Specialist harus dipilih'), +}) + +// Unit mapping berdasarkan installation +export const installationUnitMapping: Record = { + '1': ['1', '3'], + '2': ['2', '3'], + '3': ['1', '2', '3'], +} + +export const unitConf = { + msg: { + placeholder: '---pilih unit', + search: 'kode, nama unit', + empty: 'unit tidak ditemukan', + }, + items: [ + { value: '1', label: 'Instalasi Medis', code: 'MED' }, + { value: '2', label: 'Instalasi Keperawatan', code: 'NUR' }, + { value: '3', label: 'Instalasi Administrasi', code: 'ADM' }, + ], +} + +export const specialistConf = { + msg: { + placeholder: '---pilih specialist', + search: 'kode, nama specialist', + empty: 'specialist tidak ditemukan', + }, + items: [ + { value: '1', label: 'Spesialis Jantung', code: 'CARD' }, + { value: '2', label: 'Spesialis Mata', code: 'OPHT' }, + { value: '3', label: 'Spesialis Bedah', code: 'SURG' }, + { value: '4', label: 'Spesialis Anak', code: 'PEDI' }, + { value: '5', label: 'Spesialis Kandungan', code: 'OBGY' }, + ], +} + +export const installationConf = { + msg: { + placeholder: '---pilih instalasi', + search: 'kode, nama instalasi', + empty: 'instalasi tidak ditemukan', + }, + items: [ + { value: '1', label: 'Ambulatory', code: 'AMB' }, + { value: '2', label: 'Inpatient', code: 'IMP' }, + { value: '3', label: 'Emergency', code: 'EMER' }, + ], +} + +// Helper function untuk filter unit berdasarkan installation +export function getFilteredUnits(installationId: string) { + if (!installationId || !installationUnitMapping[installationId]) { + return [] + } + + const allowedUnitIds = installationUnitMapping[installationId] + return unitConf.items.filter((unit) => allowedUnitIds.includes(unit.value)) +} + +// Helper function untuk membuat unit config yang ter-filter +export function createFilteredUnitConf(installationId: string) { + return { + ...unitConf, + items: getFilteredUnits(installationId), + } +} diff --git a/app/components/content/subspecialist/list.vue b/app/components/content/subspecialist/list.vue new file mode 100644 index 00000000..bfb4e4b9 --- /dev/null +++ b/app/components/content/subspecialist/list.vue @@ -0,0 +1,241 @@ + + + diff --git a/app/components/content/tools/list.vue b/app/components/content/tools/list.vue index 580dda40..b16ccaec 100644 --- a/app/components/content/tools/list.vue +++ b/app/components/content/tools/list.vue @@ -24,19 +24,9 @@ const items = [ { value: 'item-3', label: 'Item 3' }, ] -// Fungsi untuk fetch data division async function fetchDeviceData(params: any) { - // Prepare query parameters for pagination and search - const urlParams = new URLSearchParams({ - 'page-number': params.page.toString(), - 'page-size': params.pageSize.toString(), - }) - - if (params.q) { - urlParams.append('search', params.q) - } - - return await xfetch(`/api/v1/device?${urlParams.toString()}`) + const endpoint = transform('/api/v1/device', params) + return await xfetch(endpoint) } // Menggunakan composable untuk pagination diff --git a/app/components/content/unit/list.vue b/app/components/content/unit/list.vue index 404da13e..03ee6c9a 100644 --- a/app/components/content/unit/list.vue +++ b/app/components/content/unit/list.vue @@ -18,19 +18,9 @@ const recId = ref(0) const recAction = ref('') const recItem = ref(null) -// Fungsi untuk fetch data unit async function fetchUnitData(params: any) { - // Prepare query parameters for pagination and search - const urlParams = new URLSearchParams({ - 'page-number': params.page.toString(), - 'page-size': params.pageSize.toString(), - }) - - if (params.q) { - urlParams.append('search', params.q) - } - - return await xfetch(`/api/v1/patient?${urlParams.toString()}`) + const endpoint = transform('/api/v1/patient', params) + return await xfetch(endpoint) } // Menggunakan composable untuk pagination diff --git a/app/components/pub/custom-ui/form/combobox.vue b/app/components/pub/custom-ui/form/combobox.vue index 23f9401f..de51600e 100644 --- a/app/components/pub/custom-ui/form/combobox.vue +++ b/app/components/pub/custom-ui/form/combobox.vue @@ -15,6 +15,7 @@ const props = defineProps<{ searchPlaceholder?: string emptyMessage?: string class?: string + disabled?: boolean }>() const emit = defineEmits<{ @@ -63,13 +64,14 @@ function onSelect(item: Item) {