diff --git a/app/Controllers/View/JobPostingController.php b/app/Controllers/View/JobPostingController.php index 609ad16..142ec64 100644 --- a/app/Controllers/View/JobPostingController.php +++ b/app/Controllers/View/JobPostingController.php @@ -398,6 +398,7 @@ class JobPostingController extends BaseController 'department' => trim((string) $this->request->getPost('department')), 'location' => trim((string) $this->request->getPost('location')), 'employment_type' => trim((string) $this->request->getPost('employment_type')), + 'responsibilities' => trim((string) $this->request->getPost('responsibilities')), 'requirements' => trim((string) $this->request->getPost('requirements')), ]; } @@ -427,6 +428,7 @@ class JobPostingController extends BaseController 'department' => (string) ($data['department'] ?? ''), 'location' => (string) ($data['location'] ?? ''), 'employment_type' => (string) ($data['employment_type'] ?? ''), + 'responsibilities' => (string) ($data['responsibilities'] ?? ''), 'requirements' => (string) ($data['requirements'] ?? ''), ]; } diff --git a/app/Database/Migrations/2026-09-01-000100_CreateJobPostings.php b/app/Database/Migrations/2026-09-01-000100_CreateJobPostings.php index ed5f9e9..0006a78 100644 --- a/app/Database/Migrations/2026-09-01-000100_CreateJobPostings.php +++ b/app/Database/Migrations/2026-09-01-000100_CreateJobPostings.php @@ -16,6 +16,7 @@ class CreateJobPostings extends Migration 'department' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'location' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'employment_type' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true], + 'responsibilities' => ['type' => 'TEXT', 'null' => true], 'requirements' => ['type' => 'TEXT', 'null' => true], 'version' => ['type' => 'INT', 'constraint' => 11, 'default' => 1], 'is_active' => ['type' => 'TINYINT', 'constraint' => 1, 'default' => 1], @@ -38,6 +39,7 @@ class CreateJobPostings extends Migration 'department' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'location' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'employment_type' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true], + 'responsibilities' => ['type' => 'TEXT', 'null' => true], 'requirements' => ['type' => 'TEXT', 'null' => true], 'saved_by' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true], 'saved_at' => ['type' => 'DATETIME', 'null' => true], @@ -56,6 +58,7 @@ class CreateJobPostings extends Migration 'department' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'location' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true], 'employment_type' => ['type' => 'VARCHAR', 'constraint' => 50, 'null' => true], + 'responsibilities' => ['type' => 'TEXT', 'null' => true], 'requirements' => ['type' => 'TEXT', 'null' => true], 'status' => ['type' => 'VARCHAR', 'constraint' => 20, 'default' => 'draft'], 'posted_by' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true], diff --git a/app/Database/Migrations/2026-09-01-000110_SeedVolunteerJobPostings.php b/app/Database/Migrations/2026-09-01-000110_SeedVolunteerJobPostings.php index 600ee6d..f3e7aac 100644 --- a/app/Database/Migrations/2026-09-01-000110_SeedVolunteerJobPostings.php +++ b/app/Database/Migrations/2026-09-01-000110_SeedVolunteerJobPostings.php @@ -12,7 +12,8 @@ class SeedVolunteerJobPostings extends Migration 'position_id' => 'cc23227b-82b1-4bcb-8976-fcd21f0a1e01', 'version_id' => '6a408f24-88db-4c0e-b7f2-26cc2da51e01', 'title' => 'Grade 6 Teacher Volunteer', - 'description' => "Al Rahma Sunday School is looking for a dedicated Grade 6 Teacher Volunteer to teach and mentor students in a positive Islamic learning environment. The teacher will help students strengthen their understanding of Islamic studies, Quran, Arabic, manners, and character development.\n\nResponsibilities:\n- Teach Grade 6 Sunday school lessons based on the school curriculum\n- Prepare weekly lesson plans and classroom activities\n- Help students understand Islamic values and apply them in daily life\n- Manage classroom behavior in a respectful and positive way\n- Encourage student participation, discussion, and teamwork\n- Track attendance and student progress\n- Communicate with school administration and parents when needed\n- Support school events, exams, and activities when requested", + 'description' => "Al Rahma Sunday School is looking for a dedicated Grade 6 Teacher Volunteer to teach and mentor students in a positive Islamic learning environment. The teacher will help students strengthen their understanding of Islamic studies, Quran, Arabic, manners, and character development.", + 'responsibilities' => "- Teach Grade 6 Sunday school lessons based on the school curriculum\n- Prepare weekly lesson plans and classroom activities\n- Help students understand Islamic values and apply them in daily life\n- Manage classroom behavior in a respectful and positive way\n- Encourage student participation, discussion, and teamwork\n- Track attendance and student progress\n- Communicate with school administration and parents when needed\n- Support school events, exams, and activities when requested", 'requirements' => "- Strong commitment to Islamic education and community service\n- Comfortable teaching and guiding middle school students\n- Patient, responsible, organized, and dependable\n- Good communication skills\n- Prior teaching, tutoring, or youth mentoring experience preferred\n- Must be available during Sunday school hours", ], [ @@ -20,7 +21,8 @@ class SeedVolunteerJobPostings extends Migration 'position_id' => 'cc23227b-82b1-4bcb-8976-fcd21f0a1e02', 'version_id' => '6a408f24-88db-4c0e-b7f2-26cc2da51e02', 'title' => 'Grade 8 Teacher Volunteer', - 'description' => "Al Rahma Sunday School is seeking a Grade 8 Teacher Volunteer to support students as they continue developing their Islamic knowledge, personal responsibility, and connection to the Muslim community.\n\nThe Grade 8 teacher will lead classroom lessons, encourage meaningful discussion, and help students build confidence in their faith and character.\n\nResponsibilities:\n- Teach Grade 8 Sunday school curriculum\n- Prepare engaging lessons, discussions, and activities\n- Help students understand Islamic teachings in age-appropriate ways\n- Encourage respectful dialogue, critical thinking, and positive behavior\n- Support students with Quran, Islamic studies, Arabic, and character development\n- Maintain classroom order and a safe learning environment\n- Monitor attendance and student participation\n- Communicate with administration and parents as needed\n- Assist with school programs, projects, or events when requested", + 'description' => "Al Rahma Sunday School is seeking a Grade 8 Teacher Volunteer to support students as they continue developing their Islamic knowledge, personal responsibility, and connection to the Muslim community.\n\nThe Grade 8 teacher will lead classroom lessons, encourage meaningful discussion, and help students build confidence in their faith and character.", + 'responsibilities' => "- Teach Grade 8 Sunday school curriculum\n- Prepare engaging lessons, discussions, and activities\n- Help students understand Islamic teachings in age-appropriate ways\n- Encourage respectful dialogue, critical thinking, and positive behavior\n- Support students with Quran, Islamic studies, Arabic, and character development\n- Maintain classroom order and a safe learning environment\n- Monitor attendance and student participation\n- Communicate with administration and parents as needed\n- Assist with school programs, projects, or events when requested", 'requirements' => "- Commitment to Islamic values and youth education\n- Ability to connect with middle school students\n- Responsible, patient, respectful, and organized\n- Strong communication and classroom management skills\n- Teaching, tutoring, halaqa, or mentoring experience preferred\n- Must be dependable and available on Sundays", ], [ @@ -28,7 +30,8 @@ class SeedVolunteerJobPostings extends Migration 'position_id' => 'cc23227b-82b1-4bcb-8976-fcd21f0a1e03', 'version_id' => '6a408f24-88db-4c0e-b7f2-26cc2da51e03', 'title' => 'Youth Teacher / Mentor Volunteer', - 'description' => "Al Rahma Sunday School is looking for a Youth Teacher / Mentor Volunteer to work with students ages 16-17. This role focuses on teaching, mentoring, and guiding older teens as they strengthen their Islamic identity, personal responsibility, leadership skills, and connection to the Muslim community.\n\nThe Youth Teacher will lead age-appropriate lessons and discussions that connect Islamic values to real-life topics students face at this stage of life.\n\nResponsibilities:\n- Teach and mentor students ages 16-17\n- Lead discussions on Islamic identity, character, Quran, Seerah, manners, leadership, and real-life challenges\n- Create a respectful classroom environment where students feel comfortable asking questions\n- Encourage critical thinking, responsibility, positive decision-making, and community involvement\n- Prepare weekly lessons, activities, or discussion topics\n- Support students in developing confidence in their faith and values\n- Maintain appropriate teacher-student boundaries and a safe learning environment\n- Track attendance and student participation\n- Communicate with Sunday school administration and parents when needed\n- Support youth projects, events, service activities, or school programs when requested", + 'description' => "Al Rahma Sunday School is looking for a Youth Teacher / Mentor Volunteer to work with students ages 16-17. This role focuses on teaching, mentoring, and guiding older teens as they strengthen their Islamic identity, personal responsibility, leadership skills, and connection to the Muslim community.\n\nThe Youth Teacher will lead age-appropriate lessons and discussions that connect Islamic values to real-life topics students face at this stage of life.", + 'responsibilities' => "- Teach and mentor students ages 16-17\n- Lead discussions on Islamic identity, character, Quran, Seerah, manners, leadership, and real-life challenges\n- Create a respectful classroom environment where students feel comfortable asking questions\n- Encourage critical thinking, responsibility, positive decision-making, and community involvement\n- Prepare weekly lessons, activities, or discussion topics\n- Support students in developing confidence in their faith and values\n- Maintain appropriate teacher-student boundaries and a safe learning environment\n- Track attendance and student participation\n- Communicate with Sunday school administration and parents when needed\n- Support youth projects, events, service activities, or school programs when requested", 'requirements' => "- Strong commitment to Islamic education and youth development\n- Ability to relate respectfully and effectively with older teens\n- Comfortable leading meaningful discussions with students ages 16-17\n- Patient, dependable, trustworthy, and organized\n- Good communication, leadership, and classroom management skills\n- Prior experience in teaching, mentoring, halaqas, youth programs, or community service preferred\n- Must be available during Sunday school hours", ], ]; @@ -48,6 +51,7 @@ class SeedVolunteerJobPostings extends Migration 'department' => 'Sunday School', 'location' => 'Al Rahma Sunday School', 'employment_type' => 'Volunteer', + 'responsibilities' => $posting['responsibilities'], 'requirements' => $posting['requirements'], ]; diff --git a/app/Database/Migrations/2026-09-03-000100_AddResponsibilitiesToJobPostings.php b/app/Database/Migrations/2026-09-03-000100_AddResponsibilitiesToJobPostings.php new file mode 100644 index 0000000..9d18023 --- /dev/null +++ b/app/Database/Migrations/2026-09-03-000100_AddResponsibilitiesToJobPostings.php @@ -0,0 +1,83 @@ +tables as $table) { + if (!$this->db->tableExists($table) || $this->db->fieldExists('responsibilities', $table)) { + continue; + } + + $this->forge->addColumn($table, [ + 'responsibilities' => [ + 'type' => 'TEXT', + 'null' => true, + 'after' => 'employment_type', + ], + ]); + } + + $this->backfillResponsibilities(); + } + + public function down() + { + foreach ($this->tables as $table) { + if ($this->db->tableExists($table) && $this->db->fieldExists('responsibilities', $table)) { + $this->forge->dropColumn($table, 'responsibilities'); + } + } + } + + private function backfillResponsibilities(): void + { + $primaryKeys = [ + 'job_templates' => 'template_id', + 'job_template_versions' => 'version_id', + 'job_positions' => 'position_id', + ]; + + foreach ($primaryKeys as $table => $primaryKey) { + if (!$this->db->tableExists($table) || !$this->db->fieldExists('responsibilities', $table)) { + continue; + } + + $rows = $this->db->table($table) + ->select($primaryKey . ', description, responsibilities') + ->groupStart() + ->where('responsibilities', null) + ->orWhere('responsibilities', '') + ->groupEnd() + ->like('description', 'Responsibilities:') + ->get() + ->getResultArray(); + + foreach ($rows as $row) { + $description = (string) ($row['description'] ?? ''); + $parts = preg_split('/\R\RResponsibilities:\R/', $description, 2); + + if (!is_array($parts) || count($parts) !== 2) { + continue; + } + + $this->db->table($table) + ->where($primaryKey, $row[$primaryKey]) + ->update([ + 'description' => trim($parts[0]), + 'responsibilities' => trim($parts[1]), + ]); + } + } + } +} diff --git a/app/Database/Migrations/2026-09-03-000110_BackfillJobPostingResponsibilities.php b/app/Database/Migrations/2026-09-03-000110_BackfillJobPostingResponsibilities.php new file mode 100644 index 0000000..b0c9466 --- /dev/null +++ b/app/Database/Migrations/2026-09-03-000110_BackfillJobPostingResponsibilities.php @@ -0,0 +1,53 @@ + 'template_id', + 'job_template_versions' => 'version_id', + 'job_positions' => 'position_id', + ]; + + public function up() + { + foreach ($this->primaryKeys as $table => $primaryKey) { + if (!$this->db->tableExists($table) || !$this->db->fieldExists('responsibilities', $table)) { + continue; + } + + $rows = $this->db->table($table) + ->select($primaryKey . ', description, responsibilities') + ->groupStart() + ->where('responsibilities', null) + ->orWhere('responsibilities', '') + ->groupEnd() + ->like('description', 'Responsibilities:') + ->get() + ->getResultArray(); + + foreach ($rows as $row) { + $parts = preg_split('/\R\RResponsibilities:\R/', (string) ($row['description'] ?? ''), 2); + + if (!is_array($parts) || count($parts) !== 2) { + continue; + } + + $this->db->table($table) + ->where($primaryKey, $row[$primaryKey]) + ->update([ + 'description' => trim($parts[0]), + 'responsibilities' => trim($parts[1]), + ]); + } + } + } + + public function down() + { + // Data-only migration; do not merge responsibilities back into descriptions on rollback. + } +} diff --git a/app/Models/JobPositionModel.php b/app/Models/JobPositionModel.php index dd8d535..ca671d5 100644 --- a/app/Models/JobPositionModel.php +++ b/app/Models/JobPositionModel.php @@ -18,6 +18,7 @@ class JobPositionModel extends Model 'department', 'location', 'employment_type', + 'responsibilities', 'requirements', 'status', 'posted_by', diff --git a/app/Models/JobTemplateModel.php b/app/Models/JobTemplateModel.php index 0f86957..939e1b1 100644 --- a/app/Models/JobTemplateModel.php +++ b/app/Models/JobTemplateModel.php @@ -17,6 +17,7 @@ class JobTemplateModel extends Model 'department', 'location', 'employment_type', + 'responsibilities', 'requirements', 'version', 'is_active', diff --git a/app/Models/JobTemplateVersionModel.php b/app/Models/JobTemplateVersionModel.php index 1905d11..5e5a160 100644 --- a/app/Models/JobTemplateVersionModel.php +++ b/app/Models/JobTemplateVersionModel.php @@ -19,6 +19,7 @@ class JobTemplateVersionModel extends Model 'department', 'location', 'employment_type', + 'responsibilities', 'requirements', 'saved_by', 'saved_at', diff --git a/app/Views/jobs/admin/_posting_fields.php b/app/Views/jobs/admin/_posting_fields.php index 3bbd574..4a18186 100644 --- a/app/Views/jobs/admin/_posting_fields.php +++ b/app/Views/jobs/admin/_posting_fields.php @@ -20,6 +20,10 @@ +