2019-12-07 19:49:42 +01:00
|
|
|
function savePlaceNumber() {
|
2020-01-13 17:50:20 +01:00
|
|
|
var selected = $('.selected');
|
|
|
|
if(selected.length) {
|
|
|
|
var selected_id = $('.selected')[0].innerText;
|
2019-12-07 19:49:42 +01:00
|
|
|
const seat_number_input = $('.seat_number')[0];
|
|
|
|
seat_number_input.value = selected_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleButtonAvailability() {
|
2019-12-08 00:00:52 +01:00
|
|
|
const buttons = $('.checkout-button');
|
2019-12-07 19:49:42 +01:00
|
|
|
const selected_place = $('.selected')[0];
|
2019-12-08 00:00:52 +01:00
|
|
|
buttons.each(function(e) {
|
|
|
|
if(!$(this).hasClass('end-button')) {
|
|
|
|
if(!selected_place){
|
|
|
|
$(this).css('pointer-events', 'none');
|
|
|
|
$(this).css('cursor', 'unset');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$(this).css('pointer-events', 'unset');
|
|
|
|
$(this).css('cursor', 'pointer');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2019-12-07 19:49:42 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function checkForUnavailablePlaces() {
|
|
|
|
const unavailablePlaces = Array();
|
|
|
|
$('.unavailable_place').each(function(){
|
|
|
|
unavailablePlaces.push($(this).val());
|
|
|
|
});
|
|
|
|
|
|
|
|
const allPlaces = $('.seatCharts-seat.seatCharts-cell.available');
|
|
|
|
if(unavailablePlaces){
|
|
|
|
allPlaces.each(function(){
|
|
|
|
if(unavailablePlaces.includes($(this).text()) && !$(this).parent().hasClass('seatCharts-legendItem')) {
|
|
|
|
$(this).addClass('unavailable');
|
|
|
|
$(this).css('pointer-events', 'none');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2019-12-20 01:11:51 +01:00
|
|
|
|
2019-12-07 19:49:42 +01:00
|
|
|
$(document).ready(function(){
|
|
|
|
$('.seatCharts-seat').on('click', function(){
|
|
|
|
toggleButtonAvailability();
|
|
|
|
savePlaceNumber();
|
|
|
|
});
|
2020-01-17 17:10:54 +01:00
|
|
|
var mode = $('#mode').val();
|
|
|
|
if(mode === 'test') {
|
|
|
|
var random_seat = $('#random_seat').val();
|
|
|
|
var allPlaces = $('.seatCharts-seat.seatCharts-cell');
|
|
|
|
var allSlides = $('.carousel-item');
|
|
|
|
var seat;
|
|
|
|
allPlaces.each(function(){
|
|
|
|
if($(this).text() === random_seat) {
|
|
|
|
$(this).click();
|
|
|
|
seat = $(this);
|
|
|
|
}
|
|
|
|
$(this).css('pointer-events', 'none');
|
|
|
|
$('.cancel-cart-item').remove();
|
|
|
|
});
|
|
|
|
allSlides.each(function() {
|
|
|
|
if($.contains($(this).get(0), $(seat).get(0))) {
|
|
|
|
$('#map-carousel').carousel($(this).index()-1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
setTimeout(function() {
|
|
|
|
$('#test-end-btn').click();
|
|
|
|
}, 7000);
|
|
|
|
} else {
|
|
|
|
checkForUnavailablePlaces();
|
|
|
|
toggleButtonAvailability();
|
|
|
|
}
|
2019-12-07 19:49:42 +01:00
|
|
|
});
|