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

{% block title %} Annonce {% endblock %}


{% block stylesheets %}
    {{ parent() }}
    {{ encore_entry_link_tags('app_backend_annonce') }}
{% endblock %}

{% block content %}
<!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4">
    <h1 class="h3 mb-0 text-gray-800">Anonnce Images</h1>
    <ol class="breadcrumb float-sm-right">
        <li class="breadcrumb-item active">Anonnce</li>
        <li class="breadcrumb-item active">Images</li>
    </ol>
</div>

<div class="row">

    {% include 'backend_admin/basic/notice.html.twig' %}
    
    <div class="card shadow mb-4"  >
        <!-- Card Header - Dropdown -->
        <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
            <h6 class="m-0 font-weight-bold text-primary">Chargement des images d'annonce pour la page d'accueil et de recherche</h6>
        </div>
        <!-- Card Body -->
        <div class="card-body">
            <table class="table" border="1" align="center">
                <tbody>
                    <tr>
                        <td width="15%">
                            <div class="holder">
                                {% if annonce.getImageHome() %}
                                    <img id="img-preview-home" class="img-thumbnail" src="{{ asset('uploads/images/annonces/' ~ annonce.getImageHome()) }}" alt="pic"/>
                                {% else %}
                                    <img id="img-preview-home" class="img-thumbnail" src="{{ asset('images/backend/img/h.png') }}" alt="pic"/>
                                {% endif %}
                            </div>
                        </td>
                        <td width="75%">
                            <div class="progress" >
                                <div class="progress-bar" id="progress-bar-accueil" role="progressbar" style="width: 0%" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">0%</div>
                            </div>
                            <fieldset class="upload_dropZone text-center mb-3 p-4">
                                <p>
                                    Image pour la page <b>d'accueil</b>
                                </p>
                                <p class="small my-3">
                                    Largeur d'image doit d'être <b>{{ annonce.getDimensionWidth() }}px</b> | Hauteur d'image doit d'être <b>240px</b><br>
                                </p>
                                <input id="upload_image_accueil"  class="position-absolute invisible" type="file" accept="image/jpeg, image/png, image/gif, image/jpg" multiple="false"/>
                                <label class="btn btn-upload mb-3" for="upload_image_accueil"> 
                                    <i class="fa-regular fa-image"></i> choisir  l'image
                                </label>
                            </fieldset>
                        </td>
                        <td width="10%">
                            <br>
                            <button type="button" class="btn btn-primary" id="submit-image-accueil">
                                <i class="fa-solid fa-cloud-arrow-up fa-lg"></i> Importer
                            </button>
                        </td>
                    </tr>
                    <tr>
                        <td width="15%">
                            <div class="holder">
                                {% if annonce.getImageSearch() %}
                                    <img id="img-preview-search" class="img-thumbnail" src="{{ asset('uploads/images/annonces/' ~ annonce.getImageSearch()) }}" alt="pic"/>
                                {% else %}
                                    <img id="img-preview-search" class="img-thumbnail" src="{{ asset('images/backend/img/h.png') }}" alt="pic"/>
                                {% endif %}
                            </div>
                        </td>
                        <td width="75%">
                            <div class="progress" >
                                <div class="progress-bar" id="progress-bar-search" role="progressbar" style="width: 0%" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">0%</div>
                            </div>
                            <fieldset class="upload_dropZone text-center mb-3 p-4">
                                <p>
                                    Image pour la page <b>de recherche</b>
                                </p>
                                <p class="small my-3">
                                    Largeur d'image doit d'être <b>438px</b> | Hauteur d'image doit d'être <b>240px</b><br>
                                </p>
                                <input id="upload_image_search"  class="position-absolute invisible" type="file" accept="image/jpeg, image/png, image/gif, image/jpg" />
                                <label class="btn btn-upload mb-3" for="upload_image_search"> 
                                    <i class="fa-regular fa-image"></i> choisir  l'image
                                </label>
                            </fieldset>
                        </td>
                        <td width="10%">
                            <br>
                            <button type="button" class="btn btn-primary" id="submit-image-search">
                                <i class="fa-solid fa-cloud-arrow-up fa-lg"></i> Importer
                            </button>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>








    <div class="card shadow mb-4"  >
        <!-- Card Header - Dropdown -->
        <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
            <h6 class="m-0 font-weight-bold text-primary">Chargement des images d'annonce pour la page détail</h6>
        </div>
        <!-- Card Body -->
        <div class="card-body">
            <table class="table" border="1" align="center">
                <tbody>
                    <tr>
                        <td width="15%">
                            <div class="holder">
                                {% if annonce.getImageDetail1() %}
                                    <img id="img-preview-detail1" class="img-thumbnail" src="{{ asset('uploads/images/annonces/' ~ annonce.getImageDetail1()) }}" alt="pic"/>
                                {% else %}
                                    <img id="img-preview-detail1" class="img-thumbnail" src="{{ asset('images/backend/img/h.png') }}" alt="pic"/>
                                {% endif %}
                            </div>
                        </td>
                        <td width="75%">
                            <div class="progress" >
                                <div class="progress-bar" id="progress-bar-detail1" role="progressbar" style="width: 0%" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">0%</div>
                            </div>
                            <fieldset class="upload_dropZone text-center mb-3 p-4">
                                <p>
                                    Image 1 pour la page <b>détail</b>
                                </p>
                                <p class="small my-3">
                                    Taille maximum de l'image 2Mo<br>
                                </p>
                                <input id="upload_image_detail1"  class="position-absolute invisible" type="file" accept="image/jpeg, image/png, image/gif, image/jpg" />
                                <label class="btn btn-upload mb-3" for="upload_image_detail1"> 
                                    <i class="fa-regular fa-image"></i> choisir  l'image
                                </label>
                            </fieldset>
                        </td>
                        <td width="10%">
                            <br>
                            <button type="button" class="btn btn-primary" id="submit-image-detail1">
                                <i class="fa-solid fa-cloud-arrow-up fa-lg"></i> Importer
                            </button>
                            {#<button type="button" class="btn btn-warning"><i class="fa-solid fa-pen-to-square"></i> Editer </button><button type="button" class="btn btn-success"><i class="fa-solid fa-magnifying-glass"></i> Afficher</button><button type="button" class="btn btn-danger"><i class="fa-solid fa-trash"></i> Supprimer/button>#}
                        </td>
                    </tr>
                    <tr>
                        <td width="15%">
                            <div class="holder">
                                {% if annonce.getImageDetail2() %}
                                    <img id="img-preview-detail2" class="img-thumbnail" src="{{ asset('uploads/images/annonces/' ~ annonce.getImageDetail2()) }}" alt="pic"/>
                                {% else %}
                                    <img id="img-preview-detail2" class="img-thumbnail" src="{{ asset('images/backend/img/h.png') }}" alt="pic"/>
                                {% endif %}
                            </div>
                        </td>
                        <td width="75%">
                            <div class="progress" >
                                <div class="progress-bar" id="progress-bar-detail2" role="progressbar" style="width: 0%" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">0%</div>
                            </div>
                            <fieldset class="upload_dropZone text-center mb-3 p-4">
                                <p>
                                    Image 2 pour la page <b>détail</b>
                                </p>
                                <p class="small my-3">
                                    Taille maximum de l'image 2Mo<br>
                                </p>
                                <input id="upload_image_detail2"  class="position-absolute invisible" type="file" accept="image/jpeg, image/png, image/gif, image/jpg" />
                                <label class="btn btn-upload mb-3" for="upload_image_detail2"> 
                                    <i class="fa-regular fa-image"></i> choisir  l'image
                                </label>
                            </fieldset>
                        </td>
                        <td width="10%">
                            <br>
                            <button type="button" class="btn btn-primary" id="submit-image-detail2">
                                <i class="fa-solid fa-cloud-arrow-up fa-lg"></i> Importer
                            </button>
                            {#<button type="button" class="btn btn-warning"><i class="fa-solid fa-pen-to-square"></i> Editer </button><button type="button" class="btn btn-success"><i class="fa-solid fa-magnifying-glass"></i> Afficher</button><button type="button" class="btn btn-danger"><i class="fa-solid fa-trash"></i> Supprimer/button>#}
                        </td>
                    </tr>
                    <tr>
                        <td width="15%">
                            <div class="holder">
                                {% if annonce.getImageDetail3() %}
                                    <img id="img-preview-detail3" class="img-thumbnail" src="{{ asset('uploads/images/annonces/' ~ annonce.getImageDetail3()) }}" alt="pic"/>
                                {% else %}
                                    <img id="img-preview-detail3" class="img-thumbnail" src="{{ asset('images/backend/img/h.png') }}" alt="pic"/>
                                {% endif %}
                            </div>
                        </td>
                        <td width="75%">
                            <div class="progress" >
                                <div class="progress-bar" id="progress-bar-detail3" role="progressbar" style="width: 0%" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">0%</div>
                            </div>
                            <fieldset class="upload_dropZone text-center mb-3 p-4">
                                <p>
                                    Image 3 pour la page <b>détail</b>
                                </p>
                                <p class="small my-3">
                                    Taille maximum de l'image 2Mo<br>
                                </p>
                                <input id="upload_image_detail3"  class="position-absolute invisible" type="file" accept="image/jpeg, image/png, image/gif, image/jpg" />
                                <label class="btn btn-upload mb-3" for="upload_image_detail3"> 
                                    <i class="fa-regular fa-image"></i> choisir  l'image
                                </label>
                            </fieldset>
                        </td>
                        <td width="10%">
                            <br>
                            <button type="button" class="btn btn-primary" id="submit-image-detail3">
                                <i class="fa-solid fa-cloud-arrow-up fa-lg"></i> Importer
                            </button>
                            {#<button type="button" class="btn btn-warning"><i class="fa-solid fa-pen-to-square"></i> Editer </button><button type="button" class="btn btn-success"><i class="fa-solid fa-magnifying-glass"></i> Afficher</button><button type="button" class="btn btn-danger"><i class="fa-solid fa-trash"></i> Supprimer/button>#}
                        </td>
                    </tr>
                    <tr>
                        <td width="15%">
                            <div class="holder">
                                {% if annonce.getImageDetail4() %}
                                    <img id="img-preview-detail4" class="img-thumbnail" src="{{ asset('uploads/images/annonces/' ~ annonce.getImageDetail4()) }}" alt="pic"/>
                                {% else %}
                                    <img id="img-preview-detail4" class="img-thumbnail" src="{{ asset('images/backend/img/h.png') }}" alt="pic"/>
                                {% endif %}
                            </div>
                        </td>
                        <td width="75%">
                            <div class="progress" >
                                <div class="progress-bar" id="progress-bar-detail4" role="progressbar" style="width: 0%" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100">0%</div>
                            </div>
                            <fieldset class="upload_dropZone text-center mb-3 p-4">
                                <p>
                                    Image 4 pour la page <b>détail</b>
                                </p>
                                <p class="small my-3">
                                    Taille maximum de l'image 2Mo<br>
                                </p>
                                <input id="upload_image_detail4"  class="position-absolute invisible" type="file" accept="image/jpeg, image/png, image/gif, image/jpg" />
                                <label class="btn btn-upload mb-3" for="upload_image_detail4"> 
                                    <i class="fa-regular fa-image"></i> choisir  l'image
                                </label>
                            </fieldset>
                        </td>
                        <td width="10%">
                            <br>
                            <button type="button" class="btn btn-primary" id="submit-image-detail4">
                                <i class="fa-solid fa-cloud-arrow-up fa-lg"></i> Importer
                            </button>
                            {#<button type="button" class="btn btn-warning"><i class="fa-solid fa-pen-to-square"></i> Editer </button><button type="button" class="btn btn-success"><i class="fa-solid fa-magnifying-glass"></i> Afficher</button><button type="button" class="btn btn-danger"><i class="fa-solid fa-trash"></i> Supprimer/button>#}
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>



<!-- Modal -->
<div class="modal fade" id="cropperModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <img id="imgPreviewCropper" src="" data-type-img=""/>
            </div>
            <div class="modal-footer">
                <button id="resize-image" type="button" class="btn btn-primary">Redimensionner</button>
            </div>
        </div>
    </div>
</div>


{% endblock %}

{% block javascripts %}
    <script>

        var pathUplodImageAdd = "{{ path('backend_admin_annonce_uploder_add', {id: annonce.id }) }}";
        var pathUplodImageDelete = "{{ path('backend_admin_annonce_uploder_delete') }}";

        var heightImgAccueil = 240;
        var widthImgAccueil =  {{ annonce.getDimensionWidth() }};
        var largeurAnnonce = {{ annonce.getLargeur() }};

    </script>

    {{ parent() }}
    {{ encore_entry_script_tags('app_backend_annonce') }}
{% endblock %}