<script setup>
import { useI18n } from 'vue-i18n';

import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FormModelPopup from 'src/components/FormModelPopup.vue';

const emit = defineEmits(['onDataSaved']);

const { t } = useI18n();

const onDataSaved = (dataSaved) => {
    emit('onDataSaved', dataSaved);
};
</script>

<template>
    <FormModelPopup
        :form-initial-data="{}"
        :title="t('New customs agent')"
        @on-data-saved="onDataSaved($event)"
        model="customer"
        url-create="CustomsAgents"
    >
        <template #form-inputs="{ data }">
            <VnRow>
                <VnInput
                    :label="t('NIF')"
                    :required="true"
                    clearable
                    v-model="data.nif"
                />
                <VnInput
                    :label="t('Fiscal name')"
                    :required="true"
                    clearable
                    v-model="data.fiscalName"
                />
            </VnRow>
            <VnRow>
                <VnInput :label="t('Street')" clearable v-model="data.street" />
                <VnInput :label="t('Phone')" clearable v-model="data.phone" />
            </VnRow>
        </template>
    </FormModelPopup>
</template>

<i18n>
es:
    New customs agent: Nuevo agente de aduanas
    NIF: NIF
    Fiscal name: Nombre fiscal
    Street: Dirección fiscal
    Phone: Teléfono
</i18n>
