From b6220810cf3ea6235210c26be7f849ec68092004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Thu, 26 Feb 2026 18:59:15 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[hr]=20=EC=82=AC=EC=9B=90=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D/=EC=88=98=EC=A0=95=20-=20=EB=B9=84=EB=B0=80=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20=ED=87=B4=EC=A7=81?= =?UTF-8?q?=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 비밀번호 필드 제거 (등록 폼, validation, 서비스) - 퇴직일(resign_date) 필드 추가 (등록/수정/상세 화면) - json_extra에 resign_date 저장/수정 지원 - Model에 resign_date accessor 추가 --- .../Api/Admin/HR/EmployeeController.php | 3 +- app/Models/HR/Employee.php | 6 +++ app/Services/HR/EmployeeService.php | 7 ++- resources/views/hr/employees/create.blade.php | 54 +++++-------------- resources/views/hr/employees/edit.blade.php | 12 +++-- resources/views/hr/employees/show.blade.php | 4 ++ 6 files changed, 39 insertions(+), 47 deletions(-) diff --git a/app/Http/Controllers/Api/Admin/HR/EmployeeController.php b/app/Http/Controllers/Api/Admin/HR/EmployeeController.php index e54950fc..1de66c26 100644 --- a/app/Http/Controllers/Api/Admin/HR/EmployeeController.php +++ b/app/Http/Controllers/Api/Admin/HR/EmployeeController.php @@ -76,7 +76,6 @@ public function store(Request $request): JsonResponse 'name' => 'required|string|max:50', 'email' => 'nullable|email|max:100', 'phone' => 'nullable|string|max:20', - 'password' => 'nullable|string|min:6', 'department_id' => 'nullable|integer|exists:departments,id', 'position_key' => 'nullable|string|max:50', 'job_title_key' => 'nullable|string|max:50', @@ -86,6 +85,7 @@ public function store(Request $request): JsonResponse 'manager_user_id' => 'nullable|integer|exists:users,id', 'display_name' => 'nullable|string|max:50', 'hire_date' => 'nullable|date', + 'resign_date' => 'nullable|date', 'address' => 'nullable|string|max:200', 'emergency_contact' => 'nullable|string|max:100', ]; @@ -154,6 +154,7 @@ public function update(Request $request, int $id): JsonResponse 'manager_user_id' => 'nullable|integer|exists:users,id', 'display_name' => 'nullable|string|max:50', 'hire_date' => 'nullable|date', + 'resign_date' => 'nullable|date', 'address' => 'nullable|string|max:200', 'emergency_contact' => 'nullable|string|max:100', ]); diff --git a/app/Models/HR/Employee.php b/app/Models/HR/Employee.php index b9242b0d..9662e013 100644 --- a/app/Models/HR/Employee.php +++ b/app/Models/HR/Employee.php @@ -39,6 +39,7 @@ class Employee extends Model protected $appends = [ 'hire_date', + 'resign_date', 'position_label', 'job_title_label', ]; @@ -71,6 +72,11 @@ public function getHireDateAttribute(): ?string return $this->json_extra['hire_date'] ?? null; } + public function getResignDateAttribute(): ?string + { + return $this->json_extra['resign_date'] ?? null; + } + public function getAddressAttribute(): ?string { return $this->json_extra['address'] ?? null; diff --git a/app/Services/HR/EmployeeService.php b/app/Services/HR/EmployeeService.php index 6e95959d..d5e12a53 100644 --- a/app/Services/HR/EmployeeService.php +++ b/app/Services/HR/EmployeeService.php @@ -170,7 +170,7 @@ public function createEmployee(array $data): Employee 'name' => $data['name'], 'email' => $email, 'phone' => $data['phone'] ?? null, - 'password' => Hash::make($data['password'] ?? 'sam1234!'), + 'password' => Hash::make('sam1234!'), 'role' => 'ops', 'is_active' => true, 'must_change_password' => true, @@ -191,6 +191,9 @@ public function createEmployee(array $data): Employee if (! empty($data['hire_date'])) { $jsonExtra['hire_date'] = $data['hire_date']; } + if (! empty($data['resign_date'])) { + $jsonExtra['resign_date'] = $data['resign_date']; + } if (! empty($data['address'])) { $jsonExtra['address'] = $data['address']; } @@ -240,7 +243,7 @@ public function updateEmployee(int $id, array $data): ?Employee ], fn ($v) => $v !== null); // json_extra 업데이트 - $jsonExtraKeys = ['hire_date', 'address', 'emergency_contact', 'salary', 'bank_account']; + $jsonExtraKeys = ['hire_date', 'resign_date', 'address', 'emergency_contact', 'salary', 'bank_account']; $extra = $employee->json_extra ?? []; foreach ($jsonExtraKeys as $key) { if (array_key_exists($key, $data)) { diff --git a/resources/views/hr/employees/create.blade.php b/resources/views/hr/employees/create.blade.php index fd8da0ef..b4b8e644 100644 --- a/resources/views/hr/employees/create.blade.php +++ b/resources/views/hr/employees/create.blade.php @@ -125,17 +125,6 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:rin - {{-- 비밀번호 --}} -
- - -

미입력 시 기본 비밀번호가 설정됩니다.

-
- {{-- 근무 정보 --}}

근무 정보

@@ -195,14 +184,19 @@ class="shrink-0 w-9 h-9 flex items-center justify-center border border-gray-300
- {{-- 입사일 / 상태 --}} + {{-- 입사일 / 퇴직일 / 상태 --}}
-
+
-
+
+ + +
+
-
+
+ + +
+