cccc2872cd
API CI/CD / Validate (composer + pint) (push) Successful in 3m9s
API CI/CD / Test (PHPUnit) (push) Failing after 2m0s
API CI/CD / Build frontend assets (push) Failing after 1m55s
API CI/CD / Security audit (push) Failing after 55s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
351 lines
12 KiB
PHP
351 lines
12 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>School Calendar</title>
|
|
<style>
|
|
:root {
|
|
--bg: #f5f7fb;
|
|
--panel: #ffffff;
|
|
--line: #d9e0ea;
|
|
--ink: #172033;
|
|
--muted: #637083;
|
|
--success: #198754;
|
|
--primary: #0d6efd;
|
|
--danger: #dc3545;
|
|
--secondary: #6c757d;
|
|
--warning-bg: #fff3cd;
|
|
--warning-line: #ffec99;
|
|
--shadow: 0 12px 32px rgba(23, 32, 51, 0.08);
|
|
}
|
|
|
|
* { box-sizing: border-box; }
|
|
|
|
body {
|
|
margin: 0;
|
|
min-height: 100vh;
|
|
color: var(--ink);
|
|
font-family: Arial, Helvetica, sans-serif;
|
|
background: var(--bg);
|
|
}
|
|
|
|
a,
|
|
button,
|
|
select {
|
|
font: inherit;
|
|
}
|
|
|
|
.container-fluid {
|
|
width: 100%;
|
|
padding: 24px;
|
|
}
|
|
|
|
.wrapper {
|
|
max-width: 1380px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.content {
|
|
background: var(--panel);
|
|
border: 1px solid var(--line);
|
|
border-radius: 8px;
|
|
box-shadow: var(--shadow);
|
|
padding: 24px;
|
|
}
|
|
|
|
h2 {
|
|
margin: 0 0 18px;
|
|
text-align: center;
|
|
font-size: 1.9rem;
|
|
}
|
|
|
|
.toolbar {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
gap: 8px;
|
|
margin-bottom: 18px;
|
|
}
|
|
|
|
.filter-form {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
align-items: flex-end;
|
|
justify-content: center;
|
|
gap: 14px;
|
|
margin-bottom: 18px;
|
|
text-align: center;
|
|
}
|
|
|
|
.form-label {
|
|
display: inline-block;
|
|
margin-bottom: 6px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.form-select {
|
|
min-width: 150px;
|
|
padding: 8px 34px 8px 10px;
|
|
border: 1px solid #c8d1dc;
|
|
border-radius: 6px;
|
|
background: #fff;
|
|
}
|
|
|
|
.btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-height: 36px;
|
|
padding: 8px 12px;
|
|
border: 1px solid transparent;
|
|
border-radius: 6px;
|
|
color: #fff;
|
|
text-decoration: none;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.btn-sm {
|
|
min-height: 30px;
|
|
padding: 5px 9px;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.btn-success { background: var(--success); }
|
|
.btn-primary { background: var(--primary); }
|
|
.btn-danger { background: var(--danger); }
|
|
.btn-secondary { background: var(--secondary); }
|
|
.btn-outline-secondary {
|
|
background: #fff;
|
|
border-color: var(--secondary);
|
|
color: var(--secondary);
|
|
}
|
|
|
|
.alert {
|
|
margin-bottom: 16px;
|
|
padding: 12px 14px;
|
|
border-radius: 6px;
|
|
}
|
|
|
|
.alert-success {
|
|
color: #0f5132;
|
|
background: #d1e7dd;
|
|
border: 1px solid #badbcc;
|
|
}
|
|
|
|
.alert-danger {
|
|
color: #842029;
|
|
background: #f8d7da;
|
|
border: 1px solid #f5c2c7;
|
|
}
|
|
|
|
.alert-info {
|
|
color: #055160;
|
|
background: #cff4fc;
|
|
border: 1px solid #b6effb;
|
|
}
|
|
|
|
.table-responsive {
|
|
width: 100%;
|
|
overflow-x: auto;
|
|
margin-bottom: 18px;
|
|
}
|
|
|
|
table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
background: #fff;
|
|
}
|
|
|
|
th,
|
|
td {
|
|
padding: 10px 12px;
|
|
border: 1px solid var(--line);
|
|
text-align: left;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
th {
|
|
background: #eef3f8;
|
|
font-weight: 700;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
tbody tr:nth-child(even) {
|
|
background: #f9fbfd;
|
|
}
|
|
|
|
.text-center { text-align: center; }
|
|
.small { font-size: 0.875rem; }
|
|
.table-warning {
|
|
background: var(--warning-bg);
|
|
border-color: var(--warning-line);
|
|
}
|
|
|
|
.actions {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 6px;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.delete-form {
|
|
display: inline;
|
|
}
|
|
|
|
@media (max-width: 760px) {
|
|
.container-fluid {
|
|
padding: 12px;
|
|
}
|
|
|
|
.content {
|
|
padding: 16px;
|
|
}
|
|
|
|
.toolbar {
|
|
justify-content: stretch;
|
|
}
|
|
|
|
.toolbar .btn,
|
|
.filter-form .btn {
|
|
width: 100%;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container-fluid">
|
|
<div class="wrapper">
|
|
<div class="content">
|
|
<h2>School Calendar</h2>
|
|
|
|
@php
|
|
$addParams = array_filter([
|
|
'school_year' => $schoolYear ?? '',
|
|
'semester' => $semester ?? '',
|
|
], fn ($value) => $value !== '');
|
|
$addQuery = $addParams ? ('?'.http_build_query($addParams)) : '';
|
|
$resetUrl = url()->current();
|
|
@endphp
|
|
|
|
<div class="toolbar">
|
|
<a href="{{ url('/administrator/calendar_add_event') }}{{ $addQuery }}" class="btn btn-success">Add School Calendar Entry</a>
|
|
</div>
|
|
|
|
<form method="get" action="{{ url()->current() }}" class="filter-form">
|
|
<div>
|
|
<label for="school_year" class="form-label">School Year:</label>
|
|
<select name="school_year" id="school_year" class="form-select">
|
|
@foreach ($schoolYears as $option)
|
|
<option value="{{ $option }}" @selected($option === ($schoolYear ?? ''))>{{ $option }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="semester" class="form-label">Semester:</label>
|
|
<select name="semester" id="semester" class="form-select">
|
|
<option value="">-</option>
|
|
<option value="Fall" @selected(strcasecmp((string) ($semester ?? ''), 'Fall') === 0)>Fall</option>
|
|
<option value="Spring" @selected(strcasecmp((string) ($semester ?? ''), 'Spring') === 0)>Spring</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<button type="submit" class="btn btn-secondary">Apply</button>
|
|
<a href="{{ $resetUrl }}" class="btn btn-outline-secondary">Reset</a>
|
|
</div>
|
|
</form>
|
|
|
|
@if (session('success'))
|
|
<div class="alert alert-success">{{ session('success') }}</div>
|
|
@endif
|
|
|
|
@php
|
|
$emailStatus = session('email_status');
|
|
$emailStatusClass = session('email_status_class', 'info');
|
|
@endphp
|
|
|
|
@if ($emailStatus)
|
|
<div class="alert alert-{{ $emailStatusClass }}">{{ $emailStatus }}</div>
|
|
@endif
|
|
|
|
@if (session('error'))
|
|
<div class="alert alert-danger">{{ session('error') }}</div>
|
|
@endif
|
|
|
|
<div class="table-responsive">
|
|
<table id="myTable">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Title</th>
|
|
<th>Type</th>
|
|
<th>Description</th>
|
|
<th>Date</th>
|
|
<th>Notify Parent</th>
|
|
<th>Notify Teacher</th>
|
|
<th>Notify Admin</th>
|
|
<th>No School</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if ($events->isNotEmpty())
|
|
@if ($emailStatus)
|
|
<tr class="table-warning">
|
|
<td colspan="10" class="text-center small">{{ $emailStatus }}</td>
|
|
</tr>
|
|
@endif
|
|
|
|
@foreach ($events as $event)
|
|
<tr>
|
|
<td>{{ $event->id }}</td>
|
|
<td>{{ $event->title }}</td>
|
|
<td>{{ $event->event_type ?: '-' }}</td>
|
|
<td>{{ $event->description }}</td>
|
|
<td>{{ optional($event->date)->format('m-d-Y') }}</td>
|
|
<td class="text-center">
|
|
<input type="checkbox" disabled @checked((bool) $event->notify_parent)>
|
|
</td>
|
|
<td class="text-center">
|
|
<input type="checkbox" disabled @checked((bool) $event->notify_teacher)>
|
|
</td>
|
|
<td class="text-center">
|
|
<input type="checkbox" disabled @checked((bool) $event->notify_admin)>
|
|
</td>
|
|
<td class="text-center">
|
|
<input type="checkbox" disabled @checked((bool) $event->no_school)>
|
|
</td>
|
|
<td>
|
|
<div class="actions">
|
|
<a href="{{ url('/administrator/calendar_edit/'.$event->id) }}" class="btn btn-primary btn-sm">Edit</a>
|
|
<form action="{{ url('/administrator/calendar_delete/'.$event->id) }}" method="post" class="delete-form">
|
|
@csrf
|
|
<button type="submit" class="btn btn-danger btn-sm">Delete</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@else
|
|
<tr>
|
|
<td colspan="10" class="text-center">No school calendar entries found</td>
|
|
</tr>
|
|
@endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.querySelectorAll('.delete-form').forEach((form) => {
|
|
form.addEventListener('submit', (event) => {
|
|
if (!window.confirm('Are you sure you want to delete this school calendar entry?')) {
|
|
event.preventDefault();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|