moderate.blade.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. @extends('layouts.app')
  2. @section('title', 'Модерация комментариев')
  3. @section('content')
  4. <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
  5. <div class="mb-8">
  6. <h1 class="text-4xl font-bold text-gray-900">Модерация комментариев</h1>
  7. <p class="mt-2 text-gray-600">Проверьте и одобрите комментарии перед публикацией</p>
  8. </div>
  9. {{-- Статистика --}}
  10. <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
  11. <div class="bg-white rounded-lg shadow-md p-6">
  12. <div class="flex items-center">
  13. <div class="flex-shrink-0 bg-yellow-100 rounded-lg p-3">
  14. <svg class="h-6 w-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  15. <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"/>
  16. </svg>
  17. </div>
  18. <div class="ml-4">
  19. <p class="text-sm font-medium text-gray-500">Ожидают модерации</p>
  20. <p class="text-2xl font-bold text-gray-900">{{ \App\Models\Comment::pending()->count() }}</p>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="bg-white rounded-lg shadow-md p-6">
  25. <div class="flex items-center">
  26. <div class="flex-shrink-0 bg-green-100 rounded-lg p-3">
  27. <svg class="h-6 w-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  28. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
  29. </svg>
  30. </div>
  31. <div class="ml-4">
  32. <p class="text-sm font-medium text-gray-500">Одобрено</p>
  33. <p class="text-2xl font-bold text-gray-900">{{ \App\Models\Comment::approved()->count() }}</p>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="bg-white rounded-lg shadow-md p-6">
  38. <div class="flex items-center">
  39. <div class="flex-shrink-0 bg-red-100 rounded-lg p-3">
  40. <svg class="h-6 w-6 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  41. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
  42. </svg>
  43. </div>
  44. <div class="ml-4">
  45. <p class="text-sm font-medium text-gray-500">Отклонено</p>
  46. <p class="text-2xl font-bold text-gray-900">{{ \App\Models\Comment::where('status', 'rejected')->count() }}</p>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. {{-- Список комментариев --}}
  52. @if($comments->isEmpty())
  53. <div class="bg-white rounded-lg shadow-md p-12 text-center">
  54. <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  55. <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"/>
  56. </svg>
  57. <h3 class="mt-2 text-sm font-medium text-gray-900">Нет комментариев на модерации</h3>
  58. <p class="mt-1 text-sm text-gray-500">Все комментарии обработаны</p>
  59. </div>
  60. @else
  61. <div class="space-y-4">
  62. @foreach($comments as $comment)
  63. <div class="bg-white rounded-lg shadow-md overflow-hidden">
  64. <div class="p-6">
  65. {{-- Информация о посте --}}
  66. <div class="flex items-center justify-between mb-4 pb-4 border-b border-gray-200">
  67. <div class="flex items-center space-x-3">
  68. <svg class="h-5 w-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  69. <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"/>
  70. </svg>
  71. <a href="{{ route('posts.show', $comment->post) }}"
  72. class="text-indigo-600 hover:text-indigo-800 font-medium">
  73. {{ $comment->post->title }}
  74. </a>
  75. </div>
  76. <span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
  77. <svg class="mr-1 h-3 w-3" fill="currentColor" viewBox="0 0 20 20">
  78. <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"/>
  79. </svg>
  80. Ожидает модерации
  81. </span>
  82. </div>
  83. {{-- Информация об авторе --}}
  84. <div class="flex items-start space-x-4 mb-4">
  85. <div class="flex-shrink-0">
  86. <div class="w-12 h-12 bg-indigo-100 rounded-full flex items-center justify-center">
  87. <span class="text-indigo-600 font-semibold text-xl">
  88. {{ substr($comment->author_name, 0, 1) }}
  89. </span>
  90. </div>
  91. </div>
  92. <div class="flex-1 min-w-0">
  93. <div class="flex items-center justify-between">
  94. <div>
  95. <p class="text-sm font-semibold text-gray-900">
  96. {{ $comment->author_name }}
  97. </p>
  98. <p class="text-sm text-gray-500">
  99. {{ $comment->author_email }}
  100. </p>
  101. </div>
  102. <p class="text-sm text-gray-500">
  103. {{ $comment->created_at->diffForHumans() }}
  104. </p>
  105. </div>
  106. {{-- Текст комментария --}}
  107. <div class="mt-3 p-4 bg-gray-50 rounded-lg">
  108. <p class="text-gray-700 leading-relaxed">{{ $comment->content }}</p>
  109. </div>
  110. </div>
  111. </div>
  112. {{-- Действия --}}
  113. <div class="flex items-center justify-end space-x-3 pt-4 border-t border-gray-200">
  114. <form action="{{ route('comments.reject', $comment) }}" method="POST" class="inline">
  115. @csrf
  116. <button type="submit"
  117. onclick="return confirm('Вы уверены, что хотите отклонить этот комментарий?')"
  118. 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">
  119. <svg class="mr-2 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  120. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
  121. </svg>
  122. Отклонить
  123. </button>
  124. </form>
  125. <form action="{{ route('comments.approve', $comment) }}" method="POST" class="inline">
  126. @csrf
  127. <button type="submit"
  128. 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">
  129. <svg class="mr-2 h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  130. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
  131. </svg>
  132. Одобрить
  133. </button>
  134. </form>
  135. </div>
  136. </div>
  137. </div>
  138. @endforeach
  139. </div>
  140. {{-- Пагинация --}}
  141. <div class="mt-8">
  142. {{ $comments->links() }}
  143. </div>
  144. @endif
  145. </div>
  146. @endsection