{% extends 'base.html.twig' %}

{% block title %}{% endblock %}

{% block body %}
    <div class="layout-px-spacing">
        <div class="page-header">
            <div class="page-title">
                <h3>Gestion des Juristes</h3>
            </div>
            <button type="button" class="btn btn-primary mb-2 mr-2" data-toggle="modal"
                    data-target="#addUser" style="float: right; margin-bottom: 16px; margin-top: 30px;">
                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
                     stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
                     class="feather feather-user-plus">
                    <path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
                    <circle cx="8.5" cy="7" r="4"></circle>
                    <line x1="20" y1="8" x2="20" y2="14"></line>
                    <line x1="23" y1="11" x2="17" y2="11"></line>
                </svg>
            </button>
            <!-- Modal -->
            <div class="modal fade" id="addUser" tabindex="-1" role="dialog"
                 aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
                <div class="modal-dialog modal-dialog-centered" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title">Ajouter un juriste</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24"
                                     viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
                                     stroke-linecap="round" stroke-linejoin="round" class="feather feather-x">
                                    <line x1="18" y1="6" x2="6" y2="18"></line>
                                    <line x1="6" y1="6" x2="18" y2="18"></line>
                                </svg>
                            </button>
                        </div>
                        <form method="post" enctype="multipart/form-data">
                            <div class="modal-body">
                                <!-- Email -->
                                <div class="row mb-4">
                                    <div class="col">
                                        <input type="email" name="email" class="form-control" placeholder="email">
                                    </div>
                                </div>
                                <!--Password -->
                                <div class="row mb-4">
                                    <div class="col">
                                        <input type="password" name="password" class="form-control"
                                               placeholder="password">
                                    </div>
                                </div>
                                <!--First Name -->
                                <div class="row mb-4">
                                    <div class="col">
                                        <input type="text" name="firstname" class="form-control" placeholder="Prénom">
                                    </div>
                                </div>
                                <!--Last Name -->
                                <div class="row mb-4">
                                    <div class="col">
                                        <input type="text" name="lastname" class="form-control" placeholder="Nom">
                                    </div>
                                </div>
                                <!--Tel -->
                                <div class="row mb-4">
                                    <div class="col">
                                        <input type="text" name="tel" class="form-control" placeholder="Téléphone">
                                    </div>
                                </div>
                                <!--Avatar -->
                                <div class="row mb-4">
                                    <div class="col text-center">
                                        <p class="mt-2"><i class="flaticon-cloud-upload mr-1"></i> Télécharger votre
                                            photo</p>
                                        <div class="upload mt-4 pr-md-4">
                                            {#
                                                  <input type="file" name="avatar" class="form-control" placeholder="Avatar">
                                            #}
                                            <input type="file" name="avatar" id="input-file-max-fs"
                                                   class="dropify"{# data-default-file="assets/img/200x200.jpg"#}
                                                   data-max-file-size="2M"/>

                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button class="btn" data-dismiss="modal"><i class="flaticon-cancel-12"></i> Annuler
                                </button>
                                <button type="submit" class="btn btn-primary">Enregistrer</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>

        <div class="row" id="cancel-row">

            <div class="col-xl-12 col-lg-12 col-sm-12  layout-spacing">
                <div class="widget-content widget-content-area br-6">
                    <div class="table-responsive mb-4 mt-4">
                        <table id="zero-config" class="table table-hover" style="width:100%">
                            <thead>
                            <tr>
                                <th class="no-content"></th>
                                <th>Nom</th>
                                <th>Prénom</th>
                                <th>email</th>
                                <th>Tél</th>
                                <th class="no-content"></th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for lawyer in lawyers %}
                                <tr>
                                    {#  <td>
                                          <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                               fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                               stroke-linejoin="round" class="feather feather-user text-info">
                                              <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
                                              <circle cx="12" cy="7" r="4"></circle>
                                          </svg>
                                      </td>#}

                                    <td class="text-center">
                                        {% if lawyer.avatar is not null %}
                                            <img src="{{ asset('uploads/lawyers/' ~ lawyer.avatar ) }}"
                                                 alt="{{ lawyer.avatar }}" class="rounded"
                                                 width="100">
                                        {% else %}
                                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
                                                 viewBox="0 0 24 24"
                                                 fill="none" stroke="currentColor" stroke-width="2"
                                                 stroke-linecap="round"
                                                 stroke-linejoin="round" class="feather feather-user text-info">
                                                <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
                                                <circle cx="12" cy="7" r="4"></circle>
                                            </svg>
                                        {% endif %}
                                    </td>
                                    <td>{{ lawyer.firsName }}</td>
                                    <td>{{ lawyer.lastName }}</td>
                                    <td>{{ lawyer.email }}</td>
                                    <td>{{ lawyer.tel }}</td>
                                    <td>
                                        <a href="{{ path('lawyer_edit', {'id': lawyer.id}) }}"
                                           class="btn btn-warning mb-2 mr-2 rounded-circle" title="modifier">
                                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
                                                 viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
                                                 stroke-linecap="round" stroke-linejoin="round"
                                                 class="feather feather-user-plus">
                                                <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
                                                <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
                                            </svg>
                                        </a>
                                        <form method="post" action="{{ path('lawyer_delete', {'id': lawyer.id}) }}"
                                              onsubmit="return confirm('Êtes-vous sûr de vouloir supprimer {{ lawyer.firsName ~ ' ' ~ lawyer.lastName }}');"
                                              style="display: inline">
                                            <input type="hidden" name="_method" value="DELETE">
                                            <input type="hidden" name="_token"
                                                   value="{{ csrf_token('delete' ~ lawyer.id) }}">
                                            <button class="btn btn-danger mb-2 mr-2 rounded-circle" title="Supprimer">
                                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
                                                     viewBox="0 0 24 24" fill="none" stroke="currentColor"
                                                     stroke-width="2"
                                                     stroke-linecap="round" stroke-linejoin="round"
                                                     class="feather feather-trash-2">
                                                    <polyline points="3 6 5 6 21 6"></polyline>
                                                    <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
                                                    <line x1="10" y1="11" x2="10" y2="17"></line>
                                                    <line x1="14" y1="11" x2="14" y2="17"></line>
                                                </svg>
                                            </button>
                                        </form>
                                    </td>
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

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

{% block stylesheets %}
    <link rel="stylesheet" type="text/css" href="{{ asset('plugins/table/datatable/datatables.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ asset('plugins/table/datatable/dt-global_style.css') }}">
    <link href="{{ asset('assets/css/components/custom-modal.css') }}" rel="stylesheet" type="text/css"/>

    <link rel="stylesheet" type="text/css" href="{{ asset('plugins/dropify/dropify.min.css') }}">
    <link href="{{ asset('assets/css/users/account-setting.css') }}" rel="stylesheet" type="text/css"/>
{% endblock %}

{% block javascripts %}
    <script src="{{ asset('plugins/table/datatable/datatables.js') }}"></script>
    <script>
        $('#zero-config').DataTable({
            "oLanguage": {
                "oPaginate": {
                    "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
                    "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
                },
                "sInfo": "Afficher la page _PAGE_ de _PAGES_",
                "sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
                "sSearchPlaceholder": "Recherche...",
                "sLengthMenu": "Résultats :  _MENU_",
            },
            "stripeClasses": [],
            "lengthMenu": [7, 10, 20, 50],
            "pageLength": 7
        });
    </script>
    <script src="{{ asset('plugins/dropify/dropify.min.js') }}"></script>
    <script src="{{ asset('plugins/blockui/jquery.blockUI.min.js') }}"></script>
    <!-- <script src="plugins/tagInput/tags-input.js"></script> -->
    <script src="{{ asset('assets/js/users/account-settings.js') }}"></script>

{% endblock %}