diff --git a/app/components/app/specialist/list-cfg.ts b/app/components/app/specialist/list-cfg.ts index 79685879..2ddc5007 100644 --- a/app/components/app/specialist/list-cfg.ts +++ b/app/components/app/specialist/list-cfg.ts @@ -30,7 +30,7 @@ export const funcParsed: RecStrFuncUnknown = { }, unit: (rec: unknown): unknown => { const recX = rec as SmallDetailDto - return `${recX.unit_id}` + return recX.unit_id || '-' }, } diff --git a/app/components/app/specialist/list.vue b/app/components/app/specialist/list.vue index e9489ef1..cde2a4ce 100644 --- a/app/components/app/specialist/list.vue +++ b/app/components/app/specialist/list.vue @@ -22,10 +22,15 @@ function handlePageChange(page: number) { - diff --git a/app/components/app/subspecialist/entry-form-prev.vue b/app/components/app/subspecialist/entry-form-prev.vue new file mode 100644 index 00000000..9d31fd3f --- /dev/null +++ b/app/components/app/subspecialist/entry-form-prev.vue @@ -0,0 +1,213 @@ + + + + + onSubmitForm(values, { resetForm }))"> + + + + Nama + + + + + + + + + + + + + + Kode + + + + + + + + + + + + + + Instalasi + + + + + onInstallationChanged(value, setFieldValue)" + /> + + + + + + + + + Unit + + + + + onUnitChanged(value, setFieldValue)" + /> + + + + + + + + + Specialist + + + + + + + + + + + + + + + + + Batal + + + Simpan + + + + + diff --git a/app/components/app/subspecialist/entry-form.vue b/app/components/app/subspecialist/entry-form.vue index 9d31fd3f..6aea232d 100644 --- a/app/components/app/subspecialist/entry-form.vue +++ b/app/components/app/subspecialist/entry-form.vue @@ -1,213 +1,128 @@ - - onSubmitForm(values, { resetForm }))"> - - - - Nama - - - - - - - - - - - - - - Kode - - - - - - - - - - - - - - Instalasi - - - - - onInstallationChanged(value, setFieldValue)" - /> - - - - - - - - - Unit - - - - - onUnitChanged(value, setFieldValue)" - /> - - - - - - - - - Specialist - - - - - - - - - - - - - - - - - Batal - - - Simpan - - - - + + + + Kode + + + + + + Nama + + + + + + Spesialis + + + + + + + + Kembali + + Simpan + + + diff --git a/app/components/app/subspecialist/list-cfg.ts b/app/components/app/subspecialist/list-cfg.ts index eb25f5d0..c7ded48e 100644 --- a/app/components/app/subspecialist/list-cfg.ts +++ b/app/components/app/subspecialist/list-cfg.ts @@ -10,14 +10,13 @@ import { defineAsyncComponent } from 'vue' type SmallDetailDto = any -const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-ud.vue')) +const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-dud.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: 'Specialist' }, { label: '' }], -] -export const keys = ['id', 'name', 'cellphone', 'religion_code', 'action'] +export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Specialis' }, { label: '' }]] + +export const keys = ['code', 'name', 'specialist', 'action'] export const delKeyNames: KeyLabel[] = [ { key: 'code', label: 'Kode' }, @@ -27,15 +26,11 @@ export const delKeyNames: KeyLabel[] = [ export const funcParsed: RecStrFuncUnknown = { name: (rec: unknown): unknown => { const recX = rec as SmallDetailDto - return `${recX.firstName} ${recX.lastName || ''}`.trim() - }, - unit: (rec: unknown): unknown => { - const recX = rec as SmallDetailDto - return recX.unit?.name || '-' + return `${recX.name}`.trim() }, specialist: (rec: unknown): unknown => { const recX = rec as SmallDetailDto - return recX.specialist?.name || '-' + return recX.specialist_id || '-' }, } @@ -45,9 +40,6 @@ export const funcComponent: RecStrFuncComponent = { idx, rec: rec as object, component: action, - props: { - size: 'sm', - }, } return res }, diff --git a/app/components/app/subspecialist/list.vue b/app/components/app/subspecialist/list.vue index e9489ef1..cde2a4ce 100644 --- a/app/components/app/subspecialist/list.vue +++ b/app/components/app/subspecialist/list.vue @@ -22,10 +22,15 @@ function handlePageChange(page: number) { - diff --git a/app/components/content/subspecialist/list-prev.vue b/app/components/content/subspecialist/list-prev.vue new file mode 100644 index 00000000..a5496df6 --- /dev/null +++ b/app/components/content/subspecialist/list-prev.vue @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + ID: {{ record?.id }} + Nama: {{ record.name }} + Kode: {{ record.code }} + Specialist: {{ record.specialist?.name }} + + + + diff --git a/app/components/content/subspecialist/list.vue b/app/components/content/subspecialist/list.vue index a478ef22..ad38241f 100644 --- a/app/components/content/subspecialist/list.vue +++ b/app/components/content/subspecialist/list.vue @@ -1,34 +1,41 @@ - - + + - - + , resetForm: () => void) => { + if (recId > 0) { + handleActionEdit(recId, values, getSubSpecialistList, resetForm, toast) + return + } + handleActionSave(values, getSubSpecialistList, resetForm, toast) + } + " + @cancel="handleCancelForm" /> + handleActionRemove(recId, getSubSpecialistList, toast)" + @cancel="" > ID: {{ record?.id }} Nama: {{ record.name }} Kode: {{ record.code }} - Specialist: {{ record.specialist?.name }} diff --git a/app/models/specialist.ts b/app/models/specialist.ts index 9d8f01c3..39b23390 100644 --- a/app/models/specialist.ts +++ b/app/models/specialist.ts @@ -1,4 +1,5 @@ export interface Specialist { + id?: number code: string name: string unit_id: number | string diff --git a/app/models/subspecialist.ts b/app/models/subspecialist.ts index 755508f6..32591ab3 100644 --- a/app/models/subspecialist.ts +++ b/app/models/subspecialist.ts @@ -1,5 +1,5 @@ export interface Subspecialist { code: string name: string - unit_id: number + specialist_id: number | string } diff --git a/app/schemas/subspecialist.schema.ts b/app/schemas/subspecialist.schema.ts new file mode 100644 index 00000000..d485c95c --- /dev/null +++ b/app/schemas/subspecialist.schema.ts @@ -0,0 +1,13 @@ +import { z } from 'zod' +import type { Subspecialist } from '~/models/subspecialist' + +const SubspecialistSchema = 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'), + specialist_id: z.number().positive('Spesialis harus diisi'), +}) + +type SubspecialistFormData = z.infer & Subspecialist + +export { SubspecialistSchema } +export type { SubspecialistFormData }
ID: {{ record?.id }}
Nama: {{ record.name }}
Kode: {{ record.code }}
Specialist: {{ record.specialist?.name }}