{% extends 'base.html.twig' %}{% block metaTitle %}Favoriten - {{ parent() }}{% endblock %}{% block body %} <div class="page-title-overlap pt-2 pt-md-4 hintergrundfarbe schriftfarbe"> <div class="container d-lg-flex justify-content-between py-2 py-lg-3"> <div class="order-lg-1 pe-lg-4 text-center text-lg-start"> <h3 class="schriftfarbe mb-0">Favoriten</h3> </div> </div> </div> <!-- Page Title--> <section class="container mb-3 pb-3"> <div class="bg-light shadow-lg rounded-3 overflow-hidden"> {% if favoriten|length != 0 %} {% for favorit in favoriten %} {% set firmenname = 'unbekannt' %} {% for firmenprofil in firmenprofile %} {% if favorit.schulung.erstellerFirmenId == firmenprofil.id %} {% set firmenname = firmenprofil.firmenname %} {% endif %} {% endfor %} <div class="favoriten-block p-3"> <div class="d-sm-flex justify-content-between mt-4 pb-4 border-bottom"> <div class="d-block d-sm-flex align-items-start text-center text-sm-start"> <a class="d-block flex-shrink-0 mx-auto me-sm-4" href="{{ path('produkt_details',{id:favorit.schulung.id}) }}{% if favorit.schulung.nurCelsisten == 4 %}?guid={{ favorit.schulung.importFehler }}{% endif %}" style="width: 10rem;"> <img src="{{ asset('uploads/schulungen/' ~ favorit.schulung.id ~ '/titelbild/' ~ favorit.schulung.titelbild ) }}" alt="Bild" style="border-radius: 5px"> </a> <div class="pt-2"> <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> <div class="fs-sm"><span class="text-muted me-2">{{ favorit.schulung.kurzbeschreibung }}</span></div> <div class="fs-sm">{{ favorit.schulung.schulungsart.name }}</div> </div> </div> <div class="pt-2 ps-sm-3 mx-auto mx-sm-0 text-center"> <button href="{{ path ('user_produkt_favoriten_loeschen',{id:favorit.schulung.id}) }}" title="aus Favoriten entfernen" class="btn-wishlist btn-sm btn-heart-favorite" type="button"> <i class="mdi mdi-heart-minus fs-4"></i> </button> </div> </div> </div> {% endfor %} {% else %} <div class="mb-10 p-3"> <p>Du hast noch keine Favoriten gespeichert</p> </div> {% endif %} </div> </section> <script> jQuery(function ($) { $(document).on('click', '.btn-heart-favorite', function (event) { event.preventDefault(); let $button = $(this); let $container = $button.closest('.favoriten-block'); let href = $(this).attr('href'); let favoritenAnzahl = parseInt($(".favoriten-anzahl").text()); $.ajax({ 'url': href, 'method': 'get', 'success': function (response) { $container.addClass('d-none'); $(".favoriten-anzahl").text(favoritenAnzahl - 1); }, 'error': function (response) { console.log('Fehler bei Ajax-Link' + response) } }); }); }); </script>{% endblock %}