refactor: completely remove attendance policies and hardcode 15min grace periods

This commit is contained in:
2026-07-16 10:22:17 +08:00
parent bb331f213f
commit 4d1879d8ce
14 changed files with 115 additions and 1123 deletions

View File

@@ -245,7 +245,6 @@ class EmployeeController extends Controller
'shift_id' => 'nullable|exists:shifts,id',
'rest_days' => 'nullable|array',
'rest_days.*' => 'string|in:monday,tuesday,wednesday,thursday,friday,saturday,sunday',
'attendance_policy_id' => 'nullable|exists:attendance_policies,id',
'salary' => 'required|numeric|min:0',
// Employment details
@@ -379,13 +378,6 @@ class EmployeeController extends Controller
}
$employee->shift_id = $shiftId;
$policyId = $request->attendance_policy_id;
if (empty($policyId)) {
$defaultPolicy = \App\Models\AttendancePolicy::whereIn('created_by', getCompanyAndUsersId())->where('status', 'active')->first();
$policyId = $defaultPolicy ? $defaultPolicy->id : null;
}
$employee->attendance_policy_id = $policyId;
$employee->rest_days = $request->rest_days;
$employee->date_of_joining = $request->date_of_joining;
$employee->employment_type = $request->employment_type;
@@ -595,7 +587,6 @@ class EmployeeController extends Controller
'shift_id' => 'nullable|exists:shifts,id',
'rest_days' => 'nullable|array',
'rest_days.*' => 'string|in:monday,tuesday,wednesday,thursday,friday,saturday,sunday',
'attendance_policy_id' => 'nullable|exists:attendance_policies,id',
'salary' => 'required|numeric|min:0',
// Employment details
@@ -685,13 +676,6 @@ class EmployeeController extends Controller
}
$employee->shift_id = $shiftId;
$policyId = $request->attendance_policy_id;
if (empty($policyId)) {
$defaultPolicy = \App\Models\AttendancePolicy::whereIn('created_by', getCompanyAndUsersId())->where('status', 'active')->first();
$policyId = $defaultPolicy ? $defaultPolicy->id : null;
}
$employee->attendance_policy_id = $policyId;
$employee->rest_days = $request->rest_days;
$employee->phone = $request->phone;
$employee->date_of_birth = $request->date_of_birth;
@@ -1448,9 +1432,8 @@ class EmployeeController extends Controller
'branch_id' => $branchId,
'department_id' => $departmentId,
'designation_id' => $designationId,
'base_salary' => $row['base_salary'],
'shift_id' => $shiftId,
'attendance_policy_id' => $attendancePolicyId,
'base_salary' => $row['base_salary'],
'date_of_joining' => !empty($row['date_of_joining']) ? $row['date_of_joining'] : now(),
'employment_type' => $row['employment_type'] ?? 'full-time',
'employee_status' => $row['employee_status'] ?? 'active',