Files

104 lines
5.3 KiB
Vue

<script setup>
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout.vue';
import { Head, useForm } from '@inertiajs/vue3';
import InputError from '@/Components/InputError.vue';
import InputLabel from '@/Components/InputLabel.vue';
import PrimaryButton from '@/Components/PrimaryButton.vue';
import TextInput from '@/Components/TextInput.vue';
const props = defineProps({
templates: Array,
});
const form = useForm({
first_name: '',
last_name: '',
email: '',
position: '',
department: '',
arrival_date: '',
template_id: props.templates.length > 0 ? props.templates[0].id : '',
});
const submit = () => {
form.post(route('integrations.store'));
};
</script>
<template>
<Head title="Nouvelle Intégration" />
<AuthenticatedLayout>
<template #header>
<h2 class="text-xl font-semibold leading-tight text-gray-800 dark:text-gray-200">
Nouvelle fiche agent
</h2>
</template>
<div class="py-12">
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg dark:bg-gray-800 p-8 max-w-2xl mx-auto">
<form @submit.prevent="submit" class="space-y-6">
<div class="grid grid-cols-2 gap-4">
<div>
<InputLabel for="first_name" value="Prénom" />
<TextInput id="first_name" type="text" class="mt-1 block w-full" v-model="form.first_name" required autofocus />
<InputError class="mt-2" :message="form.errors.first_name" />
</div>
<div>
<InputLabel for="last_name" value="Nom" />
<TextInput id="last_name" type="text" class="mt-1 block w-full" v-model="form.last_name" required />
<InputError class="mt-2" :message="form.errors.last_name" />
</div>
</div>
<div>
<InputLabel for="email" value="Email" />
<TextInput id="email" type="email" class="mt-1 block w-full" v-model="form.email" required />
<InputError class="mt-2" :message="form.errors.email" />
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<InputLabel for="position" value="Poste" />
<TextInput id="position" type="text" class="mt-1 block w-full" v-model="form.position" required />
<InputError class="mt-2" :message="form.errors.position" />
</div>
<div>
<InputLabel for="department" value="Service de destination" />
<TextInput id="department" type="text" class="mt-1 block w-full" v-model="form.department" required />
<InputError class="mt-2" :message="form.errors.department" />
</div>
</div>
<div>
<InputLabel for="arrival_date" value="Date d'arrivée" />
<TextInput id="arrival_date" type="date" class="mt-1 block w-full" v-model="form.arrival_date" required />
<InputError class="mt-2" :message="form.errors.arrival_date" />
</div>
<div class="warning-box bg-red-500 p-4 rounded-md text-center">
<span class="text-white">Attention, si vous selectionner l'option <b><u>AVEC TELEPHONE PORTABLE</u></b> une validation de la direction générale est nécessaire.</span>
<br>
<span class="text-white"><b><u><i>C'est à vous d'initier celle-ci auprès de votre Direction Générale Adjointe</i></u></b></span>
</div>
<div>
<InputLabel for="template_id" value="Template de parcours" />
<select id="template_id" v-model="form.template_id" class="mt-1 block w-full border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-indigo-500 dark:focus:border-indigo-600 focus:ring-indigo-500 dark:focus:ring-indigo-600 rounded-md shadow-sm">
<option value="">Aucun (Pas de tâches)</option>
<option v-for="t in templates" :key="t.id" :value="t.id">{{ t.name }}</option>
</select>
<InputError class="mt-2" :message="form.errors.template_id" />
</div>
<div class="flex items-center justify-end mt-4">
<PrimaryButton class="ml-4" :class="{ 'opacity-25': form.processing }" :disabled="form.processing">
Créer la fiche agent
</PrimaryButton>
</div>
</form>
</div>
</div>
</div>
</AuthenticatedLayout>
</template>