Remove required from all admin add/edit form inputs

- Skip required-field validation for orientation/ap/finality/licence/jury in admin add+edit
This commit is contained in:
Pontoporeia
2026-05-08 12:40:06 +02:00
parent 5735ccbc38
commit 95fcbc919a
12 changed files with 216 additions and 98 deletions

View File

@@ -23,6 +23,7 @@ $juryPresident = $juryPresident ?? null;
$showPresident = $showPresident ?? false;
$showPromoteurUlb = $showPromoteurUlb ?? true;
$promoteurUlbConditional = $promoteurUlbConditional ?? false;
$adminMode = $adminMode ?? false;
// Add-mode repopulation from flash data
$addMode = ($juryPromoteur === null && $juryPromoteurUlb === null && empty($lecteursInternes) && empty($lecteursExternes) && $juryPresident === null);
@@ -45,9 +46,9 @@ if ($addMode && function_exists('old')) {
<!-- Promoteur·ice interne -->
<div>
<label for="jury_promoteur">Promoteur·ice interne : <span class="asterisk">*</span></label>
<label for="jury_promoteur">Promoteur·ice interne :<?= $adminMode ? '' : ' <span class="asterisk">*</span>' ?></label>
<input type="text" id="jury_promoteur" name="jury_promoteur"
value="<?= htmlspecialchars($juryPromoteur ?? '') ?>" placeholder="Nom" required>
value="<?= htmlspecialchars($juryPromoteur ?? '') ?>" placeholder="Nom" <?= $adminMode ? '' : 'required' ?>>
</div>
<?php if ($showPromoteurUlb): ?>
@@ -70,7 +71,7 @@ if ($addMode && function_exists('old')) {
var isApprofondi = text.includes('approfondi');
ulbRow.style.display = isApprofondi ? '' : 'none';
if (ulbInput) {
ulbInput.required = isApprofondi;
ulbInput.required = <?= $adminMode ? 'false' : 'isApprofondi' ?>;
ulbInput.disabled = !isApprofondi;
if (!isApprofondi) ulbInput.value = '';
}
@@ -86,11 +87,11 @@ if ($addMode && function_exists('old')) {
<!-- Lecteur·ice(s) interne -->
<fieldset class="admin-jury-lecteurs">
<legend>Lecteur·ice(s) interne <span class="asterisk">*</span></legend>
<legend>Lecteur·ice(s) interne<?= $adminMode ? '' : ' <span class="asterisk">*</span>' ?></legend>
<div id="jury-lecteurs-internes-list" class="admin-jury-list">
<?php if (empty($lecteursInternes)): ?>
<div class="admin-jury-entry">
<input type="text" name="jury_lecteur_interne[]" placeholder="Nom" required
<input type="text" name="jury_lecteur_interne[]" placeholder="Nom" <?= $adminMode ? '' : 'required' ?>
aria-label="Lecteur·ice interne 1 — nom">
<button type="button" class="btn btn--sm btn--ghost admin-btn-remove"
onclick="removeJuryRow(this)" aria-label="Supprimer"><span aria-hidden="true">✕</span></button>
@@ -100,7 +101,7 @@ if ($addMode && function_exists('old')) {
<div class="admin-jury-entry">
<input type="text" name="jury_lecteur_interne[]"
value="<?= htmlspecialchars($lm['name']) ?>" placeholder="Nom"
<?= $li === 0 ? 'required' : '' ?>
<?= (!$adminMode && $li === 0) ? 'required' : '' ?>
aria-label="Lecteur·ice interne <?= $li + 1 ?> — nom">
<button type="button" class="btn btn--sm btn--ghost admin-btn-remove"
onclick="removeJuryRow(this)" aria-label="Supprimer"><span aria-hidden="true">✕</span></button>
@@ -116,11 +117,11 @@ if ($addMode && function_exists('old')) {
<!-- Lecteur·ice(s) externe -->
<fieldset class="admin-jury-lecteurs">
<legend>Lecteur·ice(s) externe <span class="asterisk">*</span></legend>
<legend>Lecteur·ice(s) externe<?= $adminMode ? '' : ' <span class="asterisk">*</span>' ?></legend>
<div id="jury-lecteurs-externes-list" class="admin-jury-list">
<?php if (empty($lecteursExternes)): ?>
<div class="admin-jury-entry">
<input type="text" name="jury_lecteur_externe[]" placeholder="Nom" required
<input type="text" name="jury_lecteur_externe[]" placeholder="Nom" <?= $adminMode ? '' : 'required' ?>
aria-label="Lecteur·ice externe 1 — nom">
<button type="button" class="btn btn--sm btn--ghost admin-btn-remove"
onclick="removeJuryRow(this)" aria-label="Supprimer"><span aria-hidden="true">✕</span></button>
@@ -130,7 +131,7 @@ if ($addMode && function_exists('old')) {
<div class="admin-jury-entry">
<input type="text" name="jury_lecteur_externe[]"
value="<?= htmlspecialchars($lm['name']) ?>" placeholder="Nom"
<?= $li === 0 ? 'required' : '' ?>
<?= (!$adminMode && $li === 0) ? 'required' : '' ?>
aria-label="Lecteur·ice externe <?= $li + 1 ?> — nom">
<button type="button" class="btn btn--sm btn--ghost admin-btn-remove"
onclick="removeJuryRow(this)" aria-label="Supprimer"><span aria-hidden="true">✕</span></button>