{% set descriptionTypeMapping = {
0: "Package",
1: "PackageContentShort",
2: "PackageContentLong",
3: "PackageShortText"
} %}
{% if tvbPackage is defined %}
{% set package = tvbPackage %}
{% set descriptionTypeMapping = {
0: "Package",
2: "PackageContentLong"
} %}
{% else %}
{% set package = housePackageMaster %}
{% set tvbPackage = null %}
{% endif %}
<section class="{{ fromTvbOverview is defined and fromTvbOverview == true ? '' : 'mt-4' }}"
data-track-content
data-content-name="package-info">
<div class="wysiwyg">
<div class="row">
<div class="col-8">
{% if fromTvbOverview is defined and fromTvbOverview %}
<h2 class="mb-4 text-primary">{{ "demi.detail.package.tab.package"|trans }}</h2>
{% endif %}
{% for type in descriptionTypeMapping %}
{% set text = package.getDescription(type,app.request.locale,dateFrom is defined ? dateFrom : null) %}
{% if text is empty and searchParam is defined %}
{% set text = package.getDescription(type, demi_core_configuration('getFallbackLanguage', []), searchParam is defined ? searchParam.getDateFrom() : null) %}
{% endif %}
{% if text is not empty %}
{{ text|raw }}<br/><br/>
{% endif %}
{% endfor %}
</div>
<div class="col-4 border-left">
<section class="mt-3">
<div class="h5 mb-1">{{ 'demi.detail.package.validdates'|trans }}</div>
{% set validDates = package.getValidDates() %}
{% if validDates is not null %}
{% if not tvbPackage is null and tvbPackage.getClassName() == 'demiPackage' %}
{% for item in validDates.getItems() %}
{% if item.getDateTo() > date('now') %}
{{ elements_dateFormatRange(item.getDateFrom(),item.getDateTo(),'daterange-short-long', 'daterange-long-long') }}
<br/>
{% endif %}
{% endfor %}
{% else %}
{% for item in validDates.getItems() %}
{% if item.getTo() > date('now') %}
{{ elements_dateFormatRange(item.getFrom(),item.getTo(),'daterange-short-long', 'daterange-long-long') }}
<br/>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
</section>
{% if not tvbPackage is null and tvbPackage is instanceof('\\Elements\\Demi\\Model\\Package') and not tvbPackage.hasAccommodationSection() %}
<script>
_config.overlay = true;
</script>
<div class="mt-3">
{% if not tvbPackage is null and tvbPackage.getCheapestPackagePrice() %}
<strong class="font-medium offer-box__price text-success">
{{ 'demi.price-from-short'|trans }} {{ demi_paymentGetPriceObject(tvbPackage.getCheapestPackagePrice()) }}
</strong><br/>
{% endif %}
{% set addToCartUrl = demi_demiUrl({
'path': demi_core_configuration('getCheckoutPath',[]).getFullPath(),
'controller': 'cart',
'action': 'packagestep1'
}, 'demi_checkout', true) %}
<script>
_config.addPackageToCart = true;
_config.addToCartUrl = "{{ addToCartUrl }}";
_config.packageId = "{{ tvbPackage.getId() }}";
</script>
<div class="mt-3">
<button type="button" class="btn btn-success js-overlay__toggle js-add-package-to-cart__btn"
data-target="#search-overlay">
{{ 'demi.detail.package.add-to-cart'|trans }}
<span class="circle-spinner circle-spinner--white circle-spinner--small ml-2 js-add-package-to-cart__loading"
aria-label="{{ 'demi.content-loading'|trans }}"
title="{{ 'demi.content-loading'|trans }}" hidden>
</span>
</button>
<div class="js-add-package-to-cart__error text-danger mt-3 strong" role="alert" hidden>
<div class="row row--gutter-width-6">
<div class="col-auto">
<span class="demi-icon demi-icon-warning icon-in-text"
title="{{ 'demi.warning'|trans }}"
aria-label="{{ 'demi.warning'|trans }}"/>
</div>
<div class="col js-add-package-to-cart__error-text"></div>
</div>
</div>
<div class="js-add-package-to-cart__warning text-warning mt-3 strong" role="alert" hidden>
<div class="row row--gutter-width-6">
<div class="col-auto">
<span class="demi-icon demi-icon-warning icon-in-text"
title="{{ 'demi.warning'|trans }}"
aria-label="{{ 'demi.warning'|trans }}"/>
</div>
<div class="col js-add-package-to-cart__warning-text"></div>
</div>
</div>
</div>
{% else %}
{% if not tvbPackage is null and tvbPackage is instanceof('\\Elements\\Demi\\Model\\Package') %}
{{ include('@ElementsDemiFrontend/DestinationPackage/includes/destinationpackageBookingInfos.html.twig',{
'tvbPackage': tvbPackage
}) }}
{% endif %}
{% if isAffiliate is not defined or isAffiliate == false %}
{% set tvbPackageListUrl = null %}
{% if accommodation is not defined and not tvbPackage is null %}
{% if tvbPackage.getClassName() == 'demiPackage' %}
{% set tvbPackageListDocument = demi_findDestinationPackageAccoList(document, tvbPackage) %}
{% elseif tvbPackage.getClassName() == 'demiHousePackageMaster' %}
{% set tvbPackageListDocument = demi_findHousePackageMasterSelfAssignList(document, tvbPackage) %}
{% elseif tvbPackage.getClassName() == "demiHousePackageContainer" %}
{% set tvbPackageListDocument = demi_findHousePackageContainerList(document, tvbPackage) %}
{% endif %}
{% if tvbPackageListDocument is defined and tvbPackageListDocument %}
{% set tvbPackageListUrl = tvbPackageListDocument.getFullPath() %}
{% endif %}
{% endif %}
<div class="mt-3 js-search-data__hide-if-submitted" {{ availabilityIsChecked is defined and availabilityIsChecked ==true ? 'hidden' : '' }}>
{% if tvbPackageListUrl is not null %}
{% if not tvbPackage is null and tvbPackage.getCheapestPackagePrice() is not empty %}
<strong class="font-medium offer-box__price text-success">
{{ 'demi.price-from-short'|trans }} {{ demi_paymentGetPriceObject(tvbPackage.getCheapestPackagePrice()) }}
</strong><br/>
{% endif %}
<a href="{{ tvbPackageListUrl }}"
data-target="#booking"
aria-controls="booking"
class="btn btn-success btn-lg">
<script data-cookieconsent="ignore">
_config.openTabAndSroll = true;
</script>
<span class="btn__icon demi-icon demi-icon-cart mr-2" aria-hidden="true"></span>
{{ "demi.detail.package.booking-button"|trans }}
</a>
{% elseif fromTvbOverview is defined and fromTvbOverview %}
<div class="text-danger"> {{ 'demi.destinationpackage.not-bookable'|trans }} </div>
{% endif %}
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
</section>
<hr class="hr--border-gray my-5">
{% if not tvbPackage is null and tvbPackage.getClassName() == 'demiPackage' and not tvbPackage.hasAccommodationSection() %}
{{ include('@ElementsDemiFrontend/Includes/overlays/search.html.twig',{
'searchParam': searchParam is defined ? searchParam : null,
'isSearch': true,
'modifierClass': isAffiliate is defined and isAffiliate == true ? 'overlay--centered-top' : 'overlay--centered'
}) }}
{% endif %}