diff --git a/app/components/app/divison/list-cfg.ts b/app/components/app/divison/list-cfg.ts new file mode 100644 index 00000000..45cfcd6f --- /dev/null +++ b/app/components/app/divison/list-cfg.ts @@ -0,0 +1,80 @@ +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-dud.vue')) + +export const cols: Col[] = [ + {}, + {}, + {}, + {}, +] + +export const header: Th[][] = [ + [ + { label: 'Id' }, + { label: 'Kode' }, + { label: 'Nama' }, + { label: 'Kelompok' }, + ], +] + +export const keys = [ + 'id', + 'cellphone', + 'firstName', + 'birth_place', +] + +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, + } + return res + }, +} + +export const funcHtml: RecStrFuncUnknown = { + patient_address(_rec) { + return '-' + }, +} diff --git a/app/components/app/divison/list.vue b/app/components/app/divison/list.vue index d3a63407..3aecc2e8 100644 --- a/app/components/app/divison/list.vue +++ b/app/components/app/divison/list.vue @@ -1,54 +1,72 @@ - - diff --git a/app/components/flow/division/list.vue b/app/components/flow/division/list.vue index d3a63407..28f514b6 100644 --- a/app/components/flow/division/list.vue +++ b/app/components/flow/division/list.vue @@ -1,51 +1,166 @@ diff --git a/app/components/flow/division/schema.query.ts b/app/components/flow/division/schema.query.ts new file mode 100644 index 00000000..9b1a4606 --- /dev/null +++ b/app/components/flow/division/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/components/pub/custom-ui/data/types.ts b/app/components/pub/custom-ui/data/types.ts index c1dbe8d3..52f5753c 100644 --- a/app/components/pub/custom-ui/data/types.ts +++ b/app/components/pub/custom-ui/data/types.ts @@ -36,7 +36,7 @@ export interface Th { } export interface ButtonNav { - variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'negative' | 'ghost' | 'link' + variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link' classVal?: string classValExt?: string icon?: string @@ -56,6 +56,12 @@ export interface QuickSearchNav { } export interface RefSearchNav { + modelValue?: string + placeholder?: string + minLength?: number + debounceMs?: number + inputClass?: string + showValidationFeedback?: boolean onInput: (val: string) => void onClick: () => void onClear: () => void diff --git a/app/components/pub/custom-ui/nav-header/header.vue b/app/components/pub/custom-ui/nav-header/header.vue index 2f8ebb4e..8b81d3f3 100644 --- a/app/components/pub/custom-ui/nav-header/header.vue +++ b/app/components/pub/custom-ui/nav-header/header.vue @@ -1,18 +1,140 @@