102 lines
5.2 KiB
PHP
102 lines
5.2 KiB
PHP
<?= $this->extend('layout/main_layout') ?>
|
|
<?= $this->section('content') ?>
|
|
<div class="container my-5">
|
|
<h3 class="text-center text-success" style="font-family: Arial, sans-serif;">Events
|
|
<span class="badge bg-info"><?= count($activeEvents) ?></span>
|
|
</h3>
|
|
|
|
<!-- Flash messages -->
|
|
<?php if (session()->getFlashdata('success')): ?>
|
|
<div class="alert alert-success">
|
|
<?= session()->getFlashdata('success') ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (session()->getFlashdata('error')): ?>
|
|
<div class="alert alert-danger">
|
|
<?= session()->getFlashdata('error') ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (empty($activeEvents)): ?>
|
|
<div class="alert alert-info mb-3 d-inline-block">
|
|
There are no active events at this time.
|
|
</div>
|
|
<?php else: ?>
|
|
<?php foreach ($activeEvents as $event): ?>
|
|
<div class="card mb-4">
|
|
<div class="card-body">
|
|
|
|
<!-- Event Title -->
|
|
<h5 class="card-title">
|
|
<?= esc($event['event_name']) ?>
|
|
<small class="text-muted">(Expires: <?= esc(!empty($event['expiration_date']) ? local_date($event['expiration_date'], 'm-d-Y') : '') ?>)</small>
|
|
</h5>
|
|
|
|
<!-- Image -->
|
|
<div class="text-center mb-3">
|
|
<?php if ($event['flyer']): ?>
|
|
<img src="<?= base_url('uploads/' . $event['flyer']) ?>" class="img-fluid" alt="Event Flyer">
|
|
<?php else: ?>
|
|
<div class="text-muted">No Flyer</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<!-- Participation Table -->
|
|
<form method="post" action="<?= site_url('parent/updateParticipation') ?>">
|
|
<?= csrf_field() ?>
|
|
<input type="hidden" name="event_id" value="<?= $event['id'] ?>">
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-sm table-bordered">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Student First Name</th>
|
|
<th>Student Last Name</th>
|
|
<th class="text-center">Participate</th>
|
|
<th>Description</th>
|
|
<th>Event Fees</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($yourStudents as $student): ?>
|
|
<?php
|
|
$key = $student['id'] . ':' . $event['id'];
|
|
$current = $charges[$key]['participation'] ?? '';
|
|
?>
|
|
<tr>
|
|
<td><?= esc($student['firstname']) ?></td>
|
|
<td><?= esc($student['lastname']) ?></td>
|
|
<td class="text-center align-middle">
|
|
<div class="d-inline-flex align-items-center gap-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio"
|
|
name="participation[<?= $key ?>]" value="yes"
|
|
<?= $current === 'yes' ? 'checked' : '' ?>>
|
|
<label class="form-check-label">Yes</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="radio"
|
|
name="participation[<?= $key ?>]" value="no"
|
|
<?= $current === 'no' ? 'checked' : '' ?>>
|
|
<label class="form-check-label">No</label>
|
|
</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>
|
|
</table>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary mt-2">Save</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?= $this->endSection() ?>
|