mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-08-10 07:11:18 +02:00
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:
@@ -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');
|
||||
endif;
|
||||
$attrs = $withAutofocusFn('année', ['min' => 2000, 'max' => date('Y') + 1]);
|
||||
include APP_ROOT . '/templates/partials/form/text-field.php';
|
||||
endif;
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user