@extends('admin.layouts.app')
@section('title', 'Edit Article')
@section('content')
<div class="card" style="max-width:700px">
    <div class="card-header">Edit Article: {{ $article->title }}</div>
    <form action="{{ route('admin.articles.update', $article) }}" method="POST">
        @csrf @method('PUT')
        <div class="form-group">
            <label>Title *</label>
            <input type="text" name="title" class="form-control" value="{{ old('title', $article->title) }}" required>
        </div>
        <div class="form-row">
            <div class="form-group">
                <label>Slug</label>
                <input type="text" name="slug" class="form-control" value="{{ old('slug', $article->slug) }}">
            </div>
            <div class="form-group">
                <label>Category</label>
                <input type="text" name="category" class="form-control" value="{{ old('category', $article->category) }}">
            </div>
        </div>
        <div class="form-group">
            <label>Content</label>
            <textarea name="content" class="form-control" rows="10">{{ old('content', $article->content) }}</textarea>
        </div>
        <div class="form-row">
            <div class="form-group">
                <label>Order</label>
                <input type="number" name="order" class="form-control" value="{{ old('order', $article->order) }}" min="0">
            </div>
            <div class="form-group">
                <label class="checkbox-label" style="margin-top:25px"><input type="checkbox" name="is_active" value="1" {{ $article->is_active ? 'checked' : '' }}> Active</label>
            </div>
        </div>
        <button type="submit" class="btn btn-primary">Update Article</button>
    </form>
</div>
@endsection
