Files
simrsx-fe/app/components/app/device/entry-form.vue
T

65 lines
2.0 KiB
Vue

<script setup lang="ts">
import Block from '~/components/pub/custom-ui/form/block.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; errors: any }>()
const emit = defineEmits(['update:modelValue', 'event'])
const data = computed({
get: () => props.modelValue,
set: (val) => {
emit('update:modelValue', val)
},
})
const items = [
{ value: 'item1', label: 'Item 1' },
{ value: 'item2', label: 'Item 2' },
]
</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="1">
<Label>Kode</Label>
<Field>
<Input v-model="data.code" />
</Field>
</FieldGroup>
<FieldGroup v-if="!!props.errors.code">
<Label></Label>
<span class="text-red-400 text-sm">{{ props.errors.code }}</span>
</FieldGroup>
<FieldGroup :column="1">
<Label>Nama</Label>
<Field>
<Input v-model="data.name" />
</Field>
</FieldGroup>
<FieldGroup v-if="!!props.errors.name">
<Label></Label>
<span class="text-red-400 text-sm">{{ props.errors.name }}</span>
</FieldGroup>
<FieldGroup :column="1">
<Label>Item</Label>
<Field>
<Select v-model="data.type" :items="items" placeholder="Pilih item" />
</Field>
</FieldGroup>
<FieldGroup :column="1">
<Label>Satuan</Label>
<Field>
<Select v-model="data.uom" :items="items" placeholder="Pilih item" />
</Field>
</FieldGroup>
</Block>
</div>
</div>
</form>
</template>