Files
newznab-tmux/resources/views/admin/comments/index.blade.php
T
2025-10-10 10:49:09 +02:00

139 lines
8.1 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">
<!-- 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="fas fa-comments mr-2"></i>{{ $title }}
</h1>
<div class="text-sm text-gray-600 dark:text-gray-400">
Total: {{ $commentsList->total() }} comments
</div>
</div>
</div>
<!-- Comments Table -->
<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">User</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Comment</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Release</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">Status</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">
@forelse($commentsList as $comment)
<tr class="hover:bg-gray-50 dark:hover:bg-gray-700">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-gray-200 font-mono">
#{{ $comment->id }}
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div>
<div class="text-sm font-medium text-gray-900 dark:text-gray-200">
{{ $comment->username }}
</div>
@if($comment->host)
<div class="text-xs text-gray-500 dark:text-gray-400">
{{ $comment->host }}
</div>
@endif
</div>
</div>
</td>
<td class="px-6 py-4">
<div class="text-sm text-gray-900 dark:text-gray-200 max-w-md">
<div class="line-clamp-2" title="{{ $comment->text }}">
{{ Str::limit($comment->text, 150) }}
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm">
@if($comment->guid)
<a href="{{ url('details/' . $comment->guid) }}"
target="_blank"
class="text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300">
<i class="fas fa-external-link-alt mr-1"></i>View Release
</a>
@else
<span class="text-gray-500 dark:text-gray-400"></span>
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex flex-col space-y-1">
@if($comment->isvisible)
<span class="px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200">
<i class="fas fa-eye mr-1"></i>Visible
</span>
@else
<span class="px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200">
<i class="fas fa-eye-slash mr-1"></i>Hidden
</span>
@endif
@if($comment->shared)
<span class="px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200">
<i class="fas fa-share-alt mr-1"></i>Shared
</span>
@endif
@if($comment->issynced)
<span class="px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200">
<i class="fas fa-sync mr-1"></i>Synced
</span>
@endif
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
<div>{{ $comment->created_at ? $comment->created_at->format('Y-m-d') : '—' }}</div>
<div class="text-xs">{{ $comment->created_at ? $comment->created_at->format('H:i:s') : '' }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<form method="POST" action="{{ url('admin/comments-delete?id=' . $comment->id) }}" class="inline">
@csrf
<button type="submit"
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 this comment?')">
<i class="fas fa-trash"></i>
</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="px-6 py-4 text-center text-gray-500 dark:text-gray-400">
No comments found.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<!-- Pagination -->
<div class="px-6 py-4 bg-gray-50 dark:bg-gray-900 border-t border-gray-200 dark:border-gray-700">
{{ $commentsList->links() }}
</div>
</div>
</div>
@push('styles')
<style>
.line-clamp-2 {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
</style>
@endpush
@endsection