templates/front/animal/single.html.twig line 62

  1. {% extends 'layout/base.html.twig' %}
  2. {% block title %}Adopciaki.pl - Profil - {{ animal.name }}{% endblock %}
  3. {% block og_title %}Cześć jestem {{ animal.name }}{% endblock %}
  4. {% set shortDesc = 'Adopciaki.pl to program wspierający odpowiedzialne adopcje psów i kotów. Pomagamy dobrać zwierzaka do stylu życia opiekuna i zapewniamy pomoc specjalistów.' %}
  5. {% if(animal.shortDescription is empty) %}
  6.     {% set shortDesc = animal.description|striptags %}
  7. {% else %}
  8.     {% set shortDesc = animal.shortDescription %}
  9. {% endif %}
  10. {# Animal Age #}
  11. {% set difference = date("now"|date("Y-m-d")).diff(date(animal.bornDate|date('Y-m-d'))) %}
  12. {%  set diffYears = difference.days / 365 %}
  13. {% set months = 0 %}
  14. {% if difference.days < 365 %}
  15.     {% set months = 1 %}
  16.     {%  set diffYears = difference.days / 30 %}
  17. {% endif %}
  18. {% if diffYears|round(0, 'floor') == 0 %}
  19.     {% set animalAge = 1 %}
  20. {% else %}
  21.     {% set animalAge = diffYears|round(0, 'floor') %}
  22. {% endif %}
  23. {% if months == 1 %}
  24.     {% if animalAge == 1 %}
  25.         {% set yearsMonths = 'miesiąc' %}
  26.     {% elseif (animalAge % 10 ) >= 2 and (animalAge % 10) <= 4 %}
  27.         {% if (animalAge % 100) >= 10 and (animalAge % 100) <= 20 %}
  28.             {% set yearsMonths = 'miesięcy' %}
  29.         {% else %}
  30.             {% set yearsMonths = 'miesiące' %}
  31.         {% endif %}
  32.     {% else %}
  33.         {% set yearsMonths = 'miesięcy' %}
  34.     {% endif %}
  35. {% else %}
  36.     {% if animalAge == 1 %}
  37.         {% set yearsMonths = 'rok' %}
  38.     {% elseif (animalAge % 10 ) >= 2 and (animalAge % 10) <= 4 %}
  39.         {% if (animalAge % 100) >= 10 and (animalAge % 100) <= 20 %}
  40.             {% set yearsMonths = 'lat' %}
  41.         {% else %}
  42.             {% set yearsMonths = 'lata' %}
  43.         {% endif %}
  44.     {% else %}
  45.         {% set yearsMonths = 'lat' %}
  46.     {% endif %}
  47. {% endif %}
  48. {% set fullDesc = shortDesc %}
  49. {% set shortDesc = 'Cześć jestem '~ animal.name ~'. Mam około '~animalAge~' '~yearsMonths~'. '~shortDesc %}
  50. {% block description %}{{ shortDesc }}{% endblock %}
  51. {% block og_description %}{{ shortDesc }}{% endblock %}
  52. {% if animal.featuredImage.id is not empty %}
  53. {#    {% block og_image %}#}
  54. {#        {{ asset(animalImage(animal.featuredImage.path)) | imagine_filter('animal_og_image') }}#}
  55. {#    {% endblock %}#}
  56. {% endif %}
  57. {% block content %}
  58.     {% set pollStatus = 'default' %}
  59. {#    {% if poll is not empty %}#}
  60. {#        {% set pollStatus = poll %}#}
  61. {#    {% endif %}#}
  62.     {% if animal.adoptionDate %}
  63.         {% set animalAdopted = 'adopted' %}
  64.     {% else %}
  65.         {% set animalAdopted = 'not-adopted' %}
  66.     {% endif %}
  67.     {% set isWatched = false %}
  68.     {%  if app.user.watchedAnimals is defined %}
  69.         {% for watchAnimal in  app.user.watchedAnimals%}
  70.             {% if watchAnimal.id == animal.id %}
  71.                 {% set isWatched = true %}
  72.             {% endif %}
  73.         {% endfor %}
  74.     {% endif %}
  75.     {% set kidAccept05 = true %}
  76.     {% set kidAccept510 = true %}
  77.     {% set kidAccept10plus = true %}
  78.     {% set kidAcceptName = 'Czuje się niepewnie w towarzystwie dzieci, polecamy raczej do domu bez dzieci' %}
  79.     {% for acceptance in  animal.kidAcceptances | sort %}
  80.         {% set kidAcceptName = acceptance.name %}
  81.     {% endfor %}
  82.     {% set mainImage = '' %}
  83.     {% set gallery = [] %}
  84.     {% for key,picture in animal.pictures %}
  85.         {% if key == 0  %}
  86.             {% set mainImage = asset(animalImage(animal.featuredImage.path)) | imagine_filter('animal_listing_thumb') %}
  87.         {% elseif key > 0 and picture.id != animal.fbSqImageId and picture.id != animal.fbLargeImageId %}
  88.             {% set gallery = gallery|merge([asset(animalImage(picture.path)) | imagine_filter('animal_gallery_thumb')]) %}
  89.         {% endif %}
  90.     {% endfor %}
  91.     {#    {% set noteItemGallery = [] %}#}
  92.     {#    {% for key,note in notes %}#}
  93.     {#        {% if note.pictures  %}#}
  94.     {#            {% for key,picture in note.pictures %}#}
  95.     {#                {% set noteItemGallery = noteItemGallery|merge([asset(animalImage(picture.path)) | imagine_filter('animal_gallery_image')]) %}#}
  96.     {#            {% endfor %}#}
  97.     {#        {% endif %}#}
  98.     {#    {% endfor %}#}
  99.     {% set prepSimilarAnimals = [] %}
  100.     {% for key,animalItem in similarAnimals %}
  101.         {% if animalItem.id is not same as(animal.id)  %}
  102.             {% set prepSimilarAnimals = prepSimilarAnimals|merge([{
  103.                 'url' : path('base_front_animal_single', {'id':animalItem.id, 'name': animalItem.name}),
  104.                 'image' : asset(animalImage(animalItem.featuredImage.path)) | imagine_filter('animal_gallery_thumb')
  105.             }]) %}
  106.         {% endif %}
  107.     {% endfor %}
  108.     {% set isLogged = 'false' %}
  109.     {% if is_granted('IS_AUTHENTICATED') %}
  110.         {% set isLogged = 'true' %}
  111.     {% endif %}
  112.     <section id="animal-profile">
  113.         <div class="container-fluid pt-0 animal-header {% if(animalAdopted == 'adopted') %}animal-adopted{% endif %} mb-4">
  114.             <div class="container">
  115.                 <div class="row d-flex justify-content-center pt-0 pb-5">
  116.                     <div class="col-12">
  117.                         <h1 class="animal-heading-title mt-4 mb-5">Cześć, jestem <b>{{ animal.name }}</b> {% if(animalAdopted == 'adopted') %}- mam dom{% endif %}</h1>
  118.                     </div>
  119.                     <div class="row">
  120.                         <div class="col-12 col-lg-6 mb-5 mb-lg-0">
  121.                             <div class="row">
  122.                                 <div class="col-12 col-sm-6">
  123.                                     <img class="img-fluid" src="{{ mainImage }}" />
  124.                                 </div>
  125.                                 <div class="col-12 col-sm-6">
  126.                                     <div class="row">
  127.                                         <div class="col-12 pt-lg-3">
  128.                                             <p class="animal-heading-info"><b>Zwierzak:</b> {{ animal.species.name }}</p>
  129.                                         </div>
  130.                                         <div class="col-12">
  131.                                             <p class="animal-heading-info"><b>Płeć:</b> {{ animal.sex.name }}</p>
  132.                                         </div>
  133.                                         <div class="col-12">
  134.                                             <p class="animal-heading-info"><b>Wiek:</b> {% if animal.isAgeInMonths == true %}do 1 roku{% else %}{{ animal.age }} {{ yearsMonths }}{% endif %}</p>
  135.                                         </div>
  136.                                         <div class="col-12">
  137.                                             <p class="animal-heading-info"><b>Waga:</b> {{ animal.weight }} kg</p>
  138.                                         </div>
  139.                                         <div class="col-12">
  140.                                             <p class="animal-heading-info"><b>Rozmiar:</b> {{ animal.size }}</p>
  141.                                         </div>
  142.                                         <div class="col-12">
  143.                                             <p class="animal-heading-info"><b>Aktywność:</b> {{ animal.lifeStyle.name }}</p>
  144.                                         </div>
  145.                                     </div>
  146.                                 </div>
  147.                             </div>
  148.                         </div>
  149.                         <div class="col-12 col-lg-6 mb-5 mb-lg-0">
  150.                             <div class="row">
  151.                                 <div class="col-12 col-md-6">
  152.                                     <div class="row pb-4 mini-gallery">
  153.                                         {% for key,picture in animal.pictures %}
  154.                                             {% if key == 1 or key == 2 %}
  155.                                                 {% if picture.id != animal.fbSqImageId and picture.id != animal.fbLargeImageId %}
  156.                                                     <div class="col-6">
  157.                                                         <div class="image" data-image="{{ asset(animalImage(picture.path)) | imagine_filter('animal_gallery_thumb') }}">
  158.                                                             <img src="{{ asset(animalImage(picture.path)) | imagine_filter('animal_gallery_thumb') }}" class="img-fluid">
  159.                                                         </div>
  160.                                                     </div>
  161.                                                 {% endif %}
  162.                                             {% endif %}
  163.                                         {% endfor %}
  164.                                     </div>
  165.                                     <div class="row mini-gallery">
  166.                                         {% for key,picture in animal.pictures %}
  167.                                             {% if key == 3 or key == 4 %}
  168.                                                 {% if picture.id != animal.fbSqImageId and picture.id != animal.fbLargeImageId %}
  169.                                                     <div class="col-6">
  170.                                                         <div class="image" data-image="{{ asset(animalImage(picture.path)) | imagine_filter('animal_gallery_thumb') }}">
  171.                                                             <img src="{{ asset(animalImage(picture.path)) | imagine_filter('animal_gallery_thumb') }}" class="img-fluid">
  172.                                                         </div>
  173.                                                     </div>
  174.                                                 {% endif %}
  175.                                             {% endif %}
  176.                                         {% endfor %}
  177.                                     </div>
  178.                                 </div>
  179.                                 <div class="col-12 col-md-6">
  180.                                     <div class="row">
  181.                                         {% if animal.kidAcceptances %}
  182.                                             <div class="col-12 pt-lg-4">
  183.                                                 <p class="animal-heading-info2"><b>Czy może mieszkać z dziećmi?</b><br/>
  184.                                                     {% for kidAcceptance in animal.kidAcceptances %}
  185.                                                         {{ kidAcceptance.name }}<br/>
  186.                                                     {% endfor %}
  187.                                                 </p>
  188.                                             </div>
  189.                                         {% endif %}
  190.                                         {% if animal.notAcceptings is iterable %}
  191.                                             <div class="col-12">
  192.                                                 <p class="animal-heading-info2"><b>Czy może mieszkać z innymi zwierzętami?</b>
  193.                                                     {% if animal.notAcceptings is iterable %}
  194.                                                         {% for key,notAccepting in animal.notAcceptings %}
  195.                                                             <span class="d-block">{{ notAccepting }}</span>
  196.                                                         {% endfor %}
  197.                                                     {% else %}
  198.                                                         <br>
  199.                                                         {{ animal.notAcceptings }}
  200.                                                     {% endif %}
  201.                                                 </p>
  202.                                             </div>
  203.                                         {% endif %}
  204.                                         {% if animal.timeCareNeeded is iterable  %}
  205.                                             <div class="col-12">
  206.                                                 <p class="animal-heading-info2"><b>Czy może zostawać sam w domu?</b><br/>
  207.                                                     {% for key,timeCare in animal.timeCareNeeded %}
  208.                                                         <span class="d-block">{{ timeCare }}</span>
  209.                                                     {% endfor %}
  210.                                                 </p>
  211.                                             </div>
  212.                                         {% endif %}
  213.                                         {% if animal.city2 %}
  214.                                             <div class="col-12">
  215.                                                 <p class="animal-heading-info2"><b>Miejsce tymczasowego pobytu:</b> {{ animal.city2 }}
  216.                                                 </p>
  217.                                             </div>
  218.                                         {% endif %}
  219.                                         {% if animal.possibility %}
  220.                                             <div class="col-12">
  221.                                                 <p class="animal-heading-info2"><b>Możliwość adopcji:</b> {{ animal.possibility.name }}</p>
  222.                                             </div>
  223.                                         {% endif %}
  224.                                     </div>
  225.                                 </div>
  226.                             </div>
  227.                         </div>
  228.                     </div>
  229.                 </div>
  230.             </div>
  231.         </div>
  232.         <div class="container-fluid pt-0 pt-md-5">
  233.             <div class="container">
  234.                 <div class="row d-flex justify-content-center pt-0">
  235.                     <div class="col-12">
  236.                         <p class="animal-sub-info">{{ animal.description|striptags }}</p>
  237.                     </div>
  238.                     <div class="col-12 mt-4 mb-5">
  239.                         <div class="gallery gallery-not-adopted">
  240.                             <div class="row">
  241.                                 <gallery :images="{{ gallery | json_encode }}"></gallery>
  242.                             </div>
  243.                         </div>
  244.                     </div>
  245.                 </div>
  246.             </div>
  247.         </div>
  248.         {% if(animalAdopted == 'not-adopted') %}
  249.             <div class="mb-md-5">
  250.                 <animal-poll
  251.                         is-logged="{{ isLogged }}"
  252.                         animal-path="{{ path('animal_poll_step', {animal : animal.id}) }}"
  253.                         animal-specie-type="{{ animal.species.name }}"
  254.                         image="{{ mainImage }}"
  255.                 ></animal-poll>
  256.             </div>
  257.         {% endif %}
  258.         <div class="container-fluid pt-4 pb-5">
  259.             <div class="container">
  260.                 <div class="row d-flex justify-content-center pt-0">
  261.                     <div class="col-12 col-md-12 col-lg-12">
  262.                         <div class="row">
  263.                             <div class="col-12 col-md-4">
  264.                                 <div class="col-12">
  265.                                     <a href="{{ path('animals_all') }}" class="btn btn-primary btn-lg mb-2 mt-2 w-100">Poznaj wszystkie
  266.                                         nasze
  267.                                         Adopciaki</a>
  268.                                 </div>
  269.                                 <div class="col-12">
  270.                                     <a href="{{ path('app_adoption_process') }}" class="btn btn-primary btn-lg mb-2 mt-2 w-100">Sprawdź, jak adoptować</a>
  271.                                 </div>
  272.                             </div>
  273.                             <div class="col-12 col-md-4">
  274.                                 <div class="col-12">
  275.                                     <a href="{{ path('app_about_us') }}" class="btn btn-secondary btn-lg mb-2 mt-2 w-100">Zobacz, jak działamy</a>
  276.                                 </div>
  277.                                 <div class="col-12">
  278.                                     <a href="{{ path('app_support_us') }}" class="btn btn-secondary btn-lg mb-2 mt-2  w-100">Sprawdź, jak możesz pomóc</a>
  279.                                 </div>
  280.                             </div>
  281.                             <div class="col-12 col-md-4">
  282.                                 <div class="col-12">
  283.                                     <a href="{{ path('animals_all') }}" class="btn btn-secondary btn-lg mb-2 mt-2 w-100">Mogą do Ciebie pasować również</a>
  284.                                 </div>
  285.                                 <div class="col-12">
  286.                                     <div class="similar-animals">
  287.                                         <similar-animals :similar-animals="{{ prepSimilarAnimals | json_encode }}"></similar-animals>
  288.                                     </div>
  289.                                 </div>
  290.                             </div>
  291.                         </div>
  292.                     </div>
  293.                 </div>
  294.             </div>
  295.         </div>
  296.         {% if notes %}
  297.             <div class="container-fluid pt-4 pb-5">
  298.             <div class="container">
  299.                 <div class="row d-flex justify-content-center pt-0">
  300.                     <div class="col-12 col-md-12 col-lg-12">
  301.                         <div class="adopt-news">
  302.                             <h3>Z dzienniczka <span>Adopciaka</span></h3>
  303.                             <div class="block-wrapper">
  304.                                 {% for noteItem in notes %}
  305.                                     <div class="note-item">
  306.                                         <div class="row">
  307.                                             <div class="col-auto">
  308.                                                 <p class="date">{{ noteItem.publishedDate|date("d.m.Y") }}</p>
  309.                                             </div>
  310.                                             <div class="col">
  311.                                                 {% if(noteItem.title | length is not same as(0)) %}
  312.                                                     <p class="title">{{ noteItem.title }}</p>
  313.                                                 {% endif %}
  314.                                                 <div class="text">{{ noteItem.content | replace({'<p>​</p>': ""}) | raw  }}</div>
  315.                                                 {% if(noteItem.pictures | length is not same as(0)) %}
  316.                                                     <div class="image">
  317.                                                         <img src="{{ asset(animalImage(noteItem.pictures[0].path)) | imagine_filter('animal_gallery_thumb') }}" alt="">
  318.                                                     </div>
  319.                                                 {% endif %}
  320.                                             </div>
  321.                                         </div>
  322.                                     </div>
  323.                                 {% endfor %}
  324.                             </div>
  325.                         </div>
  326.                     </div>
  327.                 </div>
  328.             </div>
  329.         </div>
  330.         {% endif %}
  331.     </section>
  332. {% endblock %}