75 lines
4.1 KiB
Vue
75 lines
4.1 KiB
Vue
<script setup>
|
|
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout.vue';
|
|
import { Head, Link, router } from '@inertiajs/vue3';
|
|
import PrimaryButton from '@/Components/PrimaryButton.vue';
|
|
|
|
const props = defineProps({
|
|
templates: Array,
|
|
});
|
|
|
|
const deleteTemplate = (template) => {
|
|
if (confirm('Êtes-vous sûr de vouloir supprimer ce template ?')) {
|
|
router.delete(route('templates.destroy', template.id));
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<Head title="Gestion des Templates" />
|
|
|
|
<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 Modèles d'Intégration
|
|
</h2>
|
|
<Link :href="route('templates.create')">
|
|
<PrimaryButton>Nouveau Modè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">Description</th>
|
|
<th class="px-6 py-3 text-xs font-bold uppercase text-gray-500 dark:text-gray-400">Tâches</th>
|
|
<th class="px-6 py-3 text-xs font-bold uppercase text-gray-500 dark:text-gray-400">Actif</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="template in templates" :key="template.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">
|
|
{{ template.name }}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">
|
|
{{ template.description || '-' }}
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-500 dark:text-gray-400">
|
|
{{ template.service_items_count }}
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<span :class="['px-2 inline-flex text-xs leading-5 font-semibold rounded-full', template.is_active ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800']">
|
|
{{ template.is_active ? 'Oui' : 'Non' }}
|
|
</span>
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-right space-x-2">
|
|
<Link :href="route('templates.edit', template.id)" class="text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300">Modifier</Link>
|
|
<button @click="deleteTemplate(template)" 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>
|