diff --git a/app/components/app/person-relative/_common/select-relations.vue b/app/components/app/person-relative/_common/select-relations.vue index 179976bf..5c3d2594 100644 --- a/app/components/app/person-relative/_common/select-relations.vue +++ b/app/components/app/person-relative/_common/select-relations.vue @@ -4,6 +4,7 @@ import FieldGroup from '~/components/pub/my-ui/form/field-group.vue' import Field from '~/components/pub/my-ui/form/field.vue' import Select from '~/components/pub/my-ui/form/select.vue' import { cn } from '~/lib/utils' +import { relationshipCodes } from '~/lib/constants' const props = defineProps<{ fieldName: string @@ -18,15 +19,11 @@ const props = defineProps<{ const { fieldName = 'phoneNumber', errors, class: containerClass, selectClass, fieldGroupClass } = props -const emergencyContactOptions = [ - { label: 'Diri sendiri', value: 'self' }, - { label: 'Orang Tua', value: 'parent' }, - { label: 'Anak', value: 'child' }, - { label: 'Keluarga lain', value: 'relative' }, - { label: 'Petugas instansi lainnya', value: 'institution_officer' }, - { label: 'Petugas kesehatan', value: 'health_officer' }, - { label: 'Lainnya', value: 'other', priority: -1 }, -] +const emergencyContactOptions = Object.entries(relationshipCodes).map(([value, label]) => ({ + label, + value, + ...(value === 'other' && { priority: -1 }) +}))