{% extends 'base.html' %}

{% block title %}Создать документ списания{% endblock %}

{% block content %}
<div class="container-fluid px-4 py-3">
    <!-- Breadcrumbs -->
    <nav aria-label="breadcrumb" class="mb-2">
        <ol class="breadcrumb breadcrumb-sm mb-0">
            <li class="breadcrumb-item"><a href="{% url 'inventory:writeoff-document-list' %}">Документы списания</a></li>
            <li class="breadcrumb-item active">Создать</li>
        </ol>
    </nav>

    <div class="row justify-content-center">
        <div class="col-lg-6">
            <div class="card border-0 shadow-sm">
                <div class="card-header bg-light py-3">
                    <h5 class="mb-0">
                        <i class="bi bi-file-earmark-plus me-2"></i>Новый документ списания
                    </h5>
                </div>
                <div class="card-body">
                    <form method="post">
                        {% csrf_token %}

                        <div class="mb-3">
                            <label for="id_warehouse" class="form-label">Склад <span class="text-danger">*</span></label>
                            {{ form.warehouse }}
                            {% if form.warehouse.errors %}
                            <div class="text-danger small">{{ form.warehouse.errors.0 }}</div>
                            {% endif %}
                        </div>

                        <div class="mb-3">
                            <label for="id_date" class="form-label">Дата документа <span class="text-danger">*</span></label>
                            {{ form.date }}
                            {% if form.date.errors %}
                            <div class="text-danger small">{{ form.date.errors.0 }}</div>
                            {% endif %}
                        </div>

                        <div class="mb-3">
                            <label for="id_notes" class="form-label">Примечания</label>
                            {{ form.notes }}
                        </div>

                        <div class="d-flex gap-2">
                            <button type="submit" class="btn btn-primary">
                                <i class="bi bi-check-lg me-1"></i>Создать
                            </button>
                            <a href="{% url 'inventory:writeoff-document-list' %}" class="btn btn-outline-secondary">
                                Отмена
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
