Files
simrsx-fe/app/components/app/therapy-protocol/entry.vue
hasyim_kai 1dd8e8e7b3 Squashed commit of the following:
commit 72ce2260c50597f782f07d29db3985607ecc2f34
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Mon Nov 17 15:19:36 2025 +0700

    Feat: add doc preview in Therpay protocol List

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

    Fix: prepare API integration protokol terapi verification

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

    Feat: add basic CRUD therapy protocol

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

    Fix: Prepare protokol terapi API Integration

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

    Fix: hotfix style add protokol terapi

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

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

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

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

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

    Fix: Add Schema therapy protocol rehab medik

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

    Fix: refactor Actions Btn ba-dr-su

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

    Feat: UI protokol terapi in Rehab medik

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

    wip: list protokol terapi

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

    feat(therapy-protocol): init form entry

    feat(therapy-protocol): init page routes

    wip: init entry form

    wip: form entry protokol terapi

    todo: table procedure, and diagnose  picker

    wip: schema form new entry

    todo: picker/modal yang relateds ke form entry
2025-11-25 09:23:57 +07:00

205 lines
7.9 KiB
Vue

<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>