{% extends "admin_base.html" %}
{% block content %}
<h1 class="mb-4">Edit Subcategory</h1>

<form method="POST" enctype="multipart/form-data">
    {{ form.hidden_tag() }}
    
    <div class="mb-3">
        {{ form.name.label(class="form-label") }}
        {{ form.name(class="form-control") }}
    </div>
    
    <div class="mb-3">
        {{ form.parent_category.label(class="form-label") }}
        {{ form.parent_category(class="form-control") }}
    </div>
    
    <div class="mb-3">
        {{ form.image.label(class="form-label") }}
        {{ form.image(class="form-control") }}
    </div>
    
    {% if subcategory.image %}
    <div class="mb-3">
        <p>Current Image:</p>
        <img src="{{ url_for('static', filename='uploads/' + subcategory.image) }}" alt="{{ subcategory.name }}" class="img-thumbnail" style="max-width: 200px;">
    </div>
    {% endif %}
    
    {{ form.submit(class="btn btn-primary") }}
</form>

<a href="{{ url_for('admin_blueprint.manage_tour_categories') }}" class="btn btn-secondary mt-3">Back to Categories</a>
{% endblock %}