| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- @extends('layout')
- @section('content')
- <div class="bg-white p-8 rounded-lg shadow-sm border border-gray-100">
- <h2 class="text-2xl font-bold mb-6">{{ isset($post) ? 'Редактировать статью' : 'Новая статья' }}</h2>
- <form action="{{ isset($post) ? route('admin.posts.update', $post) : route('admin.posts.store') }}" method="POST">
- @csrf
- @if(isset($post)) @method('PUT') @endif
- <div class="space-y-6">
- <div>
- <label class="block text-sm font-medium text-gray-700">Заголовок</label>
- <input type="text" name="title" value="{{ old('title', $post->title ?? '') }}" class="mt-1 block w-full rounded-md border border-gray-300 p-2 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">
- </div>
- <div>
- <label class="block text-sm font-medium text-gray-700">Текст статьи</label>
- <textarea name="content" rows="10" class="mt-1 block w-full rounded-md border border-gray-300 p-2 shadow-sm focus:border-indigo-500 focus:ring-indigo-500">{{ old('content', $post->content ?? '') }}</textarea>
- </div>
- <div class="grid grid-cols-1 md:grid-cols-2 gap-6 bg-gray-50 p-4 rounded-md">
- <div>
- <label class="block text-sm font-medium text-gray-700">Запланировать публикацию (дата/время)</label>
- <input type="datetime-local" name="scheduled_at" value="{{ old('scheduled_at', isset($post) && $post->scheduled_at ? $post->scheduled_at->format('Y-m-d\TH:i') : '') }}" class="mt-1 block w-full rounded-md border border-gray-300 p-2">
- <p class="text-xs text-gray-500 mt-1">Оставьте пустым для немедленной публикации или черновика</p>
- </div>
- <div class="flex items-center mt-6">
- <input type="checkbox" name="is_published" id="is_published" value="1" {{ old('is_published', $post->is_published ?? false) ? 'checked' : '' }} class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
- <label for="is_published" class="ml-2 block text-sm text-gray-900">
- Опубликовать немедленно?
- </label>
- </div>
- </div>
- <div class="flex justify-end gap-3">
- <a href="{{ route('admin.posts.index') }}" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300">Отмена</a>
- <button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 shadow-sm">
- {{ isset($post) ? 'Обновить' : 'Создать' }}
- </button>
- </div>
- </div>
- </form>
- </div>
- @endsection
|