add job openings to the parent portal
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 47s
Tests / PHPUnit (push) Successful in 1m22s

This commit is contained in:
root
2026-09-02 23:48:23 -04:00
parent 88772c3ea0
commit 46769e8b27
2 changed files with 112 additions and 0 deletions
@@ -13,6 +13,7 @@ use App\Models\ScoreCommentModel;
use App\Models\AttendanceRecordModel;
use App\Models\AttendanceDayModel;
use App\Models\CalendarModel;
use App\Models\JobPositionModel;
use \Config\Database;
use DateTimeImmutable;
use DateTimeZone;
@@ -867,6 +868,15 @@ class LandingPageController extends BaseController
->get()
->getRowArray();
$paymentBalance = (float) ($paymentRow['account_balance'] ?? 0);
$openPositions = [];
try {
if ($this->db->tableExists('job_positions')) {
$openPositions = (new JobPositionModel())->openPositions();
}
} catch (\Throwable $e) {
log_message('error', 'Unable to load parent dashboard job positions: ' . $e->getMessage());
}
// Pass data to the view, including the deadlines
return view('/landing_page/parent_dashboard', [
@@ -878,6 +888,7 @@ class LandingPageController extends BaseController
'lastDayOfRegistration' => $this->lastDayOfRegistration, // Add the enrollment deadline to the view
'withdrawalDeadline' => $this->refundDeadline, // Add the refund deadline to the view
'paymentBalance' => $paymentBalance, // 🔹 New
'openPositions' => $openPositions,
]);
}
+101
View File
@@ -1,5 +1,36 @@
<?= $this->extend('layout/main_layout') ?>
<?= $this->section('styles') ?>
<style>
.volunteer-openings-modal .modal-header {
background: linear-gradient(135deg, #0f766e, #2563eb);
color: #fff;
}
.volunteer-openings-modal .btn-close {
filter: invert(1) grayscale(100%) brightness(200%);
}
.volunteer-opening-card {
border: 1px solid rgba(15, 23, 42, 0.12);
border-radius: 8px;
padding: 1rem;
background: #fff;
}
.volunteer-opening-card + .volunteer-opening-card {
margin-top: 0.85rem;
}
.volunteer-opening-meta {
color: #64748b;
font-size: 0.92rem;
}
</style>
<?= $this->endSection() ?>
<?= $this->section('content') ?>
<?php $openPositions = $openPositions ?? []; ?>
<!-- Circle Styles -->
@@ -178,4 +209,74 @@
</div>
</div>
<?php if (!empty($openPositions)): ?>
<div class="modal fade volunteer-openings-modal" id="volunteerOpeningsModal" tabindex="-1" aria-labelledby="volunteerOpeningsModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<div>
<h5 class="modal-title mb-1" id="volunteerOpeningsModalLabel">Volunteer openings</h5>
<div class="small opacity-75">Al Rahma Sunday School is looking for help from our community.</div>
</div>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p class="mb-3">
Please review the current openings below. If you or someone you know can help, submit an application or share the opportunity.
</p>
<?php foreach ($openPositions as $position): ?>
<?php
$positionId = (string) ($position['position_id'] ?? '');
$detailsUrl = site_url('careers/' . rawurlencode($positionId));
$applyUrl = site_url('careers/' . rawurlencode($positionId) . '/apply');
$meta = array_filter([
$position['department'] ?? '',
$position['location'] ?? '',
$position['employment_type'] ?? '',
]);
?>
<div class="volunteer-opening-card">
<div class="d-flex flex-column flex-md-row justify-content-between gap-3">
<div>
<h6 class="mb-1"><?= esc($position['title'] ?? 'Volunteer position') ?></h6>
<?php if (!empty($meta)): ?>
<div class="volunteer-opening-meta mb-2"><?= esc(implode(' | ', $meta)) ?></div>
<?php endif; ?>
<?php if (!empty($position['description'])): ?>
<div class="small text-muted"><?= esc($position['description']) ?></div>
<?php endif; ?>
</div>
<div class="d-flex align-items-start gap-2 flex-shrink-0">
<a class="btn btn-outline-secondary btn-sm" href="<?= esc($detailsUrl) ?>">Details</a>
<a class="btn btn-primary btn-sm" href="<?= esc($applyUrl) ?>">Apply</a>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="modal-footer">
<a class="btn btn-outline-secondary" href="<?= site_url('careers') ?>">View all openings</a>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?= $this->endSection() ?>
<?php if (!empty($openPositions)): ?>
<?= $this->section('scripts') ?>
<script>
document.addEventListener('DOMContentLoaded', function () {
const modalEl = document.getElementById('volunteerOpeningsModal');
if (!modalEl || !window.bootstrap) {
return;
}
bootstrap.Modal.getOrCreateInstance(modalEl).show();
});
</script>
<?= $this->endSection() ?>
<?php endif; ?>