Squashed commit of the following:

commit 72ce2260c50597f782f07d29db3985607ecc2f34
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Mon Nov 17 15:19:36 2025 +0700

    Feat: add doc preview in Therpay protocol List

commit 7032cd2409a660d40899ffd421137e4158cfde4a
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Wed Nov 12 15:34:30 2025 +0700

    Fix: prepare API integration protokol terapi verification

commit dbf6f78d00afc818baf2b34d128ee2153814cc88
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Wed Nov 12 14:09:28 2025 +0700

    Feat: add basic CRUD therapy protocol

commit 46a44e90fe4d4097b5460d2d4e5689b2a5389467
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Tue Nov 11 15:57:54 2025 +0700

    Fix: Prepare protokol terapi API Integration

commit 4674090566727cebd947e50e2c06c44e8c7afa7e
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Mon Nov 10 15:33:22 2025 +0700

    Fix: hotfix style add protokol terapi

commit 919c91abd8ef8b4cd193012eed7f5e8cf635cda2
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Mon Nov 10 15:17:14 2025 +0700

    Fix: Typo drpodown-action-p in protokol-terapi

commit e21d30eacf1a08118e289d4bb64889e708d5023a
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Mon Nov 10 15:14:33 2025 +0700

    Fix: add diagnose & procedure dialog picker in add protokol terapi

commit 9a3d73b72b0dceea778d83e7630c5ead110a6a4c
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Tue Nov 4 10:21:24 2025 +0700

    Fix: Add Schema therapy protocol rehab medik

commit 4d8d2d633bbbd78038b1cc607558c1ceb31c5986
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Tue Nov 4 09:30:55 2025 +0700

    Fix: refactor Actions Btn ba-dr-su

commit 5f290a6e4bd1559c0e5864a508c5ab650cfae6e8
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Mon Nov 3 17:08:20 2025 +0700

    Feat: UI protokol terapi in Rehab medik

commit 63010f69ff30532bb8ac91443112f31d4942b221
Author: Khafid Prayoga <khafidp@pm.me>
Date:   Tue Oct 21 09:54:13 2025 +0700

    wip: list protokol terapi

commit 44eedc298680a5255fee0ee8feee3e24beda93dd
Author: Khafid Prayoga <khafidp@pm.me>
Date:   Mon Oct 20 12:54:01 2025 +0700

    feat(therapy-protocol): init form entry

    feat(therapy-protocol): init page routes

    wip: init entry form

    wip: form entry protokol terapi

    todo: table procedure, and diagnose  picker

    wip: schema form new entry

    todo: picker/modal yang relateds ke form entry
