Rend les salles et tournées configurables

Refs #10 #21
This commit is contained in:
Alexandre NOEL 2026-09-08 00:33:25 +02:00
commit e7176b6371
17 changed files with 189 additions and 25 deletions

View file

@ -140,6 +140,7 @@ $estMonths = $birth_estimated_months > 0 ? ($birth_estimated_months % 12) : '';
<?php foreach (($shelterRooms ?? []) as $room): ?><option
value="<?= h($room['code']) ?>"
data-status="<?= h($room['status_code']) ?>"
<?= $isEdit && !ShelterRoomService::accepts($room, $animal) ? 'disabled' : '' ?>
<?= (($animal['refuge_room'] ?? '') === $room['code']) ? 'selected' : '' ?>>
<?= h($room['name']) ?></option><?php endforeach; ?>
</select>

View file

@ -276,12 +276,11 @@ $fieldOptions = [
<div class="care-mode">
<div class="card mb-3">
<div class="card-body d-flex align-items-center gap-2 care-round-toolbar">
<strong
class="me-2"><?= h(t('care.round_of', ['period' => t($period === 'morning' ? 'care.morning' : 'care.evening')])) ?></strong>
<a class="btn <?= $period === 'morning' ? 'btn-primary' : 'btn-outline-primary' ?>"
href="/care-round?period=morning&date=<?= h($date) ?>">☀️ <?= h(t('care.morning')) ?></a>
<a class="btn <?= $period === 'evening' ? 'btn-primary' : 'btn-outline-primary' ?>"
href="/care-round?period=evening&date=<?= h($date) ?>">🌙 <?= h(t('care.evening')) ?></a>
<strong class="me-2"><?= h(t('care.round_of', ['period' => t('care.' . $period)])) ?></strong>
<?php foreach (['morning' => '☀️','noon' => '🕛','afternoon' => '🌤️','evening' => '🌙'] as $periodCode => $icon): ?>
<a class="btn <?= $period === $periodCode ? 'btn-primary' : 'btn-outline-primary' ?>"
href="/care-round?period=<?= h($periodCode) ?>&date=<?= h($date) ?>"><?= $icon ?> <?= h(t('care.' . $periodCode)) ?></a>
<?php endforeach; ?>
<div class="care-round-actions"><input class="form-control" type="date" value="<?= h($date) ?>"
onchange="location.href='/care-round?period=<?= h($period) ?>&date='+this.value">
<button class="btn btn-outline-secondary" type="button"

View file

@ -66,6 +66,7 @@ foreach ($rooms as $room) {
<td><select class="form-select care-room-select" name="room[<?= (int)$animal['id'] ?>]"
data-animal="<?= (int)$animal['id'] ?>"><?php foreach ($rooms as $room): ?><option
value="<?= h($room['code']) ?>"
<?= !ShelterRoomService::accepts($room, $animal) ? 'disabled' : '' ?>
<?= $currentRoom === $room['code'] ? 'selected' : '' ?>><?= h($room['name']) ?>
</option><?php endforeach; ?></select></td>
<td><select class="form-select care-box-select" name="box[<?= (int)$animal['id'] ?>]"

View file

@ -31,10 +31,9 @@
<div class="col-lg-6">
<section class="card h-100">
<div class="card-body">
<span class="badge bg-blue-lt mb-2">1.0.0-rc.10</span>
<h3>Fiabilité des fiches animales</h3>
<p class="text-muted">Enregistrement du statut rétabli, codes internes stabilisés et noms accentués
correctement translittérés.</p>
<span class="badge bg-blue-lt mb-2">1.0.0-rc.11</span>
<h3>Salles et tournées configurables</h3>
<p class="text-muted">Critères d’accueil par salle et créneaux de soins adaptés à l’organisation du refuge.</p>
</div>
</section>
</div>

View file

@ -47,6 +47,11 @@
name="rooms[<?= (int)$room['id'] ?>][bulk_validation]"
<?= $room['bulk_validation'] ? 'checked' : '' ?>><span
class="form-check-label"><?= h(t('rooms.bulk_validation')) ?></span></label></div>
<div class="col-12"><hr><div class="form-label"><?= h(t('rooms.admission_rules')) ?></div></div>
<div class="col-md-4"><label class="form-label"><?= h(t('animal.species')) ?></label><select class="form-select" name="rooms[<?= (int)$room['id'] ?>][allowed_species]"><option value=""><?= h(t('common.all')) ?></option><?php foreach ($species as $option): ?><option value="<?= h($option['code']) ?>" <?= ($room['allowed_species'] ?? '') === $option['code'] ? 'selected' : '' ?>><?= h($option['name']) ?></option><?php endforeach; ?></select></div>
<div class="col-md-4"><label class="form-label"><?= h(t('animal.sex')) ?></label><select class="form-select" name="rooms[<?= (int)$room['id'] ?>][allowed_sex]"><option value=""><?= h(t('common.all')) ?></option><option value="M" <?= ($room['allowed_sex'] ?? '') === 'M' ? 'selected' : '' ?>><?= h(t('sex.male')) ?></option><option value="F" <?= ($room['allowed_sex'] ?? '') === 'F' ? 'selected' : '' ?>><?= h(t('sex.female')) ?></option></select></div>
<div class="col-md-4"><label class="form-label">FIV</label><select class="form-select" name="rooms[<?= (int)$room['id'] ?>][required_fiv]"><option value="any"><?= h(t('common.all')) ?></option><option value="positive" <?= ($room['required_fiv'] ?? 'any') === 'positive' ? 'selected' : '' ?>><?= h(t('animals.test_positive')) ?></option><option value="negative" <?= ($room['required_fiv'] ?? 'any') === 'negative' ? 'selected' : '' ?>><?= h(t('animals.test_negative')) ?></option></select></div>
<div class="col-12"><label class="form-label"><?= h(t('rooms.care_periods')) ?></label><div class="d-flex flex-wrap gap-3"><?php foreach (ShelterRoomService::PERIODS as $period): ?><label class="form-check"><input class="form-check-input" type="checkbox" name="rooms[<?= (int)$room['id'] ?>][care_periods][]" value="<?= h($period) ?>" <?= in_array($period, ShelterRoomService::periods($room), true) ? 'checked' : '' ?>><span class="form-check-label"><?= h(t('care.' . $period)) ?></span></label><?php endforeach; ?></div></div>
</div>
</div>
</div><?php endforeach; ?>
@ -78,6 +83,10 @@
<div class="col-12"><label class="form-check"><input class="form-check-input" type="checkbox"
name="new_room[bulk_validation]"><span
class="form-check-label"><?= h(t('rooms.bulk_validation')) ?></span></label></div>
<div class="col-md-4"><label class="form-label"><?= h(t('animal.species')) ?></label><select class="form-select" name="new_room[allowed_species]"><option value=""><?= h(t('common.all')) ?></option><?php foreach ($species as $option): ?><option value="<?= h($option['code']) ?>"><?= h($option['name']) ?></option><?php endforeach; ?></select></div>
<div class="col-md-4"><label class="form-label"><?= h(t('animal.sex')) ?></label><select class="form-select" name="new_room[allowed_sex]"><option value=""><?= h(t('common.all')) ?></option><option value="M"><?= h(t('sex.male')) ?></option><option value="F"><?= h(t('sex.female')) ?></option></select></div>
<div class="col-md-4"><label class="form-label">FIV</label><select class="form-select" name="new_room[required_fiv]"><option value="any"><?= h(t('common.all')) ?></option><option value="positive"><?= h(t('animals.test_positive')) ?></option><option value="negative"><?= h(t('animals.test_negative')) ?></option></select></div>
<div class="col-12"><label class="form-label"><?= h(t('rooms.care_periods')) ?></label><div class="d-flex flex-wrap gap-3"><?php foreach (ShelterRoomService::PERIODS as $period): ?><label class="form-check"><input class="form-check-input" type="checkbox" name="new_room[care_periods][]" value="<?= h($period) ?>" <?= in_array($period, ['morning','evening'], true) ? 'checked' : '' ?>><span class="form-check-label"><?= h(t('care.' . $period)) ?></span></label><?php endforeach; ?></div></div>
</div>
</div>
</div>