fix event issues

This commit is contained in:
root
2026-04-19 12:05:10 -04:00
parent 35988e9ce1
commit 596d368b1d
7 changed files with 239 additions and 29 deletions
+50 -8
View File
@@ -24,6 +24,7 @@
</div>
<?php else: ?>
<?php foreach ($activeEvents as $event): ?>
<?php $externalParticipants = $externalParticipantsByEvent[$event['id']] ?? []; ?>
<div class="card mb-4">
<div class="card-body">
@@ -42,6 +43,53 @@
<?php endif; ?>
</div>
<div class="mb-3">
<h6 class="mb-1">Description</h6>
<?php if (!empty($event['description'])): ?>
<div class="mb-0"><?= $event['description'] ?></div>
<?php else: ?>
<p class="mb-0">No description</p>
<?php endif; ?>
</div>
<?php if (!empty($externalParticipants)): ?>
<div class="mb-3">
<h6 class="mb-2">External Participants</h6>
<div class="table-responsive">
<table class="table table-sm table-bordered mb-0">
<thead class="table-light">
<tr>
<th>Student Name</th>
<th>Status</th>
<th>Fee</th>
</tr>
</thead>
<tbody>
<?php foreach ($externalParticipants as $participant): ?>
<?php
$isPaid = !empty($participant['event_paid']) || ((float) ($participant['charged'] ?? 0) <= 0);
?>
<tr>
<td>
<?= esc($participant['name']) ?> <span class="text-muted">(external)</span>
<?php if (!empty($participant['note'])): ?>
<small class="text-muted d-block"><?= esc($participant['note']) ?></small>
<?php endif; ?>
</td>
<td>
<span class="badge bg-<?= $isPaid ? 'success' : 'danger' ?>">
<?= $isPaid ? 'Paid' : 'Unpaid' ?>
</span>
</td>
<td class="text-nowrap">$<?= esc(number_format((float) ($participant['charged'] ?? 0), 2)) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php endif; ?>
<!-- Participation Table -->
<form method="post" action="<?= site_url('parent/updateParticipation') ?>">
<?= csrf_field() ?>
@@ -51,11 +99,8 @@
<table class="table table-sm table-bordered">
<thead class="table-light">
<tr>
<th>Student First Name</th>
<th>Student Last Name</th>
<th>Student Name</th>
<th class="text-center">Participate</th>
<th>Description</th>
<th>Event Fees</th>
</tr>
</thead>
<tbody>
@@ -65,8 +110,7 @@
$current = $charges[$key]['participation'] ?? '';
?>
<tr>
<td><?= esc($student['firstname']) ?></td>
<td><?= esc($student['lastname']) ?></td>
<td><?= esc(trim(($student['firstname'] ?? '') . ' ' . ($student['lastname'] ?? ''))) ?></td>
<td class="text-center align-middle">
<div class="d-inline-flex align-items-center gap-3">
<div class="form-check">
@@ -83,8 +127,6 @@
</div>
</div>
</td>
<td><?= esc($event['description'] ?: 'No description') ?></td>
<td class="text-nowrap">$<?= esc(number_format((float) ($event['amount'] ?? 0), 2)) ?></td>
</tr>
<?php endforeach; ?>
</tbody>