SIPREKSI/frontendd/resources/views/admin/dashboard.blade.php

62 lines
2.6 KiB
PHP

@extends('layouts.home')
@section('content')
<div class="table-responsive">
<table class="table table-light mb-0">
<thead>
<tr>
<th>ID</th>
<th>NAME</th>
<th>EMAIL</th>
<th>ROLE</th>
<th>ACTION</th>
</tr>
</thead>
<tbody>
@foreach ($users as $user)
<tr>
<td> {{ $user->id }} </td>
<td> {{ $user->name }} </td>
<td> {{ $user->email }} </td>
<td> {{ $user->role }} </td>
<td>
<!-- Tombol Trigger Modal -->
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#deleteModal{{ $user->id }}">
Hapus
</button>
<!-- Modal -->
<div class="modal fade" id="deleteModal{{ $user->id }}" tabindex="-1" aria-labelledby="modalLabel{{ $user->id }}" aria-hidden="true">
<div class="modal-dialog">
<form action="{{ route('admin.destroy', $user->id) }}" method="POST">
@csrf
@method('DELETE')
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modalLabel{{ $user->id }}">Konfirmasi Hapus</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Apakah Anda yakin ingin menghapus user <strong>{{ $user->name }}</strong>?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
<button type="submit" class="btn btn-danger">Hapus</button>
</div>
</div>
</form>
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<form method="POST" action="{{ route('logout') }}">
@csrf
<a href="{{ route('logout') }}" onclick="event.preventDefault(); this.closest('form').submit();">Logout</a>
</form>
@endsection