MIF_E31230393/resources/views/admin/users.blade.php

59 lines
2.6 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="max-w-6xl mx-auto px-10 py-16">
<h1 class="text-3xl font-extrabold text-gray-900 mb-8">Kelola Data Pengguna</h1>
@if (session('success'))
<div class="mb-6 px-6 py-4 bg-green-50 text-green-700 rounded-2xl border border-green-200">
{{ session('success') }}
</div>
@endif
@if ($errors->any())
<div class="mb-6 px-6 py-4 bg-red-50 text-red-700 rounded-2xl border border-red-200">
{{ $errors->first() }}
</div>
@endif
<div class="bg-white rounded-2xl shadow-sm border border-orange-100 overflow-hidden">
<table class="w-full text-left">
<thead class="bg-orange-50">
<tr>
<th class="px-6 py-4 text-xs font-bold text-gray-500 uppercase tracking-widest">Nama</th>
<th class="px-6 py-4 text-xs font-bold text-gray-500 uppercase tracking-widest">Email</th>
<th class="px-6 py-4 text-xs font-bold text-gray-500 uppercase tracking-widest">Terdaftar</th>
<th class="px-6 py-4 text-xs font-bold text-gray-500 uppercase tracking-widest">Aksi</th>
</tr>
</thead>
<tbody>
@forelse ($users as $user)
<tr class="border-t border-gray-100">
<td class="px-6 py-4">{{ $user->name }}</td>
<td class="px-6 py-4">{{ $user->email }}</td>
<td class="px-6 py-4">{{ $user->created_at->format('d-m-Y') }}</td>
<td class="px-6 py-4">
<form action="{{ route('admin.users.destroy', $user->id) }}" method="POST"
onsubmit="return confirm('Yakin ingin menghapus pengguna ini?');">
@csrf
@method('DELETE')
<button type="submit" class="px-4 py-2 bg-red-50 text-red-700 rounded-full text-xs font-bold hover:bg-red-100 transition">
Hapus
</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="px-6 py-8 text-center text-gray-400">Belum ada pengguna terdaftar.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<a href="{{ route('admin.dashboard') }}" class="inline-block mt-8 text-orange-700 font-bold hover:text-orange-800">
Kembali ke Dashboard
</a>
</div>
@endsection