{% extends 'base.html' %}
{% load i18n static %}

{% block title %}تعديل المصدر - {{ resource.title_ar }}{% endblock %}

{% block content %}
<div class="container" style="margin-top: 100px; margin-bottom: 50px;">
    <div class="row justify-content-center">
        <div class="col-md-8 col-lg-6">
            <div class="glass-card p-4 p-md-5">
                <div class="text-center mb-4">
                    <h3 class="fw-bold text-primary">تعديل المصدر</h3>
                    <p class="text-muted">المادة: {{ subject.name_ar }}</p>
                </div>

                <form method="post" enctype="multipart/form-data">
                    {% csrf_token %}
                    
                    {% for field in form %}
                    <div class="mb-3">
                        <label for="{{ field.id_for_label }}" class="form-label fw-bold">{{ field.label }}</label>
                        {{ field }}
                        {% if field.help_text %}
                            <div class="form-text">{{ field.help_text }}</div>
                        {% endif %}
                        {% for error in field.errors %}
                            <div class="text-danger small">{{ error }}</div>
                        {% endfor %}
                    </div>
                    {% endfor %}

                    <div class="d-grid gap-2 mt-4">
                        <button type="submit" class="btn btn-primary rounded-pill btn-lg">حفظ التغييرات</button>
                        <a href="{% url 'subject_detail' subject.id %}" class="btn btn-outline-secondary rounded-pill">إلغاء</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}