add open position system
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 48s
Tests / PHPUnit (push) Successful in 1m29s

This commit is contained in:
root
2026-09-02 00:53:55 -04:00
parent 5b11e2d859
commit dbfd72c2f9
24 changed files with 1627 additions and 47 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php $item = $item ?? []; ?>
<div class="row g-3">
<div class="col-md-6">
<label class="form-label" for="title">Title</label>
<input id="title" name="title" class="form-control" value="<?= esc(old('title', $item['title'] ?? '')) ?>" required>
</div>
<div class="col-md-6">
<label class="form-label" for="department">Department</label>
<input id="department" name="department" class="form-control" value="<?= esc(old('department', $item['department'] ?? '')) ?>">
</div>
<div class="col-md-6">
<label class="form-label" for="location">Location</label>
<input id="location" name="location" class="form-control" value="<?= esc(old('location', $item['location'] ?? '')) ?>">
</div>
<div class="col-md-6">
<label class="form-label" for="employment_type">Employment Type</label>
<input id="employment_type" name="employment_type" class="form-control" value="<?= esc(old('employment_type', $item['employment_type'] ?? '')) ?>">
</div>
<div class="col-12">
<label class="form-label" for="description">Description</label>
<textarea id="description" name="description" class="form-control" rows="6"><?= esc(old('description', $item['description'] ?? '')) ?></textarea>
</div>
<div class="col-12">
<label class="form-label" for="requirements">Requirements</label>
<textarea id="requirements" name="requirements" class="form-control" rows="6"><?= esc(old('requirements', $item['requirements'] ?? '')) ?></textarea>
</div>
</div>
+62
View File
@@ -0,0 +1,62 @@
<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<div class="container-fluid mt-4">
<div class="d-flex justify-content-between align-items-center mb-3">
<h2>Job Applications</h2>
<a href="<?= site_url('administrator/job-postings/positions') ?>" class="btn btn-outline-secondary">Positions</a>
</div>
<?php if (session('success')): ?><div class="alert alert-success"><?= esc(session('success')) ?></div><?php endif; ?>
<?php if (session('error')): ?><div class="alert alert-danger"><?= esc(session('error')) ?></div><?php endif; ?>
<form method="get" class="row g-2 mb-4">
<div class="col-md-4">
<select name="position_id" class="form-select">
<option value="">All positions</option>
<?php foreach ($positions as $position): ?>
<option value="<?= esc($position['position_id']) ?>" <?= $selectedPosition === $position['position_id'] ? 'selected' : '' ?>><?= esc($position['title']) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-md-3">
<select name="status" class="form-select">
<option value="">All statuses</option>
<?php foreach ($statuses as $status): ?>
<option value="<?= esc($status) ?>" <?= $selectedStatus === $status ? 'selected' : '' ?>><?= esc(ucfirst($status)) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-auto"><button class="btn btn-outline-primary" type="submit">Filter</button></div>
</form>
<div class="table-responsive">
<table class="table table-striped table-bordered align-middle no-mgmt-sticky">
<thead><tr><th>Applicant</th><th>Position</th><th>Position ID</th><th>Email</th><th>Phone</th><th>Submitted</th><th>Status / Notes</th><th>Resume</th></tr></thead>
<tbody>
<?php foreach ($applications as $application): ?>
<tr>
<td><?= esc(trim($application['first_name'] . ' ' . $application['last_name'])) ?></td>
<td><?= esc($application['position_title'] ?? '') ?></td>
<td><?= esc(substr((string) ($application['position_id'] ?? ''), 0, 8)) ?></td>
<td><a href="mailto:<?= esc($application['email']) ?>"><?= esc($application['email']) ?></a></td>
<td><?= esc($application['phone']) ?></td>
<td><?= esc($application['submitted_at']) ?></td>
<td style="min-width: 280px;">
<form action="<?= site_url('administrator/job-postings/applications/' . $application['application_id']) ?>" method="post">
<?= csrf_field() ?>
<select name="status" class="form-select form-select-sm mb-2">
<?php foreach ($statuses as $status): ?>
<option value="<?= esc($status) ?>" <?= $application['status'] === $status ? 'selected' : '' ?>><?= esc(ucfirst($status)) ?></option>
<?php endforeach; ?>
</select>
<textarea name="admin_notes" class="form-control form-control-sm mb-2" rows="2"><?= esc($application['admin_notes'] ?? '') ?></textarea>
<button class="btn btn-sm btn-primary" type="submit">Save</button>
</form>
</td>
<td><a class="btn btn-sm btn-outline-secondary" href="<?= site_url('administrator/job-postings/applications/' . $application['application_id'] . '/resume') ?>">Download</a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?= $this->endSection() ?>
+27
View File
@@ -0,0 +1,27 @@
<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<?php $isEdit = !empty($position['position_id']); ?>
<div class="container mt-4">
<h2><?= $isEdit ? 'Edit Job Position' : 'New Job Position' ?></h2>
<?php if (session('errors')): ?>
<div class="alert alert-danger"><?php foreach ((array) session('errors') as $error): ?><div><?= esc($error) ?></div><?php endforeach; ?></div>
<?php endif; ?>
<form action="<?= $isEdit ? site_url('administrator/job-postings/positions/' . $position['position_id']) : site_url('administrator/job-postings/positions') ?>" method="post">
<?= csrf_field() ?>
<input type="hidden" name="template_id" value="<?= esc(old('template_id', $position['template_id'] ?? '')) ?>">
<?= view('jobs/admin/_posting_fields', ['item' => $position ?? []]) ?>
<div class="mb-3">
<label class="form-label" for="status">Status</label>
<select id="status" name="status" class="form-select">
<?php foreach ($statuses as $status): ?>
<option value="<?= esc($status) ?>" <?= old('status', $position['status'] ?? 'draft') === $status ? 'selected' : '' ?>><?= esc(ucfirst($status)) ?></option>
<?php endforeach; ?>
</select>
</div>
<button type="submit" class="btn btn-primary">Save Position</button>
<a href="<?= site_url('administrator/job-postings/positions') ?>" class="btn btn-outline-secondary">Cancel</a>
</form>
</div>
<?= $this->endSection() ?>
+38
View File
@@ -0,0 +1,38 @@
<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<div class="container-fluid mt-4">
<div class="d-flex justify-content-between align-items-center mb-3">
<h2>Open Positions</h2>
<div class="d-flex gap-2">
<a href="<?= site_url('administrator/job-postings/applications') ?>" class="btn btn-outline-secondary">Applications</a>
<a href="<?= site_url('administrator/job-postings/templates') ?>" class="btn btn-primary">New Position</a>
</div>
</div>
<?php if (session('success')): ?><div class="alert alert-success"><?= esc(session('success')) ?></div><?php endif; ?>
<?php if (session('error')): ?><div class="alert alert-danger"><?= esc(session('error')) ?></div><?php endif; ?>
<div class="table-responsive">
<table class="table table-striped table-bordered no-mgmt-sticky">
<thead><tr><th>Title</th><th>Department</th><th>Location</th><th>Type</th><th>Status</th><th>Actions</th></tr></thead>
<tbody>
<?php foreach ($positions as $position): ?>
<tr>
<td><?= esc($position['title']) ?></td>
<td><?= esc($position['department'] ?? '') ?></td>
<td><?= esc($position['location'] ?? '') ?></td>
<td><?= esc($position['employment_type'] ?? '') ?></td>
<td><?= esc(ucfirst($position['status'])) ?></td>
<td>
<a class="btn btn-sm btn-outline-primary" href="<?= site_url('administrator/job-postings/positions/' . $position['position_id'] . '/edit') ?>">Edit</a>
<?php if ($position['status'] === 'open'): ?>
<a class="btn btn-sm btn-outline-secondary" href="<?= site_url('careers/' . $position['position_id']) ?>">Public View</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?= $this->endSection() ?>
+47
View File
@@ -0,0 +1,47 @@
<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<?php $isEdit = !empty($template); ?>
<div class="container mt-4">
<h2><?= $isEdit ? 'Edit Job Template' : 'New Job Template' ?></h2>
<?php if (session('errors')): ?>
<div class="alert alert-danger"><?php foreach ((array) session('errors') as $error): ?><div><?= esc($error) ?></div><?php endforeach; ?></div>
<?php endif; ?>
<form action="<?= $isEdit ? site_url('administrator/job-postings/templates/' . $template['template_id']) : site_url('administrator/job-postings/templates') ?>" method="post">
<?= csrf_field() ?>
<?= view('jobs/admin/_posting_fields', ['item' => $template ?? []]) ?>
<?php if ($isEdit): ?>
<div class="mb-3">
<label class="form-label" for="save_mode">Save Mode</label>
<select id="save_mode" name="save_mode" class="form-select">
<option value="overwrite">Overwrite current version</option>
<option value="new_version">Save as new version</option>
</select>
</div>
<?php endif; ?>
<button type="submit" class="btn btn-primary">Save Template</button>
<a href="<?= site_url('administrator/job-postings/templates') ?>" class="btn btn-outline-secondary">Cancel</a>
</form>
<?php if ($isEdit && !empty($versions)): ?>
<h3 class="h5 mt-5">Version History</h3>
<table class="table table-sm table-bordered">
<thead><tr><th>Version</th><th>Saved At</th><th>Actions</th></tr></thead>
<tbody>
<?php foreach ($versions as $version): ?>
<tr>
<td><?= esc($version['version']) ?></td>
<td><?= esc($version['saved_at']) ?></td>
<td>
<form action="<?= site_url('administrator/job-postings/templates/versions/' . $version['version_id'] . '/restore') ?>" method="post">
<?= csrf_field() ?>
<button class="btn btn-sm btn-outline-primary" type="submit">Restore</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<?= $this->endSection() ?>
+53
View File
@@ -0,0 +1,53 @@
<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>
<div class="container-fluid mt-4">
<div class="d-flex justify-content-between align-items-center mb-3">
<h2>Job Templates</h2>
<div class="d-flex gap-2">
<a href="<?= site_url('administrator/job-postings/positions') ?>" class="btn btn-outline-secondary">Open Positions</a>
<a href="<?= site_url('administrator/job-postings/templates/new') ?>" class="btn btn-primary">New Template</a>
</div>
</div>
<?php if (session('success')): ?><div class="alert alert-success"><?= esc(session('success')) ?></div><?php endif; ?>
<?php if (session('error')): ?><div class="alert alert-danger"><?= esc(session('error')) ?></div><?php endif; ?>
<div class="table-responsive">
<table class="table table-striped table-bordered no-mgmt-sticky">
<thead>
<tr>
<th>Title</th>
<th>Department</th>
<th>Location</th>
<th>Type</th>
<th>Version</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($templates as $template): ?>
<tr>
<td><?= esc($template['title']) ?></td>
<td><?= esc($template['department'] ?? '') ?></td>
<td><?= esc($template['location'] ?? '') ?></td>
<td><?= esc($template['employment_type'] ?? '') ?></td>
<td><?= esc($template['version']) ?></td>
<td><?= !empty($template['is_active']) ? 'Active' : 'Archived' ?></td>
<td class="d-flex gap-2">
<a class="btn btn-sm btn-outline-primary" href="<?= site_url('administrator/job-postings/templates/' . $template['template_id'] . '/edit') ?>">Edit</a>
<a class="btn btn-sm btn-outline-success" href="<?= site_url('administrator/job-postings/positions/new?template_id=' . $template['template_id']) ?>">Create Position</a>
<?php if (!empty($template['is_active'])): ?>
<form action="<?= site_url('administrator/job-postings/templates/' . $template['template_id'] . '/archive') ?>" method="post">
<?= csrf_field() ?>
<button class="btn btn-sm btn-outline-danger" type="submit">Archive</button>
</form>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?= $this->endSection() ?>