Refactor employee management by implementing automatic employee number generation, updating national ID handling, and enhancing localization for gender and nationality fields across various resources. Adjust form components and validation logic to improve user experience and data integrity.

This commit is contained in:
Mekan1206
2026-08-02 21:06:37 +05:00
parent 28cbef8eb5
commit eed46157cd
25 changed files with 1175 additions and 51 deletions

View File

@@ -26,7 +26,6 @@ it('creates an employee with the provided data', function (): void {
$shift = Shift::factory()->create();
$employee = $this->service->create([
'employee_number' => 'EMP-10001',
'full_name' => 'John Doe',
'gender' => 'male',
'birth_date' => '1990-05-15',
@@ -39,16 +38,37 @@ it('creates an employee with the provided data', function (): void {
]);
expect($employee)->toBeInstanceOf(Employee::class)
->and($employee->employee_number)->toBe('EMP-10001')
->and($employee->employee_number)->toBe('EMP-00001')
->and($employee->full_name)->toBe('John Doe')
->and($employee->employment_status)->toBe(EmploymentStatus::Active);
$this->assertDatabaseHas('employees', [
'employee_number' => 'EMP-10001',
'employee_number' => 'EMP-00001',
'full_name' => 'John Doe',
]);
});
it('creates an employee with an explicit employee number', function (): void {
$department = Department::factory()->create();
$position = Position::factory()->create();
$shift = Shift::factory()->create();
$employee = $this->service->create([
'employee_number' => 'EMP-10001',
'full_name' => 'Jane Doe',
'gender' => 'female',
'birth_date' => '1991-06-20',
'phone' => '+993 61 92 92 48',
'department_id' => $department->id,
'position_id' => $position->id,
'shift_id' => $shift->id,
'employment_status' => EmploymentStatus::Active,
'hire_date' => '2024-02-01',
]);
expect($employee->employee_number)->toBe('EMP-10001');
});
it('terminates an employee and notifies hr managers', function (): void {
$employee = Employee::factory()->active()->create();
$terminationDate = Carbon::parse('2025-06-30');