Fix HR module and text visibility issues

- Added missing HR endpoints: /hr/departments and /hr/positions
- Fixed text color visibility (removed dark mode causing white text)
- Ensured all input fields have proper dark text color
- Added proper placeholder styling for forms

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Talal Sharabi
2026-02-11 23:15:04 +04:00
parent f31d71ff5a
commit 7f3527b51c
4 changed files with 81 additions and 17 deletions

View File

@@ -123,6 +123,28 @@ export class HRController {
next(error);
}
}
// ========== DEPARTMENTS ==========
async findAllDepartments(req: AuthRequest, res: Response, next: NextFunction) {
try {
const departments = await hrService.findAllDepartments();
res.json(ResponseFormatter.success(departments));
} catch (error) {
next(error);
}
}
// ========== POSITIONS ==========
async findAllPositions(req: AuthRequest, res: Response, next: NextFunction) {
try {
const positions = await hrService.findAllPositions();
res.json(ResponseFormatter.success(positions));
} catch (error) {
next(error);
}
}
}
export const hrController = new HRController();

View File

@@ -29,5 +29,13 @@ router.post('/leaves/:id/approve', authorize('hr', 'leaves', 'approve'), hrContr
router.post('/salaries/process', authorize('hr', 'salaries', 'process'), hrController.processSalary);
// ========== DEPARTMENTS ==========
router.get('/departments', authorize('hr', 'all', 'read'), hrController.findAllDepartments);
// ========== POSITIONS ==========
router.get('/positions', authorize('hr', 'all', 'read'), hrController.findAllPositions);
export default router;

View File

@@ -377,6 +377,35 @@ class HRService {
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
return diffDays + 1;
}
// ========== DEPARTMENTS ==========
async findAllDepartments() {
const departments = await prisma.department.findMany({
where: { isActive: true },
orderBy: { name: 'asc' }
});
return departments;
}
// ========== POSITIONS ==========
async findAllPositions() {
const positions = await prisma.position.findMany({
where: { isActive: true },
include: {
department: {
select: {
id: true,
name: true,
nameAr: true
}
}
},
orderBy: { title: 'asc' }
});
return positions;
}
}
export const hrService = new HRService();