{% extends "base.html.twig" %}
{% trans_default_domain 'core' %}

{% block actionheader %}
{% endblock %}

{% block searchform_container %}{% endblock %}

{% block body %}

    {{ form_start(form) }}

    <article class="retencion-like">

        <header id="retencion-like-title">
            {% block retencion_actions %}{% endblock %}
            {% block retencion_label %}{% endblock %}
        </header>

        <div class="box pad box-warning">

            <div class="box-header with-border">

                <div class="btn-group">

                    <div class="btn-group">

                        <a href="{{ path('retencion_index') }}" class="btn btn-app">
                            <i class="glyphicon glyphicon-list-alt"></i>
                            Listado
                        </a>
                        <a href="{{ path('retencion_add') }}" class="btn btn-app">
                            <i class="glyphicon glyphicon-file"></i>
                            Nuevo
                        </a>

                        <button type="button" class="btn btn-app" data-toggle="modal" data-target="#myModal" onclick='verPdf("{{ path('retencion_show_pdf_preview',{ 'id': entity.id , 'slug': entity.slug}) }}")'>
                            <i class="fa fa-file-pdf-o"></i>Pdf
                        </button>

                        {% if entity.autorizado == true %}
                            <a href="{{ path('retencion_download_xml', {'id': entity.id, 'slug': entity.slug}) }}" class="btn btn-app" name="Form-xml"><span
                                        class="fa fa-file-text"></span> XML
                            </a>
                        {% endif %}
                        {% if entity.anulado %}
                            <button type="submit" name="Form-pdf" class="btn btn-app">
                                <i class="fa fa-file-pdf-o"></i>Pdf
                            </button>
                        {% else %}
                            {% include "Core/comprob.show.html.twig" with {'entity': entity} %}
                        {% endif %}

                        {#
                        REVISAR IMPORTANTE SHARA
                        <form action="{{ path('retencion_email', {'id': entity.id}) }}" method="post">
                            <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
                            <button type="submit" class="btn btn-default btn-warning"><span
                                        class="glyphicon glyphicon-envelope"></span> {% trans %}show.email{% endtrans %}</button>
                        </form>
                        #}
                    </div>
                </div>
            </div>
            <div class="box-body">

                {% if entity.anulado %}
                    <div class="container-fluid">
                        <div class="row text-center">
                            <div class="col-md-12">
                                <h2 style="color: red">A N U L A D O</h2>
                            </div>
                        </div>
                    </div>
                {% endif %}

                {% include "Core/emisor.show.html.twig" with {'entity': entity} %}

                <div class="row">
                    <div id="retencion-like-provider-data" class="col-md-12">

                        <h3>Retención</h3>

                        <div class="row">
                            <div class="col-md-3 clearfix">
                                <label>Serie:</label>
                                {{ entity.serie }}
                            </div>
                            <div class="col-md-3 clearfix">
                                <label>Número:</label>
                                {{ entity.label }}
                            </div>
                            <div class="col-md-3 clearfix">
                                <label>Fecha:</label>
                                {{ entity.issueDate |date("d/m/Y") }}
                            </div>

                        </div>

                        <div class="row">
                            <div class="col-md-6 clearfix">
                                <label>Proveedor:</label>
                                {{ entity.provider_name }}
                            </div>
                            <div class="col-md-6 clearfix">
                                <label style="font-weight: bold">Identificación:</label>
                                {{ entity.provider_identification }}
                            </div>

                            <div class="col-md-6 clearfix">
                                <label style="font-weight: bold">Dirección:</label>
                                {{ entity.provider_address|nl2br }}
                            </div>

                            <div class="col-md-6 clearfix">
                                <label style="font-weight: bold">Email:</label>
                                {{ entity.provider_email }}
                            </div>

                        </div>

                        {% if entity.isSinRespuesta == true %}
                            <div class="row">
                                <div class="col-md-12 clearfix">
                                    <label>Mensaje Error:</label>
                                    <p style="color: red">{{ entity.mensajeError }}</p>
                                </div>

                            </div>
                        {% endif %}
                    </div>

                    <div id="retencion-like-properties" class="col-md-4" style="display: none; visibility: hidden;">
                        <div class="panel panel-default">
                            <h3 class="panel-heading">{% trans %}abstract_invoice.show.properties{% endtrans %}</h3>

                            <div class="panel-body">
                                {% block properties %}{% endblock %}
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div id="retencion-like-provider-data" class="col-md-12">

                        <h3>Periodo Fiscal</h3>

                        <div class="row">
                            <div class="col-md-2 clearfix">
                                <label style="font-weight: bold">Mes:</label>
                                {{ entity.mes }}
                            </div>
                            <div class="col-md-2 clearfix">
                                <label style="font-weight: bold">Año:</label>
                                {{ entity.anio }}
                            </div>

                        </div>

                    </div>

                </div>
                <div class="row">
                    <div id="retencion-like-provider-data" class="col-md-12">

                        <h3>Factura de Compra</h3>

                        <div class="row">
                            <div class="col-md-2 clearfix">
                                <label style="font-weight: bold">Serie:</label>
                                {{ entity.serieCompra }}
                            </div>
                            <div class="col-md-2 clearfix">
                                <label style="font-weight: bold">Numero:</label>
                                {{ entity.numeroCompra }}
                            </div>
                            <div class="col-md-2 clearfix">
                                <label>Fecha:</label>
                                {{ entity.fechaCompra |date("d/m/Y") }}
                            </div>

                        </div>

                    </div>

                </div>

                <div class="row">
                    <div class="col-md-12">

                        <h3>Lineas de Retención</h3>

                        <table id="retencion-like-items" class="table table-condensed table-striped align-middle">
                            <thead>
                            <tr>
                                <th class="col-md-1 cell-align-center">Código</th>
                                <th class="">{% trans %}item.show.description{% endtrans %}</th>
                                <th class="col-md-1 cell-align-right">Base</th>
                                <th class="col-md-1 cell-align-right">Porcentaje</th>
                                <th class="col-md-1 cell-align-right">Retenido</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for item in entity.items %}
                                {{ include('RetencionItem/show.html.twig', { 'item': item, 'currency': currency }) }}
                            {% endfor %}
                            </tbody>
                        </table>

                    </div>
                </div>

                <div class="row totals">
                    <div class="col-md-4 col-md-offset-8">
                        <table id="retencion-like-totals" class="table table-condensed table-striped">
                            <tbody>
                            <tr>
                                <th>{% trans with {'%currency%': currency} %}abstract_invoice.show.total{% endtrans %}</th>
                                <td class="cell-align-right">{{ entity.grossAmount|localizedcurrency(currency, app.request.locale) }}</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

                <div id="retencion-like-notes" class="row">
                    {#<div class="col-md-6">
                      <label>{% trans %}abstract_retencion.show.terms{% endtrans %}:</label>
                      <p>{{ entity.terms|nl2br }}</p>
                    </div>
                    #}
                    <div class="col-md-6" style="word-wrap: break-word;">
                        <label style="font-weight: bold">{% trans %}abstract_invoice.show.notes{% endtrans %}
                            :</label>
                        {{ entity.notes|nl2br }}
                    </div>
                </div>

                <div class="entity-actions clearfix">
                    {% block retencion_edit_actions %}{% endblock %}
                </div>

            </div>
        </div>

    </article>

    {% include "Core/email.show.html.twig" with {'entity': entity} %}

    {{ form_rest(form) }}
    {{ form_end(form) }}

{% endblock %}

{#
{% block properties %}
    <div class="col-md-12">
        <label>Clave acceso:</label>
        {{ entity.claveAcceso }}
    </div>
    <div class="col-md-12">
        <label>{% trans %}show.issue_date{% endtrans %}:</label>
        {{ entity.issueDate|localizeddate('none', 'none', app.request.locale, null, 'dd/MM/yyyy') }}
    </div>
    <div class="col-md-12">
        <label>Fecha de autorización:</label>
        {{ entity.fechaAutorizacion }}
    </div>

{% endblock %}
#}
