index.blade.php 5.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {{--
  2. Вьюха: список отзывов клиентов
  3. Создана: 2026-05-07
  4. Контроллер: Admin\ReviewAdminController::index()
  5. Переменные: $reviews (коллекция Review)
  6. --}}
  7. @extends('admin.layout')
  8. @section('title', 'Отзывы клиентов')
  9. @section('content_header')
  10. <div class="d-flex justify-content-between align-items-center">
  11. <h1 class="m-0">Отзывы клиентов</h1>
  12. <a href="{{ route('admin.reviews.create') }}" class="btn btn-primary btn-sm">
  13. <i class="fas fa-plus"></i> Добавить отзыв
  14. </a>
  15. </div>
  16. @stop
  17. @section('breadcrumb')
  18. <li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">Главная</a></li>
  19. <li class="breadcrumb-item active">Отзывы</li>
  20. @stop
  21. @section('content')
  22. @if(session('success'))
  23. <div class="alert alert-success alert-dismissible">
  24. <button type="button" class="close" data-dismiss="alert">&times;</button>
  25. {{ session('success') }}
  26. </div>
  27. @endif
  28. <div class="card card-primary card-outline">
  29. <div class="card-body p-0">
  30. @if($reviews->isEmpty())
  31. <div class="p-4 text-muted">Отзывов пока нет. <a href="{{ route('admin.reviews.create') }}">Добавить первый</a></div>
  32. @else
  33. <table class="table table-hover table-sm mb-0">
  34. <thead class="thead-light">
  35. <tr>
  36. <th style="width:50px">#</th>
  37. <th>Автор</th>
  38. <th>Автомобиль</th>
  39. <th style="width:100px">Рейтинг</th>
  40. <th style="width:100px">Дата</th>
  41. <th style="width:80px">Статус</th>
  42. <th style="width:110px" class="text-right">Действия</th>
  43. </tr>
  44. </thead>
  45. <tbody>
  46. @foreach($reviews as $review)
  47. <tr class="{{ $review->is_active ? '' : 'text-muted' }}">
  48. <td>{{ $review->id }}</td>
  49. <td>
  50. <strong>{{ $review->author }}</strong>
  51. <div class="text-muted small">{{ Str::limit($review->body, 60) }}</div>
  52. </td>
  53. <td>{{ $review->car_name ?: '—' }}</td>
  54. <td>
  55. @for ($i = 1; $i <= 5; $i++)
  56. <span style="color:{{ $i <= $review->rating ? '#f39c12' : '#dee2e6' }}">★</span>
  57. @endfor
  58. </td>
  59. <td>{{ $review->review_date?->format('d.m.Y') ?: '—' }}</td>
  60. <td>
  61. <form action="{{ route('admin.reviews.toggle', $review) }}" method="POST" class="d-inline">
  62. @csrf
  63. <button type="submit"
  64. class="badge badge-{{ $review->is_active ? 'success' : 'secondary' }} border-0"
  65. style="cursor:pointer;font-size:11px;padding:4px 8px"
  66. title="{{ $review->is_active ? 'Кликните, чтобы скрыть' : 'Кликните, чтобы показать' }}">
  67. {{ $review->is_active ? 'Активен' : 'Скрыт' }}
  68. </button>
  69. </form>
  70. </td>
  71. <td class="text-right">
  72. <a href="{{ route('admin.reviews.edit', $review) }}"
  73. class="btn btn-xs btn-info" title="Редактировать">
  74. <i class="fas fa-edit"></i>
  75. </a>
  76. <form action="{{ route('admin.reviews.destroy', $review) }}" method="POST"
  77. class="d-inline"
  78. onsubmit="return confirm('Удалить отзыв «{{ addslashes($review->author) }}»?')">
  79. @csrf @method('DELETE')
  80. <button class="btn btn-xs btn-danger ml-1" title="Удалить">
  81. <i class="fas fa-trash"></i>
  82. </button>
  83. </form>
  84. </td>
  85. </tr>
  86. @endforeach
  87. </tbody>
  88. </table>
  89. @endif
  90. </div>
  91. </div>
  92. @stop