Files
pta/app/Views/pages/role.php
PTA 935cc3ea1c Retrait des cumuls « Consommation globale » et « Reste à affecter » du tableau de bord
Ces deux cartes additionnaient les heures de tous les agents suivis, quotités
confondues : le pourcentage et le solde obtenus ne décrivaient la situation
d'aucun agent réel et n'appelaient aucune action. Le bloc « Suivi des quotas
annuels » conserve les indicateurs actionnables (agents suivis, agents sans
aucune heure) et le tableau agent par agent.

Les agrégats correspondants sont retirés du payload de api/dashboard_summary.php
et de leur calcul dans DashboardController : plus aucun consommateur ne les lit.
La tuile « Quotas dépassés » et son compteur de dépassements sont inchangés.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 15:09:15 +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.11">
</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>