mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Update user list and edit page
This commit is contained in:
@@ -65,6 +65,15 @@ class AdminUserController extends BasePageController
|
||||
}
|
||||
$user->country_name = $position ? $position->countryName : null;
|
||||
$user->country_code = $position ? $position->countryCode : null;
|
||||
|
||||
// Add daily API and download counts
|
||||
try {
|
||||
$user->daily_api_count = \App\Models\UserRequest::getApiRequests($user->id);
|
||||
$user->daily_download_count = \App\Models\UserDownload::getDownloadRequests($user->id);
|
||||
} catch (\Exception $e) {
|
||||
$user->daily_api_count = 0;
|
||||
$user->daily_download_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Build order by URLs
|
||||
@@ -154,7 +163,8 @@ class AdminUserController extends BasePageController
|
||||
$ret = User::signUp($request->input('username'), $request->input('password'), $request->input('email'), '', $request->input('notes'), $invites, '', true, $request->input('role'), false);
|
||||
} else {
|
||||
$editedUser = User::find($request->input('id'));
|
||||
$ret = User::updateUser($editedUser->id, $request->input('username'), $request->input('email'), $request->input('grabs'), $request->input('role'), $request->input('notes'), $request->input('invites'), ($request->has('movieview') ? 1 : 0), ($request->has('musicview') ? 1 : 0), ($request->has('gameview') ? 1 : 0), ($request->has('xxxview') ? 1 : 0), ($request->has('consoleview') ? 1 : 0), ($request->has('bookview') ? 1 : 0));
|
||||
// Use the current grabs value since it's read-only
|
||||
$ret = User::updateUser($editedUser->id, $request->input('username'), $request->input('email'), $editedUser->grabs, $request->input('role'), $request->input('notes'), $request->input('invites'), ($request->has('movieview') ? 1 : 0), ($request->has('musicview') ? 1 : 0), ($request->has('gameview') ? 1 : 0), ($request->has('xxxview') ? 1 : 0), ($request->has('consoleview') ? 1 : 0), ($request->has('bookview') ? 1 : 0));
|
||||
if ($request->input('password') !== null) {
|
||||
User::updatePassword($editedUser->id, $request->input('password'));
|
||||
}
|
||||
@@ -211,6 +221,17 @@ class AdminUserController extends BasePageController
|
||||
$title = 'User Edit';
|
||||
$id = $request->input('id');
|
||||
$user = User::find($id);
|
||||
|
||||
// Add daily API and download counts
|
||||
if ($user) {
|
||||
try {
|
||||
$user->daily_api_count = \App\Models\UserRequest::getApiRequests($user->id);
|
||||
$user->daily_download_count = \App\Models\UserDownload::getDownloadRequests($user->id);
|
||||
} catch (\Exception $e) {
|
||||
$user->daily_api_count = 0;
|
||||
$user->daily_download_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -301,7 +301,66 @@
|
||||
id="grabs"
|
||||
name="grabs"
|
||||
value="{{ is_array($user) ? ($user['grabs'] ?? 0) : ($user->grabs ?? 0) }}"
|
||||
class="w-full px-3 py-2 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md focus:ring-blue-500 focus:border-blue-500">
|
||||
disabled
|
||||
class="w-full px-3 py-2 bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border border-gray-300 dark:border-gray-600 rounded-md cursor-not-allowed opacity-75">
|
||||
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">
|
||||
<i class="fa fa-info-circle mr-1"></i>Total grabs is read-only and automatically tracked
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Daily Activity Stats -->
|
||||
<div class="border border-gray-200 dark:border-gray-700 rounded-lg p-4 bg-gradient-to-br from-gray-50 to-white dark:from-gray-900 dark:to-gray-800">
|
||||
<div class="flex items-center mb-3">
|
||||
<i class="fa fa-chart-line mr-2 text-purple-600 dark:text-purple-400"></i>
|
||||
<label class="text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
Daily Activity (Last 24 Hours)
|
||||
</label>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<!-- Daily API Requests -->
|
||||
<div class="bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-3">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<p class="text-xs text-blue-600 dark:text-blue-400 font-medium uppercase tracking-wide">
|
||||
<i class="fa fa-code mr-1"></i>API Requests
|
||||
</p>
|
||||
<p class="text-2xl font-bold text-blue-900 dark:text-blue-100 mt-1">
|
||||
{{ is_array($user) ? ($user['daily_api_count'] ?? 0) : ($user->daily_api_count ?? 0) }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="text-blue-600 dark:text-blue-400">
|
||||
<i class="fa fa-code text-3xl opacity-20"></i>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-xs text-blue-600 dark:text-blue-400 mt-2">
|
||||
<i class="fa fa-clock mr-1"></i>In the last 24 hours
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Daily Downloads -->
|
||||
<div class="bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<p class="text-xs text-green-600 dark:text-green-400 font-medium uppercase tracking-wide">
|
||||
<i class="fa fa-download mr-1"></i>Downloads
|
||||
</p>
|
||||
<p class="text-2xl font-bold text-green-900 dark:text-green-100 mt-1">
|
||||
{{ is_array($user) ? ($user['daily_download_count'] ?? 0) : ($user->daily_download_count ?? 0) }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="text-green-600 dark:text-green-400">
|
||||
<i class="fa fa-download text-3xl opacity-20"></i>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-xs text-green-600 dark:text-green-400 mt-2">
|
||||
<i class="fa fa-clock mr-1"></i>In the last 24 hours
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="mt-3 text-xs text-gray-600 dark:text-gray-400 flex items-center">
|
||||
<i class="fa fa-info-circle mr-1.5 text-blue-500"></i>
|
||||
<span>These counters show activity from the past 24 hours and are automatically updated.</span>
|
||||
</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@@ -173,6 +173,12 @@
|
||||
@endif
|
||||
</a>
|
||||
</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider" title="Daily API requests in last 24 hours">
|
||||
<i class="fa fa-code mr-1"></i>Daily API
|
||||
</th>
|
||||
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider" title="Daily downloads in last 24 hours">
|
||||
<i class="fa fa-download mr-1"></i>Daily DLs
|
||||
</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>
|
||||
@@ -253,6 +259,18 @@
|
||||
<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 text-gray-900 dark:text-gray-100" title="API requests in last 24 hours">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
|
||||
{{ ($user->daily_api_count ?? 0) > 0 ? 'bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200' : 'bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300' }}">
|
||||
<i class="fa fa-code mr-1"></i>{{ $user->daily_api_count ?? 0 }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-100" title="Downloads in last 24 hours">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
|
||||
{{ ($user->daily_download_count ?? 0) > 0 ? 'bg-green-100 dark:bg-green-900 text-green-800 dark:text-green-200' : 'bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-300' }}">
|
||||
<i class="fa fa-download mr-1"></i>{{ $user->daily_download_count ?? 0 }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
|
||||
<div class="flex gap-2">
|
||||
@if($user->deleted_at)
|
||||
|
||||
Reference in New Issue
Block a user