{% extends 'django_ledger/layouts/content_layout_1.html' %}
{% load i18n %}
{% load static %}
{% load django_ledger %}

{% block view_content %}
    <div class="columns is-multiline is-centered">

        {% if estimate_model %}
            <div class="column is-12 has-text-centered">
                <h2 class="is-size-2">{% trans 'Invoice for Estimate' %}: {{ estimate_model.title }}</h2>
                <h3 class="is-size-3">{{ estimate_model.estimate_number }}</h3>
                <h4 class="is-size-4 mt-2">{{ estimate_model.customer }}</h4>
                <a class="button is-dark mt-2"
                   href="{% url 'django_ledger:customer-estimate-detail' entity_slug=view.kwargs.entity_slug ce_pk=estimate_model.uuid %}">
                    {% trans 'Back to Estimate' %}</a>
            </div>
        {% endif %}

        <div class="column is-10-tablet is-6-desktop">
            <div class="card">

                <div class="card-header">
                    <h2 class="card-header-title has-text-weight-light is-size-4 is-centered">{% trans 'Create Invoice' %}</h2>
                </div>

                <form action="{{ form_action_url }}" method="post" id="djl-bill-create-form-id">

                    <div class="card-content">
                        {% csrf_token %}
                        {{ form }}
                    </div>

                    <div class="card-content">
                        <div class="buttons">
                            <button type="submit"
                                    id="djl-invoice-create-button"
                                    class="button is-primary is-fullwidth mb-4">{% trans 'Create' %}
                            </button>
                            <a href="{% url 'django_ledger:invoice-list' entity_slug=view.kwargs.entity_slug %}"
                               id="djl-invoice-create-back-button"
                               class="button is-fullwidth mt-4">{% trans 'Cancel' %}</a>
                        </div>

                    </div>
                </form>

            </div>
        </div>
    </div>
{% endblock %}

