Job Openings (فرص العمل)
Post job vacancies linked to departments and positions, track the number of positions to fill, and manage opening lifecycle.
Attributes
| Field | Type | Description |
|---|---|---|
id | integer | Primary key |
opening_number | string | Auto-generated number |
title_en | string | English title |
title_ar | string | Arabic title |
department_id | integer | Department FK (nullable) |
position_id | integer | Position FK (nullable) |
branch_id | integer | Branch FK (nullable) |
number_of_positions | integer | Positions to fill |
filled_positions | integer | Positions filled so far |
status | enum | draft, open, on_hold, closed, filled |
description | text | Job description (nullable) |
requirements | text | Job requirements (nullable) |
employment_type | string | Full-time, part-time, etc. |
experience_years_min | integer | Min experience (nullable) |
experience_years_max | integer | Max experience (nullable) |
salary_range_min | decimal | Min salary (nullable) |
salary_range_max | decimal | Max salary (nullable) |
published_at | datetime | Publication date (nullable) |
closing_date | date | Application deadline (nullable) |
Status Workflow
API Endpoints
| Method | URL | Description |
|---|---|---|
GET | /api/hr/job-openings | List openings |
POST | /api/hr/job-openings | Create opening |
GET | /api/hr/job-openings/{id} | Show opening |
PUT | /api/hr/job-openings/{id} | Update opening |
DELETE | /api/hr/job-openings/{id} | Delete opening |
POST | /api/hr/job-openings/{id}/status | Change status |
Examples
bash
# Create job opening
curl -X POST "https://moon-erp.elbaset.com/api/hr/job-openings" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"title_ar": "مطور برمجيات",
"title_en": "Software Developer",
"department_id": 2,
"position_id": 5,
"number_of_positions": 3,
"employment_type": "permanent",
"experience_years_min": 2,
"salary_range_min": 5000,
"salary_range_max": 8000,
"closing_date": "2026-04-30"
}'
# Update status
curl -X POST "https://moon-erp.elbaset.com/api/hr/job-openings/1/status" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{ "status": "open" }'dart
final response = await dio.post('/api/hr/job-openings', data: {
'title_ar': 'مطور برمجيات',
'title_en': 'Software Developer',
'department_id': 2,
'number_of_positions': 3,
'employment_type': 'permanent',
});Business Rules
filled_positionsis auto-incremented when a candidate is hired through this opening- Status transitions to
filledautomatically whenfilled_positions >= number_of_positions - Deleting an opening is only allowed when status is
draft