From 0e43bff3672e6923eb10ad6c8ac4d8df5436dc73 Mon Sep 17 00:00:00 2001 From: Munawwirul Jamal Date: Mon, 13 Oct 2025 16:38:23 +0700 Subject: [PATCH 1/4] dev: hotfix, added userQueryCRUD --- app/composables/useQueryCRUD.ts | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 app/composables/useQueryCRUD.ts diff --git a/app/composables/useQueryCRUD.ts b/app/composables/useQueryCRUD.ts new file mode 100644 index 00000000..a48e9a2b --- /dev/null +++ b/app/composables/useQueryCRUD.ts @@ -0,0 +1,46 @@ +import { computed } from 'vue' +import { useRoute, useRouter } from 'vue-router' + +export function useQueryCRUDMode(key: string = 'mode') { + const route = useRoute() + const router = useRouter() + + const mode = computed<'list' | 'entry'>({ + get: () => (route.query[key] && route.query[key] === 'entry' ? 'entry' : 'list'), + set: (val) => { + router.push({ + path: route.path, + query: { + ...route.query, + [key]: val, + }, + }) + }, + }) + + const goToEntry = () => (mode.value = 'entry') + const backToList = () =>(mode.value = 'list') + + return { mode, goToEntry, backToList } +} + +export function useQueryCRUDRecordId(key: string = 'record-id') { + const route = useRoute() + const router = useRouter() + + // const recordId = useState('route-query-' + key, () => '') + const recordId = computed({ + get: () => route.query[key], + set: (val: string) => { + router.replace({ + path: route.path, + query: { + ...route.query, + [key]: val, + }, + }) + }, + }) + + return { recordId } +} From 32c815a6e54ca85555f386dc0f1f517c1334775e Mon Sep 17 00:00:00 2001 From: Munawwirul Jamal Date: Wed, 15 Oct 2025 07:37:57 +0700 Subject: [PATCH 2/4] dev: hotfix, cleaning data-table --- .../app/assesment-function/list-cfg.ts | 205 ++++++++-------- .../app/assesment-function/list.vue | 12 +- app/components/app/bed/list-cfg.ts | 60 ++--- app/components/app/bed/list.vue | 9 +- app/components/app/building/list-cfg.ts | 51 ++-- app/components/app/building/list.vue | 9 +- app/components/app/chamber/list-cfg.ts | 60 ++--- app/components/app/chamber/list.vue | 9 +- app/components/app/counter/list-cfg.ts | 51 ++-- app/components/app/counter/list.vue | 9 +- .../app/division-position/list-cfg.ts | 95 ++++---- app/components/app/division-position/list.vue | 9 +- app/components/app/division/list-cfg.ts | 66 ++--- app/components/app/division/list.vue | 9 +- app/components/app/doctor/list-cfg.ts | 183 +++++++------- app/components/app/doctor/list.vue | 9 +- app/components/app/employee/list-cfg.ts | 167 +++++++------ app/components/app/employee/list.vue | 9 +- app/components/app/encounter/list-cfg.ts | 228 +++++++++--------- app/components/app/encounter/list.vue | 9 +- app/components/app/equipment/list-cfg.ts | 74 +++--- app/components/app/equipment/list.vue | 11 +- app/components/app/floor/list-cfg.ts | 62 ++--- app/components/app/floor/list.vue | 9 +- app/components/app/icd/list-cfg.ts | 228 +++++++++--------- app/components/app/icd/list.vue | 9 +- app/components/app/icd/multiselect-picker.vue | 9 +- app/components/app/installation/list-cfg.ts | 80 +++--- app/components/app/installation/list.vue | 9 +- app/components/app/item-price/list-cfg.ts | 61 ++--- app/components/app/item-price/list.vue | 9 +- app/components/app/item/list-cfg.ts | 61 ++--- app/components/app/item/list.vue | 9 +- app/components/app/laborant/list-cfg.ts | 183 +++++++------- app/components/app/laborant/list.vue | 9 +- app/components/app/medicine-group/list-cfg.ts | 53 ++-- app/components/app/medicine-group/list.vue | 9 +- .../app/medicine-method/list-cfg.ts | 53 ++-- app/components/app/medicine-method/list.vue | 9 +- app/components/app/medicine/list-cfg.ts | 85 +++---- app/components/app/medicine/list.vue | 9 +- app/components/app/nurse/list-cfg.ts | 183 +++++++------- app/components/app/nurse/list.vue | 9 +- app/components/app/nutritionist/list-cfg.ts | 181 +++++++------- app/components/app/nutritionist/list.vue | 9 +- app/components/app/patient/list-cfg.ts | 163 +++++++------ app/components/app/patient/list.vue | 9 +- app/components/app/patient/picker.vue | 9 +- app/components/app/pharmacist/list-cfg.ts | 181 +++++++------- app/components/app/pharmacist/list.vue | 9 +- .../app/prescription-item/list-entry.cfg.ts | 56 +++++ .../app/prescription-item/list-entry.ts | 66 ----- .../app/prescription-item/list-entry.vue | 9 +- app/components/app/public-screen/list-cfg.ts | 52 ++-- app/components/app/public-screen/list.vue | 9 +- .../registration/sep-prosedur/list-cfg.ts | 197 +++++++-------- .../rehab/registration/sep-prosedur/list.vue | 9 +- app/components/app/room/list-cfg.ts | 87 +++---- app/components/app/room/list.vue | 9 +- app/components/app/satusehat/list-cfg.ts | 106 ++++---- app/components/app/satusehat/list.vue | 7 +- app/components/app/sep/list-cfg.ts | 127 +++++----- app/components/app/sep/list.vue | 9 +- app/components/app/soapi/list-cfg.ts | 204 ++++++++-------- app/components/app/soapi/list.vue | 9 +- app/components/app/specialist/list-cfg.ts | 71 +++--- app/components/app/specialist/list.vue | 9 +- app/components/app/subspecialist/list-cfg.ts | 71 +++--- app/components/app/subspecialist/list.vue | 9 +- app/components/app/tools/list-cfg.ts | 76 +++--- app/components/app/tools/list.vue | 9 +- app/components/app/unit/list-cfg.ts | 71 +++--- app/components/app/unit/list.vue | 9 +- app/components/app/uom/list-cfg.ts | 60 ++--- app/components/app/uom/list.vue | 11 +- app/components/app/user/list-cfg.ts | 174 +++++++------ app/components/app/user/list.vue | 9 +- app/components/app/warehouse/list-cfg.ts | 61 ++--- app/components/app/warehouse/list.vue | 9 +- .../pub/my-ui/data-table/data-table.vue | 33 +-- app/components/pub/my-ui/data-table/index.ts | 3 + app/components/pub/my-ui/data-table/type.ts | 56 +++++ app/components/pub/my-ui/data/types.ts | 35 +-- 83 files changed, 2279 insertions(+), 2506 deletions(-) create mode 100644 app/components/app/prescription-item/list-entry.cfg.ts delete mode 100644 app/components/app/prescription-item/list-entry.ts create mode 100644 app/components/pub/my-ui/data-table/index.ts 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/list-cfg.ts b/app/components/app/bed/list-cfg.ts index 8e940723..825db939 100644 --- a/app/components/app/bed/list-cfg.ts +++ b/app/components/app/bed/list-cfg.ts @@ -1,44 +1,44 @@ -import type { - Col, - KeyLabel, - RecComponent, - RecStrFuncComponent, - RecStrFuncUnknown, - Th, -} from '~/components/pub/my-ui/data/types' +import type { Config, RecComponent } from '~/components/pub/my-ui/data-table' import { defineAsyncComponent } from 'vue' type SmallDetailDto = any const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) -export const cols: Col[] = [{}, {}, {}, { width: 50 }] +export const config: Config = { + cols: [{}, {}, {}, { width: 50 }], -export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Kamar' }, { label: '' }]] + headers: [[ + { label: 'Kode' }, + { label: 'Nama' }, + { label: 'Kamar' }, + { label: '' }, + ]], -export const keys = ['code', 'name', 'parent', 'action'] + keys: ['code', 'name', 'parent', 'action'], -export const delKeyNames: KeyLabel[] = [ - { key: 'code', label: 'Kode' }, - { key: 'name', label: 'Nama' }, -] + delKeyNames: [ + { key: 'code', label: 'Kode' }, + { key: 'name', label: 'Nama' }, + ], -export const funcParsed: RecStrFuncUnknown = { - parent: (rec: unknown): unknown => { - const recX = rec as SmallDetailDto - return recX.parent?.name || '-' + parses: { + parent: (rec: unknown): unknown => { + const recX = rec as SmallDetailDto + return recX.parent?.name || '-' + }, }, -} -export const funcComponent: RecStrFuncComponent = { - action(rec, idx) { - const res: RecComponent = { - idx, - rec: rec as object, - component: action, - } - return res + components: { + action(rec, idx) { + const res: RecComponent = { + idx, + rec: rec as object, + component: action, + } + return res + }, }, -} -export const funcHtml: RecStrFuncUnknown = {} + htmls: {}, +} diff --git a/app/components/app/bed/list.vue b/app/components/app/bed/list.vue index f8b4bf29..19642581 100644 --- a/app/components/app/bed/list.vue +++ b/app/components/app/bed/list.vue @@ -6,7 +6,7 @@ import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vu import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type' // Configs -import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' +import { config } from './list-cfg' interface Props { data: any[] @@ -27,13 +27,8 @@ function handlePageChange(page: number) {