diff --git a/app/components/app/division/entry-form.vue b/app/components/app/division/entry-form.vue index 829c4bd9..5f4b3299 100644 --- a/app/components/app/division/entry-form.vue +++ b/app/components/app/division/entry-form.vue @@ -39,7 +39,7 @@ const { defineField, errors, meta } = useForm({ const [code, codeAttrs] = defineField('code') const [name, nameAttrs] = defineField('name') -const [division, divisionAttrs] = defineField('uom_code') +const [division, divisionAttrs] = defineField('division_id') // Fill fields from props.values if provided if (props.values) { diff --git a/app/components/app/unit/entry-form-prev.vue b/app/components/app/unit/entry-form-prev.vue new file mode 100644 index 00000000..463a6683 --- /dev/null +++ b/app/components/app/unit/entry-form-prev.vue @@ -0,0 +1,125 @@ + + + + + onSubmitForm(values, { resetForm }))"> + + + + Nama + + + + + + + + + + + + + + Kode + + + + + + + + + + + + + + Instalasi + + + + + + + + + + + + + + + + + Batal + + + Simpan + + + + + diff --git a/app/components/app/unit/entry-form.vue b/app/components/app/unit/entry-form.vue index 463a6683..5e3566b7 100644 --- a/app/components/app/unit/entry-form.vue +++ b/app/components/app/unit/entry-form.vue @@ -1,125 +1,102 @@ - - onSubmitForm(values, { resetForm }))"> - - - - Nama - - - - - - - - - - - - - - Kode - - - - - - - - - - - - - - Instalasi - - - - - - - - - - - - - - - - - Batal - - - Simpan - - - - + + + + Kode + + + + + + Nama + + + + + + + Kembali + + Simpan + + + diff --git a/app/components/app/unit/list-cfg.ts b/app/components/app/unit/list-cfg.ts index 00423066..c341342e 100644 --- a/app/components/app/unit/list-cfg.ts +++ b/app/components/app/unit/list-cfg.ts @@ -12,31 +12,11 @@ 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 cols: Col[] = [{ width: 100 }, {}, {}, { width: 50 }] -export const header: Th[][] = [ - [ - { label: 'Id' }, - { label: 'Nama' }, - { label: 'Kode' }, - { label: 'Instalasi' }, - { label: '' }, - ], -] +export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Instalasi' }, { label: '' }]] -export const keys = [ - 'id', - 'firstName', - 'cellphone', - 'birth_place', - 'action', -] +export const keys = ['code', 'name', 'installation', 'action'] export const delKeyNames: KeyLabel[] = [ { key: 'code', label: 'Kode' }, @@ -46,22 +26,7 @@ export const delKeyNames: KeyLabel[] = [ 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') + return `${recX.name}`.trim() }, } @@ -71,16 +36,9 @@ export const funcComponent: RecStrFuncComponent = { idx, rec: rec as object, component: action, - props: { - size: 'sm', - }, } return res }, } -export const funcHtml: RecStrFuncUnknown = { - patient_address(_rec) { - return '-' - }, -} +export const funcHtml: RecStrFuncUnknown = {} diff --git a/app/components/content/unit/list-prev.vue b/app/components/content/unit/list-prev.vue new file mode 100644 index 00000000..9cee37a1 --- /dev/null +++ b/app/components/content/unit/list-prev.vue @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + ID: {{ record?.id }} + Nama: {{ record.firstName }} + Kode: {{ record.cellphone }} + + + + + + diff --git a/app/components/content/unit/list.vue b/app/components/content/unit/list.vue index b54b3c0c..86ae3a1c 100644 --- a/app/components/content/unit/list.vue +++ b/app/components/content/unit/list.vue @@ -1,29 +1,38 @@ - - + + - + + :schema="UnitSchema" + :values="recItem" + :is-loading="isProcessing" + :is-readonly="isReadonly" + @submit=" + (values: UnitFormData | Record, resetForm: () => void) => { + if (recId > 0) { + handleActionEdit(recId, values, getUnitList, resetForm, toast) + return + } + handleActionSave(values, getUnitList, resetForm, toast) + } + " + @cancel="handleCancelForm" + /> + v-model:open="isRecordConfirmationOpen" + action="delete" + :record="recItem" + @confirm="() => handleActionRemove(recId, getUnitList, toast)" + @cancel="" + > ID: {{ record?.id }} - Nama: {{ record.firstName }} - Kode: {{ record.cellphone }} + Nama: {{ record.name }} + Kode: {{ record.code }} - - diff --git a/app/models/unit.ts b/app/models/unit.ts index f137a38c..adcea902 100644 --- a/app/models/unit.ts +++ b/app/models/unit.ts @@ -1,5 +1,5 @@ export interface Unit { code: string name: string - installation: string | number + installation?: string | number } diff --git a/app/schemas/unit.schema.ts b/app/schemas/unit.schema.ts new file mode 100644 index 00000000..30a5a075 --- /dev/null +++ b/app/schemas/unit.schema.ts @@ -0,0 +1,12 @@ +import { z } from 'zod' +import type { Unit } from '~/models/unit' + +const UnitSchema = z.object({ + code: z.string({ required_error: 'Kode harus diisi' }).min(1, 'Kode minimum 1 karakter'), + name: z.string({ required_error: 'Nama harus diisi' }).min(1, 'Nama minimum 1 karakter'), +}) + +type UnitFormData = z.infer & Unit + +export { UnitSchema } +export type { UnitFormData }
ID: {{ record?.id }}
Nama: {{ record.firstName }}
Kode: {{ record.cellphone }}
Nama: {{ record.name }}
Kode: {{ record.code }}