fix: resolve FormData rest_days array serialization bug in employee forms
This commit is contained in:
@@ -220,6 +220,8 @@ class EmployeeController extends Controller
|
||||
'gender' => 'required|in:male,female,other',
|
||||
'profile_image' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048',
|
||||
'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',
|
||||
|
||||
@@ -346,6 +348,8 @@ class EmployeeController extends Controller
|
||||
$employee->branch_id = $request->branch_id;
|
||||
$employee->department_id = $request->department_id;
|
||||
$employee->designation_id = $request->designation_id;
|
||||
$employee->shift_id = $request->shift_id;
|
||||
$employee->rest_days = $request->rest_days;
|
||||
$employee->date_of_joining = $request->date_of_joining;
|
||||
$employee->employment_type = $request->employment_type;
|
||||
$employee->employee_status = $request->employee_status;
|
||||
@@ -540,6 +544,8 @@ class EmployeeController extends Controller
|
||||
'gender' => 'required|in:male,female,other',
|
||||
'profile_image' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:2048',
|
||||
'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',
|
||||
|
||||
@@ -620,6 +626,7 @@ class EmployeeController extends Controller
|
||||
// Keep existing auto-generated employee_id, don't regenerate on update
|
||||
$employee->biometric_emp_id = $request->biometric_emp_id;
|
||||
$employee->shift_id = $request->shift_id;
|
||||
$employee->rest_days = $request->rest_days;
|
||||
$employee->attendance_policy_id = $request->attendance_policy_id;
|
||||
$employee->phone = $request->phone;
|
||||
$employee->date_of_birth = $request->date_of_birth;
|
||||
|
||||
Reference in New Issue
Block a user