forked from verdnatura/salix-front
53 lines
1.5 KiB
Vue
53 lines
1.5 KiB
Vue
<script setup>
|
|
import { reactive, ref, onMounted, nextTick } from 'vue';
|
|
import { useI18n } from 'vue-i18n';
|
|
import { useRoute } from 'vue-router';
|
|
|
|
import VnInput from 'src/components/common/VnInput.vue';
|
|
import VnRow from 'components/ui/VnRow.vue';
|
|
import FormModelPopup from 'components/FormModelPopup.vue';
|
|
|
|
const { t } = useI18n();
|
|
const emit = defineEmits(['onDataSaved']);
|
|
const route = useRoute();
|
|
|
|
const identifierInputRef = ref(null);
|
|
const intrastatFormData = reactive({});
|
|
|
|
const onDataSaved = (formData, requestResponse) => {
|
|
emit('onDataSaved', formData, requestResponse);
|
|
};
|
|
|
|
onMounted(async () => {
|
|
await nextTick();
|
|
identifierInputRef.value.focus();
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<FormModelPopup
|
|
:url-update="`Items/${route.params.id}/createIntrastat`"
|
|
model="itemGenus"
|
|
:title="t('createIntrastatForm.title')"
|
|
:form-initial-data="intrastatFormData"
|
|
@on-data-saved="onDataSaved"
|
|
>
|
|
<template #form-inputs="{ data }">
|
|
<VnRow>
|
|
<VnInput
|
|
ref="identifierInputRef"
|
|
:label="t('createIntrastatForm.identifier')"
|
|
type="number"
|
|
v-model.number="data.intrastatId"
|
|
:required="true"
|
|
/>
|
|
<VnInput
|
|
:label="t('createIntrastatForm.description')"
|
|
v-model="data.description"
|
|
:required="true"
|
|
/>
|
|
</VnRow>
|
|
</template>
|
|
</FormModelPopup>
|
|
</template>
|