Merge branch 'dev' into feat/ap-lab-order-52
This commit is contained in:
@@ -35,24 +35,24 @@ const { defineField, errors, meta } = useForm({
|
||||
initialValues: {
|
||||
date: props.values.date || today.toISOString().slice(0, 10),
|
||||
problem: '',
|
||||
dstUnit_id: 0,
|
||||
} as Partial<ConsultationFormData>,
|
||||
dstUnit_code: '',
|
||||
} as ConsultationFormData,
|
||||
})
|
||||
|
||||
const [date, dateAttrs] = defineField('date')
|
||||
const [unit_id, unitAttrs] = defineField('unit_id')
|
||||
const [unit_code, unitAttrs] = defineField('unit_code')
|
||||
const [problem, problemAttrs] = defineField('problem')
|
||||
|
||||
// Fill fields from props.values if provided
|
||||
if (props.values) {
|
||||
if (props.values.date !== undefined) date.value = props.values.date.substring(0, 10)
|
||||
if (props.values.dstUnit_id !== undefined) unit_id.value = props.values.dstUnit_id
|
||||
if (props.values.dstUnit_code !== undefined) unit_code.value = props.values.dstUnit_code
|
||||
if (props.values.problem !== undefined) problem.value = props.values.problem
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
date.value = date.value ?? today.toISOString().slice(0, 10)
|
||||
unit_id.value = 0
|
||||
unit_code.value = 0
|
||||
problem.value = ''
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ function onSubmitForm(values: any) {
|
||||
encounter_id: props.encounter_id,
|
||||
date: date.value ? `${date.value}T00:00:00Z` : '',
|
||||
problem: problem.value || '',
|
||||
dstUnit_id: unit_id.value || 0,
|
||||
dstUnit_code: unit_code.value || '',
|
||||
}
|
||||
emit('submit', formData, resetForm)
|
||||
}
|
||||
@@ -89,18 +89,18 @@ function onCancelForm() {
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label>Unit</DE.Label>
|
||||
<DE.Field :errMessage="errors.unit_id">
|
||||
{{ errors.unit_id }}
|
||||
<DE.Field :errMessage="errors.unit_code">
|
||||
{{ errors.unit_code }}
|
||||
<Select
|
||||
id="strUnit_id"
|
||||
v-model.number="unit_id"
|
||||
id="strUnit_code"
|
||||
v-model="unit_code"
|
||||
icon-name="i-lucide-chevron-down"
|
||||
placeholder="Pilih poliklinik tujuan"
|
||||
v-bind="unitAttrs"
|
||||
:items="props.units || []"
|
||||
:disabled="isLoading || isReadonly"
|
||||
/>
|
||||
<!-- <Input type="number" id="unit_id" v-model.number="unit_id" v-bind="unitAttrs" :disabled="isLoading || isReadonly" /> -->
|
||||
<!-- <Input type="number" id="unit_code" v-model.number="unit_code" v-bind="unitAttrs" :disabled="isLoading || isReadonly" /> -->
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell :colSpan="3">
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||
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'
|
||||
|
||||
interface Props {
|
||||
data: any[]
|
||||
paginationMeta: PaginationMeta
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
const isModalOpen = inject(`isHistoryDialogOpen`) as Ref<boolean>
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
emit('pageChange', page)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog v-model:open="isModalOpen" title="Riwayat Surat Kontrol" size="full">
|
||||
<PubMyUiDataTable
|
||||
v-bind="config"
|
||||
:rows="data"
|
||||
:skeleton-size="props.paginationMeta?.pageSize"
|
||||
/>
|
||||
<PaginationView :pagination-meta="props.paginationMeta" @page-change="handlePageChange" />
|
||||
</Dialog>
|
||||
</template>
|
||||
@@ -0,0 +1,85 @@
|
||||
import type { Config } from '~/components/pub/my-ui/data-table'
|
||||
import type { Patient } from '~/models/patient'
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
import { educationCodes, genderCodes } from '~/lib/constants'
|
||||
import { calculateAge } from '~/lib/utils'
|
||||
|
||||
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/print-btn.vue'))
|
||||
|
||||
export const config: Config = {
|
||||
cols: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {width: 130}, {width: 30},],
|
||||
|
||||
headers: [
|
||||
[
|
||||
{ label: 'NAMA PASIEN' },
|
||||
{ label: 'NO.SURAT KONTROL' },
|
||||
{ label: 'NO.SEP' },
|
||||
{ label: 'TANGGAL RENCANA KONTROL' },
|
||||
{ label: 'TANGGAL TERBIT' },
|
||||
{ label: 'DPJP' },
|
||||
{ label: 'SPESIALIS' },
|
||||
{ label: 'SUBSPESIALIS' },
|
||||
{ label: 'TIPE RAWAT' },
|
||||
{ label: 'DIBUAT OLEH' },
|
||||
{ label: 'DIEDIT OLEH' },
|
||||
{ label: 'STATUS' },
|
||||
{ label: 'AKSI' },
|
||||
],
|
||||
],
|
||||
|
||||
keys: [
|
||||
'date',
|
||||
'name',
|
||||
'name',
|
||||
'name',
|
||||
'name',
|
||||
'name',
|
||||
'name',
|
||||
'name',
|
||||
'name',
|
||||
'name',
|
||||
'name',
|
||||
'status',
|
||||
'action',
|
||||
],
|
||||
|
||||
delKeyNames: [
|
||||
{ key: 'code', label: 'Kode' },
|
||||
{ key: 'name', label: 'Nama' },
|
||||
],
|
||||
|
||||
parses: {
|
||||
date: (rec: unknown): unknown => {
|
||||
const date = (rec as any).date
|
||||
if (typeof date == 'object' && date) {
|
||||
return (date as Date).toLocaleDateString('id-ID')
|
||||
} else if (typeof date == 'string') {
|
||||
return (date as string).substring(0, 10)
|
||||
}
|
||||
return date
|
||||
},
|
||||
specialist_subspecialist: (rec: unknown): unknown => {
|
||||
return '-'
|
||||
},
|
||||
dpjp: (rec: unknown): unknown => {
|
||||
// const { person } = rec as Patient
|
||||
return '-'
|
||||
},
|
||||
},
|
||||
|
||||
components: {
|
||||
action(rec, idx) {
|
||||
return {
|
||||
idx,
|
||||
rec: rec as object,
|
||||
component: action,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
htmls: {
|
||||
sep_status(_rec) {
|
||||
return 'SEP Internal'
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -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"
|
||||
/>
|
||||
|
||||
@@ -1,43 +1,57 @@
|
||||
<script setup lang="ts">
|
||||
// Components
|
||||
import Block from '~/components/pub/my-ui/doc-entry/block.vue'
|
||||
import Cell from '~/components/pub/my-ui/doc-entry/cell.vue'
|
||||
import Field from '~/components/pub/my-ui/doc-entry/field.vue'
|
||||
import Label from '~/components/pub/my-ui/doc-entry/label.vue'
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import { Button } from '~/components/pub/ui/button'
|
||||
import { Input } from '~/components/pub/ui/input'
|
||||
import Select from '~/components/pub/ui/select/Select.vue'
|
||||
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
|
||||
import * as CB from '~/components/pub/my-ui/combobox'
|
||||
|
||||
import DatepickerSingle from '~/components/pub/my-ui/datepicker/datepicker-single.vue'
|
||||
import TreeSelect from '~/components/pub/my-ui/select-tree/tree-select.vue'
|
||||
import FileUpload from '~/components/pub/my-ui/form/file-field.vue'
|
||||
|
||||
// Types
|
||||
import { IntegrationEncounterSchema, type IntegrationEncounterFormData } from '~/schemas/integration-encounter.schema'
|
||||
import type { PatientEntity } from '~/models/patient'
|
||||
import type { TreeItem } from '~/components/pub/my-ui/select-tree/type'
|
||||
|
||||
// Helpers
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { refDebounced } from '@vueuse/core'
|
||||
import type { Doctor } from '~/models/doctor'
|
||||
|
||||
// References
|
||||
import { paymentMethodCodes } from '~/const/key-val/common'
|
||||
|
||||
// App things
|
||||
import { genEncounter, type Encounter } from '~/models/encounter'
|
||||
|
||||
// Props
|
||||
const props = defineProps<{
|
||||
isLoading?: boolean
|
||||
isReadonly?: boolean
|
||||
isSepValid?: boolean
|
||||
isCheckingSep?: boolean
|
||||
doctor?: any[]
|
||||
subSpecialist?: any[]
|
||||
specialists?: TreeItem[]
|
||||
payments: any[]
|
||||
doctorItems?: CB.Item[]
|
||||
selectedDoctor: Doctor
|
||||
// subSpecialist?: any[]
|
||||
// specialists?: TreeItem[]
|
||||
// paymentMethods: PaymentMethodCode[]
|
||||
participantGroups?: any[]
|
||||
seps: any[]
|
||||
patient?: PatientEntity | null | undefined
|
||||
objects?: any
|
||||
// objects?: any
|
||||
}>()
|
||||
|
||||
// Model
|
||||
const model = defineModel<Encounter>()
|
||||
model.value = genEncounter()
|
||||
|
||||
// Common preparation
|
||||
const defaultCBItems = [{ label: 'Pilih', value: '' }];
|
||||
const paymentMethodItems = CB.recStrToItem(paymentMethodCodes)
|
||||
|
||||
// Emit preparation
|
||||
const emit = defineEmits<{
|
||||
(e: 'onSelectDoctor', code: string): void
|
||||
(e: 'event', menu: string, value?: any): void
|
||||
(e: 'fetch', value?: any): void
|
||||
}>()
|
||||
@@ -48,10 +62,10 @@ const { handleSubmit, errors, defineField, meta } = useForm<IntegrationEncounter
|
||||
})
|
||||
|
||||
// Bind fields and extract attrs
|
||||
const [doctorId, doctorIdAttrs] = defineField('doctorId')
|
||||
const [subSpecialistId, subSpecialistIdAttrs] = defineField('subSpecialistId')
|
||||
const [doctorCode, doctorCodeAttrs] = defineField('doctor_code')
|
||||
const [unitCode, unitCodeAttrs] = defineField('unit_code')
|
||||
const [registerDate, registerDateAttrs] = defineField('registerDate')
|
||||
const [paymentType, paymentTypeAttrs] = defineField('paymentType')
|
||||
const [paymentMethodCode, paymentMethodCodeAttrs] = defineField('paymentMethod_code')
|
||||
const [patientCategory, patientCategoryAttrs] = defineField('patientCategory')
|
||||
const [cardNumber, cardNumberAttrs] = defineField('cardNumber')
|
||||
const [sepType, sepTypeAttrs] = defineField('sepType')
|
||||
@@ -68,30 +82,50 @@ const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false
|
||||
const isSepValid = computed(() => props.isSepValid || false)
|
||||
const isCheckingSep = computed(() => props.isCheckingSep || false)
|
||||
|
||||
const doctorOpts = computed(() => {
|
||||
// Add default option
|
||||
const defaultOption = [{ label: 'Pilih', value: '' }]
|
||||
// Add doctors from props
|
||||
const doctors = props.doctor || []
|
||||
return [...defaultOption, ...doctors]
|
||||
})
|
||||
// Unit, specialist, subspecialist
|
||||
const unitFullName = ref('')
|
||||
watch(() => props.selectedDoctor, (doctor) => {
|
||||
unitFullName.value = doctor.subspecialist?.name ??
|
||||
doctor.specialist?.name ??
|
||||
doctor.unit?.name ??
|
||||
'tidak diketahui'
|
||||
model.value!.unit_code = doctor.unit_code || ''
|
||||
model.value!.specialist_code = doctor.specialist_code || ''
|
||||
model.value!.subspecialist_code = doctor.subspecialist_code || ''
|
||||
},
|
||||
)
|
||||
// const doctorOpts = computed(() => {
|
||||
// const defaultOption = [{ label: 'Pilih', value: '' }]
|
||||
// const doctors = props.doctors || []
|
||||
// return [...defaultOption, ...doctors]
|
||||
// })
|
||||
// watch(doctorCode, (newValue) => {
|
||||
// // doctor.value = props.doctors?.find(doc => doc.code === newValue)
|
||||
// unitFullName.value = doctor.value?.subspecialist?.name ??
|
||||
// doctor.value?.specialist?.name ??
|
||||
// doctor.value?.unit?.name ??
|
||||
// 'tidak diketahui'
|
||||
// model.value!.responsible_doctor_code = doctor.value?.code
|
||||
// // const unitName = selectedDoctor?.specialist?.name || ''
|
||||
// // emit('event', 'unit-changed', unitName)
|
||||
// })
|
||||
|
||||
const isJKNPayment = computed(() => paymentType.value === 'jkn')
|
||||
const isJKNPayment = computed(() => paymentMethodCode.value === 'jkn')
|
||||
|
||||
async function onFetchChildren(parentId: string): Promise<void> {
|
||||
console.log('onFetchChildren', parentId)
|
||||
}
|
||||
// async function onFetchChildren(parentId: string): Promise<void> {
|
||||
// console.log('onFetchChildren', parentId)
|
||||
// }
|
||||
|
||||
// Watch specialist/subspecialist selection to fetch doctors
|
||||
watch(subSpecialistId, async (newValue) => {
|
||||
if (newValue) {
|
||||
console.log('SubSpecialist changed:', newValue)
|
||||
// Reset doctor selection
|
||||
doctorId.value = ''
|
||||
// Emit fetch event to parent
|
||||
emit('fetch', { subSpecialistId: newValue })
|
||||
}
|
||||
})
|
||||
// watch(subSpecialistCode, async (newValue) => {
|
||||
// if (newValue) {
|
||||
// console.log('SubSpecialist changed:', newValue)
|
||||
// // Reset doctor selection
|
||||
// doctorCode.value = ''
|
||||
// // Emit fetch event to parent
|
||||
// emit('fetch', { subSpecialistCode: newValue })
|
||||
// }
|
||||
// })
|
||||
|
||||
// Debounced SEP number watcher: emit change only after user stops typing
|
||||
const debouncedSepNumber = refDebounced(sepNumber, 500)
|
||||
@@ -100,25 +134,25 @@ watch(debouncedSepNumber, (newValue) => {
|
||||
})
|
||||
|
||||
// Sync props to form fields
|
||||
watch(
|
||||
() => props.objects,
|
||||
(objects) => {
|
||||
if (objects && Object.keys(objects).length > 0) {
|
||||
patientName.value = objects?.patientName || ''
|
||||
nationalIdentity.value = objects?.nationalIdentity || ''
|
||||
medicalRecordNumber.value = objects?.medicalRecordNumber || ''
|
||||
doctorId.value = objects?.doctorId || ''
|
||||
subSpecialistId.value = objects?.subSpecialistId || ''
|
||||
registerDate.value = objects?.registerDate || ''
|
||||
paymentType.value = objects?.paymentType || ''
|
||||
patientCategory.value = objects?.patientCategory || ''
|
||||
cardNumber.value = objects?.cardNumber || ''
|
||||
sepType.value = objects?.sepType || ''
|
||||
sepNumber.value = objects?.sepNumber || ''
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true },
|
||||
)
|
||||
// watch(
|
||||
// () => props.objects,
|
||||
// (objects) => {
|
||||
// if (objects && Object.keys(objects).length > 0) {
|
||||
// patientName.value = objects?.patientName || ''
|
||||
// nationalIdentity.value = objects?.nationalIdentity || ''
|
||||
// medicalRecordNumber.value = objects?.medicalRecordNumber || ''
|
||||
// doctorCode.value = objects?.doctorCode || ''
|
||||
// subSpecialistCode.value = objects?.subSpecialistCode || ''
|
||||
// registerDate.value = objects?.registerDate || ''
|
||||
// paymentMethodCode.value = objects?.paymentMethodCode || ''
|
||||
// patientCategory.value = objects?.patientCategory || ''
|
||||
// cardNumber.value = objects?.cardNumber || ''
|
||||
// sepType.value = objects?.sepType || ''
|
||||
// sepNumber.value = objects?.sepNumber || ''
|
||||
// }
|
||||
// },
|
||||
// { deep: true, immediate: true },
|
||||
// )
|
||||
|
||||
watch(
|
||||
() => props.patient,
|
||||
@@ -136,11 +170,11 @@ watch(
|
||||
function onAddSep() {
|
||||
const formValues = {
|
||||
patientId: patientId.value || '',
|
||||
doctorCode: doctorId.value,
|
||||
subSpecialistCode: subSpecialistId.value,
|
||||
doctorCode: doctorCode.value,
|
||||
// subSpecialistCode: subSpecialistCode.value,
|
||||
registerDate: registerDate.value,
|
||||
cardNumber: cardNumber.value,
|
||||
paymentType: paymentType.value,
|
||||
paymentMethodCode: paymentMethodCode.value,
|
||||
sepType: sepType.value
|
||||
}
|
||||
emit('event', 'add-sep', formValues)
|
||||
@@ -158,14 +192,14 @@ const formRef = ref<HTMLFormElement | null>(null)
|
||||
function submitForm() {
|
||||
console.log('🔵 submitForm called, formRef:', formRef.value)
|
||||
console.log('🔵 Form values:', {
|
||||
doctorId: doctorId.value,
|
||||
subSpecialistId: subSpecialistId.value,
|
||||
doctorCode: doctorCode.value,
|
||||
// subSpecialistCode: subSpecialistCode.value,
|
||||
registerDate: registerDate.value,
|
||||
paymentType: paymentType.value,
|
||||
paymentMethodCode: paymentMethodCode.value,
|
||||
})
|
||||
console.log('🔵 Form errors:', errors.value)
|
||||
console.log('🔵 Form meta:', meta.value)
|
||||
|
||||
|
||||
// Trigger form submit using native form submit
|
||||
// This will trigger validation and onSubmit handler
|
||||
if (formRef.value) {
|
||||
@@ -179,7 +213,7 @@ function submitForm() {
|
||||
preventDefault: () => {},
|
||||
target: formRef.value || {},
|
||||
} as SubmitEvent
|
||||
|
||||
|
||||
// Call onSubmit directly
|
||||
console.log('🔵 Calling onSubmit with mock event')
|
||||
onSubmit(mockEvent)
|
||||
@@ -231,149 +265,151 @@ defineExpose({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Block
|
||||
<DE.Block
|
||||
labelSize="thin"
|
||||
class="!pt-0"
|
||||
:colCount="3"
|
||||
:cellFlex="false"
|
||||
>
|
||||
<Cell>
|
||||
<Label height="compact">Nama Pasien</Label>
|
||||
<Field :errMessage="errors.patientName">
|
||||
<DE.Cell>
|
||||
<DE.Label height="compact">Nama Pasien</DE.Label>
|
||||
<DE.Field :errMessage="errors.patientName">
|
||||
<Input
|
||||
id="patientName"
|
||||
v-model="patientName"
|
||||
v-bind="patientNameAttrs"
|
||||
:disabled="true"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">NIK</Label>
|
||||
<Field :errMessage="errors.nationalIdentity">
|
||||
<DE.Cell>
|
||||
<DE.Label height="compact">NIK</DE.Label>
|
||||
<DE.Field :errMessage="errors.nationalIdentity">
|
||||
<Input
|
||||
id="nationalIdentity"
|
||||
v-model="nationalIdentity"
|
||||
v-bind="nationalIdentityAttrs"
|
||||
:disabled="true"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">No. RM</Label>
|
||||
<Field :errMessage="errors.medicalRecordNumber">
|
||||
<DE.Cell>
|
||||
<DE.Label height="compact">No. RM</DE.Label>
|
||||
<DE.Field :errMessage="errors.medicalRecordNumber">
|
||||
<Input
|
||||
id="medicalRecordNumber"
|
||||
v-model="medicalRecordNumber"
|
||||
v-bind="medicalRecordNumberAttrs"
|
||||
:disabled="true"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</Block>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</DE.Block>
|
||||
|
||||
<hr />
|
||||
|
||||
<!-- Data Kunjungan -->
|
||||
<h3 class="text-lg font-semibold">Data Kunjungan</h3>
|
||||
|
||||
<Block
|
||||
<DE.Block
|
||||
labelSize="thin"
|
||||
class="!pt-0"
|
||||
:colCount="3"
|
||||
:cellFlex="false"
|
||||
>
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
<DE.Cell>
|
||||
<DE.Label height="compact">
|
||||
Dokter
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.doctorId">
|
||||
<Combobox
|
||||
id="doctorId"
|
||||
v-model="doctorId"
|
||||
v-bind="doctorIdAttrs"
|
||||
:items="doctorOpts"
|
||||
</DE.Label>
|
||||
<DE.Field :errMessage="errors.doctor_code">
|
||||
<CB.Combobox
|
||||
id="doctorCode"
|
||||
v-model="doctorCode"
|
||||
v-bind="doctorCodeAttrs"
|
||||
:items="[...defaultCBItems, ...doctorItems]"
|
||||
:is-disabled="isLoading || isReadonly"
|
||||
placeholder="Pilih Dokter"
|
||||
search-placeholder="Cari Dokter"
|
||||
empty-message="Dokter tidak ditemukan"
|
||||
@update:model-value="(value) => emit('onSelectDoctor', value)"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
<DE.Cell>
|
||||
<DE.Label height="compact">
|
||||
Spesialis / Subspesialis
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.subSpecialistId">
|
||||
<TreeSelect
|
||||
id="subSpecialistId"
|
||||
v-model="subSpecialistId"
|
||||
v-bind="subSpecialistIdAttrs"
|
||||
</DE.Label>
|
||||
<DE.Field :errMessage="errors.unit_code">
|
||||
<Input :value="unitFullName"/>
|
||||
<!-- <TreeSelect
|
||||
id="subSpecialistCode"
|
||||
v-model="subSpecialistCode"
|
||||
v-bind="subSpecialistCodeAttrs"
|
||||
:data="specialists || []"
|
||||
:on-fetch-children="onFetchChildren"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</Block>
|
||||
/> -->
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</DE.Block>
|
||||
|
||||
<Block
|
||||
<DE.Block
|
||||
labelSize="thin"
|
||||
class="!pt-0"
|
||||
:colCount="3"
|
||||
:cellFlex="false"
|
||||
>
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
<DE.Cell>
|
||||
<DE.Label height="compact">
|
||||
Tanggal Daftar
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.registerDate">
|
||||
</DE.Label>
|
||||
<DE.Field :errMessage="errors.registerDate">
|
||||
<DatepickerSingle
|
||||
id="registerDate"
|
||||
v-model="registerDate"
|
||||
v-bind="registerDateAttrs"
|
||||
placeholder="Pilih tanggal"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
<DE.Cell>
|
||||
<DE.Label height="compact">
|
||||
Jenis Pembayaran
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.paymentType">
|
||||
<Select
|
||||
id="paymentType"
|
||||
v-model="paymentType"
|
||||
v-bind="paymentTypeAttrs"
|
||||
:items="payments"
|
||||
</DE.Label>
|
||||
<DE.Field :errMessage="errors.paymentMethod_code">
|
||||
<CB.Combobox
|
||||
id="paymentMethodCode"
|
||||
v-model="paymentMethodCode"
|
||||
v-bind="paymentMethodCodeAttrs"
|
||||
:items="paymentMethodItems"
|
||||
:disabled="isLoading || isReadonly"
|
||||
placeholder="Pilih Jenis Pembayaran"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</Block>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</DE.Block>
|
||||
|
||||
<!-- BPJS Fields (conditional) -->
|
||||
<template v-if="isJKNPayment">
|
||||
<Block
|
||||
<DE.Block
|
||||
labelSize="thin"
|
||||
class="!pt-0"
|
||||
:colCount="3"
|
||||
:cellFlex="false"
|
||||
>
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
<DE.Cell>
|
||||
<DE.Label height="compact">
|
||||
Kelompok Peserta
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.patientCategory">
|
||||
</DE.Label>
|
||||
<DE.Field :errMessage="errors.patientCategory">
|
||||
<Select
|
||||
id="patientCategory"
|
||||
v-model="patientCategory"
|
||||
@@ -382,15 +418,15 @@ defineExpose({
|
||||
:disabled="isLoading || isReadonly"
|
||||
placeholder="Pilih Kelompok Peserta"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
<DE.Cell>
|
||||
<DE.Label height="compact">
|
||||
No. Kartu BPJS
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.cardNumber">
|
||||
</DE.Label>
|
||||
<DE.Field :errMessage="errors.cardNumber">
|
||||
<Input
|
||||
id="cardNumber"
|
||||
v-model="cardNumber"
|
||||
@@ -398,15 +434,15 @@ defineExpose({
|
||||
:disabled="isLoading || isReadonly"
|
||||
placeholder="Masukkan nomor kartu BPJS"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
<DE.Cell>
|
||||
<DE.Label height="compact">
|
||||
Jenis SEP
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.sepType">
|
||||
</DE.Label>
|
||||
<DE.Field :errMessage="errors.sepType">
|
||||
<Select
|
||||
id="sepType"
|
||||
v-model="sepType"
|
||||
@@ -415,22 +451,22 @@ defineExpose({
|
||||
:disabled="isLoading || isReadonly"
|
||||
placeholder="Pilih Jenis SEP"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</Block>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</DE.Block>
|
||||
|
||||
<Block
|
||||
<DE.Block
|
||||
labelSize="thin"
|
||||
class="!pt-0"
|
||||
:colCount="3"
|
||||
:cellFlex="false"
|
||||
>
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
<DE.Cell>
|
||||
<DE.Label height="compact">
|
||||
No. SEP
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.sepNumber">
|
||||
</DE.Label>
|
||||
<DE.Field :errMessage="errors.sepNumber">
|
||||
<div class="flex gap-2">
|
||||
<Input
|
||||
id="sepNumber"
|
||||
@@ -474,8 +510,8 @@ defineExpose({
|
||||
/>
|
||||
</Button>
|
||||
</div>
|
||||
</Field>
|
||||
</Cell>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
|
||||
<FileUpload
|
||||
field-name="sepFile"
|
||||
@@ -492,7 +528,7 @@ defineExpose({
|
||||
:accept="['pdf', 'jpg', 'png']"
|
||||
:max-size-mb="1"
|
||||
/>
|
||||
</Block>
|
||||
</DE.Block>
|
||||
</template>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,499 @@
|
||||
<script setup lang="ts">
|
||||
// Components
|
||||
import Block from '~/components/pub/my-ui/doc-entry/block.vue'
|
||||
import Cell from '~/components/pub/my-ui/doc-entry/cell.vue'
|
||||
import Field from '~/components/pub/my-ui/doc-entry/field.vue'
|
||||
import Label from '~/components/pub/my-ui/doc-entry/label.vue'
|
||||
import { Button } from '~/components/pub/ui/button'
|
||||
import { Input } from '~/components/pub/ui/input'
|
||||
import Select from '~/components/pub/ui/select/Select.vue'
|
||||
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
|
||||
import DatepickerSingle from '~/components/pub/my-ui/datepicker/datepicker-single.vue'
|
||||
import TreeSelect from '~/components/pub/my-ui/select-tree/tree-select.vue'
|
||||
import FileUpload from '~/components/pub/my-ui/form/file-field.vue'
|
||||
|
||||
// Types
|
||||
import { IntegrationEncounterSchema, type IntegrationEncounterFormData } from '~/schemas/integration-encounter.schema'
|
||||
import type { PatientEntity } from '~/models/patient'
|
||||
import type { TreeItem } from '~/components/pub/my-ui/select-tree/type'
|
||||
|
||||
// Helpers
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { refDebounced } from '@vueuse/core'
|
||||
|
||||
const props = defineProps<{
|
||||
isLoading?: boolean
|
||||
isReadonly?: boolean
|
||||
isSepValid?: boolean
|
||||
isCheckingSep?: boolean
|
||||
doctor?: any[]
|
||||
subSpecialist?: any[]
|
||||
specialists?: TreeItem[]
|
||||
payments: any[]
|
||||
participantGroups?: any[]
|
||||
seps: any[]
|
||||
patient?: PatientEntity | null | undefined
|
||||
objects?: any
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'event', menu: string, value?: any): void
|
||||
(e: 'fetch', value?: any): void
|
||||
}>()
|
||||
|
||||
// Validation schema
|
||||
const { handleSubmit, errors, defineField, meta } = useForm<IntegrationEncounterFormData>({
|
||||
validationSchema: toTypedSchema(IntegrationEncounterSchema),
|
||||
})
|
||||
|
||||
// Bind fields and extract attrs
|
||||
const [doctorId, doctorIdAttrs] = defineField('doctorId')
|
||||
const [subSpecialistId, subSpecialistIdAttrs] = defineField('subSpecialistId')
|
||||
const [registerDate, registerDateAttrs] = defineField('registerDate')
|
||||
const [paymentType, paymentTypeAttrs] = defineField('paymentType')
|
||||
const [patientCategory, patientCategoryAttrs] = defineField('patientCategory')
|
||||
const [cardNumber, cardNumberAttrs] = defineField('cardNumber')
|
||||
const [sepType, sepTypeAttrs] = defineField('sepType')
|
||||
const [sepNumber, sepNumberAttrs] = defineField('sepNumber')
|
||||
const [patientName, patientNameAttrs] = defineField('patientName')
|
||||
const [nationalIdentity, nationalIdentityAttrs] = defineField('nationalIdentity')
|
||||
const [medicalRecordNumber, medicalRecordNumberAttrs] = defineField('medicalRecordNumber')
|
||||
const patientId = ref('')
|
||||
|
||||
const isLoading = props.isLoading !== undefined ? props.isLoading : false
|
||||
const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false
|
||||
|
||||
// SEP validation state from props
|
||||
const isSepValid = computed(() => props.isSepValid || false)
|
||||
const isCheckingSep = computed(() => props.isCheckingSep || false)
|
||||
|
||||
const doctorOpts = computed(() => {
|
||||
// Add default option
|
||||
const defaultOption = [{ label: 'Pilih', value: '' }]
|
||||
// Add doctors from props
|
||||
const doctors = props.doctor || []
|
||||
return [...defaultOption, ...doctors]
|
||||
})
|
||||
|
||||
const isJKNPayment = computed(() => paymentType.value === 'jkn')
|
||||
|
||||
async function onFetchChildren(parentId: string): Promise<void> {
|
||||
console.log('onFetchChildren', parentId)
|
||||
}
|
||||
|
||||
// Watch specialist/subspecialist selection to fetch doctors
|
||||
watch(subSpecialistId, async (newValue) => {
|
||||
if (newValue) {
|
||||
console.log('SubSpecialist changed:', newValue)
|
||||
// Reset doctor selection
|
||||
doctorId.value = ''
|
||||
// Emit fetch event to parent
|
||||
emit('fetch', { subSpecialistId: newValue })
|
||||
}
|
||||
})
|
||||
|
||||
// Debounced SEP number watcher: emit change only after user stops typing
|
||||
const debouncedSepNumber = refDebounced(sepNumber, 500)
|
||||
watch(debouncedSepNumber, (newValue) => {
|
||||
emit('event', 'sep-number-changed', newValue)
|
||||
})
|
||||
|
||||
// Sync props to form fields
|
||||
watch(
|
||||
() => props.objects,
|
||||
(objects) => {
|
||||
if (objects && Object.keys(objects).length > 0) {
|
||||
patientName.value = objects?.patientName || ''
|
||||
nationalIdentity.value = objects?.nationalIdentity || ''
|
||||
medicalRecordNumber.value = objects?.medicalRecordNumber || ''
|
||||
doctorId.value = objects?.doctorId || ''
|
||||
subSpecialistId.value = objects?.subSpecialistId || ''
|
||||
registerDate.value = objects?.registerDate || ''
|
||||
paymentType.value = objects?.paymentType || ''
|
||||
patientCategory.value = objects?.patientCategory || ''
|
||||
cardNumber.value = objects?.cardNumber || ''
|
||||
sepType.value = objects?.sepType || ''
|
||||
sepNumber.value = objects?.sepNumber || ''
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true },
|
||||
)
|
||||
|
||||
watch(
|
||||
() => props.patient,
|
||||
(patient) => {
|
||||
if (patient && Object.keys(patient).length > 0) {
|
||||
patientId.value = patient?.id ? String(patient.id) : ''
|
||||
patientName.value = patient?.person?.name || ''
|
||||
nationalIdentity.value = patient?.person?.residentIdentityNumber || ''
|
||||
medicalRecordNumber.value = patient?.number || ''
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true },
|
||||
)
|
||||
|
||||
function onAddSep() {
|
||||
const formValues = {
|
||||
patientId: patientId.value || '',
|
||||
doctorCode: doctorId.value,
|
||||
subSpecialistCode: subSpecialistId.value,
|
||||
registerDate: registerDate.value,
|
||||
cardNumber: cardNumber.value,
|
||||
paymentType: paymentType.value,
|
||||
sepType: sepType.value
|
||||
}
|
||||
emit('event', 'add-sep', formValues)
|
||||
}
|
||||
|
||||
// Submit handler
|
||||
const onSubmit = handleSubmit((values) => {
|
||||
console.log('✅ Validated form values:', JSON.stringify(values, null, 2))
|
||||
emit('event', 'save', values)
|
||||
})
|
||||
|
||||
// Expose submit method for parent component
|
||||
const formRef = ref<HTMLFormElement | null>(null)
|
||||
|
||||
function submitForm() {
|
||||
console.log('🔵 submitForm called, formRef:', formRef.value)
|
||||
console.log('🔵 Form values:', {
|
||||
doctorId: doctorId.value,
|
||||
subSpecialistId: subSpecialistId.value,
|
||||
registerDate: registerDate.value,
|
||||
paymentType: paymentType.value,
|
||||
})
|
||||
console.log('🔵 Form errors:', errors.value)
|
||||
console.log('🔵 Form meta:', meta.value)
|
||||
|
||||
// Trigger form submit using native form submit
|
||||
// This will trigger validation and onSubmit handler
|
||||
if (formRef.value) {
|
||||
console.log('🔵 Calling formRef.value.requestSubmit()')
|
||||
formRef.value.requestSubmit()
|
||||
} else {
|
||||
console.warn('⚠️ formRef.value is null, cannot submit form')
|
||||
// Fallback: directly call onSubmit handler
|
||||
// Create a mock event object
|
||||
const mockEvent = {
|
||||
preventDefault: () => {},
|
||||
target: formRef.value || {},
|
||||
} as SubmitEvent
|
||||
|
||||
// Call onSubmit directly
|
||||
console.log('🔵 Calling onSubmit with mock event')
|
||||
onSubmit(mockEvent)
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
submitForm,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mx-auto w-full">
|
||||
<form
|
||||
ref="formRef"
|
||||
@submit.prevent="onSubmit"
|
||||
class="grid gap-6 p-4"
|
||||
>
|
||||
<!-- Data Pasien -->
|
||||
<div class="flex flex-col gap-2">
|
||||
<h3 class="text-lg font-semibold">Data Pasien</h3>
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-sm">sudah pernah terdaftar sebagai pasien?</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
type="button"
|
||||
class="h-[40px] rounded-md border-orange-400 text-orange-400 hover:bg-green-50"
|
||||
@click="emit('event', 'search')"
|
||||
>
|
||||
<Icon
|
||||
name="i-lucide-search"
|
||||
class="h-5 w-5"
|
||||
/>
|
||||
Cari Pasien
|
||||
</Button>
|
||||
<span class="text-sm">belum pernah terdaftar sebagai pasien?</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
type="button"
|
||||
class="h-[40px] rounded-md border-orange-400 text-orange-400 hover:bg-green-50"
|
||||
@click="emit('event', 'add')"
|
||||
>
|
||||
<Icon
|
||||
name="i-lucide-plus"
|
||||
class="h-5 w-5"
|
||||
/>
|
||||
Tambah Pasien Baru
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Block
|
||||
labelSize="thin"
|
||||
class="!pt-0"
|
||||
:colCount="3"
|
||||
:cellFlex="false"
|
||||
>
|
||||
<Cell>
|
||||
<Label height="compact">Nama Pasien</Label>
|
||||
<Field :errMessage="errors.patientName">
|
||||
<Input
|
||||
id="patientName"
|
||||
v-model="patientName"
|
||||
v-bind="patientNameAttrs"
|
||||
:disabled="true"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">NIK</Label>
|
||||
<Field :errMessage="errors.nationalIdentity">
|
||||
<Input
|
||||
id="nationalIdentity"
|
||||
v-model="nationalIdentity"
|
||||
v-bind="nationalIdentityAttrs"
|
||||
:disabled="true"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">No. RM</Label>
|
||||
<Field :errMessage="errors.medicalRecordNumber">
|
||||
<Input
|
||||
id="medicalRecordNumber"
|
||||
v-model="medicalRecordNumber"
|
||||
v-bind="medicalRecordNumberAttrs"
|
||||
:disabled="true"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</Block>
|
||||
|
||||
<hr />
|
||||
|
||||
<!-- Data Kunjungan -->
|
||||
<h3 class="text-lg font-semibold">Data Kunjungan</h3>
|
||||
|
||||
<Block
|
||||
labelSize="thin"
|
||||
class="!pt-0"
|
||||
:colCount="3"
|
||||
:cellFlex="false"
|
||||
>
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
Dokter
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.doctorId">
|
||||
<Combobox
|
||||
id="doctorId"
|
||||
v-model="doctorId"
|
||||
v-bind="doctorIdAttrs"
|
||||
:items="doctorOpts"
|
||||
:is-disabled="isLoading || isReadonly"
|
||||
placeholder="Pilih Dokter"
|
||||
search-placeholder="Cari Dokter"
|
||||
empty-message="Dokter tidak ditemukan"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
Spesialis / Subspesialis
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.subSpecialistId">
|
||||
<TreeSelect
|
||||
id="subSpecialistId"
|
||||
v-model="subSpecialistId"
|
||||
v-bind="subSpecialistIdAttrs"
|
||||
:data="specialists || []"
|
||||
:on-fetch-children="onFetchChildren"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</Block>
|
||||
|
||||
<Block
|
||||
labelSize="thin"
|
||||
class="!pt-0"
|
||||
:colCount="3"
|
||||
:cellFlex="false"
|
||||
>
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
Tanggal Daftar
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.registerDate">
|
||||
<DatepickerSingle
|
||||
id="registerDate"
|
||||
v-model="registerDate"
|
||||
v-bind="registerDateAttrs"
|
||||
placeholder="Pilih tanggal"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
Jenis Pembayaran
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.paymentType">
|
||||
<Select
|
||||
id="paymentType"
|
||||
v-model="paymentType"
|
||||
v-bind="paymentTypeAttrs"
|
||||
:items="payments"
|
||||
:disabled="isLoading || isReadonly"
|
||||
placeholder="Pilih Jenis Pembayaran"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</Block>
|
||||
|
||||
<!-- BPJS Fields (conditional) -->
|
||||
<template v-if="isJKNPayment">
|
||||
<Block
|
||||
labelSize="thin"
|
||||
class="!pt-0"
|
||||
:colCount="3"
|
||||
:cellFlex="false"
|
||||
>
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
Kelompok Peserta
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.patientCategory">
|
||||
<Select
|
||||
id="patientCategory"
|
||||
v-model="patientCategory"
|
||||
v-bind="patientCategoryAttrs"
|
||||
:items="participantGroups || []"
|
||||
:disabled="isLoading || isReadonly"
|
||||
placeholder="Pilih Kelompok Peserta"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
No. Kartu BPJS
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.cardNumber">
|
||||
<Input
|
||||
id="cardNumber"
|
||||
v-model="cardNumber"
|
||||
v-bind="cardNumberAttrs"
|
||||
:disabled="isLoading || isReadonly"
|
||||
placeholder="Masukkan nomor kartu BPJS"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
Jenis SEP
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.sepType">
|
||||
<Select
|
||||
id="sepType"
|
||||
v-model="sepType"
|
||||
v-bind="sepTypeAttrs"
|
||||
:items="seps"
|
||||
:disabled="isLoading || isReadonly"
|
||||
placeholder="Pilih Jenis SEP"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
</Block>
|
||||
|
||||
<Block
|
||||
labelSize="thin"
|
||||
class="!pt-0"
|
||||
:colCount="3"
|
||||
:cellFlex="false"
|
||||
>
|
||||
<Cell>
|
||||
<Label height="compact">
|
||||
No. SEP
|
||||
<span class="text-red-500">*</span>
|
||||
</Label>
|
||||
<Field :errMessage="errors.sepNumber">
|
||||
<div class="flex gap-2">
|
||||
<Input
|
||||
id="sepNumber"
|
||||
v-model="sepNumber"
|
||||
v-bind="sepNumberAttrs"
|
||||
placeholder="Tambah SEP terlebih dahulu"
|
||||
class="flex-1"
|
||||
:disabled="isLoading || isReadonly"
|
||||
/>
|
||||
<Button
|
||||
v-if="!isSepValid"
|
||||
variant="outline"
|
||||
type="button"
|
||||
class="bg-primary"
|
||||
size="sm"
|
||||
:disabled="isCheckingSep || isLoading || isReadonly"
|
||||
@click="onAddSep"
|
||||
>
|
||||
<Icon
|
||||
v-if="isCheckingSep"
|
||||
name="i-lucide-loader-2"
|
||||
class="h-4 w-4 animate-spin"
|
||||
/>
|
||||
<Icon
|
||||
v-else
|
||||
name="i-lucide-plus"
|
||||
class="h-4 w-4"
|
||||
/>
|
||||
</Button>
|
||||
<Button
|
||||
v-else
|
||||
variant="outline"
|
||||
type="button"
|
||||
class="bg-green-500 text-white hover:bg-green-600"
|
||||
size="sm"
|
||||
disabled
|
||||
>
|
||||
<Icon
|
||||
name="i-lucide-check"
|
||||
class="h-4 w-4"
|
||||
/>
|
||||
</Button>
|
||||
</div>
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
<FileUpload
|
||||
field-name="sepFile"
|
||||
label="Dokumen SEP"
|
||||
placeholder="Unggah dokumen SEP"
|
||||
:accept="['pdf', 'jpg', 'png']"
|
||||
:max-size-mb="1"
|
||||
/>
|
||||
|
||||
<FileUpload
|
||||
field-name="sippFile"
|
||||
label="Dokumen SIPP"
|
||||
placeholder="Unggah dokumen SIPP"
|
||||
:accept="['pdf', 'jpg', 'png']"
|
||||
:max-size-mb="1"
|
||||
/>
|
||||
</Block>
|
||||
</template>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
@@ -7,17 +7,37 @@ const props = defineProps<{
|
||||
data: Encounter
|
||||
}>()
|
||||
|
||||
let address = ref('')
|
||||
if (props.data.patient.person.addresses) {
|
||||
address.value = props.data.patient.person.addresses.map((a) => a.address).join(', ')
|
||||
}
|
||||
const addressText = computed(() => {
|
||||
if (props.data.patient.person.addresses && props.data.patient.person.addresses.length > 0) {
|
||||
return props.data.patient.person.addresses.map((a) => a.address).join(', ')
|
||||
}
|
||||
return '-'
|
||||
})
|
||||
|
||||
let dpjp = ref('')
|
||||
const paymentMethodText = computed(() => {
|
||||
const code = props.data.paymentMethod_code
|
||||
if (!code) return '-'
|
||||
|
||||
// Map payment method codes
|
||||
if (code === 'insurance') {
|
||||
return 'JKN'
|
||||
} else if (code === 'jkn') {
|
||||
return 'JKN'
|
||||
} else if (code === 'jkmm') {
|
||||
return 'JKMM'
|
||||
} else if (code === 'spm') {
|
||||
return 'SPM'
|
||||
} else if (code === 'pks') {
|
||||
return 'PKS'
|
||||
}
|
||||
})
|
||||
|
||||
let dpjpText = ref('')
|
||||
if (props.data.responsible_doctor) {
|
||||
const dp = props.data.responsible_doctor.employee.person
|
||||
dpjp.value = `${dp.frontTitle} ${dp.name} ${dp.endTitle}`
|
||||
dpjpText.value = `${dp.frontTitle} ${dp.name} ${dp.endTitle}`
|
||||
} else if (props.data.appointment_doctor) {
|
||||
dpjp.value = props.data.appointment_doctor.employee.person.name
|
||||
dpjpText.value = props.data.appointment_doctor.employee.person.name
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -31,7 +51,7 @@ if (props.data.responsible_doctor) {
|
||||
<div>
|
||||
<DE.Block mode="preview">
|
||||
<DE.Cell>
|
||||
<DE.Label class="font-semibold">No. RM</DE.Label>
|
||||
<DE.Label class="font-semibold">Tgl. Lahir</DE.Label>
|
||||
<DE.Colon />
|
||||
<DE.Field>
|
||||
{{ data.patient.person.birthDate?.substring(0, 10) }}
|
||||
@@ -48,7 +68,7 @@ if (props.data.responsible_doctor) {
|
||||
<DE.Label class="font-semibold">Alamat</DE.Label>
|
||||
<DE.Colon />
|
||||
<DE.Field>
|
||||
<div v-html="address"></div>
|
||||
{{ addressText }}
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</DE.Block>
|
||||
@@ -70,7 +90,7 @@ if (props.data.responsible_doctor) {
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label position="dynamic" class="font-semibold">Klinik</DE.Label>
|
||||
<DE.Label position="dynamic" class="font-semibold">Diagnosa</DE.Label>
|
||||
<DE.Colon />
|
||||
<DE.Field>
|
||||
{{ data.unit?.name }}
|
||||
@@ -84,17 +104,21 @@ if (props.data.responsible_doctor) {
|
||||
<DE.Label position="dynamic" class="font-semibold">DPJP</DE.Label>
|
||||
<DE.Colon />
|
||||
<DE.Field>
|
||||
{{ dpjp }}
|
||||
{{ dpjpText }}
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label
|
||||
position="dynamic"
|
||||
class="!text-base font-semibold 2xl:!text-lg"
|
||||
>
|
||||
<DE.Label position="dynamic" class="font-semibold">Pembayaran</DE.Label>
|
||||
<DE.Colon />
|
||||
<DE.Field>
|
||||
{{ paymentMethodText }}
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
<DE.Cell>
|
||||
<DE.Label position="dynamic" class="!text-base !font-semibold 2xl:!text-lg">
|
||||
Billing
|
||||
</DE.Label>
|
||||
<DE.Colon class="pt-1" />
|
||||
<DE.Colon class="pt-1"/>
|
||||
<DE.Field class="text-base 2xl:text-lg">
|
||||
Rp. 000.000
|
||||
<!-- {{ data }} -->
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { cn } from '~/lib/utils';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
assesmentDate?: string
|
||||
class?: string
|
||||
}>(), {
|
||||
assesmentDate: new Date().toISOString(),
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :class="cn('flex items-center gap-3 p-3 rounded-md text-orange-500 border border-orange-400 bg-orange-50',
|
||||
props.class
|
||||
)">
|
||||
<Icon name="i-lucide-triangle-alert" class="h-9 w-9 align-middle transition-colors" />
|
||||
<p class="font-medium">Pasien telah mencapai atau telah melampaui jadwal Asesment pada
|
||||
<b>{{ new Date(props.assesmentDate).toDateString() }}</b>
|
||||
<br>
|
||||
Harap melakukan Re-Asement sebelum melanjutkan Protocol Therapy</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,21 @@
|
||||
<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<{
|
||||
|
||||
}>()
|
||||
const isModalOpen = inject<Ref<boolean>>('isHistoryDialogOpen')!
|
||||
|
||||
function openDialog() {
|
||||
isModalOpen.value = true
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Button type="button" variant="outline" class="text-orange-500 border border-orange-400 bg-orange-50"
|
||||
@click="openDialog">
|
||||
<Icon name="i-lucide-history" class="h-4 w-4 align-middle transition-colors" />
|
||||
History
|
||||
</Button>
|
||||
</template>
|
||||
@@ -0,0 +1,66 @@
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
rec: any
|
||||
idx?: number
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><b>S : </b></td>
|
||||
<td>{{ props.rec.result.s }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<Separator class="my-3" />
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><b>O : </b></td>
|
||||
<td>{{ props.rec.result.o }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<Separator class="my-3" />
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><b>A : </b></td>
|
||||
<td>{{ props.rec.result.a }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<Separator class="my-3" />
|
||||
<div>
|
||||
<h1><b>P : </b></h1>
|
||||
<ul class="pl-5 list-disc space-y-1">
|
||||
<li>
|
||||
<h1><b>Goal of Treatment</b></h1>
|
||||
<p>{{ props.rec.result.p.goal }}</p>
|
||||
</li>
|
||||
<li>
|
||||
<h1><b>Tindakan/Program Rehabilitasi Medik</b></h1>
|
||||
<p>{{ props.rec.result.p.action }}</p>
|
||||
</li>
|
||||
<li>
|
||||
<h1><b>Edukasi</b></h1>
|
||||
<p>{{ props.rec.result.p.education }}</p>
|
||||
</li>
|
||||
<li>
|
||||
<h1><b>Frekuensi Kunjungan</b></h1>
|
||||
<p>{{ props.rec.result.p.frequency }} x Perminggu</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<Separator class="my-3" />
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><b>Rencana Tindak Lanjut : </b></td>
|
||||
<td>{{ props.rec.result.plan }} - {{ props.rec.result.planDesc }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
@@ -0,0 +1,100 @@
|
||||
<script setup lang="ts">
|
||||
import { ActionEvents, type LinkItem, type ListItemDto } from '~/components/pub/my-ui/data/types';
|
||||
|
||||
|
||||
const props = defineProps<{
|
||||
rec: ListItemDto
|
||||
}>()
|
||||
|
||||
const { getActiveRole } = useUserStore()
|
||||
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 = computed(() => {
|
||||
const role = getActiveRole()
|
||||
const isAdmin = role == "system"
|
||||
const isDoctorRole = role == "emp|doc"
|
||||
const isPhysioRole = role == "emp|doc"
|
||||
const isUnverified = true // recItem.id === 0
|
||||
const isUnvalidated = true // recItem.id
|
||||
|
||||
const items: LinkItem[] = [
|
||||
{ label: 'Print', onClick: print, icon: 'i-lucide-printer', }
|
||||
]
|
||||
if (isDoctorRole || isAdmin) {
|
||||
items.push({ label: 'Edit', onClick: edit, icon: 'i-lucide-pencil', })
|
||||
|
||||
if (isUnverified) {
|
||||
items.push({ label: 'Verify', onClick: verify, icon: 'i-lucide-check', })
|
||||
}
|
||||
if (!isUnverified && isUnvalidated) { // verified & unvalidated
|
||||
items.push({ label: 'Validate', onClick: validate, icon: 'i-lucide-check-check', })
|
||||
}
|
||||
|
||||
items.push({ label: 'Delete', onClick: del, icon: 'i-lucide-trash', })
|
||||
}
|
||||
|
||||
return items
|
||||
})
|
||||
|
||||
function edit() {
|
||||
recId.value = props.rec.id || 0
|
||||
recAction.value = ActionEvents.showEdit
|
||||
recItem.value = props.rec
|
||||
timestamp.value = new Date().getTime()
|
||||
}
|
||||
|
||||
function verify() {
|
||||
recId.value = props.rec.id || 0
|
||||
recAction.value = ActionEvents.showVerify
|
||||
recItem.value = props.rec
|
||||
timestamp.value = new Date().getTime()
|
||||
}
|
||||
function validate() {
|
||||
recId.value = props.rec.id || 0
|
||||
recAction.value = ActionEvents.showValidate
|
||||
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
|
||||
timestamp.value = new Date().getTime()
|
||||
}
|
||||
function del() {
|
||||
recId.value = props.rec.id || 0
|
||||
recAction.value = ActionEvents.showConfirmDelete
|
||||
recItem.value = props.rec
|
||||
timestamp.value = new Date().getTime()
|
||||
}
|
||||
</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,93 @@
|
||||
<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 = [
|
||||
{ value: 'EVALUASI', label: 'Evaluasi' },
|
||||
{ value: 'RUJUK', label: 'Rujuk' },
|
||||
{ value: 'SELESAI', label: 'Selesai' },
|
||||
]
|
||||
</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,44 @@
|
||||
<script setup lang="ts">
|
||||
import { Badge } from '~/components/pub/ui/badge'
|
||||
|
||||
const props = defineProps<{
|
||||
rec: any
|
||||
idx?: number
|
||||
}>()
|
||||
|
||||
const verifyStatusCodes: Record<string, string> = {
|
||||
verified: 'Terverifikasi',
|
||||
unverified: 'Belum Verifikasi',
|
||||
}
|
||||
const validateStatusCodes: Record<string, string> = {
|
||||
validated: 'Tervalidasi',
|
||||
unvalidated: 'Belum Validasi',
|
||||
}
|
||||
|
||||
const verifyStatusText = computed(() => {
|
||||
const code: keyof typeof verifyStatusCodes = props.rec.status.verified === 1 ? `verified` : `unverified`
|
||||
return verifyStatusCodes[code]
|
||||
})
|
||||
const validateStatusText = computed(() => {
|
||||
const code: keyof typeof validateStatusCodes = props.rec.status.validated === 1 ? `validated` : `unvalidated`
|
||||
return validateStatusCodes[code]
|
||||
})
|
||||
|
||||
const verifyBadgeVariant = computed(() => {
|
||||
return props.rec.status.verified === 1 ? 'default' : 'outline'
|
||||
})
|
||||
const validateBadgeVariant = computed(() => {
|
||||
return props.rec.status.validated === 1 ? 'default' : 'outline'
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col gap-2 items-center justify-center">
|
||||
<Badge :variant="verifyBadgeVariant" class="w-fit rounded-2xl text-[0.6rem]" >
|
||||
{{ verifyStatusText }}
|
||||
</Badge>
|
||||
<Badge :variant="validateBadgeVariant" class="w-fit rounded-2xl text-[0.6rem]" >
|
||||
{{ validateStatusText }}
|
||||
</Badge>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,128 @@
|
||||
<script setup lang="ts">
|
||||
import type { FormErrors } from '~/types/error'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { Form } from '~/components/pub/ui/form'
|
||||
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 RadioFollowup from './_common/radio-followup.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">
|
||||
|
||||
<!-- FORM 1 -->
|
||||
<DE.Block :col-count="2" :cell-flex="false">
|
||||
<DE.Cell :col-span="2">
|
||||
<TextAreaInput
|
||||
field-name="subjective"
|
||||
label="Subjective"
|
||||
placeholder="Subjective"
|
||||
class="w-1/2"
|
||||
:errors="errors" />
|
||||
</DE.Cell>
|
||||
<DE.Cell :col-span="2" >
|
||||
<TextAreaInput
|
||||
field-name="objective"
|
||||
label="Objective"
|
||||
placeholder="Masukkan Objective"
|
||||
class="w-1/2"
|
||||
:errors="errors" />
|
||||
</DE.Cell>
|
||||
<DE.Cell :col-span="2">
|
||||
<TextAreaInput
|
||||
field-name="assesment"
|
||||
label="Assesment"
|
||||
placeholder="Masukkan Assesment"
|
||||
class="w-1/2"
|
||||
:errors="errors" />
|
||||
</DE.Cell>
|
||||
|
||||
<DE.Cell class="mt-2 px-4 bg-gray-50 border rounded-lg" :col-span="2">
|
||||
<DE.Block :col-count="2" :cell-flex="false">
|
||||
<TextAreaInput
|
||||
field-name="planningGoal"
|
||||
label="Goal of Treatment"
|
||||
placeholder="Masukkan Goal of Treatment"
|
||||
:errors="errors" />
|
||||
<TextAreaInput
|
||||
field-name="planningAction"
|
||||
label="Tindakan/Program Rehabilitasi Medik"
|
||||
placeholder="Masukkan Tindakan/Program Rehabilitasi Medik"
|
||||
:errors="errors" />
|
||||
<TextAreaInput
|
||||
field-name="planningEducation"
|
||||
label="Edukasi"
|
||||
placeholder="Masukkan Edukasi"
|
||||
:errors="errors" />
|
||||
<InputBase
|
||||
field-name="planningFrequency"
|
||||
label="Frekuensi Kunjungan"
|
||||
right-label="x Minggu"
|
||||
placeholder="Masukkan Frekuensi Kunjungan"
|
||||
:errors="errors"
|
||||
numeric-only
|
||||
is-disabled
|
||||
/>
|
||||
</DE.Block>
|
||||
</DE.Cell>
|
||||
|
||||
<DE.Cell :col-span="2">
|
||||
<RadioFollowup
|
||||
field-name="followUpPlan"
|
||||
label="Rencana Tindak Lanjut"
|
||||
:errors="errors"
|
||||
is-required
|
||||
/>
|
||||
<TextAreaInput
|
||||
label=""
|
||||
field-name="followUpPlanDesc"
|
||||
placeholder="Masukkan Keterangan rencana tindak lanjut"
|
||||
class="w-1/2 mt-3"
|
||||
:errors="errors" />
|
||||
</DE.Cell>
|
||||
|
||||
|
||||
|
||||
</DE.Block>
|
||||
</Form>
|
||||
</template>
|
||||
@@ -0,0 +1,60 @@
|
||||
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'))
|
||||
const resultData = defineAsyncComponent(() => import('./_common/card-result.vue'))
|
||||
const statusBadge = defineAsyncComponent(() => import('./_common/verify-badge.vue'))
|
||||
|
||||
export const config: Config = {
|
||||
cols: [{}, { width: 800 }, {}, { width: 120 }, { width: 3 },],
|
||||
|
||||
headers: [
|
||||
[
|
||||
{ label: 'Tanggal' },
|
||||
{ label: 'Hasil Asesmen Pasien Dan Pemberian Pelayanan' },
|
||||
{ label: 'Jenis Form' },
|
||||
{ label: 'Status' },
|
||||
{ label: 'Action' },
|
||||
],
|
||||
],
|
||||
|
||||
keys: ['date', 'result', 'type', 'status', 'action'],
|
||||
|
||||
parses: {
|
||||
date: (rec: unknown): unknown => {
|
||||
const date = (rec as any).date
|
||||
|
||||
if (typeof date == 'object' && date) {
|
||||
return (date as Date).toLocaleDateString('id-ID')
|
||||
} else if (typeof date == 'string') {
|
||||
return (date as string).substring(0, 10)
|
||||
}
|
||||
return date
|
||||
},
|
||||
},
|
||||
|
||||
components: {
|
||||
result(rec, idx) {
|
||||
return {
|
||||
idx,
|
||||
rec: rec as object,
|
||||
component: resultData,
|
||||
}
|
||||
},
|
||||
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,61 @@
|
||||
<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
|
||||
dateValue: DateRange
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
const df = new DateFormatter('en-US', { dateStyle: 'medium',})
|
||||
|
||||
const emit = defineEmits<{
|
||||
pageChange: [page: number]
|
||||
'update:dateValue': [value: DateRange]
|
||||
}>()
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
emit('pageChange', page)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-4">
|
||||
<Popover>
|
||||
<PopoverTrigger as-child>
|
||||
<Button variant="outline" :class="cn('mb-1 w-[280px] justify-start text-left font-normal',
|
||||
!props.dateValue && 'text-muted-foreground')">
|
||||
<CalendarIcon class="mr-2 h-4 w-4" />
|
||||
<template v-if="props.dateValue.start">
|
||||
<template v-if="props.dateValue.end">
|
||||
{{ df.format(props.dateValue.start.toDate(getLocalTimeZone())) }} -
|
||||
{{ df.format(props.dateValue.end.toDate(getLocalTimeZone())) }}
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
{{ df.format(props.dateValue.start.toDate(getLocalTimeZone())) }}
|
||||
</template>
|
||||
</template>
|
||||
<template v-else> Pick a date </template>
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent class="w-auto p-0">
|
||||
<RangeCalendar v-model="props.dateValue" initial-focus :number-of-months="2"
|
||||
@update:model-value="(date) => emit('update:dateValue', date)" />
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
|
||||
<PubMyUiDataTable
|
||||
v-bind="config"
|
||||
:rows="data"
|
||||
:skeleton-size="paginationMeta?.pageSize"
|
||||
/>
|
||||
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,59 @@
|
||||
import type { Config } from '~/components/pub/my-ui/data-table'
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
|
||||
const action = defineAsyncComponent(() => import('./_common/dropdown-action.vue'))
|
||||
const statusBadge = defineAsyncComponent(() => import('./_common/verify-badge.vue'))
|
||||
const resultData = defineAsyncComponent(() => import('./_common/card-result.vue'))
|
||||
|
||||
export const config: Config = {
|
||||
cols: [{}, { width: 800 }, {}, { width: 120 }, { width: 3 },],
|
||||
|
||||
headers: [
|
||||
[
|
||||
{ label: 'Tanggal' },
|
||||
{ label: 'Hasil Asesmen Pasien Dan Pemberian Pelayanan' },
|
||||
{ label: 'Jenis Form' },
|
||||
{ label: 'Status' },
|
||||
{ label: 'Action' },
|
||||
],
|
||||
],
|
||||
|
||||
keys: ['date', 'result', 'type', 'status', 'action'],
|
||||
|
||||
parses: {
|
||||
date: (rec: unknown): unknown => {
|
||||
const date = (rec as any).date
|
||||
|
||||
if (typeof date == 'object' && date) {
|
||||
return (date as Date).toLocaleDateString('id-ID')
|
||||
} else if (typeof date == 'string') {
|
||||
return (date as string).substring(0, 10)
|
||||
}
|
||||
return date
|
||||
},
|
||||
},
|
||||
|
||||
components: {
|
||||
result(rec, idx) {
|
||||
return {
|
||||
idx,
|
||||
rec: rec as object,
|
||||
component: resultData,
|
||||
}
|
||||
},
|
||||
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,14 @@
|
||||
<script setup lang="ts">
|
||||
import { config } from './list.cfg'
|
||||
|
||||
interface Props {
|
||||
data: any[]
|
||||
}
|
||||
defineProps<Props>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-4">
|
||||
<PubMyUiDataTable v-bind="config" :rows="data" />
|
||||
</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 '~/components/pub/my-ui/form/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>
|
||||
@@ -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,21 @@
|
||||
<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<{
|
||||
|
||||
}>()
|
||||
const isModalOpen = inject<Ref<boolean>>('isHistoryDialogOpen')!
|
||||
|
||||
function openDialog() {
|
||||
isModalOpen.value = true
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Button type="button" variant="outline" class="text-orange-500 border border-orange-400 bg-orange-50"
|
||||
@click="openDialog">
|
||||
<Icon name="i-lucide-history" class="h-4 w-4 align-middle transition-colors" />
|
||||
History
|
||||
</Button>
|
||||
</template>
|
||||
@@ -0,0 +1,73 @@
|
||||
<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 { cn } from '~/lib/utils'
|
||||
|
||||
interface InstallationFormData {
|
||||
name: string
|
||||
code: string
|
||||
encounterClassCode: string
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
schema: any
|
||||
initialValues?: Partial<InstallationFormData>
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
submit: [values: InstallationFormData, resetForm: () => void]
|
||||
reset: [resetForm: () => void]
|
||||
}>()
|
||||
|
||||
// Form submission handler
|
||||
function onSubmitForm(values: any, { resetForm }: { resetForm: () => void }) {
|
||||
emit('submit', values, resetForm)
|
||||
}
|
||||
|
||||
// Form cancel handler
|
||||
function onResetForm({ resetForm }: { resetForm: () => void }) {
|
||||
emit('reset', resetForm)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form
|
||||
v-slot="{ handleSubmit, resetForm }"
|
||||
as=""
|
||||
keep-values
|
||||
:initial-values="initialValues"
|
||||
>
|
||||
<form id="entry-form" @submit="handleSubmit($event, (values) => onSubmitForm(values, { resetForm }))">
|
||||
<div class="mb-5 border-b border-b-slate-300 pb-7 text-lg xl:text-xl">
|
||||
<div class="flex flex-col justify-between">
|
||||
<InputBase
|
||||
field-name="patientName"
|
||||
label="Nama Pasien"
|
||||
placeholder="Nama Pasien"
|
||||
/>
|
||||
<InputBase
|
||||
field-name="cardNumber"
|
||||
label="Nomor Kartu"
|
||||
placeholder="Nomor Kartu"
|
||||
/>
|
||||
<InputBase
|
||||
field-name="sepNumber"
|
||||
label="Nomor SEP"
|
||||
placeholder="Nomor SEP"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="my-2 flex items-center gap-3 justify-end">
|
||||
<Button @click="onResetForm" variant="secondary">Reset</Button>
|
||||
<Button @click="onSubmitForm">Terapkan</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
</template>
|
||||
@@ -0,0 +1,52 @@
|
||||
<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 SelectOriginPolyclinic from '~/components/app/bpjs/control-letter/_common/select-origin-polyclinic.vue'
|
||||
import SelectDestinationPolyclinic from '~/components/app/bpjs/control-letter/_common/select-destination-polyclinic.vue'
|
||||
import { cn } from '~/lib/utils'
|
||||
|
||||
const props = defineProps()
|
||||
|
||||
const items = reactive([
|
||||
{ id: 1, updatedBy: 'Kakek Sugiono', createdAt: new Date(Date.now() - 86400000 * 2) },
|
||||
{ id: 2, updatedBy: 'Kakek Sugiono', createdAt: new Date(Date.now() - 86400000) },
|
||||
{ id: 3, updatedBy: 'Kakek Sugiono', createdAt: new Date() },
|
||||
])
|
||||
const itemsCount = computed(() => items.length || 0)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ul :class="cn('pb-5 flex flex-col min-h-[30rem]', '')">
|
||||
<li v-for="(item, index) in items" :key="item.id" class="flex gap-3 items-start">
|
||||
|
||||
<div class="flex flex-col items-center">
|
||||
<div class="h-5 w-5 rounded-full border-2 border-gray-300 flex items-center justify-center">
|
||||
<div :class="cn('dark:bg-white border-gray-300 rounded-full p-1.5',
|
||||
index === 0 ? 'bg-green-500' : 'bg-transparent'
|
||||
)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr v-if="index !== itemsCount - 1" class="h-14 w-0.5 bg-gray-300 dark:bg-gray-300" aria-hidden="true">
|
||||
</div>
|
||||
|
||||
<div class="flex justify-between items-center min-w-96">
|
||||
<div class="max-w-80">
|
||||
<time :class="cn('mt-0 text-base font-medium text-gray-800 dark:text-gray-100', '')">
|
||||
{{ item?.createdAt.toLocaleDateString('id-ID') }}
|
||||
</time>
|
||||
<h1 :class="cn('text-gray-500 dark:text-gray-400', '')">Ditambahkan Oleh : {{ item.updatedBy }}</h1>
|
||||
<NuxtLink class="mt-1 text-orange-500" :to="`surgery-report/${item.id}`">
|
||||
Lihat Detail
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
@@ -0,0 +1,94 @@
|
||||
<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: 'PRC', value: 'prc' },
|
||||
{ label: 'FFP', value: 'ffp' },
|
||||
{ label: 'WB', value: 'wb' },
|
||||
{ label: 'TC', value: 'tc' },
|
||||
]
|
||||
</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,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, BillingCodeTypeOptList } from '~/lib/constants'
|
||||
import { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import type { Item } from '~/components/pub/my-ui/combobox'
|
||||
|
||||
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
|
||||
|
||||
const itemList = computed<Array<Item>>(() => BillingCodeTypeOptList)
|
||||
</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="itemList"
|
||||
: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, BirthDescriptionTypeOptList } from '~/lib/constants'
|
||||
import { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import type { Item } from '~/components/pub/my-ui/combobox'
|
||||
|
||||
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
|
||||
|
||||
const itemList = computed<Array<Item>>(() => BirthDescriptionTypeOptList)
|
||||
</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="itemList"
|
||||
: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, BirthPlaceDescriptionTypeOptList } from '~/lib/constants'
|
||||
import { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import type { Item } from '~/components/pub/my-ui/combobox'
|
||||
|
||||
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
|
||||
|
||||
const itemList = computed<Array<Item>>(() => BirthPlaceDescriptionTypeOptList)
|
||||
</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="itemList"
|
||||
:placeholder="placeholder"
|
||||
search-placeholder="Cari..."
|
||||
empty-message="Data tidak ditemukan"
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
</FormField>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</template>
|
||||
@@ -0,0 +1,117 @@
|
||||
<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
|
||||
isWithTime?: boolean
|
||||
}>()
|
||||
|
||||
const {
|
||||
fieldName = 'birthDate',
|
||||
label = 'Tanggal Lahir',
|
||||
placeholder = 'Pilih tanggal lahir',
|
||||
errors,
|
||||
class: containerClass,
|
||||
fieldGroupClass,
|
||||
labelClass,
|
||||
} = 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"
|
||||
>
|
||||
{{ 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="props.isWithTime ? 'datetime-local' : 'date'"
|
||||
min="1900-01-01"
|
||||
v-bind="componentField"
|
||||
:placeholder="placeholder"
|
||||
@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, DissectionTypeOptList } from '~/lib/constants'
|
||||
import { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import type { Item } from '~/components/pub/my-ui/combobox'
|
||||
|
||||
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
|
||||
|
||||
const itemList = computed<Array<Item>>(() => DissectionTypeOptList)
|
||||
</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="itemList"
|
||||
:placeholder="placeholder"
|
||||
search-placeholder="Cari..."
|
||||
empty-message="Data tidak ditemukan"
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
</FormField>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</template>
|
||||
@@ -0,0 +1,87 @@
|
||||
<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 { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import type { Item } from '~/components/pub/my-ui/combobox'
|
||||
|
||||
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
|
||||
|
||||
const doctors = ref<Array<Item>>([])
|
||||
|
||||
async function fetchDpjp() {
|
||||
doctors.value = await getDoctorLabelList({
|
||||
serviceType: 1,
|
||||
serviceDate: new Date().toISOString().substring(0, 10),
|
||||
includes: 'employee-person',
|
||||
}, true)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchDpjp()
|
||||
})
|
||||
|
||||
// function handleDpjpChange(selected: string) {
|
||||
// selectedDpjpId.value = selected ?? null
|
||||
// }
|
||||
</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="doctors"
|
||||
:placeholder="placeholder"
|
||||
search-placeholder="Cari..."
|
||||
empty-message="Data tidak ditemukan"
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
</FormField>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</template>
|
||||
@@ -0,0 +1,87 @@
|
||||
<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 { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import type { Item } from '~/components/pub/my-ui/combobox'
|
||||
|
||||
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
|
||||
|
||||
const doctors = ref<Array<Item>>([])
|
||||
|
||||
async function fetchDpjp() {
|
||||
doctors.value = await getDoctorLabelList({
|
||||
serviceType: 1,
|
||||
serviceDate: new Date().toISOString().substring(0, 10),
|
||||
includes: 'employee-person',
|
||||
}, true)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchDpjp()
|
||||
})
|
||||
|
||||
// function handleDpjpChange(selected: string) {
|
||||
// selectedDpjpId.value = selected ?? null
|
||||
// }
|
||||
</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="doctors"
|
||||
: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, SpecimenTypeOptList } from '~/lib/constants'
|
||||
import { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import type { Item } from '~/components/pub/my-ui/combobox'
|
||||
|
||||
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
|
||||
|
||||
const itemList = computed<Array<Item>>(() => SpecimenTypeOptList)
|
||||
</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="itemList"
|
||||
: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, SurgeryOrderTypeOptList } from '~/lib/constants'
|
||||
import { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import type { Item } from '~/components/pub/my-ui/combobox'
|
||||
|
||||
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
|
||||
|
||||
const itemList = computed<Array<Item>>(() => SurgeryOrderTypeOptList)
|
||||
</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="itemList"
|
||||
: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, SurgerySystemTypeOptList } from '~/lib/constants'
|
||||
import { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import type { Item } from '~/components/pub/my-ui/combobox'
|
||||
|
||||
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
|
||||
|
||||
const itemList = computed<Array<Item>>(() => SurgerySystemTypeOptList)
|
||||
</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="itemList"
|
||||
: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, SurgeryTypeOptList } from '~/lib/constants'
|
||||
import { getValueLabelList as getDoctorLabelList } from '~/services/doctor.service'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import type { Item } from '~/components/pub/my-ui/combobox'
|
||||
|
||||
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
|
||||
|
||||
const itemList = computed<Array<Item>>(() => SurgeryTypeOptList)
|
||||
</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="itemList"
|
||||
:placeholder="placeholder"
|
||||
search-placeholder="Cari..."
|
||||
empty-message="Data tidak ditemukan"
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
</FormField>
|
||||
</DE.Field>
|
||||
</DE.Cell>
|
||||
</template>
|
||||
@@ -0,0 +1,144 @@
|
||||
<script setup lang="ts">
|
||||
import DetailRow from '~/components/pub/my-ui/form/view/detail-row.vue'
|
||||
import { type Variants, Badge } from '~/components/pub/ui/badge'
|
||||
import { cn, } from '~/lib/utils'
|
||||
import type { ControlLetter } from '~/models/control-letter'
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
instance: ControlLetter | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'click'): void
|
||||
}>()
|
||||
|
||||
const dummy = [
|
||||
{
|
||||
id: 1,
|
||||
number: 1,
|
||||
name: 'Operasi',
|
||||
code: 'OP-001'
|
||||
}
|
||||
]
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region State & Computed
|
||||
// #endregion
|
||||
|
||||
// Computed addresses from nested data
|
||||
// #endregion
|
||||
|
||||
// #region Lifecycle Hooks
|
||||
// #endregion
|
||||
|
||||
// #region Functions
|
||||
|
||||
// #endregion region
|
||||
|
||||
// #region Utilities & event handlers
|
||||
function onClick() {
|
||||
emit('click')
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region Watchers
|
||||
// #endregion
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<article :class="cn('space-y-10',)">
|
||||
<div :class="cn('space-y-2',)">
|
||||
<h1>Dibuat oleh {{ `Dr. Agus` }} pada {{ `11 Agustus 2025, 20.00` }}</h1>
|
||||
<DetailRow label="Tanggal Laporan">{{ props.instance?.date ? new
|
||||
Date(props.instance?.date).toLocaleDateString('id-ID') : '-' }}</DetailRow>
|
||||
</div>
|
||||
<div :class="cn('space-y-2',)">
|
||||
<h1 class="font-semibold text-lg">Tim Pelaksanaan Operasi</h1>
|
||||
<DetailRow label="DPJP Bedah">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Operator">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Asisten Operator">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Instrumentir">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="DPJP Anastesi">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Perawat Anastesi">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Tanggal Pembedahan">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Diagnosa Pra Bedah">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Perawat Pasca Bedah">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
</div>
|
||||
|
||||
<div :class="cn('space-y-2',)">
|
||||
<h1 class="font-semibold text-lg">Tindakan Operatif / Non Operatif Lain</h1>
|
||||
<div class="border border-gray-200 rounded-lg overflow-hidden">
|
||||
<Table>
|
||||
<TableHeader class="bg-gray-100">
|
||||
<TableRow>
|
||||
<TableHead class="w-14">No</TableHead>
|
||||
<TableHead class="">Prosedur</TableHead>
|
||||
<TableHead class="">Code</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-for="(field, idx) in dummy" :key="idx">
|
||||
<TableCell class="">{{ idx + 1 }}</TableCell>
|
||||
<TableCell class="">{{ field.name }}</TableCell>
|
||||
<TableCell class="">{{ field.code }}</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div :class="cn('space-y-2',)">
|
||||
<h1 class="font-semibold text-lg">Data Pelaksanaan Operasi</h1>
|
||||
<DE.Block :col-count="2" :cell-flex="false">
|
||||
<div>
|
||||
<DetailRow label="Jenis Operasi">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Kode Biling">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Sitem Operasi">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Operasi Mulai">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Operasi Selesai">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Lama Operasi"><b>{{ 1 }}</b> Jam <b>{{ 1 }}</b> Menit</DetailRow>
|
||||
<DetailRow label="Pembiusan Mulai">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Pembiusan Selesai">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Lama Pembiusan"><b>{{ 1 }}</b> Jam <b>{{ 1 }}</b> Menit</DetailRow>
|
||||
</div>
|
||||
<div>
|
||||
<DetailRow label="Jenis Pembedahan">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Operasi ke">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Keterangan Lahir">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Ket Tempat Lahir">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Berat Badan">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Ket Saat Lahir">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Uraian Operasi">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Jumlah Pendarahan">{{ props.instance?.date ? props.instance?.date : '-' }} CC</DetailRow>
|
||||
</div>
|
||||
<div>
|
||||
<DetailRow label="PRC">{{ props.instance?.date ? props.instance?.date : '-' }} CC</DetailRow>
|
||||
<DetailRow label="FPP">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="WB">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="TC">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Merk">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Nama Implant">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Stiker/Nomor Register Implant">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Nama Pendamping Implant">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
</div>
|
||||
<div>
|
||||
<DetailRow label-class="w-96" label="Specimen/Jaringan dikirim ke">{{ props.instance?.date ? props.instance?.date : '-' }}</DetailRow>
|
||||
<DetailRow label="Keterangan Jaringan">
|
||||
<Badge :variant="`outline`">
|
||||
{{ `Example` }}
|
||||
</Badge>
|
||||
</DetailRow>
|
||||
</div>
|
||||
</DE.Block>
|
||||
</div>
|
||||
|
||||
<div class="border-t-1 my-2 flex justify-end border-t-slate-300 py-2">
|
||||
<PubMyUiNavFooterBa @click="onClick" />
|
||||
</div>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -0,0 +1,259 @@
|
||||
<script setup lang="ts">
|
||||
import type { FormErrors } from '~/types/error'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { Form } from '~/components/pub/ui/form'
|
||||
import SelectDate from './_common/select-date.vue'
|
||||
import InputBase from '~/components/pub/my-ui/form/input-base.vue'
|
||||
import { FieldArray } from 'vee-validate'
|
||||
|
||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||
import SelectDpjpBedah from './_common/select-dpjp-bedah.vue'
|
||||
import SelectDpjpAnastesi from './_common/select-dpjp-anastesi.vue'
|
||||
import SelectSurgeryType from './_common/select-surgery-type.vue'
|
||||
import SelectBillingCode from './_common/select-billing-code.vue'
|
||||
import SelectSurgerySystemType from './_common/select-surgery-system-type.vue'
|
||||
import SelectDissectionType from './_common/select-dissection-type.vue'
|
||||
import SelectSurgeryOrder from './_common/select-surgery-order.vue'
|
||||
import SelectBirthDesc from './_common/select-birth-desc.vue'
|
||||
import SelectBirthPlaceDesc from './_common/select-birth-place-desc.vue'
|
||||
import SelectSpecimenType from './_common/select-specimen-type.vue'
|
||||
import TextAreaInput from '~/components/pub/my-ui/form/text-area-input.vue'
|
||||
import RadioBloodType from './_common/radio-blood-type.vue'
|
||||
import OperativeActionPicker from './operative-action/picker-dialog.vue'
|
||||
|
||||
const props = defineProps<{
|
||||
schema: any
|
||||
initialValues?: any
|
||||
errors?: FormErrors
|
||||
operativeActionList?: any[]
|
||||
}>()
|
||||
|
||||
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 : {}"
|
||||
>
|
||||
<DE.Block :col-count="4" :cell-flex="false">
|
||||
<SelectDpjpBedah :errors="errors"
|
||||
field-name="a1"
|
||||
label="DPJP Bedah" placeholder="Pilih DPJP Bedah"
|
||||
is-required
|
||||
/>
|
||||
<InputBase :errors="errors"
|
||||
field-name="a2"
|
||||
label="Operator" placeholder="Isi Operator"
|
||||
/>
|
||||
<InputBase :errors="errors"
|
||||
field-name="a3"
|
||||
label="Asisten Operator" placeholder="Isi Asisten Operator"
|
||||
/>
|
||||
<InputBase :errors="errors"
|
||||
field-name="a4"
|
||||
label="Instrumentir" placeholder="Isi Instrumentir"
|
||||
/>
|
||||
<SelectDpjpAnastesi :errors="errors"
|
||||
field-name="a5"
|
||||
label="DPJP Anastesi" placeholder="Pilih DPJP Anastesi"
|
||||
is-required
|
||||
/>
|
||||
<InputBase :errors="errors"
|
||||
field-name="a6"
|
||||
label="Perawatan Anastesi" placeholder="Isi Perawatan Anastesi"
|
||||
/>
|
||||
<SelectDate
|
||||
field-name="a7"
|
||||
label="Tanggal Pembedahan"
|
||||
:errors="errors"
|
||||
is-required
|
||||
/>
|
||||
</DE.Block>
|
||||
<DE.Block :col-count="4" :cell-flex="false">
|
||||
<DE.Cell :col-span="2">
|
||||
<TextAreaInput :errors="errors"
|
||||
field-name="a8"
|
||||
label="Diagnosa Pra Bedah" placeholder="Isi Diagnosa Pra Bedah"
|
||||
is-required
|
||||
/>
|
||||
</DE.Cell>
|
||||
<InputBase :errors="errors"
|
||||
field-name="a9"
|
||||
label="Perawat Pasca Bedah" placeholder="Isi Perawat Pasca Bedah"
|
||||
/>
|
||||
</DE.Block>
|
||||
|
||||
<!-- PICKER -->
|
||||
<DE.Block :col-count="1" :cell-flex="false" class="w-1/2">
|
||||
<OperativeActionPicker field-name="a63" title="Prosedur" />
|
||||
</DE.Block>
|
||||
<!-- -->
|
||||
|
||||
<DE.Block :col-count="3" :cell-flex="false">
|
||||
<SelectSurgeryType :errors="errors"
|
||||
field-name="a10"
|
||||
label="Jenis Operasi" placeholder="Pilih Jenis Operasi"
|
||||
is-required
|
||||
/>
|
||||
<SelectBillingCode :errors="errors"
|
||||
field-name="a11"
|
||||
label="Kode Billing" placeholder="Pilih Kode Billing"
|
||||
is-required
|
||||
/>
|
||||
<SelectSurgerySystemType :errors="errors"
|
||||
field-name="a12"
|
||||
label="Sistem Operasi" placeholder="Pilih Sistem Operasi"
|
||||
is-required
|
||||
/>
|
||||
<SelectDate :errors="errors"
|
||||
field-name="a7"
|
||||
label="Operasi Mulai"
|
||||
is-required
|
||||
is-with-time
|
||||
/>
|
||||
<SelectDate :errors="errors"
|
||||
field-name="a7"
|
||||
label="Operasi Selesai"
|
||||
is-required
|
||||
is-with-time
|
||||
/>
|
||||
<div>
|
||||
<p class="mt-1.5 mb-2">Lama Operasi</p>
|
||||
<h1 class="text-base"><b>{{ 1 }}</b> Jam <b>{{ 1 }}</b> Menit</h1>
|
||||
</div>
|
||||
<SelectDate :errors="errors"
|
||||
field-name="a44"
|
||||
label="Pembiusan Mulai"
|
||||
is-required
|
||||
is-with-time
|
||||
/>
|
||||
<SelectDate :errors="errors"
|
||||
field-name="a45"
|
||||
label="Pembiusan Selesai"
|
||||
is-required
|
||||
is-with-time
|
||||
/>
|
||||
<div>
|
||||
<p class="mt-1.5 mb-2">Lama Pembiusan</p>
|
||||
<h1 class="text-base"><b>{{ 1 }}</b> Jam <b>{{ 1 }}</b> Menit</h1>
|
||||
</div>
|
||||
<SelectDissectionType :errors="errors"
|
||||
field-name="a13"
|
||||
label="Jenis Pembedahan" placeholder="Pilih Jenis Pembedahan"
|
||||
is-required
|
||||
/>
|
||||
<SelectSurgeryOrder :errors="errors"
|
||||
field-name="a14"
|
||||
label="Urutan Operasi Ke" placeholder="Pilih Urutan Operasi Ke"
|
||||
is-required
|
||||
/>
|
||||
<SelectBirthDesc :errors="errors"
|
||||
field-name="a15"
|
||||
label="Ket. Lahir" placeholder="Pilih Ket. Lahir"
|
||||
is-required
|
||||
/>
|
||||
<SelectBirthPlaceDesc :errors="errors"
|
||||
field-name="a16"
|
||||
label="Ket. Tempat Lahir" placeholder="Pilih Ket. Tempat Lahir"
|
||||
is-required
|
||||
/>
|
||||
<InputBase :errors="errors"
|
||||
field-name="a6"
|
||||
label="Berat Badan" placeholder="Isi Berat Badan"
|
||||
right-label="Gram"
|
||||
numeric-only
|
||||
/>
|
||||
<InputBase :errors="errors"
|
||||
field-name="a6"
|
||||
label="Ket. Saat Lahir" placeholder="Isi Ket. Saat Lahir"
|
||||
/>
|
||||
<TextAreaInput :errors="errors"
|
||||
field-name="a8"
|
||||
label="Uraian Operasi" placeholder="Isi Uraian Operasi"
|
||||
is-required
|
||||
/>
|
||||
<InputBase :errors="errors"
|
||||
field-name="a6"
|
||||
label="Jumlah Pendarahan" placeholder="Isi Jumlah Pendarahan"
|
||||
right-label="cc"
|
||||
numeric-only
|
||||
/>
|
||||
</DE.Block>
|
||||
|
||||
|
||||
<DE.Block :col-count="1" :cell-flex="false" class="w-1/2">
|
||||
<RadioBloodType :errors="errors"
|
||||
field-name="a16"
|
||||
label="Jenis Darah Masuk" placeholder="Pilih Jenis Darah Masuk"
|
||||
/>
|
||||
<InputBase :errors="errors"
|
||||
class=""
|
||||
field-name="a6"
|
||||
label="Jumlah Darah Masuk" placeholder="Isi Jumlah Darah Masuk"
|
||||
right-label="cc"
|
||||
numeric-only
|
||||
/>
|
||||
</DE.Block>
|
||||
|
||||
<DE.Block :col-count="3" :cell-flex="false">
|
||||
<InputBase :errors="errors"
|
||||
field-name="a6"
|
||||
label="Merk" placeholder="Isi Merk"
|
||||
/>
|
||||
<InputBase :errors="errors"
|
||||
field-name="a6"
|
||||
label="Nama Implant" placeholder="Isi Nama Implant"
|
||||
/>
|
||||
<InputBase :errors="errors"
|
||||
field-name="a6"
|
||||
label="Stiker / Nomor Register Implant" placeholder="Isi Stiker / Nomor Register Implant"
|
||||
/>
|
||||
<InputBase :errors="errors"
|
||||
field-name="a6"
|
||||
label="Nama Penedamping Implant" placeholder="Isi Nama Penedamping Implant"
|
||||
/>
|
||||
<SelectSpecimenType :errors="errors"
|
||||
field-name="a17"
|
||||
label="Specimen/Jaringan Dikirim Ke" placeholder="Pilih Specimen/Jaringan Dikirim Ke"
|
||||
is-required
|
||||
/>
|
||||
</DE.Block>
|
||||
|
||||
<DE.Block :col-count="1" :cell-flex="false" class="w-1/2">
|
||||
<FieldArray v-slot="{ fields, push, remove }" name="a32">
|
||||
<div v-for="(field, idx) in fields" :key="idx" class="flex items-end gap-3 mb-3">
|
||||
<InputBase :errors="errors"
|
||||
:field-name="`a32[${idx}]`"
|
||||
label="Keterangan Jaringan" placeholder="Isi Keterangan Jaringan"
|
||||
/>
|
||||
<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 Keterangan Jaringan
|
||||
</Button>
|
||||
</FieldArray>
|
||||
</DE.Block>
|
||||
|
||||
</Form>
|
||||
</template>
|
||||
@@ -0,0 +1,57 @@
|
||||
import type { Config } from '~/components/pub/my-ui/data-table'
|
||||
import type { Patient } from '~/models/patient'
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
import { educationCodes, genderCodes } from '~/lib/constants'
|
||||
import { calculateAge } from '~/lib/utils'
|
||||
|
||||
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
|
||||
|
||||
export const config: Config = {
|
||||
cols: [{}, {}, {}, {}, {}, {}, {}, {},],
|
||||
|
||||
headers: [
|
||||
[
|
||||
{ label: 'Tgl Laporan' },
|
||||
{ label: 'DPJP Bedah' },
|
||||
{ label: 'DPJP Anastesi' },
|
||||
{ label: 'Tgl Pembedahan' },
|
||||
{ label: 'Jenis Operasi' },
|
||||
{ label: 'Kode Billing' },
|
||||
{ label: 'Sistem Operasi' },
|
||||
{ label: 'Action' },
|
||||
],
|
||||
],
|
||||
|
||||
keys: ['date', 'doctor.employee.person.name', 'doctor.employee.person.name', 'date', 'name', 'name', 'name', 'action'],
|
||||
|
||||
delKeyNames: [
|
||||
{ key: 'code', label: 'Kode' },
|
||||
{ key: 'name', label: 'Nama' },
|
||||
],
|
||||
|
||||
parses: {
|
||||
date: (rec: unknown): unknown => {
|
||||
const date = (rec as any).date
|
||||
if (typeof date == 'object' && date) {
|
||||
return (date as Date).toLocaleDateString('id-ID')
|
||||
} else if (typeof date == 'string') {
|
||||
return (date as string).substring(0, 10)
|
||||
}
|
||||
return date
|
||||
},
|
||||
},
|
||||
|
||||
components: {
|
||||
action(rec, idx) {
|
||||
return {
|
||||
idx,
|
||||
rec: rec as object,
|
||||
component: action,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
htmls: {
|
||||
|
||||
},
|
||||
}
|
||||
@@ -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,30 @@
|
||||
<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 timestamp = inject<Ref<any>>('timestamp')!
|
||||
|
||||
const activeKey = ref<string | null>(null)
|
||||
|
||||
function process() {
|
||||
recId.value = props.rec.id || 0
|
||||
recAction.value = ActionEvents.showProcess
|
||||
recItem.value = props.rec
|
||||
timestamp.value = new Date().getTime()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Button @click="process" variant="outline"
|
||||
class="text-orange-400 border-orange-400 bg-transparent">
|
||||
Pilih
|
||||
<Icon name="i-lucide-arrow-right" class="h-4 w-4 align-middle transition-colors" />
|
||||
</Button>
|
||||
</template>
|
||||
@@ -0,0 +1,44 @@
|
||||
import type { Config } from '~/components/pub/my-ui/data-table'
|
||||
import type { Patient } from '~/models/patient'
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
import { educationCodes, genderCodes } from '~/lib/constants'
|
||||
import { calculateAge } from '~/lib/utils'
|
||||
|
||||
const action = defineAsyncComponent(() => import('./dropdown-action.vue'))
|
||||
|
||||
export const config: Config = {
|
||||
cols: [{}, {}, {width: 30}, ],
|
||||
|
||||
headers: [
|
||||
[
|
||||
{ label: 'Nama Prosedur' },
|
||||
{ label: 'Code' },
|
||||
{ label: 'Action' },
|
||||
],
|
||||
],
|
||||
|
||||
keys: ['name', 'code', 'action',],
|
||||
|
||||
delKeyNames: [
|
||||
{ key: 'code', label: 'Kode' },
|
||||
{ key: 'name', label: 'Nama' },
|
||||
],
|
||||
|
||||
parses: {
|
||||
|
||||
},
|
||||
|
||||
components: {
|
||||
action(rec, idx) {
|
||||
return {
|
||||
idx,
|
||||
rec: rec as object,
|
||||
component: action,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
htmls: {
|
||||
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<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'
|
||||
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
|
||||
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
|
||||
|
||||
// Helpers
|
||||
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||
import { toast } from '~/components/pub/ui/toast'
|
||||
import { config } from './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 {
|
||||
data: any[]
|
||||
paginationMeta: PaginationMeta
|
||||
processFn: (input: unknown) => void
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const recId = ref<string>(``)
|
||||
const recAction = ref<string>(``)
|
||||
const recItem = ref<any>({})
|
||||
const timestamp = ref<any>({})
|
||||
provide('ap_rec_id', recId)
|
||||
provide('ap_rec_action', recAction)
|
||||
provide('ap_rec_item', recItem)
|
||||
provide('timestamp', timestamp)
|
||||
|
||||
const emit = defineEmits<{
|
||||
pageChange: [page: number]
|
||||
toggleDialog: []
|
||||
}>()
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
emit('pageChange', page)
|
||||
}
|
||||
|
||||
watch([recId, recAction, ], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showProcess:
|
||||
props.processFn({
|
||||
id: recId.value,
|
||||
code: recItem.value.code,
|
||||
name: recItem.value.name,
|
||||
})
|
||||
emit('toggleDialog')
|
||||
break
|
||||
}
|
||||
})
|
||||
</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,116 @@
|
||||
<script setup lang="ts">
|
||||
import ProcedureListDialog from './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'
|
||||
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||
import List from './list.vue'
|
||||
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
|
||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||
import { getList, getDetail } from '~/services/procedure-src.service'
|
||||
import { ActionEvents, type HeaderPrep, type RefSearchNav } from '~/components/pub/my-ui/data/types'
|
||||
|
||||
interface Props {
|
||||
fieldName: string
|
||||
title: string
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
const isOperativeActionDialogOpen = ref(false)
|
||||
provide("isOperativeActionDialogOpen", isOperativeActionDialogOpen);
|
||||
|
||||
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
|
||||
fetchFn: (params) => getList({ ...params, includes: 'specialist,subspecialist,doctor-employee-person', }),
|
||||
entityName: 'surgery-report',
|
||||
})
|
||||
const headerPrep: HeaderPrep = {
|
||||
title: props.title,
|
||||
icon: 'i-lucide-clipboard-list',
|
||||
}
|
||||
const refSearchNav: RefSearchNav = {
|
||||
onClick: () => {
|
||||
// open filter modal
|
||||
},
|
||||
onInput: (val: string) => {
|
||||
searchInput.value = val
|
||||
},
|
||||
onClear: () => {
|
||||
searchInput.value = ''
|
||||
},
|
||||
}
|
||||
|
||||
const handleToggleOperativeActionDialog = () => {
|
||||
isOperativeActionDialogOpen.value = !isOperativeActionDialogOpen.value
|
||||
}
|
||||
|
||||
const dummy = [
|
||||
{
|
||||
id: 1,
|
||||
number: 1,
|
||||
name: 'Operasi',
|
||||
code: 'OP-001'
|
||||
}
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="">
|
||||
<div class="mb-2 flex justify-between">
|
||||
<h1 class="mb-2 font-medium">{{ title }}</h1>
|
||||
<Button @click="isOperativeActionDialogOpen = 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 {{ title }}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<FieldArray v-slot="{ fields, push, remove }" :name="props.fieldName">
|
||||
<Dialog
|
||||
v-model:open="isOperativeActionDialogOpen"
|
||||
title="" size="xl">
|
||||
<Header
|
||||
:prep="headerPrep"
|
||||
:ref-search-nav="refSearchNav"
|
||||
v-model:search="searchInput"
|
||||
@search="handleSearch" />
|
||||
<!-- <List :data="dummy" :process-fn="push" /> -->
|
||||
<List
|
||||
:data="dummy"
|
||||
:pagination-meta="paginationMeta"
|
||||
@page-change="handlePageChange"
|
||||
@toggle-dialog="handleToggleOperativeActionDialog"
|
||||
:process-fn="push"
|
||||
/>
|
||||
</Dialog>
|
||||
|
||||
<div class="border border-gray-200 rounded-lg overflow-hidden">
|
||||
<Table>
|
||||
<TableHeader class="bg-gray-100">
|
||||
<TableRow>
|
||||
<TableHead class="">Prosedur</TableHead>
|
||||
<TableHead class="">Code</TableHead>
|
||||
<TableHead class="w-24">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,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>
|
||||
+64
@@ -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>
|
||||
+33
@@ -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: {},
|
||||
}
|
||||
+120
@@ -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>
|
||||
+62
@@ -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>
|
||||
+33
@@ -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: {},
|
||||
}
|
||||
+108
@@ -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>
|
||||
+62
@@ -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>
|
||||
+64
@@ -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>
|
||||
+33
@@ -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: {},
|
||||
}
|
||||
+107
@@ -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>
|
||||
+63
@@ -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>
|
||||
+64
@@ -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>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import EncounterHome from '~/components/content/encounter/home.vue'
|
||||
import Process from '~/components/content/encounter/process.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<EncounterHome display="menu" class-code="ambulatory" sub-class-code="chemo" />
|
||||
<Process display="menu" class-code="ambulatory" sub-class-code="chemo" />
|
||||
</template>
|
||||
|
||||
@@ -43,7 +43,7 @@ interface Props {
|
||||
}
|
||||
const props = defineProps<Props>()
|
||||
|
||||
let units = ref<{ value: string; label: string }[]>([])
|
||||
const units = ref<{ value: string; label: string }[]>([])
|
||||
const encounterId = ref<number>(props?.encounter?.id || 0)
|
||||
const title = ref('')
|
||||
|
||||
|
||||
@@ -11,8 +11,20 @@ import { getList, remove } from '~/services/control-letter.service'
|
||||
import { toast } from '~/components/pub/ui/toast'
|
||||
import type { Encounter } from '~/models/encounter'
|
||||
import WarningAlert from '~/components/pub/my-ui/alert/warning-alert.vue'
|
||||
// import type { PagePermission } from '~/models/role'
|
||||
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
|
||||
import { permissions } from '~/const/page-permission/chemoteraphy'
|
||||
import { unauthorizedToast } from '~/lib/utils'
|
||||
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||
import DocPreviewDialog from '~/components/pub/my-ui/modal/doc-preview-dialog.vue'
|
||||
import HistoryDialog from '~/components/app/control-letter/history-dialog.vue'
|
||||
// #endregion
|
||||
|
||||
// #region Permission
|
||||
const roleAccess = permissions['/rehab/encounter'] || {}
|
||||
const { getPagePermissions } = useRBAC()
|
||||
const pagePermission = getPagePermissions(roleAccess)
|
||||
|
||||
// #region State
|
||||
const props = defineProps<{
|
||||
encounter?: Encounter
|
||||
@@ -24,6 +36,10 @@ const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSe
|
||||
fetchFn: (params) => getList({ ...params, includes: 'specialist,subspecialist,doctor-employee-person', }),
|
||||
entityName: 'control-letter',
|
||||
})
|
||||
const historyData = usePaginatedList({
|
||||
fetchFn: (params) => getList({ ...params, includes: ['person', 'person-Addresses'] }),
|
||||
entityName: 'control-letter-history',
|
||||
})
|
||||
|
||||
const refSearchNav: RefSearchNav = {
|
||||
onClick: () => {
|
||||
@@ -37,6 +53,10 @@ const refSearchNav: RefSearchNav = {
|
||||
},
|
||||
}
|
||||
|
||||
const isHistoryDialogOpen = ref(false)
|
||||
provide('isHistoryDialogOpen', isHistoryDialogOpen)
|
||||
|
||||
const isDocPreviewDialogOpen = ref(false)
|
||||
const isRecordConfirmationOpen = ref(false)
|
||||
const summaryLoading = ref(false)
|
||||
const isRequirementsMet = ref(true)
|
||||
@@ -44,17 +64,20 @@ const isRequirementsMet = ref(true)
|
||||
const recId = ref<number>(0)
|
||||
const recAction = ref<string>('')
|
||||
const recItem = ref<any>(null)
|
||||
const timestamp = ref(new Date().toISOString())
|
||||
|
||||
const headerPrep: HeaderPrep = {
|
||||
title: "Surat Kontrol",
|
||||
icon: 'i-lucide-newspaper',
|
||||
addNav: {
|
||||
}
|
||||
if (pagePermission.canCreate) {
|
||||
headerPrep.addNav = {
|
||||
label: "Surat Kontrol",
|
||||
onClick: () => navigateTo({
|
||||
name: 'rehab-encounter-id-control-letter-add',
|
||||
params: { id: encounterId },
|
||||
}),
|
||||
},
|
||||
}
|
||||
}
|
||||
// #endregion
|
||||
|
||||
@@ -105,11 +128,12 @@ function handleCancelConfirmation() {
|
||||
provide('rec_id', recId)
|
||||
provide('rec_action', recAction)
|
||||
provide('rec_item', recItem)
|
||||
provide('timestamp', isLoading)
|
||||
provide('table_data_loader', isLoading)
|
||||
// #endregion
|
||||
|
||||
// #region Watchers
|
||||
watch([recId, recAction], () => {
|
||||
watch([recId, recAction, timestamp], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
navigateTo({
|
||||
@@ -119,17 +143,22 @@ watch([recId, recAction], () => {
|
||||
break
|
||||
|
||||
case ActionEvents.showEdit:
|
||||
// TODO: Handle edit action
|
||||
// isFormEntryDialogOpen.value = true
|
||||
navigateTo({
|
||||
name: 'rehab-encounter-id-control-letter-control_letter_id-edit',
|
||||
params: { id: encounterId, "control_letter_id": recId.value },
|
||||
})
|
||||
if(pagePermission.canUpdate){
|
||||
navigateTo({
|
||||
name: 'rehab-encounter-id-control-letter-control_letter_id-edit',
|
||||
params: { id: encounterId, "control_letter_id": recId.value },
|
||||
})
|
||||
} else {
|
||||
unauthorizedToast()
|
||||
}
|
||||
break
|
||||
|
||||
case ActionEvents.showConfirmDelete:
|
||||
// Trigger confirmation modal open
|
||||
isRecordConfirmationOpen.value = true
|
||||
if(pagePermission.canDelete){
|
||||
isRecordConfirmationOpen.value = true
|
||||
} else {
|
||||
unauthorizedToast()
|
||||
}
|
||||
break
|
||||
}
|
||||
})
|
||||
@@ -151,8 +180,19 @@ watch([recId, recAction], () => {
|
||||
:ref-search-nav="refSearchNav"
|
||||
@search="handleSearch" />
|
||||
|
||||
<div class="mb-3 flex justify-end items-center">
|
||||
<Button variant="outline"
|
||||
class="gap-1 bg-transparent items-center text-orange-400 border-orange-400"
|
||||
@click="isHistoryDialogOpen = true">
|
||||
<Icon name="i-lucide-history" class="h-4 w-4" /> Riwayat Program Nasional</Button>
|
||||
</div>
|
||||
|
||||
<AppControlLetterList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||
|
||||
<Dialog v-model:open="isDocPreviewDialogOpen" title="Preview Dokumen" size="2xl">
|
||||
<DocPreviewDialog :link="`https://www.antennahouse.com/hubfs/xsl-fo-sample/pdf/basic-link-1.pdf`" />
|
||||
</Dialog>
|
||||
|
||||
<RecordConfirmation v-model:open="isRecordConfirmationOpen" action="delete" :record="recItem"
|
||||
@confirm="handleConfirmDelete" @cancel="handleCancelConfirmation">
|
||||
<template #default="{ record }">
|
||||
@@ -172,5 +212,13 @@ watch([recId, recAction], () => {
|
||||
</div>
|
||||
</template>
|
||||
</RecordConfirmation>
|
||||
|
||||
<HistoryDialog
|
||||
v-model:is-modal-open="isHistoryDialogOpen"
|
||||
:data="historyData.data.value"
|
||||
:pagination-meta="historyData.paginationMeta"
|
||||
@page-change="historyData.handlePageChange"
|
||||
/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -8,8 +8,11 @@ import AppViewPatient from '~/components/app/patient/view-patient.vue'
|
||||
import { refDebounced } from '@vueuse/core'
|
||||
|
||||
// Handlers
|
||||
import { getDetail as getDoctorDetail } from '~/services/doctor.service'
|
||||
import { useEncounterEntry } from '~/handlers/encounter-entry.handler'
|
||||
import { genDoctor, type Doctor } from '~/models/doctor'
|
||||
|
||||
// Props
|
||||
const props = defineProps<{
|
||||
id: number
|
||||
classCode?: 'ambulatory' | 'emergency' | 'inpatient' | 'outpatient'
|
||||
@@ -54,7 +57,33 @@ const {
|
||||
} = useEncounterEntry(props)
|
||||
|
||||
const debouncedSepNumber = refDebounced(sepNumber, 500)
|
||||
const selectedDoctor = ref<Doctor>(genDoctor())
|
||||
|
||||
provide('rec_select_id', recSelectId)
|
||||
provide('table_data_loader', isLoading)
|
||||
|
||||
watch(debouncedSepNumber, async (newValue) => {
|
||||
await getValidateSepNumber(newValue)
|
||||
})
|
||||
|
||||
watch(
|
||||
() => formObjects.value?.paymentType,
|
||||
(newValue) => {
|
||||
isSepValid.value = false
|
||||
if (newValue !== 'jkn') {
|
||||
sepNumber.value = ''
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
await handleInit()
|
||||
if (props.id > 0) {
|
||||
await loadEncounterDetail()
|
||||
}
|
||||
})
|
||||
|
||||
///// Functions
|
||||
function handleSavePatient() {
|
||||
selectedPatientObject.value = null
|
||||
setTimeout(() => {
|
||||
@@ -100,29 +129,13 @@ async function handleEvent(menu: string, value?: any) {
|
||||
}
|
||||
}
|
||||
|
||||
provide('rec_select_id', recSelectId)
|
||||
provide('table_data_loader', isLoading)
|
||||
|
||||
watch(debouncedSepNumber, async (newValue) => {
|
||||
await getValidateSepNumber(newValue)
|
||||
})
|
||||
|
||||
watch(
|
||||
() => formObjects.value?.paymentType,
|
||||
(newValue) => {
|
||||
isSepValid.value = false
|
||||
if (newValue !== 'jkn') {
|
||||
sepNumber.value = ''
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
await handleInit()
|
||||
if (props.id > 0) {
|
||||
await loadEncounterDetail()
|
||||
async function getDoctorInfo(value: string) {
|
||||
const resp = await getDoctorDetail(value, { includes: 'unit,specialist,subspecialist'})
|
||||
if (resp.success) {
|
||||
selectedDoctor.value = resp.body.data
|
||||
// console.log(selectedDoctor.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -144,9 +157,11 @@ onMounted(async () => {
|
||||
:seps="sepsList"
|
||||
:participant-groups="participantGroupsList"
|
||||
:specialists="specialistsTree"
|
||||
:doctor="doctorsList"
|
||||
:doctorItems="doctorsList"
|
||||
:selectedDoctor="selectedDoctor"
|
||||
:patient="selectedPatientObject"
|
||||
:objects="formObjects"
|
||||
@on-select-doctor="getDoctorInfo"
|
||||
@event="handleEvent"
|
||||
@fetch="handleFetch"
|
||||
/>
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
<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 { KfrSchema, } from '~/schemas/kfr.schema'
|
||||
import { handleActionSave, handleActionEdit } from '~/handlers/kfr.handler'
|
||||
import { getDetail } from '~/services/kfr.service';
|
||||
|
||||
// #region Props & Emits
|
||||
const props = withDefaults(defineProps<{
|
||||
callbackUrl?: string
|
||||
mode?: 'add' | 'edit'
|
||||
}>(), {
|
||||
mode: "add",
|
||||
})
|
||||
|
||||
// form related state
|
||||
const route = useRoute()
|
||||
|
||||
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
|
||||
const kfrId = typeof route.params.kfr_id == 'string' ? parseInt(route.params.kfr_id) : 0
|
||||
const inputForm = ref<ExposedForm<any> | null>(null)
|
||||
// #endregion
|
||||
|
||||
// #region State & Computed
|
||||
const router = useRouter()
|
||||
const isConfirmationOpen = ref(false)
|
||||
// #endregion
|
||||
|
||||
// #region Lifecycle Hooks
|
||||
onMounted(() => {
|
||||
if(props.mode === `edit`) init()
|
||||
})
|
||||
// #endregion
|
||||
|
||||
// #region Functions
|
||||
async function init(){
|
||||
const result = await getDetail(kfrId)
|
||||
if (result.success) {
|
||||
const currentValue = result.body?.data || {}
|
||||
inputForm.value?.setValues(currentValue)
|
||||
}
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
router.go(-1)
|
||||
}
|
||||
|
||||
async function handleConfirmAdd() {
|
||||
const inputData: any = await composeFormData()
|
||||
const response = props.mode === `add`
|
||||
? await handleActionSave(
|
||||
inputData,
|
||||
() => { },
|
||||
() => { },
|
||||
toast,
|
||||
)
|
||||
: await handleActionEdit(
|
||||
kfrId,
|
||||
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.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 = {
|
||||
// subjective: '',
|
||||
// objective: '',
|
||||
// assesment: '',
|
||||
// planningGoal: '',
|
||||
// planningAction: '',
|
||||
// planningEducation: '',
|
||||
planningFrequency: 2,
|
||||
followUpPlan: 'EVALUASI',
|
||||
// followUpPlanDesc: '',
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg font-semibold xl:text-xl">
|
||||
{{ props.mode === "add" ? `Tambah` : `Update` }} Formulir Rawat Jalan KFR
|
||||
</div>
|
||||
<AppKfrEntry
|
||||
ref="inputForm"
|
||||
:schema="KfrSchema"
|
||||
: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,372 @@
|
||||
<script setup lang="ts">
|
||||
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
|
||||
|
||||
// #region Imports
|
||||
import { ActionEvents } from '~/components/pub/my-ui/data/types'
|
||||
|
||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||
|
||||
import { getList, remove } from '~/services/kfr.service'
|
||||
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 type { ExposedForm } from '~/types/form'
|
||||
import { VerificationSchema } from '~/schemas/verification.schema'
|
||||
import { handleActionSave } from '~/handlers/kfr.handler'
|
||||
import { toast } from '~/components/pub/ui/toast'
|
||||
import DocPreviewDialog from '~/components/pub/my-ui/modal/doc-preview-dialog.vue'
|
||||
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||
import { CalendarDate } from '@internationalized/date'
|
||||
import type { DateRange } from 'radix-vue'
|
||||
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.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
|
||||
const kfrId = typeof route.params.kfr_id == 'string' ? parseInt(route.params.kfr_id) : 0
|
||||
// #endregion
|
||||
|
||||
// #region State
|
||||
const { getActiveRole } = useUserStore()
|
||||
const isVerifyDialogOpen = ref(false)
|
||||
const isValidateDialogOpen = ref(false)
|
||||
const isHistoryDialogOpen = ref(false)
|
||||
const isPatientInTherapy = ref(false)
|
||||
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
|
||||
fetchFn: (params) => getList({ ...params }),
|
||||
entityName: 'kfr',
|
||||
})
|
||||
const historyData = usePaginatedList({
|
||||
fetchFn: (params) => getList({ ...params }),
|
||||
entityName: 'kfr-history',
|
||||
})
|
||||
|
||||
const dummy = [
|
||||
{
|
||||
id: 11,
|
||||
date: new Date(),
|
||||
result: {
|
||||
s: `Example`,
|
||||
o: `Example`,
|
||||
a: `Example`,
|
||||
p: {
|
||||
goal: `Example`,
|
||||
action: `Example`,
|
||||
education: `Example`,
|
||||
frequency: `Example`,
|
||||
},
|
||||
plan: `Example`,
|
||||
planDesc: `Description`,
|
||||
},
|
||||
type: `Asesmen`,
|
||||
status: {
|
||||
verified: 1,
|
||||
validated: 0,
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
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 isAssessment = ref<boolean>(false)
|
||||
const isTherapyProtocol = ref<boolean>(false)
|
||||
const isReassessment = ref<boolean>(true)
|
||||
const isInOrBeyondAssessmentPeriod = ref<boolean>(true)
|
||||
|
||||
const isDoctor = computed(() => getActiveRole() === 'emp|doc')
|
||||
const isAdmin = computed(() => getActiveRole() === 'system')
|
||||
|
||||
const isCaptchaValid = ref(false)
|
||||
provide('isCaptchaValid', isCaptchaValid)
|
||||
|
||||
const addBtnTxt = computed(() => {
|
||||
if (isAssessment.value) {
|
||||
return `Tambah Asesmen`
|
||||
} else if (isTherapyProtocol.value) {
|
||||
return `Tambah Protokol Terapi`
|
||||
} else if (isReassessment.value) {
|
||||
return `Tambah Re-Asesmen`
|
||||
}
|
||||
return `Tambah Asesmen`
|
||||
})
|
||||
|
||||
const headerPrep: HeaderPrep = {
|
||||
title: "Formulir Rawat Jalan KFR",
|
||||
icon: 'i-lucide-newspaper',
|
||||
}
|
||||
if(isDoctor.value || isAdmin.value) {
|
||||
headerPrep.addNav = {
|
||||
label: addBtnTxt.value,
|
||||
onClick: () => navigateTo({
|
||||
name: 'rehab-encounter-id-kfr-add',
|
||||
}),
|
||||
}
|
||||
}
|
||||
if(!isAssessment.value) {
|
||||
headerPrep.components = [
|
||||
{
|
||||
component: defineAsyncComponent(() => import('~/components/app/kfr/_common/btn-history.vue')),
|
||||
props: { }
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
const defaultDate = {
|
||||
start: new CalendarDate(2025, 1, 20),
|
||||
end: new CalendarDate(2025, 1, 20).add({ days: 20 }),
|
||||
}
|
||||
const historyDateValue = ref(defaultDate) as Ref<DateRange>
|
||||
// #endregion
|
||||
|
||||
// #region Lifecycle Hooks
|
||||
onMounted(() => {
|
||||
getPatientSummary()
|
||||
|
||||
const isInTherapy = false // TODO: determine if patient is in therapy
|
||||
handleIsPatientInTherapy(isInTherapy)
|
||||
})
|
||||
// #endregion
|
||||
|
||||
// #region Functions
|
||||
function handleIsInAssesmentPeriood(value: boolean) {
|
||||
if (value) {
|
||||
isInOrBeyondAssessmentPeriod.value = true
|
||||
} else {
|
||||
isInOrBeyondAssessmentPeriod.value = false
|
||||
}
|
||||
}
|
||||
function handleIsPatientInTherapy(value: boolean) {
|
||||
if (value) {
|
||||
isPatientInTherapy.value = true
|
||||
} else {
|
||||
isPatientInTherapy.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleOpenHistory() {
|
||||
isHistoryDialogOpen.value = true
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
function toggleHistoryDialog() {
|
||||
isHistoryDialogOpen.value = !isHistoryDialogOpen.value
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
|
||||
async function handleConfirmValidate() {
|
||||
try {
|
||||
// const result = await remove(record.id)
|
||||
// if (result.success) {
|
||||
// toast({ title: 'Berhasil', description: 'Data berhasil dihapus', variant: 'default' })
|
||||
// await fetchData()
|
||||
// } else {
|
||||
// toast({ title: 'Gagal', description: `Data gagal dihapus`, variant: 'destructive' })
|
||||
// }
|
||||
} catch (error) {
|
||||
toast({ title: 'Gagal', description: `Something went wrong`, variant: 'destructive' })
|
||||
}
|
||||
}
|
||||
|
||||
function handleCancelValidate() {
|
||||
// Reset record state when cancelled
|
||||
recId.value = 0
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
}
|
||||
|
||||
async function handleConfirmDelete(record: any, action: string) {
|
||||
if (action === 'delete' && record?.id) {
|
||||
try {
|
||||
const result = await remove(record.id)
|
||||
if (result.success) {
|
||||
toast({ title: 'Berhasil', description: 'Data berhasil dihapus', variant: 'default' })
|
||||
await fetchData()
|
||||
} else {
|
||||
toast({ title: 'Gagal', description: `Data gagal dihapus`, variant: 'destructive' })
|
||||
}
|
||||
} catch (error) {
|
||||
toast({ title: 'Gagal', description: `Something went wrong`, variant: 'destructive' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleCancelConfirmation() {
|
||||
// Reset record state when cancelled
|
||||
recId.value = 0
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
}
|
||||
// #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)
|
||||
provide('isHistoryDialogOpen', isHistoryDialogOpen)
|
||||
// #endregion
|
||||
|
||||
// #region Watchers
|
||||
watch([recId, recAction, timestamp], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showEdit:
|
||||
// if(pagePermission.canUpdate) {
|
||||
navigateTo({
|
||||
name: 'rehab-encounter-id-kfr-kfr_id-edit',
|
||||
params: {
|
||||
kfr_id: kfrId
|
||||
}
|
||||
})
|
||||
// } else {
|
||||
// unauthorizedToast()
|
||||
// }
|
||||
break
|
||||
case ActionEvents.showVerify:
|
||||
// if(pagePermission.canUpdate) {
|
||||
handleVerify()
|
||||
// } else {
|
||||
// unauthorizedToast()
|
||||
// }
|
||||
break
|
||||
case ActionEvents.showValidate:
|
||||
// if(pagePermission.canUpdate) {
|
||||
isValidateDialogOpen.value = true
|
||||
// } else {
|
||||
// unauthorizedToast()
|
||||
// }
|
||||
break
|
||||
case ActionEvents.showPrint:
|
||||
isDocPreviewDialogOpen.value = true
|
||||
break
|
||||
case ActionEvents.showConfirmDelete:
|
||||
isRecordConfirmationOpen.value = true
|
||||
break
|
||||
}
|
||||
})
|
||||
// #endregion
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Header :prep="{ ...headerPrep }" />
|
||||
|
||||
<AppKfrCommonBannerPatientInTherapy v-if="isInOrBeyondAssessmentPeriod" class="mb-5" />
|
||||
|
||||
<AppKfrList :data="dummy" />
|
||||
|
||||
<Dialog v-model:open="isVerifyDialogOpen" title="Verifikasi">
|
||||
<AppKfrVerifyDialog ref="inputForm" :schema="VerificationSchema" />
|
||||
<div class="flex justify-end">
|
||||
<Action v-show="isCaptchaValid" :enable-draft="false" @click="handleActionClick" />
|
||||
</div>
|
||||
</Dialog>
|
||||
|
||||
<Confirmation
|
||||
v-model:open="isValidateDialogOpen"
|
||||
title="Validasi Data"
|
||||
message="Apakah Anda yakin ingin Validasi data ini?"
|
||||
confirm-text="Simpan"
|
||||
@confirm="handleConfirmValidate"
|
||||
@cancel="handleCancelValidate"
|
||||
/>
|
||||
|
||||
<Dialog v-model:open="isHistoryDialogOpen" title="History" size="full">
|
||||
<AppKfrHistoryList
|
||||
:data="dummy"
|
||||
v-model:date-value="historyDateValue"
|
||||
:pagination-meta="paginationMeta"
|
||||
@page-change="handlePageChange" />
|
||||
</Dialog>
|
||||
|
||||
<RecordConfirmation v-model:open="isRecordConfirmationOpen" action="delete" :record="recItem"
|
||||
@confirm="handleConfirmDelete" @cancel="handleCancelConfirmation">
|
||||
<template #default="{ record }">
|
||||
<div class="text-sm">
|
||||
<p>
|
||||
<strong>ID:</strong>
|
||||
{{ record?.id }}
|
||||
</p>
|
||||
<p v-if="record?.firstName">
|
||||
<strong>Nama:</strong>
|
||||
{{ record.firstName }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</RecordConfirmation>
|
||||
|
||||
<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,65 @@
|
||||
<script setup lang="ts">
|
||||
import { useRouter } from 'vue-router'
|
||||
import { withBase } from '~/models/_base'
|
||||
import type { HeaderPrep } from '~/components/pub/my-ui/data/types'
|
||||
import type { Patient } from '~/models/patient'
|
||||
import type { Person } from '~/models/person'
|
||||
import { getDetail } from '~/services/surgery-report.service'
|
||||
|
||||
// Components
|
||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||
import type { SurgeryReport } from '~/models/surgery-report'
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
}>()
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region State & Computed
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
|
||||
const surgeryReportId = typeof route.params.surgery_report_id == 'string' ? parseInt(route.params.surgery_report_id) : 0
|
||||
const surgeryReport = ref<SurgeryReport | null>(null)
|
||||
|
||||
const headerPrep: HeaderPrep = {
|
||||
title: 'Detail Laporan Operasi',
|
||||
icon: 'i-lucide-newspaper',
|
||||
}
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Lifecycle Hooks
|
||||
// onMounted(async () => {
|
||||
// const result = await getDetail(controlLetterId, {
|
||||
// includes: "unit,specialist,subspecialist,doctor-employee-person",
|
||||
// })
|
||||
// if (result.success) {
|
||||
// controlLetter.value = result.body?.data
|
||||
// }
|
||||
// })
|
||||
// #endregion
|
||||
|
||||
// #region Functions
|
||||
function goBack() {
|
||||
router.go(-1)
|
||||
}
|
||||
|
||||
// #endregion region
|
||||
|
||||
// #region Utilities & event handlers
|
||||
function handleAction() {
|
||||
goBack()
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region Watchers
|
||||
// #endregion
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Header :prep="headerPrep" :ref-search-nav="headerPrep.refSearchNav" />
|
||||
<AppSurgeryReportDetail :instance="surgeryReport" @click="handleAction" />
|
||||
</template>
|
||||
@@ -0,0 +1,148 @@
|
||||
<script setup lang="ts">
|
||||
import { useRouter } from 'vue-router'
|
||||
import type { Patient, genPatientProps } from '~/models/patient'
|
||||
import type { ExposedForm } from '~/types/form'
|
||||
import type { PatientBase } from '~/models/patient'
|
||||
import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue'
|
||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||
import { genPatient } from '~/models/patient'
|
||||
import { PatientSchema } from '~/schemas/patient.schema'
|
||||
import { PersonAddressRelativeSchema } from '~/schemas/person-address-relative.schema'
|
||||
import { PersonAddressSchema } from '~/schemas/person-address.schema'
|
||||
import { PersonContactListSchema } from '~/schemas/person-contact.schema'
|
||||
import { PersonFamiliesSchema } from '~/schemas/person-family.schema'
|
||||
import { ResponsiblePersonSchema } from '~/schemas/person-relative.schema'
|
||||
import { uploadAttachment } from '~/services/patient.service'
|
||||
import { getDetail, update } from '~/services/surgery-report.service'
|
||||
import type { SurgeryReport } from '~/models/surgery-report'
|
||||
import ActionDialog from '~/components/pub/my-ui/nav-footer/ba-su.vue'
|
||||
|
||||
import { toast } from '~/components/pub/ui/toast'
|
||||
import { withBase } from '~/models/_base'
|
||||
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue'
|
||||
import { SurgeryReportSchema } from '~/schemas/surgery-report.schema'
|
||||
import { formatDateYyyyMmDd } from '~/lib/date'
|
||||
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||
import { getList, remove } from '~/services/surgery-report.service'
|
||||
import { handleActionEdit } from '~/handlers/surgery-report.handler'
|
||||
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
|
||||
|
||||
// #region Props & Emits
|
||||
const props = defineProps<{
|
||||
callbackUrl?: string
|
||||
}>()
|
||||
|
||||
// form related state
|
||||
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
|
||||
fetchFn: (params) => getList({ ...params, includes: 'specialist,subspecialist,doctor-employee-person', }),
|
||||
entityName: 'surgery-report',
|
||||
})
|
||||
// #endregion
|
||||
|
||||
// #region State & Computed
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
|
||||
const surgeryReportId = typeof route.params.surgery_report_id == 'string' ? parseInt(route.params.surgery_report_id) : 0
|
||||
|
||||
const inputForm = ref<ExposedForm<any> | null>(null)
|
||||
const surgeryReport = ref({})
|
||||
const isConfirmationOpen = ref(false)
|
||||
const selectedOperativeAction = ref<any>(null)
|
||||
// #endregion
|
||||
|
||||
// #region Lifecycle Hooks
|
||||
onMounted(async () => {
|
||||
const result = await getDetail(surgeryReportId)
|
||||
if (result.success) {
|
||||
const responseData = {...result.body.data, date: formatDateYyyyMmDd(result.body.data.date)}
|
||||
surgeryReport.value = responseData
|
||||
inputForm.value?.setValues(responseData)
|
||||
}
|
||||
})
|
||||
// #endregion
|
||||
|
||||
// #region Functions
|
||||
function goBack() {
|
||||
router.go(-1)
|
||||
}
|
||||
|
||||
async function handleConfirmAdd() {
|
||||
const response = await handleActionEdit(
|
||||
surgeryReportId,
|
||||
await composeFormData(),
|
||||
() => { },
|
||||
() => { },
|
||||
toast,
|
||||
)
|
||||
goBack()
|
||||
}
|
||||
|
||||
async function composeFormData(): Promise<SurgeryReport> {
|
||||
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') {
|
||||
isConfirmationOpen.value = true
|
||||
}
|
||||
|
||||
if (eventType === 'back') {
|
||||
if (props.callbackUrl) {
|
||||
await navigateTo(props.callbackUrl)
|
||||
return
|
||||
}
|
||||
|
||||
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">Update Laporan Operasi</div>
|
||||
<code>{{ selectedOperativeAction }}</code>
|
||||
<AppSurgeryReportEntry
|
||||
ref="inputForm"
|
||||
:schema="SurgeryReportSchema"
|
||||
:operative-action-list="[]"
|
||||
/>
|
||||
|
||||
<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>
|
||||
|
||||
<style scoped>
|
||||
/* component style */
|
||||
</style>
|
||||
@@ -0,0 +1,200 @@
|
||||
<script setup lang="ts">
|
||||
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
|
||||
|
||||
// #region Imports
|
||||
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||
import { ActionEvents } from '~/components/pub/my-ui/data/types'
|
||||
|
||||
import Filter from '~/components/pub/my-ui/nav-header/filter.vue'
|
||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||
import { getList, remove } from '~/services/surgery-report.service'
|
||||
import { toast } from '~/components/pub/ui/toast'
|
||||
import type { Encounter } from '~/models/encounter'
|
||||
import WarningAlert from '~/components/pub/my-ui/alert/warning-alert.vue'
|
||||
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||
// #endregion
|
||||
|
||||
// #region State
|
||||
const props = defineProps<{
|
||||
encounter?: Encounter
|
||||
}>()
|
||||
const route = useRoute()
|
||||
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
|
||||
|
||||
const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSearch, fetchData } = usePaginatedList({
|
||||
fetchFn: (params) => getList({ ...params, includes: 'specialist,subspecialist,doctor-employee-person', }),
|
||||
entityName: 'surgery-report',
|
||||
})
|
||||
|
||||
const isHistoryDialogOpen = ref(false)
|
||||
const isFilterDialogOpen = ref(false)
|
||||
const isRecordConfirmationOpen = ref(false)
|
||||
const summaryLoading = ref(false)
|
||||
const isRequirementsMet = ref(true)
|
||||
|
||||
const recId = ref<number>(0)
|
||||
const recAction = ref<string>('')
|
||||
const recItem = ref<any>(null)
|
||||
|
||||
const headerPrep: HeaderPrep = {
|
||||
title: "Laporan Operasi",
|
||||
icon: 'i-lucide-history',
|
||||
addNav: {
|
||||
label: "Laporan Operasi",
|
||||
onClick: () => navigateTo({
|
||||
name: 'rehab-encounter-id-surgery-report-add',
|
||||
params: { id: encounterId },
|
||||
}),
|
||||
},
|
||||
}
|
||||
const refSearchNav: RefSearchNav = {
|
||||
onClick: () => {
|
||||
isFilterDialogOpen.value = true
|
||||
},
|
||||
onInput: (val: string) => {
|
||||
searchInput.value = val
|
||||
},
|
||||
onClear: () => {
|
||||
searchInput.value = ''
|
||||
},
|
||||
}
|
||||
headerPrep.components = [
|
||||
{
|
||||
component: defineAsyncComponent(() => import('~/components/app/surgery-report/_common/btn-history.vue')),
|
||||
props: { }
|
||||
},
|
||||
];
|
||||
// #endregion
|
||||
|
||||
// #region Lifecycle Hooks
|
||||
onMounted(() => {
|
||||
getListData()
|
||||
})
|
||||
// #endregion
|
||||
|
||||
// #region Functions
|
||||
async function getListData() {
|
||||
try {
|
||||
summaryLoading.value = true
|
||||
await new Promise((resolve) => setTimeout(resolve, 500))
|
||||
} catch (error) {
|
||||
console.error('Error fetching Data:', error)
|
||||
} finally {
|
||||
summaryLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// Handle confirmation result
|
||||
function handleFiltering(value: any) {
|
||||
isFilterDialogOpen.value = false
|
||||
}
|
||||
async function handleConfirmDelete(record: any, action: string) {
|
||||
if (action === 'delete' && record?.id) {
|
||||
try {
|
||||
const result = await remove(record.id)
|
||||
if (result.success) {
|
||||
toast({ title: 'Berhasil', description: 'Data berhasil dihapus', variant: 'default' })
|
||||
await fetchData()
|
||||
} else {
|
||||
toast({ title: 'Gagal', description: `Data gagal dihapus`, variant: 'destructive' })
|
||||
}
|
||||
} catch (error) {
|
||||
toast({ title: 'Gagal', description: `Something went wrong`, variant: 'destructive' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleCancelConfirmation() {
|
||||
// Reset record state when cancelled
|
||||
recId.value = 0
|
||||
recAction.value = ''
|
||||
recItem.value = null
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region Provide
|
||||
provide('rec_id', recId)
|
||||
provide('rec_action', recAction)
|
||||
provide('rec_item', recItem)
|
||||
provide('table_data_loader', isLoading)
|
||||
provide('isHistoryDialogOpen', isHistoryDialogOpen)
|
||||
// #endregion
|
||||
|
||||
// #region Watchers
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
navigateTo({
|
||||
name: 'rehab-encounter-id-surgery-report-control_letter_id',
|
||||
params: { id: encounterId, "control_letter_id": recId.value },
|
||||
})
|
||||
break
|
||||
|
||||
case ActionEvents.showEdit:
|
||||
// TODO: Handle edit action
|
||||
// isFormEntryDialogOpen.value = true
|
||||
navigateTo({
|
||||
name: 'rehab-encounter-id-surgery-report-control_letter_id-edit',
|
||||
params: { id: encounterId, "control_letter_id": recId.value },
|
||||
})
|
||||
break
|
||||
|
||||
case ActionEvents.showConfirmDelete:
|
||||
// Trigger confirmation modal open
|
||||
isRecordConfirmationOpen.value = true
|
||||
break
|
||||
}
|
||||
})
|
||||
// #endregion
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<WarningAlert v-if="!isRequirementsMet"
|
||||
class="mb-5"
|
||||
text="Syarat pembuatan Laporan Operasi belum terpenuhi"
|
||||
:description="[
|
||||
'Lanjutan Penatalaksanaan Pasien harus pulang/KRS.',
|
||||
'Status Resume Medis harus tervalidasi.'
|
||||
]" />
|
||||
|
||||
<div v-else>
|
||||
<Header :prep="headerPrep" />
|
||||
|
||||
<Filter
|
||||
:prep="headerPrep"
|
||||
:ref-search-nav="refSearchNav"
|
||||
:enable-export="false"
|
||||
/>
|
||||
|
||||
<AppSurgeryReportList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||
|
||||
<Dialog v-model:open="isFilterDialogOpen" title="Filter" size="lg">
|
||||
<AppSurgeryReportCommonFilter @submit="handleFiltering" />
|
||||
</Dialog>
|
||||
|
||||
<Dialog v-model:open="isHistoryDialogOpen" title="History">
|
||||
<AppSurgeryReportCommonHistoryDialog />
|
||||
</Dialog>
|
||||
|
||||
<RecordConfirmation v-model:open="isRecordConfirmationOpen" action="delete" :record="recItem"
|
||||
@confirm="handleConfirmDelete" @cancel="handleCancelConfirmation">
|
||||
<template #default="{ record }">
|
||||
<div class="text-sm">
|
||||
<p>
|
||||
<strong>ID:</strong>
|
||||
{{ record?.id }}
|
||||
</p>
|
||||
<p v-if="record?.firstName">
|
||||
<strong>Nama:</strong>
|
||||
{{ record.firstName }}
|
||||
</p>
|
||||
<p v-if="record?.code">
|
||||
<strong>Kode:</strong>
|
||||
{{ record.cellphone }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</RecordConfirmation>
|
||||
</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>
|
||||
@@ -1,6 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { cn } from '~/lib/utils'
|
||||
|
||||
import { type Item } from './index'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -14,6 +13,8 @@ const props = defineProps<{
|
||||
isDisabled?: boolean
|
||||
}>()
|
||||
|
||||
const model = defineModel()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string]
|
||||
'update:searchText': [value: string]
|
||||
@@ -57,6 +58,7 @@ const searchableItems = computed(() => {
|
||||
})
|
||||
|
||||
function onSelect(item: Item) {
|
||||
model.value = item.value
|
||||
emit('update:modelValue', item.value)
|
||||
open.value = false
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user