diff --git a/app/components/app/medical-action-src/entry-form.vue b/app/components/app/medical-action-src/entry-form.vue new file mode 100644 index 00000000..0a02ea85 --- /dev/null +++ b/app/components/app/medical-action-src/entry-form.vue @@ -0,0 +1,119 @@ + + + + + + + Kode + + + + + + Nama + + + + + + + + Kembali + + + Simpan + + + + diff --git a/app/components/app/medical-action-src/list-cfg.ts b/app/components/app/medical-action-src/list-cfg.ts new file mode 100644 index 00000000..2fecde69 --- /dev/null +++ b/app/components/app/medical-action-src/list-cfg.ts @@ -0,0 +1,32 @@ +import type { Config, RecComponent } from '~/components/pub/my-ui/data-table' +import { defineAsyncComponent } from 'vue' + +const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) + +export const config: Config = { + cols: [{}, {}, {}, { width: 50 }], + + headers: [[{ label: 'Kode' }, { label: 'Nama' }, { label: '' }]], + + keys: ['code', 'name', 'action'], + + delKeyNames: [ + { key: 'code', label: 'Kode' }, + { key: 'name', label: 'Nama ' }, + ], + + parses: {}, + + components: { + action(rec, idx) { + const res: RecComponent = { + idx, + rec: rec as object, + component: action, + } + return res + }, + }, + + htmls: {}, +} diff --git a/app/components/app/medical-action-src/list.vue b/app/components/app/medical-action-src/list.vue new file mode 100644 index 00000000..1be60a60 --- /dev/null +++ b/app/components/app/medical-action-src/list.vue @@ -0,0 +1,36 @@ + + + + + + + + diff --git a/app/components/content/medical-action-src/list.vue b/app/components/content/medical-action-src/list.vue new file mode 100644 index 00000000..c39ff4b8 --- /dev/null +++ b/app/components/content/medical-action-src/list.vue @@ -0,0 +1,184 @@ + + + + + + + { + onResetState() + isFormEntryDialogOpen = value + } + " + > + , resetForm: () => void) => { + if (recId > 0) { + handleActionEdit(recId, values, getItemList, resetForm, toast) + return + } + handleActionSave(values, getItemList, resetForm, toast) + } + " + @cancel="handleCancelForm" + /> + + + handleActionRemove(recId, getItemList, toast)" + @cancel="" + > + + + + {{ field.label }}: + {{ record[field.key] }} + + + + + diff --git a/app/handlers/medical-action-src.handler.ts b/app/handlers/medical-action-src.handler.ts new file mode 100644 index 00000000..652d6d60 --- /dev/null +++ b/app/handlers/medical-action-src.handler.ts @@ -0,0 +1,24 @@ +// Handlers +import { genCrudHandler } from '~/handlers/_handler' + +// Services +import { create, update, remove } from '~/services/medical-action-src.service' + +export const { + recId, + recAction, + recItem, + isReadonly, + isProcessing, + isFormEntryDialogOpen, + isRecordConfirmationOpen, + onResetState, + handleActionSave, + handleActionEdit, + handleActionRemove, + handleCancelForm, +} = genCrudHandler({ + create, + update, + remove, +}) diff --git a/app/pages/(features)/mcu-src/medical-action/index.vue b/app/pages/(features)/mcu-src/medical-action/index.vue index 36fb8feb..7e471367 100644 --- a/app/pages/(features)/mcu-src/medical-action/index.vue +++ b/app/pages/(features)/mcu-src/medical-action/index.vue @@ -32,7 +32,9 @@ const canRead = true - Daftar Aksi Medis + + + & Partial + +export { MedicalActionSrcSchema } +export type { MedicalActionSrcFormData } diff --git a/app/services/medical-action-src.service.ts b/app/services/medical-action-src.service.ts new file mode 100644 index 00000000..aa196962 --- /dev/null +++ b/app/services/medical-action-src.service.ts @@ -0,0 +1,41 @@ +// Base +import * as base from './_crud-base' + +// Types +import type { MedicalActionSrc } from '~/models/medical-action-src' + +const path = '/api/v1/medical-action-src' +const name = 'medical-action-src' + +export function create(data: any) { + return base.create(path, data, name) +} + +export function getList(params: any = null) { + return base.getList(path, params, name) +} + +export function getDetail(id: number | string) { + return base.getDetail(path, id, name) +} + +export function update(id: number | string, data: any) { + return base.update(path, id, data, name) +} + +export function remove(id: number | string) { + return base.remove(path, id, name) +} + +export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> { + let data: { value: string; label: string }[] = [] + const result = await getList(params) + if (result.success) { + const resultData = result.body?.data || [] + data = resultData.map((item: MedicalActionSrc) => ({ + value: item.id ? Number(item.id) : item.code, + label: item.name, + })) + } + return data +}
+ {{ field.label }}: + {{ record[field.key] }} +