diff --git a/.gitignore b/.gitignore index 4a7f73a2..5bdfc11f 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ logs .env .env.* !.env.example + +.vscode \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 4b1147d4..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "chrome", - "request": "launch", - "name": "Launch Chrome against localhost", - "url": "http://localhost:3000", - "webRoot": "${workspaceFolder}" - } - ] -} diff --git a/app/assets/css/main.css b/app/assets/css/main.css index b5064af7..cab62d6e 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -174,7 +174,7 @@ body { } body, table, label { - @apply md:!text-xs xl:!text-sm 2xl:!text-sm; + @apply md:!text-xs 2xl:!text-sm; } /* Container */ diff --git a/app/components/app/assesment-function/list-cfg.ts b/app/components/app/assesment-function/list-cfg.ts index 460cacd9..a11537a7 100644 --- a/app/components/app/assesment-function/list-cfg.ts +++ b/app/components/app/assesment-function/list-cfg.ts @@ -1,119 +1,114 @@ -import type { - Col, - KeyLabel, - RecComponent, - RecStrFuncComponent, - RecStrFuncUnknown, - Th, -} from '~/components/pub/my-ui/data/types' import { defineAsyncComponent } from 'vue' +import type { Config, RecComponent } from '~/components/pub/my-ui/data-table' type SmallDetailDto = any const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) -export const cols: Col[] = [ - {}, - {}, - {}, - { width: 100 }, - { width: 120 }, - {}, - {}, - {}, - { width: 100 }, - { width: 100 }, - {}, - { width: 50 }, -] - -export const header: Th[][] = [ - [ - { label: 'Nama' }, - { label: 'Rekam Medis' }, - { label: 'KTP' }, - { label: 'Tgl Lahir' }, - { label: 'Umur' }, - { label: 'JK' }, - { label: 'Pendidikan' }, - { label: 'Status' }, - { label: '' }, +export const config: Config = { + cols: [ + {}, + {}, + {}, + { width: 100 }, + { width: 120 }, + {}, + {}, + {}, + { width: 100 }, + { width: 100 }, + {}, + { width: 50 }, ], -] -export const keys = [ - 'name', - 'medicalRecord_number', - 'identity_number', - 'birth_date', - 'patient_age', - 'gender', - 'education', - 'status', - 'action', -] + headers: [ + [ + { label: 'Nama' }, + { label: 'Rekam Medis' }, + { label: 'KTP' }, + { label: 'Tgl Lahir' }, + { label: 'Umur' }, + { label: 'JK' }, + { label: 'Pendidikan' }, + { label: 'Status' }, + { label: '' }, + ], + ], -export const delKeyNames: KeyLabel[] = [ - { key: 'code', label: 'Kode' }, - { key: 'name', label: 'Nama' }, -] + keys: [ + 'name', + 'medicalRecord_number', + 'identity_number', + 'birth_date', + 'patient_age', + 'gender', + 'education', + 'status', + 'action', + ], -export const funcParsed: RecStrFuncUnknown = { - name: (rec: unknown): unknown => { - const recX = rec as SmallDetailDto - return `${recX.firstName} ${recX.middleName || ''} ${recX.lastName || ''}` - }, - 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 - }, - birth_date: (rec: unknown): unknown => { - const recX = rec as SmallDetailDto - if (typeof recX.birth_date == 'object' && recX.birth_date) { - return (recX.birth_date as Date).toLocaleDateString() - } else if (typeof recX.birth_date == 'string') { - return (recX.birth_date as string).substring(0, 10) - } - return recX.birth_date - }, - patient_age: (rec: unknown): unknown => { - const recX = rec as SmallDetailDto - return recX.birth_date?.split('T')[0] - }, - gender: (rec: unknown): unknown => { - const recX = rec as SmallDetailDto - if (typeof recX?.gender_code !== 'number' && recX?.gender_code !== '') { - return 'Tidak Diketahui' - } - return recX.gender_code - }, - education: (rec: unknown): unknown => { - const recX = rec as SmallDetailDto - if (typeof recX.education_code == 'number' && recX.education_code >= 0) { - return recX.education_code - } else if (typeof recX.education_code) { - return recX.education_code - } - return '-' - }, -} + delKeyNames: [ + { key: 'code', label: 'Kode' }, + { key: 'name', label: 'Nama' }, + ], -export const funcComponent: RecStrFuncComponent = { - action(rec, idx) { - const res: RecComponent = { - idx, - rec: rec as object, - component: action, - } - return res + parses: { + name: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + return `${recX.firstName} ${recX.middleName || ''} ${recX.lastName || ''}` + }, + 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 + }, + birth_date: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + if (typeof recX.birth_date == 'object' && recX.birth_date) { + return (recX.birth_date as Date).toLocaleDateString() + } else if (typeof recX.birth_date == 'string') { + return (recX.birth_date as string).substring(0, 10) + } + return recX.birth_date + }, + patient_age: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + return recX.birth_date?.split('T')[0] + }, + gender: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + if (typeof recX?.gender_code !== 'number' && recX?.gender_code !== '') { + return 'Tidak Diketahui' + } + return recX.gender_code + }, + education: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + if (typeof recX.education_code == 'number' && recX.education_code >= 0) { + return recX.education_code + } else if (typeof recX.education_code) { + return recX.education_code + } + return '-' + }, }, -} -export const funcHtml: RecStrFuncUnknown = { - patient_address(_rec) { - return '-' + components: { + action(rec: unknown, idx: number) { + const res: RecComponent = { + idx, + rec: rec as object, + component: action, + } + return res + }, }, -} + + htmls: { + patient_address(rec: unknown) { + return '-' + }, + }, +} \ No newline at end of file diff --git a/app/components/app/assesment-function/list.vue b/app/components/app/assesment-function/list.vue index b9a74929..58b4f1bd 100644 --- a/app/components/app/assesment-function/list.vue +++ b/app/components/app/assesment-function/list.vue @@ -1,5 +1,5 @@ diff --git a/app/components/app/bed/entry-form.vue b/app/components/app/bed/entry-form.vue index fb851aa4..f2b0c961 100644 --- a/app/components/app/bed/entry-form.vue +++ b/app/components/app/bed/entry-form.vue @@ -5,6 +5,10 @@ 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' +import Combobox from '~/components/pub/my-ui/combobox/combobox.vue' + +// Constants +import { infraGroupCodesKeys } from '~/lib/constants' // Types import type { InfraFormData } from '~/schemas/infra.schema' @@ -16,6 +20,7 @@ import { toTypedSchema } from '@vee-validate/zod' interface Props { schema: z.ZodSchema + parents: any[] values: any isLoading?: boolean isReadonly?: boolean @@ -34,27 +39,28 @@ const { defineField, errors, meta } = useForm({ initialValues: { code: '', name: '', - infraGroup_code: 'counter', + infraGroup_code: infraGroupCodesKeys.bed, parent_id: null, } as Partial, }) const [code, codeAttrs] = defineField('code') const [name, nameAttrs] = defineField('name') -const [infraGroup_code, infraGroupAttrs] = defineField('infraGroup_code') +const [infraGroup_code] = defineField('infraGroup_code') const [parent_id, parentIdAttrs] = defineField('parent_id') 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.infraGroup_code !== undefined) infraGroup_code.value = props.values.infraGroup_code - if (props.values.parent_id !== undefined) parent_id.value = props.values.parent_id + if (props.values.parent_id !== undefined) + parent_id.value = props.values.parent_id ? Number(props.values.parent_id) : null } const resetForm = () => { code.value = '' name.value = '' - infraGroup_code.value = 'counter' + infraGroup_code.value = infraGroupCodesKeys.bed parent_id.value = null } @@ -62,8 +68,8 @@ function onSubmitForm() { const formData: InfraFormData = { code: code.value || '', name: name.value || '', - infraGroup_code: infraGroup_code.value || 'counter', - parent_id: parent_id.value || null, + infraGroup_code: infraGroup_code.value || infraGroupCodesKeys.bed, + parent_id: parent_id.value ? Number(parent_id.value) : null, } emit('submit', formData, resetForm) } @@ -74,23 +80,62 @@ function onCancelForm() {