templates/user/start/gast_favoriten.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block metaTitle %}Favoriten - {{ parent() }}{% endblock %}
  3. {% block body %}
  4.     <div class="page-title-overlap pt-2 pt-md-4 hintergrundfarbe schriftfarbe">
  5.         <div class="container d-lg-flex justify-content-between py-2 py-lg-3">
  6.             <div class="order-lg-1 pe-lg-4 text-center text-lg-start">
  7.                 <h3 class="schriftfarbe mb-0">Favoriten</h3>
  8.             </div>
  9.         </div>
  10.     </div>
  11.     <!-- Page Title-->
  12.     <section class="container mb-3 pb-3">
  13.         <div class="bg-light shadow-lg rounded-3 overflow-hidden">
  14.             {% if favoriten|length != 0 %}
  15.                 {% for favorit in favoriten %}
  16.                     {% set firmenname = 'unbekannt' %}
  17.                     {% for firmenprofil in firmenprofile %}
  18.                         {% if favorit.schulung.erstellerFirmenId == firmenprofil.id %}
  19.                             {% set firmenname = firmenprofil.firmenname %}
  20.                         {% endif %}
  21.                     {% endfor %}
  22.                     <div class="favoriten-block p-3">
  23.                         <div class="d-sm-flex justify-content-between mt-4 pb-4 border-bottom">
  24.                             <div class="d-block d-sm-flex align-items-start text-center text-sm-start">
  25.                                 <a class="d-block flex-shrink-0 mx-auto me-sm-4"
  26.                                    href="{{ path('produkt_details',{id:favorit.schulung.id}) }}{% if favorit.schulung.nurCelsisten == 4 %}?guid={{ favorit.schulung.importFehler }}{% endif %}"
  27.                                    style="width: 10rem;">
  28.                                     <img src="{{ asset('uploads/schulungen/' ~ favorit.schulung.id ~ '/titelbild/' ~ favorit.schulung.titelbild ) }}" alt="Bild" style="border-radius: 5px">
  29.                                 </a>
  30.                                 <div class="pt-2">
  31.                                     <h3 class="product-title fs-base mb-2"><a href="{{ path('produkt_details',{id:favorit.schulung.id}) }}{% if favorit.schulung.nurCelsisten == 4 %}?guid={{ favorit.schulung.importFehler }}{% endif %}">{{ favorit.schulung.schulungName }}</a></h3>
  32.                                     <div class="fs-sm"><span class="text-muted me-2">{{ favorit.schulung.kurzbeschreibung }}</span></div>
  33.                                     <div class="fs-sm">{{ favorit.schulung.schulungsart.name }}</div>
  34.                                 </div>
  35.                             </div>
  36.                             <div class="pt-2 ps-sm-3 mx-auto mx-sm-0 text-center">
  37.                                 <button href="{{ path ('user_produkt_favoriten_loeschen',{id:favorit.schulung.id}) }}"
  38.                                         title="aus Favoriten entfernen"
  39.                                         class="btn-wishlist btn-sm btn-heart-favorite"
  40.                                         type="button">
  41.                                     <i class="mdi mdi-heart-minus fs-4"></i>
  42.                                 </button>
  43.                             </div>
  44.                         </div>
  45.                     </div>
  46.                 {% endfor %}
  47.             {% else %}
  48.                 <div class="mb-10 p-3">
  49.                     <p>Du hast noch keine Favoriten gespeichert</p>
  50.                 </div>
  51.             {% endif %}
  52.         </div>
  53.     </section>
  54.     <script>
  55.         jQuery(function ($) {
  56.             $(document).on('click', '.btn-heart-favorite', function (event) {
  57.                 event.preventDefault();
  58.                 let $button = $(this);
  59.                 let $container = $button.closest('.favoriten-block');
  60.                 let href = $(this).attr('href');
  61.                 let favoritenAnzahl = parseInt($(".favoriten-anzahl").text());
  62.                 $.ajax({
  63.                     'url': href,
  64.                     'method': 'get',
  65.                     'success': function (response) {
  66.                         $container.addClass('d-none');
  67.                         $(".favoriten-anzahl").text(favoritenAnzahl - 1);
  68.                     },
  69.                     'error': function (response) {
  70.                         console.log('Fehler bei Ajax-Link' + response)
  71.                     }
  72.                 });
  73.             });
  74.         });
  75.     </script>
  76. {% endblock %}