{% extends 'base.html' %}

{% block content %}
<div class="container py-5">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card shadow-sm border-0">
                <div class="card-header bg-white border-0 py-4">
                    <h2 class="h4 mb-0 text-center">
                        {% if object %}Редактировать поставщика{% else %}Новый поставщик{% endif %}
                    </h2>
                </div>
                <div class="card-body p-4">
                    <form method="post">
                        {% csrf_token %}
                        <div class="mb-3">
                            <label class="form-label">Наименование компании *</label>
                            {{ form.name }}
                            {% if form.name.errors %}<div class="text-danger small">{{ form.name.errors }}</div>{% endif %}
                        </div>
                        <div class="row">
                            <div class="col-md-6 mb-3">
                                <label class="form-label">ФИО представителя</label>
                                {{ form.representative_name }}
                            </div>
                            <div class="col-md-6 mb-3">
                                <label class="form-label">Телефон</label>
                                {{ form.phone }}
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-6 mb-3">
                                <label class="form-label">Электронная почта</label>
                                {{ form.email }}
                            </div>
                            <div class="col-md-6 mb-3">
                                <label class="form-label">Номер договора</label>
                                {{ form.contract_number }}
                            </div>
                        </div>
                        
                        <div class="d-grid gap-2 d-md-flex justify-content-md-end mt-4">
                            <a href="{% url 'supply_list' %}" class="btn btn-light px-4">Отмена</a>
                            <button type="submit" class="btn btn-primary px-5">Сохранить</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
    .form-control {
        border-radius: 8px;
        padding: 0.75rem;
        border: 1px solid #e0e0e0;
    }
    .form-control:focus {
        border-color: #0d6efd;
        box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.1);
    }
    label {
        font-weight: 500;
        color: #495057;
        margin-bottom: 0.5rem;
    }
</style>
{% endblock %}