feat: Implement initial agent integration management system with role-based dashboards, status tracking, and activity timelines.

This commit is contained in:
jeremy bayse
2026-02-16 19:22:18 +01:00
parent af060a8847
commit e7bff2ae80
19 changed files with 533 additions and 24 deletions

View File

@@ -55,7 +55,7 @@ const props = defineProps({
Détails
</Link>
<span class="text-gray-300 dark:text-gray-600">|</span>
<a :href="route('integrations.pdf', req.id)" target="_blank" class="flex items-center gap-1 text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300 font-medium transition-colors" title="Télécharger la fiche PDF">
<a v-if="req.status === 'completed'" :href="route('integrations.pdf', req.id)" target="_blank" class="flex items-center gap-1 text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300 font-medium transition-colors" title="Télécharger la fiche PDF">
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>

View File

@@ -132,8 +132,18 @@ const props = defineProps({
</td>
<td class="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">{{ req.agent.department }}</td>
<td class="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">{{ req.completed_at ? new Date(req.completed_at).toLocaleDateString() : '-' }}</td>
<td class="px-6 py-4 text-sm">
<td class="px-6 py-4 text-sm flex items-center space-x-3">
<Link :href="route('integrations.show', req.id)" class="text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300">Consulter</Link>
<a
:href="route('integrations.pdf', req.id)"
target="_blank"
class="text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300 font-medium flex items-center"
title="Télécharger PDF"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</a>
</td>
</tr>
<tr v-if="completed_integrations.length === 0">

View File

@@ -8,6 +8,10 @@ const props = defineProps({
role: String,
my_tasks: Array,
completed_tasks: Array,
processed_integrations: {
type: Array,
default: () => []
},
});
const getOverdueCount = () => {
@@ -83,6 +87,54 @@ const getOverdueCount = () => {
</table>
</div>
</div>
<!-- Processed Integrations (Recent) -->
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg dark:bg-gray-800">
<div class="p-6 border-b border-gray-200 dark:border-gray-700">
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">Fiches traitées (Récent)</h3>
</div>
<div class="overflow-x-auto">
<table class="w-full text-left border-collapse">
<thead>
<tr class="bg-gray-50 dark:bg-gray-700/50">
<th class="px-6 py-3 text-xs font-bold uppercase text-gray-500 dark:text-gray-400">Agent</th>
<th class="px-6 py-3 text-xs font-bold uppercase text-gray-500 dark:text-gray-400">Arrivée</th>
<th class="px-6 py-3 text-xs font-bold uppercase text-gray-500 dark:text-gray-400">Template</th>
<th class="px-6 py-3 text-xs font-bold uppercase text-gray-500 dark:text-gray-400">Action</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
<tr v-for="integration in processed_integrations" :key="integration.id" class="hover:bg-gray-50 dark:hover:bg-gray-700/30">
<td class="px-6 py-4">
<div class="text-sm font-medium text-gray-900 dark:text-white">{{ integration.agent.first_name }} {{ integration.agent.last_name }}</div>
<div class="text-xs text-gray-500 dark:text-gray-400">{{ integration.agent.position }}</div>
</td>
<td class="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">{{ new Date(integration.agent.arrival_date).toLocaleDateString() }}</td>
<td class="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">{{ integration.template?.name || 'Standard' }}</td>
<td class="px-6 py-4 text-sm">
<div class="flex items-center space-x-3">
<Link :href="route('integrations.show', integration.id)" class="text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300">Voir</Link>
<a
v-if="integration.status === 'completed'"
:href="route('integrations.pdf', integration.id)"
target="_blank"
class="text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300 font-medium flex items-center"
title="Télécharger PDF"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</a>
</div>
</td>
</tr>
<tr v-if="processed_integrations.length === 0">
<td colspan="4" class="px-6 py-8 text-center text-gray-500 dark:text-gray-400 italic text-sm">Aucune fiche traitée récemment</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</AuthenticatedLayout>

View File

@@ -31,7 +31,9 @@ const validateRH = () => {
<template #header>
<div class="flex items-center justify-between">
<h2 class="text-xl font-semibold leading-tight text-gray-800 dark:text-gray-200">
Integration: {{ integration.agent.first_name }} {{ integration.agent.last_name }}
<span v-if="integration.type === 'offboarding'" class="text-red-600 mr-2">[DÉPART]</span>
<span v-else class="text-green-600 mr-2">[ARRIVÉE]</span>
Fiche Agent : {{ integration.agent.first_name }} {{ integration.agent.last_name }}
</h2>
<div class="flex items-center space-x-4">
<button
@@ -41,6 +43,17 @@ const validateRH = () => {
>
Valider Dossier RH
</button>
<a
v-if="integration.status === 'completed'"
:href="route('integrations.pdf', integration.id)"
target="_blank"
class="inline-flex items-center px-4 py-2 bg-red-600 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-red-700 focus:bg-red-700 active:bg-red-900 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition ease-in-out duration-150"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
Télécharger PDF
</a>
<StatusBadge :status="integration.status" />
</div>
</div>

View File

@@ -0,0 +1,75 @@
<script setup>
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout.vue';
import { Head, useForm, Link } from '@inertiajs/vue3';
import PrimaryButton from '@/Components/PrimaryButton.vue';
import InputError from '@/Components/InputError.vue';
import InputLabel from '@/Components/InputLabel.vue';
import TextInput from '@/Components/TextInput.vue';
const props = defineProps({
permissions: Array,
});
const form = useForm({
name: '',
permissions: [],
});
const submit = () => {
form.post(route('roles.store'));
};
</script>
<template>
<Head title="Nouveau Rôle" />
<AuthenticatedLayout>
<template #header>
<h2 class="text-xl font-semibold leading-tight text-gray-800 dark:text-gray-200">
Nouveau Rôle
</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-6">
<form @submit.prevent="submit" class="space-y-6 max-w-xl">
<div>
<InputLabel for="name" value="Nom du Rôle" />
<TextInput
id="name"
type="text"
class="mt-1 block w-full"
v-model="form.name"
required
autofocus
/>
<InputError class="mt-2" :message="form.errors.name" />
</div>
<div>
<span class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Permissions</span>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<label v-for="permission in permissions" :key="permission.id" class="flex items-center space-x-2">
<input
type="checkbox"
:value="permission.name"
v-model="form.permissions"
class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:focus:ring-indigo-600 dark:focus:ring-offset-gray-800"
>
<span class="text-sm text-gray-700 dark:text-gray-300">{{ permission.name }}</span>
</label>
</div>
<InputError class="mt-2" :message="form.errors.permissions" />
</div>
<div class="flex items-center gap-4">
<PrimaryButton :disabled="form.processing">Enregistrer</PrimaryButton>
<Link :href="route('roles.index')" class="text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 underline">Annuler</Link>
</div>
</form>
</div>
</div>
</div>
</AuthenticatedLayout>
</template>

View File

@@ -0,0 +1,78 @@
<script setup>
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout.vue';
import { Head, useForm, Link } from '@inertiajs/vue3';
import PrimaryButton from '@/Components/PrimaryButton.vue';
import InputError from '@/Components/InputError.vue';
import InputLabel from '@/Components/InputLabel.vue';
import TextInput from '@/Components/TextInput.vue';
const props = defineProps({
role: Object,
permissions: Array,
});
const form = useForm({
name: props.role.name,
permissions: props.role.permissions.map(p => p.name),
});
const submit = () => {
form.put(route('roles.update', props.role.id));
};
</script>
<template>
<Head title="Modifier Rôle" />
<AuthenticatedLayout>
<template #header>
<h2 class="text-xl font-semibold leading-tight text-gray-800 dark:text-gray-200">
Modifier Rôle : {{ role.name }}
</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-6">
<form @submit.prevent="submit" class="space-y-6 max-w-xl">
<div>
<InputLabel for="name" value="Nom du Rôle" />
<TextInput
id="name"
type="text"
class="mt-1 block w-full"
v-model="form.name"
required
autofocus
:disabled="role.name === 'Admin'"
/>
<p v-if="role.name === 'Admin'" class="text-xs text-gray-500 mt-1">Le nom du rôle Admin ne peut pas être modifié.</p>
<InputError class="mt-2" :message="form.errors.name" />
</div>
<div>
<span class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Permissions</span>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<label v-for="permission in permissions" :key="permission.id" class="flex items-center space-x-2">
<input
type="checkbox"
:value="permission.name"
v-model="form.permissions"
class="rounded border-gray-300 text-indigo-600 shadow-sm focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:focus:ring-indigo-600 dark:focus:ring-offset-gray-800"
>
<span class="text-sm text-gray-700 dark:text-gray-300">{{ permission.name }}</span>
</label>
</div>
<InputError class="mt-2" :message="form.errors.permissions" />
</div>
<div class="flex items-center gap-4">
<PrimaryButton :disabled="form.processing">Enregistrer</PrimaryButton>
<Link :href="route('roles.index')" class="text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 underline">Annuler</Link>
</div>
</form>
</div>
</div>
</div>
</AuthenticatedLayout>
</template>

View File

@@ -0,0 +1,68 @@
<script setup>
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout.vue';
import { Head, Link, router } from '@inertiajs/vue3';
import PrimaryButton from '@/Components/PrimaryButton.vue';
const props = defineProps({
roles: Array,
});
const deleteRole = (role) => {
if (confirm('Êtes-vous sûr de vouloir supprimer ce rôle ?')) {
router.delete(route('roles.destroy', role.id));
}
};
</script>
<template>
<Head title="Gestion des Rôles" />
<AuthenticatedLayout>
<template #header>
<div class="flex justify-between items-center">
<h2 class="text-xl font-semibold leading-tight text-gray-800 dark:text-gray-200">
Gestion des Rôles
</h2>
<Link :href="route('roles.create')">
<PrimaryButton>Nouveau Rôle</PrimaryButton>
</Link>
</div>
</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">
<div class="overflow-x-auto">
<table class="w-full text-left border-collapse">
<thead>
<tr class="border-b dark:border-gray-700 bg-gray-50 dark:bg-gray-700/50">
<th class="px-6 py-3 text-xs font-bold uppercase text-gray-500 dark:text-gray-400">Nom</th>
<th class="px-6 py-3 text-xs font-bold uppercase text-gray-500 dark:text-gray-400">Permissions</th>
<th class="px-6 py-3 text-xs font-bold uppercase text-gray-500 dark:text-gray-400 text-right">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 dark:divide-gray-700">
<tr v-for="role in roles" :key="role.id" class="hover:bg-gray-50 dark:hover:bg-gray-700/30">
<td class="px-6 py-4 text-sm font-medium text-gray-900 dark:text-white">
{{ role.name }}
</td>
<td class="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">
<div class="flex flex-wrap gap-1">
<span v-for="permission in role.permissions" :key="permission.id" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300">
{{ permission.name }}
</span>
</div>
</td>
<td class="px-6 py-4 text-sm text-right space-x-2">
<Link :href="route('roles.edit', role.id)" class="text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300">Modifier</Link>
<button v-if="role.name !== 'Admin'" @click="deleteRole(role)" class="text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300">Supprimer</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</AuthenticatedLayout>
</template>