Publier Globinours 1.0.0-rc.3
This commit is contained in:
parent
ea8c24d622
commit
9a2b4068da
78 changed files with 38230 additions and 20 deletions
82
app/Views/_animal_show_activity.php
Normal file
82
app/Views/_animal_show_activity.php
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
// Sous-vue de la fiche animale ; les variables sont préparées par AnimalsController::show().
|
||||
?>
|
||||
<!-- ACTIVITÉ -->
|
||||
<div class="tab-pane" id="tab-activity">
|
||||
<?php /** @var array $activity */ ?>
|
||||
<?php if (empty($activity)): ?>
|
||||
<div class="text-muted"><?= h(t('animal.no_activity')) ?></div>
|
||||
<?php else: ?>
|
||||
|
||||
<?php
|
||||
$actMeta = [
|
||||
'history' => ['label' => t('animal.system'), 'iconBg' => 'bg-blue', 'icon' => 'history', 'badge' => 'bg-blue-lt'],
|
||||
'medical' => ['label' => t('animal.tab.medical'), 'iconBg' => 'bg-red', 'icon' => 'heart', 'badge' => 'bg-red-lt'],
|
||||
'vaccine' => ['label' => t('animal.vaccine'), 'iconBg' => 'bg-yellow', 'icon' => 'shield-check', 'badge' => 'bg-yellow-lt'],
|
||||
'deworming' => ['label' => t('animals.dewormer'), 'iconBg' => 'bg-lime', 'icon' => 'pill', 'badge' => 'bg-lime-lt'],
|
||||
'treatment' => ['label' => t('animal.treatment'), 'iconBg' => 'bg-orange', 'icon' => 'pill', 'badge' => 'bg-orange-lt'],
|
||||
'weight' => ['label' => t('common.weight'), 'iconBg' => 'bg-indigo', 'icon' => 'scale', 'badge' => 'bg-indigo-lt'],
|
||||
'care_round' => ['label' => t('animal.care_round'), 'iconBg' => 'bg-red', 'icon' => 'alert-triangle','badge' => 'bg-red-lt'],
|
||||
'death' => ['label' => t('status.decede'), 'iconBg' => 'bg-dark', 'icon' => 'rainbow', 'badge' => 'bg-dark-lt'],
|
||||
];
|
||||
?>
|
||||
|
||||
<ul class="list list-timeline" style="list-style-type:none;">
|
||||
<?php foreach ($activity as $a):
|
||||
$kind = (string)($a['kind'] ?? 'history');
|
||||
if (!$canViewMedical && in_array($kind, ['medical','vaccine','treatment','deworming','weight','care_round','death'], true)) {
|
||||
continue;
|
||||
}
|
||||
$meta = $actMeta[$kind] ?? ['label' => ucfirst($kind), 'iconBg' => 'bg-muted', 'icon' => 'circle', 'badge' => 'bg-muted-lt'];
|
||||
|
||||
$lbl = (string)($a['label'] ?? '');
|
||||
$details = (string)($a['details'] ?? '');
|
||||
$at = (string)($a['at'] ?? '');
|
||||
?>
|
||||
<li>
|
||||
<!-- icône timeline (gauche) -->
|
||||
<div class="list-timeline-icon <?= h($meta['iconBg']) ?>">
|
||||
<i class="ti ti-<?= h($meta['icon']) ?>"></i>
|
||||
</div>
|
||||
|
||||
<div class="list-timeline-content">
|
||||
<div class="d-flex align-items-start justify-content-between">
|
||||
|
||||
<div class="d-flex align-items-center gap-3 flex-grow-1">
|
||||
|
||||
<!-- BADGE FIXE aligné -->
|
||||
<div style="min-width:110px">
|
||||
<span class="badge <?= h($meta['badge']) ?>">
|
||||
<?= strtoupper(h($meta['label'])) ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- TITRE -->
|
||||
<div class="fw-bold">
|
||||
<?= h($lbl) ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- DATE -->
|
||||
<div class="text-muted small text-end" style="min-width:140px">
|
||||
<?= h($at) ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php //if ($details !== ''):?>
|
||||
<!-- <div class="mt-2 ms-3"> -->
|
||||
<?php //echo nl2br(h($details));?>
|
||||
<!-- </div>-->
|
||||
<?php //endif;?>
|
||||
|
||||
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
48
app/Views/_animal_show_documents.php
Normal file
48
app/Views/_animal_show_documents.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
// Sous-vue de la fiche animale ; les variables sont préparées par AnimalsController::show().
|
||||
?>
|
||||
<!-- DOCUMENTS -->
|
||||
<?php if ($canViewMedical): ?>
|
||||
<div class="tab-pane" id="tab-documents">
|
||||
<div class="card card-sm">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<h3 class="card-title mb-1"><?= h(t('animal.adoption_contract')) ?></h3>
|
||||
<div class="text-muted small"><?= h(t('animal.generated_copy_help')) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-3 align-items-center">
|
||||
<div class="col-md">
|
||||
<div class="fw-bold"><?= h(t('animal.prefilled_information')) ?></div>
|
||||
<div class="text-muted small"><?= h(t('animal.adoption_prefill')) ?></div>
|
||||
<?php if (!empty($adoption)): ?><div class="text-success small mt-1">✓
|
||||
<?= h(t('animal.linked_adopter', ['name' => $adoption['adopter_name'] ?? ''])) ?></div>
|
||||
<?php else: ?><div class="text-warning small mt-1">⚠ <?= h(t('animal.no_linked_adopter')) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col-md-auto d-flex flex-wrap gap-2"><a class="btn btn-outline-primary"
|
||||
href="/animal/documents/adoption?animal_id=<?= (int)$animal['id'] ?>&format=odt"><?= h(t('animal.download_odt')) ?></a><a
|
||||
class="btn btn-danger"
|
||||
href="/animal/documents/adoption?animal_id=<?= (int)$animal['id'] ?>&format=pdf"
|
||||
target="_blank"><?= h(t('animal.view_print_pdf')) ?></a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card card-sm mt-3">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<h3 class="card-title mb-1"><?= h(t('animal.abandon_found')) ?></h3>
|
||||
<div class="text-muted small"><?= h(t('animal.known_info_added')) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body d-flex flex-wrap align-items-center gap-2">
|
||||
<div class="me-auto text-muted small"><?= h(t('animal.identity_summary')) ?></div><a
|
||||
class="btn btn-outline-primary"
|
||||
href="/animal/documents/abandon?animal_id=<?= (int)$animal['id'] ?>&format=odt"><?= h(t('animal.download_odt')) ?></a><a
|
||||
class="btn btn-danger" href="/animal/documents/abandon?animal_id=<?= (int)$animal['id'] ?>&format=pdf"
|
||||
target="_blank"><?= h(t('animal.view_print_pdf')) ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
31
app/Views/_animal_show_history.php
Normal file
31
app/Views/_animal_show_history.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
// Sous-vue de la fiche animale ; les variables sont préparées par AnimalsController::show().
|
||||
?>
|
||||
<!-- HISTORIQUE -->
|
||||
<div class="tab-pane" id="tab-hist">
|
||||
<?php $visibleHistory = $canViewMedical ? $history : array_values(array_filter($history, static fn (array $row): bool => !in_array((string)($row['type'] ?? ''), ['medical','treatment','vaccine','deworming','death'], true))); ?>
|
||||
<?php if (empty($visibleHistory)): ?>
|
||||
<div class="text-muted"><?= h(t('animal.no_history_event')) ?></div>
|
||||
<?php else: ?>
|
||||
<ul class="list list-timeline">
|
||||
<?php foreach ($visibleHistory as $h):
|
||||
$style = $historyStyles[$h['type']] ?? ['bg' => 'bg-muted','icon' => 'circle'];
|
||||
?>
|
||||
<li>
|
||||
<div class="list-timeline-icon <?= $style['bg'] ?>">
|
||||
<i class="ti ti-<?= $style['icon'] ?>"></i>
|
||||
</div>
|
||||
<div class="list-timeline-content">
|
||||
<div class="fw-bold"><?= h($h['label']) ?></div>
|
||||
<div class="text-muted small"><?= h($h['created_at']) ?></div>
|
||||
<?php if (!empty($h['actor_name'])): ?><div class="text-muted small">
|
||||
<?= h(t('common.by', ['name' => $h['actor_name']])) ?></div><?php endif; ?>
|
||||
<?php if (!empty($h['details'])): ?>
|
||||
<div class="mt-1"><?= nl2br(h($h['details'])) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
459
app/Views/_animal_show_identity.php
Normal file
459
app/Views/_animal_show_identity.php
Normal file
|
|
@ -0,0 +1,459 @@
|
|||
<?php
|
||||
// Sous-vue de la fiche animale ; les variables sont préparées par AnimalsController::show().
|
||||
?>
|
||||
<!-- IDENTITÉ -->
|
||||
<div class="tab-pane active show" id="tab-ident">
|
||||
|
||||
<?php if ($canViewMedical && !empty($death)): ?>
|
||||
<?php
|
||||
$deathCauseLabels = array_combine(array_keys(DeathController::CAUSES), array_map(static fn ($key) => DeathController::causeLabel($key), array_keys(DeathController::CAUSES)));
|
||||
$deathPlaceLabels = array_combine(array_keys(DeathController::PLACES), array_map(static fn ($key) => DeathController::placeLabel($key), array_keys(DeathController::PLACES)));
|
||||
$deathDispositionLabels = array_combine(array_keys(DeathController::DISPOSITIONS), array_map(static fn ($key) => DeathController::dispositionLabel($key), array_keys(DeathController::DISPOSITIONS)));
|
||||
$deathDate = DateTimeImmutable::createFromFormat('Y-m-d', (string)$death['deceased_date']);
|
||||
$deathDateLabel = !empty($death['death_year']) ? t('animal.year', ['year' => (int)$death['death_year']]) : ($deathDate ? $deathDate->format('d/m/Y') : t('animal.date_unknown'));
|
||||
?>
|
||||
<div class="card border-dark mb-3 overflow-hidden">
|
||||
<div class="card-status-start bg-dark"></div>
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<div>
|
||||
<h3 class="card-title mb-1">🌈 <?= h(t('animal.death_recorded')) ?></h3>
|
||||
<div class="text-muted small"><?= h($deathDateLabel) ?> ·
|
||||
<?= h($deathCauseLabels[$death['cause_code']] ?? $death['cause_code']) ?></div>
|
||||
</div><a class="btn btn-outline-dark btn-sm"
|
||||
href="/animal/death?id=<?= (int)$animal['id'] ?>"><?= h(t('common.edit')) ?></a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-3">
|
||||
<div class="subheader"><?= h(t('animal.statistics')) ?></div><span
|
||||
class="badge <?= !empty($death['occurred_in_care']) ? 'bg-dark' : 'bg-secondary-lt' ?>"><?= h(t(!empty($death['occurred_in_care']) ? 'animal.in_shelter_figures' : 'animal.outside_care')) ?></span>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="subheader"><?= h(t('death.place')) ?></div>
|
||||
<strong><?= h($deathPlaceLabels[$death['place_type']] ?? $death['place_type']) ?></strong><?php if ($death['place_details']): ?>
|
||||
<div class="small text-muted"><?= h($death['place_details']) ?></div><?php endif; ?>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="subheader"><?= h(t('death.care_body')) ?></div>
|
||||
<strong><?= h($deathDispositionLabels[$death['body_disposition']] ?? $death['body_disposition']) ?></strong><?php if ($death['crematorium_name']): ?>
|
||||
<div class="small text-muted"><?= h($death['crematorium_name']) ?></div><?php endif; ?>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="subheader"><?= h(t('animal.context')) ?></div>
|
||||
<?php if (!empty($death['euthanized'])): ?><span
|
||||
class="badge bg-purple-lt"><?= h(t('animal.euthanasia')) ?></span><?php else: ?><span
|
||||
class="text-muted"><?= h(t('animal.natural_death_short')) ?></span><?php endif; ?><?php if ($death['veterinarian_name']): ?>
|
||||
<div class="small text-muted"><?= h($death['veterinarian_name']) ?></div><?php endif; ?>
|
||||
</div>
|
||||
<?php if ($death['cause_details'] || $death['notes']): ?><div class="col-12 small">
|
||||
<?php if ($death['cause_details']): ?><strong><?= h(t('animal.cause')) ?> :</strong>
|
||||
<?= nl2br(h($death['cause_details'])) ?><?php endif; ?><?php if ($death['notes']): ?><div
|
||||
class="mt-1"><strong><?= h(t('common.notes')) ?> :</strong> <?= nl2br(h($death['notes'])) ?>
|
||||
</div><?php endif; ?></div><?php endif; ?>
|
||||
<?php if (!empty($death['death_age_value'])): ?><div class="col-12 small">
|
||||
<strong><?= h(t('animal.death_age')) ?></strong> <?= (int)$death['death_age_value'] ?> <?= h(match($death['death_age_unit']) {
|
||||
'day' => t('animal.age_days'),'week' => t('animal.age_weeks'),'month' => t('animal.age_months'),'year' => t('animal.age_years'),default => ''
|
||||
}) ?></div><?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($bondedGroup)): ?>
|
||||
<div class="card border-purple mb-3">
|
||||
<div class="card-status-start bg-purple"></div>
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<div>
|
||||
<h3 class="card-title mb-1">🔗 <?= h($bondedGroup['name'] ?: t('animal.bonded_cats')) ?></h3>
|
||||
<div class="text-muted small"><?= h(t('animal.bonded_help')) ?></div>
|
||||
</div>
|
||||
<form method="post" action="/bonded/dissolve"
|
||||
onsubmit="return confirm(<?= h(json_encode(t('animal.bonded_dissolve_confirm'), JSON_HEX_APOS | JSON_HEX_QUOT)) ?>);">
|
||||
<input type="hidden" name="group_id" value="<?= (int)$bondedGroup['id'] ?>">
|
||||
<input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<button class="btn btn-outline-secondary btn-sm"
|
||||
type="submit"><?= h(t('animal.dissolve_group')) ?></button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if (!empty($bondedGroup['notes'])): ?><p class="text-muted mb-3">
|
||||
<?= nl2br(h($bondedGroup['notes'])) ?></p><?php endif; ?>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<?php foreach ($bondedMembers as $member): ?>
|
||||
<a class="btn <?= (int)$member['id'] === (int)$animal['id'] ? 'btn-purple' : 'btn-outline-purple' ?>"
|
||||
href="/animal?id=<?= (int)$member['id'] ?>">
|
||||
<span class="coat-swatch me-1"
|
||||
style="<?= h(coat_swatch_style($member['color'] ?? '')) ?>"></span><?= h($member['name']) ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$lifeProfileMeta = [
|
||||
'yes' => [t('common.yes'),'bg-green-lt text-green','✓'],
|
||||
'no' => [t('common.no'),'bg-red-lt text-red','✕'],
|
||||
'unknown' => [t('common.unknown'),'bg-secondary-lt text-secondary','—'],
|
||||
];
|
||||
?>
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<h3 class="card-title mb-1"><?= h(t('animal.form.intake')) ?></h3>
|
||||
<div class="text-muted small"><?= h(t('animal.intake_origin_help')) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-6 col-lg-3">
|
||||
<div class="subheader"><?= h(t('common.date')) ?></div>
|
||||
<strong><?= h(!empty($animal['intake_date']) ? date('d/m/Y', strtotime((string)$animal['intake_date'])) : '—') ?></strong>
|
||||
</div>
|
||||
<div class="col-6 col-lg-3">
|
||||
<div class="subheader"><?= h(t('animal.intake_mode')) ?></div>
|
||||
<strong><?= h($intakeTypes[$animal['intake_type'] ?? 'unknown'] ?? t('common.not_provided')) ?></strong>
|
||||
</div>
|
||||
<div class="col-6 col-lg-3">
|
||||
<div class="subheader"><?= h(t('animal.reason')) ?></div>
|
||||
<strong><?= h($intakeReasons[$animal['intake_reason'] ?? 'unknown'] ?? t('common.not_provided')) ?></strong>
|
||||
</div>
|
||||
<div class="col-6 col-lg-3">
|
||||
<div class="subheader"><?= h(t('animal.origin_city')) ?></div>
|
||||
<strong><?= h(($animal['rescue_location_name'] ?? '') ?: '—') ?></strong>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6">
|
||||
<div class="subheader"><?= h(t('animal.form.depositor')) ?></div><?php if ($depositor): ?><a
|
||||
class="fw-bold"
|
||||
href="/directory/edit?id=<?= (int)$depositor['id'] ?>"><?= h($depositor['name']) ?></a><?php if (!empty($depositor['city'])): ?><span
|
||||
class="text-muted"> · <?= h($depositor['city']) ?></span><?php endif; ?><?php else: ?><span
|
||||
class="text-muted"><?= h(t('animal.form.no_depositor')) ?></span><?php endif; ?>
|
||||
</div>
|
||||
<?php if (!empty($animal['intake_circumstances'])): ?><div class="col-12">
|
||||
<div class="subheader"><?= h(t('animal.form.circumstances')) ?></div>
|
||||
<div><?= nl2br(h($animal['intake_circumstances'])) ?></div>
|
||||
</div><?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<h3 class="card-title mb-1"><?= h(t('animal.form.life_profile')) ?></h3>
|
||||
<div class="text-muted small"><?= h(t('animal.life_profile_help')) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<?php foreach ([
|
||||
'compatibility_dogs' => ['🐶',t('animals.dogs')],
|
||||
'compatibility_cats' => ['🐱',t('animals.cats')],
|
||||
'compatibility_children' => ['🧒',t('animals.children')],
|
||||
'house_trained' => ['🧼',t('animals.cleanliness')],
|
||||
] as $field => $profile): [$profileLabel,$profileClass,$profileSymbol] = $lifeProfileMeta[$animal[$field] ?? 'unknown'] ?? $lifeProfileMeta['unknown']; ?>
|
||||
<div class="col-6 col-lg-3">
|
||||
<div class="border rounded p-3 h-100 d-flex align-items-center gap-3"><span class="fs-2"
|
||||
aria-hidden="true"><?= $profile[0] ?></span>
|
||||
<div>
|
||||
<div class="text-muted small"><?= h($profile[1]) ?></div><span
|
||||
class="badge <?= h($profileClass) ?>"><?= h($profileSymbol . ' ' . $profileLabel) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require __DIR__ . '/_expense_summary.php'; ?>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title m-0"><?= h(t('common.notes')) ?></h3>
|
||||
</div>
|
||||
<div class="card-body"><?= $animal['notes'] ? nl2br(h($animal['notes'])) : '—' ?></div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
$rescueAddr = trim((string)($animal['rescue_address'] ?? ''));
|
||||
$rescueLat = isset($animal['rescue_lat']) && $animal['rescue_lat'] !== '' ? (float)$animal['rescue_lat'] : null;
|
||||
$rescueLng = isset($animal['rescue_lng']) && $animal['rescue_lng'] !== '' ? (float)$animal['rescue_lng'] : null;
|
||||
|
||||
$currentAddr = trim((string)($animal['current_address'] ?? '5 RUE NOTRE DAME 29260 LESNEVEN'));
|
||||
$currentLat = isset($animal['current_lat']) && $animal['current_lat'] !== '' ? (float)$animal['current_lat'] : null;
|
||||
$currentLng = isset($animal['current_lng']) && $animal['current_lng'] !== '' ? (float)$animal['current_lng'] : null;
|
||||
|
||||
$hasRescue = ($rescueLat !== null && $rescueLng !== null);
|
||||
$hasCurrent = ($currentLat !== null && $currentLng !== null);
|
||||
?>
|
||||
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<h3 class="card-title m-0"><?= h(t('animal.location')) ?></h3>
|
||||
<div class="d-flex gap-2">
|
||||
<span class="badge bg-azure-lt"><?= h(t('animal.rescue')) ?></span>
|
||||
<span class="badge bg-lime-lt"><?= h(t('animal.current')) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<div class="text-muted mb-1"><?= h(t('animal.rescue_place')) ?></div>
|
||||
<div class="fw-bold"><?= $rescueAddr !== '' ? h($rescueAddr) : '—' ?></div>
|
||||
<?php if (!$hasRescue): ?>
|
||||
<div class="text-muted small mt-1"><?= h(t('animal.coordinates_missing')) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="text-muted mb-1"><?= h(t('animal.form.current_location')) ?></div>
|
||||
<div class="fw-bold"><?= h($currentAddr) ?></div>
|
||||
|
||||
<?php if (!$hasCurrent): ?>
|
||||
<div class="text-muted small mt-1"><?= h(t('animal.coordinates_missing')) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ($animal['status'] === 'adopte'): ?>
|
||||
|
||||
<div class="alert alert-success mt-3">
|
||||
<strong><?= h(t('animal.adopted_by')) ?> :</strong><br>
|
||||
<?= htmlspecialchars($adoption['adopter_name'] . ' - ' . $adoption['adopter_address'] . ' ' . $adoption['adopter_postal_code'] . ' ' . $adoption['adopter_city'] . ' - (' . $adoption['adopter_phone'] . ' - ' . $adoption['adopter_email'] . ')') ?>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="mt-3" id="mapJourney"
|
||||
style="height:320px;border-radius:10px;overflow:hidden; border:1px solid #ccc"></div>
|
||||
|
||||
<?php
|
||||
function haversine_km($lat1, $lon1, $lat2, $lon2)
|
||||
{
|
||||
$earthRadius = 6371; // km
|
||||
|
||||
$dLat = deg2rad($lat2 - $lat1);
|
||||
$dLon = deg2rad($lon2 - $lon1);
|
||||
|
||||
$a = sin($dLat / 2) * sin($dLat / 2) +
|
||||
cos(deg2rad($lat1)) * cos(deg2rad($lat2)) *
|
||||
sin($dLon / 2) * sin($dLon / 2);
|
||||
|
||||
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
|
||||
return $earthRadius * $c;
|
||||
}
|
||||
|
||||
$distanceKm = null;
|
||||
|
||||
if ($hasRescue && $hasCurrent) {
|
||||
$distanceKm = haversine_km(
|
||||
$rescueLat,
|
||||
$rescueLng,
|
||||
$currentLat,
|
||||
$currentLng,
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ($distanceKm !== null): ?>
|
||||
<div class="mt-3 text-muted small">
|
||||
<?= h(t('animal.distance_story', ['name' => $animal['name'],'distance' => number_format($distanceKm, 2)])) ?><br>
|
||||
<em><?= h(t('animal.distance_caption')) ?></em>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
/** @var array|null $icad Structure = ['cached'=>..., 'stale'=>bool] comme ton endpoint */
|
||||
$cache = $icad['cached'] ?? null;
|
||||
$data = $cache['data'] ?? null;
|
||||
$status = $cache['status'] ?? 'empty';
|
||||
$fetched = $cache['fetched_at'] ?? '';
|
||||
$icadUrl = $data['icad_url'] ?? null;
|
||||
|
||||
$badge = match ($status) {
|
||||
'ok' => 'bg-success-lt',
|
||||
'error' => 'bg-danger-lt',
|
||||
default => 'bg-muted-lt',
|
||||
};
|
||||
|
||||
$label = match ($status) {
|
||||
'ok' => 'i-CAD : OK',
|
||||
'error' => 'i-CAD : Erreur',
|
||||
default => t('animal.icad_not_checked'),
|
||||
};
|
||||
|
||||
$err = (string)($cache['error'] ?? '');
|
||||
?>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<span class="badge <?= $badge ?>"><?= h($label) ?></span>
|
||||
<?php if ($fetched): ?>
|
||||
<span class="text-muted small"><?= h(t('animal.last_sync', ['date' => $fetched])) ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<?php if ($icadUrl): ?>
|
||||
<a class="btn btn-sm btn-outline-primary" href="<?= h($icadUrl) ?>" target="_blank" rel="noopener">
|
||||
<?= h(t('animal.open_icad')) ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<button class="btn btn-sm btn-outline-secondary" type="button" id="btn-icad-refresh"
|
||||
data-animal-id="<?= (int)$animal['id'] ?>">
|
||||
<?= h(t('common.refresh')) ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body" id="icad-card-body">
|
||||
<?php if ($status === 'error'): ?>
|
||||
<div class="alert alert-danger">
|
||||
<strong><?= h(t('animal.icad_error')) ?></strong><br>
|
||||
<?= h($err) ?>
|
||||
</div>
|
||||
<?php elseif ($status !== 'ok' || !$data): ?>
|
||||
<div class="text-muted"><?= h(t('animal.no_icad')) ?></div>
|
||||
<?php else: ?>
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<div class="datagrid">
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title"><?= h(t('animal.icad_name')) ?></div>
|
||||
<div class="datagrid-content"><?= h($data['name'] ?? '') ?></div>
|
||||
</div>
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title">Puce</div>
|
||||
<div class="datagrid-content"><?= h($data['insert'] ?? '') ?></div>
|
||||
</div>
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title"><?= h(t('animal.sex')) ?></div>
|
||||
<div class="datagrid-content"><?= h($data['sex'] ?? '') ?></div>
|
||||
</div>
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title"><?= h(t('animal.birth')) ?></div>
|
||||
<div class="datagrid-content"><?= h($data['birth_date'] ?? '') ?></div>
|
||||
</div>
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title"><?= h(t('animal.appearance')) ?></div>
|
||||
<div class="datagrid-content"><?= h($data['appearance'] ?? '') ?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$holder =
|
||||
$data['holder'] ??
|
||||
$data['owner'] ??
|
||||
$data['detenteur'] ??
|
||||
null;
|
||||
|
||||
// Si ton parse aplatit au lieu d'imbriquer :
|
||||
if (!$holder && (
|
||||
isset($data['holder_name']) || isset($data['holder_phone']) || isset($data['holder_email'])
|
||||
)) {
|
||||
$holder = [
|
||||
'name' => $data['holder_name'] ?? '',
|
||||
'phone' => $data['holder_phone'] ?? '',
|
||||
'email' => $data['holder_email'] ?? '',
|
||||
'type' => $data['holder_type'] ?? '',
|
||||
'address' => $data['holder_address'] ?? '',
|
||||
];
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if (is_array($holder) && array_filter($holder, fn ($v) => trim((string)$v) !== '')): ?>
|
||||
<hr class="my-3">
|
||||
|
||||
<div class="row g-3">
|
||||
<div class="col-md-12">
|
||||
<div class="d-flex align-items-center justify-content-between mb-2">
|
||||
<div class="fw-bold"><?= h(t('animal.holder')) ?></div>
|
||||
<span class="text-muted small"><span
|
||||
class="badge bg-danger-lt"><?= h(t('animal.do_not_share')) ?></span></span>
|
||||
</div>
|
||||
|
||||
<div class="datagrid">
|
||||
<?php if (!empty($holder['type'])): ?>
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title">Type</div>
|
||||
<div class="datagrid-content"><?= h($holder['type']) ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($holder['name'])): ?>
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title"><?= h(t('common.name')) ?></div>
|
||||
<div class="datagrid-content"><?= h($holder['name']) ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($holder['phone'])): ?>
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title"><?= h(t('common.phone')) ?></div>
|
||||
<div class="datagrid-content"><?= h($holder['phone']) ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($holder['email'])): ?>
|
||||
<div class="datagrid-item">
|
||||
<div class="datagrid-title"><?= h(t('common.email')) ?></div>
|
||||
<div class="datagrid-content"><?= h($holder['email']) ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($holder['address'])): ?>
|
||||
<div class="datagrid-item" style="grid-column: 1 / -1;">
|
||||
<div class="datagrid-title"><?= h(t('common.address')) ?></div>
|
||||
<div class="datagrid-content"><?= nl2br(h($holder['address'])) ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="text-muted mb-2"><?= h(t('animal.icad_history')) ?></div>
|
||||
<?php $events = $data['events'] ?? []; ?>
|
||||
<?php if (empty($events)): ?>
|
||||
<div class="text-muted"><?= h(t('animal.no_event')) ?></div>
|
||||
<?php else: ?>
|
||||
<ul class="list list-timeline">
|
||||
<?php foreach ($events as $e): ?>
|
||||
<li>
|
||||
<div class="list-timeline-icon bg-blue-lt">
|
||||
<i class="ti ti-history"></i>
|
||||
</div>
|
||||
<div class="list-timeline-content">
|
||||
<div class="fw-bold"><?= h($e['label'] ?? '') ?></div>
|
||||
<div class="text-muted small">
|
||||
<?= h(t('common.date')) ?> : <?= h($e['date'] ?? '') ?> —
|
||||
<?= h(t('animal.recorded')) ?> : <?= h($e['recorded_at'] ?? '') ?>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
68
app/Views/_animal_show_litters.php
Normal file
68
app/Views/_animal_show_litters.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
// Sous-vue de la fiche animale ; les variables sont préparées par AnimalsController::show().
|
||||
?>
|
||||
<!-- PORTÉES -->
|
||||
<?php if ($isCat): ?><div class="tab-pane" id="tab-litters">
|
||||
<div class="d-flex align-items-center justify-content-between mb-3">
|
||||
<div>
|
||||
<h3 class="mb-0"><?= h(t('animal.litters_parentage')) ?></h3>
|
||||
<div class="text-muted"><?= h(t('animal.litters_help')) ?></div>
|
||||
</div>
|
||||
<a class="btn btn-primary" href="/litter/new?animal_id=<?= (int)$animal['id'] ?>">+
|
||||
<?= h(t('animal.add_litter')) ?></a>
|
||||
</div>
|
||||
<?php if (empty($litters)): ?>
|
||||
<div class="empty">
|
||||
<div class="empty-description"><?= h(t('animal.no_litter')) ?></div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="row row-cards">
|
||||
<?php foreach ($litters as $litter): ?>
|
||||
<?php
|
||||
$litterDateLabel = t('animal.date_unknown');
|
||||
if (!empty($litter['birth_date'])) {
|
||||
$litterDate = DateTimeImmutable::createFromFormat('Y-m-d', (string)$litter['birth_date']);
|
||||
if ($litterDate) {
|
||||
$litterDateLabel = $litterDate->format('d/m/Y');
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="col-12">
|
||||
<div class="card card-sm">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<h4 class="card-title mb-1"><?= h(t('animal.litter_on', ['date' => $litterDateLabel])) ?></h4>
|
||||
<div class="text-muted small">
|
||||
<?= h(t('animal.mother')) ?> :
|
||||
<?= $litter['mother_id'] ? '<a href="/animal?id=' . (int)$litter['mother_id'] . '">' . h($litter['mother_name']) . '</a>' : h(t('animal.unknown_female')) ?>
|
||||
· <?= h(t('animal.father')) ?> :
|
||||
<?= $litter['father_id'] ? '<a href="/animal?id=' . (int)$litter['father_id'] . '">' . h($litter['father_name']) . '</a>' : h(t('animal.unknown_male')) ?>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn btn-outline-primary btn-sm ms-auto"
|
||||
href="/litter/add-existing?litter_id=<?= (int)$litter['id'] ?>&animal_id=<?= (int)$animal['id'] ?>">+
|
||||
<?= h(t('animal.add_existing_cat')) ?></a>
|
||||
</div>
|
||||
<div class="list-group list-group-flush">
|
||||
<?php foreach ($litter['kittens'] as $index => $kitten): ?>
|
||||
<a class="list-group-item list-group-item-action d-flex align-items-center gap-2"
|
||||
href="/animal?id=<?= (int)$kitten['id'] ?>">
|
||||
<span
|
||||
class="text-muted font-monospace"><?= $index === count($litter['kittens']) - 1 ? '└' : '├' ?></span>
|
||||
<span class="coat-swatch" style="<?= h(coat_swatch_style($kitten['color'] ?? '')) ?>"></span>
|
||||
<strong><?= h($kitten['name']) ?></strong>
|
||||
<?php if (!empty($kitten['archived_at'])): ?><span
|
||||
class="badge bg-secondary-lt"><?= h(t('animal.archived')) ?></span><?php endif; ?>
|
||||
<span
|
||||
class="text-muted"><?= h(($kitten['sex'] ?? 'U') === 'F' ? t('sex.female') : (($kitten['sex'] ?? 'U') === 'M' ? t('sex.male') : t('animal.sex_define'))) ?></span>
|
||||
<?php [$kittenStatusClass, $kittenStatusLabel] = status_badge((string)$kitten['status']); ?>
|
||||
<span class="badge <?= h($kittenStatusClass) ?> ms-auto"><?= h($kittenStatusLabel) ?></span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div><?php endif; ?>
|
||||
71
app/Views/_animal_show_locations.php
Normal file
71
app/Views/_animal_show_locations.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
// Sous-vue de la fiche animale ; les variables sont préparées par AnimalsController::show().
|
||||
?>
|
||||
<!-- EMPLACEMENTS -->
|
||||
<div class="tab-pane" id="tab-placements">
|
||||
<div class="d-flex justify-content-between align-items-start gap-2 mb-3">
|
||||
<div>
|
||||
<h3 class="mb-1"><?= h(t('animal.placement_journey')) ?></h3>
|
||||
<div class="text-muted"><?= h(t('animal.placement_journey_help')) ?></div>
|
||||
</div><button class="btn btn-primary btn-sm" data-bs-toggle="modal"
|
||||
data-bs-target="#modalPlacement"><?= h(t('animal.add_event')) ?></button>
|
||||
</div>
|
||||
<?php $placementLabels = ['reservation' => t('animal.reservation'),'foster' => t('animal.form.foster'),'adoption' => t('animal.final_adoption'),'return' => t('animal.return_shelter'),'cancellation' => t('animal.cancellation')];
|
||||
$placementColors = ['reservation' => 'purple','foster' => 'cyan','adoption' => 'green','return' => 'orange','cancellation' => 'secondary']; ?>
|
||||
<?php if (empty($placements)): ?><div class="text-muted"><?= h(t('animal.no_placement')) ?></div><?php else: ?><ul
|
||||
class="list list-timeline"><?php foreach ($placements as $placement): ?><li>
|
||||
<div class="list-timeline-icon bg-<?= h($placementColors[$placement['event_type']] ?? 'secondary') ?>"><i
|
||||
class="ti ti-home"></i></div>
|
||||
<div class="list-timeline-content">
|
||||
<div class="d-flex justify-content-between gap-2">
|
||||
<div><span
|
||||
class="badge bg-<?= h($placementColors[$placement['event_type']] ?? 'secondary') ?>-lt"><?= h($placementLabels[$placement['event_type']] ?? $placement['event_type']) ?></span><?php if (!empty($placement['contact_name'])): ?>
|
||||
<strong class="ms-2"><?= h($placement['contact_name']) ?></strong><?php endif; ?></div>
|
||||
<div class="text-muted small"><?= h(date('d/m/Y', strtotime((string)$placement['event_date']))) ?>
|
||||
</div>
|
||||
</div><?php if (!empty($placement['reason'])): ?><div class="mt-1"><strong><?= h(t('animal.reason')) ?>
|
||||
:</strong> <?= h($placement['reason']) ?></div>
|
||||
<?php endif; ?><?php if (!empty($placement['notes'])): ?><div class="text-muted">
|
||||
<?= nl2br(h($placement['notes'])) ?></div>
|
||||
<?php endif; ?><?php if (!empty($placement['actor_name'])): ?><div class="text-muted small">
|
||||
<?= h(t('common.by', ['name' => $placement['actor_name']])) ?></div><?php endif; ?>
|
||||
</div>
|
||||
</li><?php endforeach; ?></ul><?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="tab-locations">
|
||||
<div class="d-flex flex-wrap justify-content-between align-items-start gap-2 mb-3">
|
||||
<div>
|
||||
<h3 class="mb-1"><?= h(t('animal.location_history')) ?></h3>
|
||||
<div class="text-muted"><?= h(t('animal.location_history_help')) ?></div>
|
||||
</div>
|
||||
<span class="badge bg-blue-lt"><?= h(tn('animal.step', 'animal.steps', count($locationHistory ?? []))) ?></span>
|
||||
</div>
|
||||
<?php if (empty($locationHistory)): ?>
|
||||
<div class="text-muted"><?= h(t('animal.no_location')) ?></div>
|
||||
<?php else: ?>
|
||||
<ul class="list list-timeline">
|
||||
<?php foreach ($locationHistory as $location):
|
||||
$fromLabel = LocationHistoryService::label($location, 'from');
|
||||
$toLabel = LocationHistoryService::label($location, 'to');
|
||||
$isInitial = empty($location['from_status']) && empty($location['from_refuge_room']) && empty($location['from_care_box_key']) && empty($location['from_address']);
|
||||
?>
|
||||
<li>
|
||||
<div class="list-timeline-icon bg-blue"><i class="ti ti-map-pin"></i></div>
|
||||
<div class="list-timeline-content">
|
||||
<div class="d-flex flex-wrap justify-content-between gap-2">
|
||||
<div class="fw-bold">
|
||||
<?= $isInitial ? h($toLabel) : h($fromLabel) . ' <span class="text-muted mx-1">→</span> ' . h($toLabel) ?>
|
||||
</div>
|
||||
<div class="text-muted small"><?= h($location['moved_at']) ?></div>
|
||||
</div>
|
||||
<?php if (!empty($location['reason'])): ?><div class="text-muted mt-1"><?= h($location['reason']) ?>
|
||||
</div><?php endif; ?>
|
||||
<?php if (!empty($location['actor_name'])): ?><div class="text-muted small mt-1">
|
||||
<?= h(t('common.by', ['name' => $location['actor_name']])) ?></div><?php endif; ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
436
app/Views/_animal_show_medical.php
Normal file
436
app/Views/_animal_show_medical.php
Normal file
|
|
@ -0,0 +1,436 @@
|
|||
<?php
|
||||
// Sous-vue de la fiche animale ; les variables sont préparées par AnimalsController::show().
|
||||
?>
|
||||
<!-- MÉDICAL -->
|
||||
<?php if ($canViewMedical): ?>
|
||||
<div class="tab-pane" id="tab-med">
|
||||
<div class="card mt-3">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<div>
|
||||
<h3 class="card-title m-0"><?= h(t('animal.medical_status_global')) ?></h3>
|
||||
<div class="text-muted small"><?= h(t('animal.current_health_help')) ?></div>
|
||||
</div>
|
||||
<button class="btn btn-sm btn-outline-primary" type="button" data-bs-toggle="modal"
|
||||
data-bs-target="#modalMedicalStatus"><?= h(t('common.edit')) ?></button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<?php if ($isCat): ?><div class="col-12 col-md-3">
|
||||
<div class="subheader mb-1">FIV</div>
|
||||
<span class="badge <?= $fivClass ?>"><?= h($fivLabel) ?></span>
|
||||
</div>
|
||||
<div class="col-12 col-md-3">
|
||||
<div class="subheader mb-1">FeLV</div>
|
||||
<span class="badge <?= $felvClass ?>"><?= h($felvLabel) ?></span>
|
||||
</div><?php endif; ?>
|
||||
<div class="col-12 <?= $isCat ? 'col-md-6' : '' ?>">
|
||||
<div class="subheader mb-1"><?= h(t('animal.conditions_short')) ?></div>
|
||||
<?php $activeConditions = array_values(array_filter($healthConditions ?? [], fn ($condition) => ($condition['status'] ?? '') === 'active')); ?>
|
||||
<?php if (!$activeConditions): ?>
|
||||
<span class="text-muted"><?= h(t('animal.no_active_condition')) ?></span>
|
||||
<?php else: ?>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<?php foreach ($activeConditions as $condition): ?>
|
||||
<span class="badge bg-red-lt"><?= h($condition['name']) ?></span>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-3 mt-0">
|
||||
<div class="col-12 col-xl-5">
|
||||
<div class="card h-100">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h3 class="card-title mb-0">📄 <?= h(t('medical_document.prescriptions')) ?></h3>
|
||||
<div class="text-muted small"><?= h(t('medical_document.private_documents')) ?></div>
|
||||
</div><button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal"
|
||||
data-bs-target="#modalPrescription"><?= h(t('common.add')) ?></button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if (empty($prescriptions)): ?><div class="text-muted">
|
||||
<?= h(t('medical_document.no_prescription')) ?></div><?php else: ?><div class="divide-y">
|
||||
<?php foreach ($prescriptions as $p): $statusKey = 'medical_document.status_' . $p['status']; ?>
|
||||
<div class="py-2">
|
||||
<div class="d-flex justify-content-between gap-2">
|
||||
<div>
|
||||
<strong><?= h((new DateTimeImmutable($p['prescribed_on']))->format('d/m/Y')) ?></strong>
|
||||
<span
|
||||
class="badge <?= $p['status'] === 'active' ? 'bg-green-lt' : 'bg-secondary-lt' ?>"><?= h(t($statusKey)) ?></span>
|
||||
</div><a class="btn btn-sm btn-ghost-primary" target="_blank"
|
||||
href="/animal/medical-document?kind=prescription&id=<?= (int)$p['id'] ?>"><i
|
||||
class="ti ti-file-search"></i> <?= h(t('common.open')) ?></a>
|
||||
</div><?php if (!empty($p['clinic_name']) || !empty($p['veterinarian_name'])): ?><div
|
||||
class="text-muted small">
|
||||
<?= h(implode(' · ', array_filter([$p['clinic_name'],$p['veterinarian_name']]))) ?>
|
||||
</div><?php endif; ?><?php if (!empty($prescriptionTreatments[$p['id']])): ?><div
|
||||
class="mt-1 d-flex flex-wrap gap-1">
|
||||
<?php foreach ($prescriptionTreatments[$p['id']] as $linked): ?><span
|
||||
class="badge bg-orange-lt">💊
|
||||
<?= h($linked['medication_name'] ?: t('animal.treatment')) ?></span><?php endforeach; ?>
|
||||
</div><?php endif; ?><?php if (!empty($p['notes'])): ?><div class="small mt-1">
|
||||
<?= nl2br(h($p['notes'])) ?></div><?php endif; ?>
|
||||
</div><?php endforeach; ?></div><?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-xl-7">
|
||||
<div class="card h-100">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h3 class="card-title mb-0">🧪 <?= h(t('medical_document.lab_results')) ?></h3>
|
||||
<div class="text-muted small"><?= h(t('medical_document.lab_help')) ?></div>
|
||||
</div><button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal"
|
||||
data-bs-target="#modalLabReport"><?= h(t('common.add')) ?></button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if (empty($labReports)): ?><div class="text-muted"><?= h(t('medical_document.no_analysis')) ?>
|
||||
</div><?php else: ?><div class="accordion" id="labReportsAccordion">
|
||||
<?php foreach ($labReports as $i => $report): $results = $labResultsByReport[$report['id']] ?? []; ?>
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header"><button class="accordion-button <?= $i ? 'collapsed' : '' ?>"
|
||||
type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#lab-report-<?= (int)$report['id'] ?>"><span
|
||||
class="me-2"><?= h((new DateTimeImmutable($report['sampled_on']))->format('d/m/Y')) ?></span><span
|
||||
class="text-muted"><?= h($report['report_type'] ?: t('medical_document.analysis')) ?></span></button>
|
||||
</h2>
|
||||
<div id="lab-report-<?= (int)$report['id'] ?>"
|
||||
class="accordion-collapse collapse <?= !$i ? 'show' : '' ?>"
|
||||
data-bs-parent="#labReportsAccordion">
|
||||
<div class="accordion-body"><?php if ($report['stored_name']): ?><a
|
||||
class="btn btn-sm btn-outline-primary mb-2" target="_blank"
|
||||
href="/animal/medical-document?kind=analysis&id=<?= (int)$report['id'] ?>"><i
|
||||
class="ti ti-paperclip"></i>
|
||||
<?= h(t('medical_document.open_report')) ?></a><?php endif; ?><?php if ($results): ?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-vcenter mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= h(t('medical_document.parameter')) ?></th>
|
||||
<th><?= h(t('medical_document.value')) ?></th>
|
||||
<th><?= h(t('medical_document.reference')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><?php foreach ($results as $result): $hasReference = $result['reference_min'] !== null || $result['reference_max'] !== null;
|
||||
$low = $result['reference_min'] !== null && (float)$result['value'] < (float)$result['reference_min'];
|
||||
$high = $result['reference_max'] !== null && (float)$result['value'] > (float)$result['reference_max']; ?><tr>
|
||||
<td><?= h($result['parameter_name']) ?></td>
|
||||
<td><strong
|
||||
class="<?= !$hasReference ? '' : ($low || $high ? 'text-danger' : 'text-success') ?>"><?= h((string)$result['value'] . ' ' . ($result['unit'] ?? '')) ?></strong>
|
||||
</td>
|
||||
<td><?= $hasReference ? h(($result['reference_min'] ?? '…') . ' – ' . ($result['reference_max'] ?? '…') . ' ' . ($result['unit'] ?? '')) : '—' ?>
|
||||
</td>
|
||||
</tr><?php endforeach; ?></tbody>
|
||||
</table>
|
||||
</div><?php endif; ?><div class="text-muted small mt-2">
|
||||
<?= h(implode(' · ', array_filter([$report['laboratory_name'],$report['clinic_name'],$report['veterinarian_name']]))) ?>
|
||||
</div><?php if ($report['notes']): ?><div class="small mt-1">
|
||||
<?= nl2br(h($report['notes'])) ?></div><?php endif; ?></div>
|
||||
</div>
|
||||
</div><?php endforeach; ?></div><?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($labSeries)): ?><div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<h3 class="card-title mb-0"><?= h(t('medical_document.evolution')) ?></h3>
|
||||
<div class="text-muted small"><?= h(t('medical_document.graph_help')) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-3"><?php foreach (array_values($labSeries) as $i => $series): ?><div
|
||||
class="col-12 col-xl-6">
|
||||
<div class="border rounded p-3">
|
||||
<h4 class="mb-2">
|
||||
<?= h($series['name']) ?><?= $series['unit'] ? ' <span class="text-muted fw-normal">(' . h($series['unit']) . ')</span>' : '' ?>
|
||||
</h4>
|
||||
<div style="height:230px"><canvas class="lab-chart"
|
||||
data-series="<?= h(json_encode($series, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) ?>"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div><?php endforeach; ?></div>
|
||||
</div>
|
||||
</div><?php endif; ?>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<div>
|
||||
<h3 class="card-title m-0">🏥 Chirurgies</h3>
|
||||
<div class="text-muted small">Interventions planifiées et réalisées</div>
|
||||
</div><a class="btn btn-sm btn-outline-primary"
|
||||
href="/animal/surgery/new?animal_id=<?= (int)$animal['id'] ?>"><?= h(t('common.add')) ?></a>
|
||||
</div>
|
||||
<div class="card-body"><?php if (empty($surgeries)):?><span class="text-muted">Aucune chirurgie
|
||||
enregistrée.</span><?php else:?><div class="table-responsive">
|
||||
<table class="table table-sm table-vcenter mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Intervention</th>
|
||||
<th>Structure / vétérinaire</th>
|
||||
<th>Statut</th>
|
||||
<th class="text-end">Coût</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><?php foreach ($surgeries as $s):?><tr>
|
||||
<td><?= h(date('d/m/Y', strtotime($s['surgery_date']))) ?></td>
|
||||
<td><strong><?= h($s['procedure_name']) ?></strong><?php if ($s['notes']):?><div
|
||||
class="small text-muted"><?= h($s['notes']) ?></div><?php endif?></td>
|
||||
<td><?= h(implode(' · ', array_filter([$s['clinic_name'],$s['veterinarian_name']])) ?: '—') ?>
|
||||
</td>
|
||||
<td><span
|
||||
class="badge <?= $s['status'] === 'completed' ? 'bg-green-lt' : ($s['status'] === 'planned' ? 'bg-blue-lt' : 'bg-secondary-lt') ?>"><?= h(['completed' => 'Réalisée','planned' => 'Planifiée','cancelled' => 'Annulée'][$s['status']] ?? $s['status']) ?></span>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<?= $s['amount_cents'] === null ? '—' : number_format($s['amount_cents'] / 100, 2, ',', ' ') . ' €' ?>
|
||||
</td>
|
||||
</tr><?php endforeach?></tbody>
|
||||
</table>
|
||||
</div><?php endif?></div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<div>
|
||||
<h3 class="card-title m-0"><?= h(t('animals.dewormer')) ?></h3>
|
||||
<div class="text-muted small"><?= h(t('animal.deworming_schedule')) ?></div>
|
||||
</div><button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal"
|
||||
data-bs-target="#modalDeworming"><?= h(t('common.add')) ?></button>
|
||||
</div>
|
||||
<div class="card-body"><?php if (!$dewormings): ?><span
|
||||
class="text-muted"><?= h(t('animal.no_deworming')) ?></span><?php else: ?><div class="mb-3">
|
||||
<strong><?= h(t('animal.latest_deworming', ['date' => (new DateTimeImmutable($lastDeworming['administered_on']))->format('d/m/Y')])) ?></strong><?php if ($lastDeworming['next_due_date']): $due = new DateTimeImmutable($lastDeworming['next_due_date']);
|
||||
$late = $due < new DateTimeImmutable('today'); ?><span
|
||||
class="badge ms-2 <?= $late ? 'bg-red-lt' : 'bg-blue-lt' ?>"><?= h(t('animal.next_date', ['date' => $due->format('d/m/Y')])) ?></span><?php endif; ?>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-vcenter mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= h(t('common.date')) ?></th>
|
||||
<th><?= h(t('animal.product')) ?></th>
|
||||
<th><?= h(t('animal.dose')) ?></th>
|
||||
<th><?= h(t('common.weight')) ?></th>
|
||||
<th><?= h(t('animal.recorded_by')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><?php foreach ($dewormings as $d): ?><tr>
|
||||
<td><?= h((new DateTimeImmutable($d['administered_on']))->format('d/m/Y')) ?></td>
|
||||
<td><?= h($d['medication_name'] ?: t('common.not_provided')) ?></td>
|
||||
<td><?= h($d['dose_text'] ?: '—') ?></td>
|
||||
<td><?= $d['weight_kg'] !== null ? h(number_format((float)$d['weight_kg'], 2, ',', ' ')) . ' kg' : '—' ?>
|
||||
</td>
|
||||
<td><?= h($d['actor_name'] ?: '—') ?></td>
|
||||
</tr><?php endforeach; ?></tbody>
|
||||
</table>
|
||||
</div><?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title m-0"><?= h(t('animal.weight_evolution')) ?></h3>
|
||||
</div>
|
||||
|
||||
<?php if (!$weights): ?>
|
||||
<div class="card-body text-muted"><?= h(t('animal.no_weight')) ?></div>
|
||||
<?php else: ?>
|
||||
<div style="height:260px">
|
||||
<canvas id="weightChart"></canvas>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<hr />
|
||||
<?php if (!$medical_notes): ?>
|
||||
<div class="text-muted"><?= h(t('animal.no_medical_note')) ?></div>
|
||||
<?php else: ?>
|
||||
<div class="divide-y">
|
||||
<?php foreach ($medical_notes as $n): ?>
|
||||
<div class="py-3">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<?php
|
||||
$kind = (string)$n['kind'];
|
||||
$badge = match ($kind) {
|
||||
'consult' => 'bg-blue-lt',
|
||||
'controle' => 'bg-green-lt',
|
||||
'symptome' => 'bg-yellow-lt',
|
||||
'diagnostic' => 'bg-purple-lt',
|
||||
'acte' => 'bg-orange-lt',
|
||||
'hosp' => 'bg-red-lt',
|
||||
default => 'bg-secondary-lt',
|
||||
};
|
||||
|
||||
$stmtPhotos = DB::pdo()->prepare('
|
||||
SELECT *
|
||||
FROM medical_photos
|
||||
WHERE medical_note_id = ?
|
||||
ORDER BY created_at ASC
|
||||
');
|
||||
$stmtPhotos->execute([(int)$n['id']]);
|
||||
$notePhotos = $stmtPhotos->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
<span class="badge <?= $badge ?>"><?= ucfirst(h($kind)) ?></span>
|
||||
|
||||
<?php if (!empty($n['reason'])): ?>
|
||||
<strong class="ms-2"><?= h($n['reason']) ?></strong>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="text-muted"><?= h($n['noted_at']) ?></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-2">
|
||||
<?php if (!empty($n['weight_kg']) || !empty($n['temperature_c'])): ?>
|
||||
<div class="text-muted">
|
||||
<?= !empty($n['weight_kg']) ? (h(t('pdf.weight')) . ': <strong>' . h($n['weight_kg']) . ' kg</strong>') : '' ?>
|
||||
<?= (!empty($n['weight_kg']) && !empty($n['temperature_c'])) ? ' • ' : '' ?>
|
||||
<?= !empty($n['temperature_c']) ? ('Temp: <strong>' . h($n['temperature_c']) . ' °C</strong>') : '' ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($n['clinic_name']) || !empty($n['vet_name'])): ?>
|
||||
<div class="text-muted">
|
||||
<?= !empty($n['clinic_name']) ? h($n['clinic_name']) : '' ?>
|
||||
<?= (!empty($n['clinic_name']) && !empty($n['vet_name'])) ? ' • ' : '' ?>
|
||||
<?= !empty($n['vet_name']) ? h($n['vet_name']) : '' ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if (!empty($n['symptoms'])): ?>
|
||||
<div><span class="text-muted"><?= h(t('animal.symptoms')) ?> :</span> <?= nl2br(h($n['symptoms'])) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($n['exam'])): ?>
|
||||
<div><span class="text-muted"><?= h(t('animal.exam')) ?> :</span> <?= nl2br(h($n['exam'])) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($n['diagnosis'])): ?>
|
||||
<div><span class="text-muted"><?= h(t('animal.diagnosis')) ?> :</span> <?= nl2br(h($n['diagnosis'])) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($n['plan'])): ?>
|
||||
<div><span class="text-muted"><?= h(t('animal.plan')) ?> :</span> <?= nl2br(h($n['plan'])) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($notePhotos)): ?>
|
||||
<div class="mt-3">
|
||||
<div class="text-muted mb-1"><?= h(t('animal.photos')) ?> :</div>
|
||||
|
||||
<div class="row row-cards">
|
||||
<?php foreach ($notePhotos as $p): ?>
|
||||
<?php
|
||||
$src = '/private-media?kind=medical&id=' . (int)$p['id'];
|
||||
?>
|
||||
<div class="col-6 col-sm-4 col-md-3 col-lg-2">
|
||||
<a href="<?= $src ?>" target="_blank" class="d-block">
|
||||
<img src="<?= $src ?>" class="img-fluid rounded border"
|
||||
style="height:140px;object-fit:cover;">
|
||||
</a>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- TRAITEMENTS -->
|
||||
<div class="tab-pane" id="tab-trt">
|
||||
<?php if (!$treatments): ?>
|
||||
<div class="text-muted"><?= h(t('animal.no_treatment')) ?></div>
|
||||
<?php else: ?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-vcenter">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= h(t('animal.status')) ?></th>
|
||||
<th><?= h(t('animal.medication')) ?></th>
|
||||
<th><?= h(t('animal.route')) ?></th>
|
||||
<th><?= h(t('animal.dosage')) ?></th>
|
||||
<th><?= h(t('animal.start')) ?></th>
|
||||
<th><?= h(t('dashboard.end')) ?></th>
|
||||
<th><?= h(t('common.notes')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($treatments as $t): ?>
|
||||
<?php
|
||||
$isFinished = !empty($t['end_date'])
|
||||
&& $t['end_date'] < date('Y-m-d');
|
||||
?>
|
||||
<tr class="<?= $isFinished ? 'table-secondary text-muted' : '' ?>">
|
||||
<td>
|
||||
<span class="badge <?= $isFinished ? 'bg-grey-lt' : 'bg-green-lt' ?>">
|
||||
<?= h(t($isFinished ? 'animal.finished' : 'animal.ongoing')) ?>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<strong><?= h($t['medication_name']) ?></strong>
|
||||
<?php if (!empty($t['molecule'])): ?>
|
||||
<div class="text-muted">
|
||||
<?= h($t['molecule']) ?><?= !empty($t['form']) ? (' • ' . h($t['form'])) : '' ?></div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?= $t['route'] ? h($t['route']) : '—' ?></td>
|
||||
<td><?= h($t['dose_text']) ?></td>
|
||||
<td><?= h($t['start_date']) ?></td>
|
||||
<td><?= $t['end_date'] ? h($t['end_date']) : '—' ?></td>
|
||||
<td><?= $t['notes'] ? h($t['notes']) : '—' ?></td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- VACCINS -->
|
||||
<div class="tab-pane" id="tab-vac">
|
||||
<?php if (!$vaccinations): ?>
|
||||
<div class="text-muted"><?= h(t('animal.no_vaccine_recorded')) ?></div>
|
||||
<?php else: ?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-vcenter">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= h(t('animal.vaccine')) ?></th>
|
||||
<th><?= h(t('animal.done_on')) ?></th>
|
||||
<th><?= h(t('animal.reminder_due')) ?></th>
|
||||
<th><?= h(t('animal.batch_traceability')) ?></th>
|
||||
<th><?= h(t('animal.administered_by')) ?></th>
|
||||
<th><?= h(t('common.notes')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($vaccinations as $v): ?>
|
||||
<tr>
|
||||
<td><strong><?= h($v['vaccine_name']) ?></strong></td>
|
||||
<td><?= h($v['done_date']) ?></td>
|
||||
<td><?= $v['due_date'] ? h($v['due_date']) : '—' ?></td>
|
||||
<td><?php if (!empty($v['manufacturer'])): ?><strong><?= h($v['manufacturer']) ?></strong><br><?php endif; ?><?= $v['lot'] ? h(t('animal.batch')) . ' ' . h($v['lot']) : '—' ?><?php if (!empty($v['batch_expires_on'])): ?>
|
||||
<div class="text-muted small">
|
||||
<?= h(t('animal.expires_on', ['date' => date('d/m/Y', strtotime((string)$v['batch_expires_on']))])) ?>
|
||||
</div><?php endif; ?></td>
|
||||
<td><?= !empty($v['administrator_name']) ? h($v['administrator_name']) : '—' ?></td>
|
||||
<td><?= $v['notes'] ? h($v['notes']) : '—' ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
1105
app/Views/_animal_show_modals.php
Normal file
1105
app/Views/_animal_show_modals.php
Normal file
File diff suppressed because it is too large
Load diff
205
app/Views/_animal_show_photos.php
Normal file
205
app/Views/_animal_show_photos.php
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
<?php
|
||||
// Sous-vue de la fiche animale ; les variables sont préparées par AnimalsController::show().
|
||||
?>
|
||||
<!-- PHOTOS -->
|
||||
<div class="tab-pane" id="tab-photos">
|
||||
<?php /** @var array $photos */ ?>
|
||||
|
||||
<?php
|
||||
$publicPhotos = array_values(array_filter($photos ?? [], fn ($p) => (int)($p['is_public'] ?? 1) === 1));
|
||||
$privatePhotos = array_values(array_filter($photos ?? [], fn ($p) => (int)($p['is_public'] ?? 1) === 0));
|
||||
?>
|
||||
|
||||
<div class="row row-cards">
|
||||
|
||||
<!-- PUBLIC -->
|
||||
<div class="col-12">
|
||||
<div class="card border-success">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<div class="d-flex align-items-baseline gap-2">
|
||||
<h3 class="card-title m-0"><?= h(t('animal.public_photos')) ?></h3>
|
||||
<div class="text-muted small">(<?= h(t('animal.visible_online')) ?>)</div>
|
||||
</div>
|
||||
|
||||
<form method="post" action="/animal/photos/upload" enctype="multipart/form-data"
|
||||
class="d-flex gap-2">
|
||||
<input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<input type="hidden" name="is_public" value="1">
|
||||
<input type="hidden" name="redirect_hash" value="#tab-photos">
|
||||
<input class="form-control form-control-sm" type="file" name="photos[]" multiple
|
||||
accept="image/*" required>
|
||||
<button class="btn btn-sm btn-success"
|
||||
type="submit"><?= h(t('animal.upload_public')) ?></button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<?php if (empty($publicPhotos)): ?>
|
||||
<div class="text-muted"><?= h(t('animal.no_public_photo')) ?></div>
|
||||
<?php else: ?>
|
||||
<div class="row row-cards">
|
||||
<?php foreach ($publicPhotos as $p): ?>
|
||||
<?php
|
||||
$src = '/media/animals/' . (int)$animal['id'] . '/' . h($p['filename']);
|
||||
$isPrimary = (int)($p['is_primary'] ?? 0) === 1;
|
||||
?>
|
||||
<div class="col-6 col-sm-4 col-md-3 col-lg-2">
|
||||
<div class="card card-sm">
|
||||
<a href="<?= $src ?>" target="_blank" class="d-block">
|
||||
<img src="<?= $src ?>" class="card-img-top" style="height:140px;object-fit:cover"
|
||||
alt="">
|
||||
</a>
|
||||
|
||||
<div class="card-body p-2">
|
||||
<?= $isPrimary
|
||||
? '<span class="badge bg-primary-lt">' . h(t('animal.primary')) . '</span>'
|
||||
: '<span class="badge bg-success-lt">' . h(t('animal.public')) . '</span>' ?>
|
||||
|
||||
<?php if ($isPrimary): ?>
|
||||
<button type="submit" class="btn btn-sm btn-icon btn-light position-absolute"
|
||||
title="<?= h(t('animal.set_primary')) ?>"
|
||||
style="border-radius:999px; top:10px;right:10px;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="18" height="18"
|
||||
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"
|
||||
fill="currentColor" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path fill="#edd180"
|
||||
d="M12 17.75l-5.878 3.09l1.122-6.545l-4.756-4.635l6.57-.955l2.942-5.955l2.942 5.955l6.57 .955l-4.756 4.635l1.122 6.545z" />
|
||||
</svg>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<form method="post" action="/animal/photos/primary" class="position-absolute"
|
||||
style="top:8px;right:8px;">
|
||||
<input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<input type="hidden" name="photo_id" value="<?= (int)$p['id'] ?>">
|
||||
<input type="hidden" name="redirect_hash" value="#tab-photos">
|
||||
<button type="submit" class="btn btn-sm btn-icon btn-light"
|
||||
title="<?= h(t('animal.set_primary')) ?>"
|
||||
style="border-radius:999px;top:-2px; right:2px;">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="18" height="18"
|
||||
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"
|
||||
fill="currentColor" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path
|
||||
d="M12 17.75l-5.878 3.09l1.122-6.545l-4.756-4.635l6.57-.955l2.942-5.955l2.942 5.955l6.57 .955l-4.756 4.635l1.122 6.545z" />
|
||||
</svg>
|
||||
</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="d-flex gap-1 mt-2">
|
||||
|
||||
<form method="post" action="/animal/photos/toggle" class="flex-fill">
|
||||
<input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<input type="hidden" name="photo_id" value="<?= (int)$p['id'] ?>">
|
||||
<input type="hidden" name="is_public" value="0">
|
||||
<input type="hidden" name="redirect_hash" value="#tab-photos">
|
||||
<button class="btn btn-sm btn-outline-warning w-100"
|
||||
type="submit"><?= h(t('animal.private')) ?></button>
|
||||
</form>
|
||||
|
||||
<form method="post" action="/animal/photos/delete"
|
||||
onsubmit="return confirm(<?= h(json_encode(t('animal.delete_photo_confirm'), JSON_HEX_APOS | JSON_HEX_QUOT)) ?>);"
|
||||
class="flex-fill">
|
||||
<input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<input type="hidden" name="photo_id" value="<?= (int)$p['id'] ?>">
|
||||
<input type="hidden" name="redirect_hash" value="#tab-photos">
|
||||
<button class="btn btn-sm btn-outline-danger w-100"
|
||||
type="submit"><?= h(t('common.delete_short')) ?></button>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PRIVE -->
|
||||
<div class="col-12">
|
||||
<div class="card border-danger">
|
||||
<div class="card-header d-flex align-items-center justify-content-between">
|
||||
<div class="d-flex align-items-baseline gap-2">
|
||||
<h3 class="card-title m-0"><?= h(t('animal.private_photos')) ?></h3>
|
||||
<div class="text-muted small">(<?= h(t('animal.not_visible_online')) ?>)</div>
|
||||
</div>
|
||||
|
||||
<form method="post" action="/animal/photos/upload" enctype="multipart/form-data"
|
||||
class="d-flex gap-2">
|
||||
<input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<input type="hidden" name="is_public" value="0">
|
||||
<input type="hidden" name="redirect_hash" value="#tab-photos">
|
||||
<input class="form-control form-control-sm" type="file" name="photos[]" multiple
|
||||
accept="image/*" required>
|
||||
<button class="btn btn-sm btn-danger"
|
||||
type="submit"><?= h(t('animal.upload_private')) ?></button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<?php if (empty($privatePhotos)): ?>
|
||||
<div class="text-muted"><?= h(t('animal.no_private_photo')) ?></div>
|
||||
<?php else: ?>
|
||||
<div class="row row-cards">
|
||||
<?php foreach ($privatePhotos as $p): ?>
|
||||
<?php $src = '/private-media?kind=photo&id=' . (int)$p['id']; ?>
|
||||
<div class="col-6 col-sm-4 col-md-3 col-lg-2">
|
||||
<div class="card card-sm bg-muted-lt">
|
||||
<a href="<?= $src ?>" target="_blank" class="d-block">
|
||||
<img src="<?= $src ?>" class="card-img-top"
|
||||
style="height:140px;object-fit:cover;filter:grayscale(20%);" alt="">
|
||||
</a>
|
||||
|
||||
<div class="card-body p-2">
|
||||
<span class="badge bg-danger-lt"><?= h(t('animal.private')) ?></span>
|
||||
<?php if (!empty($p['caption'])): ?><div class="small mt-2">
|
||||
<?= nl2br(h($p['caption'])) ?></div><?php endif; ?>
|
||||
<?php if (!empty($p['care_round_id'])): ?><div class="text-muted small mt-1">📋
|
||||
<?= h(t('animal.round_photo')) ?></div><?php endif; ?>
|
||||
|
||||
<div class="d-flex gap-1 mt-2">
|
||||
<form method="post" action="/animal/photos/toggle" class="flex-fill">
|
||||
<input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<input type="hidden" name="photo_id" value="<?= (int)$p['id'] ?>">
|
||||
<input type="hidden" name="is_public" value="1">
|
||||
<input type="hidden" name="redirect_hash" value="#tab-photos">
|
||||
<button class="btn btn-sm btn-outline-success w-100"
|
||||
type="submit"><?= h(t('animal.public')) ?></button>
|
||||
</form>
|
||||
|
||||
<form method="post" action="/animal/photos/delete"
|
||||
onsubmit="return confirm(<?= h(json_encode(t('animal.delete_photo_confirm'), JSON_HEX_APOS | JSON_HEX_QUOT)) ?>);"
|
||||
class="flex-fill">
|
||||
<input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<input type="hidden" name="photo_id" value="<?= (int)$p['id'] ?>">
|
||||
<input type="hidden" name="redirect_hash" value="#tab-photos">
|
||||
<button class="btn btn-sm btn-outline-danger w-100"
|
||||
type="submit"><?= h(t('common.delete_short')) ?></button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
67
app/Views/_deworming_modal.php
Normal file
67
app/Views/_deworming_modal.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<div class="modal modal-blur fade" id="modalDewormingCatalog" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<form class="modal-content" method="post" action="/animal/add-deworming">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><?= h(t('deworm.catalog_record')) ?></h5><button type="button" class="btn-close"
|
||||
data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body"><input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6"><label class="form-label"><?= h(t('common.date')) ?></label><input
|
||||
class="form-control" type="date" name="administered_on" value="<?= date('Y-m-d') ?>"
|
||||
required></div>
|
||||
<div class="col-md-6"><label class="form-label"><?= h(t('deworm.product')) ?></label><select
|
||||
class="form-select" name="dewormer_id">
|
||||
<option value=""><?= h(t('common.not_provided')) ?></option>
|
||||
<?php foreach (($dewormers ?? []) as $d): ?><option value="<?= (int)$d['id'] ?>">
|
||||
<?= h($d['name']) ?></option><?php endforeach; ?>
|
||||
</select></div>
|
||||
<div class="col-12"><label class="form-check"><input class="form-check-input" type="checkbox"
|
||||
name="create_dewormer" value="1" id="dewormerNewToggle"><span
|
||||
class="form-check-label"><?= h(t('deworm.add_catalog')) ?></span></label></div>
|
||||
<div class="col-12 d-none" id="dewormerNewFields">
|
||||
<div class="row g-2">
|
||||
<div class="col-md-5"><input class="form-control" name="new_dewormer_name"
|
||||
placeholder="<?= h(t('deworm.name')) ?>"></div>
|
||||
<div class="col-md-4"><input class="form-control" name="new_dewormer_ingredient"
|
||||
placeholder="<?= h(t('deworm.ingredient')) ?>"></div>
|
||||
<div class="col-md-3"><input class="form-control" name="new_dewormer_form"
|
||||
placeholder="<?= h(t('deworm.form')) ?>"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6"><label class="form-label"><?= h(t('animal.dose')) ?></label><input
|
||||
class="form-control" name="dose_text" placeholder="<?= h(t('deworm.dose_example')) ?>">
|
||||
</div>
|
||||
<div class="col-md-6"><label class="form-label"><?= h(t('common.weight')) ?></label>
|
||||
<div class="input-group"><input class="form-control" type="number" min="0" step="0.01"
|
||||
name="weight_kg"><span class="input-group-text">kg</span></div>
|
||||
</div>
|
||||
<div class="col-12"><label class="form-label"><?= h(t('deworm.next_due')) ?> <span
|
||||
class="text-muted"><?= h(t('common.optional_parentheses')) ?></span></label><input
|
||||
class="form-control" type="date" name="next_due_date">
|
||||
<div class="form-hint"><?= h(t('deworm.auto_age')) ?></div>
|
||||
</div>
|
||||
<?php if (!empty($litters)): ?><div class="col-12"><label class="form-check"><input
|
||||
class="form-check-input" type="checkbox" name="apply_litter" value="1"><span
|
||||
class="form-check-label"><?= h(t('deworm.apply_litter')) ?></span></label></div>
|
||||
<?php endif; ?>
|
||||
<div class="col-12"><label class="form-label"><?= h(t('animal.comment')) ?></label><textarea
|
||||
class="form-control" name="notes" rows="2"></textarea></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer"><button class="btn me-auto" type="button"
|
||||
data-bs-dismiss="modal"><?= h(t('common.cancel')) ?></button><button
|
||||
class="btn btn-primary"><?= h(t('common.save')) ?></button></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('[data-bs-target="#modalDeworming"]').forEach(b => b.setAttribute(
|
||||
'data-bs-target', '#modalDewormingCatalog'));
|
||||
const t = document.getElementById('dewormerNewToggle'),
|
||||
p = document.getElementById('dewormerNewFields');
|
||||
t?.addEventListener('change', () => p?.classList.toggle('d-none', !t.checked));
|
||||
});
|
||||
|
||||
</script>
|
||||
29
app/Views/_directory_medical_fields.php
Normal file
29
app/Views/_directory_medical_fields.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php $directoryFieldId = $directoryFieldId ?? uniqid('medical_', false); ?>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label"><?= h(t('animal.veterinary_clinic')) ?></label>
|
||||
<select class="form-select directory-contact-select medical-clinic-select" name="clinic_contact_id"
|
||||
data-pair="<?= h($directoryFieldId) ?>" data-new-target="<?= h($directoryFieldId) ?>ClinicNew" required>
|
||||
<option value="">— <?= h(t('common.choose')) ?> —</option>
|
||||
<?php foreach ($directoryClinics as $contact): ?><option value="<?= (int)$contact['id'] ?>">
|
||||
<?= h($contact['name']) ?></option><?php endforeach; ?>
|
||||
<option value="new">+ <?= h(t('animal.create_clinic')) ?></option>
|
||||
</select>
|
||||
<input class="form-control mt-2 d-none" id="<?= h($directoryFieldId) ?>ClinicNew" name="new_clinic_name"
|
||||
placeholder="<?= h(t('animal.new_clinic_name')) ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label"><?= h(t('animal.form.veterinarian')) ?></label>
|
||||
<select class="form-select directory-contact-select medical-vet-select" name="vet_contact_id"
|
||||
data-pair="<?= h($directoryFieldId) ?>" data-new-target="<?= h($directoryFieldId) ?>VetNew" required>
|
||||
<option value="">— <?= h(t('common.choose')) ?> —</option>
|
||||
<?php foreach ($veterinarians as $contact): ?><option value="<?= (int)$contact['id'] ?>"
|
||||
data-organization="<?= (int)($contact['organization_id'] ?? 0) ?>"><?= h($contact['name']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
<option value="new">+ <?= h(t('animal.create_vet')) ?></option>
|
||||
</select>
|
||||
<input class="form-control mt-2 d-none" id="<?= h($directoryFieldId) ?>VetNew" name="new_vet_name"
|
||||
placeholder="<?= h(t('animal.new_vet_name')) ?>">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="form-hint"><?= h(t('animal.medical_pair_hint')) ?></div>
|
||||
</div>
|
||||
63
app/Views/_expense_modal.php
Normal file
63
app/Views/_expense_modal.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php if ($canViewMedical): ?>
|
||||
<div class="modal modal-blur fade" id="modalExpense" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
<form class="modal-content" method="post" action="/animal/add-expense">
|
||||
<div class="modal-header">
|
||||
<div>
|
||||
<h5 class="modal-title"><?= h(t('expense.add')) ?></h5>
|
||||
<div class="text-muted small"><?= h(t('expense.history_help')) ?></div>
|
||||
</div><button class="btn-close" type="button" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body"><input type="hidden" name="animal_id" value="<?= (int)$animal['id'] ?>">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-8"><label
|
||||
class="form-label required"><?= h(t('expense.act_product')) ?></label><select
|
||||
class="form-select" name="tariff_id" id="expenseTariff" required>
|
||||
<option value="">— <?= h(t('expense.choose')) ?> —</option><?php $lastClinic = '';
|
||||
foreach ($expenseTariffs as $t):if ($lastClinic !== $t['clinic_name']):if ($lastClinic !== ''):?></optgroup><?php endif;
|
||||
$lastClinic = $t['clinic_name'];?><optgroup label="<?= h($lastClinic) ?>"><?php endif;?><option
|
||||
value="<?= (int)$t['id'] ?>" data-price="<?= (int)$t['effective_cents'] ?>"
|
||||
data-discount="<?= h((string)$t['discount_percent']) ?>"><?= h($t['label']) ?> ·
|
||||
<?= number_format($t['effective_cents'] / 100, 2, ',', ' ') ?> €</option><?php endforeach;
|
||||
if ($lastClinic !== ''):?></optgroup><?php endif;?>
|
||||
</select>
|
||||
<div class="form-hint" id="expenseHint"><?= h(t('expense.price_after_discount')) ?></div>
|
||||
</div>
|
||||
<div class="col-md-4"><label class="form-label"><?= h(t('common.date')) ?></label><input
|
||||
class="form-control" type="date" name="occurred_on" value="<?= date('Y-m-d') ?>" required>
|
||||
</div>
|
||||
<div class="col-md-4"><label class="form-label"><?= h(t('expense.quantity')) ?></label><input
|
||||
class="form-control" type="number" min="0.01" step="0.01" name="quantity" value="1"
|
||||
required></div>
|
||||
<div class="col-md-8"><label class="form-label"><?= h(t('expense.comment')) ?></label><input
|
||||
class="form-control" name="notes" placeholder="<?= h(t('expense.comment_placeholder')) ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer"><button class="btn me-auto" type="button"
|
||||
data-bs-dismiss="modal"><?= h(t('common.cancel')) ?></button><button
|
||||
class="btn btn-primary"><?= h(t('expense.save')) ?></button></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const s = document.getElementById('expenseTariff'),
|
||||
h = document.getElementById('expenseHint'),
|
||||
template = < ? = json_encode(t('expense.unit_estimate'), JSON_UNESCAPED_UNICODE |
|
||||
JSON_UNESCAPED_SLASHES) ? > ,
|
||||
empty = < ? = json_encode(t('expense.price_after_discount'), JSON_UNESCAPED_UNICODE |
|
||||
JSON_UNESCAPED_SLASHES) ? > ;
|
||||
s?.addEventListener('change', () => {
|
||||
const o = s.selectedOptions[0],
|
||||
price = (Number(o?.dataset.price || 0) / 100).toLocaleString( < ? = json_encode(I18n::
|
||||
locale() === 'fr' ? 'fr-FR' : 'en-GB') ? > , {
|
||||
minimumFractionDigits: 2
|
||||
});
|
||||
h.textContent = o?.value ? template.replace(':price', price).replace(':discount', o.dataset
|
||||
.discount) : empty;
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
37
app/Views/_expense_summary.php
Normal file
37
app/Views/_expense_summary.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php if ($canViewMedical): ?>
|
||||
<div class="card mt-3">
|
||||
<div class="card-body d-flex flex-wrap align-items-center gap-3">
|
||||
<?php $expenseCount = count($expenses ?? []); ?><div class="me-auto">
|
||||
<div class="subheader"><?= h(t('expense.estimated_vet')) ?></div>
|
||||
<div class="text-muted small"><?= h(t('expense.recorded', ['count' => $expenseCount])) ?></div>
|
||||
</div>
|
||||
<div class="h2 mb-0"><?= number_format(($expenseTotal ?? 0) / 100, 2, ',', ' ') ?> €</div>
|
||||
<?php if (!empty($expenses)): ?><button class="btn btn-sm btn-outline-secondary" type="button"
|
||||
data-bs-toggle="collapse" data-bs-target="#animalExpenseDetails"
|
||||
aria-expanded="false"><?= h(t('expense.details')) ?></button><?php endif; ?>
|
||||
</div>
|
||||
<?php if (!empty($expenses)): ?><div class="collapse" id="animalExpenseDetails">
|
||||
<div class="table-responsive border-top">
|
||||
<table class="table table-sm table-vcenter mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= h(t('common.date')) ?></th>
|
||||
<th><?= h(t('expense.expense')) ?></th>
|
||||
<th><?= h(t('pricing.structure')) ?></th>
|
||||
<th><?= h(t('pricing.discount')) ?></th>
|
||||
<th class="text-end"><?= h(t('expense.total')) ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><?php foreach ($expenses as $e): ?><tr>
|
||||
<td><?= h(date('d/m/Y', strtotime($e['occurred_on']))) ?></td>
|
||||
<td><?= h($e['label']) ?><?php if ((float)$e['quantity'] !== 1.0): ?><span
|
||||
class="text-muted small"> × <?= h((string)$e['quantity']) ?></span><?php endif; ?></td>
|
||||
<td><?= h($e['clinic_name'] ?: '—') ?></td>
|
||||
<td><?= number_format((float)$e['discount_percent'], 2, ',', ' ') ?> %</td>
|
||||
<td class="text-end fw-bold"><?= number_format($e['total_cents'] / 100, 2, ',', ' ') ?> €</td>
|
||||
</tr><?php endforeach; ?></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
15
app/Views/_expense_tariff_field.php
Normal file
15
app/Views/_expense_tariff_field.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<div class="col-12"><label class="form-label"><?= h(t('animal.tariff_record')) ?> <span
|
||||
class="text-muted">(<?= h(mb_strtolower(t('common.optional'))) ?>)</span></label><select class="form-select"
|
||||
name="tariff_id">
|
||||
<option value=""><?= h(t('animal.no_expense')) ?></option><?php $expenseClinic = '';
|
||||
foreach (($expenseTariffs ?? []) as $t):if ($expenseClinic !== $t['clinic_name']):if ($expenseClinic !== ''):?>
|
||||
</optgroup><?php endif;
|
||||
$expenseClinic = $t['clinic_name'];?><optgroup label="<?= h($expenseClinic) ?>"><?php endif;?><option
|
||||
value="<?= (int)$t['id'] ?>"><?= h($t['label']) ?> ·
|
||||
<?= number_format($t['effective_cents'] / 100, 2, ',', ' ') ?> €
|
||||
<?= h(t('animal.net')) ?><?= (float)$t['discount_percent'] > 0 ? ' (−' . number_format((float)$t['discount_percent'], 0) . ' %)' : '' ?>
|
||||
</option><?php endforeach;
|
||||
if ($expenseClinic !== ''):?></optgroup><?php endif;?>
|
||||
</select>
|
||||
<div class="form-hint"><?= h(t('animal.expense_hint')) ?></div>
|
||||
</div>
|
||||
99
app/Views/_helpers.php
Normal file
99
app/Views/_helpers.php
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
|
||||
// app/Views/_helpers.php
|
||||
|
||||
if (!function_exists('h')) {
|
||||
function h($s): string
|
||||
{
|
||||
return htmlspecialchars((string)$s, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
|
||||
}
|
||||
}
|
||||
|
||||
function app_version(): string
|
||||
{
|
||||
static $version = null;
|
||||
if ($version !== null) {
|
||||
return $version;
|
||||
}
|
||||
$path = dirname(__DIR__, 2) . '/VERSION';
|
||||
$value = is_file($path) ? trim((string) file_get_contents($path)) : '';
|
||||
return $version = ($value !== '' ? $value : 'développement');
|
||||
}
|
||||
|
||||
function status_badge(string $st): array
|
||||
{
|
||||
$st = strtolower(trim($st));
|
||||
return match ($st) {
|
||||
'refuge' => ['bg-blue-lt',t('status.refuge')],
|
||||
'fa' => ['bg-cyan-lt',t('status.fa')],
|
||||
'fa_permanente' => ['bg-indigo-lt',t('status.fa_permanente')],
|
||||
'chat_libre' => ['bg-green-lt text-green','🌿 ' . t('status.chat_libre')],
|
||||
'quarantaine' => ['bg-yellow-lt',t('status.quarantaine')],
|
||||
'soin' => ['bg-red-lt',t('status.soin')],
|
||||
'isolation' => ['bg-orange-lt',t('status.isolation')],
|
||||
'hospitalise','hospitalisé' => ['bg-red-lt',t('status.hospitalise')],
|
||||
'reserve','réservé' => ['bg-purple-lt',t('status.reserve')],
|
||||
'adopte','adopté' => ['bg-green-lt',t('status.adopte')],
|
||||
'decede','décédé' => ['bg-dark-lt',t('status.decede')],
|
||||
'enfui' => ['bg-secondary-lt',t('status.enfui')],
|
||||
default => ['bg-secondary-lt', $st !== '' ? $st : '—'],
|
||||
};
|
||||
}
|
||||
|
||||
function species_label(?string $species): string
|
||||
{
|
||||
if (class_exists('SpeciesService')) {
|
||||
return SpeciesService::label($species);
|
||||
}
|
||||
return match (strtolower(trim((string)$species))) {
|
||||
'cat', 'chat' => t('species.cat'),
|
||||
'dog', 'chien' => t('species.dog'),
|
||||
'nac' => 'NAC',
|
||||
'' => '—',
|
||||
default => ucfirst(trim((string)$species)),
|
||||
};
|
||||
}
|
||||
|
||||
function coat_swatch_style(?string $coat): string
|
||||
{
|
||||
return match (mb_strtolower(trim((string)$coat), 'UTF-8')) {
|
||||
'bicolore noir / blanc' => 'background:linear-gradient(135deg,#252525 0 50%,#fff 50% 100%)',
|
||||
'bicolore gris / blanc' => 'background:linear-gradient(135deg,#8b95a1 0 50%,#fff 50% 100%)',
|
||||
'bicolore roux / blanc' => 'background:linear-gradient(135deg,#d9822b 0 50%,#fff 50% 100%)',
|
||||
'bicolore tigré et blanc' => 'background:linear-gradient(90deg,transparent 0 55%,#fff 55% 100%),repeating-linear-gradient(135deg,#8a6848 0 5px,#3f3328 5px 8px)',
|
||||
'gris' => 'background:#8b95a1',
|
||||
'roux' => 'background:#d9822b',
|
||||
'noir' => 'background:#252525',
|
||||
'chocolat' => 'background:#6f4e37',
|
||||
'blanc' => 'background:#fff',
|
||||
'tricolore / calico' => 'background:conic-gradient(#252525 0 33%,#fff 33% 66%,#d9822b 66% 100%)',
|
||||
'écaille de tortue' => 'background:conic-gradient(#2d241f 0 28%,#b86326 28% 48%,#171513 48% 72%,#d18a45 72% 100%)',
|
||||
'colourpoint / siamois' => 'background:radial-gradient(circle at center,#f2dfbb 0 48%,#654b3c 52% 100%)',
|
||||
'tigré / tabby' => 'background:repeating-linear-gradient(135deg,#8a6848 0 5px,#3f3328 5px 8px)',
|
||||
default => 'background:#d9dde3',
|
||||
};
|
||||
}
|
||||
|
||||
function sort_th(string $label, string $key, string $sort, string $dir, string $path = '/animals'): string
|
||||
{
|
||||
$nextDir = ($sort === $key && strtoupper($dir) === 'ASC') ? 'desc' : 'asc';
|
||||
$arrow = ($sort === $key) ? (strtoupper($dir) === 'ASC' ? ' ↑' : ' ↓') : '';
|
||||
$qs = $_GET;
|
||||
$qs['sort'] = $key;
|
||||
$qs['dir'] = $nextDir;
|
||||
$href = $path . '?' . http_build_query($qs);
|
||||
return '<a class="text-reset text-decoration-none" href="' . htmlspecialchars($href, ENT_QUOTES) . '">' . $label . $arrow . '</a>';
|
||||
|
||||
}
|
||||
|
||||
function sortLink($column, $label, $sort, $dir, $year, $q, $species)
|
||||
{
|
||||
$newDir = ($sort === $column && $dir === 'ASC') ? 'desc' : 'asc';
|
||||
|
||||
$arrow = '';
|
||||
if ($sort === $column) {
|
||||
$arrow = $dir === 'ASC' ? ' ↑' : ' ↓';
|
||||
}
|
||||
|
||||
return '<a href="?year=' . $year . '&q=' . urlencode($q) . '&species=' . urlencode($species) . '&sort=' . $column . '&dir=' . $newDir . '">' . $label . $arrow . '</a>';
|
||||
}
|
||||
35
app/Views/_layout_footer.php
Normal file
35
app/Views/_layout_footer.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
/** Pied de page commun. */
|
||||
?>
|
||||
<footer class="globinours-footer d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="footer-surface d-flex flex-wrap align-items-center justify-content-between gap-3">
|
||||
<div>
|
||||
<div class="fw-bold">Globinours</div>
|
||||
<div class="text-muted small"><?= h(t('footer.description')) ?></div>
|
||||
</div>
|
||||
<div class="footer-meta d-flex flex-wrap align-items-center gap-3"><span
|
||||
class="d-inline-flex align-items-center gap-1"><span role="img"
|
||||
aria-label="<?= h(t('footer.brewed_label')) ?>">🧪 <?= h(t('footer.brewed')) ?></span>
|
||||
<?= t('footer.by_brittany', ['developer' => '<a href="https://oversu.fr" target="_blank" rel="noopener noreferrer" class="text-reset fw-semibold">OverSu</a>']) ?>
|
||||
<span class="breton-flag" role="img" aria-label="<?= h(t('footer.breton_flag')) ?>"
|
||||
title="Gwen ha Du"></span></span><span class="badge footer-version">Version
|
||||
<?= h(app_version()) ?></span><a class="footer-source" href="/evolutions"
|
||||
title="<?= h(t('footer.evolutions_title')) ?>">🧭
|
||||
<span><?= h(t('footer.evolutions')) ?></span></a><a class="footer-source"
|
||||
href="https://nnsprod.com/git/oversu/Globinours" target="_blank" rel="noopener noreferrer"
|
||||
title="<?= h(t('footer.source_title')) ?>" aria-label="<?= h(t('footer.source_title')) ?>"><svg
|
||||
xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" fill="none"
|
||||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
||||
aria-hidden="true">
|
||||
<circle cx="6" cy="6" r="2" />
|
||||
<circle cx="18" cy="6" r="2" />
|
||||
<circle cx="6" cy="18" r="2" />
|
||||
<path d="M6 8v8" />
|
||||
<path d="M8 6h8" />
|
||||
<path d="M18 8a6 6 0 0 1 -6 6h-4" />
|
||||
</svg><span><?= h(t('footer.source')) ?></span></a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paw-footer" aria-hidden="true"></div>
|
||||
</footer>
|
||||
152
app/Views/_layout_topbar.php
Normal file
152
app/Views/_layout_topbar.php
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
<?php
|
||||
/** Barre de navigation et recherche globale. */
|
||||
?>
|
||||
<header class="navbar navbar-expand-md d-print-none">
|
||||
<div class="container-xl">
|
||||
<div class="topbar-surface d-flex align-items-center justify-content-between w-100">
|
||||
<a class="navbar-brand d-flex flex-row align-items-center py-0"
|
||||
href="<?= h(PermissionService::can('dashboard') ? '/dashboard' : PermissionService::firstAllowedPath()) ?>">
|
||||
<img src="/assets/logo-globinours-64.png" width="52" height="54" alt="" class="flex-shrink-0"
|
||||
style="margin-right:10px">
|
||||
<span class="d-flex flex-column align-items-start">
|
||||
<span class="fw-bold">Globinours</span>
|
||||
<span class="text-muted fw-normal" style="font-size:.72rem; line-height:1.2; letter-spacing:0;">
|
||||
<?= h(t('footer.tagline')) ?>
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<div class="navbar-nav flex-row order-md-last">
|
||||
<span class="search-trigger-wrap"><button class="search-trigger" type="button" data-bs-toggle="modal"
|
||||
data-bs-target="#globalSearchModal"
|
||||
title="<?= h(t('search.open')) ?> — <?= h(t('search.shortcut')) ?>"
|
||||
aria-label="<?= h(t('search.open')) ?> (<?= h(t('search.shortcut')) ?>)"><svg
|
||||
xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24"
|
||||
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
|
||||
stroke-linejoin="round" aria-hidden="true">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<circle cx="10" cy="10" r="7" />
|
||||
<path d="M21 21l-6 -6" />
|
||||
</svg></button></span>
|
||||
<!-- Dashboard -->
|
||||
<?php if (PermissionService::can('dashboard')): ?>
|
||||
<a class="btn <?= $dashboardActive ? 'btn-teal' : 'btn-outline-teal' ?> btn-sm me-2" href="/dashboard">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-1" width="18" height="18" viewBox="0 0 24 24"
|
||||
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
|
||||
stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M4 4h6v8h-6z" />
|
||||
<path d="M4 16h6v4h-6z" />
|
||||
<path d="M14 12h6v8h-6z" />
|
||||
<path d="M14 4h6v6h-6z" />
|
||||
</svg>
|
||||
<?= h(t('nav.dashboard')) ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Animaux -->
|
||||
<?php if (PermissionService::can('animals')): ?>
|
||||
<a class="btn <?= $animalsActive ? 'btn-primary' : 'btn-outline-primary' ?> btn-sm me-2"
|
||||
href="/animals">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon me-1" width="18" height="18" viewBox="0 0 24 24"
|
||||
stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
|
||||
stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M4.5 9.5a2.5 2.5 0 1 0 0 -5a2.5 2.5 0 0 0 0 5z" />
|
||||
<path d="M9 5.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 0 0 -5 0z" />
|
||||
<path d="M17 9.5a2.5 2.5 0 1 0 0 -5a2.5 2.5 0 0 0 0 5z" />
|
||||
<path
|
||||
d="M7 15.5c0 -2.5 2.2 -4.5 5 -4.5s5 2 5 4.5c0 2 -1.3 4 -3.5 4c-.8 0 -1.1 -.5 -1.5 -.5s-.7 .5 -1.5 .5c-2.2 0 -3.5 -2 -3.5 -4z" />
|
||||
</svg>
|
||||
<?= h(t('nav.animals')) ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Administratif -->
|
||||
<?php if (PermissionService::can('directory')): ?>
|
||||
<a class="btn <?= $directoryActive ? 'btn-purple' : 'btn-outline-purple' ?> btn-sm me-2"
|
||||
href="/directory">👥 <?= h(t('nav.directory')) ?></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Tournée de soins -->
|
||||
<?php if (PermissionService::can('care')): ?>
|
||||
<a class="btn <?= $careRoundActive ? 'btn-orange' : 'btn-outline-orange' ?> btn-sm me-2"
|
||||
href="/care-round">🩺 <?= h(t('nav.care_round')) ?></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Agenda -->
|
||||
<?php if (PermissionService::can('agenda')): ?><a
|
||||
class="btn <?= $agendaActive ? 'btn-pink' : 'btn-outline-pink' ?> btn-sm me-2" href="/agenda">📅
|
||||
<?= h(t('nav.agenda')) ?></a><?php endif; ?>
|
||||
|
||||
<!-- Statistiques -->
|
||||
<?php if (PermissionService::can('statistics')): ?>
|
||||
<a class="btn <?= $statisticsActive ? 'btn-cyan' : 'btn-outline-cyan' ?> btn-sm me-2" href="/statistics"
|
||||
title="<?= h(t('nav.statistics')) ?>">📊 <?= h(t('nav.statistics')) ?></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (PermissionService::can('accounting')): ?><a
|
||||
class="btn <?= $accountingActive ? 'btn-teal' : 'btn-outline-teal' ?> btn-sm me-2"
|
||||
href="/accounting?year=0">🧾 Comptabilité</a><?php endif; ?>
|
||||
|
||||
<div class="dropdown settings-dropdown"><button class="btn btn-dark btn-sm me-2 settings-trigger"
|
||||
data-bs-toggle="dropdown" aria-expanded="false" title="<?= h(t('account.settings')) ?>"
|
||||
aria-label="<?= h(t('account.settings')) ?>"><svg xmlns="http://www.w3.org/2000/svg"
|
||||
class="icon m-0" width="22" height="22" viewBox="0 0 24 24" stroke-width="2"
|
||||
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M12 15.5a3.5 3.5 0 1 0 0 -7a3.5 3.5 0 0 0 0 7z" />
|
||||
<path
|
||||
d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06 .06a2 2 0 1 1 -2.83 2.83l-.06 -.06a1.65 1.65 0 0 0 -1.82 -.33a1.65 1.65 0 0 0 -1 1.51v.17a2 2 0 1 1 -4 0v-.09a1.65 1.65 0 0 0 -1.08 -1.51a1.65 1.65 0 0 0 -1.82 .33l-.06 .06a2 2 0 1 1 -2.83 -2.83l.06 -.06a1.65 1.65 0 0 0 .33 -1.82a1.65 1.65 0 0 0 -1.51 -1h-.17a2 2 0 1 1 0 -4h.09a1.65 1.65 0 0 0 1.51 -1.08a1.65 1.65 0 0 0 -.33 -1.82l-.06 -.06a2 2 0 1 1 2.83 -2.83l.06 .06a1.65 1.65 0 0 0 1.82 .33h.08a1.65 1.65 0 0 0 1 -1.51v-.17a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51a1.65 1.65 0 0 0 1.82 -.33l.06 -.06a2 2 0 1 1 2.83 2.83l-.06 .06a1.65 1.65 0 0 0 -.33 1.82v.08a1.65 1.65 0 0 0 1.51 1h.17a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0 -1.51 1z" />
|
||||
</svg></button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<div class="dropdown-item-text">
|
||||
<div class="fw-bold">👤 <?= h($currentUser['display_name'] ?: $currentUser['username']) ?>
|
||||
</div>
|
||||
<div class="small text-muted"><?= h(ucfirst((string)$currentUser['role'])) ?></div>
|
||||
</div>
|
||||
<div class="dropdown-divider"></div><?php if (PermissionService::can('administrative')):?><a
|
||||
class="dropdown-item" href="/admin/register">📁
|
||||
<?= h(t('nav.administrative')) ?></a><?php endif;?><?php if (PermissionService::can('grants')):?><a
|
||||
class="dropdown-item" href="/admin/grants">📊
|
||||
<?= h(t('nav.grants')) ?></a><?php endif;?><?php if (PermissionService::can('administrative') || PermissionService::can('grants')):?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php endif;?><?php if (Auth::is('admin')): ?><?php $lastSettingsGroup = null;
|
||||
foreach ($settingsMenuLinks as [$settingsHref,$settingsIcon,$settingsLabel,$settingsGroup]): if ($settingsGroup !== $lastSettingsGroup): if ($lastSettingsGroup !== null): ?>
|
||||
<div class="dropdown-divider"></div><?php endif; ?><div class="dropdown-header">
|
||||
<?= h(settingsGroupLabel($settingsGroup)) ?></div>
|
||||
<?php $lastSettingsGroup = $settingsGroup;endif; ?><a class="dropdown-item"
|
||||
href="<?= h($settingsHref) ?>"><?= $settingsIcon ?>
|
||||
<?= h($settingsLabel) ?></a><?php endforeach; ?><div class="dropdown-divider"></div>
|
||||
<?php endif; ?><form method="post" action="/logout"><input type="hidden" name="csrf"
|
||||
value="<?= h(Auth::csrf()) ?>"><button class="dropdown-item text-danger" type="submit">↪
|
||||
<?= h(t('account.logout')) ?></button></form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div class="modal modal-blur fade" id="globalSearchModal" tabindex="-1" aria-hidden="true"
|
||||
data-hint="<?= h(t('search.hint')) ?>" data-loading="<?= h(t('search.loading')) ?>"
|
||||
data-none="<?= h(t('search.none')) ?>" data-error="<?= h(t('search.error')) ?>"
|
||||
data-all-results="<?= h(t('search.all_results')) ?>"
|
||||
data-groups="<?= h(json_encode(['animals' => t('search.group.animals'),'directory' => t('search.group.directory'),'agenda' => t('search.group.agenda'),'accounting' => t('search.group.accounting')], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)) ?>">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-title"><?= h(t('search.title')) ?></h2><button type="button" class="btn-close"
|
||||
data-bs-dismiss="modal" aria-label="<?= h(t('common.close')) ?>"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="input-group input-group-lg mb-3"><span class="input-group-text">⌕</span><input
|
||||
class="form-control" id="globalSearchInput" maxlength="120" autocomplete="off"
|
||||
placeholder="<?= h(t('search.placeholder')) ?>"></div>
|
||||
<div id="globalSearchResults" class="list-group">
|
||||
<div class="text-muted text-center py-4"><?= h(t('search.hint')) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
14
app/Views/_public_animal_cards.php
Normal file
14
app/Views/_public_animal_cards.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php if (!$animals): ?><div class="empty"><?= h(t('public_site.no_animals')) ?></div><?php else: ?><div class="grid">
|
||||
<?php foreach ($animals as $a): ?><a class="animal-card"
|
||||
href="<?= h($siteUrl('animal', ['id' => (int)$a['id']])) ?>"><?php if ($a['primary_photo']): ?><img
|
||||
loading="lazy" src="/media/animals/<?= (int)$a['id'] ?>/<?= h(rawurlencode($a['primary_photo'])) ?>"
|
||||
alt="<?= h($a['name']) ?>"><?php else: ?><div class="photo-placeholder"><?= h($a['species_icon'] ?: '🐾') ?>
|
||||
</div><?php endif; ?><div class="animal-card-body">
|
||||
<h3><?= h($a['name']) ?></h3>
|
||||
<div class="meta">
|
||||
<?= h(($a['species_name'] ?: SpeciesService::label($a['species'])) . ' · ' . public_age($a)) ?></div>
|
||||
<div class="chips"><?php if ($a['sex'] === 'F'): ?><span class="chip">♀
|
||||
<?= h(t('sex.female')) ?></span><?php elseif ($a['sex'] === 'M'): ?><span class="chip">♂
|
||||
<?= h(t('sex.male')) ?></span><?php endif; ?><?php if ($a['sterilization_status'] === 'yes'): ?><span
|
||||
class="chip">✓ <?= h(t('public_site.sterilized')) ?></span><?php endif; ?></div>
|
||||
</div></a><?php endforeach; ?></div><?php endif; ?>
|
||||
31
app/Views/_settings_links.php
Normal file
31
app/Views/_settings_links.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
if (!function_exists('settingsNavigationLinks')) {
|
||||
function settingsGroupLabel(string$group): string
|
||||
{
|
||||
return match($group) {
|
||||
'general' => t('settings.group_general'),'business' => t('settings.group_business'),'access' => t('settings.group_access'),'maintenance' => t('settings.group_maintenance'),default => $group
|
||||
};
|
||||
}
|
||||
function settingsNavigationLinks(): array
|
||||
{
|
||||
return [
|
||||
'general' => ['/settings/general','⚙️',t('settings.general'),'general'],
|
||||
'public-site' => ['/settings/public-site','🌐',t('settings.public_site'),'general'],
|
||||
'species' => ['/settings/species','🐾',t('settings.species'),'business'],
|
||||
'rooms' => ['/settings/rooms','🚪',t('settings.rooms'),'business'],
|
||||
'pricing' => ['/settings/pricing','💶',t('settings.pricing'),'business'],
|
||||
'inventory' => ['/settings/inventory','💊',t('settings.inventory'),'business'],
|
||||
'lab-references' => ['/settings/lab-references','🩸',t('settings.lab_references'),'business'],
|
||||
'users' => ['/settings/users','👥',t('settings.users'),'access'],
|
||||
'permissions' => ['/settings/permissions','🔐',t('settings.permissions'),'access'],
|
||||
'privacy' => ['/settings/privacy','🔏',t('settings.privacy'),'access'],
|
||||
'backups' => ['/settings/backups','💾',t('settings.backups'),'maintenance'],
|
||||
'health' => ['/settings/health','🩺',t('settings.health'),'maintenance'],
|
||||
'notifications' => ['/settings/notifications','🔔',t('settings.notifications'),'maintenance'],
|
||||
'data' => ['/settings/data','🧪',t('settings.data'),'maintenance'],
|
||||
'asm3' => ['/settings/asm3','🚚',t('settings.asm3'),'maintenance'],
|
||||
'audit' => ['/settings/audit','📜',t('settings.audit'),'maintenance'],
|
||||
];
|
||||
}
|
||||
}
|
||||
21
app/Views/access_denied.php
Normal file
21
app/Views/access_denied.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php $editing = ($deniedAction ?? 'view') === 'edit';
|
||||
$module = $deniedModule ?? t('access.requested'); ?>
|
||||
<div class="row justify-content-center py-5">
|
||||
<div class="col-md-8 col-lg-6">
|
||||
<div class="card text-center overflow-hidden">
|
||||
<div class="card-status-top bg-orange"></div>
|
||||
<div class="card-body p-5">
|
||||
<div class="display-3 mb-3">🔒</div>
|
||||
<div class="text-uppercase text-muted fw-bold small mb-2"><?= h(t('access.denied')) ?></div>
|
||||
<h2 class="mb-3"><?= h(t($editing ? 'access.edit_denied' : 'access.page_denied')) ?></h2>
|
||||
<p class="text-muted mb-4">
|
||||
<?= h(t($editing ? 'access.explanation_edit' : 'access.explanation_view', ['module' => $module])) ?>
|
||||
</p>
|
||||
<div class="d-flex flex-wrap justify-content-center gap-2"><a class="btn btn-primary"
|
||||
href="<?= h(PermissionService::firstAllowedPath()) ?>"><?= h(t('access.back_space')) ?></a><button
|
||||
class="btn btn-outline-secondary" type="button"
|
||||
onclick="history.back()"><?= h(t('access.previous')) ?></button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue