Skip to content

Leave Types (أنواع الإجازات)

Define the types of leave available to employees — annual, sick, maternity, etc. — with rules for carry-over, gender restrictions, and minimum service requirements.

Attributes

FieldTypeDescription
idintegerPrimary key
name_arstringArabic name
name_enstringEnglish name (nullable)
codestringUnique code
max_days_per_yearintegerMaximum days per year
is_paidbooleanWhether leave is paid
requires_attachmentbooleanRequires supporting document
is_carry_over_allowedbooleanCan unused days carry over
max_carry_over_daysintegerMax days to carry over (nullable)
genderstringRestrict to male or female (nullable = both)
min_service_monthsintegerMinimum service months required
descriptionstringDescription (nullable)
is_activebooleanActive status

API Endpoints

MethodURLDescription
GET/api/hr/leave-typesList leave types
POST/api/hr/leave-typesCreate leave type
GET/api/hr/leave-types/{id}Show leave type
PUT/api/hr/leave-types/{id}Update leave type
DELETE/api/hr/leave-types/{id}Delete leave type

Examples

bash
# Create leave type
curl -X POST "https://moon-erp.elbaset.com/api/hr/leave-types" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name_ar": "إجازة سنوية",
    "name_en": "Annual Leave",
    "code": "AL",
    "max_days_per_year": 30,
    "is_paid": true,
    "is_carry_over_allowed": true,
    "max_carry_over_days": 5,
    "min_service_months": 3
  }'
dart
final response = await dio.post('/api/hr/leave-types', data: {
  'name_ar': 'إجازة سنوية',
  'name_en': 'Annual Leave',
  'code': 'AL',
  'max_days_per_year': 30,
  'is_paid': true,
  'is_carry_over_allowed': true,
  'max_carry_over_days': 5,
  'min_service_months': 3,
});

Business Rules

  • gender restriction limits who can request this leave type (e.g., maternity for females)
  • min_service_months prevents new employees from using certain leave types
  • requires_attachment enforces document upload on leave requests of this type
  • Carry-over days are applied when leave balances are initialized for a new fiscal year

Moon ERP API Documentation