diff --git a/app/Http/Controllers/Api/Admin/HR/EmployeeController.php b/app/Http/Controllers/Api/Admin/HR/EmployeeController.php index 69b1939b..e54950fc 100644 --- a/app/Http/Controllers/Api/Admin/HR/EmployeeController.php +++ b/app/Http/Controllers/Api/Admin/HR/EmployeeController.php @@ -85,7 +85,6 @@ public function store(Request $request): JsonResponse 'employee_status' => 'nullable|string|in:active,leave,resigned', 'manager_user_id' => 'nullable|integer|exists:users,id', 'display_name' => 'nullable|string|max:50', - 'employee_code' => 'nullable|string|max:30', 'hire_date' => 'nullable|date', 'address' => 'nullable|string|max:200', 'emergency_contact' => 'nullable|string|max:100', @@ -154,7 +153,6 @@ public function update(Request $request, int $id): JsonResponse 'employee_status' => 'nullable|string|in:active,leave,resigned', 'manager_user_id' => 'nullable|integer|exists:users,id', 'display_name' => 'nullable|string|max:50', - 'employee_code' => 'nullable|string|max:30', 'hire_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 b576837b..b9242b0d 100644 --- a/app/Models/HR/Employee.php +++ b/app/Models/HR/Employee.php @@ -38,7 +38,6 @@ class Employee extends Model ]; protected $appends = [ - 'employee_code', 'hire_date', 'position_label', 'job_title_label', @@ -67,11 +66,6 @@ public function manager(): BelongsTo // json_extra Accessor // ========================================================================= - public function getEmployeeCodeAttribute(): ?string - { - return $this->json_extra['employee_code'] ?? null; - } - public function getHireDateAttribute(): ?string { return $this->json_extra['hire_date'] ?? null; diff --git a/app/Services/HR/EmployeeService.php b/app/Services/HR/EmployeeService.php index 011dd0dc..6e95959d 100644 --- a/app/Services/HR/EmployeeService.php +++ b/app/Services/HR/EmployeeService.php @@ -24,7 +24,7 @@ public function getEmployees(array $filters = [], int $perPage = 20): LengthAwar ->with(['user', 'department']) ->forTenant($tenantId); - // 검색 필터 (이름, 사번, 이메일) + // 검색 필터 (이름, 이메일, 연락처) if (! empty($filters['q'])) { $search = $filters['q']; $query->where(function ($q) use ($search) { @@ -33,8 +33,7 @@ public function getEmployees(array $filters = [], int $perPage = 20): LengthAwar $uq->where('name', 'like', "%{$search}%") ->orWhere('email', 'like', "%{$search}%") ->orWhere('phone', 'like', "%{$search}%"); - }) - ->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(json_extra, '$.employee_code')) LIKE ?", ["%{$search}%"]); + }); }); } @@ -189,9 +188,6 @@ public function createEmployee(array $data): Employee // json_extra 구성 $jsonExtra = []; - if (! empty($data['employee_code'])) { - $jsonExtra['employee_code'] = $data['employee_code']; - } if (! empty($data['hire_date'])) { $jsonExtra['hire_date'] = $data['hire_date']; } @@ -244,7 +240,7 @@ public function updateEmployee(int $id, array $data): ?Employee ], fn ($v) => $v !== null); // json_extra 업데이트 - $jsonExtraKeys = ['employee_code', 'hire_date', 'address', 'emergency_contact', 'salary', 'bank_account']; + $jsonExtraKeys = ['hire_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 8d5cd55e..fd8da0ef 100644 --- a/resources/views/hr/employees/create.blade.php +++ b/resources/views/hr/employees/create.blade.php @@ -109,16 +109,6 @@ class="text-xs text-red-500 hover:text-red-700 font-medium shrink-0"> class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> - {{-- 사번 --}} -