Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 29e6fec64d | |||
| df8af066fc | |||
| 7d52c1e440 | |||
| 69da55b292 | |||
| d0eb1252d5 | |||
| 9a0015f205 | |||
| 94b4218ba5 | |||
| f1825434ed | |||
| d11a297fd2 | |||
| 6680003b4d |
@@ -70,6 +70,13 @@ jobs:
|
|||||||
- name: Analyse statique (Larastan / PHPStan)
|
- name: Analyse statique (Larastan / PHPStan)
|
||||||
run: vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=512M --no-progress
|
run: vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=512M --no-progress
|
||||||
|
|
||||||
|
- name: Audit de sécurité des dépendances (composer audit)
|
||||||
|
# Signale les vulnérabilités connues (CVE) des dépendances.
|
||||||
|
# Informatif : n'échoue pas le build, car un correctif amont peut ne
|
||||||
|
# pas être encore disponible ; les dépendances sont tenues à jour.
|
||||||
|
run: composer audit --no-interaction
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Exécution des tests + couverture (PHPUnit)
|
- name: Exécution des tests + couverture (PHPUnit)
|
||||||
# phpunit.xml définit déjà l'environnement de test (sqlite en mémoire).
|
# phpunit.xml définit déjà l'environnement de test (sqlite en mémoire).
|
||||||
# On génère le rapport de couverture (clover) et le rapport de tests
|
# On génère le rapport de couverture (clover) et le rapport de tests
|
||||||
|
|||||||
@@ -53,6 +53,13 @@ jobs:
|
|||||||
cd WEB
|
cd WEB
|
||||||
docker compose up -d --build
|
docker compose up -d --build
|
||||||
|
|
||||||
|
# Le bind-mount ./:/var/www masque le vendor/ et public/build/
|
||||||
|
# construits dans l'image : on les (re)génère sur l'hôte, dans le
|
||||||
|
# conteneur, pour qu'ils soient présents via le montage.
|
||||||
|
docker exec cesizen-app composer install --no-interaction --no-dev --optimize-autoloader
|
||||||
|
docker exec cesizen-app npm ci
|
||||||
|
docker exec cesizen-app npm run build
|
||||||
|
|
||||||
# Migrations de la base de données (sans interaction)
|
# Migrations de la base de données (sans interaction)
|
||||||
docker exec cesizen-app php artisan migrate --force
|
docker exec cesizen-app php artisan migrate --force
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ et le versionnage suit [SemVer](https://semver.org/lang/fr/).
|
|||||||
## [Non publié]
|
## [Non publié]
|
||||||
|
|
||||||
### Ajouté
|
### Ajouté
|
||||||
|
- 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 d'intégration continue Gitea Actions (tests, Pint, audit de sécurité).
|
||||||
- Pipeline de déploiement continu (build image → registre Gitea → webhook Portainer).
|
- Pipeline de déploiement continu (build image → registre Gitea → webhook Portainer).
|
||||||
- Middleware `SecurityHeaders` (HSTS, CSP, X-Frame-Options, etc.).
|
- Middleware `SecurityHeaders` (HSTS, CSP, X-Frame-Options, etc.).
|
||||||
|
|||||||
@@ -62,4 +62,16 @@ AWS_DEFAULT_REGION=us-east-1
|
|||||||
AWS_BUCKET=
|
AWS_BUCKET=
|
||||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||||
|
|
||||||
|
# --- Gitea (tickets créés depuis le formulaire de suggestions du site) ---
|
||||||
|
# Token d'accès Gitea avec le scope "write:issue" (Settings > Applications > Generate Token).
|
||||||
|
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}"
|
VITE_APP_NAME="${APP_NAME}"
|
||||||
|
|||||||
@@ -19,13 +19,15 @@ LOG_CHANNEL=stack
|
|||||||
LOG_STACK=daily # rotation quotidienne des logs
|
LOG_STACK=daily # rotation quotidienne des logs
|
||||||
LOG_LEVEL=warning # on ne loggue pas le debug en prod
|
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_CONNECTION=mysql
|
||||||
DB_HOST=cesizen-db
|
DB_HOST=127.0.0.1
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
DB_DATABASE=cesizen
|
DB_DATABASE=cesizen
|
||||||
DB_USERNAME=cesizen_app # compte applicatif à privilèges limités
|
DB_USERNAME=cesizen_app
|
||||||
DB_PASSWORD= # mot de passe fort (gestionnaire de secrets)
|
DB_PASSWORD=
|
||||||
|
|
||||||
# ── Sessions & cookies (durcissement) ─────────────────────────
|
# ── Sessions & cookies (durcissement) ─────────────────────────
|
||||||
SESSION_DRIVER=database
|
SESSION_DRIVER=database
|
||||||
@@ -52,4 +54,16 @@ MAIL_PASSWORD=
|
|||||||
MAIL_FROM_ADDRESS="no-reply@cesizen.fr"
|
MAIL_FROM_ADDRESS="no-reply@cesizen.fr"
|
||||||
MAIL_FROM_NAME="${APP_NAME}"
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
# ── Gitea (tickets créés depuis le formulaire de suggestions) ─
|
||||||
|
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}"
|
VITE_APP_NAME="${APP_NAME}"
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
/public/storage
|
/public/storage
|
||||||
/storage/*.key
|
/storage/*.key
|
||||||
/storage/pail
|
/storage/pail
|
||||||
|
/public/downloads/*.apk
|
||||||
|
/public/downloads/*.ipa
|
||||||
/vendor
|
/vendor
|
||||||
Homestead.json
|
Homestead.json
|
||||||
Homestead.yaml
|
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,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 $this->hasMany(EmotionRecord::class, 'user_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return HasMany<Ticket, $this>
|
||||||
|
*/
|
||||||
|
public function tickets(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Ticket::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function favoritedActivities(): BelongsToMany
|
public function favoritedActivities(): BelongsToMany
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(RelaxationActivity::class, 'favorites', 'id_user', 'id_activite');
|
return $this->belongsToMany(RelaxationActivity::class, 'favorites', 'id_user', 'id_activite');
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Prépare un client HTTP authentifié, ou null si Gitea n'est pas configuré.
|
||||||
|
*/
|
||||||
|
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).');
|
||||||
|
|
||||||
|
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 {
|
||||||
|
$response = $client->post("/issues/{$number}/comments", ['body' => $body]);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
Log::error('Ajout de commentaire Gitea impossible : '.$e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response->successful();
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+528
-696
File diff suppressed because it is too large
Load Diff
@@ -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',
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
@@ -35,4 +35,11 @@ return [
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// Gitea : création de tickets (issues) depuis le formulaire de suggestions.
|
||||||
|
'gitea' => [
|
||||||
|
'url' => env('GITEA_URL', 'https://gitea.sam-coffre.duckdns.org'),
|
||||||
|
'token' => env('GITEA_TOKEN'),
|
||||||
|
'repo' => env('GITEA_REPO', 'sam/cesizen'),
|
||||||
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -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,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
|
"dependencies": {
|
||||||
|
"alpinejs": "^3.15.12"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/vite": "^4.0.0",
|
"@tailwindcss/vite": "^4.0.0",
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.11.0",
|
||||||
@@ -1134,6 +1137,30 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"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": {
|
"node_modules/ansi-regex": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||||
|
|||||||
@@ -13,5 +13,8 @@
|
|||||||
"laravel-vite-plugin": "^2.0.0",
|
"laravel-vite-plugin": "^2.0.0",
|
||||||
"tailwindcss": "^4.0.0",
|
"tailwindcss": "^4.0.0",
|
||||||
"vite": "^7.0.7"
|
"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';
|
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>
|
<title>@yield('title', 'CESIZen') | Ministère de la Santé et de la Prévention</title>
|
||||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||||
<link rel="icon" href="./img/CesiZen_logo.png" type="image/x-icon">
|
<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>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
--fr-blue: #000091;
|
--fr-blue: #000091;
|
||||||
|
|||||||
@@ -50,6 +50,28 @@
|
|||||||
Guides & Informations
|
Guides & Informations
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<!-- Mes tickets (utilisateur connecté → suivi Gitea) -->
|
||||||
|
@auth
|
||||||
|
<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>
|
||||||
|
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">
|
<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>
|
<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">
|
<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
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('title', 'Nouvelle demande')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="max-w-2xl mx-auto space-y-8">
|
||||||
|
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<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 ? Votre demande crée un ticket de suivi que
|
||||||
|
vous pourrez consulter à tout moment.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<a href="{{ route('tickets.index') }}" class="shrink-0 text-sm font-bold text-[--fr-blue] hover:underline">
|
||||||
|
← Mes tickets
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@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
|
||||||
|
|
||||||
|
<div class="bg-white p-8 border border-slate-200 shadow-sm">
|
||||||
|
<form action="{{ route('tickets.store') }}" method="POST" class="space-y-6">
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<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
|
||||||
|
class="w-full border-slate-200 rounded-lg focus:ring-[--fr-blue] focus:border-[--fr-blue] @error('type') border-red-500 @enderror">
|
||||||
|
@php($typeChoisi = old('type'))
|
||||||
|
<option value="Modification" @selected($typeChoisi === 'Modification')>✏️ Modification d'un contenu existant</option>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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"
|
||||||
|
class="w-full border-slate-200 rounded-lg focus:ring-[--fr-blue] focus:border-[--fr-blue] @error('titre') border-red-500 @enderror">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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('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>
|
||||||
|
</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
|
||||||
@@ -3,10 +3,12 @@
|
|||||||
use App\Http\Controllers\DashboardController;
|
use App\Http\Controllers\DashboardController;
|
||||||
use App\Http\Controllers\Web\AuthController;
|
use App\Http\Controllers\Web\AuthController;
|
||||||
use App\Http\Controllers\Web\DiagnosticController;
|
use App\Http\Controllers\Web\DiagnosticController;
|
||||||
|
use App\Http\Controllers\Web\DownloadController;
|
||||||
use App\Http\Controllers\Web\EmotionController;
|
use App\Http\Controllers\Web\EmotionController;
|
||||||
use App\Http\Controllers\Web\InformationController;
|
use App\Http\Controllers\Web\InformationController;
|
||||||
use App\Http\Controllers\Web\ProfileController;
|
use App\Http\Controllers\Web\ProfileController;
|
||||||
use App\Http\Controllers\Web\RelaxationController;
|
use App\Http\Controllers\Web\RelaxationController;
|
||||||
|
use App\Http\Controllers\Web\TicketController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
// Public Routes
|
// Public Routes
|
||||||
@@ -16,6 +18,9 @@ Route::get('/relaxation', [RelaxationController::class, 'index'])->name('relaxat
|
|||||||
Route::get('/informations', [InformationController::class, 'index'])->name('informations.index');
|
Route::get('/informations', [InformationController::class, 'index'])->name('informations.index');
|
||||||
Route::get('/informations/{id}', [InformationController::class, 'show'])->name('informations.show');
|
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
|
// Authentification
|
||||||
Route::get('/login', [AuthController::class, 'showLogin'])->name('login');
|
Route::get('/login', [AuthController::class, 'showLogin'])->name('login');
|
||||||
Route::post('/login', [AuthController::class, 'login']);
|
Route::post('/login', [AuthController::class, 'login']);
|
||||||
@@ -41,4 +46,11 @@ Route::middleware('auth')->group(function () {
|
|||||||
|
|
||||||
// Pages Relaxation
|
// Pages Relaxation
|
||||||
Route::post('/relaxation/{id}/favorite', [RelaxationController::class, 'toggleFavorite'])->name('relaxation.favorite');
|
Route::post('/relaxation/{id}/favorite', [RelaxationController::class, 'toggleFavorite'])->name('relaxation.favorite');
|
||||||
|
|
||||||
|
// 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,5 +6,13 @@ use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
|||||||
|
|
||||||
abstract class TestCase extends BaseTestCase
|
abstract class TestCase extends BaseTestCase
|
||||||
{
|
{
|
||||||
//
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
// Les assets front (Vite) ne sont pas compilés dans l'environnement de
|
||||||
|
// test / CI : on neutralise la directive @vite pour que le rendu des
|
||||||
|
// vues ne dépende pas du manifeste (public/build/manifest.json).
|
||||||
|
$this->withoutVite();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,13 @@
|
|||||||
# À déployer sur le serveur (via Portainer ou docker compose).
|
# À déployer sur le serveur (via Portainer ou docker compose).
|
||||||
# Il exécute les workflows définis dans .gitea/workflows/.
|
# Il exécute les workflows définis dans .gitea/workflows/.
|
||||||
#
|
#
|
||||||
# Étapes d'enregistrement :
|
# Déploiement via Portainer :
|
||||||
# 1. Dans Gitea : Administration ▸ Actions ▸ Runners ▸ "Create new runner"
|
# 1. Gitea ▸ Administration ▸ Actions ▸ Runners ▸ "Create new runner"
|
||||||
# pour obtenir le REGISTRATION TOKEN.
|
# pour obtenir le REGISTRATION TOKEN.
|
||||||
# 2. Renseigner GITEA_RUNNER_REGISTRATION_TOKEN ci-dessous (ou via .env).
|
# 2. Portainer ▸ Stacks ▸ Add stack ▸ coller ce fichier.
|
||||||
# 3. `docker compose up -d`
|
# 3. Dans "Environment variables", ajouter :
|
||||||
|
# GITEA_RUNNER_REGISTRATION_TOKEN = <le jeton copié>
|
||||||
|
# 4. Deploy the stack.
|
||||||
# ─────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────
|
||||||
services:
|
services:
|
||||||
act_runner:
|
act_runner:
|
||||||
@@ -17,7 +19,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
# URL de l'instance Gitea
|
# URL de l'instance Gitea
|
||||||
GITEA_INSTANCE_URL: https://gitea.sam-coffre.duckdns.org
|
GITEA_INSTANCE_URL: https://gitea.sam-coffre.duckdns.org
|
||||||
# Jeton d'enregistrement récupéré dans l'admin Gitea
|
# Jeton d'enregistrement (défini dans les variables d'environnement du stack)
|
||||||
GITEA_RUNNER_REGISTRATION_TOKEN: "${GITEA_RUNNER_REGISTRATION_TOKEN}"
|
GITEA_RUNNER_REGISTRATION_TOKEN: "${GITEA_RUNNER_REGISTRATION_TOKEN}"
|
||||||
GITEA_RUNNER_NAME: cesizen-runner
|
GITEA_RUNNER_NAME: cesizen-runner
|
||||||
# Images utilisées pour les labels (ubuntu-latest => image complète)
|
# Images utilisées pour les labels (ubuntu-latest => image complète)
|
||||||
@@ -25,4 +27,8 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
# Le runner a besoin du socket Docker pour lancer les jobs conteneurisés
|
# Le runner a besoin du socket Docker pour lancer les jobs conteneurisés
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- ./data:/data
|
# Volume nommé (persiste l'enregistrement du runner entre redémarrages)
|
||||||
|
- act_runner_data:/data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
act_runner_data:
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
@@ -124,9 +124,9 @@ function card(s, x, y, w, h, accent, title, lines) {
|
|||||||
const s = pres.addSlide();
|
const s = pres.addSlide();
|
||||||
s.background = { color: C.lightBg };
|
s.background = { color: C.lightBg };
|
||||||
header(s, 5, "Maintenance", "Gestion des évolutions & incidents");
|
header(s, 5, "Maintenance", "Gestion des évolutions & incidents");
|
||||||
card(s, 0.65, 1.45, 4.35, 2.5, C.teal, "Gitea Issues (2 modèles)", [
|
card(s, 0.65, 1.45, 4.35, 2.5, C.teal, "Gitea Issues + formulaire in-app", [
|
||||||
"🐞 Rapport d'incident (correctif)", "✨ Demande d'évolution (évolutif)",
|
"🐞 Rapport d'incident (correctif)", "✨ Demande d'évolution (évolutif)",
|
||||||
"Champs structurés & priorité"]);
|
"Formulaire du site → ticket Gitea (API)", "Champs structurés & priorité"]);
|
||||||
card(s, 5.15, 1.45, 4.3, 2.5, C.yellow, "Pilotage", [
|
card(s, 5.15, 1.45, 4.3, 2.5, C.yellow, "Pilotage", [
|
||||||
"Labels + tableau Kanban", "Jalons = versions (SemVer)",
|
"Labels + tableau Kanban", "Jalons = versions (SemVer)",
|
||||||
"Pull Request obligatoire"]);
|
"Pull Request obligatoire"]);
|
||||||
@@ -161,7 +161,7 @@ function card(s, x, y, w, h, accent, title, lines) {
|
|||||||
s.background = { color: C.lightBg };
|
s.background = { color: C.lightBg };
|
||||||
header(s, 7, "Déploiement", "CI/CD automatisée — Gitea Actions");
|
header(s, 7, "Déploiement", "CI/CD automatisée — Gitea Actions");
|
||||||
s.addImage({ path: "docs/img/diag_cicd.png", x: 0.65, y: 1.4, w: 8.8, h: 3.5 });
|
s.addImage({ path: "docs/img/diag_cicd.png", x: 0.65, y: 1.4, w: 8.8, h: 3.5 });
|
||||||
s.addText("Un push lance les tests & contrôles qualité ; une fusion sur main construit l'image, la publie et redéploie automatiquement.",
|
s.addText("Un push lance style, analyse statique, tests & couverture ; une fusion sur main déclenche le déploiement SSH (mise à jour, conteneurs, migrations).",
|
||||||
{ x: 0.65, y: 4.95, w: 8.8, h: 0.4, fontSize: 11, italic: true, color: C.gray, fontFace: "Calibri", margin: 0 });
|
{ x: 0.65, y: 4.95, w: 8.8, h: 0.4, fontSize: 11, italic: true, color: C.gray, fontFace: "Calibri", margin: 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user