ee3bb1cd6e
Consolidate XError, XErrors, and FormErrors types into a single file for better maintainability and consistency across the codebase.
67 lines
1.9 KiB
Vue
67 lines
1.9 KiB
Vue
<script setup lang="ts">
|
|
import type { FormErrors } from '~/types/error'
|
|
import Block from '~/components/pub/custom-ui/form/block.vue'
|
|
import Combobox from '~/components/pub/custom-ui/form/combobox.vue'
|
|
import FieldGroup from '~/components/pub/custom-ui/form/field-group.vue'
|
|
import Field from '~/components/pub/custom-ui/form/field.vue'
|
|
import Label from '~/components/pub/custom-ui/form/label.vue'
|
|
|
|
const props = defineProps<{
|
|
modelValue: any
|
|
division: {
|
|
msg: {
|
|
placeholder: string
|
|
search: string
|
|
empty: string
|
|
}
|
|
items: {
|
|
value: string
|
|
label: string
|
|
code: string
|
|
}[]
|
|
}
|
|
errors?: FormErrors
|
|
}>()
|
|
const emit = defineEmits(['update:modelValue', 'event'])
|
|
|
|
const data = computed({
|
|
get: () => props.modelValue,
|
|
set: (val) => emit('update:modelValue', val),
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<form id="entry-form">
|
|
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
|
|
<div class="flex flex-col justify-between">
|
|
<Block>
|
|
<FieldGroup :column="2">
|
|
<Label>Nama</Label>
|
|
<Field id="name" :errors="errors">
|
|
<Input v-model="data.name" />
|
|
</Field>
|
|
</FieldGroup>
|
|
<FieldGroup :column="2">
|
|
<Label>Kode</Label>
|
|
<Field id="code" :errors="errors">
|
|
<Input v-model="data.code" />
|
|
</Field>
|
|
</FieldGroup>
|
|
<FieldGroup :column="2">
|
|
<Label>Divisi</Label>
|
|
<Field id="parentId" :errors="errors">
|
|
<Combobox
|
|
v-model="data.parentId"
|
|
:items="props.division.items"
|
|
:placeholder="props.division.msg.placeholder"
|
|
:search-placeholder="props.division.msg.search"
|
|
:empty-message="props.division.msg.empty"
|
|
/>
|
|
</Field>
|
|
</FieldGroup>
|
|
</Block>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</template>
|