index.blade.php 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <!DOCTYPE html>
  2. <html lang="ru">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Все отправленные данные</title>
  7. <style>
  8. * { margin: 0; padding: 0; box-sizing: border-box; }
  9. body {
  10. font-family: Arial, sans-serif;
  11. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  12. min-height: 100vh;
  13. padding: 40px 20px;
  14. }
  15. .container {
  16. background: white;
  17. padding: 40px;
  18. border-radius: 10px;
  19. box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  20. max-width: 1200px;
  21. margin: 0 auto;
  22. }
  23. h1 {
  24. color: #333;
  25. margin-bottom: 10px;
  26. text-align: center;
  27. }
  28. .subtitle {
  29. color: #666;
  30. text-align: center;
  31. margin-bottom: 30px;
  32. font-size: 14px;
  33. }
  34. .header-actions {
  35. display: flex;
  36. justify-content: space-between;
  37. align-items: center;
  38. margin-bottom: 20px;
  39. flex-wrap: wrap;
  40. gap: 10px;
  41. }
  42. .btn {
  43. padding: 10px 20px;
  44. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  45. color: white;
  46. border: none;
  47. border-radius: 5px;
  48. font-size: 14px;
  49. font-weight: bold;
  50. cursor: pointer;
  51. text-decoration: none;
  52. display: inline-block;
  53. transition: transform 0.2s;
  54. }
  55. .btn:hover {
  56. transform: translateY(-2px);
  57. }
  58. .btn-secondary {
  59. background: linear-gradient(135deg, #a8a8a8 0%, #7f7f7f 100%);
  60. }
  61. .count-badge {
  62. background: #667eea;
  63. color: white;
  64. padding: 5px 15px;
  65. border-radius: 20px;
  66. font-size: 14px;
  67. font-weight: bold;
  68. }
  69. .table-wrapper {
  70. overflow-x: auto;
  71. margin-top: 20px;
  72. }
  73. table {
  74. width: 100%;
  75. border-collapse: collapse;
  76. background: white;
  77. }
  78. thead {
  79. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  80. }
  81. thead th {
  82. color: white;
  83. padding: 15px;
  84. text-align: left;
  85. font-weight: bold;
  86. font-size: 14px;
  87. }
  88. tbody tr {
  89. border-bottom: 1px solid #e1e1e1;
  90. transition: background-color 0.2s;
  91. }
  92. tbody tr:hover {
  93. background-color: #f8f9fa;
  94. }
  95. tbody tr:last-child {
  96. border-bottom: none;
  97. }
  98. td {
  99. padding: 15px;
  100. color: #333;
  101. font-size: 14px;
  102. }
  103. .message-cell {
  104. max-width: 300px;
  105. word-wrap: break-word;
  106. white-space: pre-wrap;
  107. }
  108. .date-cell {
  109. white-space: nowrap;
  110. color: #666;
  111. font-size: 13px;
  112. }
  113. .email-cell {
  114. color: #667eea;
  115. font-weight: 500;
  116. }
  117. .empty-state {
  118. text-align: center;
  119. padding: 60px 20px;
  120. color: #999;
  121. }
  122. .empty-state-icon {
  123. font-size: 64px;
  124. margin-bottom: 20px;
  125. }
  126. .alert {
  127. padding: 15px;
  128. border-radius: 5px;
  129. margin-bottom: 20px;
  130. }
  131. .alert-success {
  132. background: #d4edda;
  133. color: #155724;
  134. border: 1px solid #c3e6cb;
  135. }
  136. /* Стили для кнопок действий */
  137. .action-btn {
  138. padding: 5px 10px;
  139. font-size: 16px;
  140. border: none;
  141. border-radius: 5px;
  142. cursor: pointer;
  143. text-decoration: none;
  144. display: inline-block;
  145. margin: 0 2px;
  146. transition: all 0.2s;
  147. }
  148. .action-btn:hover {
  149. transform: scale(1.1);
  150. box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  151. }
  152. .btn-view {
  153. background: #3498db;
  154. color: white;
  155. }
  156. .btn-view:hover {
  157. background: #2980b9;
  158. }
  159. .btn-edit {
  160. background: #f1c40f;
  161. color: white;
  162. }
  163. .btn-edit:hover {
  164. background: #f39c12;
  165. }
  166. .btn-delete {
  167. background: #e74c3c;
  168. color: white;
  169. }
  170. .btn-delete:hover {
  171. background: #c0392b;
  172. }
  173. @media (max-width: 768px) {
  174. .container {
  175. padding: 20px;
  176. }
  177. table {
  178. font-size: 12px;
  179. }
  180. thead th, td {
  181. padding: 10px 8px;
  182. }
  183. .message-cell {
  184. max-width: 150px;
  185. }
  186. .action-btn {
  187. font-size: 14px;
  188. padding: 4px 8px;
  189. margin: 1px;
  190. }
  191. }
  192. .status-badge {
  193. padding: 4px 8px;
  194. border-radius: 12px;
  195. color: white;
  196. font-size: 12px;
  197. font-weight: bold;
  198. white-space: nowrap;
  199. }
  200. .status-primary { background-color: #007bff; }
  201. .status-warning { background-color: #ffc107; color: #212529; }
  202. .status-success { background-color: #28a745; }
  203. .status-danger { background-color: #dc3545; }
  204. .status-secondary { background-color: #6c757d; }
  205. </style>
  206. </head>
  207. <body>
  208. <div class="container">
  209. <h1>📋 Все отправленные данные</h1>
  210. <p class="subtitle">Laravel {{ app()->version() }} | Данные из формы</p>
  211. @if(session('success'))
  212. <div class="alert alert-success">
  213. {{ session('success') }}
  214. </div>
  215. @endif
  216. {{-- Добавим ссылку на главную страницу --}}
  217. <div class="header-actions">
  218. <a href="{{ route('form') }}" class="btn btn-secondary">← На главную</a>
  219. <span class="count-badge">Всего записей: {{ $submissions->count() }}</span>
  220. </div>
  221. <div class="table-wrapper">
  222. @if($submissions->count() > 0)
  223. <table>
  224. <thead>
  225. <tr>
  226. <th>#</th>
  227. <th>Имя</th>
  228. <th>Email</th>
  229. <th>Сообщение</th>
  230. <th>Категория</th> {{-- НОВАЯ КОЛОНКА --}}
  231. <th>Статус</th> {{-- НОВАЯ КОЛОНКА --}}
  232. <th>Дата</th>
  233. <th style="text-align: right;">Действия</th>
  234. </tr>
  235. </thead>
  236. <tbody>
  237. @foreach($submissions as $submission)
  238. <tr>
  239. <td>{{ $submission->id }}</td> {{-- Лучше использовать реальный ID --}}
  240. <td>{{ $submission->name }}</td>
  241. <td class="email-cell">{{ $submission->email }}</td>
  242. <td class="message-cell">{{ Str::limit($submission->message, 50) }}</td> {{-- Ограничим длину для красоты --}}
  243. {{-- НОВЫЕ ДАННЫЕ --}}
  244. <td>{{ $submission->category->name ?? 'N/A' }}</td>
  245. <td>
  246. <span class="status-badge status-{{ $submission->status->color_class ?? 'secondary' }}">
  247. {{ $submission->status->name ?? 'Неизвестен' }}
  248. </span>
  249. </td>
  250. <td class="date-cell">
  251. {{ $submission->created_at->format('d.m.Y H:i') }}
  252. </td>
  253. <td style="text-align: right; white-space: nowrap;">
  254. <a href="{{ route('admin.show', $submission->id) }}" class="action-btn btn-view" title="Просмотр">👁️</a>
  255. <a href="{{ route('admin.edit', $submission->id) }}" class="action-btn btn-edit" title="Редактировать">✏️</a>
  256. <form action="{{ route('admin.delete', $submission) }}" method="POST" style="display: inline;" onsubmit="return confirm('⚠️ Вы уверены, что хотите удалить запись?')">
  257. @csrf
  258. @method('DELETE')
  259. <button type="submit" class="action-btn btn-delete" title="Удалить">🗑️</button>
  260. </form>
  261. </td>
  262. </tr>
  263. @endforeach
  264. </tbody>
  265. </table>
  266. @else
  267. <div class="empty-state">
  268. <div class="empty-state-icon">📭</div>
  269. <h3>Пока нет отправленных данных</h3>
  270. <p style="margin-top: 10px;">Заполните <a href="{{ route('form') }}">форму</a>, чтобы увидеть данные здесь</p>
  271. </div>
  272. @endif
  273. </div>
  274. </div>
  275. </body>
  276. </html>