Merge branch 'dev' of github.com:dikstub-rssa/simrs-fe into feat/patient-63

This commit is contained in:
Khafid Prayoga
2025-10-15 12:45:40 +07:00
86 changed files with 2310 additions and 2518 deletions

No files matched your search

+2
View File
@@ -22,3 +22,5 @@ logs
.env .env
.env.* .env.*
!.env.example !.env.example
.vscode
-15
View File
@@ -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}"
}
]
}
+99 -104
View File
@@ -1,119 +1,114 @@
import type {
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
export const cols: Col[] = [ export const config: Config = {
{}, cols: [
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 120 }, { width: 100 },
{}, { width: 120 },
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{ width: 50 }, {},
] { 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 keys = [ headers: [
'name', [
'medicalRecord_number', { label: 'Nama' },
'identity_number', { label: 'Rekam Medis' },
'birth_date', { label: 'KTP' },
'patient_age', { label: 'Tgl Lahir' },
'gender', { label: 'Umur' },
'education', { label: 'JK' },
'status', { label: 'Pendidikan' },
'action', { label: 'Status' },
] { label: '' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'name',
{ key: 'name', label: 'Nama' }, 'medicalRecord_number',
] 'identity_number',
'birth_date',
'patient_age',
'gender',
'education',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
const recX = rec as SmallDetailDto { key: 'name', label: 'Nama' },
return `${recX.firstName} ${recX.middleName || ''} ${recX.lastName || ''}` ],
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 '-'
},
}, },
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
if (recX.identity_number?.substring(0, 5) === 'BLANK') { action(rec: unknown, idx: number) {
return '(TANPA NIK)' const res: RecComponent = {
} idx,
return recX.identity_number rec: rec as object,
component: action,
}
return res
},
}, },
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 funcComponent: RecStrFuncComponent = { htmls: {
action(rec, idx) { patient_address(rec: unknown) {
const res: RecComponent = { return '-'
idx, },
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
+2 -10
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -7,13 +7,5 @@ defineProps<{
</script> </script>
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable v-bind="config" :rows="data" />
:rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/>
</template> </template>
+30 -30
View File
@@ -1,44 +1,44 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
parent: (rec: unknown): unknown => { parent: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return recX.parent?.name || '-' return recX.parent?.name || '-'
},
}, },
}
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res return res
},
}, },
}
export const funcHtml: RecStrFuncUnknown = {} htmls: {},
}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+25 -26
View File
@@ -1,37 +1,36 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: '' }]] headers: [[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: '' },
]],
export const keys = ['code', 'name', 'action'] keys: ['code', 'name', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = {} parses: {},
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res return res
},
}, },
}
export const funcHtml: RecStrFuncUnknown = {} htmls: {},
}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+30 -30
View File
@@ -1,44 +1,44 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: 'Lantai' }, { label: '' }]] headers: [[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Lantai' },
{ label: '' },
]],
export const keys = ['code', 'name', 'parent', 'action'] keys: ['code', 'name', 'parent', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
parent: (rec: unknown): unknown => { parent: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return recX.parent?.name || '-' return recX.parent?.name || '-'
},
}, },
}
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res return res
},
}, },
}
export const funcHtml: RecStrFuncUnknown = {} htmls: {},
}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+25 -26
View File
@@ -1,37 +1,36 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: '' }]] headers: [[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: '' },
]],
export const keys = ['code', 'name', 'action'] keys: ['code', 'name', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = {} parses: {},
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res return res
},
}, },
}
export const funcHtml: RecStrFuncUnknown = {} htmls: {},
}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
@@ -1,64 +1,59 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue'))
export const cols: Col[] = [{}, {}, {}, {}, {}, { width: 50 }] export const config: Config = {
cols: [{}, {}, {}, {}, {}, { width: 50 }],
export const header: Th[][] = [ headers: [
[ [
{ label: 'Kode' }, { label: 'Kode' },
{ label: 'Nama' }, { label: 'Nama' },
{ label: 'Divisi Induk' }, { label: 'Divisi Induk' },
{ label: 'Karyawan' }, { label: 'Karyawan' },
{ label: 'Status Kepala' }, { label: 'Status Kepala' },
{ label: '' }, { label: '' },
],
], ],
]
export const keys = ['code', 'name', 'division', 'employee', 'head', 'action'] keys: ['code', 'name', 'division', 'employee', 'head', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
division: (rec: unknown): unknown => { division: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return recX.division?.name || '-' return recX.division?.name || '-'
},
employee: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.employee?.name || '-'
},
head: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.headStatus ? 'Ya' : 'Tidak'
},
}, },
employee: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
return recX.employee?.name || '-' action(rec, idx) {
}, const res: RecComponent = {
head: (rec: unknown): unknown => { idx,
const recX = rec as SmallDetailDto rec: rec as object,
return recX.headStatus ? 'Ya' : 'Tidak' component: action,
props: {
size: 'sm',
},
}
return res
},
}, },
htmls: {},
} }
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
props: {
size: 'sm',
},
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {}
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+33 -33
View File
@@ -1,47 +1,47 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue'))
export const cols: Col[] = [{}, {}, {}, { width: 50 }] export const config: Config = {
cols: [{}, {}, {}, { width: 50 }],
export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Divisi Induk' }, { label: '' }]] headers: [[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Divisi Induk' },
{ label: '' },
]],
export const keys = ['code', 'name', 'parent', 'action'] keys: ['code', 'name', 'parent', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
parent: (rec: unknown): unknown => { parent: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return recX.parent?.name || '-' return recX.parent?.name || '-'
},
}, },
}
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
props: { props: {
size: 'sm', size: 'sm',
}, },
} }
return res return res
},
}, },
}
export const funcHtml: RecStrFuncUnknown = {} htmls: {},
}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+88 -93
View File
@@ -1,11 +1,4 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
@@ -18,97 +11,99 @@ const _doctorStatus = {
1: 'Aktif', 1: 'Aktif',
} }
export const cols: Col[] = [ export const config: Config = {
{ width: 100 }, cols: [
{ width: 250 }, { width: 100 },
{}, { width: 250 },
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{}, {},
{}, {},
{ width: 120 }, {},
{ width: 100 }, { width: 120 },
{}, { width: 100 },
{}, {},
] {},
export const header: Th[][] = [
[
{ label: 'Kode JKN' },
{ label: 'Nama' },
{ label: 'No KTP' },
{ label: 'No SIP' },
{ label: 'No IHS' },
{ label: 'Telpon' },
{ label: 'Fee Ranap' },
{ label: 'Fee Rajal' },
{ label: 'Status' },
{ label: '' },
], ],
]
export const keys = [ headers: [
'bpjs_code', [
'name', { label: 'Kode JKN' },
'identity_number', { label: 'Nama' },
'sip_no', { label: 'No KTP' },
'ihs_number', { label: 'No SIP' },
'phone', { label: 'No IHS' },
'inPatient_itemPrice', { label: 'Telpon' },
'outPatient_itemPrice', { label: 'Fee Ranap' },
'status', { label: 'Fee Rajal' },
'action', { label: 'Status' },
] { label: '' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'bpjs_code',
{ key: 'name', label: 'Nama' }, 'name',
] 'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
const recX = rec as SmallDetailDto { key: 'name', label: 'Nama' },
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim() ],
parses: {
name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim()
},
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
},
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
}, },
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
if (recX.identity_number?.substring(0, 5) === 'BLANK') { action(rec, idx) {
return '(TANPA NIK)' const res: RecComponent = {
} idx,
return recX.identity_number rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}, },
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
}
export const funcComponent: RecStrFuncComponent = { htmls: {
action(rec, idx) { patient_address(_rec) {
const res: RecComponent = { return '-'
idx, },
rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+81 -86
View File
@@ -1,11 +1,4 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
@@ -17,93 +10,95 @@ const doctorStatus = {
1: 'Aktif', 1: 'Aktif',
} }
export const cols: Col[] = [ export const config: Config = {
{ width: 100 }, cols: [
{ width: 250 }, { width: 100 },
{}, { width: 250 },
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 100 }, { width: 120 },
{ width: 100 }, { width: 100 },
{ width: 50 }, {},
] {},
export const header: Th[][] = [
[
{ label: 'Kode JKN' },
{ label: 'Nama' },
{ label: 'No KTP' },
{ label: 'No SIP' },
{ label: 'No IHS' },
{ label: 'Telpon' },
{ label: 'Fee Ranap' },
{ label: 'Fee Rajal' },
{ label: 'Status' },
], ],
]
export const keys = [ headers: [
'bpjs_code', [
'name', { label: 'Kode JKN' },
'identity_number', { label: 'Nama' },
'sip_no', { label: 'No KTP' },
'ihs_number', { label: 'No SIP' },
'phone', { label: 'No IHS' },
'inPatient_itemPrice', { label: 'Telpon' },
'outPatient_itemPrice', { label: 'Fee Ranap' },
'status', { label: 'Fee Rajal' },
'action', { label: 'Status' },
] { label: '' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'bpjs_code',
{ key: 'name', label: 'Nama' }, 'name',
] 'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
console.log(rec) { key: 'name', label: 'Nama' },
const recX = rec as SmallDetailDto ],
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim()
}, parses: {
identity_number: (rec: unknown): unknown => { name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
if (recX.identity_number?.substring(0, 5) === 'BLANK') { return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim()
return '(TANPA NIK)' },
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
},
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
status: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return doctorStatus[recX.status_code as keyof typeof doctorStatus]
} }
return recX.identity_number
}, },
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
status: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return doctorStatus[recX.status_code as keyof typeof doctorStatus]
},
}
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
}
return res
} }
return res
}, },
}
export const funcHtml: RecStrFuncUnknown = { htmls: {
patient_address(_rec) { patient_address(_rec) {
return '-' return '-'
},
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+111 -115
View File
@@ -1,11 +1,4 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
@@ -13,119 +6,122 @@ type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-pdud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-pdud.vue'))
const statusBadge = defineAsyncComponent(() => import('./status-badge.vue')) const statusBadge = defineAsyncComponent(() => import('./status-badge.vue'))
export const cols: Col[] = [ export const config: Config = {
{}, cols: [
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 120 }, { width: 100 },
{}, { width: 120 },
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{ width: 50 }, {},
] { 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 keys = [ headers: [
'name', [
'medicalRecord_number', { label: 'Nama' },
'identity_number', { label: 'Rekam Medis' },
'birth_date', { label: 'KTP' },
'patient_age', { label: 'Tgl Lahir' },
'gender', { label: 'Umur' },
'education', { label: 'JK' },
'status', { label: 'Pendidikan' },
'action', { label: 'Status' },
] { label: '' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'name',
{ key: 'name', label: 'Nama' }, 'medicalRecord_number',
] 'identity_number',
'birth_date',
'patient_age',
'gender',
'education',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
const recX = rec as SmallDetailDto { key: 'name', label: 'Nama' },
return `${recX.firstName} ${recX.middleName || ''} ${recX.lastName || ''}` ],
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 '-'
},
}, },
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
if (recX.identity_number?.substring(0, 5) === 'BLANK') { action(rec, idx) {
return '(TANPA NIK)' const res: RecComponent = {
} idx,
return recX.identity_number rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
const recX = rec as SmallDetailDto
if (recX.status_code === null) {
recX.status_code = 0
}
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}, },
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 funcComponent: RecStrFuncComponent = { htmls: {
action(rec, idx) { patient_address(_rec) {
const res: RecComponent = { return '-'
idx, },
rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
if (rec.status === null) {
rec.status_code = 0
}
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+44 -30
View File
@@ -1,43 +1,57 @@
import type { Col, KeyLabel, RecComponent, RecStrFuncComponent, Th } from '~/components/pub/my-ui/data/types' import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
export const cols: Col[] = [{ width: 100 }, { width: 250 }, { width: 100 }, { width: 100 }, { width: 50 }] export const config: Config = {
cols: [
{ width: 100 },
{ width: 250 },
{ width: 100 },
{ width: 100 },
{ width: 50 },
],
export const header: Th[][] = [ headers: [
[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Stok' }, { label: 'Satuan' }, { label: '' }], [
] { label: 'Kode' },
{ label: 'Nama' },
{ label: 'Stok' },
{ label: 'Satuan' },
{ label: '' },
],
],
export const keys = ['code', 'name', 'stock', 'uom_code', 'action'] keys: ['code', 'name', 'stock', 'uom_code', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: Record<string, (row: any, ...args: any[]) => any> = { parses: {
name: (rec: unknown): unknown => { name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return `${recX.name}`.trim() return `${recX.name}`.trim()
},
uom_code: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.uom_code
},
}, },
uom_code: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
return recX.uom_code action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
}, },
htmls: {},
} }
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: Record<string, (row: any, ...args: any[]) => any> = {}
+3 -8
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,14 +27,9 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols" />
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/>
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
</div> </div>
</template> </template>
+32 -30
View File
@@ -1,44 +1,46 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: 'Gedung' }, { label: '' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Gedung' },
{ label: '' },
],
],
export const keys = ['code', 'name', 'parent', 'action'] keys: ['code', 'name', 'parent', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
parent: (rec: unknown): unknown => { parent: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return recX.parent?.name || '-' return recX.parent?.name || '-'
},
}, },
}
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res return res
},
}, },
}
export const funcHtml: RecStrFuncUnknown = {} htmls: {},
}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+111 -115
View File
@@ -1,11 +1,4 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
@@ -13,119 +6,122 @@ type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
const statusBadge = defineAsyncComponent(() => import('./status-badge.vue')) const statusBadge = defineAsyncComponent(() => import('./status-badge.vue'))
export const cols: Col[] = [ export const config: Config = {
{}, cols: [
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 120 }, { width: 100 },
{}, { width: 120 },
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{ width: 50 }, {},
] { 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 keys = [ headers: [
'name', [
'medicalRecord_number', { label: 'Nama' },
'identity_number', { label: 'Rekam Medis' },
'birth_date', { label: 'KTP' },
'patient_age', { label: 'Tgl Lahir' },
'gender', { label: 'Umur' },
'education', { label: 'JK' },
'status', { label: 'Pendidikan' },
'action', { label: 'Status' },
] { label: '' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'name',
{ key: 'name', label: 'Nama' }, 'medicalRecord_number',
] 'identity_number',
'birth_date',
'patient_age',
'gender',
'education',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
const recX = rec as SmallDetailDto { key: 'name', label: 'Nama' },
return `${recX.firstName} ${recX.middleName || ''} ${recX.lastName || ''}` ],
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 '-'
},
}, },
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
if (recX.identity_number?.substring(0, 5) === 'BLANK') { action(rec, idx) {
return '(TANPA NIK)' const res: RecComponent = {
} idx,
return recX.identity_number rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
const recX = rec as SmallDetailDto
if (recX.status_code === null) {
recX.status_code = 0
}
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}, },
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 funcComponent: RecStrFuncComponent = { htmls: {
action(rec, idx) { patient_address(_rec) {
const res: RecComponent = { return '-'
idx, },
rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
if (rec.status === null) {
rec.status_code = 0
}
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ data: any[] }>() defineProps<{ data: any[] }>()
const modelValue = defineModel<any | null>() const modelValue = defineModel<any | null>()
@@ -8,13 +8,8 @@ const modelValue = defineModel<any | null>()
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-model="modelValue" v-model="modelValue"
v-bind="config"
select-mode="multi" select-mode="multi"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+37 -35
View File
@@ -1,51 +1,53 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-ud.vue'))
export const cols: Col[] = [{}, {}, {}, { width: 50 }] export const config: Config = {
cols: [{}, {}, {}, { width: 50 }],
export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Encounter Class' }, { label: '' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Encounter Class' },
{ label: '' },
],
],
export const keys = ['code', 'name', 'encounterClass_code', 'action'] keys: ['code', 'name', 'encounterClass_code', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
name: (rec: unknown): unknown => { name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return `${recX.name}`.trim() return `${recX.name}`.trim()
},
}, },
}
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
props: { props: {
size: 'sm', size: 'sm',
}, },
} }
return res return res
},
}, },
}
export const funcHtml: RecStrFuncUnknown = { htmls: {
patient_address(_rec) { patient_address(_rec) {
return '-' return '-'
},
}, },
} }
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+29 -28
View File
@@ -1,11 +1,4 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
@@ -15,32 +8,40 @@ const _doctorStatus = {
1: 'Aktif', 1: 'Aktif',
} }
export const cols: Col[] = [{}, {}, { width: 50 }] export const config: Config = {
cols: [{}, {}, { width: 50 }],
export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Aksi' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Aksi' },
],
],
export const keys = ['code', 'name', 'action'] keys: ['code', 'name', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = {} parses: {},
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res return res
},
}, },
}
export const funcHtml: RecStrFuncUnknown = { htmls: {
patient_address(_rec) { patient_address(_rec) {
return '-' return '-'
},
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+29 -28
View File
@@ -1,11 +1,4 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
@@ -15,32 +8,40 @@ const _doctorStatus = {
1: 'Aktif', 1: 'Aktif',
} }
export const cols: Col[] = [{}, {}, { width: 50 }] export const config: Config = {
cols: [{}, {}, { width: 50 }],
export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Aksi' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Aksi' },
],
],
export const keys = ['code', 'name', 'action'] keys: ['code', 'name', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = {} parses: {},
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res return res
},
}, },
}
export const funcHtml: RecStrFuncUnknown = { htmls: {
patient_address(_rec) { patient_address(_rec) {
return '-' return '-'
},
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+88 -93
View File
@@ -1,11 +1,4 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
@@ -18,97 +11,99 @@ const _doctorStatus = {
1: 'Aktif', 1: 'Aktif',
} }
export const cols: Col[] = [ export const config: Config = {
{ width: 100 }, cols: [
{ width: 250 }, { width: 100 },
{}, { width: 250 },
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{}, {},
{}, {},
{ width: 120 }, {},
{ width: 100 }, { width: 120 },
{}, { width: 100 },
{}, {},
] {},
export const header: Th[][] = [
[
{ label: 'Kode JKN' },
{ label: 'Nama' },
{ label: 'No KTP' },
{ label: 'No SIP' },
{ label: 'No IHS' },
{ label: 'Telpon' },
{ label: 'Fee Ranap' },
{ label: 'Fee Rajal' },
{ label: 'Status' },
{ label: '' },
], ],
]
export const keys = [ headers: [
'bpjs_code', [
'name', { label: 'Kode JKN' },
'identity_number', { label: 'Nama' },
'sip_no', { label: 'No KTP' },
'ihs_number', { label: 'No SIP' },
'phone', { label: 'No IHS' },
'inPatient_itemPrice', { label: 'Telpon' },
'outPatient_itemPrice', { label: 'Fee Ranap' },
'status', { label: 'Fee Rajal' },
'action', { label: 'Status' },
] { label: '' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'bpjs_code',
{ key: 'name', label: 'Nama' }, 'name',
] 'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
const recX = rec as SmallDetailDto { key: 'name', label: 'Nama' },
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim() ],
parses: {
name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim()
},
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
},
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
}, },
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
if (recX.identity_number?.substring(0, 5) === 'BLANK') { action(rec, idx) {
return '(TANPA NIK)' const res: RecComponent = {
} idx,
return recX.identity_number rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}, },
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
}
export const funcComponent: RecStrFuncComponent = { htmls: {
action(rec, idx) { patient_address(_rec) {
const res: RecComponent = { return '-'
idx, },
rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+27 -26
View File
@@ -1,37 +1,38 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: 'Aksi' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Aksi' },
],
],
export const keys = ['code', 'name', 'action'] keys: ['code', 'name', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = {} parses: {},
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res return res
},
}, },
}
export const funcHtml: RecStrFuncUnknown = {} htmls: {},
}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
</div> </div>
+27 -26
View File
@@ -1,37 +1,38 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: 'Aksi' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Aksi' },
],
],
export const keys = ['code', 'name', 'action'] keys: ['code', 'name', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = {} parses: {},
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { const res: RecComponent = {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res return res
},
}, },
}
export const funcHtml: RecStrFuncUnknown = {} htmls: {},
}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
</div> </div>
+40 -45
View File
@@ -1,59 +1,54 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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[][] = [ headers: [
[ [
{ label: 'Kode' }, { label: 'Kode' },
{ label: 'Name' }, { label: 'Name' },
{ label: 'Golongan' }, { label: 'Golongan' },
{ label: 'Metode Pemberian' }, { label: 'Metode Pemberian' },
{ label: "Satuan" }, { label: 'Satuan' },
{ label: 'Stok' }, { label: 'Stok' },
{ label: 'Aksi' }, { label: 'Aksi' },
],
], ],
]
export const keys = ['code', 'name', 'group', 'method', 'unit', 'stock', 'action'] keys: ['code', 'name', 'group', 'method', 'unit', 'stock', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
group: (rec: unknown): unknown => { group: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineGroup?.name || '-' return (rec as SmallDetailDto).medicineGroup?.name || '-'
},
method: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineMethod?.name || '-'
},
unit: (rec: unknown): unknown => {
return (rec as SmallDetailDto).uom?.name || '-'
},
}, },
method: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineMethod?.name || '-' components: {
}, action(rec, idx) {
unit: (rec: unknown): unknown => { const res: RecComponent = {
return (rec as SmallDetailDto).uom?.name || '-' idx,
rec: rec as object,
component: action,
}
return res
},
}, },
htmls: {},
} }
export const funcComponent: RecStrFuncComponent = {
action: (rec: unknown, idx: number): RecComponent => {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
</div> </div>
+88 -93
View File
@@ -1,11 +1,4 @@
import type { import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
@@ -18,97 +11,99 @@ const _doctorStatus = {
1: 'Aktif', 1: 'Aktif',
} }
export const cols: Col[] = [ export const config: Config = {
{ width: 100 }, cols: [
{ width: 250 }, { width: 100 },
{}, { width: 250 },
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{}, {},
{}, {},
{ width: 120 }, {},
{ width: 100 }, { width: 120 },
{}, { width: 100 },
{}, {},
] {},
export const header: Th[][] = [
[
{ label: 'Kode JKN' },
{ label: 'Nama' },
{ label: 'No KTP' },
{ label: 'No SIP' },
{ label: 'No IHS' },
{ label: 'Telpon' },
{ label: 'Fee Ranap' },
{ label: 'Fee Rajal' },
{ label: 'Status' },
{ label: '' },
], ],
]
export const keys = [ headers: [
'bpjs_code', [
'name', { label: 'Kode JKN' },
'identity_number', { label: 'Nama' },
'sip_no', { label: 'No KTP' },
'ihs_number', { label: 'No SIP' },
'phone', { label: 'No IHS' },
'inPatient_itemPrice', { label: 'Telpon' },
'outPatient_itemPrice', { label: 'Fee Ranap' },
'status', { label: 'Fee Rajal' },
'action', { label: 'Status' },
] { label: '' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'bpjs_code',
{ key: 'name', label: 'Nama' }, 'name',
] 'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
const recX = rec as SmallDetailDto { key: 'name', label: 'Nama' },
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim() ],
parses: {
name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim()
},
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
},
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
}, },
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
if (recX.identity_number?.substring(0, 5) === 'BLANK') { action(rec, idx) {
return '(TANPA NIK)' const res: RecComponent = {
} idx,
return recX.identity_number rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}, },
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
}
export const funcComponent: RecStrFuncComponent = { htmls: {
action(rec, idx) { patient_address(_rec) {
const res: RecComponent = { return '-'
idx, },
rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+86 -93
View File
@@ -1,11 +1,4 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
@@ -18,97 +11,97 @@ const _doctorStatus = {
1: 'Aktif', 1: 'Aktif',
} }
export const cols: Col[] = [ export const config: Config = {
{ width: 100 }, cols: [
{ width: 250 }, { width: 100 },
{}, { width: 250 },
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{}, {},
{}, {},
{ width: 120 }, {},
{ width: 100 }, { width: 120 },
{}, { width: 100 },
{}, {},
] {},
export const header: Th[][] = [
[
{ label: 'Kode JKN' },
{ label: 'Nama' },
{ label: 'No KTP' },
{ label: 'No SIP' },
{ label: 'No IHS' },
{ label: 'Telpon' },
{ label: 'Fee Ranap' },
{ label: 'Fee Rajal' },
{ label: 'Status' },
{ label: '' },
], ],
]
export const keys = [ headers: [
'bpjs_code', [
'name', { label: 'Kode JKN' },
'identity_number', { label: 'Nama' },
'sip_no', { label: 'No KTP' },
'ihs_number', { label: 'No SIP' },
'phone', { label: 'No IHS' },
'inPatient_itemPrice', { label: 'Telpon' },
'outPatient_itemPrice', { label: 'Fee Ranap' },
'status', { label: 'Fee Rajal' },
'action', { label: 'Status' },
] { label: '' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'bpjs_code',
{ key: 'name', label: 'Nama' }, 'name',
] 'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
const recX = rec as SmallDetailDto { key: 'name', label: 'Nama' },
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim() ],
parses: {
name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim()
},
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
},
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
}, },
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
if (recX.identity_number?.substring(0, 5) === 'BLANK') { action(rec, idx) {
return '(TANPA NIK)' return {
} idx,
return recX.identity_number rec: rec as object,
component: action,
}
},
status(rec, idx) {
return {
idx,
rec: rec as object,
component: statusBadge,
}
},
}, },
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
}
export const funcComponent: RecStrFuncComponent = { htmls: {
action(rec, idx) { patient_address(_rec) {
const res: RecComponent = { return '-'
idx, },
rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+83 -98
View File
@@ -1,11 +1,4 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import type { Patient } from '~/models/patient' import type { Patient } from '~/models/patient'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
import { educationCodes, genderCodes } from '~/lib/constants' import { educationCodes, genderCodes } from '~/lib/constants'
@@ -13,103 +6,95 @@ import { calculateAge } from '~/lib/utils'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
export const cols: Col[] = [{}, {}, {}, {}, {}, {}, {}, { width: 5 }] export const config: Config = {
cols: [{}, {}, {}, {}, {}, {}, {}, { width: 5 }],
export const header: Th[][] = [ headers: [
[ [
{ label: 'ID' }, { label: 'ID' },
{ label: 'Nama' }, { label: 'Nama' },
{ label: 'NIK/No. Paspor' }, { label: 'NIK/No. Paspor' },
{ label: 'Tgl Lahir' }, { label: 'Tgl Lahir' },
{ label: 'Umur' }, { label: 'Umur' },
{ label: 'Jenis Kelamin' }, { label: 'Jenis Kelamin' },
{ label: 'Pendidikan' }, { label: 'Pendidikan' },
{ label: '' }, { label: '' },
],
], ],
]
export const keys = [ keys: ['patientId', 'name', 'identity_number', 'birth_date', 'patient_age', 'gender', 'education', 'action'],
'patientId',
'name',
'identity_number',
'birth_date',
'patient_age',
'gender',
'education',
'action',
]
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
patientId: (rec: unknown): unknown => { patientId: (rec: unknown): unknown => {
const patient = rec as Patient const patient = rec as Patient
return patient.number return patient.number
},
name: (rec: unknown): unknown => {
const { person } = rec as Patient
return person.name.trim()
},
identity_number: (rec: unknown): unknown => {
const { person } = rec as Patient
if (person.nationality == 'WNA') {
return person.passportNumber
}
return person.residentIdentityNumber || '-'
},
birth_date: (rec: unknown): unknown => {
const { person } = rec as Patient
if (typeof person.birthDate == 'object' && person.birthDate) {
return (person.birthDate as Date).toLocaleDateString('id-ID')
} else if (typeof person.birthDate == 'string') {
return (person.birthDate as string).substring(0, 10)
}
return person.birthDate
},
patient_age: (rec: unknown): unknown => {
const { person } = rec as Patient
return calculateAge(person.birthDate)
},
gender: (rec: unknown): unknown => {
const { person } = rec as Patient
if (typeof person.gender_code == 'number' && person.gender_code >= 0) {
return person.gender_code
} else if (typeof person.gender_code === 'string' && person.gender_code) {
return genderCodes[person.gender_code] || '-'
}
return '-'
},
education: (rec: unknown): unknown => {
const { person } = rec as Patient
if (typeof person.education_code == 'number' && person.education_code >= 0) {
return person.education_code
} else if (typeof person.education_code === 'string' && person.education_code) {
return educationCodes[person.education_code] || '-'
}
return '-'
},
}, },
name: (rec: unknown): unknown => {
const { person } = rec as Patient
return person.name.trim()
},
identity_number: (rec: unknown): unknown => {
const { person } = rec as Patient
if (person.nationality == 'WNA') { components: {
return person.passportNumber action(rec, idx) {
} return {
idx,
rec: rec as object,
component: action,
}
},
},
return person.residentIdentityNumber || '-' htmls: {
}, patient_address(_rec) {
birth_date: (rec: unknown): unknown => { return '-'
const { person } = rec as Patient },
if (typeof person.birthDate == 'object' && person.birthDate) {
return (person.birthDate as Date).toLocaleDateString('id-ID')
} else if (typeof person.birthDate == 'string') {
return (person.birthDate as string).substring(0, 10)
}
return person.birthDate
},
patient_age: (rec: unknown): unknown => {
const { person } = rec as Patient
return calculateAge(person.birthDate)
},
gender: (rec: unknown): unknown => {
const { person } = rec as Patient
if (typeof person.gender_code == 'number' && person.gender_code >= 0) {
return person.gender_code
} else if (typeof person.gender_code === 'string' && person.gender_code) {
return genderCodes[person.gender_code] || '-'
}
return '-'
},
education: (rec: unknown): unknown => {
const { person } = rec as Patient
if (typeof person.education_code == 'number' && person.education_code >= 0) {
return person.education_code
} else if (typeof person.education_code === 'string' && person.education_code) {
return educationCodes[person.education_code] || '-'
}
return '-'
},
}
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
+2 -7
View File
@@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue' import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -22,13 +22,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ data: any[] }>() defineProps<{ data: any[] }>()
const modelValue = defineModel<any | null>() const modelValue = defineModel<any | null>()
@@ -8,13 +8,8 @@ const modelValue = defineModel<any | null>()
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-model="modelValue" v-model="modelValue"
v-bind="config"
select-mode="single" select-mode="single"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+86 -93
View File
@@ -1,11 +1,4 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
@@ -18,97 +11,97 @@ const _doctorStatus = {
1: 'Aktif', 1: 'Aktif',
} }
export const cols: Col[] = [ export const config: Config = {
{ width: 100 }, cols: [
{ width: 250 }, { width: 100 },
{}, { width: 250 },
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{}, {},
{}, {},
{ width: 120 }, {},
{ width: 100 }, { width: 120 },
{}, { width: 100 },
{}, {},
] {},
export const header: Th[][] = [
[
{ label: 'Kode JKN' },
{ label: 'Nama' },
{ label: 'No KTP' },
{ label: 'No SIP' },
{ label: 'No IHS' },
{ label: 'Telpon' },
{ label: 'Fee Ranap' },
{ label: 'Fee Rajal' },
{ label: 'Status' },
{ label: '' },
], ],
]
export const keys = [ headers: [
'bpjs_code', [
'name', { label: 'Kode JKN' },
'identity_number', { label: 'Nama' },
'sip_no', { label: 'No KTP' },
'ihs_number', { label: 'No SIP' },
'phone', { label: 'No IHS' },
'inPatient_itemPrice', { label: 'Telpon' },
'outPatient_itemPrice', { label: 'Fee Ranap' },
'status', { label: 'Fee Rajal' },
'action', { label: 'Status' },
] { label: '' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'bpjs_code',
{ key: 'name', label: 'Nama' }, 'name',
] 'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
const recX = rec as SmallDetailDto { key: 'name', label: 'Nama' },
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim() ],
parses: {
name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim()
},
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
},
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
}, },
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
if (recX.identity_number?.substring(0, 5) === 'BLANK') { action(rec, idx) {
return '(TANPA NIK)' return {
} idx,
return recX.identity_number rec: rec as object,
component: action,
}
},
status(rec, idx) {
return {
idx,
rec: rec as object,
component: statusBadge,
}
},
}, },
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
}
export const funcComponent: RecStrFuncComponent = { htmls: {
action(rec, idx) { patient_address(_rec) {
const res: RecComponent = { return '-'
idx, },
rec: rec as object,
component: action,
}
return res
},
status(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: statusBadge,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
@@ -0,0 +1,56 @@
import type { Config } 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 config: Config = {
cols: [{}, {}, {}, {}, {}, {}, { width: 50 }],
headers: [
[
{ label: 'Nama' },
{ label: 'Bentuk' },
{ label: 'Freq' },
{ label: 'Dosis' },
{ label: 'Interval' },
{ label: 'Total' },
{ label: '' },
],
],
keys: ['name', 'uom_code', 'frequency', 'multiplier', 'interval', 'total', 'action'],
delKeyNames: [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' },
],
parses: {
cateogry: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineCategory?.name || '-'
},
group: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineGroup?.name || '-'
},
method: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineMethod?.name || '-'
},
unit: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineUnit?.name || '-'
},
},
components: {
action(rec, idx) {
return {
idx,
rec: rec as object,
component: action,
}
},
},
htmls: {},
}
@@ -1,66 +0,0 @@
import type {
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
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 header: Th[][] = [
[
{ label: 'Nama' },
{ label: 'Bentuk' },
{ label: 'Freq' },
{ label: 'Dosis' },
{ label: 'Interval' },
{ label: 'Total' },
{ label: '' },
],
]
export const keys = ['name', 'uom_code', 'frequency', 'multiplier', 'interval', 'total', 'action']
export const delKeyNames: KeyLabel[] = [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' },
]
export const funcParsed: RecStrFuncUnknown = {
cateogry: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineCategory?.name || '-'
},
group: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineGroup?.name || '-'
},
method: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineMethod?.name || '-'
},
unit: (rec: unknown): unknown => {
return (rec as SmallDetailDto).medicineUnit?.name || '-'
},
}
export const funcComponent: RecStrFuncComponent = {
action: (rec: unknown, idx: number): RecComponent => {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
// (_rec) {
// return '-'
// },
}
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-entry' import { config } from './list-entry.cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+26 -26
View File
@@ -1,37 +1,37 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: '' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: '' },
],
],
export const keys = ['code', 'name', 'action'] keys: ['code', 'name', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = {} parses: {},
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { return {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res },
}, },
}
export const funcHtml: RecStrFuncUnknown = {} htmls: {},
}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
@@ -1,112 +1,113 @@
import type { Col, KeyLabel, RecComponent, RecStrFuncComponent, RecStrFuncUnknown, Th } from '~/components/pub/my-ui/data/types' import type { Config } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
export const cols: Col[] = [ export const config: Config = {
{}, cols: [
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 120 }, { width: 100 },
{}, { width: 120 },
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{ width: 50 }, {},
] { 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 keys = [ headers: [
'name', [
'medicalRecord_number', { label: 'Nama' },
'identity_number', { label: 'Rekam Medis' },
'birth_date', { label: 'KTP' },
'patient_age', { label: 'Tgl Lahir' },
'gender', { label: 'Umur' },
'education', { label: 'JK' },
'status', { label: 'Pendidikan' },
'action', { label: 'Status' },
] { label: '' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'name',
{ key: 'name', label: 'Nama' }, 'medicalRecord_number',
] 'identity_number',
'birth_date',
'patient_age',
'gender',
'education',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
const recX = rec as SmallDetailDto { key: 'name', label: 'Nama' },
return `${recX.firstName} ${recX.middleName || ''} ${recX.lastName || ''}` ],
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.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 '-'
},
}, },
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
if (recX.identity_number?.substring(0, 5) === 'BLANK') { action(rec, idx) {
return '(TANPA NIK)' return {
} idx,
return recX.identity_number rec: rec as object,
component: action,
}
},
}, },
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 funcComponent: RecStrFuncComponent = { htmls: {
action(rec, idx) { patient_address(_rec) {
const res: RecComponent = { return '-'
idx, },
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+44 -43
View File
@@ -1,56 +1,57 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: 'Lantai' }, { label: '' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Lantai' },
{ label: '' },
],
],
export const keys = ['code', 'name', 'parent', 'action'] keys: ['code', 'name', 'parent', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
specialist: (rec: unknown): unknown => { specialist: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return recX.specialist?.name || '-' return recX.specialist?.name || '-'
},
subspecialist: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.subspecialist?.name || '-'
},
unit: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.unit?.name || '-'
},
parent: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.parent?.name || '-'
},
}, },
subspecialist: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
return recX.subspecialist?.name || '-' action(rec, idx) {
}, return {
unit: (rec: unknown): unknown => { idx,
const recX = rec as SmallDetailDto rec: rec as object,
return recX.unit?.name || '-' component: action,
}, }
parent: (rec: unknown): unknown => { },
const recX = rec as SmallDetailDto
return recX.parent?.name || '-'
}, },
htmls: {},
} }
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+49 -49
View File
@@ -1,4 +1,4 @@
import type { Col, KeyLabel, RecComponent, RecStrFuncComponent, RecStrFuncUnknown, Th } from '../../pub/nav/types' import type { Config } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
@@ -18,61 +18,61 @@ export const rowStatus = {
const patientBadge = defineAsyncComponent(() => import('./badge-patient.vue')) const patientBadge = defineAsyncComponent(() => import('./badge-patient.vue'))
const statusBadge = defineAsyncComponent(() => import('./badge-status.vue')) const statusBadge = defineAsyncComponent(() => import('./badge-status.vue'))
export const cols: Col[] = [ export const config: Config = {
{ width: 100 }, cols: [
{ width: 100 }, { width: 100 },
{ width: 100 }, { width: 100 },
{ width: 100 }, { width: 100 },
{ width: 100 }, { width: 100 },
{ width: 100 }, { width: 100 },
] { width: 100 },
export const header: Th[][] = [
[
{ label: 'ID' },
{ label: 'Jenis' },
{ label: 'Pasien' },
{ label: 'Status' },
{ label: 'Terakhir Update' },
{ label: 'FHIR ID' },
], ],
]
export const keys = ['id', 'resource_type', 'patient', 'status', 'updated_at', 'fhir_id'] headers: [
[
{ label: 'ID' },
{ label: 'Jenis' },
{ label: 'Pasien' },
{ label: 'Status' },
{ label: 'Terakhir Update' },
{ label: 'FHIR ID' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: ['id', 'resource_type', 'patient', 'status', 'updated_at', 'fhir_id'],
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' },
]
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
const recX = rec as SmallDetailDto { key: 'name', label: 'Nama' },
return `${recX.firstName} ${recX.middleName || ''} ${recX.lastName || ''}` ],
},
}
export const funcComponent: RecStrFuncComponent = { parses: {
patient(rec, idx) { name: (rec: unknown): unknown => {
const res: RecComponent = { const recX = rec as SmallDetailDto
idx, return `${recX.firstName} ${recX.middleName || ''} ${recX.lastName || ''}`
rec: rec as object, },
component: patientBadge,
}
return res
}, },
status(rec, idx) {
const res: RecComponent = { components: {
idx, patient(rec, idx) {
rec: rec as object, return {
component: statusBadge, idx,
} rec: rec as object,
return res component: patientBadge,
}
},
status(rec, idx) {
return {
idx,
rec: rec as object,
component: statusBadge,
}
},
}, },
}
export const funcHtml: RecStrFuncUnknown = { htmls: {
patient_address(_rec) { patient_address(_rec) {
return '-' return '-'
},
}, },
} }
+2 -5
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -7,8 +7,5 @@ defineProps<{
</script> </script>
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable v-bind="config" :rows="data" />
:rows="data" :cols="cols" :header="header" :keys="keys" :func-parsed="funcParsed"
:func-html="funcHtml" :func-component="funcComponent"
/>
</template> </template>
+63 -64
View File
@@ -1,78 +1,77 @@
import type { Col, KeyLabel, RecComponent, RecStrFuncComponent, Th } from '~/components/pub/my-ui/data/types' import type { Config } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SepDto = any type SepDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
export const cols: Col[] = [ export const config: Config = {
{ width: 120 }, // TGL. SEP cols: [
{ width: 150 }, // NO. SEP { width: 120 }, // TGL. SEP
{ width: 120 }, // PELAYANAN { width: 150 }, // NO. SEP
{ width: 100 }, // JALUR { width: 120 }, // PELAYANAN
{ width: 150 }, // NO. RM { width: 100 }, // JALUR
{ width: 200 }, // NAMA PASIEN { width: 150 }, // NO. RM
{ width: 150 }, // NO. KARTU BPJS { width: 200 }, // NAMA PASIEN
{ width: 150 }, // NO. SURAT KONTROL { width: 150 }, // NO. KARTU BPJS
{ width: 150 }, // TGL SURAT KONTROL { width: 150 }, // NO. SURAT KONTROL
{ width: 150 }, // KLINIK TUJUAN { width: 150 }, // TGL SURAT KONTROL
{ width: 200 }, // DPJP { width: 150 }, // KLINIK TUJUAN
{ width: 200 }, // DIAGNOSIS AWAL { width: 200 }, // DPJP
{ width: 100 }, // AKSI { width: 200 }, // DIAGNOSIS AWAL
] { width: 100 }, // AKSI
export const header: Th[][] = [
[
{ label: 'TGL. SEP' },
{ label: 'NO. SEP' },
{ label: 'PELAYANAN' },
{ label: 'JALUR' },
{ label: 'NO. RM' },
{ label: 'NAMA PASIEN' },
{ label: 'NO. KARTU BPJS' },
{ label: 'NO. SURAT KONTROL' },
{ label: 'TGL SURAT KONTROL' },
{ label: 'KLINIK TUJUAN' },
{ label: 'DPJP' },
{ label: 'DIAGNOSIS AWAL' },
{ label: 'AKSI' },
], ],
]
export const keys = [ headers: [
'tgl_sep', [
'no_sep', { label: 'TGL. SEP' },
'pelayanan', { label: 'NO. SEP' },
'jalur', { label: 'PELAYANAN' },
'no_rm', { label: 'JALUR' },
'nama_pasien', { label: 'NO. RM' },
'no_kartu_bpjs', { label: 'NAMA PASIEN' },
'no_surat_kontrol', { label: 'NO. KARTU BPJS' },
'tgl_surat_kontrol', { label: 'NO. SURAT KONTROL' },
'klinik_tujuan', { label: 'TGL SURAT KONTROL' },
'dpjp', { label: 'KLINIK TUJUAN' },
'diagnosis_awal', { label: 'DPJP' },
'action', { label: 'DIAGNOSIS AWAL' },
] { label: 'AKSI' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'no_sep', label: 'NO. SEP' }, 'tgl_sep',
{ key: 'nama_pasien', label: 'Nama Pasien' }, 'no_sep',
] 'pelayanan',
'jalur',
'no_rm',
'nama_pasien',
'no_kartu_bpjs',
'no_surat_kontrol',
'tgl_surat_kontrol',
'klinik_tujuan',
'dpjp',
'diagnosis_awal',
'action',
],
export const funcParsed: Record<string, (row: any, ...args: any[]) => any> = { delKeyNames: [
{ key: 'no_sep', label: 'NO. SEP' },
{ key: 'nama_pasien', label: 'Nama Pasien' },
],
} parses: {},
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { return {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res },
}, },
}
export const funcHtml: Record<string, (row: any, ...args: any[]) => any> = {} htmls: {},
}
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, header, keys, funcParsed, funcComponent, funcHtml } from './list-cfg' import { config } from './list-cfg'
interface SepData { interface SepData {
tgl_sep: string tgl_sep: string
@@ -23,12 +23,7 @@ const props = defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
:cols="cols" v-bind="config"
:header="header"
:keys="keys"
:rows="props.data" :rows="props.data"
:funcParsed="funcParsed"
:funcComponent="funcComponent"
:funcHtml="funcHtml"
/> />
</template> </template>
+98 -104
View File
@@ -1,119 +1,113 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
export const cols: Col[] = [ export const config: Config = {
{}, cols: [
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 120 }, { width: 100 },
{}, { width: 120 },
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{ width: 50 }, {},
] { 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 keys = [ headers: [
'name', [
'medicalRecord_number', { label: 'Nama' },
'identity_number', { label: 'Rekam Medis' },
'birth_date', { label: 'KTP' },
'patient_age', { label: 'Tgl Lahir' },
'gender', { label: 'Umur' },
'education', { label: 'JK' },
'status', { label: 'Pendidikan' },
'action', { label: 'Status' },
] { label: '' },
],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'name',
{ key: 'name', label: 'Nama' }, 'medicalRecord_number',
] 'identity_number',
'birth_date',
'patient_age',
'gender',
'education',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
const recX = rec as SmallDetailDto { key: 'name', label: 'Nama' },
return `${recX.firstName} ${recX.middleName || ''} ${recX.lastName || ''}` ],
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.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 !== 'undefined') {
return recX.education_code
}
return '-'
},
}, },
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
if (recX.identity_number?.substring(0, 5) === 'BLANK') { action(rec, idx) {
return '(TANPA NIK)' return {
} idx,
return recX.identity_number rec: rec as object,
component: action,
}
},
}, },
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 funcComponent: RecStrFuncComponent = { htmls: {
action(rec, idx) { patient_address(_rec) {
const res: RecComponent = { return '-'
idx, },
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+36 -35
View File
@@ -1,48 +1,49 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: 'Unit' }, { label: '' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Unit' },
{ label: '' },
],
],
export const keys = ['code', 'name', 'unit', 'action'] keys: ['code', 'name', 'unit', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
name: (rec: unknown): unknown => { name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return `${recX.name}`.trim() return `${recX.name}`.trim()
},
unit: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.unit_id || '-'
},
}, },
unit: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
return recX.unit_id || '-' action(rec, idx) {
return {
idx,
rec: rec as object,
component: action,
}
},
}, },
htmls: {},
} }
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+36 -35
View File
@@ -1,48 +1,49 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: 'Specialis' }, { label: '' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Specialis' },
{ label: '' },
],
],
export const keys = ['code', 'name', 'specialist', 'action'] keys: ['code', 'name', 'specialist', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
name: (rec: unknown): unknown => { name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return `${recX.name}`.trim() return `${recX.name}`.trim()
},
specialist: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.specialist_id || '-'
},
}, },
specialist: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
return recX.specialist_id || '-' action(rec, idx) {
return {
idx,
rec: rec as object,
component: action,
}
},
}, },
htmls: {},
} }
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+41 -35
View File
@@ -1,48 +1,54 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
export const cols: Col[] = [{ width: 100 }, { width: 250 }, { width: 100 }, { width: 50 }] export const config: Config = {
cols: [
{ width: 100 },
{ width: 250 },
{ width: 100 },
{ width: 50 },
],
export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Satuan' }, { label: '' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Satuan' },
{ label: '' },
],
],
export const keys = ['code', 'name', 'uom_code', 'action'] keys: ['code', 'name', 'uom_code', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: Record<string, (row: any, ...args: any[]) => any> = { parses: {
name: (rec: unknown): unknown => { name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return `${recX.name}`.trim() return `${recX.name}`.trim()
},
uom_code: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.uom_code
},
}, },
uom_code: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
return recX.uom_code action(rec, idx) {
return {
idx,
rec: rec as object,
component: action,
}
},
}, },
htmls: {},
} }
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: Record<string, (row: any, ...args: any[]) => any> = {}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
</div> </div>
+36 -35
View File
@@ -1,48 +1,49 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: 'Instalasi' }, { label: '' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Instalasi' },
{ label: '' },
],
],
export const keys = ['code', 'name', 'installation', 'action'] keys: ['code', 'name', 'installation', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
name: (rec: unknown): unknown => { name: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return `${recX.name}`.trim() return `${recX.name}`.trim()
},
installation: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return recX.installation?.name || recX.Installation?.name || '-'
},
}, },
installation: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
return recX.installation?.name || recX.Installation?.name || '-' action(rec, idx) {
return {
idx,
rec: rec as object,
component: action,
}
},
}, },
htmls: {},
} }
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
+28 -28
View File
@@ -1,11 +1,4 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
@@ -15,32 +8,39 @@ const _doctorStatus = {
1: 'Aktif', 1: 'Aktif',
} }
export const cols: Col[] = [{}, {}, { width: 50 }] export const config: Config = {
cols: [{}, {}, { width: 50 }],
export const header: Th[][] = [[{ label: 'Kode' }, { label: 'Nama' }, { label: 'Aksi' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Aksi' },
],
],
export const keys = ['code', 'name', 'action'] keys: ['code', 'name', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = {} parses: {},
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { return {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res },
}, },
}
export const funcHtml: RecStrFuncUnknown = { htmls: {
patient_address(_rec) { patient_address(_rec) {
return '-' return '-'
},
}, },
} }
+3 -8
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,14 +27,9 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols" />
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/>
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
</div> </div>
</template> </template>
+83 -89
View File
@@ -1,11 +1,4 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
@@ -17,93 +10,94 @@ const doctorStatus = {
1: 'Aktif', 1: 'Aktif',
} }
export const cols: Col[] = [ export const config: Config = {
{ width: 100 }, cols: [
{ width: 250 }, { width: 100 },
{}, { width: 250 },
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{}, { width: 100 },
{}, {},
{}, {},
{ width: 100 }, {},
{ width: 100 }, { width: 100 },
{ width: 100 }, { width: 100 },
{ width: 50 }, { width: 100 },
] { width: 50 },
export const header: Th[][] = [
[
{ label: 'Kode JKN' },
{ label: 'Nama' },
{ label: 'No KTP' },
{ label: 'No SIP' },
{ label: 'No IHS' },
{ label: 'Telpon' },
{ label: 'Fee Ranap' },
{ label: 'Fee Rajal' },
{ label: 'Status' },
], ],
]
export const keys = [ headers: [
'bpjs_code', [
'name', { label: 'Kode JKN' },
'identity_number', { label: 'Nama' },
'sip_no', { label: 'No KTP' },
'ihs_number', { label: 'No SIP' },
'phone', { label: 'No IHS' },
'inPatient_itemPrice', { label: 'Telpon' },
'outPatient_itemPrice', { label: 'Fee Ranap' },
'status', { label: 'Fee Rajal' },
'action', { label: 'Status' },
] ],
],
export const delKeyNames: KeyLabel[] = [ keys: [
{ key: 'code', label: 'Kode' }, 'bpjs_code',
{ key: 'name', label: 'Nama' }, 'name',
] 'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
],
export const funcParsed: RecStrFuncUnknown = { delKeyNames: [
name: (rec: unknown): unknown => { { key: 'code', label: 'Kode' },
console.log(rec) { key: 'name', label: 'Nama' },
const recX = rec as SmallDetailDto ],
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim()
parses: {
name: (rec: unknown): unknown => {
console.log(rec)
const recX = rec as SmallDetailDto
return `${recX.frontTitle} ${recX.name} ${recX.endTitle}`.trim()
},
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
},
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
status: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return doctorStatus[recX.status_code as keyof typeof doctorStatus]
},
}, },
identity_number: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto components: {
if (recX.identity_number?.substring(0, 5) === 'BLANK') { action(rec, idx) {
return '(TANPA NIK)' return {
} idx,
return recX.identity_number rec: rec as object,
component: action,
}
},
}, },
inPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.inPatient_itemPrice.price).toLocaleString('id-ID')
},
outPatient_itemPrice: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return Number(recX.outPatient_itemPrice.price).toLocaleString('id-ID')
},
status: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto
return doctorStatus[recX.status_code as keyof typeof doctorStatus]
},
}
export const funcComponent: RecStrFuncComponent = { htmls: {
action(rec, idx) { patient_address(_rec) {
const res: RecComponent = { return '-'
idx, },
rec: rec as object,
component: action,
}
return res
},
}
export const funcHtml: RecStrFuncUnknown = {
patient_address(_rec) {
return '-'
}, },
} }
+2 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
defineProps<{ defineProps<{
data: any[] data: any[]
@@ -8,12 +8,7 @@ defineProps<{
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/> />
</template> </template>
+31 -30
View File
@@ -1,44 +1,45 @@
import type { import type { Config } from '~/components/pub/my-ui/data-table'
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/my-ui/data/types'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue')) 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: 'Lantai' }, { label: '' }]] headers: [
[
{ label: 'Kode' },
{ label: 'Nama' },
{ label: 'Lantai' },
{ label: '' },
],
],
export const keys = ['code', 'name', 'parent', 'action'] keys: ['code', 'name', 'parent', 'action'],
export const delKeyNames: KeyLabel[] = [ delKeyNames: [
{ key: 'code', label: 'Kode' }, { key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' }, { key: 'name', label: 'Nama' },
] ],
export const funcParsed: RecStrFuncUnknown = { parses: {
parent: (rec: unknown): unknown => { parent: (rec: unknown): unknown => {
const recX = rec as SmallDetailDto const recX = rec as SmallDetailDto
return recX.parent?.name || '-' return recX.parent?.name || '-'
},
}, },
}
export const funcComponent: RecStrFuncComponent = { components: {
action(rec, idx) { action(rec, idx) {
const res: RecComponent = { return {
idx, idx,
rec: rec as object, rec: rec as object,
component: action, component: action,
} }
return res },
}, },
}
export const funcHtml: RecStrFuncUnknown = {} htmls: {},
}
+2 -7
View File
@@ -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' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
// Configs // Configs
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg' import { config } from './list-cfg'
interface Props { interface Props {
data: any[] data: any[]
@@ -27,13 +27,8 @@ function handlePageChange(page: number) {
<template> <template>
<div class="space-y-4"> <div class="space-y-4">
<PubMyUiDataTable <PubMyUiDataTable
v-bind="config"
:rows="data" :rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
:skeleton-size="paginationMeta?.pageSize" :skeleton-size="paginationMeta?.pageSize"
/> />
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
@@ -1,21 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import type { DataTableLoader } from './type' import type { DataTableLoader } from '~/components/pub/my-ui/data/types'
import type { Col, RecStrFuncComponent, RecStrFuncUnknown, Th } from '~/components/pub/my-ui/data/types' import type { Config } from './index'
import { Info } from 'lucide-vue-next' import { Info } from 'lucide-vue-next'
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '~/components/pub/ui/table' import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '~/components/pub/ui/table'
const props = defineProps<{ const props = defineProps<Config & { rows: unknown[] }>()
skeletonSize?: number
rows: unknown[]
cols: Col[]
header: Th[][]
keys: string[]
funcParsed?: RecStrFuncUnknown
funcHtml?: RecStrFuncUnknown
funcComponent?: RecStrFuncComponent
selectMode?: 'single' | 'multiple'
modelValue?: any[] | any
}>()
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'update:modelValue', val: any[] | any): void (e: 'update:modelValue', val: any[] | any): void
@@ -62,10 +51,10 @@ function handleActionCellClick(event: Event, _cellRef: string) {
<template> <template>
<Table> <Table>
<TableHeader class="bg-gray-50 dark:bg-gray-800"> <TableHeader v-if="headers" class="bg-gray-50 dark:bg-gray-800">
<TableRow> <TableRow>
<TableHead <TableHead
v-for="(h, idx) in header[0]" v-for="(h, idx) in headers[0]"
:key="`head-${idx}`" :key="`head-${idx}`"
class="border" class="border"
:style="{ width: cols[idx]?.width ? `${cols[idx].width}px` : undefined }" :style="{ width: cols[idx]?.width ? `${cols[idx].width}px` : undefined }"
@@ -75,7 +64,7 @@ function handleActionCellClick(event: Event, _cellRef: string) {
</TableRow> </TableRow>
</TableHeader> </TableHeader>
<TableBody v-if="loader.isTableLoading"> <TableBody v-if="loader?.isTableLoading">
<!-- Loading state with 5 skeleton rows --> <!-- Loading state with 5 skeleton rows -->
<TableRow v-for="n in getSkeletonSize" :key="`skeleton-${n}`"> <TableRow v-for="n in getSkeletonSize" :key="`skeleton-${n}`">
<TableCell v-for="(key, cellIndex) in keys" :key="`cell-skel-${n}-${cellIndex}`" class="border"> <TableCell v-for="(key, cellIndex) in keys" :key="`cell-skel-${n}-${cellIndex}`" class="border">
@@ -118,16 +107,16 @@ function handleActionCellClick(event: Event, _cellRef: string) {
<TableCell v-for="(key, cellIndex) in keys" :key="`cell-${rowIndex}-${cellIndex}`" class="border"> <TableCell v-for="(key, cellIndex) in keys" :key="`cell-${rowIndex}-${cellIndex}`" class="border">
<!-- existing cell renderer --> <!-- existing cell renderer -->
<component <component
:is="funcComponent?.[key]?.(row, rowIndex).component" :is="components?.[key]?.(row, rowIndex).component"
v-if="funcComponent?.[key]" v-if="components?.[key]"
:rec="row" :rec="row"
:idx="rowIndex" :idx="rowIndex"
v-bind="funcComponent[key]?.(row, rowIndex).props" v-bind="components[key]?.(row, rowIndex).props"
/> />
<template v-else> <template v-else>
<div v-if="funcHtml?.[key]" v-html="funcHtml?.[key]?.(row, rowIndex)"></div> <div v-if="htmls?.[key]" v-html="htmls?.[key]?.(row, rowIndex)"></div>
<template v-else> <template v-else>
{{ funcParsed?.[key]?.(row, rowIndex) ?? (row as any)[key] }} {{ parses?.[key]?.(row, rowIndex) ?? (row as any)[key] }}
</template> </template>
</template> </template>
</TableCell> </TableCell>
@@ -0,0 +1,3 @@
export * from './type'
export { default as DataTable } from './data-table.vue'
@@ -1,3 +1,59 @@
export type ComponentType = Component
export interface Col {
span?: number
classVal?: string
style?: string
width?: number // specific for width
widthUnit?: string // specific for width
}
export interface Th {
label: string
colSpan?: number
rowSpan?: number
classVal?: string
childClassVal?: string
style?: string
childStyle?: string
hideOnSm?: boolean
}
export interface KeyLabel {
key: string
label: string
}
export interface RecComponent {
idx?: number
rec: object
props?: any
component: ComponentType
}
export type FuncRecUnknown = (rec: unknown, idx: number) => unknown
export type FuncComponent = (rec: unknown, idx: number) => RecComponent
export type RecStrFuncUnknown = Record<string, FuncRecUnknown>
export type RecStrFuncComponent = Record<string, FuncComponent>
export interface KeyNames {
key: string
label: string
}
export type Config = {
headers?: Th[][]
cols: Col[]
keys: string[]
delKeyNames?: KeyLabel[]
parses?: RecStrFuncUnknown
components?: RecStrFuncComponent
htmls?: RecStrFuncUnknown
skeletonSize?: number
selectMode?: 'single' | 'multiple'
modelValue?: any[] | any
}
export interface DataTableLoader { export interface DataTableLoader {
isTableLoading: boolean isTableLoading: boolean
[key: string]: boolean [key: string]: boolean
+5 -30
View File
@@ -9,32 +9,6 @@ export interface ListItemDto {
export type ComponentType = Component export type ComponentType = Component
export interface RecComponent {
idx?: number
rec: object
props?: any
component: ComponentType
}
export interface Col {
span?: number
classVal?: string
style?: string
width?: number // specific for width
widthUnit?: string // specific for width
}
export interface Th {
label: string
colSpan?: number
rowSpan?: number
classVal?: string
childClassVal?: string
style?: string
childStyle?: string
hideOnSm?: boolean
}
export interface ButtonNav { export interface ButtonNav {
variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link' variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'
classVal?: string classVal?: string
@@ -82,10 +56,6 @@ export interface KeyLabel {
key: string key: string
label: string label: string
} }
export type FuncRecUnknown = (rec: unknown, idx: number) => unknown
export type FuncComponent = (rec: unknown, idx: number) => RecComponent
export type RecStrFuncUnknown = Record<string, FuncRecUnknown>
export type RecStrFuncComponent = Record<string, FuncComponent>
export interface KeyNames { export interface KeyNames {
key: string key: string
@@ -107,3 +77,8 @@ export const ActionEvents = {
showDetail: 'showDetail', showDetail: 'showDetail',
showProcess: 'showProcess', showProcess: 'showProcess',
} }
export interface DataTableLoader {
isTableLoading: boolean
[key: string]: boolean
}
+46
View File
@@ -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 }
}