From 9e2f8583439d02df5781dd4a708b21ac190cbd79 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 3 Sep 2026 13:01:36 -0400 Subject: [PATCH] fix job positions --- app/Config/Routes.php | 1 + app/Controllers/View/JobPostingController.php | 12 +++++++ .../2026-09-01-000100_CreateJobPostings.php | 1 + ...140_AddDetailsClickCountToJobPositions.php | 32 +++++++++++++++++++ app/Models/JobPositionModel.php | 10 ++++++ app/Views/careers.php | 17 ++++++++-- app/Views/jobs/admin/positions.php | 3 +- app/Views/jobs/show.php | 1 + app/Views/landing_page/parent_dashboard.php | 3 +- 9 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 app/Database/Migrations/2026-09-03-000140_AddDetailsClickCountToJobPositions.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 3a86e50..2da5aae 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -224,6 +224,7 @@ $routes->get('/', 'View\UserController::home'); // Home page route $routes->get('/about', 'View\UserController::about'); // About page route $routes->get('/careers', 'View\JobPostingController::publicIndex'); // Careers page route $routes->get('/careers/application-received', 'View\JobPostingController::applicationReceived'); +$routes->get('/careers/(:segment)/details', 'View\JobPostingController::trackDetailsClick/$1'); $routes->get('/careers/(:segment)', 'View\JobPostingController::show/$1'); $routes->get('/careers/(:segment)/apply', 'View\JobPostingController::apply/$1'); $routes->post('/careers/(:segment)/apply', 'View\JobPostingController::submitApplication/$1'); diff --git a/app/Controllers/View/JobPostingController.php b/app/Controllers/View/JobPostingController.php index e60cc8b..0799a03 100644 --- a/app/Controllers/View/JobPostingController.php +++ b/app/Controllers/View/JobPostingController.php @@ -47,6 +47,18 @@ class JobPostingController extends BaseController return view('jobs/show', ['position' => $position]); } + public function trackDetailsClick(string $positionId) + { + $position = $this->positions->where('position_id', $positionId)->where('status', 'open')->first(); + if (!$position) { + throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound('Position not found'); + } + + $this->positions->recordDetailsClick($positionId); + + return redirect()->to(site_url('careers/' . rawurlencode($positionId))); + } + public function apply(string $positionId) { $position = $this->positions->where('position_id', $positionId)->where('status', 'open')->first(); diff --git a/app/Database/Migrations/2026-09-01-000100_CreateJobPostings.php b/app/Database/Migrations/2026-09-01-000100_CreateJobPostings.php index c7b3cdf..974541c 100644 --- a/app/Database/Migrations/2026-09-01-000100_CreateJobPostings.php +++ b/app/Database/Migrations/2026-09-01-000100_CreateJobPostings.php @@ -63,6 +63,7 @@ class CreateJobPostings extends Migration 'status' => ['type' => 'VARCHAR', 'constraint' => 20, 'default' => 'draft'], 'posted_by' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true], 'posted_at' => ['type' => 'DATETIME', 'null' => true], + 'details_click_count' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'default' => 0], 'created_at' => ['type' => 'DATETIME', 'null' => true], 'updated_at' => ['type' => 'DATETIME', 'null' => true], ]); diff --git a/app/Database/Migrations/2026-09-03-000140_AddDetailsClickCountToJobPositions.php b/app/Database/Migrations/2026-09-03-000140_AddDetailsClickCountToJobPositions.php new file mode 100644 index 0000000..ff8f8d9 --- /dev/null +++ b/app/Database/Migrations/2026-09-03-000140_AddDetailsClickCountToJobPositions.php @@ -0,0 +1,32 @@ +db->tableExists('job_positions') || $this->db->fieldExists('details_click_count', 'job_positions')) { + return; + } + + $this->forge->addColumn('job_positions', [ + 'details_click_count' => [ + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + 'default' => 0, + 'after' => 'posted_at', + ], + ]); + } + + public function down() + { + if ($this->db->tableExists('job_positions') && $this->db->fieldExists('details_click_count', 'job_positions')) { + $this->forge->dropColumn('job_positions', 'details_click_count'); + } + } +} diff --git a/app/Models/JobPositionModel.php b/app/Models/JobPositionModel.php index 1ac4640..f6f1109 100644 --- a/app/Models/JobPositionModel.php +++ b/app/Models/JobPositionModel.php @@ -23,6 +23,7 @@ class JobPositionModel extends Model 'status', 'posted_by', 'posted_at', + 'details_click_count', 'created_at', 'updated_at', ]; @@ -39,6 +40,15 @@ class JobPositionModel extends Model ->findAll(); } + public function recordDetailsClick(string $positionId): bool + { + return $this->builder() + ->set('details_click_count', 'COALESCE(details_click_count, 0) + 1', false) + ->where('position_id', $positionId) + ->where('status', 'open') + ->update(); + } + public function adminPositions(): array { return $this diff --git a/app/Views/careers.php b/app/Views/careers.php index 417a2b9..2c9f01c 100644 --- a/app/Views/careers.php +++ b/app/Views/careers.php @@ -226,7 +226,7 @@ border: 1px solid var(--line); background: #ffffff; height: 100%; - padding: 1.75rem; + padding: 1.75rem 1.75rem 3rem; position: relative; } @@ -266,6 +266,16 @@ margin-bottom: 1rem; } + .opening-clicks { + position: absolute; + right: 1.25rem; + bottom: 1rem; + color: var(--ink-soft); + font-size: 0.85rem; + font-weight: 600; + line-height: 1; + } + .opening-list { padding-left: 1.1rem; margin-bottom: 1.5rem; @@ -347,7 +357,7 @@

Current Open Positions

Review the available roles below and apply by creating an account.

-

All positions bellow are taking place at ISGL: 5 Courthouse Lane, Chelmsford, MA 01824

+

All positions are non-paid and take place at ISGL: 5 Courthouse Lane, Chelmsford, MA 01824

@@ -378,7 +388,8 @@ ?>

- View Details + View Details +
views
diff --git a/app/Views/jobs/admin/positions.php b/app/Views/jobs/admin/positions.php index 8410800..b063a83 100644 --- a/app/Views/jobs/admin/positions.php +++ b/app/Views/jobs/admin/positions.php @@ -13,7 +13,7 @@
- + +
TitleDepartmentLocationTypeStatusPost DateActions
TitleDepartmentLocationTypeStatusPost DateDetail ClicksActions
Edit diff --git a/app/Views/jobs/show.php b/app/Views/jobs/show.php index 8a7b939..c242b2f 100644 --- a/app/Views/jobs/show.php +++ b/app/Views/jobs/show.php @@ -94,6 +94,7 @@ $renderPostingText = static function (?string $text): string { · ·
+
views

Description

diff --git a/app/Views/landing_page/parent_dashboard.php b/app/Views/landing_page/parent_dashboard.php index 64e09b2..06faf46 100644 --- a/app/Views/landing_page/parent_dashboard.php +++ b/app/Views/landing_page/parent_dashboard.php @@ -255,7 +255,7 @@
+
views