From 4c0312e48720569a34679c2ec113be76bfcce3b9 Mon Sep 17 00:00:00 2001 From: Khafid Prayoga Date: Wed, 3 Sep 2025 17:00:49 +0700 Subject: [PATCH] feat(installation): implement installation list with pagination and search refactor(installation): move form schema and configuration to separate files fix(installation): update page title and content display --- .../app/installation/entry-form.vue | 114 +++++-- app/components/app/installation/list-cfg.ts | 68 ++++ app/components/app/installation/list.vue | 91 +++--- app/components/flow/installation/entry.ts | 37 +++ app/components/flow/installation/entry.vue | 71 ----- app/components/flow/installation/list.vue | 300 ++++++++++++++++-- .../flow/installation/schema.query.ts | 15 + .../(features)/org-src/installation/index.vue | 4 +- 8 files changed, 537 insertions(+), 163 deletions(-) create mode 100644 app/components/app/installation/list-cfg.ts create mode 100644 app/components/flow/installation/entry.ts delete mode 100644 app/components/flow/installation/entry.vue create mode 100644 app/components/flow/installation/schema.query.ts diff --git a/app/components/app/installation/entry-form.vue b/app/components/app/installation/entry-form.vue index d935a65c..0b3a0049 100644 --- a/app/components/app/installation/entry-form.vue +++ b/app/components/app/installation/entry-form.vue @@ -1,14 +1,19 @@ diff --git a/app/components/app/installation/list-cfg.ts b/app/components/app/installation/list-cfg.ts new file mode 100644 index 00000000..6b8dc5ea --- /dev/null +++ b/app/components/app/installation/list-cfg.ts @@ -0,0 +1,68 @@ +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: 'Encounter Class' }, { 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() + }, + 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') + }, +} + +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 = { + patient_address(_rec) { + return '-' + }, +} diff --git a/app/components/app/installation/list.vue b/app/components/app/installation/list.vue index d3a63407..8f598ad6 100644 --- a/app/components/app/installation/list.vue +++ b/app/components/app/installation/list.vue @@ -1,54 +1,63 @@ - - diff --git a/app/components/flow/installation/entry.ts b/app/components/flow/installation/entry.ts new file mode 100644 index 00000000..c003a029 --- /dev/null +++ b/app/components/flow/installation/entry.ts @@ -0,0 +1,37 @@ +import * as z from 'zod' + +export const installationConf = { + msg: { + placeholder: '---pilih encounter class (fhir7)', + }, + items: [ + { value: '1', label: 'Ambulatory', code: 'AMB' }, + { value: '2', label: 'Inpatient', code: 'IMP' }, + { value: '3', label: 'Emergency', code: 'EMER' }, + { value: '4', label: 'Observation', code: 'OBSENC' }, + { value: '5', label: 'Pre-admission', code: 'PRENC' }, + { value: '6', label: 'Short Stay', code: 'SS' }, + { value: '7', label: 'Virtual', code: 'VR' }, + { value: '8', label: 'Home Health', code: 'HH' }, + ], +} + +export const schemaConf = z.object({ + name: z + .string({ + required_error: 'Nama instalasi harus diisi', + }) + .min(3, 'Nama instalasi minimal 3 karakter'), + + code: z + .string({ + required_error: 'Kode instalasi harus diisi', + }) + .min(3, 'Kode instalasi minimal 3 karakter'), + + encounterClassCode: z + .string({ + required_error: 'Kelompok encounter class harus dipilih', + }) + .min(1, 'Kelompok encounter class harus dipilih'), +}) diff --git a/app/components/flow/installation/entry.vue b/app/components/flow/installation/entry.vue deleted file mode 100644 index 94a4cd1f..00000000 --- a/app/components/flow/installation/entry.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - diff --git a/app/components/flow/installation/list.vue b/app/components/flow/installation/list.vue index d3a63407..7c98f28a 100644 --- a/app/components/flow/installation/list.vue +++ b/app/components/flow/installation/list.vue @@ -1,51 +1,301 @@ diff --git a/app/components/flow/installation/schema.query.ts b/app/components/flow/installation/schema.query.ts new file mode 100644 index 00000000..9b1a4606 --- /dev/null +++ b/app/components/flow/installation/schema.query.ts @@ -0,0 +1,15 @@ +import * as z from 'zod' + +export const querySchema = z.object({ + q: z.union([z.literal(''), z.string().min(3)]).optional().catch(''), + page: z.coerce.number().int().min(1).default(1).catch(1), + pageSize: z.coerce.number().int().min(5).max(20).default(10).catch(10), +}) + +export const defaultQuery = { + q: '', + page: 1, + pageSize: 10, +} + +export type QueryParams = z.infer diff --git a/app/pages/(features)/org-src/installation/index.vue b/app/pages/(features)/org-src/installation/index.vue index a88df5c7..4131d387 100644 --- a/app/pages/(features)/org-src/installation/index.vue +++ b/app/pages/(features)/org-src/installation/index.vue @@ -6,7 +6,7 @@ import Error from '~/components/pub/base/error/error.vue' definePageMeta({ // middleware: ['rbac'], roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'], - title: 'List Division', + title: 'List Installation', contentFrame: 'cf-full-width', }) @@ -34,7 +34,7 @@ const canRead = true