feat(person-relative): restructure contact relation components
Move select-relations component to fields directory and update imports Add new table-head component for consistent styling
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { toTypedSchema } from '@vee-validate/zod'
|
import { toTypedSchema } from '@vee-validate/zod'
|
||||||
import { FieldArray } from 'vee-validate'
|
import { FieldArray } from 'vee-validate'
|
||||||
|
|
||||||
|
// components
|
||||||
|
import { Form } from '~/components/pub/ui/form'
|
||||||
import InputBase from '~/components/pub/my-ui/form/input-base.vue'
|
import InputBase from '~/components/pub/my-ui/form/input-base.vue'
|
||||||
import Label from '~/components/pub/my-ui/form/label.vue'
|
import Label from '~/components/pub/my-ui/form/label.vue'
|
||||||
import SelectContactRelation from './_common/select-relations.vue'
|
import { SelectRelations } from './fields'
|
||||||
import { Form } from '~/components/pub/ui/form'
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
title: string
|
title: string
|
||||||
@@ -77,7 +79,7 @@ defineExpose({
|
|||||||
>
|
>
|
||||||
Hubungan dengan Pasien
|
Hubungan dengan Pasien
|
||||||
</Label>
|
</Label>
|
||||||
<SelectContactRelation
|
<SelectRelations
|
||||||
:field-name="`contacts[${idx}].relation`"
|
:field-name="`contacts[${idx}].relation`"
|
||||||
placeholder="Pilih"
|
placeholder="Pilih"
|
||||||
field-group-class="mb-0"
|
field-group-class="mb-0"
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export { default as SelectRelations } from './select-relations.vue'
|
||||||
+5
-7
@@ -1,15 +1,14 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { FormErrors } from '~/types/error'
|
import { cn } from '~/lib/utils'
|
||||||
|
import { relationshipCodes } from '~/lib/constants'
|
||||||
|
|
||||||
import FieldGroup from '~/components/pub/my-ui/form/field-group.vue'
|
import FieldGroup from '~/components/pub/my-ui/form/field-group.vue'
|
||||||
import Field from '~/components/pub/my-ui/form/field.vue'
|
import Field from '~/components/pub/my-ui/form/field.vue'
|
||||||
import Select from '~/components/pub/my-ui/form/select.vue'
|
import Select from '~/components/pub/my-ui/form/select.vue'
|
||||||
import { cn } from '~/lib/utils'
|
|
||||||
import { relationshipCodes } from '~/lib/constants'
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
fieldName: string
|
fieldName: string
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
errors?: FormErrors
|
|
||||||
class?: string
|
class?: string
|
||||||
selectClass?: string
|
selectClass?: string
|
||||||
fieldGroupClass?: string
|
fieldGroupClass?: string
|
||||||
@@ -17,12 +16,12 @@ const props = defineProps<{
|
|||||||
isDisabled?: boolean
|
isDisabled?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { fieldName = 'phoneNumber', errors, class: containerClass, selectClass, fieldGroupClass } = props
|
const { fieldName = 'phoneNumber', class: containerClass, selectClass, fieldGroupClass } = props
|
||||||
|
|
||||||
const emergencyContactOptions = Object.entries(relationshipCodes).map(([value, label]) => ({
|
const emergencyContactOptions = Object.entries(relationshipCodes).map(([value, label]) => ({
|
||||||
label,
|
label,
|
||||||
value,
|
value,
|
||||||
...(value === 'other' && { priority: -1 })
|
...(value === 'other' && { priority: -1 }),
|
||||||
}))
|
}))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -30,7 +29,6 @@ const emergencyContactOptions = Object.entries(relationshipCodes).map(([value, l
|
|||||||
<FieldGroup :class="cn('select-field-group', fieldGroupClass, containerClass)">
|
<FieldGroup :class="cn('select-field-group', fieldGroupClass, containerClass)">
|
||||||
<Field
|
<Field
|
||||||
:id="fieldName"
|
:id="fieldName"
|
||||||
:errors="errors"
|
|
||||||
:class="cn('select-field-wrapper')"
|
:class="cn('select-field-wrapper')"
|
||||||
>
|
>
|
||||||
<FormField
|
<FormField
|
||||||
Reference in New Issue
Block a user