{% extends "front/layouts/default.twig" %}
{% block head_scripts %}
{% endblock %}
{% set pageSections = [] %}
{% set pageBanner = null %}
{# if this page has a banner we will display it separately #}
{% for pageSection in entity.sections|default([])|sort((a, b) => a.ordering <=> b.ordering) %}
{% if pageSection.section.layout == 'banner-top' %}
{% set pageBanner = pageSection.section %}
{% else %}
{% set pageSections = pageSections|merge([pageSection.section]) %}
{% endif %}
{% endfor %}
{# display banner #}
{% block topBanner %}
{% if pageBanner %}
{% include pageBanner.templatePath with { 'entity' : pageBanner, currentPage: entity } %}
{% endif %}
{% endblock %}
{# display rest of the content #}
{% block content %}
{% for index, section in pageSections %}
{% set isGreySection = (loop.index is odd) %}
{% include section.templatePath with {
'entity' : section, currentPage: entity,
'greySection': isGreySection,
'isLast': loop.last,
} %}
{% endfor %}
{% include 'front/blocks/block-policy-cookie.twig' %}
{% endblock %}
{% block script %}
{{ parent() }}
<script>
$(document).ready(() => {
if($('#roomvo-available').length > 0) {
setTimeout(function(){ roomvo.startStandaloneVisualizer(); }, 1500);
}
});
</script>
<script>
$(".modalForm").submit(
function(event){
event.preventDefault();
let form = $(this);
let fSectionid = form.data('sectionid');
let ajaxurl = $("#formButton").data('ajaxurl');
let shopName = (typeof(form.data('storename')) != 'undefined') ? form.data('storename') : '';
let shopId = (typeof(form.data('storeid')) != 'undefined') ? form.data('storeid') : '';
let formData = new FormData(form[0]);
formData.append('sectionid',fSectionid);
formData.append('storename',shopName);
formData.append('storeid',shopId);
// throw new Error('test');
// console.log(shopName);
// console.log(shopId);
// return;
$.ajax({
url: ajaxurl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: (documentData) => {
$('.form-alert').each(function(){
$(this).remove();
});
$('#form-modal').modal('hide');
$('[id*=modal-form]').modal('hide');
$('#modal-thanks-form').modal('show');
window.location.replace(documentData);
},
error: (documentData) => {
form.prepend('<div class="alert alert-danger form-alert">' + documentData.responseJSON + '</div>');
form[0].scrollIntoView({ behavior: 'smooth' });
}
});
}
);
$("#contactForm").submit(
function(event){
event.preventDefault();
let form = $('#contactForm');
let fSectionid = $("#contactForm").data('sectionid');
let ajaxurl = $("#formButton").data('ajaxurl');
let formData = new FormData(form[0]);
formData.append('sectionid',fSectionid);
$.ajax({
url: ajaxurl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: (documentData) => {
$('.form-alert').each(function(){
$(this).remove();
});
window.location.replace(documentData);
},
error: (documentData) => {
console.log(documentData);
form.prepend('<div class="alert alert-danger form-alert">' + documentData.responseJSON + '</div>');
form[0].scrollIntoView({ behavior: 'smooth' });
}
});
}
);
$('input[id*=select-all-consents]').click(function(){
var checkboxSelector = '#' + this.form.id + ' input[id*=consent]';
// console.log(checkboxSelector);
if ($(this).prop('checked') == false) {
$(checkboxSelector).prop('checked',false);
}else if ($(this).prop('checked') == true) {
$(checkboxSelector).prop('checked',true);
}
});
</script>
{% endblock %}