index.blade.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. @extends('layout')
  2. @section('content')
  3. <div class="space-y-6">
  4. <h1 class="text-3xl font-bold text-gray-900">Комментарии на модерацию</h1>
  5. <div class="bg-white shadow-sm border border-gray-100 rounded-lg overflow-hidden">
  6. <table class="min-w-full divide-y divide-gray-200">
  7. <thead class="bg-gray-50">
  8. <tr>
  9. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Автор</th>
  10. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Комментарий</th>
  11. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Статья</th>
  12. <th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase">Действия</th>
  13. </tr>
  14. </thead>
  15. <tbody class="bg-white divide-y divide-gray-200">
  16. @forelse($comments as $comment)
  17. <tr>
  18. <td class="px-6 py-4 whitespace-nowrap text-sm font-bold text-gray-900">
  19. {{ $comment->author_name }}
  20. </td>
  21. <td class="px-6 py-4 text-sm text-gray-600 max-w-xs truncate">
  22. {{ $comment->body }}
  23. </td>
  24. <td class="px-6 py-4 whitespace-nowrap text-sm text-indigo-600">
  25. <a href="{{ route('posts.show', $comment->post) }}" target="_blank">
  26. {{ Str::limit($comment->post->title, 20) }}
  27. </a>
  28. </td>
  29. <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium space-x-2">
  30. <!-- Кнопка Одобрить -->
  31. <form action="{{ route('admin.comments.approve', $comment) }}" method="POST" class="inline-block">
  32. @csrf
  33. @method('PATCH')
  34. <button type="submit" class="text-green-600 hover:text-green-900 font-bold">Одобрить</button>
  35. </form>
  36. <!-- Кнопка Удалить -->
  37. <form action="{{ route('admin.comments.destroy', $comment) }}" method="POST" class="inline-block" onsubmit="return confirm('Удалить этот спам?');">
  38. @csrf
  39. @method('DELETE')
  40. <button type="submit" class="text-red-600 hover:text-red-900 ml-2">Удалить</button>
  41. </form>
  42. </td>
  43. </tr>
  44. @empty
  45. <tr>
  46. <td colspan="4" class="px-6 py-10 text-center text-gray-500">
  47. Нет комментариев, ожидающих проверки. Все чисто! 🎉
  48. </td>
  49. </tr>
  50. @endforelse
  51. </tbody>
  52. </table>
  53. </div>
  54. </div>
  55. @endsection