diff --git a/app/components/app/division/list-cfg.ts b/app/components/app/division/list-cfg.ts
index 079faf52..d5479579 100644
--- a/app/components/app/division/list-cfg.ts
+++ b/app/components/app/division/list-cfg.ts
@@ -12,11 +12,11 @@ type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue'))
-export const cols: Col[] = [{ width: 100 }, {}, {}, { width: 50 }]
+export const cols: Col[] = [{}, {}, {}, { width: 50 }]
export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Divisi Induk' }, { label: '' }]]
-export const keys = ['code', 'name', 'ancestor', 'action']
+export const keys = ['code', 'name', 'parent', 'action']
export const delKeyNames: KeyLabel[] = [
{ key: 'code', label: 'Kode' },
@@ -24,13 +24,9 @@ export const delKeyNames: KeyLabel[] = [
]
export const funcParsed: RecStrFuncUnknown = {
- ancestor: (rec: unknown): unknown => {
+ parent: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
- if (recX.meta === null) {
- return '-'
- }
-
- return recX.meta.name
+ return recX.parent?.name || '-'
},
}
diff --git a/app/components/app/division/tree.vue b/app/components/app/division/tree.vue
deleted file mode 100644
index a6f66eff..00000000
--- a/app/components/app/division/tree.vue
+++ /dev/null
@@ -1,165 +0,0 @@
-
-
-
-
-
-
Demo: Tree Select dengan Lazy Loading
-
- Contoh penggunaan komponen TreeSelect dengan data teknologi.
- Pilih item untuk melihat sub-kategori yang dimuat secara lazy.
-
-
-
-
-
💡 Catatan untuk Developer:
-
- Untuk implementasi nyata dengan data divisi rumah sakit,
- lihat komponen content/division/entry.vue
-
-
-
-
-
-
-
-
-
-
-
Value yang terpilih:
-
- {{ selectedValue || 'Belum ada yang dipilih' }}
-
-
-
-
-
-
🔄 Data dimuat secara lazy saat node parent dibuka
-
⏱️ Simulasi delay 600ms untuk menampilkan loading state
-
-
-
diff --git a/app/components/app/installation/entry-form.vue b/app/components/app/installation/entry-form.vue
index 4257b712..9d57b434 100644
--- a/app/components/app/installation/entry-form.vue
+++ b/app/components/app/installation/entry-form.vue
@@ -1,125 +1,119 @@
-
-
+
diff --git a/app/components/app/installation/list-cfg.ts b/app/components/app/installation/list-cfg.ts
index 81de0024..e6fc5d47 100644
--- a/app/components/app/installation/list-cfg.ts
+++ b/app/components/app/installation/list-cfg.ts
@@ -12,13 +12,11 @@ type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue'))
-export const cols: Col[] = [{ width: 100 }, {}, {}, {}, { width: 50 }]
+export const cols: Col[] = [{}, {}, {}, { width: 50 }]
-export const header: Th[][] = [
- [{ label: 'Id' }, { label: 'Nama' }, { label: 'Kode' }, { label: 'Encounter Class' }, { label: '' }],
-]
+export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Encounter Class' }, { label: '' }]]
-export const keys = ['id', 'name', 'cellphone', 'religion_code', 'action']
+export const keys = ['code', 'name', 'encounterClass_code', 'action']
export const delKeyNames: KeyLabel[] = [
{ key: 'code', label: 'Kode' },
@@ -28,22 +26,7 @@ export const delKeyNames: KeyLabel[] = [
export const funcParsed: RecStrFuncUnknown = {
name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
- return `${recX.firstName} ${recX.lastName || ''}`.trim()
- },
- identity_number: (rec: unknown): unknown => {
- const recX = rec as SmallDetailDto
- if (recX.identity_number?.substring(0, 5) === 'BLANK') {
- return '(TANPA NIK)'
- }
- return recX.identity_number
- },
- inPatient_itemPrice: (rec: unknown): unknown => {
- const recX = rec as SmallDetailDto
- return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
- },
- outPatient_itemPrice: (rec: unknown): unknown => {
- const recX = rec as SmallDetailDto
- return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
+ return `${recX.name}`.trim()
},
}
@@ -65,4 +48,4 @@ export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
},
-}
+}
\ No newline at end of file
diff --git a/app/components/app/installation/list.vue b/app/components/app/installation/list.vue
index 72973ca3..af63d76e 100644
--- a/app/components/app/installation/list.vue
+++ b/app/components/app/installation/list.vue
@@ -21,11 +21,16 @@ function handlePageChange(page: number) {
diff --git a/app/components/app/medicine/list-cfg.ts b/app/components/app/medicine/list-cfg.ts
index bde85bc9..77993d55 100644
--- a/app/components/app/medicine/list-cfg.ts
+++ b/app/components/app/medicine/list-cfg.ts
@@ -35,13 +35,13 @@ export const delKeyNames: KeyLabel[] = [
export const funcParsed: RecStrFuncUnknown = {
group: (rec: unknown): unknown => {
- return (rec as SmallDetailDto).medicineGroup_code || '-'
+ return (rec as SmallDetailDto).medicineGroup?.name || '-'
},
method: (rec: unknown): unknown => {
- return (rec as SmallDetailDto).medicineMethod_code || '-'
+ return (rec as SmallDetailDto).medicineMethod?.name || '-'
},
unit: (rec: unknown): unknown => {
- return (rec as SmallDetailDto).uom_code || '-'
+ return (rec as SmallDetailDto).uom?.name || '-'
},
}
diff --git a/app/components/app/specialist/entry-form.vue b/app/components/app/specialist/entry-form.vue
index 749765d9..0d055a1d 100644
--- a/app/components/app/specialist/entry-form.vue
+++ b/app/components/app/specialist/entry-form.vue
@@ -4,7 +4,7 @@ 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'
import Label from '~/components/pub/my-ui/doc-entry/label.vue'
-// import Combobox from '~/components/pub/my-ui/form/combobox.vue'
+import Combobox from '~/components/pub/my-ui/form/combobox.vue'
// Types
import type { SpecialistFormData } from '~/schemas/specialist.schema.ts'
@@ -90,24 +90,15 @@ function onCancelForm() {
-
-
|
diff --git a/app/components/app/subspecialist/entry-form.vue b/app/components/app/subspecialist/entry-form.vue
index 21f1fa6e..a396e6cf 100644
--- a/app/components/app/subspecialist/entry-form.vue
+++ b/app/components/app/subspecialist/entry-form.vue
@@ -4,7 +4,7 @@ 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'
import Label from '~/components/pub/my-ui/doc-entry/label.vue'
-// import Combobox from '~/components/pub/my-ui/form/combobox.vue'
+import Combobox from '~/components/pub/my-ui/form/combobox.vue'
// Types
import type { SubspecialistFormData } from '~/schemas/subspecialist.schema.ts'
@@ -90,24 +90,15 @@ function onCancelForm() {
-
-
|
diff --git a/app/components/app/unit/entry-form.vue b/app/components/app/unit/entry-form.vue
index 0a9d04f0..205513d5 100644
--- a/app/components/app/unit/entry-form.vue
+++ b/app/components/app/unit/entry-form.vue
@@ -4,6 +4,7 @@ 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'
import Label from '~/components/pub/my-ui/doc-entry/label.vue'
+import Combobox from '~/components/pub/my-ui/form/combobox.vue'
// Types
import type { UnitFormData } from '~/schemas/unit.schema.ts'
@@ -15,6 +16,7 @@ import { useForm } from 'vee-validate'
interface Props {
schema: z.ZodSchema
+ installations: any[]
values: any
isLoading?: boolean
isReadonly?: boolean
@@ -33,13 +35,13 @@ const { defineField, errors, meta } = useForm({
initialValues: {
code: '',
name: '',
- installation: '',
+ installation_id: 0,
} as Partial,
})
const [code, codeAttrs] = defineField('code')
const [name, nameAttrs] = defineField('name')
-const [installation, installationAttrs] = defineField('installation')
+const [installation, installationAttrs] = defineField('installation_id')
// Fill fields from props.values if provided
if (props.values) {
@@ -59,7 +61,7 @@ function onSubmitForm(values: any) {
const formData: UnitFormData = {
name: name.value || '',
code: code.value || '',
- installation: installation.value || '',
+ installation_id: installation.value || '',
}
emit('submit', formData, resetForm)
}
@@ -85,6 +87,21 @@ function onCancelForm() {
+
+
+
+
+
+ |
diff --git a/app/components/app/unit/list-cfg.ts b/app/components/app/unit/list-cfg.ts
index 13bbc16f..04975ddc 100644
--- a/app/components/app/unit/list-cfg.ts
+++ b/app/components/app/unit/list-cfg.ts
@@ -28,8 +28,9 @@ export const funcParsed: RecStrFuncUnknown = {
const recX = rec as SmallDetailDto
return `${recX.name}`.trim()
},
- installation: (_rec: unknown): unknown => {
- return '-'
+ installation: (rec: unknown): unknown => {
+ const recX = rec as SmallDetailDto
+ return recX.installation?.name || recX.Installation?.name || '-'
},
}
diff --git a/app/components/content/division/entry.ts b/app/components/content/division/entry.ts
deleted file mode 100644
index 9f3cb9f4..00000000
--- a/app/components/content/division/entry.ts
+++ /dev/null
@@ -1,145 +0,0 @@
-import type { TreeItem } from '~/components/pub/my-ui/select-tree/type'
-import * as z from 'zod'
-
-export const divisionConf = {
- msg: {
- placeholder: '---pilih divisi utama',
- search: 'kode, nama divisi',
- empty: 'divisi tidak ditemukan',
- },
- items: [
- { value: '1', label: 'Medical' },
- { value: '2', label: 'Nursing' },
- { value: '3', label: 'Admin' },
- { value: '4', label: 'Support' },
- { value: '5', label: 'Education' },
- { value: '6', label: 'Pharmacy' },
- { value: '7', label: 'Radiology' },
- { value: '8', label: 'Laboratory' },
- { value: '9', label: 'Finance' },
- { value: '10', label: 'Human Resources' },
- { value: '11', label: 'IT Services' },
- { value: '12', label: 'Maintenance' },
- { value: '13', label: 'Catering' },
- { value: '14', label: 'Security' },
- { value: '15', label: 'Emergency' },
- { value: '16', label: 'Surgery' },
- { value: '17', label: 'Outpatient' },
- { value: '18', label: 'Inpatient' },
- { value: '19', label: 'Rehabilitation' },
- { value: '20', label: 'Research' },
- ],
-}
-
-export const schema = z.object({
- name: z
- .string({
- required_error: 'Nama wajib diisi',
- })
- .min(1, 'Nama divisi wajib diisi'),
-
- code: z
- .string({
- required_error: 'Kode wajib diisi',
- })
- .min(1, 'Kode divisi wajib diisi'),
-
- parentId: z.string().optional(),
-})
-
-// State untuk tree data divisi - dimulai dengan data level atas
-const divisionTreeData = ref
([
- { value: '1', label: 'Medical', hasChildren: true },
- { value: '2', label: 'Nursing', hasChildren: true },
- { value: '3', label: 'Admin', hasChildren: false },
- { value: '4', label: 'Support', hasChildren: true },
- { value: '5', label: 'Education', hasChildren: false },
- { value: '6', label: 'Pharmacy', hasChildren: true },
- { value: '7', label: 'Radiology', hasChildren: false },
- { value: '8', label: 'Laboratory', hasChildren: true },
-])
-
-// Helper function untuk mencari dan menyisipkan data anak ke dalam tree
-function findAndInsertChildren(nodes: TreeItem[], parentId: string, newChildren: TreeItem[]): boolean {
- for (const node of nodes) {
- if (node.value === parentId) {
- node.children = newChildren
- return true
- }
- if (node.children && findAndInsertChildren(node.children as TreeItem[], parentId, newChildren)) {
- return true
- }
- }
- return false
-}
-
-// Fungsi untuk fetch data anak divisi (lazy loading)
-async function handleFetchDivisionChildren(parentId: string): Promise {
- console.log(`Mengambil data sub-divisi untuk parent: ${parentId}`)
-
- // Simulasi delay API call
- await new Promise((resolve) => setTimeout(resolve, 800))
-
- let childrenData: TreeItem[] = []
-
- // Sample data berdasarkan parent ID
- switch (parentId) {
- case '1': // Medical
- childrenData = [
- { value: '1-1', label: 'Cardiology', hasChildren: true },
- { value: '1-2', label: 'Neurology', hasChildren: false },
- { value: '1-3', label: 'Oncology', hasChildren: false },
- ]
- break
- case '2': // Nursing
- childrenData = [
- { value: '2-1', label: 'ICU Nursing', hasChildren: false },
- { value: '2-2', label: 'ER Nursing', hasChildren: false },
- { value: '2-3', label: 'Ward Nursing', hasChildren: true },
- ]
- break
- case '4': // Support
- childrenData = [
- { value: '4-1', label: 'IT Support', hasChildren: false },
- { value: '4-2', label: 'Maintenance', hasChildren: false },
- ]
- break
- case '6': // Pharmacy
- childrenData = [
- { value: '6-1', label: 'Inpatient Pharmacy', hasChildren: false },
- { value: '6-2', label: 'Outpatient Pharmacy', hasChildren: false },
- ]
- break
- case '8': // Laboratory
- childrenData = [
- { value: '8-1', label: 'Clinical Lab', hasChildren: false },
- { value: '8-2', label: 'Pathology Lab', hasChildren: false },
- ]
- break
- case '1-1': // Cardiology sub-divisions
- childrenData = [
- { value: '1-1-1', label: 'Cardiac Surgery', hasChildren: false },
- { value: '1-1-2', label: 'Cardiac Cathlab', hasChildren: false },
- ]
- break
- case '2-3': // Ward Nursing sub-divisions
- childrenData = [
- { value: '2-3-1', label: 'Pediatric Ward', hasChildren: false },
- { value: '2-3-2', label: 'Surgical Ward', hasChildren: false },
- ]
- break
- }
-
- // Insert data ke dalam tree state
- findAndInsertChildren(divisionTreeData.value, parentId, childrenData)
-}
-
-export const divisionTreeConfig = computed(() => ({
- msg: {
- placeholder: '--- Pilih divisi induk',
- search: 'Cari divisi...',
- empty: 'Divisi tidak ditemukan',
- },
- data: divisionTreeData.value,
- onFetchChildren: handleFetchDivisionChildren,
-}))
diff --git a/app/components/content/division/list-prev.vue b/app/components/content/division/list-prev.vue
deleted file mode 100644
index d072ac9a..00000000
--- a/app/components/content/division/list-prev.vue
+++ /dev/null
@@ -1,208 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
ID: {{ record?.id }}
-
Nama: {{ record.firstName }}
-
Kode: {{ record.cellphone }}
-
-
-
-
-
-
diff --git a/app/components/content/division/list.vue b/app/components/content/division/list.vue
index 8bb4e390..05a9d8df 100644
--- a/app/components/content/division/list.vue
+++ b/app/components/content/division/list.vue
@@ -13,6 +13,7 @@ import { toast } from '~/components/pub/ui/toast'
// Types
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
import { DivisionSchema, type DivisionFormData } from '~/schemas/division.schema'
+import type { TreeItem } from '~/models/_model'
// Handlers
import {
@@ -30,8 +31,9 @@ import {
} from '~/handlers/division.handler'
// Services
-import { getDivisions, getDivisionDetail } from '~/services/division.service'
+import { getList, getDetail, getValueTreeItems } from '~/services/division.service'
+const divisionsTrees = ref([])
const title = ref('')
const {
@@ -43,8 +45,13 @@ const {
handleSearch,
fetchData: getDivisionList,
} = usePaginatedList({
- fetchFn: async ({ page, search }) => {
- const result = await getDivisions({ search, page })
+ fetchFn: async (params: any) => {
+ const result = await getList({
+ search: params.search,
+ 'page-number': params['page-number'] || 0,
+ 'page-size': params['page-size'] || 10,
+ includes: 'parent,childrens',
+ })
return { success: result.success || false, body: result.body || {} }
},
entityName: 'division',
@@ -82,7 +89,7 @@ provide('rec_item', recItem)
provide('table_data_loader', isLoading)
const getCurrentDivisionDetail = async (id: number | string) => {
- const result = await getDivisionDetail(id)
+ const result = await getDetail(id)
if (result.success) {
const currentValue = result.body?.data || {}
recItem.value = currentValue
@@ -109,6 +116,22 @@ watch([recId, recAction], () => {
}
})
+watch(
+ () => data.value,
+ async () => {
+ if (!data.value) return
+ const result = await getList({
+ 'page-size': 100,
+ 'only-have-children': false,
+ includes: 'parent,childrens',
+ })
+ if (result.success) {
+ const currentData = result.body.data || []
+ divisionsTrees.value = getValueTreeItems(currentData || [])
+ }
+ },
+)
+
onMounted(async () => {
await getDivisionList()
})
@@ -123,15 +146,17 @@ onMounted(async () => {
class="mb-4 xl:mb-5"
/>
-
+