templates/pages/akaru/thalasso_niveau_2.html.twig line 1

Open in your IDE?
  1. {#
  2.     page: thalasso niveau 2
  3. #}
  4. {% extends "layouts/base.html.twig" %}
  5. {% set jsPageId = 'thalasso-detail' %}
  6. {% set pageClass = 'Thalasso-detail' %}
  7. {% block content %}
  8.     {# Header #}
  9.     {% include "component/header.html.twig" with {
  10.       props: {
  11.         account:{
  12.           link: path("app_signin", { '_locale': app.request.getLocale() }),
  13.           text: "myaccount.title"|trans
  14.         }
  15.       }
  16.     } %}
  17.     {# Hero content #}
  18.     {% include "component/hero_content.html.twig" with {
  19.     props: {
  20.       heading: {
  21.         title: frontservice.getHeaderFields(page, 'header_titre', lang)|nl2br,
  22.         titleAnnex: frontservice.getHeaderFields(page, 'header_sur_titre', lang)|nl2br
  23.       },
  24.       breadcrumb: frontservice.getBreadcrumb(page, lang),
  25.       background: frontservice.getMediaPublicUrl(page.headerImage, 'reference', frontservice.getHeaderFields(page, 'alt_header_img', lang)),
  26.       video:(frontservice.getHeaderVideo(page)) ? {
  27.         type:'video/mp4',
  28.         src: asset(frontservice.getHeaderVideo(page))
  29.       } : null
  30.     }
  31.   } only %}
  32.     {# Filter Bar #}
  33.     {# {% include "component/header/filter_bar.html.twig" with {
  34.     props:{
  35.       bookingtitle:"booking.title"|trans,
  36.     }
  37.   } only %} #}
  38.   {% if composants %}
  39.   {% set items_calendar = [] %}
  40.   {% set index = 0 %}
  41.     {% for composant in composants %}
  42.     {% if frontservice.getContentField(composant, 'masquer', lang) != 1 %}
  43.       {% set titre_principal = frontservice.getContentField(composant, 'titre_principal', lang)|replace({"\n": "<br />"})|raw %}
  44.       {% set surtitre = frontservice.getContentField(composant, 'surtitre', lang) %}
  45.       {% set introDescription = frontservice.getContentField(composant, 'intro_description', lang)|replace({"\n": "<br />"})|raw %}
  46.       {% set introDescriptionSecondaire = frontservice.getContentField(composant, 'intro_description_secondaire', lang)|replace({"\n": "<br />"})|raw %}
  47.       {# Introduction #}
  48.       {% if composant.cmsComposant.nomTechniqueComposant == "component/introduction.html.twig" %}
  49.         {% include "component/introduction.html.twig" with {
  50.           props: {
  51.             text: {
  52.               first: '<p>'~ introDescription ~'</p>',
  53.               second: '<p>'~ introDescriptionSecondaire ~'</p>'
  54.             },
  55.           }
  56.         } %}
  57.       {% endif %}
  58.       {# Care cards #}
  59.       {% if composant.cmsComposant.nomTechniqueComposant == "component/care_cards.html.twig" %}
  60.         {% set care_cards_items = composant.getCmsPageBlockComposantItems() %}
  61.         {% set items_elements = [] %}
  62.         {% if care_cards_items %}
  63.               {% for item in care_cards_items %} 
  64.                 {% set produit_thalasso_id = null %} 
  65.               
  66.               {% if item.produitThalasso %}
  67.                 {% set produit_thalasso_id = item.produitThalasso.id %} 
  68.                 {% set min_days = (item.produitThalasso.dureeJours == 0) ? 1 : item.produitThalasso.dureeJours %}
  69.                 {% set max_days = min_days %}
  70.                 {% set items_calendar = items_calendar|merge([{prod_id: item.produitThalasso.id}]) %}
  71.               {% else %} 
  72.                 {% set min_days = 1 %}
  73.                 {% set max_days = 1 %}
  74.                 {% set items_calendar = items_calendar|merge([{prod_id: 0}]) %}
  75.               {% endif %}
  76.               {% set produit_url = (produit_thalasso_id) ? path("process_choice_signature", { 'idp': produit_thalasso_id }) : null %}
  77.               {% set produit_url_gift = (produit_thalasso_id) ? path("process_choice_signature_gift", { 'idp': produit_thalasso_id, 'g':1}) : null %}
  78.               {% set item_url = null %}
  79.               {% set item_sec_url = null %}
  80.               {% set all_links = [] %}
  81.               {% if item.urlLienPrincipalPage %}
  82.                 {% set item_url = frontservice.getUrlPage(item.urlLienPrincipalPage, lang) %}
  83.               {% else %}
  84.                 {% set item_url = frontservice.getContentItemField(item, 'url_lien_principal', lang) %}
  85.               {% endif %}
  86.               {% if item.urlLienSecondairePage %}
  87.                 {% set item_sec_url = frontservice.getUrlPage(item.urlLienSecondairePage, lang) %}
  88.               {% else %}
  89.                 {% set item_sec_url = frontservice.getContentItemField(item, 'url_lien_secondaire', lang) %}
  90.               {% endif %}
  91.               {% set all_links = all_links|merge([{
  92.                       icon: '',
  93.                       text: frontservice.getContentItemField(item, 'label_lien_principal', lang),
  94.                       to: "#"
  95.                 }]) %}
  96.               {% if frontservice.getContentItemField(item, 'label_lien_secondaire', lang) and produit_url_gift %}
  97.                   {% set all_links = all_links|merge([{
  98.                       icon: 'gift',
  99.                       text: frontservice.getContentItemField(item, 'label_lien_secondaire', lang),
  100.                       to: null,
  101.                       bookingLink: produit_url_gift
  102.                   }]) %}
  103.               {% endif %}
  104.               {% set pricedisplay = { price : null, originalPrice: null} %}
  105.               {% set prix_apartir = frontservice.getContentItemField(item, 'prix_apartir', lang) %}
  106.               {% set priceValue = prix_apartir %}
  107.               {% if produit_thalasso_id %}
  108.                 {% set mode_heb = ('sans' in item.ProduitThalasso.hebergement) ? false : true %}
  109.                 {% set pricedisplay = getCalendarThalasso(produit_thalasso_id, mode_heb, true) %}
  110.                 {% if pricedisplay is null %}{% set pricedisplay = { price : null, originalPrice: null} %}{% endif %}
  111.                 {% set displayedPrice = (pricedisplay) ? pricedisplay.price : null %}
  112.                 {% if displayedPrice %}
  113.                   {% set priceValue = displayedPrice %}
  114.                 {% else %}
  115.                   {% set priceValue = (prix_apartir) ? prix_apartir : "Indisponible" %}
  116.                 {% endif %}
  117.               {% endif %}
  118.               {% if priceValue and priceValue != "Indisponible" %}
  119.                 {% set priceValue = priceValue|number_format(2,'.','')|replace({'.00': ''}) %}
  120.                 {% if '€' not in priceValue %}
  121.                   {% set priceValue = priceValue ~ '€' %}
  122.                 {% endif %}
  123.               {% endif %}
  124.                 {% set image = frontservice.getMediaPublicUrl(item.imagePrincipal, 'big', frontservice.getContentItemField(item, 'alt_p', lang)) %}
  125.                 {% set items_elements = items_elements|merge([{
  126.                     image : image,
  127.                     title: frontservice.getContentItemField(item, 'titre_principal', lang)|replace({"\n": "<br />"})|raw,
  128.                     duration: frontservice.getContentItemField(item, 'duration', lang),
  129.                     categoryTitle: frontservice.getContentItemField(item, 'category_produit', lang),
  130.                     text: frontservice.getContentItemField(item, 'description', lang),
  131.                     price: priceValue,
  132.                     links: all_links,
  133.                     idCare:(item.produitThalasso) ? item.produitThalasso.id : 0,
  134.                     indexCalendar:index,
  135.                     minDays:min_days,
  136.                     maxDays:max_days       
  137.                 }]) %}                
  138.                 {% set index = index + 1 %}
  139.               {% endfor %} 
  140.         {% endif %}
  141.         {% include "component/care_cards.html.twig" with {
  142.           props: {
  143.             heading: {
  144.               titleAnnex: titre_principal
  145.             },
  146.             items: items_elements
  147.           }
  148.         } only %}
  149.       {% endif %}
  150.       {# To discover #}
  151.       {% if composant.cmsComposant.nomTechniqueComposant == "component/to_discover.html.twig" %}
  152.         {% set to_discover_items = composant.getCmsPageBlockComposantItems() %}
  153.         {% set items_elements = [] %}
  154.         {% if to_discover_items %}
  155.               {% for item in to_discover_items %} 
  156.                 {% set item_url = '#' %}
  157.                 {% if item.urlLienPrincipalPage %}
  158.                     {% set item_url = frontservice.getUrlPage(item.urlLienPrincipalPage, lang) %}
  159.                 {% else %}
  160.                     {% set item_url = frontservice.getContentItemField(item, 'url_lien_principal', lang) %}
  161.                 {% endif %}
  162.                 {% set image = frontservice.getMediaPublicUrl(item.imagePrincipal, 'big', frontservice.getContentItemField(item, 'alt_p', lang)) %}
  163.                 {% set items_elements = items_elements|merge([{
  164.                     image: image,
  165.                     heading: {
  166.                       title: frontservice.getContentItemField(item, 'titre_principal', lang)|replace({"\n": "<br />"})|raw,
  167.                       titleAnnex: frontservice.getContentItemField(item, 'surtitre', lang)
  168.                     },
  169.                     to: item_url
  170.                 }]) %}
  171.               {% endfor %} 
  172.         {% endif %}
  173.         {% include "component/to_discover.html.twig" with {
  174.           props: {
  175.             heading: {
  176.               title: titre_principal,
  177.               titleAnnex: surtitre
  178.             },
  179.             items: items_elements
  180.           }
  181.         } only %}
  182.       {% endif %}
  183.     {% endif %}
  184.     {% endfor %}
  185.   {% endif %}
  186.     {# Calendar #}
  187.   {% set datacal = [] %}
  188.   {% if items_calendar is not empty %}
  189.     {% for item in items_calendar %}
  190.     {% set datacal = datacal|merge(getCalendarThalasso(item.prod_id,false)) %}  
  191.     {% endfor %}       
  192.   {% endif %}
  193.   
  194.   {% include "component/calendar.html.twig" with {
  195.         props: {
  196.           form: {
  197.             action:  path("process_choice_signature", { 'idp': 0 }),
  198.             link: {
  199.               text: 'Continuer'
  200.             },
  201.           },
  202.         lang:'fr',
  203.         },
  204.         data : datacal
  205.   } only %}
  206.     {# Footer #}
  207.     {% include "component/footer.html.twig" %}
  208. {% endblock %}