| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- @extends('layout')
- @section('content')
- <div class="space-y-6">
- <div class="flex justify-between items-center">
- <h1 class="text-3xl font-bold text-gray-900">Управление статьями</h1>
- <a href="{{ route('admin.posts.create') }}" class="bg-indigo-600 text-white px-4 py-2 rounded-md hover:bg-indigo-700 transition">
- + Создать статью
- </a>
- </div>
- <div class="bg-white shadow-sm border border-gray-100 rounded-lg overflow-hidden">
- <table class="min-w-full divide-y divide-gray-200">
- <thead class="bg-gray-50">
- <tr>
- <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Заголовок</th>
- <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Статус</th>
- <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Дата публикации</th>
- <th scope="col" class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Действия</th>
- </tr>
- </thead>
- <tbody class="bg-white divide-y divide-gray-200">
- @forelse($posts as $post)
- <tr>
- <td class="px-6 py-4 whitespace-nowrap">
- <div class="text-sm font-medium text-gray-900">{{ $post->title }}</div>
- <div class="text-sm text-gray-500 text-xs">{{ Str::limit($post->slug, 30) }}</div>
- </td>
- <td class="px-6 py-4 whitespace-nowrap">
- @if($post->is_published)
- <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
- Опубликовано
- </span>
- @else
- <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">
- Черновик
- </span>
- @endif
- </td>
- <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
- {{ $post->published_at ? $post->published_at->format('d.m.Y H:i') : ($post->scheduled_at ? 'Запл.: ' . $post->scheduled_at->format('d.m H:i') : '-') }}
- </td>
- <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium space-x-2">
- <a href="{{ route('admin.posts.edit', $post) }}" class="text-indigo-600 hover:text-indigo-900">Ред.</a>
-
- <form action="{{ route('admin.posts.destroy', $post) }}" method="POST" class="inline-block" onsubmit="return confirm('Удалить статью?');">
- @csrf
- @method('DELETE')
- <button type="submit" class="text-red-600 hover:text-red-900 ml-2">Удалить</button>
- </form>
- </td>
- </tr>
- @empty
- <tr>
- <td colspan="4" class="px-6 py-4 text-center text-gray-500">
- Статей пока нет. Создайте первую!
- </td>
- </tr>
- @endforelse
- </tbody>
- </table>
- </div>
- <div class="mt-4">
- {{ $posts->links() }}
- </div>
- </div>
- @endsection
|