{% extends "base.html" %}

{% block content %}
<h1 class="mb-4">Edit Category</h1>
<form method="POST" enctype="multipart/form-data">
    {{ form.hidden_tag() }}
    <div class="mb-3">
        {{ form.code.label(class="form-label") }}
        {{ form.code(class="form-control") }}
    </div>
    <div class="mb-3">
        {{ form.name.label(class="form-label") }}
        {{ form.name(class="form-control") }}
    </div>
    <div class="mb-3">
        {{ form.image.label(class="form-label") }}
        {{ form.image(class="form-control") }}
        {% if category.photo_back %}
            <p>Current Image:</p>
            <img src="{{ url_for('static', filename=category.photo_back) }}" alt="{{ category.name }}" width="100">
        {% else %}
            <p>No image currently uploaded.</p>
        {% endif %}
    </div>
    <div class="mb-3">
        {{ form.submit(class="btn btn-primary") }}
    </div>
</form>
{% endblock %}