mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 02:01:33 +00:00
270 lines
16 KiB
PHP
270 lines
16 KiB
PHP
@extends('layouts.admin')
|
|
|
|
@section('content')
|
|
<div class="container mx-auto px-4 py-6">
|
|
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
|
|
<!-- Header -->
|
|
<div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700">
|
|
<div class="flex justify-between items-center">
|
|
<h1 class="text-2xl font-semibold text-gray-800 dark:text-gray-200">
|
|
<i class="fa fa-users mr-2"></i>{{ $title }}
|
|
</h1>
|
|
<a href="{{ url('admin/user-edit?action=add') }}" class="px-4 py-2 bg-blue-600 dark:bg-blue-700 text-white rounded-lg hover:bg-blue-700 dark:hover:bg-blue-800">
|
|
<i class="fa fa-plus mr-2"></i>Add New User
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Search Filters -->
|
|
<div class="px-6 py-4 bg-gray-50 dark:bg-gray-900 border-b border-gray-200 dark:border-gray-700">
|
|
<form method="get" action="{{ url('admin/user-list') }}">
|
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
|
<div>
|
|
<label for="username" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Username</label>
|
|
<input type="text"
|
|
id="username"
|
|
name="username"
|
|
value="{{ $username ?? '' }}"
|
|
placeholder="Filter by username"
|
|
class="w-full px-3 py-2 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-blue-500 dark:focus:border-blue-400">
|
|
</div>
|
|
<div>
|
|
<label for="email" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Email</label>
|
|
<input type="text"
|
|
id="email"
|
|
name="email"
|
|
value="{{ $email ?? '' }}"
|
|
placeholder="Filter by email"
|
|
class="w-full px-3 py-2 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-blue-500 dark:focus:border-blue-400">
|
|
</div>
|
|
<div>
|
|
<label for="host" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Host/IP</label>
|
|
<input type="text"
|
|
id="host"
|
|
name="host"
|
|
value="{{ $host ?? '' }}"
|
|
placeholder="Filter by host"
|
|
class="w-full px-3 py-2 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-blue-500 dark:focus:border-blue-400">
|
|
</div>
|
|
<div>
|
|
<label for="role" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Role</label>
|
|
<select id="role"
|
|
name="role"
|
|
class="w-full px-3 py-2 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-blue-500 dark:focus:border-blue-400">
|
|
<option value="">All Roles</option>
|
|
@foreach($role_ids ?? [] as $index => $roleId)
|
|
<option value="{{ $roleId }}" {{ ($role ?? '') == $roleId ? 'selected' : '' }}>
|
|
{{ $role_names[$roleId] ?? '' }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="mt-4 flex gap-2">
|
|
<button type="submit" class="px-4 py-2 bg-blue-600 dark:bg-blue-700 text-white rounded-md hover:bg-blue-700 dark:hover:bg-blue-800">
|
|
<i class="fa fa-search mr-2"></i>Filter
|
|
</button>
|
|
<a href="{{ url('admin/user-list') }}" class="px-4 py-2 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-md hover:bg-gray-300 dark:hover:bg-gray-600">
|
|
<i class="fa fa-times mr-2"></i>Clear
|
|
</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Success/Error Messages -->
|
|
@if(request()->has('deleted') && request()->input('deleted') == 1)
|
|
<div class="mx-6 mt-4 p-4 bg-green-50 dark:bg-green-900 border border-green-200 dark:border-green-700 rounded-lg">
|
|
<p class="text-green-800 dark:text-green-200">
|
|
<i class="fa fa-check-circle mr-2"></i>
|
|
User "{{ request()->input('username') }}" has been deleted successfully.
|
|
</p>
|
|
</div>
|
|
@endif
|
|
|
|
@if(session('success'))
|
|
<div class="mx-6 mt-4 p-4 bg-green-50 dark:bg-green-900 border border-green-200 dark:border-green-700 rounded-lg">
|
|
<p class="text-green-800 dark:text-green-200">
|
|
<i class="fa fa-check-circle mr-2"></i>{{ session('success') }}
|
|
</p>
|
|
</div>
|
|
@endif
|
|
|
|
@if(session('error'))
|
|
<div class="mx-6 mt-4 p-4 bg-red-50 dark:bg-red-900 border border-red-200 dark:border-red-700 rounded-lg">
|
|
<p class="text-red-800 dark:text-red-200">
|
|
<i class="fa fa-exclamation-circle mr-2"></i>{{ session('error') }}
|
|
</p>
|
|
</div>
|
|
@endif
|
|
|
|
<!-- User Table -->
|
|
@if(count($userlist) > 0)
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
|
|
<thead class="bg-gray-50 dark:bg-gray-900">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">ID</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Username</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Email</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Role</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Host</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Country</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Verified</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Created</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
|
|
@foreach($userlist as $user)
|
|
<tr class="hover:bg-gray-50 dark:hover:bg-gray-700 transition">
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100">{{ $user->id }}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<div class="text-sm font-medium text-gray-900 dark:text-gray-100">{{ $user->username }}</div>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">{{ $user->email }}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200">
|
|
{{ $user->roles->first()->name ?? 'N/A' }}
|
|
</span>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">{{ $user->host ?? 'N/A' }}</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
|
|
@if(!empty($user->country_code))
|
|
<span title="{{ $user->country_name }}">{{ $user->country_code }}</span>
|
|
@else
|
|
N/A
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
@if($user->verified)
|
|
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200">
|
|
<i class="fa fa-check mr-1"></i>Yes
|
|
</span>
|
|
@else
|
|
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 dark:bg-red-900 text-red-800 dark:text-red-200">
|
|
<i class="fa fa-times mr-1"></i>No
|
|
</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
|
|
{{ $user->created_at ? $user->created_at->format('Y-m-d') : 'N/A' }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
|
|
<div class="flex gap-2">
|
|
<a href="{{ url('admin/user-edit?id=' . $user->id) }}"
|
|
class="text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300"
|
|
title="Edit">
|
|
<i class="fa fa-edit"></i>
|
|
</a>
|
|
@if(!$user->verified)
|
|
<form method="POST" action="{{ route('admin.verify') }}" class="inline verify-user-form">
|
|
@csrf
|
|
<input type="hidden" name="id" value="{{ $user->id }}">
|
|
<button type="button"
|
|
class="text-green-600 dark:text-green-400 hover:text-green-900 dark:hover:text-green-300 border-0 bg-transparent cursor-pointer p-0"
|
|
title="Verify User"
|
|
onclick="showVerifyModal(event, this.closest('form'))">
|
|
<i class="fa fa-check-circle"></i>
|
|
</button>
|
|
</form>
|
|
<a href="{{ url('admin/resendverification?id=' . $user->id) }}"
|
|
class="text-yellow-600 dark:text-yellow-400 hover:text-yellow-900 dark:hover:text-yellow-300"
|
|
title="Resend Verification">
|
|
<i class="fa fa-envelope"></i>
|
|
</a>
|
|
@endif
|
|
<a href="{{ url('admin/user-delete?id=' . $user->id) }}"
|
|
class="text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300"
|
|
title="Delete"
|
|
onclick="return confirm('Are you sure you want to delete user \'{{ $user->username }}\'?')">
|
|
<i class="fa fa-trash"></i>
|
|
</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
<div class="px-6 py-4 border-t border-gray-200">
|
|
{{ $userlist->links() }}
|
|
</div>
|
|
@else
|
|
<div class="px-6 py-12 text-center">
|
|
<i class="fa fa-users text-gray-400 text-5xl mb-4"></i>
|
|
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-2">No users found</h3>
|
|
<p class="text-gray-500">Try adjusting your search filters or add a new user.</p>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Verify User Confirmation Modal -->
|
|
<div id="verifyUserModal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50">
|
|
<div class="relative top-20 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white dark:bg-gray-800">
|
|
<div class="mt-3 text-center">
|
|
<div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-green-100 dark:bg-green-900">
|
|
<i class="fa fa-check-circle text-green-600 dark:text-green-400 text-2xl"></i>
|
|
</div>
|
|
<h3 class="text-lg leading-6 font-medium text-gray-900 dark:text-gray-100 mt-4">Verify User</h3>
|
|
<div class="mt-2 px-7 py-3">
|
|
<p class="text-sm text-gray-500 dark:text-gray-400">
|
|
Are you sure you want to manually verify this user? This will mark their email as verified.
|
|
</p>
|
|
</div>
|
|
<div class="flex gap-3 px-4 py-3">
|
|
<button onclick="hideVerifyModal()"
|
|
class="flex-1 px-4 py-2 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 text-base font-medium rounded-md shadow-sm hover:bg-gray-300 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-300">
|
|
Cancel
|
|
</button>
|
|
<button onclick="submitVerifyForm()"
|
|
class="flex-1 px-4 py-2 bg-green-600 dark:bg-green-700 text-white text-base font-medium rounded-md shadow-sm hover:bg-green-700 dark:hover:bg-green-800 focus:outline-none focus:ring-2 focus:ring-green-500">
|
|
Verify
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script>
|
|
let currentVerifyForm = null;
|
|
|
|
function showVerifyModal(event, form) {
|
|
event.preventDefault();
|
|
currentVerifyForm = form;
|
|
document.getElementById('verifyUserModal').classList.remove('hidden');
|
|
}
|
|
|
|
function hideVerifyModal() {
|
|
document.getElementById('verifyUserModal').classList.add('hidden');
|
|
currentVerifyForm = null;
|
|
}
|
|
|
|
function submitVerifyForm() {
|
|
if (currentVerifyForm) {
|
|
currentVerifyForm.submit();
|
|
}
|
|
}
|
|
|
|
// Close modal when clicking outside
|
|
document.getElementById('verifyUserModal')?.addEventListener('click', function(event) {
|
|
if (event.target === this) {
|
|
hideVerifyModal();
|
|
}
|
|
});
|
|
|
|
// Close modal with Escape key
|
|
document.addEventListener('keydown', function(event) {
|
|
if (event.key === 'Escape') {
|
|
hideVerifyModal();
|
|
}
|
|
});
|
|
</script>
|
|
@endpush
|
|
|