NIM_E31222518/resources/views/admin/users/index.blade.php

78 lines
4.3 KiB
PHP

@extends('layouts.admin')
@section('content')
<div class="container mx-auto px-4 py-8">
<div class="flex justify-between items-center mb-6">
<h1 class="text-2xl font-bold text-gray-800">Manajemen User</h1>
<!-- <a href="{{ route('admin.users.create') }}" class="bg-[#88D8CC] hover:bg-[#7AC9BE] text-white font-bold py-2 px-4 rounded-lg">
<i class="fas fa-plus mr-2"></i>Tambah User
</a> -->
</div>
@if(session('success'))
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4" role="alert">
<span class="block sm:inline">{{ session('success') }}</span>
</div>
@endif
<div class="bg-white rounded-xl shadow-sm border border-[#E6F7F4] overflow-hidden">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-[#F0FDFB]">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Username</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nama</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Role</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Aksi</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-100">
@forelse($users as $user)
<tr class="hover:bg-[#F8FCFB] transition-colors duration-150">
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900">{{ $user->username }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">{{ $user->nama }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">{{ $user->email }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full
{{ $user->role === 'admin' ? 'bg-purple-100 text-purple-800' : 'bg-blue-100 text-blue-800' }}">
{{ ucfirst($user->role) }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<div class="flex space-x-2">
<a href="{{ route('admin.users.edit', $user) }}" class="text-[#88D8CC] hover:text-[#7AC9BE]">
<i class="fas fa-edit"></i>
</a>
<form action="{{ route('admin.users.destroy', $user) }}" method="POST" class="inline">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-800" onclick="return confirm('Apakah Anda yakin ingin menghapus user ini?')">
<i class="fas fa-trash"></i>
</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="5" class="px-6 py-4 whitespace-nowrap text-center text-gray-500">
<div class="flex flex-col items-center justify-center py-8">
<i class="fas fa-users text-gray-300 text-5xl mb-4"></i>
<p class="text-gray-500">Tidak ada user yang ditemukan</p>
</div>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
@endsection