- AttendanceService: forceDeleteAttendance 메서드 추가 - LeaveService: deleteLeave(모든 상태), forceDeleteLeave 메서드 추가 - Controller: force 파라미터 + 슈퍼관리자 권한 분기 - 근태 테이블: 슈퍼관리자에게 삭제/영구삭제 버튼 표시 - 신청 테이블: 슈퍼관리자에게 삭제/영구삭제 버튼 표시
140 lines
7.8 KiB
PHP
140 lines
7.8 KiB
PHP
{{-- 근태현황 테이블 (조회 전용, HTMX로 로드) --}}
|
|
@php
|
|
use App\Models\HR\Attendance;
|
|
@endphp
|
|
|
|
<x-table-swipe>
|
|
<table class="min-w-full">
|
|
<thead class="bg-gray-50 border-b border-gray-200">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-sm font-semibold text-gray-600">날짜</th>
|
|
<th class="px-6 py-3 text-left text-sm font-semibold text-gray-600">사원</th>
|
|
<th class="px-6 py-3 text-left text-sm font-semibold text-gray-600">부서</th>
|
|
<th class="px-6 py-3 text-center text-sm font-semibold text-gray-600">상태</th>
|
|
<th class="px-6 py-3 text-center text-sm font-semibold text-gray-600">출근</th>
|
|
<th class="px-6 py-3 text-center text-sm font-semibold text-gray-600">퇴근</th>
|
|
<th class="px-6 py-3 text-left text-sm font-semibold text-gray-600">비고</th>
|
|
<th class="px-4 py-3 text-center text-sm font-semibold text-gray-600">GPS</th>
|
|
@if(auth()->user()->isSuperAdmin())
|
|
<th class="px-4 py-3 text-center text-sm font-semibold text-gray-600">관리</th>
|
|
@endif
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-100">
|
|
@forelse($attendances as $attendance)
|
|
@php
|
|
$profile = $attendance->user?->tenantProfiles?->first();
|
|
$department = $profile?->department;
|
|
$displayName = $profile?->display_name ?? $attendance->user?->name ?? '-';
|
|
$color = Attendance::STATUS_COLORS[$attendance->status] ?? 'gray';
|
|
$label = Attendance::STATUS_MAP[$attendance->status] ?? $attendance->status;
|
|
$checkIn = $attendance->check_in ? substr($attendance->check_in, 0, 5) : '-';
|
|
$checkOut = $attendance->check_out ? substr($attendance->check_out, 0, 5) : '-';
|
|
@endphp
|
|
<tr class="hover:bg-gray-50 transition-colors">
|
|
{{-- 날짜 --}}
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700">
|
|
{{ $attendance->base_date->format('m-d') }}
|
|
<span class="text-xs text-gray-400 ml-1">{{ ['일','월','화','수','목','금','토'][$attendance->base_date->dayOfWeek] }}</span>
|
|
</td>
|
|
|
|
{{-- 사원 --}}
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<div class="flex items-center gap-2">
|
|
<div class="shrink-0 w-8 h-8 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center text-xs font-medium">
|
|
{{ mb_substr($displayName, 0, 1) }}
|
|
</div>
|
|
<span class="text-sm font-medium text-gray-900">{{ $displayName }}</span>
|
|
</div>
|
|
</td>
|
|
|
|
{{-- 부서 --}}
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-700">
|
|
{{ $department?->name ?? '-' }}
|
|
</td>
|
|
|
|
{{-- 상태 --}}
|
|
<td class="px-6 py-4 whitespace-nowrap text-center">
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-{{ $color }}-100 text-{{ $color }}-700">
|
|
{{ $label }}
|
|
</span>
|
|
</td>
|
|
|
|
{{-- 출근 --}}
|
|
<td class="px-6 py-4 whitespace-nowrap text-center text-sm text-gray-500">
|
|
{{ $checkIn }}
|
|
</td>
|
|
|
|
{{-- 퇴근 --}}
|
|
<td class="px-6 py-4 whitespace-nowrap text-center text-sm text-gray-500">
|
|
{{ $checkOut }}
|
|
</td>
|
|
|
|
{{-- 비고 --}}
|
|
<td class="px-6 py-4 text-sm text-gray-500" style="max-width: 200px;">
|
|
<span class="truncate block">{{ $attendance->remarks ?? '' }}</span>
|
|
</td>
|
|
|
|
{{-- GPS --}}
|
|
<td class="px-4 py-4 whitespace-nowrap text-center">
|
|
@php $gpsData = $attendance->json_details['gps_data'] ?? null; @endphp
|
|
@if($gpsData)
|
|
<button type="button" onclick='openGpsModal(@json($gpsData))'
|
|
class="text-emerald-600 hover:text-emerald-800" title="GPS 정보 보기">
|
|
<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="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"/>
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"/>
|
|
</svg>
|
|
</button>
|
|
@else
|
|
<span class="text-gray-300">
|
|
<svg class="w-5 h-5 inline" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"/>
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"/>
|
|
</svg>
|
|
</span>
|
|
@endif
|
|
</td>
|
|
|
|
@if(auth()->user()->isSuperAdmin())
|
|
<td class="px-4 py-4 whitespace-nowrap text-center">
|
|
<div class="flex items-center justify-center gap-1">
|
|
<button type="button" onclick="deleteAttendance({{ $attendance->id }}, false)"
|
|
class="p-1 text-gray-400 hover:text-red-600 transition-colors" title="삭제">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
|
|
</svg>
|
|
</button>
|
|
<button type="button" onclick="deleteAttendance({{ $attendance->id }}, true)"
|
|
class="p-1 text-gray-400 hover:text-red-700 transition-colors" title="영구삭제">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</td>
|
|
@endif
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="{{ auth()->user()->isSuperAdmin() ? 9 : 8 }}" class="px-6 py-12 text-center">
|
|
<div class="flex flex-col items-center gap-2">
|
|
<svg class="w-12 h-12 text-gray-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
|
</svg>
|
|
<p class="text-gray-500">근태 기록이 없습니다.</p>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</x-table-swipe>
|
|
|
|
{{-- 페이지네이션 --}}
|
|
@if($attendances->hasPages())
|
|
<div class="px-6 py-4 border-t border-gray-200 bg-gray-50">
|
|
{{ $attendances->links() }}
|
|
</div>
|
|
@endif
|