feat: ajout du suivi des suggestions avec intégration Gitea
This commit is contained in:
@@ -42,7 +42,10 @@
|
||||
|
||||
<!-- Menu déroulant -->
|
||||
<div class="absolute right-0 mt-0 w-48 bg-white rounded-lg shadow-xl border border-gray-200 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50">
|
||||
<a href="{{ route('profile.settings') }}" class="block px-4 py-3 text-sm text-gray-700 hover:bg-gray-50 border-b border-gray-200 rounded-t-lg">
|
||||
<a href="{{ route('suggestions.index') }}" class="block px-4 py-3 text-sm text-gray-700 hover:bg-gray-50 border-b border-gray-200 rounded-t-lg">
|
||||
💬 Mes suggestions
|
||||
</a>
|
||||
<a href="{{ route('profile.settings') }}" class="block px-4 py-3 text-sm text-gray-700 hover:bg-gray-50 border-b border-gray-200">
|
||||
⚙️ Paramètres du profil
|
||||
</a>
|
||||
<form action="{{ route('logout') }}" method="POST">
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
@extends('app')
|
||||
|
||||
@section('title', 'Mes suggestions - (RE)Sources Relationnelles')
|
||||
|
||||
@section('content')
|
||||
<section class="container mx-auto px-4 py-12">
|
||||
<div class="max-w-3xl mx-auto">
|
||||
<!-- En-tête -->
|
||||
<div class="flex items-start justify-between mb-8">
|
||||
<div>
|
||||
<h1 class="text-4xl font-bold text-gray-900 mb-2">💬 Mes suggestions</h1>
|
||||
<p class="text-gray-600">
|
||||
Suivez ici la prise en compte de vos suggestions par l'équipe : état du ticket,
|
||||
réponses reçues, et poursuivez la discussion.
|
||||
</p>
|
||||
</div>
|
||||
<a href="{{ route('suggestions.create') }}" class="shrink-0 inline-flex items-center px-4 py-2.5 text-sm font-bold text-niagara border-2 border-niagara rounded-lg hover:bg-niagara hover:text-white transition-smooth duration-200">
|
||||
💡 Nouvelle suggestion
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Message de succès -->
|
||||
@if (session('success'))
|
||||
<div class="mb-6 p-4 bg-green-50 border border-green-200 rounded-lg">
|
||||
<p class="text-green-700 font-semibold">✅ {{ session('success') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@forelse ($suggestions as $suggestion)
|
||||
@php($etat = $etats[$suggestion->ID_Suggestion] ?? null)
|
||||
@php($nouvelles = $etat ? max(0, $etat['comments'] - $suggestion->CommentairesVus) : 0)
|
||||
<a href="{{ route('suggestions.show', $suggestion) }}"
|
||||
class="block bg-white rounded-xl border border-gray-200 p-6 mb-4 hover:border-niagara hover:shadow-md transition-smooth duration-200">
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div class="min-w-0">
|
||||
<div class="flex items-center gap-2 mb-1 flex-wrap">
|
||||
<span class="px-2 py-0.5 text-xs font-bold rounded-full bg-gray-100 text-gray-700">{{ $suggestion->Type }}</span>
|
||||
@if ($etat === null)
|
||||
<span class="px-2 py-0.5 text-xs font-bold rounded-full bg-gray-100 text-gray-500">⚪ État indisponible</span>
|
||||
@elseif ($etat['state'] === 'closed')
|
||||
<span class="px-2 py-0.5 text-xs font-bold rounded-full bg-purple-100 text-purple-700">✔️ Traitée</span>
|
||||
@else
|
||||
<span class="px-2 py-0.5 text-xs font-bold rounded-full bg-green-100 text-green-700">🟢 En cours</span>
|
||||
@endif
|
||||
@if ($nouvelles > 0)
|
||||
<span class="px-2 py-0.5 text-xs font-bold rounded-full bg-candlelight text-gray-900">
|
||||
🔔 {{ $nouvelles }} {{ $nouvelles > 1 ? 'nouvelles réponses' : 'nouvelle réponse' }}
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
<p class="font-bold text-gray-900 truncate">{{ $suggestion->Titre }}</p>
|
||||
<p class="text-sm text-gray-500">
|
||||
Envoyée le {{ $suggestion->DateCreation->format('d/m/Y à H\hi') }}
|
||||
@if ($suggestion->GiteaIssueNumber)
|
||||
· ticket n°{{ $suggestion->GiteaIssueNumber }}
|
||||
@endif
|
||||
@if ($etat)
|
||||
· {{ $etat['comments'] }} {{ $etat['comments'] > 1 ? 'réponses' : 'réponse' }}
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
<span class="text-gray-400 text-xl shrink-0">→</span>
|
||||
</div>
|
||||
</a>
|
||||
@empty
|
||||
<div class="bg-white rounded-xl border border-gray-200 p-10 text-center">
|
||||
<p class="text-gray-600 mb-4">Vous n'avez pas encore envoyé de suggestion.</p>
|
||||
<a href="{{ route('suggestions.create') }}" class="inline-flex items-center px-6 py-3 font-bold bg-candlelight text-gray-900 rounded-lg shadow-md hover:shadow-lg transition-smooth duration-200">
|
||||
💡 Proposer une amélioration
|
||||
</a>
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
@@ -0,0 +1,105 @@
|
||||
@extends('app')
|
||||
|
||||
@section('title', 'Suivi de ma suggestion - (RE)Sources Relationnelles')
|
||||
|
||||
@section('content')
|
||||
<section class="container mx-auto px-4 py-12">
|
||||
<div class="max-w-3xl mx-auto">
|
||||
<a href="{{ route('suggestions.index') }}" class="inline-block text-sm text-gray-500 hover:text-niagara mb-4">← Retour à mes suggestions</a>
|
||||
|
||||
<!-- En-tête -->
|
||||
<div class="mb-6">
|
||||
<div class="flex items-center gap-2 mb-2 flex-wrap">
|
||||
<span class="px-2 py-0.5 text-xs font-bold rounded-full bg-gray-100 text-gray-700">{{ $suggestion->Type }}</span>
|
||||
@if ($issue === null)
|
||||
<span class="px-2 py-0.5 text-xs font-bold rounded-full bg-gray-100 text-gray-500">⚪ État indisponible</span>
|
||||
@elseif ($issue['state'] === 'closed')
|
||||
<span class="px-2 py-0.5 text-xs font-bold rounded-full bg-purple-100 text-purple-700">✔️ Traitée</span>
|
||||
@else
|
||||
<span class="px-2 py-0.5 text-xs font-bold rounded-full bg-green-100 text-green-700">🟢 En cours de traitement</span>
|
||||
@endif
|
||||
@if ($suggestion->GiteaIssueNumber)
|
||||
<span class="text-xs text-gray-400">Ticket n°{{ $suggestion->GiteaIssueNumber }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<h1 class="text-3xl font-bold text-gray-900">{{ $suggestion->Titre }}</h1>
|
||||
<p class="text-sm text-gray-500 mt-1">Envoyée le {{ $suggestion->DateCreation->format('d/m/Y à H\hi') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Messages -->
|
||||
@if (session('success'))
|
||||
<div class="mb-6 p-4 bg-green-50 border border-green-200 rounded-lg">
|
||||
<p class="text-green-700 font-semibold">✅ {{ session('success') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
@if ($errors->any())
|
||||
<div class="mb-6 p-4 bg-red-50 border border-red-200 rounded-lg">
|
||||
@foreach ($errors->all() as $error)
|
||||
<p class="text-red-700 text-sm">{{ $error }}</p>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Ma demande -->
|
||||
<div class="bg-white rounded-xl border-2 border-niagara p-6 mb-6">
|
||||
<p class="text-xs font-bold text-niagara uppercase mb-2">Votre demande</p>
|
||||
<p class="text-gray-800 whitespace-pre-line">{{ $suggestion->Description }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Fil de discussion -->
|
||||
<h2 class="text-xl font-bold text-gray-900 mb-4">
|
||||
Réponses {{ count($commentaires) > 0 ? '('.count($commentaires).')' : '' }}
|
||||
</h2>
|
||||
|
||||
@forelse ($commentaires as $commentaire)
|
||||
<div class="bg-white rounded-xl border border-gray-200 p-5 mb-3">
|
||||
<div class="flex items-center gap-2 mb-2">
|
||||
<img
|
||||
src="https://ui-avatars.com/api/?name={{ urlencode($commentaire['auteur']) }}&background=06989e&color=fff&size=32"
|
||||
alt=""
|
||||
class="w-8 h-8 rounded-full"
|
||||
>
|
||||
<span class="font-bold text-gray-900 text-sm">{{ $commentaire['auteur'] }}</span>
|
||||
@if ($commentaire['date'])
|
||||
<span class="text-xs text-gray-400">· {{ \Illuminate\Support\Carbon::parse($commentaire['date'])->format('d/m/Y à H\hi') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<p class="text-gray-800 text-sm whitespace-pre-line">{{ $commentaire['corps'] }}</p>
|
||||
</div>
|
||||
@empty
|
||||
<div class="bg-gray-50 rounded-xl border border-dashed border-gray-300 p-6 mb-3 text-center">
|
||||
<p class="text-gray-500 text-sm">
|
||||
Pas encore de réponse de l'équipe — vous serez notifié ici dès qu'une réponse sera publiée.
|
||||
</p>
|
||||
</div>
|
||||
@endforelse
|
||||
|
||||
<!-- Répondre -->
|
||||
@if ($suggestion->GiteaIssueNumber && ($issue['state'] ?? 'open') !== 'closed')
|
||||
<form action="{{ route('suggestions.repondre', $suggestion) }}" method="POST" class="bg-white rounded-xl border border-gray-200 p-6 mt-6">
|
||||
@csrf
|
||||
<label for="message" class="block text-sm font-bold mb-2 text-gray-700">Répondre sur le ticket</label>
|
||||
<textarea
|
||||
id="message"
|
||||
name="message"
|
||||
required
|
||||
minlength="2"
|
||||
maxlength="2000"
|
||||
rows="4"
|
||||
placeholder="Apportez une précision, répondez à l'équipe…"
|
||||
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-niagara outline-none @error('message') border-red-500 @enderror">{{ old('message') }}</textarea>
|
||||
@error('message')
|
||||
<p class="text-red-600 text-xs mt-1">{{ $message }}</p>
|
||||
@enderror
|
||||
<button type="submit" class="mt-3 px-6 py-2.5 font-bold gradient-niagara text-white rounded-lg hover:shadow-lg transition-smooth duration-200">
|
||||
📨 Envoyer ma réponse
|
||||
</button>
|
||||
</form>
|
||||
@elseif (($issue['state'] ?? null) === 'closed')
|
||||
<p class="text-sm text-gray-500 mt-6 text-center">
|
||||
Cette suggestion a été traitée : le ticket est clôturé. Merci pour votre contribution !
|
||||
</p>
|
||||
@endif
|
||||
</div>
|
||||
</section>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user