chore: update frontend configuration

This commit is contained in:
Matthieu
2025-09-26 11:29:47 +02:00
parent b7caa4f552
commit a78938a4d1
64 changed files with 5790 additions and 5129 deletions

View File

@@ -3,26 +3,30 @@
<div class="w-full max-w-2xl">
<div class="card bg-base-100 shadow-2xl">
<div class="card-body">
<h1 class="text-2xl font-bold mb-2">Choisir un profil</h1>
<h1 class="text-2xl font-bold mb-2">
Choisir un profil
</h1>
<p class="text-sm text-base-content/70 mb-6">
Sélectionnez votre profil pour accéder à l'application. La création et la gestion se font via le menu utilisateur.
</p>
<section class="space-y-4">
<header class="flex items-center justify-between">
<h2 class="font-semibold">Profils disponibles</h2>
<h2 class="font-semibold">
Profils disponibles
</h2>
<button
type="button"
class="btn btn-ghost btn-xs"
@click="refreshProfiles"
:disabled="loadingProfiles"
@click="refreshProfiles"
>
<span v-if="loadingProfiles" class="loading loading-spinner loading-xs"></span>
<span v-if="loadingProfiles" class="loading loading-spinner loading-xs" />
<span v-else>Rafraîchir</span>
</button>
</header>
<div class="space-y-2 max-h-64 overflow-y-auto" v-if="profiles.length">
<div v-if="profiles.length" class="space-y-2 max-h-64 overflow-y-auto">
<button
v-for="profile in profiles"
:key="profile.id"
@@ -34,10 +38,12 @@
<IconLucideChevronRight class="w-4 h-4" aria-hidden="true" />
</button>
</div>
<p v-else class="text-sm text-base-content/60">Aucun profil enregistré.</p>
<p v-else class="text-sm text-base-content/60">
Aucun profil enregistré.
</p>
</section>
<footer class="mt-6 flex justify-between items-center" v-if="activeProfile">
<footer v-if="activeProfile" class="mt-6 flex justify-between items-center">
<div class="text-sm text-base-content/70">
Profil actuel :
<span class="font-semibold">{{ activeProfile.firstName }} {{ activeProfile.lastName }}</span>
@@ -55,8 +61,7 @@
<script setup>
import { onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { useProfiles } from '#imports'
import { useProfileSession } from '#imports'
import { useProfiles, useProfileSession } from '#imports'
import IconLucideChevronRight from '~icons/lucide/chevron-right'
const router = useRouter()

View File

@@ -3,32 +3,44 @@
<div class="max-w-4xl mx-auto">
<div class="flex items-center justify-between mb-6">
<div>
<h1 class="text-2xl font-bold">Gestion des profils</h1>
<p class="text-sm text-base-content/70">Sélectionnez, créez ou supprimez des profils.</p>
<h1 class="text-2xl font-bold">
Gestion des profils
</h1>
<p class="text-sm text-base-content/70">
Sélectionnez, créez ou supprimez des profils.
</p>
</div>
<NuxtLink to="/" class="btn btn-ghost btn-sm">Retour</NuxtLink>
<NuxtLink to="/" class="btn btn-ghost btn-sm">
Retour
</NuxtLink>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<section class="card bg-base-100 shadow-lg">
<div class="card-body space-y-4">
<header class="flex items-center justify-between">
<h2 class="card-title text-lg">Profils existants</h2>
<button type="button" class="btn btn-ghost btn-xs" @click="refresh" :disabled="loadingProfiles">
<span v-if="loadingProfiles" class="loading loading-spinner loading-xs"></span>
<h2 class="card-title text-lg">
Profils existants
</h2>
<button type="button" class="btn btn-ghost btn-xs" :disabled="loadingProfiles" @click="refresh">
<span v-if="loadingProfiles" class="loading loading-spinner loading-xs" />
<span v-else>Rafraîchir</span>
</button>
</header>
<div class="space-y-2 max-h-80 overflow-y-auto" v-if="profiles.length">
<div v-if="profiles.length" class="space-y-2 max-h-80 overflow-y-auto">
<div
v-for="profile in profiles"
:key="profile.id"
class="flex items-center justify-between rounded-lg border border-base-200 bg-base-100 px-3 py-2"
>
<div>
<p class="font-medium">{{ profile.firstName }} {{ profile.lastName }}</p>
<p class="text-xs text-base-content/60">ID : {{ profile.id }}</p>
<p class="font-medium">
{{ profile.firstName }} {{ profile.lastName }}
</p>
<p class="text-xs text-base-content/60">
ID : {{ profile.id }}
</p>
</div>
<div class="flex items-center gap-2">
<button
@@ -44,19 +56,23 @@
class="btn btn-error btn-sm"
@click="remove(profile.id)"
>
<span v-if="deleting === profile.id" class="loading loading-spinner loading-xs"></span>
<span v-if="deleting === profile.id" class="loading loading-spinner loading-xs" />
<span v-else>Supprimer</span>
</button>
</div>
</div>
</div>
<p v-else class="text-sm text-base-content/60">Aucun profil enregistré.</p>
<p v-else class="text-sm text-base-content/60">
Aucun profil enregistré.
</p>
</div>
</section>
<section class="card bg-base-100 shadow-lg">
<div class="card-body space-y-4">
<h2 class="card-title text-lg">Créer un profil</h2>
<h2 class="card-title text-lg">
Créer un profil
</h2>
<form class="space-y-3" @submit.prevent="create">
<div class="form-control">
<label class="label"><span class="label-text">Prénom</span></label>
@@ -66,7 +82,7 @@
class="input input-bordered"
placeholder="Prénom"
required
/>
>
</div>
<div class="form-control">
<label class="label"><span class="label-text">Nom</span></label>
@@ -76,10 +92,10 @@
class="input input-bordered"
placeholder="Nom"
required
/>
>
</div>
<button type="submit" class="btn btn-primary w-full" :disabled="creating">
<span v-if="creating" class="loading loading-spinner loading-sm"></span>
<span v-if="creating" class="loading loading-spinner loading-sm" />
<span v-else>Créer et activer</span>
</button>
</form>
@@ -87,10 +103,14 @@
</section>
</div>
<div class="mt-8 flex items-center justify-between bg-base-100 shadow-lg rounded-lg p-4" v-if="activeProfile">
<div v-if="activeProfile" class="mt-8 flex items-center justify-between bg-base-100 shadow-lg rounded-lg p-4">
<div>
<p class="text-sm text-base-content/70">Profil actif :</p>
<p class="font-semibold text-base-content">{{ activeProfile.firstName }} {{ activeProfile.lastName }}</p>
<p class="text-sm text-base-content/70">
Profil actif :
</p>
<p class="font-semibold text-base-content">
{{ activeProfile.firstName }} {{ activeProfile.lastName }}
</p>
</div>
<button type="button" class="btn btn-outline" @click="handleLogout">
Déconnexion
@@ -111,7 +131,7 @@ const { activeProfile, activateProfile, fetchCurrentProfile, logout } = useProfi
const createForm = reactive({
firstName: '',
lastName: '',
lastName: ''
})
const creating = ref(false)
@@ -136,7 +156,7 @@ const create = async () => {
try {
const profile = await createProfile({
firstName: createForm.firstName,
lastName: createForm.lastName,
lastName: createForm.lastName
})
createForm.firstName = ''
createForm.lastName = ''
@@ -150,7 +170,7 @@ const create = async () => {
}
const remove = async (profileId) => {
if (!confirm('Supprimer ce profil ?')) return
if (!confirm('Supprimer ce profil ?')) { return }
deleting.value = profileId
try {
await deleteProfile(profileId)