{% extends "base.html" %}
{% block title %}Edit Banner{% endblock %}
{% block content %}
<div class="container mt-4">
    <h2>Edit Banner</h2>
    <form method="post" enctype="multipart/form-data" class="row g-3">
        {% csrf_token %}
        <div class="col-md-6">
            <label for="title" class="form-label">Title</label>
            <input type="text" class="form-control" id="title" name="title" value="{{ banner.title }}" required>
        </div>
        <div class="col-md-6">
            <label for="status" class="form-label">Status</label>
            <select class="form-select" id="status" name="status">
                <option value="active" {% if banner.status == 'active' %}selected{% endif %}>Active</option>
                <option value="inactive" {% if banner.status == 'inactive' %}selected{% endif %}>Inactive</option>
            </select>
        </div>
        <div class="col-12">
            <label for="description" class="form-label">Description</label>
            <textarea class="form-control" id="description" name="description" rows="3" required>{{ banner.description }}</textarea>
        </div>
        <div class="col-12">
            <label for="image" class="form-label">Image</label>
            {% if banner.image %}
                <img src="{{ banner.image.url }}" width="120" class="mb-2"><br>
            {% endif %}
            <input type="file" class="form-control" id="image" name="image">
        </div>
        <div class="col-12">
            <button type="submit" class="btn btn-primary">Update Banner</button>
            <a href="{% url 'banner-management' %}" class="btn btn-secondary">Back</a>
        </div>
    </form>
</div>
{% endblock %}
