| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- @extends('layouts.app')
- @section('title', 'Модерация комментариев')
- @section('content')
- <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
- <div class="mb-8">
- <h1 class="text-4xl font-bold text-gray-900">Модерация комментариев</h1>
- <p class="mt-2 text-gray-600">Проверьте и одобрите комментарии перед публикацией</p>
- </div>
- {{-- Статистика --}}
- <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
- <div class="bg-white rounded-lg shadow-md p-6">
- <div class="flex items-center">
- <div class="flex-shrink-0 bg-yellow-100 rounded-lg p-3">
- <svg class="h-6 w-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
- </svg>
- </div>
- <div class="ml-4">
- <p class="text-sm font-medium text-gray-500">Ожидают модерации</p>
- <p class="text-2xl font-bold text-gray-900">{{ \App\Models\Comment::pending()->count() }}</p>
- </div>
- </div>
- </div>
- <div class="bg-white rounded-lg shadow-md p-6">
- <div class="flex items-center">
- <div class="flex-shrink-0 bg-green-100 rounded-lg p-3">
- <svg class="h-6 w-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <div class="ml-4">
- <p class="text-sm font-medium text-gray-500">Одобрено</p>
- <p class="text-2xl font-bold text-gray-900">{{ \App\Models\Comment::approved()->count() }}</p>
- </div>
- </div>
- </div>
- <div class="bg-white rounded-lg shadow-md p-6">
- <div class="flex items-center">
- <div class="flex-shrink-0 bg-red-100 rounded-lg p-3">
- <svg class="h-6 w-6 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
- </svg>
- </div>
- <div class="ml-4">
- <p class="text-sm font-medium text-gray-500">Отклонено</p>
- <p class="text-2xl font-bold text-gray-900">{{ \App\Models\Comment::where('status', 'rejected')->count() }}</p>
- </div>
- </div>
- </div>
- </div>
- {{-- Список комментариев --}}
- @if($comments->isEmpty())
- <div class="bg-white rounded-lg shadow-md p-12 text-center">
- <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
- </svg>
- <h3 class="mt-2 text-sm font-medium text-gray-900">Нет комментариев на модерации</h3>
- <p class="mt-1 text-sm text-gray-500">Все комментарии обработаны</p>
- </div>
- @else
- <div class="space-y-4">
- @foreach($comments as $comment)
- <div class="bg-white rounded-lg shadow-md overflow-hidden">
- <div class="p-6">
- {{-- Информация о посте --}}
- <div class="flex items-center justify-between mb-4 pb-4 border-b border-gray-200">
- <div class="flex items-center space-x-3">
- <svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
- </svg>
- <a href="{{ route('posts.show', $comment->post) }}"
- class="text-indigo-600 hover:text-indigo-800 font-medium">
- {{ $comment->post->title }}
- </a>
- </div>
-
- <span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
- <svg class="mr-1 h-3 w-3" fill="currentColor" viewBox="0 0 20 20">
- <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.415-1.415L11 9.586V6z" clip-rule="evenodd"/>
- </svg>
- Ожидает модерации
- </span>
- </div>
- {{-- Информация об авторе --}}
- <div class="flex items-start space-x-4 mb-4">
- <div class="flex-shrink-0">
- <div class="w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center">
- <span class="text-indigo-600 font-semibold text-xl">
- {{ substr($comment->author_name, 0, 1) }}
- </span>
- </div>
- </div>
-
- <div class="flex-1 min-w-0">
- <div class="flex items-center justify-between">
- <div>
- <p class="text-sm font-semibold text-gray-900">
- {{ $comment->author_name }}
- </p>
- <p class="text-sm text-gray-500">
- {{ $comment->author_email }}
- </p>
- </div>
- <p class="text-sm text-gray-500">
- {{ $comment->created_at->diffForHumans() }}
- </p>
- </div>
-
- {{-- Текст комментария --}}
- <div class="mt-3 p-4 bg-gray-50 rounded-lg">
- <p class="text-gray-700 leading-relaxed">{{ $comment->content }}</p>
- </div>
- </div>
- </div>
- {{-- Действия --}}
- <div class="flex items-center justify-end space-x-3 pt-4 border-t border-gray-200">
- <form action="{{ route('comments.reject', $comment) }}" method="POST" class="inline">
- @csrf
- <button type="submit"
- onclick="return confirm('Вы уверены, что хотите отклонить этот комментарий?')"
- class="inline-flex items-center px-4 py-2 border border-red-300 text-sm font-medium rounded-md text-red-700 bg-white hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500">
- <svg class="mr-2 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
- </svg>
- Отклонить
- </button>
- </form>
- <form action="{{ route('comments.approve', $comment) }}" method="POST" class="inline">
- @csrf
- <button type="submit"
- class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500">
- <svg class="mr-2 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- Одобрить
- </button>
- </form>
- </div>
- </div>
- </div>
- @endforeach
- </div>
- {{-- Пагинация --}}
- <div class="mt-8">
- {{ $comments->links() }}
- </div>
- @endif
- </div>
- @endsection
|