From 55239606af008e5c4e3ec5994de3a60ebd9d0936 Mon Sep 17 00:00:00 2001 From: Khafid Prayoga Date: Wed, 8 Oct 2025 12:22:31 +0700 Subject: [PATCH] feat(patient): address integration to backend apis feat(patient): add newborn status field and validation - Add radio button component for newborn status selection - Update patient schema with newborn status validation - Remove deprecated alias field from person model - Refactor disability type handling in patient schema fix(patient): correct address comparison logic and schema Update the patient address comparison to use boolean instead of string '1' and modify the schema to transform the string value to boolean. This ensures consistent type usage throughout the application. feat(models): add village and district model interfaces Add new model interfaces for Village and District with their respective generator functions. These models will be used to handle administrative division data in the application. feat(address): implement dynamic province selection with caching - Add province service for CRUD operations - Create useProvinces composable with caching and loading states - Update select-province component to use dynamic data - Export SelectItem interface for type consistency - Improve combobox styling and accessibility feat(address-form): implement dynamic regency selection with caching - Add new regency service for CRUD operations - Create useRegencies composable with caching and loading states - Update SelectRegency component to use dynamic data based on province selection - Improve placeholder and disabled state handling feat(address-form): implement dynamic district selection - Add district service for CRUD operations - Create useDistricts composable with caching and loading states - Update SelectDistrict component to use dynamic data - Remove hardcoded district options and implement regency-based filtering feat(address-form): implement dynamic village selection with caching - Add village service for CRUD operations - Create useVillages composable with caching and loading states - Update SelectVillage component to fetch villages based on district - Remove hardcoded village options in favor of API-driven data feat(address-form): improve address selection with debouncing and request deduplication - Add debouncing to prevent rapid API calls when selecting addresses - Implement request deduplication to avoid duplicate API calls - Add delayed form reset to ensure proper composable cleanup - Add isUserAction flag to force refresh when user changes selection --- ...{input-patient-name.vue => input-name.vue} | 48 ----- .../app/patient/_common/radio-newborn.vue | 93 +++++++++ app/components/app/patient/entry-form.vue | 16 +- .../_common/select-district.vue | 38 +++- .../_common/select-province.vue | 33 ++-- .../person-address/_common/select-regency.vue | 40 ++-- .../person-address/_common/select-village.vue | 39 ++-- .../person-address/entry-form-relative.vue | 24 +-- .../app/person-address/entry-form.vue | 96 ++++++---- app/components/content/patient/entry.vue | 4 +- app/components/pub/my-ui/form/combobox.vue | 39 ++-- app/components/pub/my-ui/form/select.vue | 4 +- app/composables/useDistricts.ts | 180 +++++++++++++++++ app/composables/useProvinces.ts | 113 +++++++++++ app/composables/useRegencies.ts | 181 ++++++++++++++++++ app/composables/useVillages.ts | 181 ++++++++++++++++++ app/lib/utils.ts | 9 + app/models/district.ts | 16 ++ app/models/patient.ts | 8 +- app/models/person.ts | 4 +- app/models/village.ts | 16 ++ app/schemas/patient.schema.ts | 42 +++- app/schemas/person-address-relative.schema.ts | 29 +-- app/services/district.service.ts | 25 +++ app/services/province.service.ts | 25 +++ app/services/regency.service.ts | 25 +++ app/services/village.service.ts | 25 +++ 27 files changed, 1153 insertions(+), 200 deletions(-) rename app/components/app/patient/_common/{input-patient-name.vue => input-name.vue} (52%) create mode 100644 app/components/app/patient/_common/radio-newborn.vue create mode 100644 app/composables/useDistricts.ts create mode 100644 app/composables/useProvinces.ts create mode 100644 app/composables/useRegencies.ts create mode 100644 app/composables/useVillages.ts create mode 100644 app/models/district.ts create mode 100644 app/models/village.ts create mode 100644 app/services/district.service.ts create mode 100644 app/services/province.service.ts create mode 100644 app/services/regency.service.ts create mode 100644 app/services/village.service.ts diff --git a/app/components/app/patient/_common/input-patient-name.vue b/app/components/app/patient/_common/input-name.vue similarity index 52% rename from app/components/app/patient/_common/input-patient-name.vue rename to app/components/app/patient/_common/input-name.vue index fbc57351..933612d3 100644 --- a/app/components/app/patient/_common/input-patient-name.vue +++ b/app/components/app/patient/_common/input-name.vue @@ -3,15 +3,12 @@ import type { FormErrors } from '~/types/error' import FieldGroup from '~/components/pub/my-ui/form/field-group.vue' import Field from '~/components/pub/my-ui/form/field.vue' import Label from '~/components/pub/my-ui/form/label.vue' -import Select from '~/components/pub/my-ui/form/select.vue' import { Input } from '~/components/pub/ui/input' import { cn } from '~/lib/utils' defineProps<{ - fieldNameAlias: string fieldNameInput: string placeholder: string - labelForAlias: string labelForInput: string errors?: FormErrors class?: string @@ -21,54 +18,9 @@ defineProps<{ maxLength?: number isRequired?: boolean }>() - -const aliasOptions = [ - { label: 'An', value: 'an' }, - { label: 'By.Ny', value: 'byny' }, - { label: 'Nn', value: 'nn' }, - { label: 'Ny', value: 'ny' }, - { label: 'Tn', value: 'tn' }, -]