@extends('layouts.app')
@section('content')
<div class="d-flex justify-content-between align-items-start mb-4"><div><div class="text-danger small fw-bold">MANAJEMEN SDM</div><h1 class="page-title">Data pegawai</h1><p class="text-muted">Kelola data dan status pegawai.</p></div><a href="{{ route('employees.create') }}" class="btn btn-danger"><i class="bi bi-person-plus me-1"></i> Tambah pegawai</a></div>
<div class="card p-4"><div class="table-responsive"><table class="table align-middle"><thead><tr><th>Kode</th><th>Nama</th><th>Departemen</th><th>Jabatan</th><th>Status</th><th>Aksi</th></tr></thead><tbody>@forelse($employees as $employee)<tr><td><strong>{{ $employee->employee_code }}</strong></td><td>{{ $employee->full_name }}<small class="d-block text-muted">{{ $employee->email }}</small></td><td>{{ $employee->department }}</td><td>{{ $employee->position }}</td><td><span class="badge {{ $employee->status === 'active' ? 'bg-success' : 'bg-secondary' }}">{{ $employee->status }}</span></td><td><a href="{{ route('employees.edit',$employee) }}" class="btn btn-sm btn-outline-secondary">Edit</a>@if(auth()->user()->role === 'admin')<form class="d-inline" method="POST" action="{{ route('employees.destroy',$employee) }}">@csrf @method('DELETE')<button class="btn btn-sm btn-outline-danger" onclick="return confirm('Hapus pegawai ini?')">Hapus</button></form>@endif</td></tr>@empty<tr><td colspan="6" class="text-center text-muted">Belum ada pegawai.</td></tr>@endforelse</tbody></table></div>{{ $employees->links() }}</div>
@endsection