This commit is contained in:
hasyim_kai
2025-11-20 11:19:03 +07:00
parent baf6ab1fda
commit 399c3cbaee
67 changed files with 4747 additions and 24 deletions
+1
View File
@@ -0,0 +1 @@
<svg xmlns='http://www.w3.org/2000/svg' width='250' height='30' viewBox='0 0 1000 120'><rect fill='#000000' width='1000' height='120'/><g fill='none' stroke='#222' stroke-width='10' stroke-opacity='1'><path d='M-500 75c0 0 125-30 250-30S0 75 0 75s125 30 250 30s250-30 250-30s125-30 250-30s250 30 250 30s125 30 250 30s250-30 250-30'/><path d='M-500 45c0 0 125-30 250-30S0 45 0 45s125 30 250 30s250-30 250-30s125-30 250-30s250 30 250 30s125 30 250 30s250-30 250-30'/><path d='M-500 105c0 0 125-30 250-30S0 105 0 105s125 30 250 30s250-30 250-30s125-30 250-30s250 30 250 30s125 30 250 30s250-30 250-30'/><path d='M-500 15c0 0 125-30 250-30S0 15 0 15s125 30 250 30s250-30 250-30s125-30 250-30s250 30 250 30s125 30 250 30s250-30 250-30'/><path d='M-500-15c0 0 125-30 250-30S0-15 0-15s125 30 250 30s250-30 250-30s125-30 250-30s250 30 250 30s125 30 250 30s250-30 250-30'/><path d='M-500 135c0 0 125-30 250-30S0 135 0 135s125 30 250 30s250-30 250-30s125-30 250-30s250 30 250 30s125 30 250 30s250-30 250-30'/></g></svg>
+6 -3
View File
@@ -4,6 +4,7 @@ import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vu
// Types
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
import type { Config, } from '~/components/pub/my-ui/data-table'
// Configs
import { config } from './list-cfg'
@@ -11,9 +12,11 @@ import { config } from './list-cfg'
interface Props {
data: any[]
paginationMeta: PaginationMeta
tableConfig?: Config
}
defineProps<Props>()
const props = withDefaults(defineProps<Props>(), {
tableConfig: () => config,
})
const emit = defineEmits<{
pageChange: [page: number]
@@ -27,7 +30,7 @@ function handlePageChange(page: number) {
<template>
<div class="space-y-4">
<PubMyUiDataTable
v-bind="config"
v-bind="props.tableConfig"
:rows="data"
:skeleton-size="paginationMeta?.pageSize"
/>
+6 -3
View File
@@ -7,13 +7,16 @@ import type { PaginationMeta } from '~/components/pub/my-ui/pagination/paginatio
// Configs
import { config } from './list-cfg'
import type { Config } from '~/components/pub/my-ui/data-table'
interface Props {
data: any[]
paginationMeta: PaginationMeta
tableConfig?: Config
}
defineProps<Props>()
const props = withDefaults(defineProps<Props>(), {
tableConfig: () => config,
})
const emit = defineEmits<{
pageChange: [page: number]
@@ -27,7 +30,7 @@ function handlePageChange(page: number) {
<template>
<div class="space-y-4">
<PubMyUiDataTable
v-bind="config"
v-bind="props.tableConfig"
:rows="data"
:skeleton-size="paginationMeta?.pageSize"
/>
@@ -0,0 +1,19 @@
<script setup lang="ts">
import { cn } from '~/lib/utils';
const props = withDefaults(defineProps<{
therapyEndDate?: string
class?: string
}>(), {
therapyEndDate: new Date().toISOString(),
})
</script>
<template>
<div :class="cn('flex items-center gap-2 p-3 rounded-md text-orange-500 border border-orange-400 bg-orange-50',
props.class
)">
<Icon name="i-lucide-triangle-alert" class="h-4 w-4 align-middle transition-colors" />
<p class="font-medium">Pasien ini sedang menjalankan program terapi sampai {{ new Date(props.therapyEndDate).toDateString() }}</p>
</div>
</template>
@@ -0,0 +1,28 @@
<script setup lang="ts">
import { ActionEvents, type ListItemDto } from '~/components/pub/my-ui/data/types';
import Button from '~/components/pub/ui/button/Button.vue';
const props = defineProps<{
rec: ListItemDto
}>()
const recId = inject<Ref<number>>('rec_id')!
const recAction = inject<Ref<string>>('rec_action')!
const recItem = inject<Ref<any>>('rec_item')!
const recDate = inject<Ref<any>>('rec_date')!
function confirm() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showConfirmVerify
recItem.value = props.rec
recDate.value = new Date().getTime()
}
</script>
<template>
<Button type="button" variant="outline" class="text-orange-500 border border-orange-400 bg-orange-50"
@click="confirm">
<Icon name="i-lucide-circle-check" class="h-4 w-4 align-middle transition-colors" />
Konfirmasi
</Button>
</template>
@@ -0,0 +1,92 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import { Label as RadioLabel } from '~/components/pub/ui/label'
import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group'
import { cn } from '~/lib/utils'
import * as DE from '~/components/pub/my-ui/doc-entry'
const props = defineProps<{
fieldName?: string
label?: string
errors?: FormErrors
class?: string
radioGroupClass?: string
radioItemClass?: string
labelClass?: string
isRequired?: boolean
}>()
const {
fieldName = 'isNewBorn',
label = 'Status Pasien',
errors,
class: containerClass,
radioGroupClass,
radioItemClass,
labelClass,
} = props
const newbornOptions = [
{ label: 'Ya', value: 'YA' },
{ label: 'Tidak', value: 'TIDAK' },
]
</script>
<template>
<DE.Cell :class="cn('radio-group-field', containerClass)" :col-span="2">
<DE.Label
:label-for="fieldName"
:is-required="isRequired"
>
{{ label }}
</DE.Label>
<DE.Field
:id="fieldName"
:errors="errors"
>
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<RadioGroup
v-bind="componentField"
:class="cn('flex flex-row flex-wrap gap-4 sm:gap-6', radioGroupClass)"
>
<div
v-for="(option, index) in newbornOptions"
:key="option.value"
:class="cn('flex min-w-fit items-center space-x-2 pt-1', radioItemClass)"
>
<RadioGroupItem
:id="`${fieldName}-${index}`"
:value="option.value"
:class="
cn(
'relative h-4 w-4 rounded-full border-muted-foreground before:absolute before:inset-1 before:rounded-full before:bg-primary before:opacity-0 before:transition-opacity data-[state=checked]:border-primary data-[state=checked]:bg-white data-[state=checked]:before:opacity-100 sm:h-5 sm:w-5',
containerClass,
)
"
/>
<RadioLabel
:for="`${fieldName}-${index}`"
:class="
cn(
'cursor-pointer select-none text-xs font-normal leading-none transition-colors hover:text-primary peer-disabled:cursor-not-allowed peer-disabled:opacity-70 sm:text-sm',
labelClass,
)
"
>
{{ option.label }}
</RadioLabel>
</div>
</RadioGroup>
</FormControl>
<FormMessage class="ml-0 mt-1" />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,92 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import { Label as RadioLabel } from '~/components/pub/ui/label'
import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group'
import { cn } from '~/lib/utils'
import * as DE from '~/components/pub/my-ui/doc-entry'
const props = defineProps<{
fieldName?: string
label?: string
errors?: FormErrors
class?: string
radioGroupClass?: string
radioItemClass?: string
labelClass?: string
isRequired?: boolean
}>()
const {
fieldName = 'isNewBorn',
label = 'Status Pasien',
errors,
class: containerClass,
radioGroupClass,
radioItemClass,
labelClass,
} = props
const newbornOptions = [
{ label: 'Suami/Istri', value: 'partner' },
{ label: 'Anak', value: 'child' },
]
</script>
<template>
<DE.Cell :class="cn('radio-group-field', containerClass)" :col-span="2">
<DE.Label
:label-for="fieldName"
:is-required="isRequired"
>
{{ label }}
</DE.Label>
<DE.Field
:id="fieldName"
:errors="errors"
>
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<RadioGroup
v-bind="componentField"
:class="cn('flex flex-row flex-wrap gap-4 sm:gap-6', radioGroupClass)"
>
<div
v-for="(option, index) in newbornOptions"
:key="option.value"
:class="cn('flex min-w-fit items-center space-x-2 pt-1', radioItemClass)"
>
<RadioGroupItem
:id="`${fieldName}-${index}`"
:value="option.value"
:class="
cn(
'relative h-4 w-4 rounded-full border-muted-foreground before:absolute before:inset-1 before:rounded-full before:bg-primary before:opacity-0 before:transition-opacity data-[state=checked]:border-primary data-[state=checked]:bg-white data-[state=checked]:before:opacity-100 sm:h-5 sm:w-5',
containerClass,
)
"
/>
<RadioLabel
:for="`${fieldName}-${index}`"
:class="
cn(
'cursor-pointer select-none text-xs font-normal leading-none transition-colors hover:text-primary peer-disabled:cursor-not-allowed peer-disabled:opacity-70 sm:text-sm',
labelClass,
)
"
>
{{ option.label }}
</RadioLabel>
</div>
</RadioGroup>
</FormControl>
<FormMessage class="ml-0 mt-1" />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,72 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
import { cn, mapToComboboxOptList } from '~/lib/utils'
import { occupationCodes } from '~/lib/constants'
import * as DE from '~/components/pub/my-ui/doc-entry'
const props = defineProps<{
fieldName?: string
label?: string
placeholder?: string
errors?: FormErrors
class?: string
selectClass?: string
fieldGroupClass?: string
labelClass?: string
isRequired?: boolean
}>()
const {
fieldName = 'job',
label,
placeholder,
errors,
class: containerClass,
fieldGroupClass,
labelClass,
} = props
const arrangementTypeOpts = [
{ label: 'KRS', value: "krs" },
{ label: 'MRS', value: "mrs" },
{ label: 'Pindah IGD', value: "pindahIgd" },
{ label: 'Rujuk', value: "rujuk" },
{ label: 'Rujuk Balik', value: "rujukBalik" },
{ label: 'Meninggal', value: "meninggal" },
{ label: 'Lain Lain', value: "other" },
]
</script>
<template>
<DE.Cell :class="cn('select-field-group', fieldGroupClass, containerClass)">
<DE.Label
v-show="label"
:label-for="fieldName"
:class="cn('select-field-label', labelClass)"
:is-required="isRequired"
>
{{ label }}
</DE.Label>
<DE.Field
:id="fieldName"
:errors="errors"
:class="cn('select-field-wrapper')"
>
<FormField :name="fieldName" v-slot="{ componentField, value }">
<FormItem>
<FormControl>
<Select
v-bind="componentField"
:model-value="value"
:items="arrangementTypeOpts"
:defaultValue='arrangementTypeOpts[0]?.value'
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,52 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import { differenceInDays, differenceInMonths, differenceInYears, parseISO } from 'date-fns'
import { Input } from '~/components/pub/ui/input'
import { cn } from '~/lib/utils'
import * as DE from '~/components/pub/my-ui/doc-entry'
import { CalendarDate, DateFormatter, getLocalTimeZone, type DateValue } from '@internationalized/date'
const props = defineProps<{
dateValueStart?: DateValue | undefined
dateValueEnd?: DateValue | undefined
}>()
const {
dateValueStart = new CalendarDate(2022, 1, 20),
dateValueEnd = new CalendarDate(2022, 1, 20).add({ days: 20 }),
} = props
// Reactive variables for age calculation
const patientAge = ref<string>('Masukkan tanggal lahir')
const df = new DateFormatter('en-US', {
dateStyle: 'medium',
})
</script>
<template>
<Popover>
<PopoverTrigger as-child>
<Button variant="outline" :class="cn('w-[280px] justify-start text-left font-normal',
(!dateValueStart && !dateValueEnd) && 'text-muted-foreground')">
<CalendarIcon class="mr-2 h-4 w-4" />
<template v-if="dateValueStart">
<template v-if="dateValueEnd">
{{ df.format(dateValueStart.toDate(getLocalTimeZone())) }} -
{{ df.format(dateValueEnd.toDate(getLocalTimeZone())) }}
</template>
<template v-else>
{{ df.format(dateValueStart.toDate(getLocalTimeZone())) }}
</template>
</template>
<template v-else> Pick a date </template>
</Button>
</PopoverTrigger>
<PopoverContent class="w-auto p-0">
<RangeCalendar v-model="dateValue" initial-focus :number-of-months="2"
@update:start-value="(startDate) => (dateValueStart = startDate)" />
</PopoverContent>
</Popover>
</template>
@@ -0,0 +1,121 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import { differenceInDays, differenceInMonths, differenceInYears, parseISO } from 'date-fns'
import { Input } from '~/components/pub/ui/input'
import { cn } from '~/lib/utils'
import * as DE from '~/components/pub/my-ui/doc-entry'
const props = defineProps<{
fieldName?: string
label?: string
placeholder?: string
errors?: FormErrors
class?: string
selectClass?: string
fieldGroupClass?: string
labelClass?: string
isRequired?: boolean
isDisabled?: boolean
isWithTime?: boolean
}>()
const {
fieldName = 'birthDate',
label = 'Tanggal Lahir',
placeholder = 'Pilih tanggal lahir',
errors,
class: containerClass,
fieldGroupClass,
labelClass,
isWithTime = false,
} = props
// Reactive variables for age calculation
const patientAge = ref<string>('Masukkan tanggal lahir')
// Function to calculate age with years, months, and days
function calculateAge(birthDate: string | Date | undefined): string {
if (!birthDate) {
return 'Masukkan tanggal lahir'
}
try {
let dateObj: Date
if (typeof birthDate === 'string') {
dateObj = parseISO(birthDate)
} else {
dateObj = birthDate
}
const today = new Date()
// Calculate years, months, and days
const totalYears = differenceInYears(today, dateObj)
// Calculate remaining months after years
const yearsPassed = new Date(dateObj)
yearsPassed.setFullYear(yearsPassed.getFullYear() + totalYears)
const remainingMonths = differenceInMonths(today, yearsPassed)
// Calculate remaining days after years and months
const monthsPassed = new Date(yearsPassed)
monthsPassed.setMonth(monthsPassed.getMonth() + remainingMonths)
const remainingDays = differenceInDays(today, monthsPassed)
// Format the result
const parts = []
if (totalYears > 0) parts.push(`${totalYears} Tahun`)
if (remainingMonths > 0) parts.push(`${remainingMonths} Bulan`)
if (remainingDays > 0) parts.push(`${remainingDays} Hari`)
return parts.length > 0 ? parts.join(' ') : '0 Hari'
} catch {
return 'Masukkan tanggal lahir'
}
}
</script>
<template>
<DE.Cell :class="cn('select-field-group', fieldGroupClass, containerClass)">
<DE.Label
:label-for="fieldName"
:class="cn('select-field-label', labelClass)"
:is-required="isRequired && !isDisabled"
>
{{ label }}
</DE.Label>
<DE.Field
:id="fieldName"
:errors="errors"
:class="cn('select-field-wrapper')"
>
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<Input
id="birthDate"
:type="isWithTime ? 'datetime-local' : 'date'"
min="1900-01-01"
:max="new Date().toISOString().split('T')[0]"
v-bind="componentField"
:placeholder="placeholder"
:disabled="isDisabled"
@update:model-value="
(value: string | number) => {
const dateStr = typeof value === 'number' ? String(value) : value
patientAge = calculateAge(dateStr)
}
"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,71 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
import { cn, mapToComboboxOptList } from '~/lib/utils'
import { occupationCodes } from '~/lib/constants'
import * as DE from '~/components/pub/my-ui/doc-entry'
const props = defineProps<{
fieldName?: string
label?: string
placeholder?: string
errors?: FormErrors
class?: string
selectClass?: string
fieldGroupClass?: string
labelClass?: string
isRequired?: boolean
}>()
const {
fieldName = 'job',
label,
placeholder,
errors,
class: containerClass,
fieldGroupClass,
labelClass,
} = props
// Generate job options from constants, sama seperti pola genderCodes
const jobOptions = mapToComboboxOptList(occupationCodes)
</script>
<template>
<DE.Cell :class="cn('select-field-group', fieldGroupClass, containerClass)">
<DE.Label
v-show="label"
:label-for="fieldName"
:class="cn('select-field-label', labelClass)"
:is-required="isRequired"
>
{{ label }}
</DE.Label>
<DE.Field
:id="fieldName"
:errors="errors"
:class="cn('select-field-wrapper')"
>
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<Combobox
class="focus:ring-0 focus:ring-offset-0"
:id="fieldName"
v-bind="componentField"
:items="jobOptions"
:placeholder="placeholder"
search-placeholder="Cari..."
empty-message="Data tidak ditemukan"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,70 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
import { cn, mapToComboboxOptList } from '~/lib/utils'
import { occupationCodes } from '~/lib/constants'
import * as DE from '~/components/pub/my-ui/doc-entry'
const props = defineProps<{
fieldName?: string
label?: string
placeholder?: string
errors?: FormErrors
class?: string
selectClass?: string
fieldGroupClass?: string
labelClass?: string
isRequired?: boolean
}>()
const {
fieldName = 'job',
label = 'Pekerjaan',
placeholder = 'Pilih pekerjaan',
errors,
class: containerClass,
fieldGroupClass,
labelClass,
} = props
// Generate job options from constants, sama seperti pola genderCodes
const jobOptions = mapToComboboxOptList(occupationCodes)
</script>
<template>
<DE.Cell :class="cn('select-field-group', fieldGroupClass, containerClass)">
<DE.Label
:label-for="fieldName"
:class="cn('select-field-label', labelClass)"
:is-required="isRequired"
>
{{ label }}
</DE.Label>
<DE.Field
:id="fieldName"
:errors="errors"
:class="cn('select-field-wrapper')"
>
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<Combobox
class="focus:ring-0 focus:ring-offset-0"
:id="fieldName"
v-bind="componentField"
:items="jobOptions"
:placeholder="placeholder"
search-placeholder="Cari..."
empty-message="Data tidak ditemukan"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,70 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
import { cn, mapToComboboxOptList } from '~/lib/utils'
import { occupationCodes } from '~/lib/constants'
import * as DE from '~/components/pub/my-ui/doc-entry'
const props = defineProps<{
fieldName?: string
label?: string
placeholder?: string
errors?: FormErrors
class?: string
selectClass?: string
fieldGroupClass?: string
labelClass?: string
isRequired?: boolean
}>()
const {
fieldName = 'job',
label = 'Pekerjaan',
placeholder = 'Pilih pekerjaan',
errors,
class: containerClass,
fieldGroupClass,
labelClass,
} = props
// Generate job options from constants, sama seperti pola genderCodes
const jobOptions = mapToComboboxOptList(occupationCodes)
</script>
<template>
<DE.Cell :class="cn('select-field-group', fieldGroupClass, containerClass)">
<DE.Label
:label-for="fieldName"
:class="cn('select-field-label', labelClass)"
:is-required="isRequired"
>
{{ label }}
</DE.Label>
<DE.Field
:id="fieldName"
:errors="errors"
:class="cn('select-field-wrapper')"
>
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<Combobox
class="focus:ring-0 focus:ring-offset-0"
:id="fieldName"
v-bind="componentField"
:items="jobOptions"
:placeholder="placeholder"
search-placeholder="Cari..."
empty-message="Data tidak ditemukan"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,71 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
import { cn, mapToComboboxOptList } from '~/lib/utils'
import { occupationCodes } from '~/lib/constants'
import * as DE from '~/components/pub/my-ui/doc-entry'
const props = defineProps<{
fieldName?: string
label?: string
placeholder?: string
errors?: FormErrors
class?: string
selectClass?: string
fieldGroupClass?: string
labelClass?: string
isRequired?: boolean
}>()
const {
fieldName = 'job',
label,
placeholder,
errors,
class: containerClass,
fieldGroupClass,
labelClass,
} = props
// Generate job options from constants, sama seperti pola genderCodes
const jobOptions = mapToComboboxOptList(occupationCodes)
</script>
<template>
<DE.Cell :class="cn('select-field-group', fieldGroupClass, containerClass)">
<DE.Label
v-show="label"
:label-for="fieldName"
:class="cn('select-field-label', labelClass)"
:is-required="isRequired"
>
{{ label }}
</DE.Label>
<DE.Field
:id="fieldName"
:errors="errors"
:class="cn('select-field-wrapper')"
>
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<Combobox
class="focus:ring-0 focus:ring-offset-0"
:id="fieldName"
v-bind="componentField"
:items="jobOptions"
:placeholder="placeholder"
search-placeholder="Cari..."
empty-message="Data tidak ditemukan"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,175 @@
<script setup lang="ts">
import { ref, computed, watch, defineEmits, defineProps, onMounted, nextTick, defineExpose } from 'vue'
import Input from '~/components/pub/ui/input/Input.vue';
import Button from '~/components/pub/ui/button/Button.vue';
import waveyFingerprint from '~/assets/svg/wavey-fingerprint.svg'
/**
* TextCaptcha props:
* - length: number of characters in the core captcha
* - caseSensitive: whether validation is case sensitive
* - useSpacing: show spaced-out characters (visual obfuscation only)
* - noiseChars: include random noise characters visually (not required to type)
*/
const props = defineProps({
length: { type: Number, default: 6 },
caseSensitive: { type: Boolean, default: false },
useSpacing: { type: Boolean, default: true },
noiseChars: { type: Boolean, default: false }, // adds random noise characters to display
refreshCooldownMs: { type: Number, default: 500 }, // guard repeated refresh
})
const emit = defineEmits<{
(e: 'update:valid', valid: boolean): void
(e: 'validated', valid: boolean): void
(e: 'change', value: string): void
}>()
// Internal state
const raw = ref('') // the canonical captcha value (what user must match, ignoring visual noise)
const display = ref('') // randomized visual representation (may include spacing/noise)
const input = ref('') // user typed value
const lastRefresh = ref(0)
const valid = inject('isCaptchaValid') as Ref<boolean>
const errorMessage = ref('')
/** Characters excluding ambiguous ones: 0/O, 1/l/I etc. */
const CHARS = '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
function randomChar() {
return CHARS.charAt(Math.floor(Math.random() * CHARS.length))
}
/** Generate the canonical captcha string */
function genRaw(len = props.length) {
let s = ''
for (let i = 0; i < len; i++) s += randomChar()
return s
}
/** Create a visually obfuscated display string (spacing, noise, random case) */
function genDisplay(base: string) {
const arr: string[] = []
for (const ch of base) {
// toggle case randomly (only for letters)
const c = /[A-Za-z]/.test(ch) && Math.random() > 0.5 ? (Math.random() > 0.5 ? ch.toLowerCase() : ch.toUpperCase()) : ch
arr.push(c)
if (props.useSpacing && Math.random() > 0.3) arr.push(' ') // random space
}
return arr.join('')
}
/** Refresh captcha */
function refresh() {
const now = Date.now()
if (now - lastRefresh.value < props.refreshCooldownMs) return
lastRefresh.value = now
raw.value = genRaw(props.length)
display.value = genDisplay(raw.value)
input.value = ''
valid.value = false
errorMessage.value = ''
// emit change so parent knows new value (but we don't send the raw canonical in production)
emit('change', display.value)
}
/** Normalize input and canonical for comparison */
function normalizeForCompare(s: string) {
const normalized = s.replace(/\s+/g, '') // strip spaces
return props.caseSensitive ? normalized : normalized.toLowerCase()
}
/** Validate the current input */
function validate() {
const left = normalizeForCompare(input.value)
const right = normalizeForCompare(raw.value)
if (!input.value) {
valid.value = false
errorMessage.value = 'Please enter the captcha text.'
} else if (left === right) {
valid.value = true
errorMessage.value = ''
} else {
valid.value = false
errorMessage.value = 'Captcha does not match.'
}
emit('update:valid', valid.value)
emit('validated', valid.value)
return valid.value
}
// expose a refresh method to parent via ref
defineExpose({ refresh, validate, isValid: computed(() => valid.value) })
// generate on mount
onMounted(() => refresh())
// // re-validate whenever input changes (lightweight)
// watch(input, () => {
// // we don't auto-pass until the user explicitly validate (but we can optionally live-validate)
// // Here we perform live feedback but still emit validated only when called
// const left = normalizeForCompare(input.value)
// const right = normalizeForCompare(raw.value)
// valid.value = !!input.value && left === right
// // emit a live update so the parent can disable submit accordingly
// emit('update:valid', valid.value)
// })
</script>
<template>
<div class="space-y-2 w-full max-w-sm">
<div class="flex items-center justify-between gap-3">
<!-- Captcha visual box -->
<div
role="img"
aria-label="Text captcha, type the characters shown"
tabindex="0"
class="select-none p-3 rounded-md border border-gray-200 text-white text-xl font-mono tracking-wider text-center w-full"
>
<span class="inline-block" v-html="display"></span>
</div>
<!-- Refresh -->
<div class="flex-shrink-0">
<Button variant="ghost" type="button" @click="refresh" title="Refresh captcha">
<Icon name="i-lucide-refresh-cw" />
</Button>
</div>
</div>
<!-- Input -->
<div class="flex gap-3 items-start">
<div class="flex-grow">
<Input
v-model="input"
:aria-invalid="valid ? 'false' : 'true'"
inputmode="text"
placeholder="Type the captcha text"
@keyup.enter="validate"
/>
<p v-if="errorMessage" class="text-xs text-red-500 mt-1">{{ errorMessage }}</p>
<p v-else-if="valid" class="text-xs text-green-500 mt-1">Correct</p>
<p v-else class="text-xs text-gray-500 mt-1">Not case-sensitive</p>
</div>
<Button variant="outline" type="button" @click="validate" title="Validate"
class="border-orange-400">
<Icon name="i-lucide-check" class="text-orange-400" />
</Button>
</div>
</div>
</template>
<style scoped>
/* small nicety: make noise/spaced display look irregular */
div[role="img"] {
background: url('~/assets/svg/wavey-fingerprint.svg') repeat center;
}
div[role="img"] span {
letter-spacing: 0.12em;
font-weight: 600;
user-select: none;
}
</style>
@@ -0,0 +1,30 @@
<script setup lang="ts">
import { Badge } from '~/components/pub/ui/badge'
const activeStatusCodes: Record<string, string> = {
verified: 'Verifikasi',
unverified: 'Belum Verifikasi',
}
const props = defineProps<{
rec: any
idx?: number
}>()
const statusText = computed(() => {
const code: keyof typeof activeStatusCodes = props.rec.status_code === 1 ? `verified` : `unverified`
return activeStatusCodes[code]
})
const badgeVariant = computed(() => {
return props.rec.status_code === 1 ? 'default' : 'outline'
})
</script>
<template>
<div class="flex justify-center">
<Badge :variant="badgeVariant" class="rounded-2xl text-[0.6rem]" >
{{ statusText }}
</Badge>
</div>
</template>
@@ -0,0 +1,51 @@
import type { Config } from '~/components/pub/my-ui/data-table'
export const medicalDiagnosisConfig: Config = {
cols: [{width: 10}, {}, {},],
headers: [
[
{ label: 'No' },
{ label: 'Diagnosa' },
{ label: 'ICD-X' },
],
],
keys: ['number', 'diagnosis', 'icd_x'],
parses: { },
}
export const functionalDiagnosisConfig: Config = {
cols: [{width: 10}, {}, {},],
headers: [
[
{ label: 'No' },
{ label: 'Diagnosa' },
{ label: 'ICD-X' },
],
],
keys: ['number', 'diagnosis', 'icd_x'],
parses: { },
}
export const proceduralConfig: Config = {
cols: [{width: 10}, {}, {},],
headers: [
[
{ label: 'No' },
{ label: 'Prosedur' },
{ label: 'ICD-IX' },
],
],
keys: ['number', 'procedure', 'icd_x'],
parses: { },
}
@@ -0,0 +1,28 @@
import type { Config } from '~/components/pub/my-ui/data-table'
const action = defineAsyncComponent(() => import('./_common/btn-confirmation-detail.vue'))
export const detailTherapyProtocolListConfig: Config = {
cols: [{}, {}, {}, {width: 100},],
headers: [
[
{ label: 'Program Kegiatan' },
{ label: 'Paraf Terapis' },
{ label: 'Paraf Dokter' },
{ label: 'Action' },
],
],
keys: ['program', 'therapistSign', 'doctorSign', 'action'],
parses: { },
components: {
action(rec, idx) {
return {
idx,
rec: rec as object,
component: action,
}
},
},
}
@@ -0,0 +1,145 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import { toTypedSchema } from '@vee-validate/zod'
import { Form } from '~/components/pub/ui/form'
import { FieldArray } from 'vee-validate'
import SelectDate from './_common/select-date.vue'
import InputBase from '~/components/pub/my-ui/form/input-base.vue'
import * as DE from '~/components/pub/my-ui/doc-entry'
import TextAreaInput from '~/components/pub/my-ui/form/text-area-input.vue'
import SelectSecondaryDiagnosis from './_common/select-secondary-diagnosis.vue'
import SelectPrimaryDiagnosis from './_common/select-primary-diagnosis.vue'
import SelectArrangement from './_common/select-arrangement.vue'
import type { ResumeArrangementType } from '~/schemas/resume.schema'
import SelectFaskes from './_common/select-faskes.vue'
import SelectDeathCause from './_common/select-death-cause.vue'
import { cn } from '~/lib/utils'
import RadioRelationship from './_common/radio-relationship.vue'
import RadioIllnessBcsWork from './_common/radio-illness-bcs-work.vue'
import { functionalDiagnosisConfig, medicalDiagnosisConfig, proceduralConfig } from './add-list.cfg'
import DetailRow from '~/components/pub/my-ui/form/view/detail-row.vue'
import Badge from '~/components/pub/ui/badge/Badge.vue'
import { detailTherapyProtocolListConfig } from './detail-list.cfg'
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue'
const props = defineProps<{
}>()
const router = useRouter()
const formRef = ref()
const isConfirmationOpen = ref(false)
defineExpose({
validate: () => formRef.value?.validate(),
resetForm: () => formRef.value?.resetForm(),
setValues: (values: any, shouldValidate = true) => formRef.value?.setValues(values, shouldValidate),
values: computed(() => formRef.value?.values),
})
function goBack() {
router.go(-1)
}
async function handleConfirmAdd() {
// handleActionClick('submit')
console.log(`tersubmit wak`)
}
function handleCancelAdd() {
isConfirmationOpen.value = false
}
// #endregion region
// #region Utilities & event handlers
async function handleActionClick(eventType: string) {
if (eventType === 'submit') {
isConfirmationOpen.value = true
// const patient: Patient = await composeFormData()
// let createdPatientId = 0
// const response = await handleActionSave(
// patient,
// () => {},
// () => {},
// toast,
// )
// const data = (response?.body?.data ?? null) as PatientBase | null
// if (!data) return
// createdPatientId = data.id
// If has callback provided redirect to callback with patientData
// if (props.callbackUrl) {
// await navigateTo(props.callbackUrl + '?patient-id=' + patient.id)
// return
// }
// Navigate to patient list or show success message
// await navigateTo('/outpatient/encounter')
// return
}
if (eventType === 'back') {
goBack()
}
}
const dummymedicalDiagnosis = [
{ id: `asdfouno182y49128y3`, program: 'Latihan penguatan otot', icd_x: 'E11' },
{ id: `asdfouno182y49128g8`, program: 'Mobilisasi otot', icd_x: 'I10' },
]
</script>
<template>
<div class="flex items-center">
<Button type="button" variant="outline" class="ml-auto text-gray-500 border border-orange-400 bg-orange-50" @click="handleActionClick('back')">
<Icon name="i-lucide-arrow-left" class="h-4 w-4 align-middle transition-colors" />
Kembali
</Button>
</div>
<section class="">
<h1 class="mb-2 text-base font-medium">Form 1</h1>
<DetailRow label="Tanggal Pemeriksaan">{{ `aaaaaa` }}</DetailRow>
<DetailRow label="Diagnosa">{{ `aaaaaa` }}</DetailRow>
<DetailRow label="Permintaan Terapi">{{ `aaaaaa` }}</DetailRow>
<DetailRow label="Frekuensi Terapi">{{ `aaaaaa` }}</DetailRow>
<DetailRow label="Waktu Mencapai Target">{{ `aaaaaa bulan` }}</DetailRow>
</section>
<Separator class="my-5" />
<section class="">
<h1 class="mb-2 text-base font-medium">Form 2</h1>
<DetailRow label="Hubungan dengan Tertanggung">{{ `aaaaaa` }}</DetailRow>
<DetailRow label="Anamnesa">{{ `aaaaaa` }}</DetailRow>
<DetailRow label="Pemeriksaan Fisik dan Uji Fungsi">{{ `aaaaaa` }}</DetailRow>
<DetailRow label="Diagnosa Medis (ICD-X)" class="mb-1">
<Badge variant="outline" class="bg-gray-200">aaaaaa</Badge>
</DetailRow>
<DetailRow label="Diagnosa Fungsional (ICD-X)" class="mb-1">
<Badge variant="outline" class="bg-gray-200">aaaaaa</Badge>
</DetailRow>
<DetailRow label="Prosedur Tata Laksana (ICD-IX CM)" class="mb-1">
<Badge variant="outline" class="bg-gray-200">aaaaaa</Badge>
</DetailRow>
<DetailRow label="Pemeriksaan Penunjang">{{ `aaaaaa` }}</DetailRow>
<DetailRow label="Evaluasi">{{ `aaaaaa` }}</DetailRow>
<DetailRow label="Anjuran">{{ `aaaaaa` }}</DetailRow>
<DetailRow label="Suspek Penyakit Akibat Kerja">{{ `aaaaaa` }}</DetailRow>
</section>
<Separator class="my-5" />
<section class="">
<h1 class="mb-2 text-base font-medium">Form 3</h1>
<DetailRow label="Diagnosa">{{ `aaaaaa` }}</DetailRow>
<DetailRow label="Permintaan Terapi">{{ `aaaaaa` }}</DetailRow>
<div class="mt-3">
<PubMyUiDataTable
v-bind="detailTherapyProtocolListConfig"
:rows="dummymedicalDiagnosis" />
</div>
</section>
</template>
@@ -0,0 +1,217 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import { toTypedSchema } from '@vee-validate/zod'
import { Form } from '~/components/pub/ui/form'
import { FieldArray } from 'vee-validate'
import SelectDate from './_common/select-date.vue'
import InputBase from '~/components/pub/my-ui/form/input-base.vue'
import * as DE from '~/components/pub/my-ui/doc-entry'
import TextAreaInput from '~/components/pub/my-ui/form/text-area-input.vue'
import SelectSecondaryDiagnosis from './_common/select-secondary-diagnosis.vue'
import SelectPrimaryDiagnosis from './_common/select-primary-diagnosis.vue'
import SelectArrangement from './_common/select-arrangement.vue'
import type { ResumeArrangementType } from '~/schemas/resume.schema'
import SelectFaskes from './_common/select-faskes.vue'
import SelectDeathCause from './_common/select-death-cause.vue'
import { cn } from '~/lib/utils'
import RadioRelationship from './_common/radio-relationship.vue'
import RadioIllnessBcsWork from './_common/radio-illness-bcs-work.vue'
import { functionalDiagnosisConfig, medicalDiagnosisConfig, proceduralConfig } from './add-list.cfg'
const props = defineProps<{
schema: any
initialValues?: any
resumeArrangementType: ResumeArrangementType
errors?: FormErrors
}>()
const formSchema = toTypedSchema(props.schema)
const formRef = ref()
defineExpose({
validate: () => formRef.value?.validate(),
resetForm: () => formRef.value?.resetForm(),
setValues: (values: any, shouldValidate = true) => formRef.value?.setValues(values, shouldValidate),
values: computed(() => formRef.value?.values),
})
const dummymedicalDiagnosis = [
{ number: 1, diagnosis: 'Diabetes Mellitus', icd_x: 'E11' },
{ number: 2, diagnosis: 'Hipertensi', icd_x: 'I10' },
{ number: 3, diagnosis: 'Asma Bronkial', icd_x: 'J45' },
]
</script>
<template>
<Form ref="formRef" v-slot="{ values }" as="" keep-values :validation-schema="formSchema" :validate-on-mount="false"
validation-mode="onSubmit" :initial-values="initialValues ? initialValues : {}">
<h1 class="mb-1 text-base font-medium">Terapi ke 1</h1>
<!-- FORM 2 -->
<h1 class="mb-3 text-base">Form 1</h1>
<DE.Block :col-count="2" :cell-flex="false">
<SelectDate field-name="checkDate" label="Tanggal Pemeriksaan" :errors="errors"/>
<div></div>
<TextAreaInput
field-name="diagnosis"
label="Diagnosa"
placeholder="Diagnosa"
:errors="errors" />
<TextAreaInput
field-name="therapyRequest"
label="Permintaan Terapi"
placeholder="Permintaan Terapi"
:errors="errors" />
<DE.Block class="flex items-end h-fit" :col-count="3" :cell-flex="false">
<div>
<h1 class="mb-1 font-medium">Frekuensi Terapi</h1>
<div :class="cn('bg-gray-50 dark:bg-slate-950 ring-offset-background placeholder:text-muted-foreground flex justify-between items-center h-9 md:h-8 2xl:h-9 w-full rounded-md border border-gray-300 px-3 py-2 md:text-xs 2xl:text-sm file:border-0 file:bg-transparent md:file:!text-xs xl:file:!text-sm file:font-medium disabled:cursor-not-allowed disabled:opacity-50',)">
<p class="">{{ `2` }}</p>
<p class="text-muted-foreground">x / Minggu</p>
</div>
</div>
<div :class="cn('bg-gray-50 dark:bg-slate-950 ring-offset-background placeholder:text-muted-foreground flex justify-between items-center h-9 md:h-8 2xl:h-9 w-full rounded-md border border-gray-300 px-3 py-2 md:text-xs 2xl:text-sm file:border-0 file:bg-transparent md:file:!text-xs xl:file:!text-sm file:font-medium disabled:cursor-not-allowed disabled:opacity-50',)">
<p>
<span class="text-muted-foreground">Selama</span>
{{ `1` }}
<span class="text-muted-foreground">Bulan</span>
</p>
</div>
<InputBase
field-name="targetPeriodInMonths"
label="Waktu mencapai target (Bulan)"
placeholder="Masukkan angka"
:errors="errors"
numeric-only
/>
</DE.Block>
<TextAreaInput
field-name="therapyTarget"
label="Target Terapi"
placeholder="Target Terapi"
:errors="errors" />
</DE.Block>
<Separator class="my-4" />
<!-- FORM 2 -->
<h1 class="mb-3 text-base font-medium">Form 2</h1>
<DE.Block :col-count="2" :cell-flex="false">
<DE.Cell :col-span="2">
<RadioRelationship
field-name="relationshipToPatient"
label="Hubungan dengan tertanggung"
:errors="errors"
is-required
/>
</DE.Cell>
<TextAreaInput
field-name="anamnesa"
label="Anamnesa"
placeholder="Anamnesa"
:errors="errors" />
<TextAreaInput
field-name="physicalExamination"
label="Pemeriksaan Fisik & Uji Fungsi"
placeholder="Pemeriksaan Fisik & Uji Fungsi"
:errors="errors" />
<div class="">
<h1 class="mb-2 font-medium">Diagnosis Medis (ICD-X)</h1>
<PubMyUiDataTable
v-bind="medicalDiagnosisConfig"
:rows="dummymedicalDiagnosis"
:skeleton-size="dummymedicalDiagnosis.length"
/>
</div>
<div class="">
<h1 class="mb-2 font-medium">Diagnosis Fungsional (ICD-X)</h1>
<PubMyUiDataTable
v-bind="functionalDiagnosisConfig"
:rows="dummymedicalDiagnosis"
:skeleton-size="dummymedicalDiagnosis.length"
/>
</div>
<div class="">
<h1 class="mb-2 font-medium">Prosedur Tata Laksana (ICD-IX CM)</h1>
<PubMyUiDataTable
v-bind="proceduralConfig"
:rows="dummymedicalDiagnosis"
:skeleton-size="dummymedicalDiagnosis.length"
/>
</div>
<TextAreaInput
field-name="supportingExamination"
label="Pemeriksaan Penunjang"
placeholder="Pemeriksaan Penunjang"
:errors="errors" />
<TextAreaInput
field-name="evaluation"
label="Evaluasi"
placeholder="Evaluasi"
:errors="errors" />
<TextAreaInput
field-name="recommendation"
label="Anjuran"
placeholder="Anjuran"
:errors="errors" />
<DE.Cell :col-span="2">
<RadioIllnessBcsWork
field-name="illnessBcsWork"
label="Suspek penyakit akibat kerja"
:errors="errors"
is-required
/>
</DE.Cell>
</DE.Block>
<Separator class="my-4" />
<!-- FORM 3 -->
<h1 class="mb-3 text-base">Form 3</h1>
<DE.Block :col-count="2" :cell-flex="false">
<SelectDate field-name="checkDate" label="Tanggal Pemeriksaan" :errors="errors"/>
<div></div>
<TextAreaInput
field-name="form3-diagnosis"
label="Diagnosa"
placeholder="Diagnosa"
:errors="errors" />
<TextAreaInput
field-name="form3-therapyRequest"
label="Permintaan Terapi"
placeholder="Permintaan Terapi"
:errors="errors" />
<DE.Cell class="mt-2" :col-span="2">
<FieldArray v-slot="{ fields, push, remove }" name="form3-programActivity">
<div v-for="(field, idx) in fields" :key="idx" class="w-1/2 flex items-center gap-3 mb-3">
<TextAreaInput
class=""
:field-name="`form3-programActivity[${idx}]`"
:label="`Program/Kegiatan ${idx + 1}`"
:placeholder="`Masukkan Program/Kegiatan ${idx + 1}`"
:errors="errors" />
<Button type="button" variant="destructive" size="sm" @click="remove(idx)">
<Icon name="i-lucide-trash-2" class="h-4 w-4" />
</Button>
</div>
<Button type="button" variant="outline"
class="mt-3 w-full rounded-md border border-primary bg-white px-4 py-2 text-primary hover:border-primary hover:bg-primary hover:text-white sm:w-auto sm:text-sm"
@click="push(``)">
<Icon name="i-lucide-plus" class="mr-2 h-4 w-4 align-middle transition-colors" />
Tambah Program
</Button>
</FieldArray>
</DE.Cell>
</DE.Block>
</Form>
</template>
@@ -0,0 +1,137 @@
<script setup lang="ts">
import { toTypedSchema } from '@vee-validate/zod'
// components
import { Form } from '~/components/pub/ui/form'
import * as DE from '~/components/pub/my-ui/doc-entry'
import Separator from '~/components/pub/ui/separator/Separator.vue'
// form field components
import { BaseTextarea, RadioRelations, SelectExaminationDate, RadioWorkDisease } from './field'
// #region Props & Emits
interface Props {
schema: any
initialValues?: any
patientId: number
}
const props = defineProps<Props>()
const emit = defineEmits<{}>()
// #endregion
// #region State & Computed
// #endregion
// #region Lifecycle Hooks
// #endregion
// #region Functions
// #endregion region
// #region Utilities & event handlers
// #endregion
// #region Watchers
// #endregion
const formSchema = toTypedSchema(props.schema)
const formRef = ref()
defineExpose({
validate: () => formRef.value?.validate(),
resetForm: () => formRef.value?.resetForm(),
setValues: (values: any, shouldValidate = true) => formRef.value?.setValues(values, shouldValidate),
values: computed(() => formRef.value?.values),
})
</script>
<template>
<Form
ref="formRef"
v-slot="{ values }"
as=""
keep-values
:validation-schema="formSchema"
:validate-on-mount="false"
validation-mode="onSubmit"
:initial-values="initialValues ? initialValues : {}"
>
<p class="mb-2 text-sm font-semibold 2xl:mb-3 2xl:text-base">Anamnesa dan Riwayat Pasien</p>
<DE.Block
:col-count="3"
:cell-flex="false"
>
<SelectExaminationDate
field-name="examinationDate"
label="Tanggal Pemeriksaan"
/>
<RadioRelations
field-name="relationshipToInsured"
label="Hubungan Dengan Tertanggung"
:col-span="2"
/>
<BaseTextarea
field-name="anamnesis"
label="Anamnesa"
/>
<BaseTextarea
field-name="medicalHistory"
label="Riwayat Penyakit"
/>
<BaseTextarea
field-name="medicationHistory"
label="Riwayat Obat"
/>
</DE.Block>
<div class="h-6">
<Separator />
</div>
<p class="mb-2 text-sm font-semibold 2xl:mb-3 2xl:text-base">Pemeriksaan Penunjang</p>
<DE.Block
:col-count="2"
:cell-flex="false"
>
<BaseTextarea
field-name="supportDiagnosis"
label="Diagnosa (ICD-X)"
/>
<BaseTextarea
field-name="functionalDiagnosis"
label="Diagnosa Fungsional (ICD-X)"
/>
<BaseTextarea
field-name="treatmentDiagnosis"
label="Diagnosa Tata Laksana (ICD-IX)"
/>
<BaseTextarea
field-name="supportExamination"
label="Pemeriksaan Penunjang"
/>
</DE.Block>
<div class="h-6">
<Separator />
</div>
<p class="mb-2 text-sm font-semibold 2xl:mb-3 2xl:text-base">Anjuran dan Evaluasi</p>
<DE.Block
:col-count="3"
:cell-flex="false"
>
<BaseTextarea
field-name="recommendation"
label="Anjuran"
/>
<BaseTextarea
field-name="evaluation"
label="Evaluasi"
/>
<RadioWorkDisease
field-name="isWorkRelatedDisease"
label="Suspek Penyakit Akibat Kerja"
/>
</DE.Block>
</Form>
</template>
@@ -0,0 +1,204 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import { toTypedSchema } from '@vee-validate/zod'
import { Form } from '~/components/pub/ui/form'
import { FieldArray } from 'vee-validate'
import SelectDate from './_common/select-date.vue'
import InputBase from '~/components/pub/my-ui/form/input-base.vue'
import * as DE from '~/components/pub/my-ui/doc-entry'
import TextAreaInput from '~/components/pub/my-ui/form/text-area-input.vue'
import { cn } from '~/lib/utils'
import RadioRelationship from './_common/radio-relationship.vue'
import RadioIllnessBcsWork from './_common/radio-illness-bcs-work.vue'
import { functionalDiagnosisConfig, proceduralConfig } from './add-list.cfg'
import FunctionalDiagnosisPicker from './picker-dialog/functional-diagnosis/diagnosis-picker.vue'
import MedicalDiagnosisPicker from './picker-dialog/medical-diagnosis/diagnosis-picker.vue'
import ArrangementProcedurePicker from './picker-dialog/arrangement-procedure/procedure-picker.vue'
const props = defineProps<{
schema: any
initialValues?: any
errors?: FormErrors
}>()
const formSchema = toTypedSchema(props.schema)
const formRef = ref()
// const isMedicalDiagnosisPickerDialogOpen = ref<boolean>(false)
// const isFunctionalDiagnosisPickerDialogOpen = ref<boolean>(false)
// const isProcedurePickerDialogOpen = ref<boolean>(false)
// function toggleMedicalDiagnosisPickerDialog() {
// isMedicalDiagnosisPickerDialogOpen.value = !isMedicalDiagnosisPickerDialogOpen.value
// }
// function toggleFunctionalDiagnosisPickerDialog() {
// isFunctionalDiagnosisPickerDialogOpen.value = !isFunctionalDiagnosisPickerDialogOpen.value
// }
// provide(`isDiagnosisPickerDialogOpen`, isDiagnosisPickerDialogOpen)
// provide(`isProcedurePickerDialogOpen`, isProcedurePickerDialogOpen)
defineExpose({
validate: () => formRef.value?.validate(),
resetForm: () => formRef.value?.resetForm(),
setValues: (values: any, shouldValidate = true) => formRef.value?.setValues(values, shouldValidate),
values: computed(() => formRef.value?.values),
})
</script>
<template>
<Form ref="formRef" v-slot="{ values }" as="" keep-values :validation-schema="formSchema" :validate-on-mount="false"
validation-mode="onSubmit" :initial-values="initialValues ? initialValues : {}">
<h1 class="mb-1 text-base font-medium">Terapi ke 1</h1>
<!-- FORM 1 -->
<h1 class="mb-3 text-base">Form 1</h1>
<DE.Block :col-count="2" :cell-flex="false">
<SelectDate field-name="form1ExaminationDate" label="Tanggal Pemeriksaan" :errors="errors"/>
<div></div>
<TextAreaInput
field-name="form1Diagnose"
label="Diagnosa"
placeholder="Diagnosa"
:errors="errors" />
<TextAreaInput
field-name="form1TherapyRequest"
label="Permintaan Terapi"
placeholder="Permintaan Terapi"
:errors="errors" />
<DE.Block class="flex items-end h-fit" :col-count="3" :cell-flex="false">
<div>
<h1 class="mb-1 font-medium">Frekuensi Terapi</h1>
<div :class="cn('bg-gray-50 dark:bg-slate-950 ring-offset-background placeholder:text-muted-foreground flex justify-between items-center h-9 md:h-8 2xl:h-9 w-full rounded-md border border-gray-300 px-3 py-2 md:text-xs 2xl:text-sm file:border-0 file:bg-transparent md:file:!text-xs xl:file:!text-sm file:font-medium disabled:cursor-not-allowed disabled:opacity-50',)">
<p class="">{{ `2` }}</p>
<p class="text-muted-foreground">x / Minggu</p>
</div>
</div>
<div :class="cn('bg-gray-50 dark:bg-slate-950 ring-offset-background placeholder:text-muted-foreground flex justify-between items-center h-9 md:h-8 2xl:h-9 w-full rounded-md border border-gray-300 px-3 py-2 md:text-xs 2xl:text-sm file:border-0 file:bg-transparent md:file:!text-xs xl:file:!text-sm file:font-medium disabled:cursor-not-allowed disabled:opacity-50',)">
<p>
<span class="text-muted-foreground">Selama</span>
{{ `1` }}
<span class="text-muted-foreground">Bulan</span>
</p>
</div>
<InputBase
field-name="form1TargetPeriod"
label="Waktu mencapai target (Bulan)"
placeholder="Masukkan angka"
:errors="errors"
numeric-only
/>
</DE.Block>
<TextAreaInput
field-name="form1TherapyTarget"
label="Target Terapi"
placeholder="Target Terapi"
:errors="errors" />
</DE.Block>
<Separator class="my-4" />
<!-- FORM 2 -->
<h1 class="mb-3 text-base font-medium">Form 2</h1>
<DE.Block :col-count="2" :cell-flex="false">
<DE.Cell :col-span="2">
<RadioRelationship
field-name="form2RelationshipToInsured"
label="Hubungan dengan tertanggung"
:errors="errors"
is-required
/>
</DE.Cell>
<TextAreaInput
field-name="anamnesis"
label="Anamnesa"
placeholder="Anamnesa"
:errors="errors" />
<TextAreaInput
field-name="form2PhysicalExamination"
label="Pemeriksaan Fisik & Uji Fungsi"
placeholder="Pemeriksaan Fisik & Uji Fungsi"
:errors="errors" />
<MedicalDiagnosisPicker
field-name="medicalDiagnoses"
title="Diagnosis Medis (ICD-X)" />
<FunctionalDiagnosisPicker
field-name="functionDiagnoses"
title="Diagnosis Fungsional (ICD-X)" />
<ArrangementProcedurePicker
field-name="procedures"
title="Prosedur Tata Laksana (ICD-IX CM)" />
<TextAreaInput
field-name="supportingExams"
label="Pemeriksaan Penunjang"
placeholder="Pemeriksaan Penunjang"
:errors="errors" />
<TextAreaInput
field-name="evaluation"
label="Evaluasi"
placeholder="Evaluasi"
:errors="errors" />
<TextAreaInput
field-name="instruction"
label="Anjuran"
placeholder="Anjuran"
:errors="errors" />
<DE.Cell :col-span="2">
<RadioIllnessBcsWork
field-name="workCauseStatus"
label="Suspek penyakit akibat kerja"
:errors="errors"
is-required
/>
</DE.Cell>
</DE.Block>
<Separator class="my-4" />
<!-- FORM 3 -->
<h1 class="mb-3 text-base">Form 3</h1>
<DE.Block :col-count="2" :cell-flex="false">
<SelectDate field-name="form3ExaminationDate" label="Tanggal Pemeriksaan" :errors="errors"/>
<div></div>
<TextAreaInput
field-name="form3Diagnose"
label="Diagnosa"
placeholder="Diagnosa"
:errors="errors" />
<TextAreaInput
field-name="form3TherapyRequest"
label="Permintaan Terapi"
placeholder="Permintaan Terapi"
:errors="errors" />
<DE.Cell class="mt-2" :col-span="2">
<FieldArray v-slot="{ fields, push, remove }" name="form3ProgramActivities">
<div v-for="(field, idx) in fields" :key="idx" class="w-1/2 flex items-center gap-3 mb-3">
<TextAreaInput
class=""
:field-name="`form3ProgramActivities[${idx}]`"
:label="`Program/Kegiatan ${idx + 1}`"
:placeholder="`Masukkan Program/Kegiatan ${idx + 1}`"
:errors="errors" />
<Button v-if="idx !== 0" type="button" variant="destructive" size="sm" @click="remove(idx)">
<Icon name="i-lucide-trash-2" class="h-4 w-4" />
</Button>
</div>
<Button type="button" variant="outline"
class="mt-3 w-full rounded-md border border-primary bg-white px-4 py-2 text-primary hover:border-primary hover:bg-primary hover:text-white sm:w-auto sm:text-sm"
@click="push(``)">
<Icon name="i-lucide-plus" class="mr-2 h-4 w-4 align-middle transition-colors" />
Tambah Program
</Button>
</FieldArray>
</DE.Cell>
</DE.Block>
</Form>
</template>
@@ -0,0 +1,40 @@
<script setup lang="ts">
import { Label as RadioLabel } from '~/components/pub/ui/label'
import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group'
import { cn } from '~/lib/utils'
import * as DE from '~/components/pub/my-ui/doc-entry'
const props = defineProps<{
label: string
fieldName: string
placeholder?: string
colSpan?: number
}>()
const { label, fieldName, placeholder = 'Masukkan catatan' } = props
</script>
<template>
<DE.Cell :col-span="colSpan || 1">
<DE.Label :label-for="fieldName">
{{ label }}
</DE.Label>
<DE.Field :id="fieldName">
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<Textarea
v-bind="componentField"
:placeholder="placeholder"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,4 @@
export { default as RadioRelations } from './radio-relations.vue'
export { default as SelectExaminationDate } from './select-examination-date.vue'
export { default as BaseTextarea } from './base-textarea.vue'
export { default as RadioWorkDisease } from './radio-work-disease.vue'
@@ -0,0 +1,77 @@
<script setup lang="ts">
import { Label as RadioLabel } from '~/components/pub/ui/label'
import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group'
import { cn } from '~/lib/utils'
import * as DE from '~/components/pub/my-ui/doc-entry'
defineProps<{
label: string
fieldName: string
containerClass?: string
radioGroupClass?: string
radioItemClass?: string
labelClass?: string
colSpan?: number
}>()
const options = [
{ label: 'Suami/Istri', value: 'spouse' },
{ label: 'Anak', value: 'child' },
]
</script>
<template>
<DE.Cell
:class="cn('radio-group-field', containerClass)"
:col-span="colSpan || 2"
>
<DE.Label :label-for="fieldName">
{{ label }}
</DE.Label>
<DE.Field :id="fieldName">
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<RadioGroup
v-bind="componentField"
:class="cn('flex flex-row flex-wrap gap-4 sm:gap-6', radioGroupClass)"
>
<div
v-for="(option, index) in options"
:key="option.value"
:class="cn('flex min-w-fit items-center space-x-2 pt-1', radioItemClass)"
>
<RadioGroupItem
:id="`${fieldName}-${index}`"
:value="option.value"
:class="
cn(
'relative h-4 w-4 rounded-full border-muted-foreground before:absolute before:inset-1 before:rounded-full before:bg-primary before:opacity-0 before:transition-opacity data-[state=checked]:border-primary data-[state=checked]:bg-white data-[state=checked]:before:opacity-100 sm:h-5 sm:w-5',
containerClass,
)
"
/>
<RadioLabel
:for="`${fieldName}-${index}`"
:class="
cn(
'cursor-pointer select-none text-xs font-normal leading-none transition-colors hover:text-primary peer-disabled:cursor-not-allowed peer-disabled:opacity-70 sm:text-sm',
labelClass,
)
"
>
{{ option.label }}
</RadioLabel>
</div>
</RadioGroup>
</FormControl>
<FormMessage class="ml-0 mt-1" />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,77 @@
<script setup lang="ts">
import { Label as RadioLabel } from '~/components/pub/ui/label'
import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group'
import { cn } from '~/lib/utils'
import * as DE from '~/components/pub/my-ui/doc-entry'
defineProps<{
label: string
fieldName: string
containerClass?: string
radioGroupClass?: string
radioItemClass?: string
labelClass?: string
colSpan?: number
}>()
const options = [
{ label: 'Ya', value: 'YA' },
{ label: 'Tidak', value: 'TIDAK' },
]
</script>
<template>
<DE.Cell
:class="cn('radio-group-field', containerClass)"
:col-span="colSpan || 1"
>
<DE.Label :label-for="fieldName">
{{ label }}
</DE.Label>
<DE.Field :id="fieldName">
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<RadioGroup
v-bind="componentField"
:class="cn('flex flex-row flex-wrap gap-4 sm:gap-6', radioGroupClass)"
>
<div
v-for="(option, index) in options"
:key="option.value"
:class="cn('flex min-w-fit items-center space-x-2 pt-1', radioItemClass)"
>
<RadioGroupItem
:id="`${fieldName}-${index}`"
:value="option.value"
:class="
cn(
'relative h-4 w-4 rounded-full border-muted-foreground before:absolute before:inset-1 before:rounded-full before:bg-primary before:opacity-0 before:transition-opacity data-[state=checked]:border-primary data-[state=checked]:bg-white data-[state=checked]:before:opacity-100 sm:h-5 sm:w-5',
containerClass,
)
"
/>
<RadioLabel
:for="`${fieldName}-${index}`"
:class="
cn(
'cursor-pointer select-none text-xs font-normal leading-none transition-colors hover:text-primary peer-disabled:cursor-not-allowed peer-disabled:opacity-70 sm:text-sm',
labelClass,
)
"
>
{{ option.label }}
</RadioLabel>
</div>
</RadioGroup>
</FormControl>
<FormMessage class="ml-0 mt-1" />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,52 @@
<script setup lang="ts">
import { Input } from '~/components/pub/ui/input'
import { cn } from '~/lib/utils'
import * as DE from '~/components/pub/my-ui/doc-entry'
const props = defineProps<{
fieldName: string
label: string
placeholder?: string
class?: string
selectClass?: string
fieldGroupClass?: string
labelClass?: string
}>()
const { placeholder = 'Pilih tanggal pemeriksaan', class: containerClass, fieldGroupClass, labelClass } = props
</script>
<template>
<DE.Cell :class="cn('select-field-group', fieldGroupClass, containerClass)">
<DE.Label
:label-for="fieldName"
:class="cn('select-field-label', labelClass)"
>
{{ label }}
</DE.Label>
<DE.Field
:id="fieldName"
:class="cn('select-field-wrapper')"
>
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<Input
id="birthDate"
type="date"
min="1980-01-01"
:max="new Date().toISOString().split('T')[0]"
v-bind="componentField"
:placeholder="placeholder"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
@@ -0,0 +1,43 @@
<script setup lang="ts">
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
import { config } from './history-list.cfg'
import { CalendarDate, DateFormatter, getLocalTimeZone } from '@internationalized/date'
import type { DateRange } from 'radix-vue'
import { cn } from '~/lib/utils'
interface Props {
data: any[]
paginationMeta: PaginationMeta
}
defineProps<Props>()
const emit = defineEmits<{
pageChange: [page: number]
}>()
const df = new DateFormatter('en-US', {
dateStyle: 'medium',
})
const dateValue = ref({
start: new CalendarDate(2022, 1, 20),
end: new CalendarDate(2022, 1, 20).add({ days: 20 }),
}) as Ref<DateRange>
function handlePageChange(page: number) {
emit('pageChange', page)
}
</script>
<template>
<div class="space-y-4">
<PubMyUiDataTable
v-bind="config"
:rows="data"
:skeleton-size="paginationMeta?.pageSize"
/>
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
</div>
</template>
@@ -0,0 +1,45 @@
import type { Config } from '~/components/pub/my-ui/data-table'
import type { Patient } from '~/models/patient'
import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dp.vue'))
export const config: Config = {
cols: [{}, {}, {}, {}, {width: 140}, {width: 3},],
headers: [
[
{ label: 'Tgl Pemeriksaan' },
{ label: 'DPJP' },
{ label: 'Anamnesa' },
{ label: 'Permintaan Terapi' },
{ label: 'Program/Kegiatan' },
{ label: 'Action' },
],
],
keys: ['birth_date', 'person.name', 'person.name', 'person.name', 'birth_date', "action"],
parses: {
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
},
},
components: {
action(rec, idx) {
return {
idx,
rec: rec as object,
component: action,
}
},
},
}
@@ -0,0 +1,53 @@
import type { Config } from '~/components/pub/my-ui/data-table'
import type { Patient } from '~/models/patient'
import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-duvp.vue'))
const statusBadge = defineAsyncComponent(() => import('./_common/verify-badge.vue'))
export const config: Config = {
cols: [{}, {}, {}, {}, {width: 140}, {width: 3},],
headers: [
[
{ label: 'Tgl Pemeriksaan' },
{ label: 'Anamnesa' },
{ label: 'Permintaan Terapi' },
{ label: 'Program' },
{ label: 'Status' },
{ label: 'Action' },
],
],
keys: ['anamnesis', 'anamnesis', 'anamnesis', 'anamnesis', 'status', 'action'],
parses: {
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
},
},
components: {
action(rec, idx) {
return {
idx,
rec: rec as object,
component: action,
}
},
status(rec, idx) {
return {
idx,
rec: rec as object,
component: statusBadge,
}
},
},
}
@@ -0,0 +1,31 @@
<script setup lang="ts">
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
import { config } from './list.cfg'
interface Props {
data: any[]
paginationMeta: PaginationMeta
}
defineProps<Props>()
const emit = defineEmits<{
pageChange: [page: number]
}>()
function handlePageChange(page: number) {
emit('pageChange', page)
}
</script>
<template>
<div class="space-y-4">
<PubMyUiDataTable
v-bind="config"
:rows="data"
:skeleton-size="paginationMeta?.pageSize"
/>
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
</div>
</template>
@@ -0,0 +1,64 @@
<script setup lang="ts">
import { ActionEvents, type LinkItem, type ListItemDto } from '~/components/pub/my-ui/data/types';
const props = defineProps<{
rec: ListItemDto
}>()
const recId = inject<Ref<number>>('ap_rec_id')!
const recAction = inject<Ref<string>>('ap_rec_action')!
const recItem = inject<Ref<any>>('ap_rec_item')!
const activeKey = ref<string | null>(null)
const linkItems: LinkItem[] = [
{
label: 'Process',
onClick: () => {
process()
},
icon: 'i-lucide-arrow-right',
},
]
function process() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showProcess
recItem.value = props.rec
}
</script>
<template>
<div>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<SidebarMenuButton
size="lg"
class="data-[state=open]:text-sidebar-accent-foreground data-[state=open]:bg-white dark:data-[state=open]:bg-slate-800"
>
<Icon
name="i-lucide-chevrons-up-down"
class="ml-auto size-4"
/>
</SidebarMenuButton>
</DropdownMenuTrigger>
<DropdownMenuContent
class="w-[--radix-dropdown-menu-trigger-width] min-w-40 rounded-lg border border-slate-200 bg-white text-black dark:border-slate-700 dark:bg-slate-800 dark:text-white"
align="end"
>
<DropdownMenuGroup>
<DropdownMenuItem
v-for="item in linkItems"
:key="item.label"
class="hover:bg-gray-100 dark:hover:bg-slate-700"
@click="item.onClick"
@mouseenter="activeKey = item.label"
@mouseleave="activeKey = null"
>
<Icon :name="item.icon ?? ''" />
<span :class="activeKey === item.label ? 'text-sidebar-accent-foreground' : ''">{{ item.label }}</span>
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</div>
</template>
@@ -0,0 +1,33 @@
import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('./dropdown-action-p.vue'))
export const config: Config = {
cols: [{}, {}, {}, { width: 50 }],
headers: [[{ label: 'Kode' }, { label: 'Nama (FHIR)' }, { label: 'Nama (ID)' }, { label: '' }]],
keys: ['code', 'name', 'indName', 'action'],
delKeyNames: [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama (FHIR)' },
{ key: 'indName', label: 'Nama (ID)' },
],
parses: {},
components: {
action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
},
htmls: {},
}
@@ -0,0 +1,120 @@
<script setup lang="ts">
// Components
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
// Helpers
import { usePaginatedList } from '~/composables/usePaginatedList'
import { toast } from '~/components/pub/ui/toast'
import { config } from './procedure-list-cfg'
// Types
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
import { ProcedureSrcSchema, type ProcedureSrcFormData } from '~/schemas/procedure-src.schema'
// Handlers
import {
isReadonly,
isProcessing,
isFormEntryDialogOpen,
isRecordConfirmationOpen,
onResetState,
handleActionSave,
handleActionEdit,
handleActionRemove,
handleCancelForm,
} from '~/handlers/procedure-src.handler'
// Services
import { getList, getDetail } from '~/services/procedure-src.service'
const title = ref('')
interface Props {
processFn: (input: unknown) => void
}
const props = defineProps<Props>()
const {
data,
isLoading,
paginationMeta,
searchInput,
handlePageChange,
handleSearch,
fetchData: getItemList,
} = usePaginatedList({
fetchFn: async (params: any) => {
const result = await getList({
search: params.search,
sort: 'createdAt:desc',
'page-number': params['page-number'] || 0,
'page-size': params['page-size'] || 10,
})
return { success: result.success || false, body: result.body || {} }
},
entityName: 'procedure-src',
})
const headerPrep: HeaderPrep = {
title: 'MCU Prosedur',
icon: 'i-lucide-clipboard-list',
refSearchNav: {
placeholder: 'Cari (min. 3 karakter)...',
minLength: 3,
debounceMs: 500,
showValidationFeedback: true,
onInput: (val: string) => {
searchInput.value = val
},
onClick: () => {},
onClear: () => {},
},
}
const recId = ref<string>(``)
const recAction = ref<string>(``)
const recItem = ref<any>({})
provide('ap_rec_id', recId)
provide('ap_rec_action', recAction)
provide('ap_rec_item', recItem)
provide('table_data_loader', isLoading)
const isModalOpen = inject(`isProcedurePickerDialogOpen`) as Ref<boolean>
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showProcess:
props.processFn({
id: recId.value,
code: recItem.value.code,
name: recItem.value.name,
})
isModalOpen.value = false
break
}
})
onMounted(async () => {
await getItemList()
})
</script>
<template>
<Dialog v-model:open="isModalOpen" title="" size="xl">
<Header
v-model="searchInput"
:prep="headerPrep"
:ref-search-nav="headerPrep.refSearchNav"
@search="handleSearch"
class=""
/>
<AppProcedureSrcList
:table-config="config"
:data="data"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"
/>
</Dialog>
</template>
@@ -0,0 +1,62 @@
<script setup lang="ts">
import ProcedureListDialog from './procedure-list.vue'
import type { FormErrors } from '~/types/error'
import { toTypedSchema } from '@vee-validate/zod'
import { Form } from '~/components/pub/ui/form'
import { FieldArray } from 'vee-validate'
import InputBase from '~/components/pub/my-ui/form/input-base.vue'
import * as DE from '~/components/pub/my-ui/doc-entry'
import TextAreaInput from '~/components/pub/my-ui/form/text-area-input.vue'
import { cn } from '~/lib/utils'
import TableHeader from '~/components/pub/ui/table/TableHeader.vue'
import { is } from 'date-fns/locale'
interface Props {
fieldName: string
title: string
}
const props = defineProps<Props>()
const isProcedurePickerDialogOpen = ref<boolean>(false)
provide(`isProcedurePickerDialogOpen`, isProcedurePickerDialogOpen)
</script>
<template>
<div class="">
<div class="mb-2 flex items-center justify-between">
<h1 class="mb-2 font-medium">{{ title }}</h1>
<Button @click="isProcedurePickerDialogOpen = true" size="xs" variant="outline"
class="text-orange-400 border-orange-400 bg-transparent">
<Icon name="i-lucide-search" class="h-4 w-4 align-middle transition-colors" />
Pilih Diagnosis
</Button>
</div>
<FieldArray v-slot="{ fields, push, remove }" :name="props.fieldName">
<ProcedureListDialog :process-fn="push" />
<div class="border border-gray-200 rounded-lg overflow-hidden">
<Table>
<TableHeader class="bg-gray-100">
<TableRow>
<TableHead class="w-1/2">Prosedur</TableHead>
<TableHead class="w-1/2">ICD-X</TableHead>
<TableHead class="w-1/2">Action</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow v-for="(field, idx) in fields" :key="idx">
<TableCell class="">{{ field.value?.name }}</TableCell>
<TableCell class="">{{ field.value?.code }}</TableCell>
<TableCell class="">
<Button type="button" variant="destructive" size="sm" @click="remove(idx)">
<Icon name="i-lucide-trash-2" class="h-4 w-4" />
</Button>
</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
</FieldArray>
</div>
</template>
@@ -0,0 +1,33 @@
import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('./dropdown-action-p.vue'))
export const config: Config = {
cols: [{}, {}, {}, { width: 50 }],
headers: [[{ label: 'Kode' }, { label: 'Nama (FHIR)' }, { label: 'Nama (ID)' }, { label: '' }]],
keys: ['code', 'name', 'indName', 'action'],
delKeyNames: [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama (FHIR)' },
{ key: 'indName', label: 'Nama (ID)' },
],
parses: {},
components: {
action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
},
htmls: {},
}
@@ -0,0 +1,108 @@
<script setup lang="ts">
// Components
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
// Helpers
import { usePaginatedList } from '~/composables/usePaginatedList'
import { toast } from '~/components/pub/ui/toast'
import { config } from './diagnosis-list-cfg'
// Types
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
import { DiagnoseSrcSchema, type DiagnoseSrcFormData } from '~/schemas/diagnose-src.schema'
// Handlers
// Services
import { getList, getDetail } from '~/services/diagnose-src.service'
const title = ref('')
interface Props {
processFn: (input: unknown) => void
}
const props = defineProps<Props>()
const {
data,
isLoading,
paginationMeta,
searchInput,
handlePageChange,
handleSearch,
fetchData: getItemList,
} = usePaginatedList({
fetchFn: async (params: any) => {
const result = await getList({
search: params.search,
sort: 'createdAt:desc',
'page-number': params['page-number'] || 0,
'page-size': params['page-size'] || 10,
})
return { success: result.success || false, body: result.body || {} }
},
entityName: 'diagnose-src',
})
const headerPrep: HeaderPrep = {
title: 'Daftar Diagnosis',
icon: 'i-lucide-microscope',
refSearchNav: {
placeholder: 'Cari (min. 3 karakter)...',
minLength: 3,
debounceMs: 500,
showValidationFeedback: true,
onInput: (val: string) => {
searchInput.value = val
},
onClick: () => {},
onClear: () => {},
},
}
const recId = ref<string>(``)
const recAction = ref<string>(``)
const recItem = ref<any>({})
provide('fd_rec_id', recId)
provide('fd_rec_action', recAction)
provide('fd_rec_item', recItem)
provide('table_data_loader', isLoading)
const isModalOpen = inject(`isFunctionalPickerDialogOpen`) as Ref<boolean>
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showProcess:
props.processFn({
id: recId.value,
code: recItem.value.code,
name: recItem.value.name,
})
isModalOpen.value = false
break
}
})
onMounted(async () => {
await getItemList()
})
</script>
<template>
<Dialog v-model:open="isModalOpen" title="" size="xl">
<Header
v-model="searchInput"
:prep="headerPrep"
:ref-search-nav="headerPrep.refSearchNav"
@search="handleSearch"
class=""
/>
<AppDiagnoseSrcList
:data="data"
:pagination-meta="paginationMeta"
:table-config="config"
@page-change="handlePageChange"
/>
</Dialog>
</template>
@@ -0,0 +1,62 @@
<script setup lang="ts">
import DiagnosisListDialog from './diagnosis-list.vue'
import type { FormErrors } from '~/types/error'
import { toTypedSchema } from '@vee-validate/zod'
import { Form } from '~/components/pub/ui/form'
import { FieldArray } from 'vee-validate'
import InputBase from '~/components/pub/my-ui/form/input-base.vue'
import * as DE from '~/components/pub/my-ui/doc-entry'
import TextAreaInput from '~/components/pub/my-ui/form/text-area-input.vue'
import { cn } from '~/lib/utils'
import TableHeader from '~/components/pub/ui/table/TableHeader.vue'
import { is } from 'date-fns/locale'
interface Props {
fieldName: string
title: string
}
const props = defineProps<Props>()
const isFunctionalPickerDialogOpen = ref<boolean>(false)
provide(`isFunctionalPickerDialogOpen`, isFunctionalPickerDialogOpen)
</script>
<template>
<div class="">
<div class="mb-2 flex items-center justify-between">
<h1 class="mb-2 font-medium">{{ title }}</h1>
<Button @click="isFunctionalPickerDialogOpen = true" size="xs" variant="outline"
class="text-orange-400 border-orange-400 bg-transparent">
<Icon name="i-lucide-search" class="h-4 w-4 align-middle transition-colors" />
Pilih Diagnosis
</Button>
</div>
<FieldArray v-slot="{ fields, push, remove }" :name="fieldName">
<DiagnosisListDialog :process-fn="push" />
<div class="border border-gray-200 rounded-lg overflow-hidden">
<Table>
<TableHeader class="bg-gray-100">
<TableRow>
<TableHead class="w-1/2">Diagnosis</TableHead>
<TableHead class="w-1/2">ICD-X</TableHead>
<TableHead class="w-1/2">Action</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow v-for="(field, idx) in fields" :key="idx">
<TableCell class="">{{ field.value?.name }}</TableCell>
<TableCell class="">{{ field.value?.code }}</TableCell>
<TableCell class="">
<Button type="button" variant="destructive" size="sm" @click="remove(idx)">
<Icon name="i-lucide-trash-2" class="h-4 w-4" />
</Button>
</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
</FieldArray>
</div>
</template>
@@ -0,0 +1,64 @@
<script setup lang="ts">
import { ActionEvents, type LinkItem, type ListItemDto } from '~/components/pub/my-ui/data/types';
const props = defineProps<{
rec: ListItemDto
}>()
const recId = inject<Ref<number>>('fd_rec_id')!
const recAction = inject<Ref<string>>('fd_rec_action')!
const recItem = inject<Ref<any>>('fd_rec_item')!
const activeKey = ref<string | null>(null)
const linkItems: LinkItem[] = [
{
label: 'Process',
onClick: () => {
process()
},
icon: 'i-lucide-arrow-right',
},
]
function process() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showProcess
recItem.value = props.rec
}
</script>
<template>
<div>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<SidebarMenuButton
size="lg"
class="data-[state=open]:text-sidebar-accent-foreground data-[state=open]:bg-white dark:data-[state=open]:bg-slate-800"
>
<Icon
name="i-lucide-chevrons-up-down"
class="ml-auto size-4"
/>
</SidebarMenuButton>
</DropdownMenuTrigger>
<DropdownMenuContent
class="w-[--radix-dropdown-menu-trigger-width] min-w-40 rounded-lg border border-slate-200 bg-white text-black dark:border-slate-700 dark:bg-slate-800 dark:text-white"
align="end"
>
<DropdownMenuGroup>
<DropdownMenuItem
v-for="item in linkItems"
:key="item.label"
class="hover:bg-gray-100 dark:hover:bg-slate-700"
@click="item.onClick"
@mouseenter="activeKey = item.label"
@mouseleave="activeKey = null"
>
<Icon :name="item.icon ?? ''" />
<span :class="activeKey === item.label ? 'text-sidebar-accent-foreground' : ''">{{ item.label }}</span>
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</div>
</template>
@@ -0,0 +1,33 @@
import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
import { defineAsyncComponent } from 'vue'
const action = defineAsyncComponent(() => import('./dropdown-action-p.vue'))
export const config: Config = {
cols: [{}, {}, {}, { width: 50 }],
headers: [[{ label: 'Kode' }, { label: 'Nama (FHIR)' }, { label: 'Nama (ID)' }, { label: '' }]],
keys: ['code', 'name', 'indName', 'action'],
delKeyNames: [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama (FHIR)' },
{ key: 'indName', label: 'Nama (ID)' },
],
parses: {},
components: {
action(rec, idx) {
const res: RecComponent = {
idx,
rec: rec as object,
component: action,
}
return res
},
},
htmls: {},
}
@@ -0,0 +1,107 @@
<script setup lang="ts">
// Components
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
// Helpers
import { usePaginatedList } from '~/composables/usePaginatedList'
import { toast } from '~/components/pub/ui/toast'
import { config } from './diagnosis-list-cfg'
// Types
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
import { DiagnoseSrcSchema, type DiagnoseSrcFormData } from '~/schemas/diagnose-src.schema'
// Services
import { getList, getDetail } from '~/services/diagnose-src.service'
const title = ref('')
interface Props {
processFn: (input: unknown) => void
}
const props = defineProps<Props>()
const {
data,
isLoading,
paginationMeta,
searchInput,
handlePageChange,
handleSearch,
fetchData: getItemList,
} = usePaginatedList({
fetchFn: async (params: any) => {
const result = await getList({
search: params.search,
sort: 'createdAt:desc',
'page-number': params['page-number'] || 0,
'page-size': params['page-size'] || 10,
})
return { success: result.success || false, body: result.body || {} }
},
entityName: 'diagnose-src',
})
const headerPrep: HeaderPrep = {
title: 'Daftar Diagnosis',
icon: 'i-lucide-microscope',
refSearchNav: {
placeholder: 'Cari (min. 3 karakter)...',
minLength: 3,
debounceMs: 500,
showValidationFeedback: true,
onInput: (val: string) => {
searchInput.value = val
},
onClick: () => {},
onClear: () => {},
},
}
const recId = ref<string>(``)
const recAction = ref<string>(``)
const recItem = ref<any>({})
provide('md_rec_id', recId)
provide('md_rec_action', recAction)
provide('md_rec_item', recItem)
provide('table_data_loader', isLoading)
const isModalOpen = inject(`isMedicalDiagnosisPickerDialogOpen`) as Ref<boolean>
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showProcess:
props.processFn({
id: recId.value,
code: recItem.value.code,
name: recItem.value.name,
})
isModalOpen.value = false
break
}
})
onMounted(async () => {
await getItemList()
})
</script>
<template>
<Dialog v-model:open="isModalOpen" title="" size="xl">
<Header
v-model="searchInput"
:prep="headerPrep"
:ref-search-nav="headerPrep.refSearchNav"
@search="handleSearch"
class=""
/>
<AppDiagnoseSrcList
:data="data"
:pagination-meta="paginationMeta"
:table-config="config"
@page-change="handlePageChange"
/>
</Dialog>
</template>
@@ -0,0 +1,63 @@
<script setup lang="ts">
import DiagnosisListDialog from './diagnosis-list.vue'
import type { FormErrors } from '~/types/error'
import { toTypedSchema } from '@vee-validate/zod'
import { Form } from '~/components/pub/ui/form'
import { FieldArray } from 'vee-validate'
import InputBase from '~/components/pub/my-ui/form/input-base.vue'
import * as DE from '~/components/pub/my-ui/doc-entry'
import TextAreaInput from '~/components/pub/my-ui/form/text-area-input.vue'
import { cn } from '~/lib/utils'
import TableHeader from '~/components/pub/ui/table/TableHeader.vue'
import { is } from 'date-fns/locale'
interface Props {
fieldName: string
title: string
}
const props = defineProps<Props>()
const isMedicalDiagnosisPickerDialogOpen = ref<boolean>(false)
provide(`isMedicalDiagnosisPickerDialogOpen`, isMedicalDiagnosisPickerDialogOpen)
</script>
<template>
<div class="">
<div class="mb-2 flex items-center justify-between">
<h1 class="mb-2 font-medium">{{ title }}</h1>
<Button @click="isMedicalDiagnosisPickerDialogOpen = true" size="xs" variant="outline"
class="text-orange-400 border-orange-400 bg-transparent">
<Icon name="i-lucide-search" class="h-4 w-4 align-middle transition-colors" />
Pilih Diagnosis
</Button>
</div>
<FieldArray v-slot="{ fields, push, remove }" :name="fieldName">
<DiagnosisListDialog :process-fn="push" />
<div class="border border-gray-200 rounded-lg overflow-hidden">
<Table>
<TableHeader class="bg-gray-100">
<TableRow>
<TableHead class="w-1/2">Diagnosis</TableHead>
<TableHead class="w-1/2">ICD-X</TableHead>
<TableHead class="w-1/2">Action</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow v-for="(field, idx) in fields" :key="idx">
<TableCell class="">{{ field.value?.name }}</TableCell>
<TableCell class="">{{ field.value?.code }}</TableCell>
<TableCell class="">
<Button type="button" variant="destructive" size="sm" @click="remove(idx)">
<Icon name="i-lucide-trash-2" class="h-4 w-4" />
</Button>
</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
</FieldArray>
</div>
</template>
@@ -0,0 +1,64 @@
<script setup lang="ts">
import { ActionEvents, type LinkItem, type ListItemDto } from '~/components/pub/my-ui/data/types';
const props = defineProps<{
rec: ListItemDto
}>()
const recId = inject<Ref<number>>('md_rec_id')!
const recAction = inject<Ref<string>>('md_rec_action')!
const recItem = inject<Ref<any>>('md_rec_item')!
const activeKey = ref<string | null>(null)
const linkItems: LinkItem[] = [
{
label: 'Process',
onClick: () => {
process()
},
icon: 'i-lucide-arrow-right',
},
]
function process() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showProcess
recItem.value = props.rec
}
</script>
<template>
<div>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<SidebarMenuButton
size="lg"
class="data-[state=open]:text-sidebar-accent-foreground data-[state=open]:bg-white dark:data-[state=open]:bg-slate-800"
>
<Icon
name="i-lucide-chevrons-up-down"
class="ml-auto size-4"
/>
</SidebarMenuButton>
</DropdownMenuTrigger>
<DropdownMenuContent
class="w-[--radix-dropdown-menu-trigger-width] min-w-40 rounded-lg border border-slate-200 bg-white text-black dark:border-slate-700 dark:bg-slate-800 dark:text-white"
align="end"
>
<DropdownMenuGroup>
<DropdownMenuItem
v-for="item in linkItems"
:key="item.label"
class="hover:bg-gray-100 dark:hover:bg-slate-700"
@click="item.onClick"
@mouseenter="activeKey = item.label"
@mouseleave="activeKey = null"
>
<Icon :name="item.icon ?? ''" />
<span :class="activeKey === item.label ? 'text-sidebar-accent-foreground' : ''">{{ item.label }}</span>
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</div>
</template>
@@ -0,0 +1,108 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import { toTypedSchema } from '@vee-validate/zod'
import FieldGroup from '~/components/pub/my-ui/form/field-group.vue'
import Field from '~/components/pub/my-ui/form/field.vue'
import Label from '~/components/pub/my-ui/form/label.vue'
import Select from '~/components/pub/my-ui/form/select.vue'
import { Form } from '~/components/pub/ui/form'
import InputBase from '~/components/pub/my-ui/form/input-base.vue'
import type { InstallationFormData } from '~/schemas/installation.schema'
import TextCaptcha from './_common/text-captcha.vue'
const props = defineProps<{
schema: any
errors?: FormErrors
}>()
const emit = defineEmits<{
submit: [values: InstallationFormData, resetForm: () => void]
cancel: [resetForm: () => void]
}>()
const formSchema = toTypedSchema(props.schema)
const formRef = ref()
const captchaRef = ref<InstanceType<typeof TextCaptcha> | null>(null)
const captchaValid = ref(false)
// Form submission handler
function onSubmitForm(values: any, { resetForm }: { resetForm: () => void }) {
const formData: InstallationFormData = {
name: values.name || '',
code: values.code || '',
}
emit('submit', formData, resetForm)
}
function onCaptchaUpdate(valid: boolean) {
captchaValid.value = valid
}
// Form cancel handler
function onCancelForm({ resetForm }: { resetForm: () => void }) {
emit('cancel', resetForm)
}
defineExpose({
validate: () => formRef.value?.validate(),
resetForm: () => formRef.value?.resetForm(),
setValues: (values: any, shouldValidate = true) => formRef.value?.setValues(values, shouldValidate),
values: computed(() => formRef.value?.values),
})
</script>
<template>
<Form
ref="formRef"
v-slot="{ values }"
as=""
keep-values
:validation-schema="formSchema"
validation-mode="onSubmit"
>
<div class="border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<div class="flex flex-col justify-between">
<InputBase
field-name="name"
label="Nama"
placeholder="Masukkan Nama"
:errors="errors"/>
<InputBase
field-name="email"
label="Email"
placeholder="Masukkan Email"
:errors="errors"/>
<div class="mt-2">
<Label class="" for="password">Password</Label>
<Field class="" id="password" :errors="errors">
<FormField v-slot="{ componentField }" name="password">
<FormItem>
<FormControl>
<Input
id="password"
v-bind="componentField"
type="password"
class="w-full"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</Field>
</div>
<TextCaptcha
ref="captchaRef"
:length="5"
:useSpacing="true"
:noiseChars="true"
@update:valid="onCaptchaUpdate"
/>
</div>
</div>
</Form>
</template>
+3 -6
View File
@@ -14,6 +14,7 @@ import Status from '~/components/content/encounter/status.vue'
import AssesmentFunctionList from '~/components/content/soapi/entry.vue'
import EarlyMedicalAssesmentList from '~/components/content/soapi/entry.vue'
import EarlyMedicalRehabList from '~/components/content/soapi/entry.vue'
import TherapyProtocolList from '~/components/content/therapy-protocol/list.vue'
import Prescription from '~/components/content/prescription/main.vue'
import CpLabOrder from '~/components/content/cp-lab-order/main.vue'
import Radiology from '~/components/content/radiology-order/main.vue'
@@ -59,7 +60,7 @@ const tabs: TabItem[] = [
component: AssesmentFunctionList,
props: { encounter: data, type: 'function', label: 'Asesmen Fungsi' },
},
{ value: 'therapy-protocol', label: 'Protokol Terapi' },
{ value: 'therapy-protocol', label: 'Protokol Terapi', component: TherapyProtocolList, props: { encounter: data } },
{ value: 'education-assessment', label: 'Asesmen Kebutuhan Edukasi' },
{ value: 'consent', label: 'General Consent' },
{ value: 'patient-note', label: 'CPRJ' },
@@ -85,10 +86,6 @@ const tabs: TabItem[] = [
<PubMyUiNavContentBa label="Kembali ke Daftar Kunjungan" />
</div>
<AppEncounterQuickInfo :data="data" />
<CompTab
:data="tabs"
:initial-active-tab="activeTab"
@change-tab="activeTab = $event"
/>
<CompTab :data="tabs" :initial-active-tab="activeTab" @change-tab="activeTab = $event" />
</div>
</template>
@@ -0,0 +1,152 @@
<script setup lang="ts">
import { useRouter } from 'vue-router'
import type { ExposedForm } from '~/types/form'
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
import { toast } from '~/components/pub/ui/toast'
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue'
import { TherapyProtocolMedicRehabilitationSchema, TherapyProtocolSchema } from '~/schemas/therapy-protocol.schema'
import { handleActionSave } from '~/handlers/therapy-protocol.handler'
// #region Props & Emits
const props = defineProps<{
callbackUrl?: string
}>()
// form related state
const route = useRoute()
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
const inputForm = ref<ExposedForm<any> | null>(null)
// #endregion
// #region State & Computed
const router = useRouter()
const isConfirmationOpen = ref(false)
// #endregion
// #region Lifecycle Hooks
// #endregion
// #region Functions
function goBack() {
router.go(-1)
}
async function handleConfirmAdd() {
const inputData: any = await composeFormData()
const response = await handleActionSave(
inputData,
() => { },
() => { },
toast,
)
const data = (response?.body?.data ?? null)
if (!data) return
goBack()
}
async function composeFormData(): Promise<any> {
const [input,] = await Promise.all([
inputForm.value?.validate(),
])
const results = [input]
const allValid = results.every((r) => r?.valid)
// exit, if form errors happend during validation
if (!allValid) return Promise.reject('Form validation failed')
const formData = input?.values
formData.medicalDiagnoses = JSON.stringify(formData.medicalDiagnoses)
formData.functionDiagnoses = JSON.stringify(formData.functionDiagnoses)
formData.procedures = JSON.stringify(formData.procedures)
formData.encounter_id = encounterId
return new Promise((resolve) => resolve(formData))
}
// #endregion region
// #region Utilities & event handlers
async function handleActionClick(eventType: string) {
if (eventType === 'submit') {
isConfirmationOpen.value = true
}
if (eventType === 'back') {
if (props.callbackUrl) return navigateTo(props.callbackUrl)
goBack()
}
}
function handleCancelAdd() {
isConfirmationOpen.value = false
}
// #endregion
// #region Watchers
// #endregion
const initial = {
// Required String Fields
form1ExaminationDate: "2025-11-06",
form1Diagnose: 'Awwww',
form1TherapyRequest: 'Awwww',
form1TargetPeriod: 4,
form1TherapyTarget: 'Awwww',
form2RelationshipToInsured: 'child',
anamnesis: 'Bobo aja wak',
form2PhysicalExamination: 'Awwww',
medicalDiagnoses: [
{
id: 3,
code: "PROC002",
name: "Cesarean section"
}
],
functionDiagnoses: [
{
id: 3,
code: "PROC002",
name: "Cesarean section"
}
],
procedures: [
{
id: 5,
code: "PROC0100",
name: "Physical therapy session"
}
],
supportingExams: 'Awwww',
evaluation: 'Awwww',
instruction: 'Awwww',
workCauseStatus: 'TIDAK',
form3ExaminationDate: "2025-11-06",
form3Diagnose: 'Awwww',
form3TherapyRequest: 'Awwww',
form3ProgramActivities: ['Menonton Kakek Meninggoy',],
}
</script>
<template>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg font-semibold xl:text-xl">Tambah</div>
<AppTherapyProtocolEntry
ref="inputForm"
:schema="TherapyProtocolMedicRehabilitationSchema"
:resume-arrangement-type="inputForm?.values.arrangement"
:initial-values="initial"
/>
<div class="my-2 flex justify-end py-2">
<Action :enable-draft="false"
@click="handleActionClick"/>
</div>
<Confirmation
v-model:open="isConfirmationOpen"
title="Simpan Data"
message="Apakah Anda yakin ingin menyimpan data ini?"
confirm-text="Simpan"
@confirm="handleConfirmAdd"
@cancel="handleCancelAdd"
/>
</template>
@@ -0,0 +1,115 @@
<script setup lang="ts">
import type { ExposedForm } from '~/types/form';
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue'
import { ActionEvents } from '~/components/pub/my-ui/data/types'
// #region Props & Emits
const props = defineProps<{
callbackUrl?: string
}>()
// form related state
const personPatientForm = ref<ExposedForm<any> | null>(null)
// #endregion
// #region State & Computed
const router = useRouter()
const isConfirmationOpen = ref(false)
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
const recDate = ref<any>(null)
// #endregion
// #region Lifecycle Hooks
// #endregion
// #region Functions
function goBack() {
router.go(-1)
}
async function handleConfirmAdd() {
// handleActionClick('submit')
console.log(`tersubmit wak`)
}
function handleCancelAdd() {
isConfirmationOpen.value = false
}
// #endregion region
// #region Utilities & event handlers
async function handleActionClick(eventType: string) {
if (eventType === 'submit') {
isConfirmationOpen.value = true
// const patient: Patient = await composeFormData()
// let createdPatientId = 0
// const response = await handleActionSave(
// patient,
// () => {},
// () => {},
// toast,
// )
// const data = (response?.body?.data ?? null) as PatientBase | null
// if (!data) return
// createdPatientId = data.id
// If has callback provided redirect to callback with patientData
// if (props.callbackUrl) {
// await navigateTo(props.callbackUrl + '?patient-id=' + patient.id)
// return
// }
// Navigate to patient list or show success message
// await navigateTo('/outpatient/encounter')
// return
}
if (eventType === 'back') {
if (props.callbackUrl) {
await navigateTo(props.callbackUrl)
return
}
goBack()
// handleCancelForm()
}
}
// #endregion
// #region Provide
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('rec_date', recDate) // for divergence if we trigger same action on same Record Item multiple times
// #endregion
// #region Watchers
watch([recId, recAction, recDate], () => {
switch (recAction.value) {
case ActionEvents.showConfirmVerify:
handleActionClick('submit')
break
}
})
// #endregion
</script>
<template>
<AppTherapyProtocolDetail />
<Confirmation
v-model:open="isConfirmationOpen"
title="Konfirmasi"
message="Apakah Anda yakin ingin Konfirmasi data ini?"
confirm-text="Konfirmasi"
@confirm="handleConfirmAdd"
@cancel="handleCancelAdd"
/>
</template>
@@ -0,0 +1,123 @@
<script setup lang="ts">
import type { ExposedForm } from '~/types/form';
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue'
import { getDetail } from '~/services/therapy-protocol.service';
import { handleActionEdit } from '~/handlers/therapy-protocol.handler'
import { TherapyProtocolMedicRehabilitationSchema } from '~/schemas/therapy-protocol.schema';
// #region Props & Emits
const props = defineProps<{
callbackUrl?: string
}>()
// form related state
const inputForm = ref<ExposedForm<any> | null>(null)
// #endregion
// #region State & Computed
const router = useRouter()
const route = useRoute()
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
const therapyId = typeof route.params.therapy_protocol_id == 'string' ? parseInt(route.params.therapy_protocol_id) : 0
const isConfirmationOpen = ref(false)
// #endregion
// #region Lifecycle Hooks
onMounted(async () => {
const result = await getDetail(therapyId)
if (result.success) {
const currentValue = result.body?.data || {}
currentValue.medicalDiagnoses = await JSON.parse(currentValue.medicalDiagnoses)
currentValue.functionDiagnoses = await JSON.parse(currentValue.functionDiagnoses)
currentValue.procedures = await JSON.parse(currentValue.procedures)
console.log(currentValue)
inputForm.value?.setValues(currentValue)
}
})
// #endregion
// #region Functions
function goBack() {
router.go(-1)
}
async function handleConfirmAdd() {
const inputData: any = await composeFormData()
const response = await handleActionEdit(
inputData,
therapyId,
() => { },
() => { },
toast,
)
const data = (response?.body?.data ?? null)
if (!data) return
goBack()
}
async function composeFormData(): Promise<any> {
const [input,] = await Promise.all([
inputForm.value?.validate(),
])
const results = [input]
const allValid = results.every((r) => r?.valid)
// exit, if form errors happend during validation
if (!allValid) return Promise.reject('Form validation failed')
const formData = input?.values
formData.medicalDiagnoses = JSON.stringify(formData.medicalDiagnoses)
formData.functionDiagnoses = JSON.stringify(formData.functionDiagnoses)
formData.procedures = JSON.stringify(formData.procedures)
formData.encounter_id = encounterId
return new Promise((resolve) => resolve(formData))
}
// #endregion region
// #region Utilities & event handlers
async function handleActionClick(eventType: string) {
if (eventType === 'submit') {
isConfirmationOpen.value = true
}
if (eventType === 'back') {
if (props.callbackUrl) return navigateTo(props.callbackUrl)
goBack()
}
}
function handleCancelAdd() {
isConfirmationOpen.value = false
}
// #endregion
// #region Watchers
// #endregion
</script>
<template>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg font-semibold xl:text-xl">Edit</div>
<AppTherapyProtocolEntry
ref="inputForm"
:schema="TherapyProtocolMedicRehabilitationSchema"
:resume-arrangement-type="inputForm?.values.arrangement"
/>
<div class="my-2 flex justify-end py-2">
<Action :enable-draft="false"
@click="handleActionClick"/>
</div>
<Confirmation
v-model:open="isConfirmationOpen"
title="Simpan Data"
message="Apakah Anda yakin ingin menyimpan data ini?"
confirm-text="Simpan"
@confirm="handleConfirmAdd"
@cancel="handleCancelAdd"
/>
</template>
@@ -0,0 +1,178 @@
<script setup lang="ts">
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
import type { Summary } from '~/components/pub/my-ui/summary-card/type'
// #region Imports
import { Calendar, Hospital, UserCheck, UsersRound } from 'lucide-vue-next'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import { ActionEvents } from '~/components/pub/my-ui/data/types'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import SummaryCard from '~/components/pub/my-ui/summary-card/summary-card.vue'
import { usePaginatedList } from '~/composables/usePaginatedList'
import { getPatients, removePatient } from '~/services/patient.service'
import DetailRow from '~/components/pub/my-ui/form/view/detail-row.vue'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
import type { Encounter } from '~/models/encounter'
import { cn } from '~/lib/utils'
import { CalendarDate, DateFormatter, getLocalTimeZone } from '@internationalized/date'
import type { DateRange } from 'radix-vue'
// #endregion
// Props
interface Props {
}
const props = defineProps<Props>()
// #endregion
// #region State
const isVerifyDialogOpen = ref(false)
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }),
entityName: 'patient',
})
const df = new DateFormatter('en-US', {
dateStyle: 'medium',
})
const dateValue = ref({
start: new CalendarDate(2022, 1, 20),
end: new CalendarDate(2022, 1, 20).add({ days: 20 }),
}) as Ref<DateRange>
const summaryLoading = ref(false)
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
// #endregion
// #region Lifecycle Hooks
onMounted(() => {
getPatientSummary()
})
// #endregion
// #region Functions
async function getPatientSummary() {
try {
summaryLoading.value = true
await new Promise((resolve) => setTimeout(resolve, 500))
} catch (error) {
console.error('Error fetching patient summary:', error)
} finally {
summaryLoading.value = false
}
}
async function handleConfirmAdd() {
isVerifyDialogOpen.value = true
}
async function handleActionClick(eventType: string) {
if (eventType === 'submit') {
// const patient: Patient = await composeFormData()
// let createdPatientId = 0
// const response = await handleActionSave(
// patient,
// () => {},
// () => {},
// toast,
// )
// const data = (response?.body?.data ?? null) as PatientBase | null
// if (!data) return
// createdPatientId = data.id
// If has callback provided redirect to callback with patientData
// if (props.callbackUrl) {
// await navigateTo(props.callbackUrl + '?patient-id=' + patient.id)
// return
// }
// Navigate to patient list or show success message
// await navigateTo('/outpatient/encounter')
// return
}
if (eventType === 'back') {
isVerifyDialogOpen.value = false
}
}
// #endregion
// #region Provide
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('table_data_loader', isLoading)
// #endregion
// #region Watchers
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showDetail:
navigateTo({
name: 'therapy-protocol-id-detail',
params: { id: recId.value },
})
break
case ActionEvents.showEdit:
navigateTo({
name: 'therapy-protocol-id-edit',
params: { id: recId.value },
})
break
case ActionEvents.showConfirmVerify:
// Trigger confirmation modal open
handleConfirmAdd()
break
case ActionEvents.showPrint:
navigateTo('https://google.com', {
external: true,
open: { target: "_blank" },
});
break
}
})
// #endregion
</script>
<template>
<Popover>
<PopoverTrigger as-child>
<Button variant="outline" :class="cn('mb-3 w-[280px] justify-start text-left font-normal',
!dateValue && 'text-muted-foreground')">
<CalendarIcon class="mr-2 h-4 w-4" />
<template v-if="dateValue.start">
<template v-if="dateValue.end">
{{ df.format(dateValue.start.toDate(getLocalTimeZone())) }} -
{{ df.format(dateValue.end.toDate(getLocalTimeZone())) }}
</template>
<template v-else>
{{ df.format(dateValue.start.toDate(getLocalTimeZone())) }}
</template>
</template>
<template v-else> Pick a date </template>
</Button>
</PopoverTrigger>
<PopoverContent class="w-auto p-0">
<RangeCalendar v-model="dateValue" initial-focus :number-of-months="2"
@update:start-value="(startDate) => (dateValue.start = startDate)" />
</PopoverContent>
</Popover>
<AppTherapyProtocolHistoryDialog
:data="data"
:pagination-meta="paginationMeta"
@page-change="handlePageChange" />
</template>
@@ -0,0 +1,262 @@
<script setup lang="ts">
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
import type { Summary } from '~/components/pub/my-ui/summary-card/type'
// #region Imports
import { Calendar, Hospital, UserCheck, UsersRound } from 'lucide-vue-next'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import { ActionEvents } from '~/components/pub/my-ui/data/types'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import SummaryCard from '~/components/pub/my-ui/summary-card/summary-card.vue'
import { usePaginatedList } from '~/composables/usePaginatedList'
import { getList, remove } from '~/services/therapy-protocol.service'
import DetailRow from '~/components/pub/my-ui/form/view/detail-row.vue'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
import type { Encounter } from '~/models/encounter'
import { cn } from '~/lib/utils'
import { CalendarDate, DateFormatter, getLocalTimeZone } from '@internationalized/date'
import type { DateRange } from 'radix-vue'
import type { ExposedForm } from '~/types/form'
import { VerificationSchema } from '~/schemas/verification.schema'
import { handleActionSave } from '~/handlers/therapy-protocol.handler'
import { toast } from '~/components/pub/ui/toast'
import DocPreviewDialog from '~/components/pub/my-ui/modal/doc-preview-dialog.vue'
// #endregion
// Props
interface Props {
encounter: Encounter
}
const props = defineProps<Props>()
const route = useRoute()
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
// #endregion
// #region State
const isVerifyDialogOpen = ref(false)
const isHistoryDialogOpen = ref(false)
const isPatientInTherapy = ref(false)
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
fetchFn: (params) => getList({ ...params }),
entityName: 'therapy-protocol',
})
const df = new DateFormatter('en-US', {
dateStyle: 'medium',
})
const dateValue = ref({
start: new CalendarDate(2022, 1, 20),
end: new CalendarDate(2022, 1, 20).add({ days: 20 }),
}) as Ref<DateRange>
const isRecordConfirmationOpen = ref(false)
const isDocPreviewDialogOpen = ref(false)
const summaryLoading = ref(false)
const inputForm = ref<ExposedForm<any> | null>(null)
const recId = ref<number>(0)
const recAction = ref<string>('')
const recItem = ref<any>(null)
const timestamp = ref<number>(0)
const isCaptchaValid = ref(false)
provide('isCaptchaValid', isCaptchaValid)
const headerPrep: HeaderPrep = {
title: "Protokol Terapi",
icon: 'i-lucide-newspaper',
addNav: {
label: "Protokol Terapi",
onClick: () => navigateTo({
name: 'rehab-encounter-id-therapy-protocol-add',
}),
},
}
// #endregion
// #region Lifecycle Hooks
onMounted(() => {
getPatientSummary()
const isInTherapy = false // TODO: determine if patient is in therapy
handleIsPatientInTherapy(isInTherapy)
})
// #endregion
// #region Functions
function handleIsPatientInTherapy(value: boolean) {
if (value) {
isPatientInTherapy.value = true
} else {
isPatientInTherapy.value = false
}
}
async function handleOpenHistory() {
isHistoryDialogOpen.value = true
console.log(`jalan history`)
}
async function getPatientSummary() {
try {
summaryLoading.value = true
await new Promise((resolve) => setTimeout(resolve, 500))
} catch (error) {
console.error('Error fetching patient summary:', error)
} finally {
summaryLoading.value = false
}
}
async function handleVerify() {
isVerifyDialogOpen.value = true
}
async function handleConfirmVerify() {
const inputData: any = await composeFormData()
const response = await handleActionSave(
inputData,
() => { },
() => { },
toast,
)
const data = (response?.body?.data ?? null)
if (!data) return
isVerifyDialogOpen.value = false
}
async function composeFormData(): Promise<any> {
const [input,] = await Promise.all([
inputForm.value?.validate(),
])
const results = [input]
const allValid = results.every((r) => r?.valid)
// exit, if form errors happend during validation
if (!allValid) return Promise.reject('Form validation failed')
const formData = input?.values
// formData.encounter_id = encounterId
return new Promise((resolve) => resolve(formData))
}
// #endregion region
// #region Utilities & event handlers
async function handleActionClick(eventType: string) {
if (eventType === 'submit') {
handleConfirmVerify()
}
if (eventType === 'back') {
isVerifyDialogOpen.value = false
}
}
// #endregion
// #region Provide
provide('rec_id', recId)
provide('rec_action', recAction)
provide('rec_item', recItem)
provide('timestamp', timestamp)
provide('table_data_loader', isLoading)
// #endregion
// #region Watchers
watch([recId, recAction, timestamp], () => {
switch (recAction.value) {
case ActionEvents.showDetail:
navigateTo({
name: 'therapy-protocol-id-detail',
params: { id: recId.value },
})
break
case ActionEvents.showEdit:
navigateTo({
name: 'rehab-encounter-id-therapy-protocol-therapy_protocol_id-edit',
params: { therapy_protocol_id: recId.value },
})
break
case ActionEvents.showConfirmVerify:
// Trigger confirmation modal open
handleVerify()
break
case ActionEvents.showPrint:
isDocPreviewDialogOpen.value = true
break
}
})
// #endregion
</script>
<template>
<Header :prep="{ ...headerPrep }" />
<section class="mb-5 flex justify-between items-center">
<!-- DATE RANGE -->
<Popover>
<PopoverTrigger as-child>
<Button variant="outline" :class="cn('w-[280px] justify-start text-left font-normal',
!dateValue && 'text-muted-foreground')">
<CalendarIcon class="mr-2 h-4 w-4" />
<template v-if="dateValue.start">
<template v-if="dateValue.end">
{{ df.format(dateValue.start.toDate(getLocalTimeZone())) }} -
{{ df.format(dateValue.end.toDate(getLocalTimeZone())) }}
</template>
<template v-else>
{{ df.format(dateValue.start.toDate(getLocalTimeZone())) }}
</template>
</template>
<template v-else> Pick a date </template>
</Button>
</PopoverTrigger>
<PopoverContent class="w-auto p-0">
<RangeCalendar v-model="dateValue" initial-focus :number-of-months="2"
@update:start-value="(startDate) => (dateValue.start = startDate)" />
</PopoverContent>
</Popover>
<!-- HISTORY -->
<Button variant="outline" :class="cn('',)" @click="handleOpenHistory">
<Icon name="i-lucide-history" class="h-4 w-4" />
History
</Button>
</section>
<AppTherapyProtocolCommonBannerPatientInTherapy
v-if="isPatientInTherapy"
class="mb-5" />
<AppTherapyProtocolList
:data="data"
:pagination-meta="paginationMeta"
@page-change="handlePageChange"/>
<Dialog v-model:open="isVerifyDialogOpen" title="Verifikasi">
<AppTherapyProtocolVerifyDialog
ref="inputForm"
:schema="VerificationSchema"
/>
<div class="flex justify-end">
<Action v-show="isCaptchaValid" :enable-draft="false" @click="handleActionClick" />
</div>
</Dialog>
<Dialog v-model:open="isHistoryDialogOpen" title="History" size="full">
<ContentTherapyProtocolHistoryList />
</Dialog>
<Dialog v-model:open="isDocPreviewDialogOpen" title="Preview Dokumen" size="2xl">
<!-- <DocPreviewDialog :link="recItem.url" /> -->
<DocPreviewDialog :link="`https://www.antennahouse.com/hubfs/xsl-fo-sample/pdf/basic-link-1.pdf`" />
</Dialog>
</template>
@@ -0,0 +1,77 @@
<script setup lang="ts">
import type { LinkItem, ListItemDto } from './types'
import { ActionEvents } from './types'
const props = defineProps<{
rec: ListItemDto
}>()
const recId = inject<Ref<number>>('rec_id')!
const recAction = inject<Ref<string>>('rec_action')!
const recItem = inject<Ref<any>>('rec_item')!
const activeKey = ref<string | null>(null)
const linkItems: LinkItem[] = [
{
label: 'Detail',
onClick: () => {
detail()
},
icon: 'i-lucide-eye',
},
{
label: 'Print',
onClick: () => {
print()
},
icon: 'i-lucide-printer',
},
]
function detail() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showDetail
recItem.value = props.rec
}
function print() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showPrint
recItem.value = props.rec
}
</script>
<template>
<div>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<SidebarMenuButton
size="lg"
class="data-[state=open]:text-sidebar-accent-foreground data-[state=open]:bg-white dark:data-[state=open]:bg-slate-800"
>
<Icon
name="i-lucide-chevrons-up-down"
class="ml-auto size-4"
/>
</SidebarMenuButton>
</DropdownMenuTrigger>
<DropdownMenuContent
class="w-[--radix-dropdown-menu-trigger-width] min-w-40 rounded-lg border border-slate-200 bg-white text-black dark:border-slate-700 dark:bg-slate-800 dark:text-white"
align="end"
>
<DropdownMenuGroup>
<DropdownMenuItem
v-for="item in linkItems"
:key="item.label"
class="hover:bg-gray-100 dark:hover:bg-slate-700"
@click="item.onClick"
@mouseenter="activeKey = item.label"
@mouseleave="activeKey = null"
>
<Icon :name="item.icon ?? ''" />
<span :class="activeKey === item.label ? 'text-sidebar-accent-foreground' : ''">{{ item.label }}</span>
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</div>
</template>
@@ -0,0 +1,106 @@
<script setup lang="ts">
import type { LinkItem, ListItemDto } from './types'
import { ActionEvents } from './types'
const props = defineProps<{
rec: ListItemDto
}>()
const recId = inject<Ref<number>>('rec_id')!
const recAction = inject<Ref<string>>('rec_action')!
const recItem = inject<Ref<any>>('rec_item')!
const timestamp = inject<Ref<any>>('timestamp')!
const activeKey = ref<string | null>(null)
const linkItems: LinkItem[] = [
{
label: 'Detail',
onClick: () => {
detail()
},
icon: 'i-lucide-eye',
},
{
label: 'Edit',
onClick: () => {
edit()
},
icon: 'i-lucide-pencil',
},
{
label: 'Verifikasi',
onClick: () => {
verify()
},
icon: 'i-lucide-shield-check',
},
{
label: 'Print',
onClick: () => {
print()
},
icon: 'i-lucide-printer',
},
]
function detail() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showDetail
recItem.value = props.rec
}
function edit() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showEdit
recItem.value = props.rec
}
function verify() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showConfirmVerify
recItem.value = props.rec
timestamp.value = new Date().getTime()
}
function print() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showPrint
recItem.value = props.rec
}
</script>
<template>
<div>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<SidebarMenuButton
size="lg"
class="data-[state=open]:text-sidebar-accent-foreground data-[state=open]:bg-white dark:data-[state=open]:bg-slate-800"
>
<Icon
name="i-lucide-chevrons-up-down"
class="ml-auto size-4"
/>
</SidebarMenuButton>
</DropdownMenuTrigger>
<DropdownMenuContent
class="w-[--radix-dropdown-menu-trigger-width] min-w-40 rounded-lg border border-slate-200 bg-white text-black dark:border-slate-700 dark:bg-slate-800 dark:text-white"
align="end"
>
<DropdownMenuGroup>
<DropdownMenuItem
v-for="item in linkItems"
:key="item.label"
class="hover:bg-gray-100 dark:hover:bg-slate-700"
@click="item.onClick"
@mouseenter="activeKey = item.label"
@mouseleave="activeKey = null"
>
<Icon :name="item.icon ?? ''" />
<span :class="activeKey === item.label ? 'text-sidebar-accent-foreground' : ''">{{ item.label }}</span>
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</div>
</template>
@@ -0,0 +1,64 @@
<script setup lang="ts">
import type { LinkItem, ListItemDto } from './types'
import { ActionEvents } from './types'
const props = defineProps<{
rec: ListItemDto
}>()
const recId = inject<Ref<number>>('rec_id')!
const recAction = inject<Ref<string>>('rec_action')!
const recItem = inject<Ref<any>>('rec_item')!
const activeKey = ref<string | null>(null)
const linkItems: LinkItem[] = [
{
label: 'Process',
onClick: () => {
process()
},
icon: 'i-lucide-arrow-right',
},
]
function process() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showProcess
recItem.value = props.rec
}
</script>
<template>
<div>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<SidebarMenuButton
size="lg"
class="data-[state=open]:text-sidebar-accent-foreground data-[state=open]:bg-white dark:data-[state=open]:bg-slate-800"
>
<Icon
name="i-lucide-chevrons-up-down"
class="ml-auto size-4"
/>
</SidebarMenuButton>
</DropdownMenuTrigger>
<DropdownMenuContent
class="w-[--radix-dropdown-menu-trigger-width] min-w-40 rounded-lg border border-slate-200 bg-white text-black dark:border-slate-700 dark:bg-slate-800 dark:text-white"
align="end"
>
<DropdownMenuGroup>
<DropdownMenuItem
v-for="item in linkItems"
:key="item.label"
class="hover:bg-gray-100 dark:hover:bg-slate-700"
@click="item.onClick"
@mouseenter="activeKey = item.label"
@mouseleave="activeKey = null"
>
<Icon :name="item.icon ?? ''" />
<span :class="activeKey === item.label ? 'text-sidebar-accent-foreground' : ''">{{ item.label }}</span>
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</div>
</template>
+2
View File
@@ -78,6 +78,8 @@ export const ActionEvents = {
showEdit: 'showEdit',
showDetail: 'showDetail',
showProcess: 'showProcess',
showConfirmVerify: 'showConfirmVerify',
showPrint: 'showPrint',
}
export interface DataTableLoader {
@@ -0,0 +1,86 @@
<script setup lang="ts">
import type { FormErrors } from '~/types/error'
import FieldGroup from '~/components/pub/my-ui/form/field-group.vue'
import Field from '~/components/pub/my-ui/form/field.vue'
import Label from '~/components/pub/my-ui/form/label.vue'
import { Input } from '~/components/pub/ui/input'
import { cn } from '~/lib/utils'
import * as DE from '~/components/pub/my-ui/doc-entry'
const props = defineProps<{
fieldName: string
placeholder: string
label: string
errors?: FormErrors
class?: string
colSpan?: number
numericOnly?: boolean
maxLength?: number
isRequired?: boolean
isDisabled?: boolean
}>()
function handleInput(event: Event) {
const target = event.target as HTMLInputElement
let value = target.value
// Filter numeric only jika diperlukan
if (props.numericOnly) {
value = value.replace(/\D/g, '')
}
// Batasi panjang maksimal jika diperlukan
if (props.maxLength && value.length > props.maxLength) {
value = value.slice(0, props.maxLength)
}
// Update value jika ada perubahan
if (target.value !== value) {
target.value = value
// Trigger input event untuk update form
target.dispatchEvent(new Event('input', { bubbles: true }))
}
}
</script>
<template>
<DE.Cell :col-span="colSpan || 1">
<DE.Label
class="mb-2 font-medium"
v-if="label !== ''"
:label-for="fieldName"
:is-required="isRequired && !isDisabled"
>
{{ label }}
</DE.Label>
<DE.Field
:id="fieldName"
:errors="errors"
>
<FormField
v-slot="{ componentField }"
:name="fieldName"
>
<FormItem>
<FormControl>
<Textarea
:disabled="isDisabled"
v-bind="componentField"
:placeholder="placeholder"
:maxlength="maxLength"
:class="cn('focus:border-primary focus:ring-2 focus:ring-primary focus:ring-offset-0')"
autocomplete="off"
aria-autocomplete="none"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
@input="handleInput"
/>
</FormControl>
<FormMessage />
</FormItem>
</FormField>
</DE.Field>
</DE.Cell>
</template>
+5 -8
View File
@@ -45,15 +45,12 @@ const isOpen = computed({
<template>
<Dialog v-model:open="isOpen">
<DialogContent
:class="sizeClass"
@interact-outside="(e: any) => preventOutside && e.preventDefault()"
@pointer-down-outside="(e: any) => preventOutside && e.preventDefault()"
>
<DialogContent :class="sizeClass" @interact-outside="(e: any) => preventOutside && e.preventDefault()"
@pointer-down-outside="(e: any) => preventOutside && e.preventDefault()">
<DialogHeader>
<DialogTitle :class="`text-sm 2xl:text-base font-semibold flex ${titleClass || ''}`">
<div v-if="props.titleIcon" class="me-2 pt-0.5">
<Icon :name="props.titleIcon" :class="`!pt-2`" />
<div class="me-2 pt-0.5">
<Icon v-if="props.titleIcon" :name="props.titleIcon" :class="`!pt-2`" />
</div>
<div>
{{ props.title }}
@@ -66,4 +63,4 @@ const isOpen = computed({
</DialogDescription>
</DialogContent>
</Dialog>
</template>
</template>
@@ -0,0 +1,29 @@
<script setup lang="ts">
const props = defineProps<{
link: string
}>()
const emit = defineEmits<{
// submit: [values: InstallationFormData, resetForm: () => void]
// cancel: [resetForm: () => void]
}>()
// Form cancel handler
// function onCancelForm({ resetForm }: { resetForm: () => void }) {
// emit('cancel', resetForm)
// }
function onExternalLink() {
navigateTo(props.link, {external: true,open: { target: "_blank" },});
}
</script>
<template>
<Button variant="link" class="absolute top-4 right-16" @click="onExternalLink">
Open in Browser
<Icon name="i-lucide-external-link" class="h-4 w-4" />
</Button>
<div class="border border-gray-400 rounded-lg w-full h-[80vh] overflow-hidden">
<embed style="width: 100%; height: 100%" :src="props.link" />
</div>
</template>
@@ -26,19 +26,19 @@ function onClick(type: ClickType) {
<div :class="`${defaultClass} ${additionalClass} ${btnClass}`">
<div>
<Button variant="ghost" type="button" @click="onClick('back')">
<Icon name="i-lucide-arrow-left" />
<Icon name="i-lucide-arrow-left" />
Back
</Button>
</div>
<div>
<Button v-show="enableDraft" variant="secondary" type="button" @click="onClick('draft')">
<div v-show="props.enableDraft">
<Button variant="secondary" type="button" @click="onClick('draft')">
<Icon name="i-lucide-file" />
Draft
</Button>
</div>
<div>
<Button type="button" @click="onClick('submit')">
<Icon name="i-lucide-check" />
<Icon name="i-lucide-check" />
Submit
</Button>
</div>
+24
View File
@@ -0,0 +1,24 @@
// Handlers
import { genCrudHandler } from '~/handlers/_handler'
// Services
import { create, update, remove } from '~/services/therapy-protocol.service'
export const {
recId,
recAction,
recItem,
isReadonly,
isProcessing,
isFormEntryDialogOpen,
isRecordConfirmationOpen,
onResetState,
handleActionSave,
handleActionEdit,
handleActionRemove,
handleCancelForm,
} = genCrudHandler({
create,
update,
remove,
})
@@ -0,0 +1,44 @@
<script setup lang="ts">
import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/my-ui/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({
middleware: ['rbac'],
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
title: 'Protokol Terapi',
contentFrame: 'cf-full-width',
})
const route = useRoute()
useHead({
title: () => `${route.meta.title}`, // backtick to avoid the ts-plugin(2322) warning
})
const roleAccess: PagePermission = PAGE_PERMISSIONS['/rehab/encounter']
const { checkRole, hasCreateAccess } = useRBAC()
// Check if user has access to this page
const hasAccess = checkRole(roleAccess)
// if (!hasAccess) {
// throw createError({
// statusCode: 403,
// statusMessage: 'Access denied',
// })
// }
// Define permission-based computed properties
const canCreate = true // hasCreateAccess(roleAccess)
</script>
<template>
<div v-if="canCreate">
<ContentTherapyProtocolEdit />
</div>
<Error
v-else
:status-code="403"
/>
</template>
@@ -0,0 +1,44 @@
<script setup lang="ts">
import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/my-ui/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({
middleware: ['rbac'],
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
title: 'Protokol Terapi',
contentFrame: 'cf-full-width',
})
const route = useRoute()
useHead({
title: () => `${route.meta.title}`, // backtick to avoid the ts-plugin(2322) warning
})
const roleAccess: PagePermission = PAGE_PERMISSIONS['/rehab/encounter']
const { checkRole, hasCreateAccess } = useRBAC()
// Check if user has access to this page
const hasAccess = checkRole(roleAccess)
// if (!hasAccess) {
// throw createError({
// statusCode: 403,
// statusMessage: 'Access denied',
// })
// }
// Define permission-based computed properties
const canCreate = true // hasCreateAccess(roleAccess)
</script>
<template>
<div v-if="canCreate">
<ContentTherapyProtocolAdd />
</div>
<Error
v-else
:status-code="403"
/>
</template>
@@ -0,0 +1,41 @@
<script setup lang="ts">
import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/my-ui/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({
middleware: ['rbac'],
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
title: 'Detail Protokol Terapi',
contentFrame: 'cf-full-width',
})
const route = useRoute()
useHead({
title: () => `${route.meta.title}`, // backtick to avoid the ts-plugin(2322) warning
})
const roleAccess: PagePermission = PAGE_PERMISSIONS['/rehab/encounter']
const { checkRole, hasCreateAccess } = useRBAC()
// Check if user has access to this page
const hasAccess = checkRole(roleAccess)
// if (!hasAccess) {
// throw createError({
// statusCode: 403,
// statusMessage: 'Access denied',
// })
// }
// Define permission-based computed properties
const canCreate = true // hasCreateAccess(roleAccess)
</script>
<template>
<div v-if="canCreate">
<ContentTherapyProtocolDetail/>
</div>
<Error v-else :status-code="403" />
</template>
@@ -0,0 +1,41 @@
<script setup lang="ts">
import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/my-ui/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({
middleware: ['rbac'],
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
title: 'Edit Protokol Terapi',
contentFrame: 'cf-full-width',
})
const route = useRoute()
useHead({
title: () => `${route.meta.title}`, // backtick to avoid the ts-plugin(2322) warning
})
const roleAccess: PagePermission = PAGE_PERMISSIONS['/rehab/encounter']
const { checkRole, hasCreateAccess } = useRBAC()
// Check if user has access to this page
const hasAccess = checkRole(roleAccess)
// if (!hasAccess) {
// throw createError({
// statusCode: 403,
// statusMessage: 'Access denied',
// })
// }
// Define permission-based computed properties
const canCreate = true // hasCreateAccess(roleAccess)
</script>
<template>
<div v-if="canCreate">
<ContentTherapyProtocolEdit />
</div>
<Error v-else :status-code="403" />
</template>
@@ -0,0 +1,41 @@
<script setup lang="ts">
import type { PagePermission } from '~/models/role'
import Error from '~/components/pub/my-ui/error/error.vue'
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
definePageMeta({
middleware: ['rbac'],
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
title: 'Tambah Protokol Terapi',
contentFrame: 'cf-full-width',
})
const route = useRoute()
useHead({
title: () => `${route.meta.title}`, // backtick to avoid the ts-plugin(2322) warning
})
const roleAccess: PagePermission = PAGE_PERMISSIONS['/rehab/encounter']
const { checkRole, hasCreateAccess } = useRBAC()
// Check if user has access to this page
const hasAccess = checkRole(roleAccess)
// if (!hasAccess) {
// throw createError({
// statusCode: 403,
// statusMessage: 'Access denied',
// })
// }
// Define permission-based computed properties
const canCreate = true // hasCreateAccess(roleAccess)
</script>
<template>
<div v-if="canCreate">
<ContentTherapyProtocolAdd />
</div>
<Error v-else :status-code="403" />
</template>
+159
View File
@@ -0,0 +1,159 @@
import { z } from 'zod'
const TherapyProtocolSchema = z.object({
examinationDate: z.string({
required_error: 'Pilih tanggal pemeriksaan',
}),
relationshipToInsured: z.enum(['spouse', 'child'], {
required_error: 'Pilih hubungan',
}),
anamnesis: z.string({
required_error: 'Mohon lengkapi catatan anamnesa',
}),
medicalHistory: z.string({
required_error: 'Mohon lengkapi catatan riwayat penyakit',
}),
medicationHistory: z.string({
required_error: 'Mohon lengkapi catatan riwayat obat',
}),
supportDiagnosis: z.array(
z.object({
diagnosis: z.string({
required_error: 'Isi diagnosis',
}),
}),
{
required_error: 'Isi diagnosis',
},
),
functionalDiagnosis: z.array(
z
.object({
diagnosis: z.string({}),
})
.optional(),
{
required_error: 'Isi diagnosis',
},
),
treatmentDiagnosis: z.array(
z.object({
diagnosis: z.string({
required_error: 'Isi diagnosis',
}),
}),
{
required_error: 'Isi diagnosis',
},
),
supportExamination: z.string({
required_error: 'Mohon lengkapi catatan pemeriksaan penunjang',
}),
recommendation: z.string({
required_error: 'Mohon lengkapi catatan anjuran',
}),
evaluation: z.string({
required_error: 'Mohon lengkapi catatan evaluasi',
}),
isWorkRelatedDisease: z.string({
required_error: 'Pilih apakah penyakit berkaitan dengan pekerjaan',
}),
})
const PickerItemSchema = z.object({
id: z.number().optional(),
code: z.string(),
name: z.string()
})
const TherapyProtocolMedicRehabilitationSchema = z.object({
form1ExaminationDate: z.string({
required_error: 'Pilih tanggal pemeriksaan',
}),
form1Diagnose: z.string({
required_error: 'Mohon lengkapi catatan diagnosa',
}),
form1TherapyRequest: z.string({
required_error: 'Mohon lengkapi catatan terapi',
}),
form1TargetPeriod: z.number({
required_error: 'Mohon lengkapi catatan terapi',
}),
form1TherapyTarget: z.string({
required_error: 'Mohon lengkapi catatan terapi',
}),
form2RelationshipToInsured: z.enum(['spouse', 'child'], {
required_error: 'Pilih hubungan',
}),
anamnesis: z.string({
required_error: 'Mohon lengkapi catatan anamnesa',
}),
form2PhysicalExamination: z.string({
required_error: 'Mohon lengkapi catatan pemeriksaan fisik',
}),
medicalDiagnoses: z.array(PickerItemSchema).default([]),
functionDiagnoses: z.array(PickerItemSchema).default([]),
procedures: z.array(PickerItemSchema).default([]),
supportingExams: z.string({
required_error: 'Mohon lengkapi catatan pemeriksaan penunjang',
}),
evaluation: z.string({
required_error: 'Mohon lengkapi catatan evaluasi',
}),
instruction: z.string({
required_error: 'Mohon lengkapi catatan anjuran',
}),
workCauseStatus: z.enum(['YA', 'TIDAK'], {
required_error: 'Pilih apakah penyakit berkaitan dengan pekerjaan',
}),
form3ExaminationDate: z.string({
required_error: 'Pilih tanggal pemeriksaan',
}),
form3Diagnose: z.string({
required_error: 'Mohon lengkapi catatan diagnosa',
}),
form3TherapyRequest: z.string({
required_error: 'Mohon lengkapi catatan terapi',
}),
form3ProgramActivities: z.array(
z.string({
required_error: 'Mohon lengkapi Program/Kegiatan',
}),
{
required_error: 'Isi Program/Kegiatan',
},
).default(['']),
})
// {
// "encounter_id": 4,
// "doctor_code": "doc-3",
// "anamnesis": "",
// "medicalDiagnoses": "", //json
// "functionDiagnoses": "", //json
// "procedures":"",
// "supportingExams":"",
// "instruction":"",
// "evaluation":"",
// "workCauseStatus":"YA",
// "frequency":1,
// "intervalUnit_code":"day",
// "duration":30,
// "durationUnit_code":"min"
// }
type TherapyProtocolFormData = z.infer<typeof TherapyProtocolSchema>
type TherapyProtocolMedicRehabilitationFormData = z.infer<typeof TherapyProtocolMedicRehabilitationSchema>
export { TherapyProtocolSchema, TherapyProtocolMedicRehabilitationSchema }
export type { TherapyProtocolFormData, TherapyProtocolMedicRehabilitationFormData }
+19
View File
@@ -0,0 +1,19 @@
import { z } from 'zod'
const VerificationSchema = z.object({
name: z.string({
required_error: 'Mohon lengkapi Nama Anda',
}),
email: z.string({
required_error: 'Mohon lengkapi email',
}),
password: z.string({
required_error: 'Mohon lengkapi password',
}),
})
type VerificationFormData = z.infer<typeof VerificationSchema>
export { VerificationSchema, }
export type { VerificationFormData, }
+27
View File
@@ -0,0 +1,27 @@
// Base
import * as base from './_crud-base'
// Constants
const path = '/api/v1/therapy-protocol'
const name = 'therapy-protocol'
export function create(data: any) {
return base.create(path, data, name)
}
export function getList(params: any = null) {
return base.getList(path, params, name)
}
export function getDetail(id: number | string, params?: any) {
return base.getDetail(path, id, name, params)
}
export function update(id: number | string, data: any) {
return base.update(path, id, data, name)
}
export function remove(id: number | string) {
return base.remove(path, id, name)
}