templates/category/show.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}
  3.     {% if properties is defined and properties[0] is defined and properties[0].category is defined and properties[0].category.name is defined %}
  4.         {{ properties[0].category.name }}
  5.     {% else %}
  6.         Catégorie vide
  7.     {% endif %}
  8.     {{ parent() }}
  9. {% endblock %}
  10. {% block body %}
  11. <link rel="stylesheet" href="{{ asset('css/swip.css') }}">
  12. <style>
  13. .row{
  14. margin-left:0;
  15. margin-right:0;
  16.     }
  17. </style>
  18. {% if properties is not empty %}
  19. <div id="modals">
  20.         {% for property in properties %}
  21.             {{ include('modal/show.html.twig', { 'property': property }) }}
  22.         {% endfor %}
  23.     </div>
  24. <h1 class="text-center m-5">{{ properties[0].category.name }}</h1>
  25. {{ properties[0].category.describ }}
  26. <div class="row">
  27.     {% for property in properties %}
  28.         <div class="col-md-4 mb-4 rounded-pill">
  29.             <div class="card p-4 shadow " style="height:660px;">
  30.                 {% if property.images|length > 0 %}
  31.                     <img style="width: 100%; height: 400px; object-fit: cover;" src="{{ asset('images/properties/' ~ property.images[0].imagename) }}" alt="{{ property.title }}">
  32.                 {% else %}
  33.                     <img src="{{ asset('images/no-image.png') }}" style="width: 100%; height: 400px; object-fit: cover;" alt="No image available">
  34.                 {% endif %}
  35.                 <div class="card-body">
  36.                     <h2 class="card-title">{{ property.title }}</h2>
  37.                     <h5 class="card-text text-danger">{{ property.housingType.name }} - {{ property.category.name }}
  38.                         {% if property.category.name matches '/location/i' and property.subType is not empty %}
  39.                             - {{ property.subType.name }}
  40.                         {% endif %}
  41.                     </h5>
  42.                     {% if property.category.name matches '/location/i' and property.subType is not empty %}
  43.                         <h2 class="card-text" id="price">{{ property.rent }} &euro;/mois</h2>
  44.                     {% else %}
  45.                         <h2 class="card-text" id="price">{{ property.price|number_format }} &euro;</h2>
  46.                     {% endif %}
  47.                     <div class="d-flex">
  48.                             <div class="d-flex flex-row align-items-center">
  49.                                 <button id="favori-button-{{ property.id }}" class="favori-button"   onclick="toggleFavori({{ property.id }})" data-property-id="{{ property.id }}"></button>
  50.                                 <h6 class="fs-6 ml-2 position-relative" id="favori_numb" >{{ property.favoritNumber }}</h6>
  51.                                 
  52.                 </div>
  53.                             <button id="voir"type="button" class="btn open-modal-btn mt-4 text-white px-4 py-2 rounded" data-toggle="modal" data-target="#exampleModal-{{ property.id }}">Voir</button>
  54.                         </div>
  55.                 </div>
  56.             </div>
  57.         </div>
  58.     {% endfor %}
  59. </div>
  60. {% else %}
  61. <div style="display:flex; flex-direction:row; align-items: center;justify-content: center;">
  62. <img src="{{ asset('images/croix_icon_rouge.png') }}" alt="icon de la croix rouge" width="110" height="110" class="d-inline-block align-text-top">
  63. <div style="display:flex; flex-direction: column">
  64.     <h2 style="color:#ce2248">Cette catĂ©gorie est vide pour le moment</h2>
  65.     <h4 style="font-weight: 100;">Revenez un autre moment.</h4>
  66. </div>
  67. </div>
  68. {% endif %}
  69. <script>
  70. $(function () {
  71.             $('[data-toggle="tooltip"]').tooltip({
  72.                 delay: { "show": 500, "hide": 100 },
  73.                 customClass: 'custom-tooltip'
  74.             });
  75.         });
  76. window.favoriUpdateUrl = '{{ path('app_favori_update') }}';
  77. </script>
  78.         
  79.     <script src="{{ asset('js/favorit.js') }}"></script>
  80. {% endblock %}