fieldset-academic: dim locked year field, remove required asterisk

When locked_year is set, render the Année label+input inline with
opacity:0.55 instead of via text-field.php. No asterisk since editing
is disabled. The hidden input still ensures the value is submitted.
This commit is contained in:
Pontoporeia
2026-07-08 13:50:03 +02:00
parent f9d8fab120
commit 6ecab96137
@@ -22,24 +22,29 @@ $lockedYear = $lockedYear ?? null;
<?php
$name = 'année'; $label = 'Année :';
$required = !$adminMode;
$type = 'number';
$placeholder = date('Y');
$attrs = $withAutofocusFn('année', ['min' => 2000, 'max' => date('Y') + 1]);
if ($lockedYear !== null):
// Link specifies a locked academic year: pre-fill, disable editing.
$value = (string)$lockedYear;
$attrs['disabled'] = true;
$attrs['readonly'] = true;
// Include a hidden input so the value is still submitted when the field is disabled.
// Link specifies a locked academic year: render a dimmed, non-editable
// field with no required indicator, plus a hidden input for submission.
?>
<input type="hidden" name="année" value="<?= htmlspecialchars((string)$lockedYear) ?>">
<div style="opacity:0.55">
<label for="année"><?= htmlspecialchars($label) ?></label>
<input type="number" id="année"
value="<?= htmlspecialchars((string)$lockedYear) ?>"
disabled readonly
min="2000" max="<?= date('Y') + 1 ?>"
placeholder="<?= htmlspecialchars($placeholder) ?>">
</div>
<?php
else:
$required = !$adminMode;
$value = $oldFn('année');
$attrs = $withAutofocusFn('année', ['min' => 2000, 'max' => date('Y') + 1]);
include APP_ROOT . '/templates/partials/form/text-field.php';
endif;
include APP_ROOT . '/templates/partials/form/text-field.php';
?>
<?php