98 lines
4.5 KiB
PHP
98 lines
4.5 KiB
PHP
<div class="container">
|
|
<div class="card border" style="border-color: #E6ECF5;">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h2 class="mb-0">User Management</h2>
|
|
<a href="{{ route('user-management.create') }}" class="btn btn-primary">Add User</a>
|
|
</div>
|
|
<div class="card-body">
|
|
@if(session('success'))
|
|
<div class="alert alert-success mb-3" role="alert">
|
|
{{ session('success') }}
|
|
</div>
|
|
@endif
|
|
@if(session('error'))
|
|
<div class="alert alert-danger mb-3" role="alert">
|
|
{{ session('error') }}
|
|
</div>
|
|
@endif
|
|
|
|
@if($loading)
|
|
<div class="text-center">
|
|
<div class="spinner-border text-primary" role="status">
|
|
<span class="visually-hidden">Loading...</span>
|
|
</div>
|
|
</div>
|
|
@else
|
|
<table class="table table-bordered table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>Username</th>
|
|
<th>First Name</th>
|
|
<th>Last Name</th>
|
|
<th>User Role</th>
|
|
<th>Email</th>
|
|
<th>Status</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($users as $user)
|
|
<tr>
|
|
<td>{{ $user['username'] ?? '' }}</td>
|
|
<td>{{ $user['firstname'] ?? '' }}</td>
|
|
<td>{{ $user['lastname'] ?? '' }}</td>
|
|
<td>{{ $user['role'] == '1' ? 'Admin' : 'Marketing Personnel' }}</td>
|
|
<td>{{ $user['email'] ?? '' }}</td>
|
|
<td>
|
|
<div class="dropdown">
|
|
<button class="btn btn-link dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" wire:loading.attr="disabled" wire:target="updateStatus">
|
|
{{ $user['status'] == 'active' ? 'Active' : 'Inactive' }}
|
|
</button>
|
|
<ul class="dropdown-menu">
|
|
<li><a class="dropdown-item" href="#" wire:click="updateStatus('{{ $user['admin_uuid'] }}', 'active')">Active</a></li>
|
|
<li><a class="dropdown-item" href="#" wire:click="updateStatus('{{ $user['admin_uuid'] }}', 'inactive')">Inactive</a></li>
|
|
</ul>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<a href="{{ route('user-management.view', ['id' => $user['id']]) }}" class="btn btn-sm btn-outline-primary me-1">View</a>
|
|
<a href="{{ route('user-management.edit', ['id' => $user['id']]) }}" class="btn btn-sm btn-outline-secondary me-1">Edit</a>
|
|
<!-- Delete not implemented in JS; add if needed -->
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="7" class="text-center">No users found.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js"></script>
|
|
|
|
@if(session('success'))
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
<script>
|
|
Swal.fire({
|
|
icon: 'success',
|
|
title: 'Success',
|
|
text: '{{ session('success') }}',
|
|
});
|
|
</script>
|
|
@endif
|
|
|
|
@if(session('error'))
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
<script>
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Error',
|
|
text: '{{ session('error') }}',
|
|
});
|
|
</script>
|
|
@endif |