From 53bd8e7f6e2b22b03690947f52b42744a17703ee Mon Sep 17 00:00:00 2001 From: hasyim_kai Date: Fri, 7 Nov 2025 08:55:23 +0700 Subject: [PATCH] Fix: refactor rehab medik - Resume UI --- .../app/resume/_common/print-btn.vue | 22 + .../resume/_common/select-concious-level.vue | 70 +++ .../_common/select-following-arrangement.vue | 70 +++ .../select-hospital-leave-condition.vue | 70 +++ .../_common/select-hospital-leave-method.vue | 70 +++ .../app/resume/_common/select-icd-10.vue | 70 +++ .../app/resume/_common/select-icd-9.vue | 70 +++ ...select-national-program-service-status.vue | 70 +++ .../select-national-program-service.vue | 70 +++ .../app/resume/_common/select-pain-scale.vue | 70 +++ .../app/resume/_common/verify-badge.vue | 67 +++ app/components/app/resume/add.vue | 468 ++++++++++++++---- .../history-list/action-history-dialog.vue | 66 +++ .../resume/history-list/action-list.cfg.ts | 94 ++++ .../consultation-history-dialog.vue | 66 +++ .../history-list/consultation-list.cfg.ts | 51 ++ .../history-list/farmacy-history-dialog.vue | 66 +++ .../resume/history-list/farmacy-list.cfg.ts | 39 ++ .../national-program-history-dialog.vue | 65 +++ .../history-list/national-program-list.cfg.ts | 30 ++ .../supporting-history-dialog.vue | 66 +++ .../history-list/supporting-list.cfg.ts | 39 ++ app/components/app/resume/list.cfg.ts | 20 +- app/components/app/resume/list.vue | 50 +- app/components/app/resume/verify-dialog.vue | 97 ++++ app/components/content/resume/add.vue | 98 +++- app/components/content/resume/list.vue | 142 ++++-- .../pub/my-ui/data/dropdown-action-dvvp.vue | 103 ++++ app/components/pub/my-ui/data/types.ts | 3 + app/components/pub/my-ui/form/input-base.vue | 8 +- .../pub/my-ui/form/text-area-input.vue | 2 +- app/schemas/resume.schema.ts | 35 +- 32 files changed, 2142 insertions(+), 185 deletions(-) create mode 100644 app/components/app/resume/_common/print-btn.vue create mode 100644 app/components/app/resume/_common/select-concious-level.vue create mode 100644 app/components/app/resume/_common/select-following-arrangement.vue create mode 100644 app/components/app/resume/_common/select-hospital-leave-condition.vue create mode 100644 app/components/app/resume/_common/select-hospital-leave-method.vue create mode 100644 app/components/app/resume/_common/select-icd-10.vue create mode 100644 app/components/app/resume/_common/select-icd-9.vue create mode 100644 app/components/app/resume/_common/select-national-program-service-status.vue create mode 100644 app/components/app/resume/_common/select-national-program-service.vue create mode 100644 app/components/app/resume/_common/select-pain-scale.vue create mode 100644 app/components/app/resume/_common/verify-badge.vue create mode 100644 app/components/app/resume/history-list/action-history-dialog.vue create mode 100644 app/components/app/resume/history-list/action-list.cfg.ts create mode 100644 app/components/app/resume/history-list/consultation-history-dialog.vue create mode 100644 app/components/app/resume/history-list/consultation-list.cfg.ts create mode 100644 app/components/app/resume/history-list/farmacy-history-dialog.vue create mode 100644 app/components/app/resume/history-list/farmacy-list.cfg.ts create mode 100644 app/components/app/resume/history-list/national-program-history-dialog.vue create mode 100644 app/components/app/resume/history-list/national-program-list.cfg.ts create mode 100644 app/components/app/resume/history-list/supporting-history-dialog.vue create mode 100644 app/components/app/resume/history-list/supporting-list.cfg.ts create mode 100644 app/components/app/resume/verify-dialog.vue create mode 100644 app/components/pub/my-ui/data/dropdown-action-dvvp.vue diff --git a/app/components/app/resume/_common/print-btn.vue b/app/components/app/resume/_common/print-btn.vue new file mode 100644 index 00000000..5688d007 --- /dev/null +++ b/app/components/app/resume/_common/print-btn.vue @@ -0,0 +1,22 @@ + + + \ No newline at end of file diff --git a/app/components/app/resume/_common/select-concious-level.vue b/app/components/app/resume/_common/select-concious-level.vue new file mode 100644 index 00000000..0852195b --- /dev/null +++ b/app/components/app/resume/_common/select-concious-level.vue @@ -0,0 +1,70 @@ + + + diff --git a/app/components/app/resume/_common/select-following-arrangement.vue b/app/components/app/resume/_common/select-following-arrangement.vue new file mode 100644 index 00000000..0852195b --- /dev/null +++ b/app/components/app/resume/_common/select-following-arrangement.vue @@ -0,0 +1,70 @@ + + + diff --git a/app/components/app/resume/_common/select-hospital-leave-condition.vue b/app/components/app/resume/_common/select-hospital-leave-condition.vue new file mode 100644 index 00000000..0852195b --- /dev/null +++ b/app/components/app/resume/_common/select-hospital-leave-condition.vue @@ -0,0 +1,70 @@ + + + diff --git a/app/components/app/resume/_common/select-hospital-leave-method.vue b/app/components/app/resume/_common/select-hospital-leave-method.vue new file mode 100644 index 00000000..0852195b --- /dev/null +++ b/app/components/app/resume/_common/select-hospital-leave-method.vue @@ -0,0 +1,70 @@ + + + diff --git a/app/components/app/resume/_common/select-icd-10.vue b/app/components/app/resume/_common/select-icd-10.vue new file mode 100644 index 00000000..0852195b --- /dev/null +++ b/app/components/app/resume/_common/select-icd-10.vue @@ -0,0 +1,70 @@ + + + diff --git a/app/components/app/resume/_common/select-icd-9.vue b/app/components/app/resume/_common/select-icd-9.vue new file mode 100644 index 00000000..0852195b --- /dev/null +++ b/app/components/app/resume/_common/select-icd-9.vue @@ -0,0 +1,70 @@ + + + diff --git a/app/components/app/resume/_common/select-national-program-service-status.vue b/app/components/app/resume/_common/select-national-program-service-status.vue new file mode 100644 index 00000000..0852195b --- /dev/null +++ b/app/components/app/resume/_common/select-national-program-service-status.vue @@ -0,0 +1,70 @@ + + + diff --git a/app/components/app/resume/_common/select-national-program-service.vue b/app/components/app/resume/_common/select-national-program-service.vue new file mode 100644 index 00000000..0852195b --- /dev/null +++ b/app/components/app/resume/_common/select-national-program-service.vue @@ -0,0 +1,70 @@ + + + diff --git a/app/components/app/resume/_common/select-pain-scale.vue b/app/components/app/resume/_common/select-pain-scale.vue new file mode 100644 index 00000000..0852195b --- /dev/null +++ b/app/components/app/resume/_common/select-pain-scale.vue @@ -0,0 +1,70 @@ + + + diff --git a/app/components/app/resume/_common/verify-badge.vue b/app/components/app/resume/_common/verify-badge.vue new file mode 100644 index 00000000..8a999895 --- /dev/null +++ b/app/components/app/resume/_common/verify-badge.vue @@ -0,0 +1,67 @@ + + + \ No newline at end of file diff --git a/app/components/app/resume/add.vue b/app/components/app/resume/add.vue index 2e12f872..d1423735 100644 --- a/app/components/app/resume/add.vue +++ b/app/components/app/resume/add.vue @@ -8,12 +8,19 @@ 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 SelectIcd10 from './_common/select-icd-10.vue' +import SelectIcd9 from './_common/select-icd-9.vue' +import SelectConciousLevel from './_common/select-concious-level.vue' +import SelectPainScale from './_common/select-pain-scale.vue' +import SelectNationalProgramService from './_common/select-national-program-service.vue' +import SelectNationalProgramServiceStatus from './_common/select-national-program-service-status.vue' +import SelectHospitalLeaveCondition from './_common/select-hospital-leave-condition.vue' +import SelectFollowingArrangement from './_common/select-following-arrangement.vue' +import SelectHospitalLeaveMethod from './_common/select-hospital-leave-method.vue' const props = defineProps<{ schema: any @@ -22,6 +29,11 @@ const props = defineProps<{ errors?: FormErrors }>() +const isActionHistoryOpen = inject(`isActionHistoryOpen`) as Ref +const isConsultationHistoryOpen = inject(`isConsultationHistoryOpen`) as Ref +const isSupportingHistoryOpen = inject(`isSupportingHistoryOpen`) as Ref +const isFarmacyHistoryOpen = inject(`isFarmacyHistoryOpen`) as Ref +const isNationalProgramServiceHistoryOpen = inject(`isNationalProgramServiceHistoryOpen`) as Ref const formSchema = toTypedSchema(props.schema) const formRef = ref() @@ -31,101 +43,369 @@ defineExpose({ setValues: (values: any, shouldValidate = true) => formRef.value?.setValues(values, shouldValidate), values: computed(() => formRef.value?.values), }) + +const DEFAULT_SECONDARY_DIAGNOSIS_VALUE = { + diagnosis: '', + icd10: '', + diagnosisBasis: '', +}; +const DEFAULT_SECONDARY_ACTION_VALUE = { + action: '', + icd9: '', + actionBasis: '', +}; +const DEFAULT_CONSULTATION_VALUE = { + consultation: '', + consultationReply: '', +}; \ No newline at end of file diff --git a/app/components/app/resume/verify-dialog.vue b/app/components/app/resume/verify-dialog.vue new file mode 100644 index 00000000..1519446c --- /dev/null +++ b/app/components/app/resume/verify-dialog.vue @@ -0,0 +1,97 @@ + + + \ No newline at end of file diff --git a/app/components/content/resume/add.vue b/app/components/content/resume/add.vue index 6df169c6..6fda4bf8 100644 --- a/app/components/content/resume/add.vue +++ b/app/components/content/resume/add.vue @@ -3,6 +3,14 @@ import type { ExposedForm } from '~/types/form'; import Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue' import { ResumeSchema } from '~/schemas/resume.schema'; import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue' +import { CalendarDate, DateFormatter, getLocalTimeZone } from '@internationalized/date'; +import type { DateRange } from 'radix-vue'; +import { getPatients } from '~/services/patient.service'; +import ActionHistoryDialog from '~/components/app/resume/history-list/action-history-dialog.vue'; +import ConsultationHistoryDialog from '~/components/app/resume/history-list/consultation-history-dialog.vue'; +import SupportingHistoryDialog from '~/components/app/resume/history-list/supporting-history-dialog.vue'; +import FarmacyHistoryDialog from '~/components/app/resume/history-list/farmacy-history-dialog.vue'; +import NationalProgramHistoryDialog from '~/components/app/resume/history-list/national-program-history-dialog.vue'; // #region Props & Emits const props = defineProps<{ @@ -11,14 +19,60 @@ const props = defineProps<{ // form related state const personPatientForm = ref | null>(null) +const actionHistoryData = usePaginatedList({ + fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }), + entityName: 'patient', +}) +const consultationHistoryData = usePaginatedList({ + fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }), + entityName: 'patient', +}) +const supportingHistoryData = usePaginatedList({ + fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }), + entityName: 'patient', +}) +const farmacyHistoryData = usePaginatedList({ + fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }), + entityName: 'patient', +}) +const nationalProgramServiceHistoryData = usePaginatedList({ + fetchFn: (params) => getPatients({ ...params, includes: ['person', 'person-Addresses'] }), + entityName: 'patient', +}) // #endregion // #region State & Computed const router = useRouter() const isConfirmationOpen = ref(false) +const isActionHistoryOpen = ref(false) +const isConsultationHistoryOpen = ref(false) +const isSupportingHistoryOpen = ref(false) +const isFarmacyHistoryOpen = ref(false) +const isNationalProgramServiceHistoryOpen = ref(false) + +provide(`isActionHistoryOpen`, isActionHistoryOpen) +provide(`isConsultationHistoryOpen`, isConsultationHistoryOpen) +provide(`isSupportingHistoryOpen`, isSupportingHistoryOpen) +provide(`isFarmacyHistoryOpen`, isFarmacyHistoryOpen) +provide(`isNationalProgramServiceHistoryOpen`, isNationalProgramServiceHistoryOpen) + +const defaultDate = { + start: new CalendarDate(2022, 1, 20), + end: new CalendarDate(2022, 1, 20).add({ days: 20 }), +} + +const actionHistoryDateValue = ref(defaultDate) as Ref +const consultationHistoryDateValue = ref(defaultDate) as Ref +const supportingHistoryDateValue = ref(defaultDate) as Ref +const farmacyHistoryDateValue = ref(defaultDate) as Ref +const nationalProgramServiceSearch = ref('') +const nationalProgramServiceSelectedStatus = ref('all') // #endregion // #region Lifecycle Hooks +onMounted(() => { + +}) // #endregion // #region Functions @@ -86,7 +140,7 @@ async function handleActionClick(eventType: string) { + :resume-arrangement-type="personPatientForm?.values.arrangement"/>
+ + + +

aaaaaaaaaaaaaaa

+ + + + + + + diff --git a/app/components/content/resume/list.vue b/app/components/content/resume/list.vue index 5c5e3658..389c830d 100644 --- a/app/components/content/resume/list.vue +++ b/app/components/content/resume/list.vue @@ -10,9 +10,12 @@ 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 Action from '~/components/pub/my-ui/nav-footer/ba-dr-su.vue' 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 Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue' // #endregion @@ -35,6 +38,7 @@ const refSearchNav: RefSearchNav = { } const formType = ref<`a` | `b`>(`a`) +const isVerifyDialogOpen = ref(false) const isRecordConfirmationOpen = ref(false) const summaryLoading = ref(false) @@ -69,23 +73,61 @@ async function getPatientSummary() { summaryLoading.value = false } } -function handleFormScreening(key: string) { - switch (key) { - case 'form-a': - navigateTo("/screening-mpp/add/a") - break; - case 'preview-form-a': - navigateTo('https://google.com', { external: true, open: { target: '_blank' } }); - break; - case 'form-b': - navigateTo("/screening-mpp/add/b") - break; - case 'preview-form-b': - navigateTo('https://google.com', { external: true, open: { target: '_blank' } }); - break; - default: - break; + +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 + } +} + +async function handleConfirmDelete() { + try { + const result = await removePatient(recId.value) + if (result.success) { + console.log('Patient deleted successfully') + // Refresh the list + await fetchData() + } else { + console.error('Failed to delete patient:', result) + // Handle error - show error message to user + } + } catch (error) { + console.error('Error deleting patient:', error) + // Handle error - show error message to user + } +} + +function handleCancelConfirmation() { + // Reset record state when cancelled + recId.value = 0 + recAction.value = '' + recItem.value = null } // #endregion @@ -99,26 +141,15 @@ provide('table_data_loader', isLoading) // #region Watchers watch([recId, recAction], () => { switch (recAction.value) { - case ActionEvents.showDetail: - navigateTo({ - name: 'outpatient-encounter-id', - params: { id: recId.value }, - }) + case ActionEvents.showVerify: + isVerifyDialogOpen.value = true break - - case ActionEvents.showEdit: - // TODO: Handle edit action - // isFormEntryDialogOpen.value = true - navigateTo({ - name: 'outpatient-encounter-id-edit', - params: { id: recId.value }, - }) - break - - case ActionEvents.showConfirmDelete: - // Trigger confirmation modal open + case ActionEvents.showValidate: isRecordConfirmationOpen.value = true break + case ActionEvents.showPrint: + navigateTo('https://google.com', {external: true,open: { target: "_blank" },}); + break } }) // #endregion @@ -126,26 +157,29 @@ watch([recId, recAction], () => { \ No newline at end of file diff --git a/app/components/pub/my-ui/data/dropdown-action-dvvp.vue b/app/components/pub/my-ui/data/dropdown-action-dvvp.vue new file mode 100644 index 00000000..00e15096 --- /dev/null +++ b/app/components/pub/my-ui/data/dropdown-action-dvvp.vue @@ -0,0 +1,103 @@ + + + diff --git a/app/components/pub/my-ui/data/types.ts b/app/components/pub/my-ui/data/types.ts index c0d283de..c86e1752 100644 --- a/app/components/pub/my-ui/data/types.ts +++ b/app/components/pub/my-ui/data/types.ts @@ -76,6 +76,9 @@ export const ActionEvents = { showEdit: 'showEdit', showDetail: 'showDetail', showProcess: 'showProcess', + showVerify: 'showVerify', + showValidate: 'showValidate', + showPrint: 'showPrint', } export interface DataTableLoader { diff --git a/app/components/pub/my-ui/form/input-base.vue b/app/components/pub/my-ui/form/input-base.vue index aeb4a4af..c31b2073 100644 --- a/app/components/pub/my-ui/form/input-base.vue +++ b/app/components/pub/my-ui/form/input-base.vue @@ -19,6 +19,8 @@ const props = defineProps<{ maxLength?: number isRequired?: boolean isDisabled?: boolean + rightLabel?: string + bottomLabel?: string }>() function handleInput(event: Event) { @@ -61,14 +63,14 @@ function handleInput(event: Event) { v-slot="{ componentField }" :name="fieldName" > - + +

{{ rightLabel }}

+

{{ bottomLabel }}

diff --git a/app/components/pub/my-ui/form/text-area-input.vue b/app/components/pub/my-ui/form/text-area-input.vue index 7747e727..c7b7c794 100644 --- a/app/components/pub/my-ui/form/text-area-input.vue +++ b/app/components/pub/my-ui/form/text-area-input.vue @@ -47,7 +47,7 @@ function handleInput(event: Event) {