Files
pta/app/Views/partials/manage_structures.php
2026-08-20 17:00:06 +02:00

88 lines
4.9 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
/**
* Management — Lieux d'affectation : création et paramètres des lieux.
* Module JS : `administration`.
*
* Partiel de contenu inclus par la vue de page homonyme. Les identifiants HTML
* posés ici sont les points d'ancrage du module JS : les renommer casse le
* module sans aucune erreur visible.
*
* Les HORAIRES DE COUVERTURE d'un lieu ne sont pas ici mais dans l'onglet
* « Administration » : ils ne décrivent pas le lieu, ils décrivent une exigence
* de présence, contrôlée par l'onglet « Couverture ».
*/
?>
<section id="manage-structures-view" class="app-view page-content">
<section class="card admin-card">
<div class="section-heading">
<div>
<h2>Ajouter un lieu d’affectation</h2>
<p class="section-subtitle">Chaque lieu possède son propre type : périscolaire ou extrascolaire.</p>
</div>
</div>
<form id="create-structure-form" class="admin-form">
<div class="admin-form-grid">
<label class="field">
<span>Code <strong>*</strong></span>
<input id="new-structure-code" name="code" type="text" maxlength="50" placeholder="Ex. CRECHE_MATUSALEME" required>
</label>
<label class="field">
<span>Nom <strong>*</strong></span>
<input id="new-structure-name" name="nom" type="text" maxlength="150" placeholder="Ex. Crèche Matusalème" required>
</label>
<label class="field">
<span>Type d’affectation <strong>*</strong></span>
<select id="new-structure-type" name="type_affectation" required>
<option value="PERISCOLAIRE">Périscolaire</option>
<option value="EXTRASCOLAIRE">Extrascolaire</option>
</select>
</label>
<label class="field admin-field-wide">
<span>Adresse</span>
<input id="new-structure-address" name="adresse" type="text" maxlength="255" placeholder="Adresse du lieu">
</label>
</div>
<div class="admin-form-actions">
<div id="create-structure-message" class="message" role="status" aria-live="polite"></div>
<button class="button button-primary" type="submit">Ajouter le lieu</button>
</div>
</form>
</section>
<section class="card">
<div class="section-heading">
<div>
<h2>Paramètres des lieux d’affectation</h2>
<p class="section-subtitle">Le type d’affectation est défini au niveau du lieu : par exemple « Crèche Matusalème — Périscolaire ».</p>
</div>
</div>
<div id="structure-settings-message" class="message" role="status" aria-live="polite"></div>
<div class="table-scroll">
<table class="planning-table assignment-table">
<thead>
<tr>
<th>Lieu</th>
<th>Code</th>
<th>Type d’affectation</th>
<th>Action</th>
</tr>
</thead>
<tbody id="structure-settings-body">
<?php foreach ($structures as $structure): ?>
<tr data-structure-id="<?= (int) $structure['id_structure'] ?>">
<td><strong><?= htmlspecialchars($structure['nom']) ?></strong></td>
<td><?= htmlspecialchars($structure['code']) ?></td>
<td>
<select class="structure-type-select" aria-label="Type d’affectation de <?= htmlspecialchars($structure['nom']) ?>">
<option value="PERISCOLAIRE" <?= ($structure['type_affectation'] ?? 'PERISCOLAIRE') === 'PERISCOLAIRE' ? 'selected' : '' ?>>Périscolaire</option>
<option value="EXTRASCOLAIRE" <?= ($structure['type_affectation'] ?? '') === 'EXTRASCOLAIRE' ? 'selected' : '' ?>>Extrascolaire</option>
</select>
</td>
<td><button type="button" class="button button-secondary save-structure-type">Enregistrer</button></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</section>