{% extends 'admin/layouts/base.html.twig' %}

{% block title %}Admin - {{ context.get['app'] ? context.get['app'].name : company_name }} - {{ title }}{% endblock %}
{% block pageheader %}
    <div class="page-header page-header-light">
        <div class="page-header-content header-elements-md-inline">
            <div class="page-title d-flex">
                <h4><i class="icon-users mr-2"></i>
                    <span class="font-weight-semibold">Proprietaires</span>
                </h4>
                <a href="javascript:" class="header-elements-toggle text-default d-md-none">
                    <i class="icon-more"></i>
                </a>
            </div>

            <div class="header-elements d-none">
                <div class="d-flex justify-content-center">
                    {% include 'admin/partials/_action_global_btn.html.twig' %}
                    <a data-toggle="tooltip" title="{{ libelle_ajouter }}"
                       href="{{ path('admin.acteurs.proprietaires.new') }}" class="btn btn-success btn-sm btn-icon ml-5">
                        <i class="icon-user-plus"></i>
                    </a>
                </div>
            </div>
        </div>

        <div class="breadcrumb-line breadcrumb-line-light header-elements-md-inline">
            {{ fil_arial(title, 'Proprietaires') }}
        </div>
    </div>
{% endblock %}
{% block body %}
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header header-elements-inline">
                    <h6 class="card-title"><i class="icon-user-plus"></i> {{ title }}</h6>
                </div>

                {% include 'admin/acteurs/proprietaires/_partials/_table.html.twig' %}
            </div>
        </div>
    </div>
    {% for proprietaire in proprietaires %}
        <!-- Primary modal -->
        <div id="modal_theme_primary{{ proprietaire.id }}" class="modal fade" tabindex="-1">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header bg-primary text-white">
                        <h6 class="modal-title">Détails du proprietaire: {{ proprietaire.name }}</h6>
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                    </div>

                    <div class="modal-body">
                        <h6 class="font-weight-semibold">Informations</h6>
                        <p><strong>Dénomination: </strong>{{ proprietaire.name }}</p>
                        <hr>
                        <h6 class="font-weight-semibold">Adresses proprietaires</h6>
                        <table class="table table-sm table-condensed table-bordered table-striped table-hover">
                            <tr>
                                <th>Email: </th>
                                <td>{{ proprietaire.adresses.email ?? '--------' }}</td>
                            </tr>
                            <tr>
                                <th>Téléphone: </th>
                                <td>{{ proprietaire.adresses.phone ?? '--------' }}</td>
                            </tr>
                            <tr>
                                <th>Code postal: </th>
                                <td>{{ proprietaire.adresses.postalCode ?? '--------' }}</td>
                            </tr>
                            <tr>
                                <th>Numéro de rue ou adresse: </th>
                                <td>{{ proprietaire.adresses.street ?? '--------' }}</td>
                            </tr>
                            <tr>
                                <th>Ville: </th>
                                <td>{{ proprietaire.adresses.city ?? '--------' }}</td>
                            </tr>
                            <tr>
                                <th>Pays ou Etat: </th>
                                <td>{{ proprietaire.adresses.country ?? '--------' }}</td>
                            </tr>
                        </table>
                    </div>

                    <div class="modal-footer">
                        <button type="button" class="btn btn-link" data-dismiss="modal">Fermer</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- /primary modal -->
    {% endfor %}
{% endblock %}

