<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(".lazy").lazyload({
effect: "fadeIn",
threshold: 300
});
});
</script>
{% block javascripts %}
{% if app.user != "" and (is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_EDIT_' ~ app.session.get('agencyId')) or is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_CREATE_' ~ app.session.get('agencyId')) or is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_DELETE_' ~ app.session.get('agencyId')) or is_granted('ROLE_SUPER_ADMIN') and promoType is defined) %}
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery('.js-ajax-homePromo').on('click', function () {
jQuery('.modal-title').html('Edit Promo');
jQuery('#js-form-homePromo').empty();
_loadSpinner("js-form-homePromo");
var url = "{{ path('aviatur_edit_homepromo', {promoType: promoType, id: 'xx', size: 'yy'}) }}";
var id = jQuery(this).data("id");
var size = jQuery(this).data("size");
var url = url.replace(/\xx/g, id);
var url = url.replace(/\yy/g, size);
jQuery.get(url, function (data) {
jQuery('#js-form-homePromo').html(data);
_removeSpinner("js-form-homePromo");
});
});
});
</script>
{% endif %}
{% endblock javascripts %}
{% if not is_mobile() %}
<section class="hide-palm">
{% if app.user != "" and (is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_CREATE_' ~ app.session.get('agencyId')) or is_granted('ROLE_SUPER_ADMIN')) %}
<a href="#" class="js-ajax-homePromo" data-id="0" data-size="banner_slider" style="margin-bottom: 5px; display: block; font-size: 16px; font-weight: bold;" data-toggle="modal" data-target="#js-promo-editModal">CREAR UNA NUEVO SLIDER</a>
{% for homePromo in homePromos %}
{% if homePromo.size == "banner_slider" %}
<div class="promo-banner" style="margin-bottom: 20px;">
{% if app.user != "" and (is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_EDIT_' ~ app.session.get('agencyId')) or is_granted('ROLE_SUPER_ADMIN') ) %}
<a href="#" class="js-ajax-homePromo" data-id="{{ homePromo.id }}" data-size="banner_slider" style="margin-bottom: 2px" data-toggle="modal" data-target="#js-promo-editModal">EDITAR</a> -
{% endif %}
{% if app.user != "" and (is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_DELETE_' ~ app.session.get('agencyId')) or is_granted('ROLE_SUPER_ADMIN') ) %}
<a href="{{ path('aviatur_edit_homepromo_delete', {id: homePromo.id, promoType: promoType}) }}">BORRAR</a>
{% endif %}
{% if homePromo.switch == false %}
{% set imageGuessedName = (homePromo.link|split('?')|first)|split('/')|last ~ "_" ~ homePromo.id ~ ".jpeg" %}
{% set pathToImage = "https://" ~ app.session.get('domainsecure') ~ "/assets/" ~ agency_folder.assetStyle() ~ "/img/promo/box/"%}
{% if file_exists(pathToImage ~ imageGuessedName)%}
{% set imageLink = pathToImage ~ imageGuessedName %}
{% else %}
{% set imageLink = pathToImage ~ homePromo.id ~ ".jpeg" %}
{% endif %}
<a href="{{ homePromo.link }}" target="_blank">
<img class="center-block img-responsive lazy" data-original="{{ imageLink }}?timestamp={{ homePromo.date| date('U') }}" alt=""/>
</a>
{% else %}
{% set imageGuessedName = (homePromo.link|split('?')|first)|split('/')|last ~ "_" ~ homePromo.id ~ ".jpeg" %}
{% set imageGuessedName2 = (homePromo.linkSwitch|split('?')|first)|split('/')|last ~ "_" ~ homePromo.id ~ "-2.jpeg" %}
{% set pathToImage = "assets/" ~ agency_folder.assetStyle() ~ "/img/promo/box/"%}
{% if file_exists(pathToImage ~ imageGuessedName)%}
{% set imageLink = pathToImage ~ imageGuessedName %}
{% else %}
{% set imageLink = pathToImage ~ homePromo.id ~ ".jpeg" %}
{% endif %}
{% if file_exists(pathToImage ~ imageGuessedName2)%}
{% set imageLink2 = pathToImage ~ imageGuessedName2 %}
{% else %}
{% set imageLink2 = pathToImage ~ homePromo.id ~ "-2.jpeg" %}
{% endif %}
<a class="center-block promo-crossFading" href="#" target="_blank"
data-href1="{{ homePromo.link }}"
data-href2="{{ homePromo.linkSwitch }}">
<img class="img-responsive js-fadeInOut lazy" data-original="/{{ imageLink }}?timestamp={{ homePromo.date| date('U') }}" alt="" />
<img class="img-responsive lazy" data-original="/{{ imageLink2 }}?timestamp={{ homePromo.date| date('U') }}" alt="" />
</a>
{% endif %}
</div>
{% endif %}
{% endfor %}
{% endif %}
</section>
<section class="hide-palm">
{% if app.user != "" and (is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_CREATE_' ~ app.session.get('agencyId')) or is_granted('ROLE_SUPER_ADMIN')) %}
<a href="#" class="js-ajax-homePromo" data-id="0" data-size="banner" style="margin-bottom: 5px; display: block; font-size: 16px; font-weight: bold;" data-toggle="modal" data-target="#js-promo-editModal">CREAR NUEVO BANNER</a>
{% endif %}
{% for homePromo in homePromos %}
{% if homePromo.size == "banner" %}
<div class="promo-banner" style="margin-bottom: 20px;">
{% if app.user != "" and (is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_EDIT_' ~ app.session.get('agencyId')) or is_granted('ROLE_SUPER_ADMIN') ) %}
<a href="#" class="js-ajax-homePromo" data-id="{{ homePromo.id }}" data-size="banner" style="margin-bottom: 2px" data-toggle="modal" data-target="#js-promo-editModal">EDITAR</a> -
{% endif %}
{% if app.user != "" and (is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_DELETE_' ~ app.session.get('agencyId')) or is_granted('ROLE_SUPER_ADMIN') ) %}
<a href="{{ path('aviatur_edit_homepromo_delete', {id: homePromo.id, promoType: promoType}) }}">BORRAR</a>
{% endif %}
{% if homePromo.switch == false %}
{% set imageGuessedName = (homePromo.link|split('?')|first)|split('/')|last ~ "_" ~ homePromo.id ~ ".jpeg" %}
{% set pathToImage = "https://" ~ app.session.get('domainsecure') ~ "/assets/" ~ agency_folder.assetStyle() ~ "/img/promo/box/"%}
{% if file_exists(pathToImage ~ imageGuessedName)%}
{% set imageLink = pathToImage ~ imageGuessedName %}
{% else %}
{% set imageLink = pathToImage ~ homePromo.id ~ ".jpeg" %}
{% endif %}
<a href="{{ homePromo.link }}" target="_blank">
<img class="center-block img-responsive lazy" data-original="{{ imageLink }}?timestamp={{ homePromo.date| date('U') }}" alt=""/>
</a>
{% else %}
{% set imageGuessedName = (homePromo.link|split('?')|first)|split('/')|last ~ "_" ~ homePromo.id ~ ".jpeg" %}
{% set imageGuessedName2 = (homePromo.linkSwitch|split('?')|first)|split('/')|last ~ "_" ~ homePromo.id ~ "-2.jpeg" %}
{% set pathToImage = "assets/" ~ agency_folder.assetStyle() ~ "/img/promo/box/"%}
{% if file_exists(pathToImage ~ imageGuessedName)%}
{% set imageLink = pathToImage ~ imageGuessedName %}
{% else %}
{% set imageLink = pathToImage ~ homePromo.id ~ ".jpeg" %}
{% endif %}
{% if file_exists(pathToImage ~ imageGuessedName2)%}
{% set imageLink2 = pathToImage ~ imageGuessedName2 %}
{% else %}
{% set imageLink2 = pathToImage ~ homePromo.id ~ "-2.jpeg" %}
{% endif %}
<a class="center-block promo-crossFading" href="#" target="_blank"
data-href1="{{ homePromo.link }}"
data-href2="{{ homePromo.linkSwitch }}">
<img class="img-responsive js-fadeInOut lazy" data-original="/{{ imageLink }}?timestamp={{ homePromo.date| date('U') }}" alt="" />
<img class="img-responsive lazy" data-original="/{{ imageLink2 }}?timestamp={{ homePromo.date| date('U') }}" alt="" />
</a>
{% endif %}
</div>
{% endif %}
{% endfor %}
</section>
{% endif%}
{% if app.user != "" and ( is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_CREATE_' ~ app.session.get('agencyId')) or is_granted('ROLE_SUPER_ADMIN') ) %}
<a href="#" class="js-ajax-homePromo" data-id="0" data-size="picture" style="margin-bottom: 5px; display: block; font-size: 16px; font-weight: bold;" data-toggle="modal" data-target="#js-promo-editModal">CREAR UNA NUEVA PROMO</a>
{% endif %}
<section class="wrapper-susy">
{% for homePromo in homePromos %}
{% if homePromo.size == "picture" %}
{% if homePromo.mobile == true or not is_mobile() or is_tablet()%}
<div class="promo-box__grid">
{% if app.user != "" and ( is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_EDIT_' ~ app.session.get('agencyId')) or is_granted('ROLE_SUPER_ADMIN') ) %}
<a href="#" class="js-ajax-homePromo" data-id="{{ homePromo.id }}" data-size="picture" style="margin-bottom: 2px" data-toggle="modal" data-target="#js-promo-editModal">EDITAR</a> -
{% endif %}
{% if app.user != "" and ( is_granted('ROLE_AVIATUR_ADMIN_ADMIN_PROMO_PRODUCT_DELETE_' ~ app.session.get('agencyId')) or is_granted('ROLE_SUPER_ADMIN') ) %}
<a href="{{ path('aviatur_edit_homepromo_delete', {id: homePromo.id, promoType: promoType}) }}">BORRAR</a>
{% endif %}
{% if homePromo.link|length > 0 or homePromo.link != null %}
<a href="{{ homePromo.link }}" target="_blank">
{% endif %}
{% set imageGuessedName = (homePromo.link|split('?')|first)|split('/')|last ~ "_" ~ homePromo.id ~ ".jpeg" %}
{% set pathToImage = "https://" ~ app.session.get('domainsecure') ~ "/assets/" ~ agency_folder.assetStyle() ~ "/img/promo/box/"%}
{% if file_exists(pathToImage ~ imageGuessedName)%}
{% set imageLink = pathToImage ~ imageGuessedName %}
{% else %}
{% set imageLink = pathToImage ~ homePromo.id ~ ".jpeg" %}
{% endif %}
<div class="promo-box lazy" data-original="{{ imageLink }}?timestamp={{ homePromo.date| date('U') }}" style='background-image: url("{{ asset('assets/'~ agency_folder.assetStyle() ~'/img/promo/box/fallback.gif') }}")'>
{% if homePromo.title != null %}
{#<div class="promo-box__title">
<h3>{{ homePromo.title }}</h3>
</div>#}
<div class="promo-box__title">
{%if '/' in homePromo.title%}
{% set promoTitle= homePromo.title|split('/')%}
<h3>{{promoTitle[0]}}<br>{{promoTitle[1]}}</h3>
{% else %}
<h3>{{ homePromo.title }}</h3>
{% endif %}
</div>
{% endif %}
{% if homePromo.price != null %}
<div class="promo-box__subtitle">
<h4>{{ homePromo.price }}</h4>
</div>
{% endif %}
{% if homePromo.content != null %}
<div class="promo-box__conditions">
{{ homePromo.content }}
</div>
{% endif %}
{% if homePromo.link == null %}
<div class="promo-box__link">
Encuentra esta oferta en el buscador !
</div>
{% endif %}
</div>
{% if homePromo.link|length > 0 or homePromo.link != null %}
</a>
{% endif %}
</div>
{% endif %}
{% endif %}
{% endfor %}
</section>