@extends('layouts.community')

@section('title', 'Nouvel Article')
@section('page-title', 'Creer un Article')

@section('content')
<div class="card">
    <div class="card-body">
        <form action="{{ route('community.blog.store') }}" method="POST" enctype="multipart/form-data">
            @csrf
            
            <div class="mb-3">
                <label class="form-label">Titre</label>
                <input type="text" name="title" class="form-control" required placeholder="Titre de l'article...">
            </div>
            
            <div class="row">
                <div class="col-md-6 mb-3">
                    <label class="form-label">Categorie</label>
                    <input type="text" name="category" class="form-control" placeholder="Ex: Actualites, Conseils...">
                </div>
                <div class="col-md-6 mb-3">
                    <label class="form-label">Tags (separes par des virgules)</label>
                    <input type="text" name="tags" class="form-control" placeholder="tag1, tag2, tag3">
                </div>
            </div>
            
            <div class="mb-3">
                <label class="form-label">Extrait</label>
                <textarea name="excerpt" class="form-control" rows="2" placeholder="Resume court de l'article..."></textarea>
            </div>
            
            <div class="mb-3">
                <label class="form-label">Contenu</label>
                <textarea name="content" class="form-control" rows="15" required placeholder="Contenu de l'article..."></textarea>
            </div>
            
            <div class="mb-3">
                <label class="form-label">Image de couverture</label>
                <input type="file" name="image" class="form-control" accept="image/*">
            </div>
            
            <div class="mb-4">
                <div class="form-check">
                    <input class="form-check-input" type="checkbox" name="is_published" value="1" id="published">
                    <label class="form-check-label" for="published">Publier immediatement</label>
                </div>
            </div>
            
            <div class="d-flex gap-2">
                <button type="submit" class="btn btn-success btn-lg">
                    <i class="bi bi-check-lg me-2"></i> Enregistrer
                </button>
                <a href="{{ route('community.blog.index') }}" class="btn btn-outline-secondary btn-lg">Annuler</a>
            </div>
        </form>
    </div>
</div>
@endsection
