diff --git a/app/Http/Controllers/Api/Admin/HR/EmployeeController.php b/app/Http/Controllers/Api/Admin/HR/EmployeeController.php index c25db9b7..266ea8c9 100644 --- a/app/Http/Controllers/Api/Admin/HR/EmployeeController.php +++ b/app/Http/Controllers/Api/Admin/HR/EmployeeController.php @@ -95,6 +95,7 @@ public function store(Request $request): JsonResponse 'address' => 'nullable|string|max:200', 'emergency_contact' => 'nullable|string|max:100', 'resident_number' => 'nullable|string|max:14', + 'personal_email' => 'nullable|email|max:100', 'bank_account.bank_code' => 'nullable|string|max:20', 'bank_account.bank_name' => 'nullable|string|max:50', 'bank_account.account_holder' => 'nullable|string|max:50', @@ -176,6 +177,7 @@ public function update(Request $request, int $id): JsonResponse 'address' => 'nullable|string|max:200', 'emergency_contact' => 'nullable|string|max:100', 'resident_number' => 'nullable|string|max:14', + 'personal_email' => 'nullable|email|max:100', 'bank_account.bank_code' => 'nullable|string|max:20', 'bank_account.bank_name' => 'nullable|string|max:50', 'bank_account.account_holder' => 'nullable|string|max:50', diff --git a/app/Models/HR/Employee.php b/app/Models/HR/Employee.php index 555ea784..64cf438f 100644 --- a/app/Models/HR/Employee.php +++ b/app/Models/HR/Employee.php @@ -111,6 +111,11 @@ public function getResidentNumberAttribute(): ?string return $this->json_extra['resident_number'] ?? null; } + public function getPersonalEmailAttribute(): ?string + { + return $this->json_extra['personal_email'] ?? null; + } + public function getBankAccountAttribute(): ?array { return $this->json_extra['bank_account'] ?? null; diff --git a/app/Services/HR/EmployeeService.php b/app/Services/HR/EmployeeService.php index 01f7b0f0..57aabe63 100644 --- a/app/Services/HR/EmployeeService.php +++ b/app/Services/HR/EmployeeService.php @@ -233,7 +233,7 @@ public function createEmployee(array $data): Employee // json_extra 구성 $jsonExtra = []; - foreach (['hire_date', 'resign_date', 'address', 'emergency_contact', 'resident_number'] as $key) { + foreach (['hire_date', 'resign_date', 'address', 'emergency_contact', 'resident_number', 'personal_email'] as $key) { if (! empty($data[$key])) { $jsonExtra[$key] = $data[$key]; } @@ -305,7 +305,7 @@ public function updateEmployee(int $id, array $data): ?Employee ], fn ($v) => $v !== null); // json_extra 업데이트 (스칼라 값) - $jsonExtraKeys = ['hire_date', 'resign_date', 'address', 'emergency_contact', 'salary', 'resident_number']; + $jsonExtraKeys = ['hire_date', 'resign_date', 'address', 'emergency_contact', 'salary', 'resident_number', 'personal_email']; $extra = $employee->json_extra ?? []; foreach ($jsonExtraKeys as $key) { if (array_key_exists($key, $data)) { diff --git a/resources/views/hr/employees/edit.blade.php b/resources/views/hr/employees/edit.blade.php index abef0ed3..fffb5dac 100644 --- a/resources/views/hr/employees/edit.blade.php +++ b/resources/views/hr/employees/edit.blade.php @@ -51,14 +51,32 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:rin class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> - {{-- 이메일 / 연락처 --}} + {{-- 업무용 이메일 / 개인 이메일 --}}