feat: [hr] 직급/직책 인라인 추가 기능 구현
- Position 생성 API 엔드포인트 추가 (POST /admin/hr/positions) - 직급/직책 select 옆 "+" 버튼으로 모달 열기 - 모달에서 이름 입력 → API 저장 → 드롭다운에 자동 추가 및 선택 - 중복 key 방지 (기존 값이면 그대로 반환) - create/edit 뷰 모두 적용
This commit is contained in:
@@ -96,28 +96,46 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:rin
|
||||
{{-- 직급 / 직책 --}}
|
||||
<div class="flex gap-4" style="flex-wrap: wrap;">
|
||||
<div style="flex: 1 1 200px;">
|
||||
<label for="position_key" class="block text-sm font-medium text-gray-700 mb-1">직급</label>
|
||||
<select name="position_key" id="position_key"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||
<option value="">선택하세요</option>
|
||||
@foreach($ranks as $rank)
|
||||
<option value="{{ $rank->key }}" {{ $employee->position_key === $rank->key ? 'selected' : '' }}>
|
||||
{{ $rank->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">직급</label>
|
||||
<div class="flex gap-2">
|
||||
<select name="position_key" id="position_key"
|
||||
class="flex-1 px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||
<option value="">선택하세요</option>
|
||||
@foreach($ranks as $rank)
|
||||
<option value="{{ $rank->key }}" {{ $employee->position_key === $rank->key ? 'selected' : '' }}>
|
||||
{{ $rank->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<button type="button" onclick="openPositionModal('rank')"
|
||||
class="shrink-0 w-9 h-9 flex items-center justify-center border border-gray-300 rounded-lg text-gray-500 hover:bg-blue-50 hover:text-blue-600 hover:border-blue-300 transition-colors"
|
||||
title="직급 추가">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="flex: 1 1 200px;">
|
||||
<label for="job_title_key" class="block text-sm font-medium text-gray-700 mb-1">직책</label>
|
||||
<select name="job_title_key" id="job_title_key"
|
||||
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||
<option value="">선택하세요</option>
|
||||
@foreach($titles as $title)
|
||||
<option value="{{ $title->key }}" {{ $employee->job_title_key === $title->key ? 'selected' : '' }}>
|
||||
{{ $title->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">직책</label>
|
||||
<div class="flex gap-2">
|
||||
<select name="job_title_key" id="job_title_key"
|
||||
class="flex-1 px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
|
||||
<option value="">선택하세요</option>
|
||||
@foreach($titles as $title)
|
||||
<option value="{{ $title->key }}" {{ $employee->job_title_key === $title->key ? 'selected' : '' }}>
|
||||
{{ $title->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<button type="button" onclick="openPositionModal('title')"
|
||||
class="shrink-0 w-9 h-9 flex items-center justify-center border border-gray-300 rounded-lg text-gray-500 hover:bg-blue-50 hover:text-blue-600 hover:border-blue-300 transition-colors"
|
||||
title="직책 추가">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -170,6 +188,9 @@ class="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 직급/직책 추가 모달 --}}
|
||||
@include('hr.employees.partials.position-add-modal')
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
|
||||
Reference in New Issue
Block a user