{% extends kimai_context.modalRequest ? 'form.html.twig' : 'base.html.twig' %}

{% block main %}
    {% set formEditTemplate = kimai_context.modalRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig' %}
    {% set formOptions = {
        'title': template.name|default('create'|trans),
        'form': form,
        'back': path('admin_invoice_template')
    } %}

    {% embed formEditTemplate with formOptions %}
        {% block form_body %}
            {{ form_row(form.name) }}
            <fieldset class="form-fieldset pb-0">
                <div class="row">
                    <div class="col-12">
                        {{ form_row(form.title) }}
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        {{ form_row(form.company) }}
                    </div>
                    <div class="col-md-6">
                        {{ form_row(form.vatId) }}
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        {{ form_row(form.address) }}
                    </div>
                    <div class="col-md-6">
                        {{ form_row(form.contact) }}
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        {{ form_row(form.paymentTerms) }}
                    </div>
                    <div class="col-md-6">
                        {{ form_row(form.paymentDetails) }}
                    </div>
                </div>
            </fieldset>
            <fieldset class="form-fieldset pb-0">
                <div class="row">
                    <div class="col-md-6">
                        {{ form_row(form.dueDays) }}
                    </div>
                    <div class="col-md-6">
                        {{ form_row(form.vat) }}
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        {{ form_row(form.language) }}
                    </div>
                    <div class="col-md-6">
                        {{ form_row(form.numberGenerator) }}
                    </div>
                </div>
            </fieldset>
            <fieldset class="form-fieldset pb-0">
                <div class="row">
                    <div class="col-md-6">
                        {{ form_row(form.renderer, {'help_html': true, 'help': '<a href="https://github.com/kimai/invoice-templates" target="_blank">' ~ ('download_invoice_renderer'|trans({}, 'invoice-renderer')) ~ '</a>'}) }}
                    </div>
                    <div class="col-md-6">
                        {{ form_row(form.calculator) }}
                    </div>
                </div>
            </fieldset>
            {{ form_rest(form) }}
        {% endblock %}
    {% endembed %}    
{% endblock %}
