Skip to content

Positions / Job Titles (المناصب)

Positions define job titles within departments, including grade levels and salary ranges.

Attributes

FieldTypeDescription
idintegerPrimary key
name_arstringArabic name
name_enstringEnglish name (nullable)
codestringAuto-generated code (POS-001)
department_idintegerDepartment FK (nullable)
descriptionstringDescription (nullable)
gradestringGrade level (nullable)
min_salarydecimalMinimum salary (nullable)
max_salarydecimalMaximum salary (nullable)
statusstringactive or inactive

API Endpoints

MethodURLDescription
GET/api/hr/positionsList positions (paginated)
POST/api/hr/positionsCreate position
GET/api/hr/positions/{id}Show position
PUT/api/hr/positions/{id}Update position
DELETE/api/hr/positions/{id}Delete position

Query Parameters

ParameterTypeDescription
department_idintegerFilter by department
statusstringFilter by active or inactive
searchstringSearch by name_ar, name_en, or code

Examples

bash
# List positions in a department
curl -X GET "https://moon-erp.elbaset.com/api/hr/positions?department_id=1" \
  -H "Authorization: Bearer {token}"

# Create position
curl -X POST "https://moon-erp.elbaset.com/api/hr/positions" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name_ar": "محاسب",
    "name_en": "Accountant",
    "department_id": 1,
    "grade": "B",
    "min_salary": 5000,
    "max_salary": 12000,
    "status": "active"
  }'
dart
// List positions
final response = await dio.get('/api/hr/positions', queryParameters: {
  'department_id': 1,
});

// Create position
final response = await dio.post('/api/hr/positions', data: {
  'name_ar': 'محاسب',
  'name_en': 'Accountant',
  'department_id': 1,
  'grade': 'B',
  'min_salary': 5000,
  'max_salary': 12000,
  'status': 'active',
});

Business Rules

  • Position code is auto-generated via SequenceService
  • max_salary must be >= min_salary when both are provided
  • Cannot delete a position that has active employees

Moon ERP API Documentation