{% extends "base.html" %}

{% block content %}
<div class="container mt-4">
    <h2>Edit Customer: {{ customer.name }}</h2>

    {% if messages %}
        {% for message in messages %}
            <div class="alert alert-{{ message.tags }}">{{ message }}</div>
        {% endfor %}
    {% endif %}

    <div class="card">
        <div class="card-body">
            <form method="post">
                {% csrf_token %}
                
                <div class="mb-3">
                    <label for="id_first_name" class="form-label">First Name</label>
                    {{ form.first_name }}
                </div>
                <div class="mb-3">
                    <label for="id_last_name" class="form-label">Last Name</label>
                    {{ form.last_name }}
                </div>
                <div class="mb-3">
                    <label for="id_email" class="form-label">Email</label>
                    {{ form.email }}
                </div>
                <div class="mb-3">
                    <label for="id_phone" class="form-label">Phone</label>
                    {{ form.phone }}
                </div>
                <div class="mb-3">
                    <label for="id_status" class="form-label">Status</label>
                    {{ form.status }}
                </div>
                <div class="mb-3">
                    <label for="id_owner" class="form-label">Owner</label>
                    {{ form.owner }}
                </div>

                <button type="submit" class="btn btn-primary">Save Changes</button>
                <a href="{% url 'customer_detail' customer.pk %}" class="btn btn-secondary">Cancel</a>
            </form>
        </div>
    </div>

</div>
{% endblock %}
