diff --git a/app/components/app/unit/entry-form.vue b/app/components/app/unit/entry-form.vue index c8581f4e..463a6683 100644 --- a/app/components/app/unit/entry-form.vue +++ b/app/components/app/unit/entry-form.vue @@ -1,14 +1,19 @@ diff --git a/app/components/app/unit/list-cfg.ts b/app/components/app/unit/list-cfg.ts new file mode 100644 index 00000000..00423066 --- /dev/null +++ b/app/components/app/unit/list-cfg.ts @@ -0,0 +1,86 @@ +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: 'Instalasi' }, + { label: '' }, + ], +] + +export const keys = [ + 'id', + 'firstName', + 'cellphone', + 'birth_place', + '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.frontTitle} ${recX.name} ${recX.endTitle}`.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/unit/list.vue b/app/components/app/unit/list.vue index d3a63407..1baaa6ba 100644 --- a/app/components/app/unit/list.vue +++ b/app/components/app/unit/list.vue @@ -1,54 +1,35 @@ - - diff --git a/app/components/flow/unit/entry.vue b/app/components/flow/unit/entry.ts similarity index 53% rename from app/components/flow/unit/entry.vue rename to app/components/flow/unit/entry.ts index 323e6649..bf85a0ed 100644 --- a/app/components/flow/unit/entry.vue +++ b/app/components/flow/unit/entry.ts @@ -1,18 +1,8 @@ - - - diff --git a/app/components/flow/unit/list.vue b/app/components/flow/unit/list.vue index d3a63407..e8c09bb0 100644 --- a/app/components/flow/unit/list.vue +++ b/app/components/flow/unit/list.vue @@ -1,51 +1,300 @@ diff --git a/app/components/flow/unit/schema.query.ts b/app/components/flow/unit/schema.query.ts new file mode 100644 index 00000000..9b1a4606 --- /dev/null +++ b/app/components/flow/unit/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/unit/add.vue b/app/pages/(features)/org-src/unit/add.vue deleted file mode 100644 index 195f4b24..00000000 --- a/app/pages/(features)/org-src/unit/add.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - diff --git a/app/pages/(features)/org-src/unit/index.vue b/app/pages/(features)/org-src/unit/index.vue index 40bd09be..801105eb 100644 --- a/app/pages/(features)/org-src/unit/index.vue +++ b/app/pages/(features)/org-src/unit/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 Unit', contentFrame: 'cf-full-width', }) @@ -34,7 +34,7 @@ const canRead = true