index.blade.php 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {{-- Вьюха: Список блоков контента в административной панели --}}
  2. @extends('admin.layout')
  3. @section('title', 'Блоки')
  4. @section('content_header')
  5. <div class="d-flex justify-content-between align-items-center">
  6. <h1 class="m-0">Блоки контента</h1>
  7. <div class="d-flex gap-2">
  8. <a href="{{ route('admin.blocks.wizard') }}" class="btn btn-secondary btn-sm">
  9. <i class="fas fa-magic"></i> Генератор макета
  10. </a>
  11. <a href="{{ route('admin.blocks.create') }}" class="btn btn-primary btn-sm">
  12. <i class="fas fa-plus"></i> Добавить блок
  13. </a>
  14. </div>
  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. <table class="table table-hover mb-0">
  31. <thead>
  32. <tr>
  33. <th>Название</th>
  34. <th>Системное имя</th>
  35. <th>Макет</th>
  36. <th>Статус</th>
  37. <th class="text-right">Действия</th>
  38. </tr>
  39. </thead>
  40. <tbody>
  41. @forelse($blocks as $block)
  42. <tr>
  43. <td>{{ $block->title }}</td>
  44. <td><code>{{ $block->name }}</code></td>
  45. <td>
  46. @if($block->layout)
  47. <span class="badge badge-info">{{ $block->layoutDefinition()['title'] ?? $block->layout }}</span>
  48. @else
  49. <span class="text-muted">—</span>
  50. @endif
  51. </td>
  52. <td>
  53. @if($block->is_active)
  54. <span class="badge badge-success">Активен</span>
  55. @else
  56. <span class="badge badge-secondary">Отключён</span>
  57. @endif
  58. </td>
  59. <td class="text-right">
  60. <a href="{{ route('admin.blocks.edit', $block) }}" class="btn btn-sm btn-primary">
  61. <i class="fas fa-edit"></i>
  62. </a>
  63. <form action="{{ route('admin.blocks.destroy', $block) }}" method="POST" class="d-inline"
  64. onsubmit="return confirm('Удалить блок «{{ $block->title }}»?')">
  65. @csrf @method('DELETE')
  66. <button type="submit" class="btn btn-sm btn-danger">
  67. <i class="fas fa-trash"></i>
  68. </button>
  69. </form>
  70. </td>
  71. </tr>
  72. @empty
  73. <tr>
  74. <td colspan="5" class="text-center text-muted py-4">Блоков пока нет</td>
  75. </tr>
  76. @endforelse
  77. </tbody>
  78. </table>
  79. </div>
  80. </div>
  81. @stop