2019-12-13 23:28:16 +01:00
|
|
|
function assignPlaces() {
|
|
|
|
const attendances = $('.attendance-id');
|
2019-12-20 23:21:31 +01:00
|
|
|
const multi_parts = $('#multi_parts').val();
|
2019-12-13 23:28:16 +01:00
|
|
|
attendances.each(function() {
|
|
|
|
const seat_number = $(this).attr('id').split('++')[0];
|
|
|
|
const name = $(this).attr('id').split('++')[1];
|
|
|
|
const surname = $(this).attr('id').split('++')[2];
|
2019-12-19 15:23:49 +01:00
|
|
|
let map_seat = '';
|
2019-12-20 23:21:31 +01:00
|
|
|
if(!multi_parts) {
|
2019-12-19 15:23:49 +01:00
|
|
|
map_seat = $('#seat-map').find(`#${seat_number}`);
|
|
|
|
} else {
|
2019-12-20 23:21:31 +01:00
|
|
|
const parts_number = $('#multi_parts_number').val();
|
|
|
|
let index = 0;
|
|
|
|
map_seat = $('#seat-map-0').find(`#${seat_number}`);
|
|
|
|
while (!map_seat.length && index < parts_number) {
|
|
|
|
index++;
|
|
|
|
map_seat = $(`#seat-map-${index}`).find(`#${seat_number}`);
|
2019-12-19 15:23:49 +01:00
|
|
|
}
|
|
|
|
}
|
2019-12-20 23:21:31 +01:00
|
|
|
console.log(map_seat);
|
2019-12-20 01:11:51 +01:00
|
|
|
map_seat.html(`<b>${seat_number}</b> <br><span class="preview-name">${name} ${surname}</span>`);
|
2019-12-13 23:28:16 +01:00
|
|
|
map_seat.on('mouseover', () => {
|
|
|
|
map_seat.css('backgroundColor', 'lightgrey');
|
|
|
|
$(this).css('backgroundColor', 'lightgrey');
|
|
|
|
}).on('mouseleave', () => {
|
2019-12-14 00:09:51 +01:00
|
|
|
map_seat.css('backgroundColor', '#649a24');
|
2019-12-13 23:28:16 +01:00
|
|
|
$(this).css('backgroundColor', 'unset');
|
|
|
|
});
|
|
|
|
$(this).on('mouseover', () => {
|
|
|
|
map_seat.css('backgroundColor', 'lightgrey');
|
|
|
|
$(this).css('backgroundColor', 'lightgrey');
|
|
|
|
}).on('mouseleave', () => {
|
2019-12-14 00:09:51 +01:00
|
|
|
map_seat.css('backgroundColor', '#649a24');
|
2019-12-13 23:28:16 +01:00
|
|
|
$(this).css('backgroundColor', 'unset');
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-12-14 22:03:41 +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().split(" ")[0]) && !$(this).parent().hasClass('seatCharts-legendItem')) {
|
2019-12-19 15:23:49 +01:00
|
|
|
$(this).addClass('taken');}
|
2019-12-14 22:03:41 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-19 15:23:49 +01:00
|
|
|
function checkMap() {
|
|
|
|
const $this = $('#map-carousel');
|
|
|
|
if ($('.carousel-inner .item:first').hasClass('active')) {
|
|
|
|
$this.children('.left.carousel-control').hide();
|
|
|
|
$this.children('.right.carousel-control').show();
|
|
|
|
} else if ($('.carousel-inner .item:last').hasClass('active')) {
|
|
|
|
$this.children('.right.carousel-control').hide();
|
|
|
|
$this.children('.left.carousel-control').show();
|
|
|
|
} else {
|
|
|
|
$this.children('.carousel-control').show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-13 23:28:16 +01:00
|
|
|
$(document).ready(function(){
|
|
|
|
assignPlaces();
|
2019-12-14 22:03:41 +01:00
|
|
|
checkForUnavailablePlaces();
|
2019-12-19 15:23:49 +01:00
|
|
|
$('#map-carousel').on('slid.bs.carousel', checkMap);
|
2019-12-13 23:28:16 +01:00
|
|
|
});
|