Files
pta/app/Views/pages/role.php
PTA 4201894e28 V7.10 — Tableau de bord, guide, semaine type et enveloppe de formation
Reprise dans le répertoire de production du travail mené dans le worktree
ux-service-enfance :

- tableau de bord Service Enfance (dashboard.php) et navigation regroupée ;
- guide d'utilisation (faq.php) accessible depuis toute la navigation ;
- éditeur de semaine type mis en avant sur l'écran de saisie ;
- droit à l'enveloppe de formation par agent, en remplacement de la case
  « formation déjà prévue dans la répartition annuelle » ;
- correctif de « [object Object] » sur les cartes de quota du PTA ;
- motif de travail par défaut à la saisie, heures travaillées complètes
  dans les PDF.

Le docker-compose.yml de production est conservé : celui du worktree décrit
une pile de test (conteneurs et volume suffixés « test », ports 9080/9081),
qui aurait fait redémarrer l'application sur un volume MariaDB vide.

Les migrations database/migration_v7_9*.sql sont obligatoires ; le service
db-migrate les applique au déploiement.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 16:53:04 +02:00

122 lines
5.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/** @var string $csrfToken */
/** @var array $agents */
/** @var array $structures */
/** @var string $error */
/** @var array|null $currentProfile */
/** @var string $cspNonce */
?>
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Choisir votre accès — PTA</title>
<link rel="stylesheet" href="assets/style.css?v=7.16">
</head>
<body class="role-page-body">
<main class="role-page-shell">
<section class="role-intro">
<p class="eyebrow">PTA</p>
<h1>Quel est votre rôle ?</h1>
<p>Votre choix détermine les pages visibles et les actions autorisées pendant cette session.</p>
<?php if ($currentProfile): ?>
<div class="role-current-profile">
Profil actuel : <strong><?= htmlspecialchars((string) $currentProfile['role_label']) ?></strong>
— <?= htmlspecialchars((string) $currentProfile['label']) ?>
</div>
<?php endif; ?>
<?php if ($error !== ''): ?>
<div class="message message-error"><?= htmlspecialchars($error) ?></div>
<?php endif; ?>
</section>
<form method="post" class="role-selection-form" id="role-selection-form">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($csrfToken) ?>">
<div class="role-choice-grid">
<label class="role-choice-card">
<input type="radio" name="role" value="AGENT" required>
<span class="role-choice-content">
<strong>Agent</strong>
<small>Lecture de mon planning et du planning de mon lieu de rattachement.</small>
</span>
</label>
<label class="role-choice-card">
<input type="radio" name="role" value="RESPONSABLE_STRUCTURE" required>
<span class="role-choice-content">
<strong>Responsable de structure</strong>
<small>Saisie et modification des horaires et motifs de mon lieu, uniquement en brouillon.</small>
</span>
</label>
<label class="role-choice-card">
<input type="radio" name="role" value="SERVICE_ENFANCE" required>
<span class="role-choice-content">
<strong>Service Enfance</strong>
<small>Contrôle complet, prévisionnel N+1, administration et validation des plannings.</small>
</span>
</label>
</div>
<div id="agent-context" class="role-context-card" hidden>
<label class="field">
<span>Je suis l’agent</span>
<select name="agent_id" id="role-agent-select">
<option value="">Choisir mon identité</option>
<?php foreach ($agents as $agent): ?>
<option value="<?= (int) $agent['id_agent'] ?>">
<?= htmlspecialchars($agent['prenom'] . ' ' . $agent['nom'] . ' (' . $agent['matricule'] . ')') ?>
<?= !empty($agent['structure_nom']) ? ' — ' . htmlspecialchars((string) $agent['structure_nom']) : '' ?>
</option>
<?php endforeach; ?>
</select>
</label>
</div>
<div id="responsable-context" class="role-context-card" hidden>
<label class="field">
<span>Je suis responsable du lieu</span>
<select name="structure_id" id="role-structure-select">
<option value="">Choisir le lieu d’affectation</option>
<?php foreach ($structures as $structure): ?>
<option value="<?= (int) $structure['id_structure'] ?>">
<?= htmlspecialchars((string) $structure['nom']) ?>
</option>
<?php endforeach; ?>
</select>
</label>
</div>
<div class="role-form-actions">
<button type="submit" class="button button-primary">Accéder à PTA</button>
</div>
</form>
<aside class="role-security-note">
<strong>Version de démonstration :</strong> ce sélecteur organise les droits dans l’application, mais ne remplace pas une authentification nominative. En production, le rôle devra être associé au compte connecté.
</aside>
</main>
<script nonce="<?= htmlspecialchars($cspNonce, ENT_QUOTES) ?>">
(() => {
const agentContext = document.querySelector('#agent-context');
const responsableContext = document.querySelector('#responsable-context');
const agentSelect = document.querySelector('#role-agent-select');
const structureSelect = document.querySelector('#role-structure-select');
function refresh() {
const role = document.querySelector('input[name="role"]:checked')?.value || '';
agentContext.hidden = role !== 'AGENT';
responsableContext.hidden = role !== 'RESPONSABLE_STRUCTURE';
agentSelect.required = role === 'AGENT';
structureSelect.required = role === 'RESPONSABLE_STRUCTURE';
}
document.querySelectorAll('input[name="role"]').forEach((input) => input.addEventListener('change', refresh));
refresh();
})();
</script>
</body>
</html>