data_table.blade.php 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. @extends('layout.app')
  2. @section('title', 'Просмотр сохраненных данных')
  3. @section('content')
  4. <h1>Сохраненные данные ({{ $count }} записей)</h1>
  5. @if (session('success'))
  6. <div class="alert-success">
  7. {{ session('success') }}
  8. </div>
  9. @endif
  10. @if ($submissions->isEmpty())
  11. <p>На данный момент нет сохраненных данных.</p>
  12. @else
  13. <table>
  14. <thead>
  15. <tr>
  16. <th>ID</th>
  17. <th>Имя</th>
  18. <th>Email</th>
  19. <th>Сообщение</th>
  20. <th>Статус</th>
  21. <th>Комментарии</th>
  22. <th>Теги</th>
  23. <th>Дата создания</th>
  24. <th>IP-адрес</th>
  25. <th>Действия</th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. @foreach ($submissions as $submission)
  30. <tr>
  31. <td>{{ $submission->id }}</td>
  32. <td>{{ $submission->name }}</td>
  33. <td>{{ $submission->email }}</td>
  34. <td>{{ Str::limit($submission->message ?? '-', 50) }}</td>
  35. <td>
  36. <span style="padding: 2px 8px; border-radius: 3px; background-color:
  37. @if($submission->status === 'active') #d4edda
  38. @elseif($submission->status === 'archived') #f8d7da
  39. @else #fff3cd @endif">
  40. {{ ucfirst($submission->status) }}
  41. </span>
  42. </td>
  43. <td>{{ $submission->comments_count }}</td>
  44. <td>
  45. @foreach($submission->tags as $tag)
  46. <span style="display: inline-block; padding: 2px 6px; margin: 2px; background-color: #e3f2fd; border-radius: 3px; font-size: 0.85em;">
  47. {{ $tag->name }}
  48. </span>
  49. @endforeach
  50. </td>
  51. <td>{{ $submission->created_at->format('d.m.Y H:i') }}</td>
  52. <td>{{ $submission->ip_address ?? 'Неизвестно' }}</td>
  53. <td>
  54. <a href="{{ route('submissions.show', $submission->id) }}" style="color: #3490dc; text-decoration: none; margin-right: 10px;">Просмотр</a>
  55. <a href="{{ route('submissions.edit', $submission->id) }}" style="color: #38c172; text-decoration: none; margin-right: 10px;">Редактировать</a>
  56. <form method="POST" action="{{ route('submissions.destroy', $submission->id) }}" style="display: inline;">
  57. @csrf
  58. @method('DELETE')
  59. <button type="submit" style="color: #e3342f; background: none; border: none; cursor: pointer; text-decoration: underline;"
  60. onclick="return confirm('Вы уверены, что хотите удалить эту заявку?')">
  61. Удалить
  62. </button>
  63. </form>
  64. </td>
  65. </tr>
  66. @endforeach
  67. </tbody>
  68. </table>
  69. @endif
  70. @endsection