templates/pages/_includes/details/_other-departures-table.html.twig line 1

Open in your IDE?
  1. {% import '_snippets/components/macros/date.html.twig' as dateMacros %}
  2. {% set companiesWithFullWeb = getCompaniesWithFullWeb() %}
  3. {% set companiesWithFullWebIds = companiesWithFullWeb|map(c => c.id) %}
  4. <div class="other-departures-view other-departures-view--table is-active" data-view-panel="table">
  5. <div class="pricing-table-wrapper">
  6. <div class="pricing-table-scroll">
  7. <table class="pricing-table">
  8. <colgroup>
  9. <col class="pricing-table-col-sticky">
  10. <col class="pricing-table-col-arrow">
  11. {% for departureCruise in allDepartures %}
  12. <col class="pricing-table-col-date">
  13. {% endfor %}
  14. <col class="pricing-table-col-arrow">
  15. </colgroup>
  16. <thead>
  17. <tr>
  18. <th scope="col" class="pricing-table-corner sticky-col">
  19. <span class="text-md-sbd color-primary-color">{{ 'details.cabin_choice.pricing_table.double_occupancy_rates'|trans }}</span>
  20. <span class="text-xs-rg color-grey-text">{{ 'details.cabin_choice.pricing_table.mandatory_service_fees'|trans }}</span>
  21. </th>
  22. <th scope="col" class="pricing-table-arrow-col pricing-table-arrow-col--left sticky-arrow-col" aria-hidden="true"></th>
  23. {% for departureCruise in allDepartures %}
  24. {% set isSelectedDeparture = departureCruise.departureDate and currentCruise.departureDate and departureCruise.departureDate|date('Y-m-d') == currentCruise.departureDate|date('Y-m-d') %}
  25. {% set departureMonth = departureCruise.departureDate ? departureCruise.departureDate|date('n') : 0 %}
  26. <th scope="col" class="pricing-table-header{% if isSelectedDeparture %} is-selected{% endif %}" data-departure-index="{{ loop.index0 }}">
  27. <span class="date text-sm-md">
  28. {% if departureCruise.departureDate %}
  29. {{ departureCruise.departureDate|date('d') }}
  30. {{ dateMacros.short_month_fr(departureMonth) }}
  31. {{ departureCruise.departureDate|date('Y') }}
  32. {% endif %}
  33. </span>
  34. {% if isSelectedDeparture %}
  35. <span class="selected-label text-2xs-rg color-grey-text">{{ 'details.cabin_choice.pricing_table.selected_departure'|trans }}</span>
  36. {% endif %}
  37. </th>
  38. {% endfor %}
  39. <th scope="col" class="pricing-table-arrow-col pricing-table-arrow-col--right sticky-arrow-col-right" aria-hidden="true"></th>
  40. </tr>
  41. </thead>
  42. <tbody>
  43. {% for subType in subTypes %}
  44. {% set subtypeShortLabel = subType.shortName|default('')|trim %}
  45. {% if subtypeShortLabel is empty %}
  46. {% set subtypeShortLabel = subType.name|default('')|trim %}
  47. {% endif %}
  48. {% if subtypeShortLabel is empty %}
  49. {% set subtypeShortLabel = '%02d'|format(loop.index0) %}
  50. {% endif %}
  51. {% set cabinTypeId = subtypeCabinTypeMap[subType.id ~ '']|default(subType.cabinType.id|default('')) %}
  52. {% set tableModalMinPrice = null %}
  53. {% for departureCruise in allDepartures %}
  54. {% set bestPriceObj = getBestPriceForCruiseCabinSubType(departureCruise, subType) %}
  55. {% set priceValue = bestPriceObj ? bestPriceObj.baseCostDouble|default(0)|round(0, 'ceil') : 0 %}
  56. {% if priceValue > 0 and (tableModalMinPrice is null or priceValue < tableModalMinPrice) %}
  57. {% set tableModalMinPrice = priceValue %}
  58. {% endif %}
  59. {% endfor %}
  60. <tr>
  61. <th scope="row" class="pricing-table-row-label sticky-col" data-subtype-id="{{ subType.id }}">
  62. {% embed 'pages/_includes/partials/_cabin-modal-link.html.twig' with {
  63. cabinTypeId: cabinTypeId,
  64. subTypeId: subType.id,
  65. linkClass: 'pricing-table-row-label-link',
  66. modalMinPrice: tableModalMinPrice
  67. } %}
  68. {% block link_content %}
  69. <span class="subtype-code text-xs-bd">{{ subtypeShortLabel }}</span>
  70. <span class="subtype-name text-md-sbd">{{ getLucidIcon('info') }} {{ subType.name }}</span>
  71. {% endblock %}
  72. {% endembed %}
  73. </th>
  74. {% if loop.first %}
  75. <td class="pricing-table-arrow-col pricing-table-arrow-col--left sticky-arrow-col" rowspan="{{ subTypes|length }}">
  76. <button type="button" class="arrow left-arrow br1" aria-label="{{ 'details.cabin_choice.pricing_table.scroll_left'|trans }}">
  77. <div class="icon">{{ getLucidIcon('chevron-left') }}</div>
  78. </button>
  79. </td>
  80. {% endif %}
  81. {% for departureCruise in allDepartures %}
  82. {% set isSelectedDeparture = departureCruise.departureDate and currentCruise.departureDate and departureCruise.departureDate|date('Y-m-d') == currentCruise.departureDate|date('Y-m-d') %}
  83. {% set cellBestPriceObj = getBestPriceForCruiseCabinSubType(departureCruise, subType) %}
  84. {% set rawBestPrice = cellBestPriceObj ? cellBestPriceObj.baseCostDouble|default(0)|round(0, 'ceil') : 0 %}
  85. {% set departureCompany = departureCruise.ship.company|default(null) %}
  86. {% set departureCompanyName = departureCompany.name|default('') %}
  87. {% set hasDirectOnline = departureCompany.id|default(null) in companiesWithFullWebIds %}
  88. <td class="pricing-table-cell{% if rawBestPrice <= 0 %} is-full{% endif %}{% if isSelectedDeparture %} is-selected{% endif %} {{ rawBestPrice == bestUpComingPrice ? 'is-best-price' : '' }}" data-departure-index="{{ loop.index0 }}">
  89. {% if rawBestPrice > 0 %}
  90. {% set departureDateLabel = departureCruise.departureDate ? departureCruise.departureDate|date('d/m/Y') : '' %}
  91. {% set dddUrl = 'details/reservation?croisiere=' ~ departureCruise.id ~ '&type=' ~ cabinTypeId ~ '&subtype=' ~ subType.id %}
  92. <button
  93. type="button"
  94. class="pricing-table-cell-link"
  95. data-cruise-id="{{ departureCruise.id }}"
  96. data-subtype-id="{{ subType.id }}"
  97. data-cabin-type-id="{{ cabinTypeId }}"
  98. data-price="{{ rawBestPrice }}"
  99. data-departure-date="{{ departureDateLabel }}"
  100. data-subtype-name="{{ subType.name }}"
  101. data-company-name="{{ departureCompanyName }}"
  102. data-direct-online="{{ hasDirectOnline ? '1' : '0' }}"
  103. data-ddd-url="{{ dddUrl }}"
  104. data-reservation-url="{{ dddUrl }}"
  105. aria-label="{{ 'details.type_of_quote.open_for'|trans({'%cabin%': subType.name, '%date%': departureDateLabel}) }}"
  106. >
  107. <span class="from text-sm-rg color-grey-text">{{ 'details.cabin_choice.pricing_table.from_label'|trans }}</span>
  108. <span class="value text-lg-sebd color-price-tags-primary">{{ rawBestPrice|number_format(0, ',', ' ') }} €</span>
  109. </button>
  110. {% else %}
  111. <div class="pricing-table-cell-link pricing-table-cell-link--static">
  112. <span class="full text-md-bd color-grey">{{ 'details.cabin_choice.pricing_table.full'|trans }}</span>
  113. </div>
  114. {% endif %}
  115. </td>
  116. {% endfor %}
  117. {% if loop.first %}
  118. <td class="pricing-table-arrow-col pricing-table-arrow-col--right sticky-arrow-col-right" rowspan="{{ subTypes|length }}">
  119. <button type="button" class="arrow right-arrow br1" aria-label="{{ 'details.cabin_choice.pricing_table.scroll_right'|trans }}">
  120. <div class="icon">{{ getLucidIcon('chevron-right') }}</div>
  121. </button>
  122. </td>
  123. {% endif %}
  124. </tr>
  125. {% endfor %}
  126. </tbody>
  127. </table>
  128. </div>
  129. </div>
  130. </div>