{% if page is defined %}
{% if page.total==0 and page.offset == 0 %}
<div class="row justify-content-md-center">
<div class="col-12 text-center">
No hay tickets disponibles
</div>
</div>
{% endif %}
{# Tickets sold #}
{% if pageSoldOut.tickets is not empty %}
{% for ticket in pageSoldOut.tickets %}
{% set symbol = 'USD' %}
{% if from_argentina %}
{% set ticket = ticket|merge({'price': ticket.price * conversion}) %}
{% set symbol = 'ARS' %}
{% endif %}
<div class="row card-event-ticket mb-4 align-items-center">
<div class="col-lg-2 col-12 d-flex justify-content-lg-start justify-content-center">
<div class="card-event-ticket-img">
<img src="{{ ticket.imageThumb }}">
</div>
</div>
<div class="col-lg-6 col-12">
<h5 class="text-truncate mt-xl-0 mt-3"><b>{{ ticket.name }}</b></h5>
<p class="text-muted text-truncate mt-2">{{ ticket.event.name }}</p>
</div>
<div class="col-xl-2 col-12 mt-xl-0 mt-4 d-flex justify-content-xl-end justify-content-center">
<h5><b>{{ ticket.price|number_format(2, ',', '.') }} {{ symbol }}</b></h5>
</div>
<div class="col-xl-2 col-12 mt-xl-0 mt-4 d-flex align-items-center box-small-ticket" style="flex-direction: column;">
<button class="btn-md blue btn_add_ticket mt-3 buy" href="javascript:void(0)" data-ticket_small="{{ ticket.id }}">entradas agotadas</button>
</div>
</div>
{% endfor %}
{% endif %}
{# Tickets available #}
{% if page.tickets is not empty %}
{% for ticket in page.tickets %}
{% if ticket.price > 0 %}
{% set symbol = 'USD' %}
{% if from_argentina %}
{% set ticket = ticket|merge({'price': ticket.price * conversion}) %}
{% set symbol = 'ARS' %}
{% endif %}
<div class="row card-event-ticket mb-4 align-items-center">
<div class="col-xl-2 col-12 d-flex justify-content-xl-start justify-content-center">
<div class="card-event-ticket-img d-flex justify-content-xl-start justify-content-center">
<img src="{{ ticket.imageThumb }}">
</div>
</div>
<div class="col-xl-6 col-12 align-items-xl-start align-items-center" style="flex-direction: column;">
<h5 class="text-truncate mt-xl-0 mt-3"><b>{{ ticket.name }}</b></h5>
<p class="text-muted text-truncate mt-2">{{ ticket.event.name }}</p>
</div>
<div class="col-xl-2 col-12 mt-xl-0 mt-4 d-flex justify-content-xl-end justify-content-center">
<h5><b>{{ ticket.price|number_format(2, ',', '.') }} {{ symbol }}</b></h5>
</div>
<div class="col-xl-2 col-12 mt-xl-0 mt-4 d-flex align-items-center box-small-ticket" style="flex-direction: column;">
<div class="card-event-ticket-amount">
<input type="button" value="-" class="quantity_btn remove_quantity_btn" id="remove_quantity_btn">
<input type="number" id="quantity" placeholder="1" class="text-center inpt-number-tickets input_number_tickets" max="{{ ticket.quantity }}" data-max="{{ ticket.quantity }}" readonly>
<input type="button" value="+" class="quantity_btn add_quantity_btn" id="add_quantity_btn">
</div>
<button class="btn-md blue btn_add_ticket mt-3 buy" href="javascript:void(0)" data-ticket_small="{{ ticket.id }}">Comprar</button>
</div>
</div>
{% endif %}
{% endfor %}
{% block javascripts %}
<script>
$( document ).ready(function() {
$("#page_next").val({{page.offset+page.limit}});
$("#page_total").val({{page.total}});
});
$(".add_quantity_btn").click( function() {
if(!$(this).closest(".box-small-ticket").find(".inpt-number-tickets").val()){
quantity=1;
}
else{
quantity = $(this).closest(".box-small-ticket").find(".inpt-number-tickets").val();
}
max = $(this).closest(".box-small-ticket").find(".inpt-number-tickets").data("max");
quantity++;
if(quantity > max){
quantity = max;
}
$(this).closest(".box-small-ticket").find(".inpt-number-tickets").val(quantity);
});
$(".remove_quantity_btn").click( function() {
quantity = $(this).closest(".box-small-ticket").find(".inpt-number-tickets").val();
quantity--;
if(quantity <= 0){
quantity = 1;
}
$(this).closest(".box-small-ticket").find(".inpt-number-tickets").val(quantity);
});
$(document).on('click', '.buy', function() {
const cus = '{{ check_user_session }}';
if(!cus) {
swal({
title: '<h4 class="py-3">Debes iniciar sesiĆ³n</h4>',
html: true,
type: 'info',
showConfirmButton: true,
confirmButtonColor: "#5902EC"
});
return false;
}
quantity = $(this).closest(".box-small-ticket").find(".inpt-number-tickets").val();
if(quantity.length <= 0){
quantity = 1;
}
url = "{{ path('ticket-buy', {'ticketId': 'value_ticket'}) }}?quantity=" + quantity;
url = url.replace("value_ticket", $(this).data("ticket_small"));
location.href = url;
});
</script>
{% endblock %}
{% endif %}
{% endif %}