Compare commits
8 Commits
a5452624cb
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 955ae61e86 | |||
| 29e6fec64d | |||
| 35c2fb9ca0 | |||
| df8af066fc | |||
| 889902aa4f | |||
| 7d52c1e440 | |||
| d452a9cfa3 | |||
| 69da55b292 |
+2
-1
@@ -7,7 +7,8 @@ et le versionnage suit [SemVer](https://semver.org/lang/fr/).
|
||||
## [Non publié]
|
||||
|
||||
### Ajouté
|
||||
- Formulaire de suggestions/signalements (utilisateur connecté) créant un ticket dans Gitea via son API.
|
||||
- Page publique de téléchargement des applications mobiles Android / iOS (`/telecharger`).
|
||||
- Système de tickets connecté à Gitea : création, suivi de l'avancement (état, jalon, labels), fil de discussion et réponses depuis l'interface web.
|
||||
- Pipeline d'intégration continue Gitea Actions (tests, Pint, audit de sécurité).
|
||||
- Pipeline de déploiement continu (build image → registre Gitea → webhook Portainer).
|
||||
- Middleware `SecurityHeaders` (HSTS, CSP, X-Frame-Options, etc.).
|
||||
|
||||
@@ -68,4 +68,10 @@ GITEA_URL=https://gitea.sam-coffre.duckdns.org
|
||||
GITEA_TOKEN=
|
||||
GITEA_REPO=sam/cesizen
|
||||
|
||||
# --- Applications mobiles (page /telecharger) ---
|
||||
MOBILE_ANDROID_URL=
|
||||
MOBILE_IOS_URL=
|
||||
MOBILE_ANDROID_VERSION=1.0.0
|
||||
MOBILE_IOS_VERSION=1.0.0
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
|
||||
@@ -19,13 +19,15 @@ LOG_CHANNEL=stack
|
||||
LOG_STACK=daily # rotation quotidienne des logs
|
||||
LOG_LEVEL=warning # on ne loggue pas le debug en prod
|
||||
|
||||
# ── Base de données (MySQL/MariaDB en production) ─────────────
|
||||
# ── Base de données (serveur MySQL/MariaDB du réseau) ─────────
|
||||
# DB_HOST = IP ou nom d'hôte du serveur MySQL (ex : 192.168.x.x sur le LAN,
|
||||
# ou le nom d'un conteneur si la base est dans la même stack Docker).
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=cesizen-db
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=cesizen
|
||||
DB_USERNAME=cesizen_app # compte applicatif à privilèges limités
|
||||
DB_PASSWORD= # mot de passe fort (gestionnaire de secrets)
|
||||
DB_USERNAME=cesizen_app
|
||||
DB_PASSWORD=
|
||||
|
||||
# ── Sessions & cookies (durcissement) ─────────────────────────
|
||||
SESSION_DRIVER=database
|
||||
@@ -57,4 +59,11 @@ GITEA_URL=https://gitea.sam-coffre.duckdns.org
|
||||
GITEA_TOKEN= # token Gitea avec le scope write:issue
|
||||
GITEA_REPO=sam/cesizen
|
||||
|
||||
# ── Applications mobiles (page /telecharger) ─────────────────
|
||||
# Liens de store (prioritaires) ou dépôt des binaires dans public/downloads/.
|
||||
MOBILE_ANDROID_URL=
|
||||
MOBILE_IOS_URL=
|
||||
MOBILE_ANDROID_VERSION=1.0.0
|
||||
MOBILE_IOS_VERSION=1.0.0
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/storage/pail
|
||||
/public/downloads/*.apk
|
||||
/public/downloads/*.ipa
|
||||
/vendor
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class DownloadController extends Controller
|
||||
{
|
||||
// Page publique de téléchargement des applications mobiles
|
||||
public function index()
|
||||
{
|
||||
return view('telecharger', [
|
||||
'android' => $this->resoudre('android'),
|
||||
'ios' => $this->resoudre('ios'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Détermine, pour une plateforme, le lien de téléchargement et sa disponibilité.
|
||||
*
|
||||
* @return array{version: string, url: string|null, disponible: bool}
|
||||
*/
|
||||
private function resoudre(string $plateforme): array
|
||||
{
|
||||
$config = config("mobile.{$plateforme}");
|
||||
if (! is_array($config)) {
|
||||
$config = [];
|
||||
}
|
||||
|
||||
$version = is_string($config['version'] ?? null) ? $config['version'] : '1.0.0';
|
||||
$url = (is_string($config['url'] ?? null) && $config['url'] !== '') ? $config['url'] : null;
|
||||
$file = is_string($config['file'] ?? null) ? $config['file'] : null;
|
||||
|
||||
// À défaut d'URL explicite, on propose le fichier précompilé s'il existe.
|
||||
if ($url === null && $file !== null && file_exists(public_path($file))) {
|
||||
$url = asset($file);
|
||||
}
|
||||
|
||||
return [
|
||||
'version' => $version,
|
||||
'url' => $url,
|
||||
'disponible' => $url !== null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use App\Services\GiteaIssueService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class SuggestionController extends Controller
|
||||
{
|
||||
// Afficher le formulaire de suggestion / signalement
|
||||
public function create()
|
||||
{
|
||||
return view('suggestions.create');
|
||||
}
|
||||
|
||||
// Traiter la demande et créer un ticket dans Gitea
|
||||
public function store(Request $request, GiteaIssueService $gitea)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'type' => ['required', Rule::in(['Modification', 'Ajout', 'Correction'])],
|
||||
'titre' => ['required', 'string', 'min:5', 'max:120'],
|
||||
'description' => ['required', 'string', 'min:10', 'max:5000'],
|
||||
], [
|
||||
'type.required' => 'Veuillez choisir un type de demande.',
|
||||
'type.in' => 'Type de demande invalide.',
|
||||
'titre.required' => 'Le titre est requis.',
|
||||
'titre.min' => 'Le titre doit contenir au moins 5 caractères.',
|
||||
'titre.max' => 'Le titre ne peut pas dépasser 120 caractères.',
|
||||
'description.required' => 'La description est requise.',
|
||||
'description.min' => 'Merci de détailler un peu plus votre demande (10 caractères minimum).',
|
||||
]);
|
||||
|
||||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
$auteur = $user->name ?? 'Utilisateur';
|
||||
|
||||
$title = "[{$data['type']}] {$data['titre']}";
|
||||
|
||||
$body = "**Type de demande :** {$data['type']}\n"
|
||||
."**Proposé par :** {$auteur} (via le site CESIZen)\n\n"
|
||||
."### Description\n"
|
||||
.$data['description']."\n\n"
|
||||
."---\n"
|
||||
.'_Ticket créé automatiquement depuis le formulaire de suggestions du site CESIZen._';
|
||||
|
||||
if ($gitea->createIssue($title, $body)) {
|
||||
return redirect()->route('suggestions.create')
|
||||
->with('success', 'Merci ! Votre demande a bien été transmise à l\'équipe.');
|
||||
}
|
||||
|
||||
return back()->withInput()->withErrors([
|
||||
'gitea' => "L'envoi de votre demande a échoué. Merci de réessayer plus tard.",
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Ticket;
|
||||
use App\Models\User;
|
||||
use App\Services\GiteaIssueService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class TicketController extends Controller
|
||||
{
|
||||
public function __construct(private GiteaIssueService $gitea) {}
|
||||
|
||||
/**
|
||||
* Liste des tickets de l'utilisateur, avec leur état courant récupéré
|
||||
* depuis Gitea (ouvert / résolu, jalon).
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
|
||||
$tickets = $user->tickets()->latest()->get()->map(function (Ticket $ticket) {
|
||||
$issue = $this->gitea->getIssue($ticket->gitea_number);
|
||||
$ticket->setAttribute('state', $issue['state'] ?? null);
|
||||
$ticket->setAttribute('milestone', $issue['milestone']['title'] ?? null);
|
||||
|
||||
return $ticket;
|
||||
});
|
||||
|
||||
return view('tickets.index', compact('tickets'));
|
||||
}
|
||||
|
||||
// Formulaire de création
|
||||
public function create()
|
||||
{
|
||||
return view('tickets.create');
|
||||
}
|
||||
|
||||
// Création d'un ticket -> issue Gitea + enregistrement local
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'type' => ['required', Rule::in(['Modification', 'Ajout', 'Correction'])],
|
||||
'titre' => ['required', 'string', 'min:5', 'max:120'],
|
||||
'description' => ['required', 'string', 'min:10', 'max:5000'],
|
||||
]);
|
||||
|
||||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
$auteur = $user->name ?? 'Utilisateur';
|
||||
|
||||
$title = "[{$data['type']}] {$data['titre']}";
|
||||
$body = "**Type de demande :** {$data['type']}\n"
|
||||
."**Proposé par :** {$auteur} (via le site CESIZen)\n\n"
|
||||
."### Description\n"
|
||||
.$data['description']."\n\n"
|
||||
."---\n"
|
||||
.'_Ticket créé automatiquement depuis CESIZen._';
|
||||
|
||||
$issue = $this->gitea->createIssue($title, $body);
|
||||
|
||||
if (! $issue || ! isset($issue['number'])) {
|
||||
return back()->withInput()->withErrors([
|
||||
'gitea' => "L'envoi de votre demande a échoué. Merci de réessayer plus tard.",
|
||||
]);
|
||||
}
|
||||
|
||||
// On mémorise le lien utilisateur <-> issue pour le suivi.
|
||||
$user->tickets()->create([
|
||||
'gitea_number' => (int) $issue['number'],
|
||||
'title' => $data['titre'],
|
||||
'type' => $data['type'],
|
||||
]);
|
||||
|
||||
return redirect()->route('tickets.show', $issue['number'])
|
||||
->with('success', 'Votre demande a bien été transmise à l\'équipe.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Détail d'un ticket : état, jalon, labels et fil de discussion.
|
||||
*/
|
||||
public function show(int $number)
|
||||
{
|
||||
$ticket = $this->findOwnedTicket($number);
|
||||
|
||||
$issue = $this->gitea->getIssue($number);
|
||||
$comments = $this->gitea->getComments($number);
|
||||
|
||||
return view('tickets.show', compact('ticket', 'issue', 'comments'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Réponse de l'utilisateur : ajoute un commentaire sur l'issue Gitea.
|
||||
*/
|
||||
public function reply(Request $request, int $number)
|
||||
{
|
||||
$this->findOwnedTicket($number);
|
||||
|
||||
$data = $request->validate([
|
||||
'message' => ['required', 'string', 'min:2', 'max:5000'],
|
||||
]);
|
||||
|
||||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
$auteur = $user->name ?? 'Utilisateur';
|
||||
$body = "**{$auteur}** (via CESIZen) :\n\n".$data['message'];
|
||||
|
||||
if (! $this->gitea->addComment($number, $body)) {
|
||||
return back()->withErrors(['gitea' => "L'envoi de votre réponse a échoué."]);
|
||||
}
|
||||
|
||||
return redirect()->route('tickets.show', $number)
|
||||
->with('success', 'Votre réponse a été ajoutée au ticket.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère le ticket s'il appartient bien à l'utilisateur connecté,
|
||||
* sinon renvoie une 404 (empêche de consulter les tickets d'autrui).
|
||||
*/
|
||||
private function findOwnedTicket(int $number): Ticket
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
|
||||
return $user->tickets()->where('gitea_number', $number)->firstOrFail();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $gitea_number
|
||||
* @property string $title
|
||||
* @property string $type
|
||||
*/
|
||||
class Ticket extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'gitea_number',
|
||||
'title',
|
||||
'type',
|
||||
];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,14 @@ class User extends Authenticatable implements FilamentUser
|
||||
return $this->hasMany(EmotionRecord::class, 'user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany<Ticket, $this>
|
||||
*/
|
||||
public function tickets(): HasMany
|
||||
{
|
||||
return $this->hasMany(Ticket::class);
|
||||
}
|
||||
|
||||
public function favoritedActivities(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(RelaxationActivity::class, 'favorites', 'id_user', 'id_activite');
|
||||
|
||||
@@ -2,52 +2,132 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Http\Client\PendingRequest;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Petit client de l'API Gitea (issues) utilisé par le système de tickets :
|
||||
* création, consultation, commentaires.
|
||||
*/
|
||||
class GiteaIssueService
|
||||
{
|
||||
/**
|
||||
* Crée un ticket (issue) dans le dépôt Gitea configuré.
|
||||
*
|
||||
* @return bool true si le ticket a bien été créé, false sinon.
|
||||
* Prépare un client HTTP authentifié, ou null si Gitea n'est pas configuré.
|
||||
*/
|
||||
public function createIssue(string $title, string $body): bool
|
||||
private function client(): ?PendingRequest
|
||||
{
|
||||
$url = rtrim((string) config('services.gitea.url'), '/');
|
||||
$repo = trim((string) config('services.gitea.repo'), '/');
|
||||
$token = (string) config('services.gitea.token');
|
||||
|
||||
if ($url === '' || $repo === '' || $token === '') {
|
||||
Log::warning('Gitea non configuré (URL / token / dépôt manquant) : ticket non créé.');
|
||||
Log::warning('Gitea non configuré (URL / token / dépôt manquant).');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Gitea attend l'en-tête "Authorization: token <TOKEN>".
|
||||
return Http::withToken($token, 'token')
|
||||
->acceptJson()
|
||||
->timeout(10)
|
||||
->baseUrl("{$url}/api/v1/repos/{$repo}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée un ticket (issue). Retourne les données de l'issue créée
|
||||
* (dont "number") ou null en cas d'échec.
|
||||
*
|
||||
* @return array<string, mixed>|null
|
||||
*/
|
||||
public function createIssue(string $title, string $body): ?array
|
||||
{
|
||||
$client = $this->client();
|
||||
if (! $client) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$response = $client->post('/issues', ['title' => $title, 'body' => $body]);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Appel API Gitea impossible : '.$e->getMessage());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($response->failed()) {
|
||||
Log::error('Création du ticket Gitea échouée', ['status' => $response->status()]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return (array) $response->json();
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère une issue (état, labels, jalon…).
|
||||
*
|
||||
* @return array<string, mixed>|null
|
||||
*/
|
||||
public function getIssue(int $number): ?array
|
||||
{
|
||||
$client = $this->client();
|
||||
if (! $client) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$response = $client->get("/issues/{$number}");
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Lecture du ticket Gitea impossible : '.$e->getMessage());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return $response->successful() ? (array) $response->json() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère les commentaires d'une issue (fil de discussion).
|
||||
*
|
||||
* @return array<int, mixed>
|
||||
*/
|
||||
public function getComments(int $number): array
|
||||
{
|
||||
$client = $this->client();
|
||||
if (! $client) {
|
||||
return [];
|
||||
}
|
||||
|
||||
try {
|
||||
$response = $client->get("/issues/{$number}/comments");
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Lecture des commentaires Gitea impossible : '.$e->getMessage());
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
return $response->successful() ? (array) $response->json() : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajoute un commentaire (réponse) à une issue.
|
||||
*/
|
||||
public function addComment(int $number, string $body): bool
|
||||
{
|
||||
$client = $this->client();
|
||||
if (! $client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
// Gitea attend l'en-tête "Authorization: token <TOKEN>".
|
||||
$response = Http::withToken($token, 'token')
|
||||
->acceptJson()
|
||||
->timeout(10)
|
||||
->post("{$url}/api/v1/repos/{$repo}/issues", [
|
||||
'title' => $title,
|
||||
'body' => $body,
|
||||
]);
|
||||
$response = $client->post("/issues/{$number}/comments", ['body' => $body]);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Appel API Gitea impossible : '.$e->getMessage());
|
||||
Log::error('Ajout de commentaire Gitea impossible : '.$e->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($response->failed()) {
|
||||
Log::error('Création du ticket Gitea échouée', [
|
||||
'status' => $response->status(),
|
||||
'body' => $response->body(),
|
||||
]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return $response->successful();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Applications mobiles (téléchargement)
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Pour chaque plateforme, la page de téléchargement utilise en priorité
|
||||
| l'URL fournie (lien de store OU URL directe). À défaut, elle propose le
|
||||
| fichier précompilé déposé dans public/downloads/. Si aucun des deux n'est
|
||||
| disponible, le bouton affiche « bientôt disponible ».
|
||||
|
|
||||
*/
|
||||
|
||||
'android' => [
|
||||
'version' => env('MOBILE_ANDROID_VERSION', '1.0.0'),
|
||||
'url' => env('MOBILE_ANDROID_URL'),
|
||||
'file' => 'downloads/cesizen.apk',
|
||||
],
|
||||
|
||||
'ios' => [
|
||||
'version' => env('MOBILE_IOS_VERSION', '1.0.0'),
|
||||
'url' => env('MOBILE_IOS_URL'),
|
||||
'file' => 'downloads/cesizen.ipa',
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Table de liaison entre un utilisateur CESIZen et le ticket (issue) qu'il a
|
||||
* ouvert dans Gitea. Elle permet de retrouver « ses » tickets alors que
|
||||
* l'application les crée toutes sous un même compte de service.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tickets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->unsignedInteger('gitea_number'); // numéro de l'issue Gitea
|
||||
$table->string('title');
|
||||
$table->string('type');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'gitea_number']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tickets');
|
||||
}
|
||||
};
|
||||
Generated
+28
-1
@@ -1,9 +1,12 @@
|
||||
{
|
||||
"name": "www",
|
||||
"name": "WEB",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"alpinejs": "^3.15.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"axios": "^1.11.0",
|
||||
@@ -1134,6 +1137,30 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@vue/reactivity": {
|
||||
"version": "3.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.1.5.tgz",
|
||||
"integrity": "sha512-1tdfLmNjWG6t/CsPldh+foumYFo3cpyCHgBYQ34ylaMsJ+SNHQ1kApMIa8jN+i593zQuaw3AdWH0nJTARzCFhg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.1.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/shared": {
|
||||
"version": "3.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.1.5.tgz",
|
||||
"integrity": "sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/alpinejs": {
|
||||
"version": "3.15.12",
|
||||
"resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.15.12.tgz",
|
||||
"integrity": "sha512-nJvPAQVNPdZZ0NrExJ/kzQco3ijR8LwvCOadQecllESiqT4NyZ/57sN9V2XyvhlBGAbmlKYgeWZvYdKq99ij/Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/reactivity": "~3.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
|
||||
@@ -13,5 +13,8 @@
|
||||
"laravel-vite-plugin": "^2.0.0",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"vite": "^7.0.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"alpinejs": "^3.15.12"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# Applications mobiles précompilées
|
||||
|
||||
Déposez ici les binaires servis par la page **/telecharger** :
|
||||
|
||||
- `cesizen.apk` — application Android
|
||||
- `cesizen.ipa` — application Apple (iOS)
|
||||
|
||||
La page détecte automatiquement la présence de ces fichiers.
|
||||
|
||||
## Alternative : liens de store
|
||||
|
||||
Plutôt que des fichiers locaux, vous pouvez renseigner des liens (Play Store,
|
||||
App Store, TestFlight…) dans le fichier `.env` du serveur :
|
||||
|
||||
```
|
||||
MOBILE_ANDROID_URL=https://play.google.com/store/apps/details?id=...
|
||||
MOBILE_IOS_URL=https://apps.apple.com/app/id...
|
||||
MOBILE_ANDROID_VERSION=1.0.0
|
||||
MOBILE_IOS_VERSION=1.0.0
|
||||
```
|
||||
|
||||
Si une URL est renseignée, elle est prioritaire sur le fichier local.
|
||||
Si ni URL ni fichier ne sont disponibles, le bouton affiche « Bientôt disponible ».
|
||||
|
||||
> Les binaires (`*.apk`, `*.ipa`) ne sont pas versionnés dans git (voir `.gitignore`).
|
||||
@@ -1 +1,8 @@
|
||||
import './bootstrap';
|
||||
|
||||
// Alpine.js hébergé localement (bundle Vite) plutôt que via un CDN externe,
|
||||
// pour rester compatible avec la Content-Security-Policy stricte.
|
||||
import Alpine from 'alpinejs';
|
||||
|
||||
window.Alpine = Alpine;
|
||||
Alpine.start();
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
<title>@yield('title', 'CESIZen') | Ministère de la Santé et de la Prévention</title>
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
<link rel="icon" href="./img/CesiZen_logo.png" type="image/x-icon">
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||
<style>
|
||||
:root {
|
||||
--fr-blue: #000091;
|
||||
|
||||
@@ -50,18 +50,28 @@
|
||||
Guides & Informations
|
||||
</a>
|
||||
|
||||
<!-- Signaler / Suggérer (utilisateur connecté → ticket Gitea) -->
|
||||
<!-- Mes tickets (utilisateur connecté → suivi Gitea) -->
|
||||
@auth
|
||||
<a href="{{ route('suggestions.create') }}"
|
||||
class="flex items-center gap-4 px-4 py-3 rounded-sm transition-all group {{ request()->routeIs('suggestions.*') ? 'text-white bg-[#000091] font-bold shadow-md' : 'text-slate-700 hover:bg-slate-50 font-medium border-b border-slate-100/50' }}"
|
||||
{!! request()->routeIs('suggestions.*') ? 'aria-current="page"' : '' !!}>
|
||||
<div class="w-8 h-8 rounded-sm flex items-center justify-center transition-colors {{ request()->routeIs('suggestions.*') ? 'bg-white/20 text-white' : 'bg-green-50 text-[--cz-jade]' }}" aria-hidden="true">
|
||||
<a href="{{ route('tickets.index') }}"
|
||||
class="flex items-center gap-4 px-4 py-3 rounded-sm transition-all group {{ request()->routeIs('tickets.*') ? 'text-white bg-[#000091] font-bold shadow-md' : 'text-slate-700 hover:bg-slate-50 font-medium border-b border-slate-100/50' }}"
|
||||
{!! request()->routeIs('tickets.*') ? 'aria-current="page"' : '' !!}>
|
||||
<div class="w-8 h-8 rounded-sm flex items-center justify-center transition-colors {{ request()->routeIs('tickets.*') ? 'bg-white/20 text-white' : 'bg-green-50 text-[--cz-jade]' }}" aria-hidden="true">
|
||||
<x-heroicon-o-chat-bubble-left-right class="h-4 w-4" />
|
||||
</div>
|
||||
Signaler / Suggérer
|
||||
Mes tickets
|
||||
</a>
|
||||
@endauth
|
||||
|
||||
<!-- Télécharger l'application mobile (public) -->
|
||||
<a href="{{ route('telecharger') }}"
|
||||
class="flex items-center gap-4 px-4 py-3 rounded-sm transition-all group {{ request()->routeIs('telecharger') ? 'text-white bg-[#000091] font-bold shadow-md' : 'text-slate-700 hover:bg-slate-50 font-medium border-b border-slate-100/50' }}"
|
||||
{!! request()->routeIs('telecharger') ? 'aria-current="page"' : '' !!}>
|
||||
<div class="w-8 h-8 rounded-sm flex items-center justify-center transition-colors {{ request()->routeIs('telecharger') ? 'bg-white/20 text-white' : 'bg-slate-100 text-slate-700' }}" aria-hidden="true">
|
||||
<x-heroicon-o-device-phone-mobile class="h-4 w-4" />
|
||||
</div>
|
||||
Application mobile
|
||||
</a>
|
||||
|
||||
<div class="pt-10 space-y-1">
|
||||
<p class="text-[10px] font-bold text-slate-500 uppercase tracking-[0.2em] mb-4 px-4">Services de l'État</p>
|
||||
<a href="#" class="flex items-center justify-between px-4 py-2 text-sm text-slate-600 hover:text-[--fr-blue] font-medium transition-colors">
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', "Télécharger l'application")
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-3xl mx-auto space-y-10">
|
||||
|
||||
<!-- En-tête -->
|
||||
<div class="text-center">
|
||||
<h1 class="text-3xl font-bold text-[#161616] mb-3">📱 Télécharger l'application CESIZen</h1>
|
||||
<p class="text-slate-600 max-w-xl mx-auto">
|
||||
Emportez CESIZen partout avec vous. Choisissez votre plateforme et installez
|
||||
l'application mobile pour suivre votre bien-être au quotidien.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-6 md:grid-cols-2">
|
||||
|
||||
{{-- Carte Android --}}
|
||||
<div class="bg-white border border-slate-200 p-8 flex flex-col items-center text-center shadow-sm">
|
||||
<div class="w-16 h-16 rounded-2xl bg-green-50 flex items-center justify-center mb-4">
|
||||
<span class="text-4xl">🤖</span>
|
||||
</div>
|
||||
<h2 class="text-2xl font-bold text-slate-900 mb-1">Android</h2>
|
||||
<p class="text-sm text-slate-500 mb-6">Version {{ $android['version'] }}</p>
|
||||
|
||||
@if ($android['disponible'])
|
||||
<a href="{{ $android['url'] }}"
|
||||
@if (str_starts_with($android['url'], url('/'))) download @else target="_blank" rel="noopener" @endif
|
||||
class="w-full px-6 py-3 bg-[#000091] text-white font-bold rounded-sm hover:bg-blue-800 shadow-md transition-all uppercase tracking-widest">
|
||||
⬇️ Télécharger (.apk)
|
||||
</a>
|
||||
<p class="text-xs text-slate-400 mt-3">
|
||||
Sur Android, autorisez l'installation depuis « sources inconnues » si nécessaire.
|
||||
</p>
|
||||
@else
|
||||
<button type="button" disabled
|
||||
class="w-full px-6 py-3 bg-slate-200 text-slate-500 font-bold rounded-sm cursor-not-allowed">
|
||||
Bientôt disponible
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
{{-- Carte iOS --}}
|
||||
<div class="bg-white border border-slate-200 p-8 flex flex-col items-center text-center shadow-sm">
|
||||
<div class="w-16 h-16 rounded-2xl bg-slate-100 flex items-center justify-center mb-4">
|
||||
<span class="text-4xl">🍏</span>
|
||||
</div>
|
||||
<h2 class="text-2xl font-bold text-slate-900 mb-1">Apple (iOS)</h2>
|
||||
<p class="text-sm text-slate-500 mb-6">Version {{ $ios['version'] }}</p>
|
||||
|
||||
@if ($ios['disponible'])
|
||||
<a href="{{ $ios['url'] }}"
|
||||
@if (str_starts_with($ios['url'], url('/'))) download @else target="_blank" rel="noopener" @endif
|
||||
class="w-full px-6 py-3 bg-slate-900 text-white font-bold rounded-sm hover:bg-black shadow-md transition-all uppercase tracking-widest">
|
||||
⬇️ Télécharger
|
||||
</a>
|
||||
<p class="text-xs text-slate-400 mt-3">
|
||||
L'installation d'un fichier .ipa nécessite TestFlight ou un profil adapté.
|
||||
</p>
|
||||
@else
|
||||
<button type="button" disabled
|
||||
class="w-full px-6 py-3 bg-slate-200 text-slate-500 font-bold rounded-sm cursor-not-allowed">
|
||||
Bientôt disponible
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<a href="{{ route('home') }}" class="text-sm font-bold text-[--fr-blue] hover:underline">
|
||||
← Retour à l'accueil
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
+11
-33
@@ -1,27 +1,23 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Signaler / Proposer une amélioration')
|
||||
@section('title', 'Nouvelle demande')
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-2xl mx-auto space-y-8">
|
||||
|
||||
<!-- En-tête -->
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-[#161616] mb-2">Signaler ou proposer une amélioration</h1>
|
||||
<h1 class="text-3xl font-bold text-[#161616] mb-2">Nouvelle demande</h1>
|
||||
<p class="text-slate-600">
|
||||
Une idée, une correction, un bug à signaler ? Votre demande est directement transmise à
|
||||
l'équipe sous forme de ticket de suivi. Merci de votre contribution !
|
||||
Une idée, une correction, un bug ? Votre demande crée un ticket de suivi que
|
||||
vous pourrez consulter à tout moment.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Message de succès -->
|
||||
@if (session('success'))
|
||||
<div class="p-4 bg-green-50 border border-green-200 rounded-lg">
|
||||
<p class="text-green-700 font-semibold">✅ {{ session('success') }}</p>
|
||||
<a href="{{ route('tickets.index') }}" class="shrink-0 text-sm font-bold text-[--fr-blue] hover:underline">
|
||||
← Mes tickets
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Erreurs -->
|
||||
@if ($errors->any())
|
||||
<div class="p-4 bg-red-50 border border-red-200 rounded-lg space-y-1">
|
||||
@foreach ($errors->all() as $error)
|
||||
@@ -31,10 +27,9 @@
|
||||
@endif
|
||||
|
||||
<div class="bg-white p-8 border border-slate-200 shadow-sm">
|
||||
<form action="{{ route('suggestions.store') }}" method="POST" class="space-y-6">
|
||||
<form action="{{ route('tickets.store') }}" method="POST" class="space-y-6">
|
||||
@csrf
|
||||
|
||||
<!-- Type de demande -->
|
||||
<div>
|
||||
<label for="type" class="block text-sm font-bold text-slate-700 mb-2">Type de demande</label>
|
||||
<select id="type" name="type" required
|
||||
@@ -44,50 +39,33 @@
|
||||
<option value="Ajout" @selected($typeChoisi === 'Ajout')>➕ Ajout d'un contenu / d'une fonctionnalité</option>
|
||||
<option value="Correction" @selected($typeChoisi === 'Correction')>🐛 Correction d'une erreur / d'un bug</option>
|
||||
</select>
|
||||
@error('type')
|
||||
<p class="text-red-600 text-xs mt-1">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<!-- Titre -->
|
||||
<div>
|
||||
<label for="titre" class="block text-sm font-bold text-slate-700 mb-2">Titre</label>
|
||||
<input type="text" id="titre" name="titre" required minlength="5" maxlength="120"
|
||||
value="{{ old('titre') }}"
|
||||
placeholder="Résumez votre demande en une phrase"
|
||||
value="{{ old('titre') }}" placeholder="Résumez votre demande en une phrase"
|
||||
class="w-full border-slate-200 rounded-lg focus:ring-[--fr-blue] focus:border-[--fr-blue] @error('titre') border-red-500 @enderror">
|
||||
@error('titre')
|
||||
<p class="text-red-600 text-xs mt-1">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<!-- Description -->
|
||||
<div>
|
||||
<label for="description" class="block text-sm font-bold text-slate-700 mb-2">Description détaillée</label>
|
||||
<textarea id="description" name="description" required minlength="10" maxlength="5000" rows="8"
|
||||
placeholder="Décrivez précisément votre demande : quoi, où, pourquoi…"
|
||||
class="w-full border-slate-200 rounded-lg focus:ring-[--fr-blue] focus:border-[--fr-blue] @error('description') border-red-500 @enderror">{{ old('description') }}</textarea>
|
||||
@error('description')
|
||||
<p class="text-red-600 text-xs mt-1">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<!-- Boutons -->
|
||||
<div class="flex gap-4 pt-2">
|
||||
<button type="submit"
|
||||
class="px-8 py-3 bg-[#000091] text-white font-bold rounded-sm hover:bg-blue-800 shadow-md transition-all uppercase tracking-widest">
|
||||
Envoyer ma demande
|
||||
</button>
|
||||
<a href="{{ route('home') }}"
|
||||
<a href="{{ route('tickets.index') }}"
|
||||
class="px-8 py-3 bg-slate-200 text-slate-900 font-bold rounded-sm hover:bg-slate-300 transition-all">
|
||||
Annuler
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="text-xs text-slate-500">
|
||||
ℹ️ Votre demande sera examinée par l'équipe avant toute prise en compte. Merci de rester courtois et constructif.
|
||||
</p>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,49 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Mes tickets')
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-3xl mx-auto space-y-8">
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
<h1 class="text-3xl font-bold text-[#161616]">Mes tickets</h1>
|
||||
<a href="{{ route('tickets.create') }}"
|
||||
class="px-5 py-2.5 bg-[#000091] text-white font-bold rounded-sm hover:bg-blue-800 shadow-md transition-all text-sm uppercase tracking-widest">
|
||||
+ Nouvelle demande
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@if (session('success'))
|
||||
<div class="p-4 bg-green-50 border border-green-200 rounded-lg">
|
||||
<p class="text-green-700 font-semibold">✅ {{ session('success') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@forelse ($tickets as $ticket)
|
||||
<a href="{{ route('tickets.show', $ticket->gitea_number) }}"
|
||||
class="block bg-white p-5 border border-slate-200 shadow-sm hover:border-[--fr-blue] transition-colors">
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div class="min-w-0">
|
||||
<p class="font-bold text-slate-900 truncate">{{ $ticket->title }}</p>
|
||||
<p class="text-xs text-slate-500 mt-1">
|
||||
#{{ $ticket->gitea_number }} · {{ $ticket->type }} · {{ $ticket->created_at->format('d/m/Y') }}
|
||||
@if ($ticket->milestone)
|
||||
· 🎯 {{ $ticket->milestone }}
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
@php($state = $ticket->state)
|
||||
<span class="shrink-0 text-xs font-bold px-3 py-1 rounded-full
|
||||
{{ $state === 'closed' ? 'bg-green-100 text-green-700' : ($state === 'open' ? 'bg-blue-100 text-blue-700' : 'bg-slate-100 text-slate-500') }}">
|
||||
{{ $state === 'closed' ? 'Résolu' : ($state === 'open' ? 'En cours' : 'Inconnu') }}
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
@empty
|
||||
<div class="bg-white p-8 border border-slate-200 shadow-sm text-center text-slate-500">
|
||||
Vous n'avez pas encore de ticket.
|
||||
<a href="{{ route('tickets.create') }}" class="text-[--fr-blue] font-bold hover:underline">Créer une demande</a>.
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
@endsection
|
||||
@@ -0,0 +1,90 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Suivi du ticket')
|
||||
|
||||
@section('content')
|
||||
<div class="max-w-3xl mx-auto space-y-6">
|
||||
|
||||
<a href="{{ route('tickets.index') }}" class="text-sm font-bold text-[--fr-blue] hover:underline">← Mes tickets</a>
|
||||
|
||||
@if (session('success'))
|
||||
<div class="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="p-4 bg-red-50 border border-red-200 rounded-lg space-y-1">
|
||||
@foreach ($errors->all() as $error)<p class="text-red-700 text-sm">{{ $error }}</p>@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php($state = $issue['state'] ?? null)
|
||||
|
||||
<div class="bg-white p-6 border border-slate-200 shadow-sm space-y-4">
|
||||
<div class="flex items-start justify-between gap-4">
|
||||
<h1 class="text-2xl font-bold text-[#161616]">{{ $ticket->title }}</h1>
|
||||
<span class="shrink-0 text-xs font-bold px-3 py-1 rounded-full
|
||||
{{ $state === 'closed' ? 'bg-green-100 text-green-700' : ($state === 'open' ? 'bg-blue-100 text-blue-700' : 'bg-slate-100 text-slate-500') }}">
|
||||
{{ $state === 'closed' ? 'Résolu' : ($state === 'open' ? 'En cours' : 'Inconnu') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2 text-xs">
|
||||
<span class="text-slate-500">#{{ $ticket->gitea_number }} · {{ $ticket->type }}</span>
|
||||
@if (!empty($issue['milestone']['title']))
|
||||
<span class="font-bold px-2 py-0.5 rounded bg-purple-100 text-purple-700">🎯 {{ $issue['milestone']['title'] }}</span>
|
||||
@endif
|
||||
@foreach ($issue['labels'] ?? [] as $label)
|
||||
<span class="font-bold px-2 py-0.5 rounded bg-slate-100 text-slate-700">{{ $label['name'] }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@if (!empty($issue['body']))
|
||||
<div class="text-sm text-slate-700 whitespace-pre-line bg-slate-50 border border-slate-100 rounded p-4">{{ $issue['body'] }}</div>
|
||||
@endif
|
||||
|
||||
@unless ($issue)
|
||||
<p class="text-sm text-amber-700 bg-amber-50 border border-amber-200 rounded p-3">
|
||||
Impossible de récupérer l'état du ticket pour le moment. Réessayez plus tard.
|
||||
</p>
|
||||
@endunless
|
||||
</div>
|
||||
|
||||
<!-- Fil de discussion -->
|
||||
<div class="space-y-3">
|
||||
<h2 class="text-lg font-bold text-slate-800">Échanges</h2>
|
||||
|
||||
@forelse ($comments as $comment)
|
||||
<div class="bg-white p-4 border border-slate-200 shadow-sm">
|
||||
<div class="flex items-center justify-between mb-2">
|
||||
<span class="text-sm font-bold text-slate-800">{{ $comment['user']['login'] ?? 'Équipe' }}</span>
|
||||
<span class="text-xs text-slate-400">
|
||||
{{ \Illuminate\Support\Carbon::parse($comment['created_at'])->format('d/m/Y H:i') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-sm text-slate-700 whitespace-pre-line">{{ $comment['body'] }}</div>
|
||||
</div>
|
||||
@empty
|
||||
<p class="text-sm text-slate-500">Aucune réponse pour le moment.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<!-- Répondre -->
|
||||
@if ($state !== 'closed')
|
||||
<form action="{{ route('tickets.reply', $ticket->gitea_number) }}" method="POST"
|
||||
class="bg-white p-4 border border-slate-200 shadow-sm space-y-3">
|
||||
@csrf
|
||||
<label for="message" class="block text-sm font-bold text-slate-700">Répondre</label>
|
||||
<textarea id="message" name="message" required minlength="2" maxlength="5000" rows="4"
|
||||
placeholder="Ajouter une précision, une réponse…"
|
||||
class="w-full border-slate-200 rounded-lg focus:ring-[--fr-blue] focus:border-[--fr-blue]">{{ old('message') }}</textarea>
|
||||
<button type="submit"
|
||||
class="px-6 py-2.5 bg-[#000091] text-white font-bold rounded-sm hover:bg-blue-800 shadow-md transition-all text-sm uppercase tracking-widest">
|
||||
Envoyer
|
||||
</button>
|
||||
</form>
|
||||
@else
|
||||
<p class="text-sm text-slate-500 italic">Ce ticket est clôturé — il n'est plus possible d'y répondre.</p>
|
||||
@endif
|
||||
</div>
|
||||
@endsection
|
||||
+11
-4
@@ -3,11 +3,12 @@
|
||||
use App\Http\Controllers\DashboardController;
|
||||
use App\Http\Controllers\Web\AuthController;
|
||||
use App\Http\Controllers\Web\DiagnosticController;
|
||||
use App\Http\Controllers\Web\DownloadController;
|
||||
use App\Http\Controllers\Web\EmotionController;
|
||||
use App\Http\Controllers\Web\InformationController;
|
||||
use App\Http\Controllers\Web\ProfileController;
|
||||
use App\Http\Controllers\Web\RelaxationController;
|
||||
use App\Http\Controllers\Web\SuggestionController;
|
||||
use App\Http\Controllers\Web\TicketController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
// Public Routes
|
||||
@@ -17,6 +18,9 @@ Route::get('/relaxation', [RelaxationController::class, 'index'])->name('relaxat
|
||||
Route::get('/informations', [InformationController::class, 'index'])->name('informations.index');
|
||||
Route::get('/informations/{id}', [InformationController::class, 'show'])->name('informations.show');
|
||||
|
||||
// Téléchargement des applications mobiles (Android / iOS)
|
||||
Route::get('/telecharger', [DownloadController::class, 'index'])->name('telecharger');
|
||||
|
||||
// Authentification
|
||||
Route::get('/login', [AuthController::class, 'showLogin'])->name('login');
|
||||
Route::post('/login', [AuthController::class, 'login']);
|
||||
@@ -43,7 +47,10 @@ Route::middleware('auth')->group(function () {
|
||||
// Pages Relaxation
|
||||
Route::post('/relaxation/{id}/favorite', [RelaxationController::class, 'toggleFavorite'])->name('relaxation.favorite');
|
||||
|
||||
// Suggestions / signalements (créent un ticket dans Gitea)
|
||||
Route::get('/suggestions/nouveau', [SuggestionController::class, 'create'])->name('suggestions.create');
|
||||
Route::post('/suggestions', [SuggestionController::class, 'store'])->name('suggestions.store');
|
||||
// Système de tickets (connecté à Gitea) : création, suivi, réponses
|
||||
Route::get('/tickets', [TicketController::class, 'index'])->name('tickets.index');
|
||||
Route::get('/tickets/nouveau', [TicketController::class, 'create'])->name('tickets.create');
|
||||
Route::post('/tickets', [TicketController::class, 'store'])->name('tickets.store');
|
||||
Route::get('/tickets/{number}', [TicketController::class, 'show'])->whereNumber('number')->name('tickets.show');
|
||||
Route::post('/tickets/{number}/reponse', [TicketController::class, 'reply'])->whereNumber('number')->name('tickets.reply');
|
||||
});
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Page publique de téléchargement des applications mobiles.
|
||||
*/
|
||||
class DownloadTest extends TestCase
|
||||
{
|
||||
#[Test]
|
||||
public function la_page_de_telechargement_est_publique()
|
||||
{
|
||||
$this->get('/telecharger')
|
||||
->assertOk()
|
||||
->assertSee('Android')
|
||||
->assertSee('Apple');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function un_lien_de_store_configure_est_propose()
|
||||
{
|
||||
config(['mobile.android.url' => 'https://play.google.com/store/apps/details?id=fr.cesizen']);
|
||||
|
||||
$this->get('/telecharger')
|
||||
->assertOk()
|
||||
->assertSee('play.google.com');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function sans_lien_ni_fichier_le_bouton_est_desactive()
|
||||
{
|
||||
config(['mobile.ios.url' => null, 'mobile.ios.file' => 'downloads/inexistant.ipa']);
|
||||
|
||||
$this->get('/telecharger')
|
||||
->assertOk()
|
||||
->assertSee('Bientôt disponible');
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Système de tickets utilisateur : le formulaire de suggestions crée une
|
||||
* issue dans Gitea via son API.
|
||||
*/
|
||||
class SuggestionTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
#[Test]
|
||||
public function un_invite_est_redirige_vers_login()
|
||||
{
|
||||
$this->get('/suggestions/nouveau')->assertRedirect('/login');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function un_utilisateur_connecte_voit_le_formulaire()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get('/suggestions/nouveau')
|
||||
->assertOk()
|
||||
->assertSee('Signaler');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function une_demande_valide_cree_un_ticket_gitea()
|
||||
{
|
||||
config([
|
||||
'services.gitea.url' => 'https://gitea.test',
|
||||
'services.gitea.token' => 'fake-token',
|
||||
'services.gitea.repo' => 'sam/cesizen',
|
||||
]);
|
||||
Http::fake(['*' => Http::response(['number' => 1], 201)]);
|
||||
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post('/suggestions', [
|
||||
'type' => 'Correction',
|
||||
'titre' => 'Un bug sur la page',
|
||||
'description' => 'Description suffisamment longue du problème rencontré.',
|
||||
])
|
||||
->assertRedirect(route('suggestions.create'))
|
||||
->assertSessionHas('success');
|
||||
|
||||
Http::assertSent(fn ($request) => str_contains($request->url(), '/api/v1/repos/sam/cesizen/issues'));
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function une_demande_invalide_est_rejetee()
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->post('/suggestions', ['type' => 'Invalide', 'titre' => 'a', 'description' => 'b'])
|
||||
->assertSessionHasErrors(['type', 'titre', 'description']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Ticket;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Système de tickets utilisateur connecté à Gitea :
|
||||
* création (issue), suivi (état + commentaires) et réponse.
|
||||
*/
|
||||
class TicketTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
config([
|
||||
'services.gitea.url' => 'https://gitea.test',
|
||||
'services.gitea.token' => 'fake-token',
|
||||
'services.gitea.repo' => 'sam/cesizen',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function un_invite_ne_peut_pas_acceder_aux_tickets()
|
||||
{
|
||||
$this->get('/tickets')->assertRedirect('/login');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function creer_un_ticket_cree_une_issue_et_un_enregistrement_local()
|
||||
{
|
||||
Http::fake([
|
||||
'*/issues' => Http::response(['number' => 42], 201),
|
||||
]);
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)->post('/tickets', [
|
||||
'type' => 'Correction',
|
||||
'titre' => 'Un bug à corriger',
|
||||
'description' => 'Description suffisamment longue du problème.',
|
||||
])->assertRedirect(route('tickets.show', 42));
|
||||
|
||||
$this->assertDatabaseHas('tickets', [
|
||||
'user_id' => $user->id,
|
||||
'gitea_number' => 42,
|
||||
'type' => 'Correction',
|
||||
]);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function l_utilisateur_voit_le_suivi_de_son_ticket()
|
||||
{
|
||||
Http::fake([
|
||||
'*/issues/42/comments' => Http::response([
|
||||
['body' => 'Nous regardons cela.', 'user' => ['login' => 'admin'], 'created_at' => '2026-07-08T10:00:00Z'],
|
||||
], 200),
|
||||
'*/issues/42' => Http::response(['number' => 42, 'state' => 'open', 'title' => 'Un bug', 'body' => 'détail'], 200),
|
||||
]);
|
||||
$user = User::factory()->create();
|
||||
Ticket::create(['user_id' => $user->id, 'gitea_number' => 42, 'title' => 'Un bug', 'type' => 'Correction']);
|
||||
|
||||
$this->actingAs($user)->get('/tickets/42')
|
||||
->assertOk()
|
||||
->assertSee('Nous regardons cela.')
|
||||
->assertSee('En cours');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function on_ne_peut_pas_consulter_le_ticket_d_un_autre()
|
||||
{
|
||||
$autre = User::factory()->create();
|
||||
Ticket::create(['user_id' => $autre->id, 'gitea_number' => 99, 'title' => 'Privé', 'type' => 'Ajout']);
|
||||
|
||||
$this->actingAs(User::factory()->create())->get('/tickets/99')->assertNotFound();
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function l_utilisateur_peut_repondre_a_son_ticket()
|
||||
{
|
||||
Http::fake(['*/issues/42/comments' => Http::response(['id' => 1], 201)]);
|
||||
$user = User::factory()->create();
|
||||
Ticket::create(['user_id' => $user->id, 'gitea_number' => 42, 'title' => 'Un bug', 'type' => 'Correction']);
|
||||
|
||||
$this->actingAs($user)->post('/tickets/42/reponse', ['message' => 'Merci pour le suivi !'])
|
||||
->assertRedirect(route('tickets.show', 42))
|
||||
->assertSessionHas('success');
|
||||
|
||||
Http::assertSent(fn ($r) => str_contains($r->url(), '/issues/42/comments') && $r->method() === 'POST');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user