index.blade.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. <form action="{{ route('admin.comments.approve', $comment) }}" method="POST" class="inline-block">
  31. @csrf
  32. @method('PATCH')
  33. <button type="submit" class="text-green-600 hover:text-green-900 font-bold">Одобрить</button>
  34. </form>
  35. <form action="{{ route('admin.comments.destroy', $comment) }}" method="POST" class="inline-block" onsubmit="return confirm('Удалить этот спам?');">
  36. @csrf
  37. @method('DELETE')
  38. <button type="submit" class="text-red-600 hover:text-red-900 ml-2">Удалить</button>
  39. </form>
  40. </td>
  41. </tr>
  42. @empty
  43. <tr>
  44. <td colspan="4" class="px-6 py-10 text-center text-gray-500">
  45. Нет комментариев, ожидающих проверки. Все чисто!
  46. </td>
  47. </tr>
  48. @endforelse
  49. </tbody>
  50. </table>
  51. </div>
  52. </div>
  53. @endsection