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
| Field | Type | Description |
|---|---|---|
id | integer | Primary key |
name_ar | string | Arabic name |
name_en | string | English name (nullable) |
code | string | Unique code |
max_days_per_year | integer | Maximum days per year |
is_paid | boolean | Whether leave is paid |
requires_attachment | boolean | Requires supporting document |
is_carry_over_allowed | boolean | Can unused days carry over |
max_carry_over_days | integer | Max days to carry over (nullable) |
gender | string | Restrict to male or female (nullable = both) |
min_service_months | integer | Minimum service months required |
description | string | Description (nullable) |
is_active | boolean | Active status |
API Endpoints
| Method | URL | Description |
|---|---|---|
GET | /api/hr/leave-types | List leave types |
POST | /api/hr/leave-types | Create 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
genderrestriction limits who can request this leave type (e.g., maternity for females)min_service_monthsprevents new employees from using certain leave typesrequires_attachmentenforces document upload on leave requests of this type- Carry-over days are applied when leave balances are initialized for a new fiscal year