Merge pull request #21 from dikstub-rssa/feat/user

Feat/user
This commit is contained in:
sharedmaxchat
2025-09-10 07:24:39 +07:00
committed by GitHub
47 changed files with 1264 additions and 126 deletions
+10
View File
@@ -66,6 +66,16 @@ The basic development workflow follows these steps:
- Pages load the appropriate content from `components/content/`.
- They do not contain UI or logic directly, just route level layout or guards.
### Validation
- UI level validation in `components/app`. help users avoid mistakes before submitting.
- Lightweight/instant validation related to UX.
- Basic formatting (email regex, numeric-only, password length).
- Showing error messages directly under the field.
- Business level validation in `components/flow`. cannot rely only on the UI, since it often requires server-side checks or rules that may change.
- More complex validation rules tied to business logic.
## Code Conventions
- Under the script setup block, putting things in group with the following order:
+15 -57
View File
@@ -11,76 +11,34 @@ const data = computed({
get: () => props.modelValue,
set: (val) => emit('update:modelValue', val),
})
const items = [
{ value: 'doctor', label: 'Dokter' },
{ value: 'nurse', label: 'Perawat' },
]
</script>
<template>
<form id="entry-form">
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<div class="mb-2 border-b border-b-slate-300 text-lg xl:text-xl">
<div class="flex flex-col justify-between">
<Block>
<FieldGroup :column="1">
<Label>Nama dan Gelar</Label>
<FieldGroup :column="2" layout="stacked">
<Label stacked>No. IHS</Label>
<Field>
<Input v-model="data.name" type="text" name="name" default-value="dr." />
</Field>
<Field>
<Input type="text" name="name" />
</Field>
<Field>
<Input type="text" name="name" />
<Input />
</Field>
</FieldGroup>
</Block>
<Block>
<FieldGroup :column="2">
<Label>NIK</Label>
<FieldGroup :column="2" layout="stacked">
<Label stacked>No. SIP</Label>
<Field>
<Input type="text" name="identity_number" />
<Input />
</Field>
</FieldGroup>
<FieldGroup :column="2">
<Label>NO SIP</Label>
<Field name="sip_number">
<Input type="text" name="sip_no" />
</Field>
</FieldGroup>
</Block>
<Block>
<FieldGroup :column="2">
<Label>Telepon / HP</Label>
<Field name="phone">
<Input type="text" name="phone" />
</Field>
</FieldGroup>
<FieldGroup :column="2">
<Label>Kode BPJS</Label>
<FieldGroup :column="2" layout="stacked">
<Label stacked>Unit</Label>
<Field>
<Input type="text" name="bpjs_code" />
</Field>
</FieldGroup>
</Block>
<Block>
<FieldGroup :column="2">
<Label>Fee Rajal</Label>
<Field>
<Input type="number" name="outPatient_rate" />
</Field>
</FieldGroup>
<FieldGroup :column="2">
<Label>Fee Ranap</Label>
<Field>
<Input type="number" name="inPatient_rate" />
</Field>
</FieldGroup>
</Block>
<Block>
<FieldGroup :column="3">
<Label>Status</Label>
<Field>
<Input type="select" name="status">
<option value="active">Aktif</option>
<option value="inactive">Tidak Aktif</option>
</Input>
<Select v-model="data.type" :items="items" placeholder="Pilih jenis" />
</Field>
</FieldGroup>
</Block>
@@ -0,0 +1,49 @@
<script setup lang="ts">
import Block from '~/components/pub/custom-ui/form/block.vue'
import FieldGroup from '~/components/pub/custom-ui/form/field-group.vue'
import Field from '~/components/pub/custom-ui/form/field.vue'
import Label from '~/components/pub/custom-ui/form/label.vue'
const props = defineProps<{ modelValue: any; items: any[] }>()
const emit = defineEmits(['update:modelValue', 'event'])
const data = computed({
get: () => props.modelValue,
set: (val) => emit('update:modelValue', val),
})
</script>
<template>
<form id="entry-form">
<div class="mb-5 border-b border-b-slate-300 text-lg xl:text-xl">
<div class="flex flex-col justify-between">
<Block>
<FieldGroup :column="2" layout="stacked">
<Label stacked>Nomor Induk Pegawai</Label>
<Field>
<Input v-model="data.number" />
</Field>
</FieldGroup>
<FieldGroup :column="2" layout="stacked">
<Label stacked>Status</Label>
<Field>
<Select v-model="data.type" :items="items" placeholder="Pilih jenis" />
</Field>
</FieldGroup>
<FieldGroup :column="2" layout="stacked">
<Label stacked>Position</Label>
<Field>
<Select v-model="data.type" :items="items" placeholder="Pilih jenis" />
</Field>
</FieldGroup>
<FieldGroup :column="2" layout="stacked">
<Label stacked>Divisi</Label>
<Field>
<Select v-model="data.type" :items="items" placeholder="Pilih jenis" />
</Field>
</FieldGroup>
</Block>
</div>
</div>
</form>
</template>
+109
View File
@@ -0,0 +1,109 @@
import type {
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/custom-ui/data/types'
import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-dud.vue'))
const doctorStatus = {
0: 'Tidak Aktif',
1: 'Aktif',
}
export const cols: Col[] = [
{ width: 100 },
{ width: 250 },
{},
{ width: 100 },
{ width: 100 },
{},
{},
{},
{ width: 100 },
{ 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 = [
'bpjs_code',
'name',
'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
]
export const delKeyNames: KeyLabel[] = [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' },
]
export const funcParsed: RecStrFuncUnknown = {
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]
},
}
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 '-'
},
}
+19
View File
@@ -0,0 +1,19 @@
<script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg'
defineProps<{
data: any[]
}>()
</script>
<template>
<PubBaseDataTable
:rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/>
</template>
@@ -0,0 +1,31 @@
<script setup lang="ts">
import Block from '~/components/pub/custom-ui/form/block.vue'
import FieldGroup from '~/components/pub/custom-ui/form/field-group.vue'
import Field from '~/components/pub/custom-ui/form/field.vue'
import Label from '~/components/pub/custom-ui/form/label.vue'
const props = defineProps<{ modelValue: any }>()
const emit = defineEmits(['update:modelValue', 'event'])
const data = computed({
get: () => props.modelValue,
set: (val) => emit('update:modelValue', val),
})
</script>
<template>
<form id="entry-form">
<div class="mb-2 border-b border-b-slate-300 text-lg xl:text-xl">
<div class="flex flex-col justify-between">
<Block>
<FieldGroup layout="stacked">
<Label stacked>No. IHS</Label>
<Field>
<Input />
</Field>
</FieldGroup>
</Block>
</div>
</div>
</form>
</template>
+114
View File
@@ -0,0 +1,114 @@
import type {
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/custom-ui/data/types'
import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-dud.vue'))
const statusBadge = defineAsyncComponent(() => import('./status-badge.vue'))
const _doctorStatus = {
0: 'Tidak Aktif',
1: 'Aktif',
}
export const cols: Col[] = [
{ width: 100 },
{ width: 250 },
{},
{ width: 100 },
{ 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 = [
'bpjs_code',
'name',
'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
]
export const delKeyNames: KeyLabel[] = [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' },
]
export const funcParsed: RecStrFuncUnknown = {
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')
},
}
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
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 '-'
},
}
+19
View File
@@ -0,0 +1,19 @@
<script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg'
defineProps<{
data: any[]
}>()
</script>
<template>
<PubBaseDataTable
:rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/>
</template>
@@ -0,0 +1,29 @@
<script setup lang="ts">
import { Badge } from '~/components/pub/ui/badge'
const props = defineProps<{
rec: any
idx?: number
}>()
const doctorStatus = {
0: 'Tidak Aktif',
1: 'Aktif',
}
const statusText = computed(() => {
return doctorStatus[props.rec.status_code as keyof typeof doctorStatus]
})
const badgeVariant = computed(() => {
return props.rec.status_code === 1 ? 'default' : 'destructive'
})
</script>
<template>
<div class="flex justify-center">
<Badge :variant="badgeVariant">
{{ statusText }}
</Badge>
</div>
</template>
+31
View File
@@ -0,0 +1,31 @@
<script setup lang="ts">
import Block from '~/components/pub/custom-ui/form/block.vue'
import FieldGroup from '~/components/pub/custom-ui/form/field-group.vue'
import Field from '~/components/pub/custom-ui/form/field.vue'
import Label from '~/components/pub/custom-ui/form/label.vue'
const props = defineProps<{ modelValue: any }>()
const emit = defineEmits(['update:modelValue', 'event'])
const data = computed({
get: () => props.modelValue,
set: (val) => emit('update:modelValue', val),
})
</script>
<template>
<form id="entry-form">
<div class="mb-2 border-b border-b-slate-300 text-lg xl:text-xl">
<div class="flex flex-col justify-between">
<Block>
<FieldGroup layout="stacked">
<Label stacked>No. IHS</Label>
<Field>
<Input />
</Field>
</FieldGroup>
</Block>
</div>
</div>
</form>
</template>
+114
View File
@@ -0,0 +1,114 @@
import type {
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/custom-ui/data/types'
import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-dud.vue'))
const statusBadge = defineAsyncComponent(() => import('./status-badge.vue'))
const _doctorStatus = {
0: 'Tidak Aktif',
1: 'Aktif',
}
export const cols: Col[] = [
{ width: 100 },
{ width: 250 },
{},
{ width: 100 },
{ 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 = [
'bpjs_code',
'name',
'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
]
export const delKeyNames: KeyLabel[] = [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' },
]
export const funcParsed: RecStrFuncUnknown = {
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')
},
}
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
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 '-'
},
}
+19
View File
@@ -0,0 +1,19 @@
<script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg'
defineProps<{
data: any[]
}>()
</script>
<template>
<PubBaseDataTable
:rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/>
</template>
View File
View File
+29
View File
@@ -0,0 +1,29 @@
<script setup lang="ts">
import { Badge } from '~/components/pub/ui/badge'
const props = defineProps<{
rec: any
idx?: number
}>()
const doctorStatus = {
0: 'Tidak Aktif',
1: 'Aktif',
}
const statusText = computed(() => {
return doctorStatus[props.rec.status_code as keyof typeof doctorStatus]
})
const badgeVariant = computed(() => {
return props.rec.status_code === 1 ? 'default' : 'destructive'
})
</script>
<template>
<div class="flex justify-center">
<Badge :variant="badgeVariant">
{{ statusText }}
</Badge>
</div>
</template>
@@ -0,0 +1,31 @@
<script setup lang="ts">
import Block from '~/components/pub/custom-ui/form/block.vue'
import FieldGroup from '~/components/pub/custom-ui/form/field-group.vue'
import Field from '~/components/pub/custom-ui/form/field.vue'
import Label from '~/components/pub/custom-ui/form/label.vue'
const props = defineProps<{ modelValue: any }>()
const emit = defineEmits(['update:modelValue', 'event'])
const data = computed({
get: () => props.modelValue,
set: (val) => emit('update:modelValue', val),
})
</script>
<template>
<form id="entry-form">
<div class="mb-2 border-b border-b-slate-300 text-lg xl:text-xl">
<div class="flex flex-col justify-between">
<Block>
<FieldGroup layout="stacked">
<Label stacked>No. IHS</Label>
<Field>
<Input />
</Field>
</FieldGroup>
</Block>
</div>
</div>
</form>
</template>
+114
View File
@@ -0,0 +1,114 @@
import type {
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/custom-ui/data/types'
import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-dud.vue'))
const statusBadge = defineAsyncComponent(() => import('./status-badge.vue'))
const _doctorStatus = {
0: 'Tidak Aktif',
1: 'Aktif',
}
export const cols: Col[] = [
{ width: 100 },
{ width: 250 },
{},
{ width: 100 },
{ 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 = [
'bpjs_code',
'name',
'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
]
export const delKeyNames: KeyLabel[] = [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' },
]
export const funcParsed: RecStrFuncUnknown = {
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')
},
}
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
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 '-'
},
}
+19
View File
@@ -0,0 +1,19 @@
<script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg'
defineProps<{
data: any[]
}>()
</script>
<template>
<PubBaseDataTable
:rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/>
</template>
@@ -0,0 +1,29 @@
<script setup lang="ts">
import { Badge } from '~/components/pub/ui/badge'
const props = defineProps<{
rec: any
idx?: number
}>()
const doctorStatus = {
0: 'Tidak Aktif',
1: 'Aktif',
}
const statusText = computed(() => {
return doctorStatus[props.rec.status_code as keyof typeof doctorStatus]
})
const badgeVariant = computed(() => {
return props.rec.status_code === 1 ? 'default' : 'destructive'
})
</script>
<template>
<div class="flex justify-center">
<Badge :variant="badgeVariant">
{{ statusText }}
</Badge>
</div>
</template>
@@ -0,0 +1,31 @@
<script setup lang="ts">
import Block from '~/components/pub/custom-ui/form/block.vue'
import FieldGroup from '~/components/pub/custom-ui/form/field-group.vue'
import Field from '~/components/pub/custom-ui/form/field.vue'
import Label from '~/components/pub/custom-ui/form/label.vue'
const props = defineProps<{ modelValue: any }>()
const emit = defineEmits(['update:modelValue', 'event'])
const data = computed({
get: () => props.modelValue,
set: (val) => emit('update:modelValue', val),
})
</script>
<template>
<form id="entry-form">
<div class="mb-2 border-b border-b-slate-300 text-lg xl:text-xl">
<div class="flex flex-col justify-between">
<Block>
<FieldGroup :column="2" layout="stacked">
<Label stacked>No. IHS</Label>
<Field>
<Input />
</Field>
</FieldGroup>
</Block>
</div>
</div>
</form>
</template>
+114
View File
@@ -0,0 +1,114 @@
import type {
Col,
KeyLabel,
RecComponent,
RecStrFuncComponent,
RecStrFuncUnknown,
Th,
} from '~/components/pub/custom-ui/data/types'
import { defineAsyncComponent } from 'vue'
type SmallDetailDto = any
const action = defineAsyncComponent(() => import('~/components/pub/custom-ui/data/dropdown-action-dud.vue'))
const statusBadge = defineAsyncComponent(() => import('./status-badge.vue'))
const _doctorStatus = {
0: 'Tidak Aktif',
1: 'Aktif',
}
export const cols: Col[] = [
{ width: 100 },
{ width: 250 },
{},
{ width: 100 },
{ 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 = [
'bpjs_code',
'name',
'identity_number',
'sip_no',
'ihs_number',
'phone',
'inPatient_itemPrice',
'outPatient_itemPrice',
'status',
'action',
]
export const delKeyNames: KeyLabel[] = [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' },
]
export const funcParsed: RecStrFuncUnknown = {
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')
},
}
export const funcComponent: RecStrFuncComponent = {
action(rec, idx) {
const res: RecComponent = {
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 '-'
},
}
+19
View File
@@ -0,0 +1,19 @@
<script setup lang="ts">
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg'
defineProps<{
data: any[]
}>()
</script>
<template>
<PubBaseDataTable
:rows="data"
:cols="cols"
:header="header"
:keys="keys"
:func-parsed="funcParsed"
:func-html="funcHtml"
:func-component="funcComponent"
/>
</template>
@@ -0,0 +1,29 @@
<script setup lang="ts">
import { Badge } from '~/components/pub/ui/badge'
const props = defineProps<{
rec: any
idx?: number
}>()
const doctorStatus = {
0: 'Tidak Aktif',
1: 'Aktif',
}
const statusText = computed(() => {
return doctorStatus[props.rec.status_code as keyof typeof doctorStatus]
})
const badgeVariant = computed(() => {
return props.rec.status_code === 1 ? 'default' : 'destructive'
})
</script>
<template>
<div class="flex justify-center">
<Badge :variant="badgeVariant">
{{ statusText }}
</Badge>
</div>
</template>
+4 -20
View File
@@ -11,10 +11,6 @@ const data = computed({
get: () => props.modelValue,
set: (val) => emit('update:modelValue', val),
})
const items = [
{ value: 'doctor', label: 'Dokter' },
{ value: 'nurse', label: 'Perawat' },
]
</script>
<template>
@@ -22,30 +18,18 @@ const items = [
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<div class="flex flex-col justify-between">
<Block>
<FieldGroup :column="2">
<Label>Username</Label>
<FieldGroup :column="2" layout="stacked">
<Label stacked>Username</Label>
<Field>
<Input v-model="data.name" />
</Field>
</FieldGroup>
<FieldGroup :column="2">
<Label>Password</Label>
<FieldGroup :column="2" layout="stacked">
<Label stacked>Password</Label>
<Field>
<Input v-model="data.password" type="password" />
</Field>
</FieldGroup>
<FieldGroup :column="2">
<Label>Status</Label>
<Field>
<Input v-model="data.status" />
</Field>
</FieldGroup>
<FieldGroup :column="2">
<Label>Tipe</Label>
<Field>
<Select v-model="data.type" :items="items" placeholder="Pilih jenis" />
</Field>
</FieldGroup>
</Block>
</div>
</div>
+4 -6
View File
@@ -30,7 +30,7 @@ const headerPrep: HeaderPrep = {
icon: 'i-lucide-users',
addNav: {
label: 'Tambah',
onClick: () => navigateTo('/human-src/user/add'),
onClick: () => navigateTo('/human-src/employee/add'),
},
}
@@ -56,10 +56,8 @@ provide('table_data_loader', isLoading)
</script>
<template>
<div class="rounded-md border p-4">
<Header :prep="{ ...headerPrep }" :ref-search-nav="refSearchNav" />
<div class="rounded-md border p-4">
<AppDoctorList v-if="!isLoading.dataListLoading" :data="data" />
</div>
<Header :prep="{ ...headerPrep }" :ref-search-nav="refSearchNav" />
<div class="my-4 flex flex-1 flex-col gap-4 md:gap-8">
<AppDoctorList v-if="!isLoading.dataListLoading" :data="data" />
</div>
</template>
+51
View File
@@ -0,0 +1,51 @@
<script setup lang="ts">
import Action from '~/components/pub/custom-ui/nav-footer/ba-dr-su.vue'
const data = ref({
name: '',
password: '',
status: '',
type: 'doctor',
})
function onClick(type: string) {
if (type === 'cancel') {
navigateTo('/human-src/employee')
} else if (type === 'draft') {
// do something
} else if (type === 'submit') {
// do something
}
}
const items = [
{ value: 'doctor', label: 'Dokter' },
{ value: 'nurse', label: 'Perawat' },
{ value: 'nutritionist', label: 'Ahli Gizi' },
{ value: 'laborant', label: 'Laboran' },
{ value: 'pharmacy', label: 'Farmasi' },
{ value: 'payment', label: 'Pembayaran' },
{ value: 'payment-verificator', label: 'Konfirmasi Pembayaran' },
{ value: 'management', label: 'Management' },
]
</script>
<template>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<Icon name="i-lucide-user" class="me-2" />
<span class="font-semibold">Tambah</span> Karyawan
</div>
<AppEmployeeEntryForm v-model="data" :items="items" />
<AppDoctorEntryForm v-if="data.type === 'doctor'" v-model="data" />
<AppNurseEntryForm v-else-if="data.type === 'nurse'" v-model="data" />
<AppPharmacistEntryForm v-else-if="data.type === 'pharmacist'" v-model="data" />
<AppLaborantEntryForm v-else-if="data.type === 'laborant'" v-model="data" />
<AppNutritionistEntryForm v-else-if="data.type === 'nutritionist'" v-model="data" />
<AppUserEntryForm v-model="data" />
<div class="my-2 flex justify-end py-2">
<Action @click="onClick" />
</div>
</template>
+63
View File
@@ -0,0 +1,63 @@
<script setup lang="ts">
import type { DataTableLoader } from '~/components/pub/base/data-table/type'
import type { HeaderPrep, RefSearchNav } from '~/components/pub/custom-ui/data/types'
import Header from '~/components/pub/custom-ui/nav-header/prep.vue'
const data = ref([])
const refSearchNav: RefSearchNav = {
onClick: () => {
// open filter modal
},
onInput: (_val: string) => {
// filter patient list
},
onClear: () => {
// clear url param
},
}
const isLoading = reactive<DataTableLoader>({
isTableLoading: false,
})
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
const headerPrep: HeaderPrep = {
title: 'User',
icon: 'i-lucide-users',
addNav: {
label: 'Tambah',
onClick: () => navigateTo('/human-src/employee/add'),
},
}
async function getDoctorList() {
isLoading.dataListLoading = true
const resp = await xfetch('/api/v1/doctor')
if (resp.success) {
data.value = (resp.body as Record<string, any>).data
}
isLoading.dataListLoading = false
}
onMounted(() => {
getDoctorList()
})
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('table_data_loader', isLoading)
</script>
<template>
<Header :prep="{ ...headerPrep }" :ref-search-nav="refSearchNav" />
<div class="my-4 flex flex-1 flex-col gap-4 md:gap-8">
<AppDoctorList v-if="!isLoading.dataListLoading" :data="data" />
</div>
</template>
@@ -31,7 +31,7 @@ function handleActionCellClick(event: Event, _cellRef: string) {
const cell = event.currentTarget as HTMLElement
const triggerButton = cell.querySelector('button[data-state]') || cell.querySelector('button')
if (triggerButton) {
(triggerButton as HTMLButtonElement).click()
;(triggerButton as HTMLButtonElement).click()
}
}
</script>
@@ -41,9 +41,11 @@ function handleActionCellClick(event: Event, _cellRef: string) {
<TableHeader class="bg-gray-50">
<TableRow>
<TableHead
v-for="(h, idx) in header[0]" :key="`head-${idx}`" class="border"
v-for="(h, idx) in header[0]"
:key="`head-${idx}`"
class="border"
:style="{ width: cols[idx]?.width ? `${cols[idx].width}px` : undefined }"
>
>
{{ h.label }}
</TableHead>
</TableRow>
@@ -53,13 +55,13 @@ v-for="(h, idx) in header[0]" :key="`head-${idx}`" class="border"
<!-- Loading state with 5 skeleton rows -->
<TableRow v-for="n in getSkeletonSize" :key="`skeleton-${n}`">
<TableCell v-for="(key, cellIndex) in keys" :key="`cell-skel-${n}-${cellIndex}`" class="border">
<Skeleton class="bg-gray-100 animate-pulse text-muted-foreground w-full h-6" />
<Skeleton class="h-6 w-full animate-pulse bg-gray-100 text-muted-foreground" />
</TableCell>
</TableRow>
</TableBody>
<TableBody v-else-if="rows.length === 0">
<TableRow>
<TableCell :colspan="keys.length" class="text-center py-8">
<TableCell :colspan="keys.length" class="py-8 text-center">
<div class="flex items-center justify-center">
<Info class="size-5 text-muted-foreground" />
<span class="ml-2">Tidak ada data tersedia</span>
@@ -74,7 +76,11 @@ v-for="(h, idx) in header[0]" :key="`head-${idx}`" class="border"
:key="`cell-${rowIndex}-${cellIndex}`"
class="border"
:class="{ 'cursor-pointer': key === 'action' && funcComponent[key] }"
@click="key === 'action' && funcComponent[key] ? handleActionCellClick($event, `cell-${rowIndex}-${cellIndex}`) : null"
@click="
key === 'action' && funcComponent[key]
? handleActionCellClick($event, `cell-${rowIndex}-${cellIndex}`)
: null
"
>
<!-- If funcComponent has a renderer -->
<component
@@ -5,6 +5,7 @@ const props = withDefaults(
density?: 'default' | 'dense'
side?: 'default' | 'break'
position?: 'default' | 'dynamic'
layout?: 'default' | 'stacked'
class?: string
}>(),
{
@@ -12,25 +13,25 @@ const props = withDefaults(
density: 'default',
side: 'default',
position: 'default',
layout: 'default',
class: '',
},
)
const wrapperClass = computed(() => [
'w-full flex-shrink-0',
const widthClass = computed(() => {
if (props.column === 1) return 'md:w-full pe-4'
if (props.column === 2) return 'md:w-1/2 pe-4'
if (props.column === 3) return 'md:w-1/3 pe-4'
return 'w-full'
})
props.column === 1 && props.side !== 'break' ? 'pe-4 md:w-1/1 ' : '',
props.column === 2 && props.side !== 'break' ? 'pe-4 md:w-1/2 my-3' : '',
props.column === 3 && props.side !== 'break' ? 'pe-4 md:w-1/3' : '',
props.column === 2 && props.side === 'break' ? 'md:w-1/2' : '',
props.column === 3 && props.side === 'break' ? 'md:w-1/3' : '',
const wrapperClass = computed(() => [
'w-full flex-shrink-0 mb-3',
widthClass.value,
props.layout === 'stacked' ? 'flex flex-col p-2' : 'md:flex',
props.density !== 'dense' ? 'mb-2 md:mb-2.5 xl:mb-3' : '',
props.side !== 'break' ? 'md:flex' : '',
props.position === 'dynamic' ? 'ps-4' : props.column > 1 ? 'pe-4' : '',
props.class,
])
</script>
@@ -40,5 +41,3 @@ const wrapperClass = computed(() => [
<slot />
</div>
</template>
<style scoped></style>
+6 -4
View File
@@ -5,11 +5,13 @@ const props = withDefaults(
size?: 'default' | 'narrow' | 'wide'
height?: 'default' | 'compact'
position?: 'default' | 'dynamic'
stacked?: boolean
}>(),
{
size: 'default',
height: 'default',
position: 'default',
stacked: false,
},
)
@@ -36,12 +38,12 @@ const positionChildMap = {
const wrapperClass = computed(() => [
'block shrink-0',
sizeMap[props.size],
heightMap[props.height],
positionWrapMap[props.position],
props.stacked ? 'w-full mb-1 text-start' : sizeMap[props.size],
props.stacked ? '' : heightMap[props.height],
props.stacked ? '' : positionWrapMap[props.position],
])
const labelClass = computed(() => positionChildMap[props.position])
const labelClass = computed(() => [props.stacked ? 'block mb-1 text-sm font-medium' : positionChildMap[props.position]])
</script>
<template>
+1 -1
View File
@@ -72,7 +72,7 @@ export const dischargeMethodCodes: Record<string, string> = {
}
export const genderCodes: Record<string, string> = {
male: 'Laki - Laki',
male: 'Laki',
female: 'Perempuan',
'not-stated': 'Tidak Disebutkan',
unknown: 'Tidak Diketahui',
+19
View File
@@ -2,6 +2,25 @@ import type { ClassValue } from 'clsx'
import { clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
export interface SelectOptionType<T> {
label: string
value: T
}
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export function mapToFlowbiteOptList(items: Record<string, string>): SelectOptionType<string>[] {
if (!items) {
return []
}
const result: SelectOptionType<string>[] = []
Object.keys(items).forEach((item) => {
result.push({
label: items[item] as string,
value: item,
})
})
return result
}
+61
View File
@@ -0,0 +1,61 @@
export interface Doctor {
id: number
createdAt: string
updatedAt: string
name: string
frontTitle?: string
endTitle?: string
specialist_code?: string
sip_no: string
ihs_number: string
identity_number: string
phone?: string
bpjs_code?: string
status_code?: number
}
// use one dto for both create and update
export interface CreateDto {
name?: string
frontTitle?: string
endTitle?: string
identity_number?: string
sip_no?: string
ihs_number?: string
phone?: string
email?: string
bpjs_code?: string
status_code?: number
outPatient_rate?: number
inPatient_rate?: number
}
export interface GetListDto {
name?: string
identity_number?: string
sip_no?: string
ihs_number?: string
}
export interface GetDetailDto {
id?: string
}
export interface UpdateDto extends CreateDto {
id?: number
}
export interface DeleteDto {
id?: string
}
export function genDoctor(): Doctor {
return {
id: 0,
createdAt: '',
updatedAt: '',
name: '',
ihs_number: '',
identity_number: '',
sip_no: '',
}
}
+37
View File
@@ -0,0 +1,37 @@
export interface Employee {
name: string
number: string
status_code: string
user_id: number
person_id: number
position_code: string
division_code: string
}
export interface CreateDto extends Employee {}
export interface UpdateDto extends Employee {
id: number
}
export interface DeleteDto {
id: number
}
export interface GetListDto extends Employee {
id: number
createdAt: string
updatedAt: string
}
export function genEmployee(): Employee {
return {
name: '',
number: '',
status_code: '',
user_id: 0,
person_id: 0,
position_code: '',
division_code: '',
}
}
+19
View File
@@ -0,0 +1,19 @@
export interface User {
id: number
name: string
password: string
status_code: string
createdAt: string
updatedAt: string
}
export function genUser(): User {
return {
id: 0,
name: '',
password: '',
status_code: '',
createdAt: '',
updatedAt: '',
}
}
@@ -1,9 +0,0 @@
<script setup lang="ts">
definePageMeta({
roles: ['sys', 'doc'],
})
</script>
<template>
<div>detail pasien</div>
</template>
@@ -1,9 +0,0 @@
<script setup lang="ts">
definePageMeta({
roles: ['sys', 'doc'],
})
</script>
<template>
<div>edit detail pasien</div>
</template>