diff --git a/app/components/app/device-order-item/entry-form.vue b/app/components/app/device-order-item/entry-form.vue new file mode 100644 index 00000000..3ae2d200 --- /dev/null +++ b/app/components/app/device-order-item/entry-form.vue @@ -0,0 +1,73 @@ + + + \ No newline at end of file diff --git a/app/components/app/device-order-item/list-entry.config.ts b/app/components/app/device-order-item/list-entry.config.ts index f2f3ef86..d47c4368 100644 --- a/app/components/app/device-order-item/list-entry.config.ts +++ b/app/components/app/device-order-item/list-entry.config.ts @@ -1,36 +1,35 @@ import { defineAsyncComponent } from 'vue' -import type { Config } from '~/components/pub/my-ui/data-table' - +import type { Config, RecComponent } from '~/components/pub/my-ui/data-table' const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue')) export const config: Config = { - cols: [{}, {}, { width: 50 }], + cols: [{}, { width: 200 }, { width: 100 }], headers: [[{ label: 'Nama' }, { label: 'Jumlah' }, { label: '' }]], - keys: ['name', 'count', 'action'], + keys: ['device.name', 'quantity', 'action'], delKeyNames: [ { key: 'name', label: 'Nama' }, { key: 'count', label: 'Jumlah' }, ], - skeletonSize: 10 + skeletonSize: 10, // funcParsed: { // parent: (rec: unknown): unknown => { // const recX = rec as SmallDetailDto // return recX.parent?.name || '-' // }, // }, - // funcComponent: { - // action(rec: object, idx: any) { - // const res: RecComponent = { - // idx, - // rec: rec as object, - // component: action, - // props: { - // size: 'sm', - // }, - // } - // return res - // }, - // } + components: { + action(rec, idx) { + const res: RecComponent = { + idx, + rec: rec as object, + component: action, + props: { + size: 'sm', + }, + } + return res + }, + } } diff --git a/app/components/app/device-order-item/list-entry.vue b/app/components/app/device-order-item/list-entry.vue index 26f6691d..b6031228 100644 --- a/app/components/app/device-order-item/list-entry.vue +++ b/app/components/app/device-order-item/list-entry.vue @@ -1,13 +1,23 @@ diff --git a/app/components/app/device-order/confirmation-info.vue b/app/components/app/device-order/confirmation-info.vue new file mode 100644 index 00000000..6711091f --- /dev/null +++ b/app/components/app/device-order/confirmation-info.vue @@ -0,0 +1,26 @@ + + \ No newline at end of file diff --git a/app/components/app/device-order/entry-form.vue b/app/components/app/device-order/entry-form.vue index bea2b6eb..4e66c441 100644 --- a/app/components/app/device-order/entry-form.vue +++ b/app/components/app/device-order/entry-form.vue @@ -1,6 +1,25 @@ diff --git a/app/components/app/device-order/list.config.ts b/app/components/app/device-order/list.config.ts index 7580c576..04a6c9fc 100644 --- a/app/components/app/device-order/list.config.ts +++ b/app/components/app/device-order/list.config.ts @@ -1,13 +1,18 @@ -import type { Config } from '~/components/pub/my-ui/data-table' +import type { Config, RecComponent } from '~/components/pub/my-ui/data-table' import type { DeviceOrder } from '~/models/device-order' -import { defineAsyncComponent } from 'vue' +import type { DeviceOrderItem } from '~/models/device-order-item' -const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue')) +const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dsd.vue')) export const config: Config = { - cols: [{ width: 120 }, { }, { }, { width: 50 }], - headers: [[{ label: 'Tanggal' }, { label: 'DPJP' }, { label: 'Alat Kesehatan' }, { label: '' }]], - keys: ['createdAt', 'encounter.doctor.person.name', 'items', 'action'], + cols: [{ width: 120 }, { }, { }, { }, { width: 50 }], + headers: [[ + { label: 'Tanggal' }, + { label: 'DPJP' }, + { label: 'Alat Kesehatan' }, + { label: 'Status' }, + { label: '' }]], + keys: ['createdAt', 'doctor.employee.person.name', 'items', 'status_code', 'action'], delKeyNames: [ { key: 'code', label: 'Kode' }, { key: 'name', label: 'Nama' }, @@ -16,27 +21,45 @@ export const config: Config = { htmls: { items: (rec: unknown): unknown => { const recX = rec as DeviceOrder - return recX.items?.length || 0 + if (recX.items?.length > 0) { + let output = '' + recX.items.forEach((item: DeviceOrderItem) => { + output += '' + + ''+ + `` + + '' + + `` + + '' + }) + output += '
${item.device?.name}:${item.quantity}
' + return output + } else { + return '-' + } + }, + }, + parses: { + createdAt: (rec: unknown): unknown => { + const recX = rec as DeviceOrder + return recX.createdAt ? new Date(recX.createdAt).toLocaleDateString() : '-' + }, + // parent: (rec: unknown): unknown => { + // const recX = rec as SmallDetailDto + // return recX.parent?.name || '-' + // }, + }, + components: { + action(rec, idx) { + const res: RecComponent = { + idx, + rec: rec as object, + component: action, + props: { + size: 'sm', + }, + } + return res }, } - // funcParsed: { - // parent: (rec: unknown): unknown => { - // const recX = rec as SmallDetailDto - // return recX.parent?.name || '-' - // }, - // }, - // funcComponent: { - // action(rec: object, idx: any) { - // const res: RecComponent = { - // idx, - // rec: rec as object, - // component: action, - // props: { - // size: 'sm', - // }, - // } - // return res - // }, - // } } diff --git a/app/components/app/device-order/list.vue b/app/components/app/device-order/list.vue index 37b24ea3..83f57dd6 100644 --- a/app/components/app/device-order/list.vue +++ b/app/components/app/device-order/list.vue @@ -8,12 +8,10 @@ import type { PaginationMeta } from '~/components/pub/my-ui/pagination/paginatio // Configs import { config } from './list.config' -interface Props { +defineProps<{ data: any[] paginationMeta: PaginationMeta -} - -defineProps() +}>() const emit = defineEmits<{ pageChange: [page: number] @@ -28,7 +26,7 @@ function handlePageChange(page: number) {
diff --git a/app/components/app/division-position/entry-form.vue b/app/components/app/division-position/entry-form.vue index 2525b49b..b25c9d0c 100644 --- a/app/components/app/division-position/entry-form.vue +++ b/app/components/app/division-position/entry-form.vue @@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({ const [code, codeAttrs] = defineField('code') const [name, nameAttrs] = defineField('name') -const [division, divisionAttrs] = defineField('division_id') +const [division, divisionAttrs] = defineField('division_code') const [employee, employeeAttrs] = defineField('employee_id') const [headStatus, headStatusAttrs] = defineField('headStatus') @@ -62,8 +62,8 @@ const headStatusStr = computed({ if (props.values) { if (props.values.code !== undefined) code.value = props.values.code if (props.values.name !== undefined) name.value = props.values.name - if (props.values.division_id !== undefined) - division.value = props.values.division_id ? Number(props.values.division_id) : null + if (props.values.division_code !== undefined) + division.value = props.values.division_code ? String(props.values.division_code) : null if (props.values.employee_id !== undefined) employee.value = props.values.employee_id ? Number(props.values.employee_id) : null if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus @@ -72,7 +72,7 @@ if (props.values) { const resetForm = () => { code.value = '' name.value = '' - division.value = null + division.value = '' employee.value = null headStatus.value = false } @@ -83,7 +83,7 @@ function onSubmitForm() { ...genBase(), name: name.value || '', code: code.value || '', - division_id: division.value || null, + division_code: division.value || '', employee_id: employee.value || null, headStatus: headStatus.value !== undefined ? headStatus.value : undefined, } @@ -130,7 +130,7 @@ function onCancelForm() { - + - divisionId: number + divisionId: string employees: any[] values: any isLoading?: boolean diff --git a/app/components/app/division/entry-form.vue b/app/components/app/division/entry-form.vue index 7702fdc6..19ca8196 100644 --- a/app/components/app/division/entry-form.vue +++ b/app/components/app/division/entry-form.vue @@ -36,25 +36,25 @@ const { defineField, errors, meta } = useForm({ initialValues: { code: '', name: '', - parent_id: null, + parent_code: null, } as Partial, }) const [code, codeAttrs] = defineField('code') const [name, nameAttrs] = defineField('name') -const [parent, parentAttrs] = defineField('parent_id') +const [parent, parentAttrs] = defineField('parent_code') // Fill fields from props.values if provided if (props.values) { if (props.values.code !== undefined) code.value = props.values.code if (props.values.name !== undefined) name.value = props.values.name - if (props.values.parent_id !== undefined) parent.value = String(props.values.parent_id) + if (props.values.parent_code !== undefined) parent.value = String(props.values.parent_code) } const resetForm = () => { code.value = '' name.value = '' - parent.value = null + parent.value = '' } // Form submission handler @@ -63,7 +63,7 @@ function onSubmitForm() { ...genBase(), name: name.value || '', code: code.value || '', - parent_id: parent.value || null, + parent_code: parent.value || '', } emit('submit', formData, resetForm) } @@ -108,7 +108,7 @@ function onCancelForm() { - + +import type { FormErrors } from '~/types/error' +import Combobox from '~/components/pub/my-ui/combobox/combobox.vue' +import { cn, mapToComboboxOptList } from '~/lib/utils' +import { docTypeCode, supportingDocOpt, type docTypeCodeKey } from '~/lib/constants' +import { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service' +import { getValueLabelList as getUnitLabelList } from '~/services/unit.service' + +import * as DE from '~/components/pub/my-ui/doc-entry' +import type { Item } from '~/components/pub/my-ui/combobox' + +const props = defineProps<{ + fieldName?: string + label?: string + placeholder?: string + errors?: FormErrors + class?: string + selectClass?: string + fieldGroupClass?: string + labelClass?: string + isRequired?: boolean +}>() + +const { + fieldName = 'job', + label = 'Pekerjaan', + placeholder = 'Pilih pekerjaan', + errors, + class: containerClass, + fieldGroupClass, + labelClass, +} = props + + + + diff --git a/app/components/app/document-upload/entry-form.vue b/app/components/app/document-upload/entry-form.vue new file mode 100644 index 00000000..f97a5161 --- /dev/null +++ b/app/components/app/document-upload/entry-form.vue @@ -0,0 +1,73 @@ + + + diff --git a/app/components/app/document-upload/list.cfg.ts b/app/components/app/document-upload/list.cfg.ts new file mode 100644 index 00000000..979c916d --- /dev/null +++ b/app/components/app/document-upload/list.cfg.ts @@ -0,0 +1,43 @@ +import type { Config } from '~/components/pub/my-ui/data-table' +import { defineAsyncComponent } from 'vue' +import { docTypeCode, docTypeLabel, type docTypeCodeKey } from '~/lib/constants' + +const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dd.vue')) + +export const config: Config = { + cols: [{}, {}, {}, {width: 50},], + + headers: [ + [ + { label: 'Nama Dokumen' }, + { label: 'Tipe Dokumen' }, + { label: 'Petugas Upload' }, + { label: 'Action' }, + ], + ], + + keys: ['fileName', 'type_code', 'employee.name', 'action'], + + delKeyNames: [ + + ], + + parses: { + type_code: (v: unknown) => { + return docTypeLabel[v?.type_code as docTypeCodeKey] + }, + }, + + components: { + action(rec, idx) { + return { + idx, + rec: rec as object, + component: action, + } + }, + }, + + htmls: { + }, +} diff --git a/app/components/app/document-upload/list.vue b/app/components/app/document-upload/list.vue new file mode 100644 index 00000000..8274e752 --- /dev/null +++ b/app/components/app/document-upload/list.vue @@ -0,0 +1,31 @@ + + + diff --git a/app/components/app/general-consent/entry.vue b/app/components/app/general-consent/entry.vue new file mode 100644 index 00000000..75e30cec --- /dev/null +++ b/app/components/app/general-consent/entry.vue @@ -0,0 +1,214 @@ + + + diff --git a/app/components/app/general-consent/list.cfg.ts b/app/components/app/general-consent/list.cfg.ts new file mode 100644 index 00000000..c2f57c54 --- /dev/null +++ b/app/components/app/general-consent/list.cfg.ts @@ -0,0 +1,82 @@ +import type { Config, RecComponent, RecStrFuncComponent, RecStrFuncUnknown } from '~/components/pub/my-ui/data-table' +import { defineAsyncComponent } from 'vue' +import type { GeneralConsent } from '~/models/general-consent' + +type SmallDetailDto = any + +const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue')) +export const config: Config = { + cols: [{ width: 100 }, {}, {}, {}, { width: 50 }], + headers: [ + [ + { label: 'Tanggal' }, + { label: 'Anggota Keluarga' }, + { label: 'Penanggung Jawab' }, + { label: 'Pemberi Informasi' }, + { label: 'Saksi 1' }, + { label: 'Saksi 2' }, + { label: '' }, + ], + ], + keys: ['date', 'relatives', 'responsible', 'informant', 'witness1', 'witness2', 'action'], + delKeyNames: [ + { key: 'data', label: 'Tanggal' }, + { key: 'dstDoctor.name', label: 'Dokter' }, + ], + parses: { + date(rec) { + const recX = rec as GeneralConsent + return recX?.createdAt?.substring(0, 10) || '-' + }, + relatives(rec) { + const recX = rec as GeneralConsent + const parsed = JSON.parse(recX?.value || '{}') + return parsed?.relatives?.join(', ') || '-' + }, + responsible(rec) { + const recX = rec as GeneralConsent + const parsed = JSON.parse(recX?.value || '{}') + return parsed?.responsible || '-' + }, + informant(rec) { + const recX = rec as GeneralConsent + const parsed = JSON.parse(recX?.value || '{}') + return parsed?.informant || '-' + }, + witness1(rec) { + const recX = rec as GeneralConsent + const parsed = JSON.parse(recX?.value || '{}') + return parsed?.witness1 || '-' + }, + witness2(rec) { + const recX = rec as GeneralConsent + const parsed = JSON.parse(recX?.value || '{}') + return parsed?.witness2 || '-' + }, + action(rec, idx) { + const res: RecComponent = { + idx, + rec: rec as object, + component: action, + props: { + size: 'sm', + }, + } + return res + }, + }, + components: { + action(rec, idx) { + const res: RecComponent = { + idx, + rec: rec as object, + component: action, + props: { + size: 'sm', + }, + } + return res + }, + } as RecStrFuncComponent, + htmls: {} as RecStrFuncUnknown, +} diff --git a/app/components/app/general-consent/list.vue b/app/components/app/general-consent/list.vue new file mode 100644 index 00000000..46f595f5 --- /dev/null +++ b/app/components/app/general-consent/list.vue @@ -0,0 +1,34 @@ + + + diff --git a/app/components/app/installation-position/entry-form.vue b/app/components/app/installation-position/entry-form.vue index 4f7885a1..1bf65323 100644 --- a/app/components/app/installation-position/entry-form.vue +++ b/app/components/app/installation-position/entry-form.vue @@ -40,7 +40,7 @@ const { defineField, errors, meta } = useForm({ const [code, codeAttrs] = defineField('code') const [name, nameAttrs] = defineField('name') -const [installation, installationAttrs] = defineField('installation_id') +const [installation, installationAttrs] = defineField('installation_code') const [employee, employeeAttrs] = defineField('employee_id') const [headStatus, headStatusAttrs] = defineField('headStatus') @@ -62,8 +62,8 @@ const headStatusStr = computed({ if (props.values) { if (props.values.code !== undefined) code.value = props.values.code if (props.values.name !== undefined) name.value = props.values.name - if (props.values.installation_id !== undefined) - installation.value = props.values.installation_id ? Number(props.values.installation_id) : null + if (props.values.installation_code !== undefined) + installation.value = props.values.installation_code ? String(props.values.installation_code) : null if (props.values.employee_id !== undefined) employee.value = props.values.employee_id ? Number(props.values.employee_id) : null if (props.values.headStatus !== undefined) headStatus.value = !!props.values.headStatus @@ -83,7 +83,7 @@ function onSubmitForm() { ...genBase(), name: name.value || '', code: code.value || '', - installation_id: installation.value || null, + installation_code: String(installation.value) || '', employee_id: employee.value || null, headStatus: headStatus.value !== undefined ? headStatus.value : undefined, } @@ -130,7 +130,7 @@ function onCancelForm() { - + +// Components +import Block from '~/components/pub/my-ui/doc-entry/block.vue' +import Cell from '~/components/pub/my-ui/doc-entry/cell.vue' +import Field from '~/components/pub/my-ui/doc-entry/field.vue' +import Label from '~/components/pub/my-ui/doc-entry/label.vue' +import Button from '~/components/pub/ui/button/Button.vue' + +// Types +import type { BaseFormData } from '~/schemas/base.schema' + +// Helpers +import type z from 'zod' +import { useForm } from 'vee-validate' +import { toTypedSchema } from '@vee-validate/zod' + +interface Props { + schema?: z.ZodSchema + values?: any + isLoading?: boolean + isReadonly?: boolean +} + +const props = defineProps() +const isLoading = props.isLoading !== undefined ? props.isLoading : false +const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false +const emit = defineEmits<{ + submit: [values: BaseFormData, resetForm: () => void] + cancel: [resetForm: () => void] +}>() + +const { defineField, errors, meta } = useForm({ + validationSchema: props.schema ? toTypedSchema(props.schema) : undefined, + initialValues: { + code: '', + name: '', + }, +}) + +const [code, codeAttrs] = defineField('code') +const [name, nameAttrs] = defineField('name') + +if (props.values) { + if (props.values.code !== undefined) code.value = props.values.code + if (props.values.name !== undefined) name.value = props.values.name +} + +const resetForm = () => { + code.value = '' + name.value = '' +} + +function onSubmitForm() { + const formData = { + name: name.value || '', + code: code.value || '', + } + emit('submit', formData, resetForm) +} + +function onCancelForm() { + emit('cancel', resetForm) +} + + + diff --git a/app/components/app/medicine-form/list-cfg.ts b/app/components/app/medicine-form/list-cfg.ts new file mode 100644 index 00000000..5b66812a --- /dev/null +++ b/app/components/app/medicine-form/list-cfg.ts @@ -0,0 +1,38 @@ +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-ud.vue')) + +export const config: Config = { + cols: [{}, {}, { width: 50 }], + + headers: [ + [ + { label: 'Kode' }, + { label: 'Nama' }, + { label: 'Aksi' }, + ], + ], + + 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/medicine-form/list.vue b/app/components/app/medicine-form/list.vue new file mode 100644 index 00000000..e4544c2f --- /dev/null +++ b/app/components/app/medicine-form/list.vue @@ -0,0 +1,35 @@ + + + diff --git a/app/components/app/medicine/entry-form.vue b/app/components/app/medicine/entry-form.vue index 42989fcb..af4df34f 100644 --- a/app/components/app/medicine/entry-form.vue +++ b/app/components/app/medicine/entry-form.vue @@ -18,6 +18,7 @@ interface Props { isReadonly?: boolean medicineGroups?: { value: string; label: string }[] medicineMethods?: { value: string; label: string }[] + medicineForms?: { value: string; label: string }[] uoms?: { value: string; label: string }[] } @@ -36,6 +37,7 @@ const { defineField, errors, meta } = useForm({ name: '', medicineGroup_code: '', medicineMethod_code: '', + medicineForm_code: '', uom_code: '', stock: 0, }, @@ -45,6 +47,7 @@ const [code, codeAttrs] = defineField('code') const [name, nameAttrs] = defineField('name') const [medicineGroup_code, medicineGroupAttrs] = defineField('medicineGroup_code') const [medicineMethod_code, medicineMethodAttrs] = defineField('medicineMethod_code') +const [medicineForm_code, medicineFormAttrs] = defineField('medicineForm_code') const [uom_code, uomAttrs] = defineField('uom_code') const [stock, stockAttrs] = defineField('stock') @@ -53,6 +56,7 @@ if (props.values) { if (props.values.name !== undefined) name.value = props.values.name if (props.values.medicineGroup_code !== undefined) medicineGroup_code.value = props.values.medicineGroup_code if (props.values.medicineMethod_code !== undefined) medicineMethod_code.value = props.values.medicineMethod_code + if (props.values.medicineForm_code !== undefined) medicineForm_code.value = props.values.medicineForm_code if (props.values.uom_code !== undefined) uom_code.value = props.values.uom_code if (props.values.stock !== undefined) stock.value = props.values.stock } @@ -62,6 +66,7 @@ const resetForm = () => { name.value = '' medicineGroup_code.value = '' medicineMethod_code.value = '' + medicineForm_code.value = '', uom_code.value = '' stock.value = 0 } @@ -72,6 +77,7 @@ function onSubmitForm() { name: name.value || '', medicineGroup_code: medicineGroup_code.value || '', medicineMethod_code: medicineMethod_code.value || '', + medicineForm_code: medicineForm_code.value || '', uom_code: uom_code.value || '', stock: stock.value || 0, } @@ -138,6 +144,20 @@ function onCancelForm() { /> + + + +