Fix carousel parts

This commit is contained in:
barwie2@st.amu.edu.pl 2020-01-13 12:47:40 +01:00
parent ea0afdb671
commit 634cf4c042

View File

@ -1,8 +1,8 @@
$(document).ready(function() {
function createMap(seats_rows, seats_container) {
let $cart = $('#selected-seats');
let seat_selected = false;
var $cart = $('#selected-seats');
var seat_selected = false;
seats_container.seatCharts({
map: seats_rows,
@ -20,7 +20,7 @@ $(document).ready(function() {
},
click: function () {
if (this.status() === 'available' && !seat_selected) {
// let's create a new <li> which we'll add to the cart items
// var's create a new <li> which we'll add to the cart items
$('<span> ' + this.settings.label + ' <a href="#" class="cancel-cart-item">[x]</a></span>')
.attr('id', 'cart-item-' + this.settings.id)
.data('seatId', this.settings.id)
@ -48,17 +48,17 @@ $(document).ready(function() {
}
function createMultiPartsMap(parts_number, seat_map) {
let $cart = $('#selected-seats');
let seat_selected = false;
var $cart = $('#selected-seats');
var seat_selected = false;
// divide all rows into carousel slides
let parts_elements = []; // slides elements
let parts_rows = []; // sets of rows for slides
var parts_elements = []; // slides elements
var parts_rows = []; // sets of rows for slides
const per_page = 4; // max number of rows on one slide
let first_index = 0;
let last_index = 4;
var first_index = 0;
var last_index = 4;
for(let i=0; i<parts_number; i++) {
for(var i=0; i<parts_number; i++) {
parts_elements[i] = $(`#seat-map-${i}`);
if(seat_map[first_index] === '_') {
seat_map.splice(first_index, 1) // remove unnecessary first row of every set if it's blank
@ -80,7 +80,7 @@ $(document).ready(function() {
}
} else if(last_rows.length < 4) { // fill the last slide to 4 rows
const diff = 4 - last_rows.length;
for(let i=0; i<diff; i++) {
for(var i=0; i<diff; i++) {
last_rows.push('_');
}
}
@ -102,7 +102,7 @@ $(document).ready(function() {
},
click: function () {
if (this.status() === 'available' && !seat_selected) {
// //let's create a new <li> which we'll add to the cart items
// //var's create a new <li> which we'll add to the cart items
$('<span> ' + this.settings.label + ' <a href="#" class="cancel-cart-item">[x]</a></span>')
.attr('id', 'cart-item-' + this.settings.id)
.data('seatId', this.settings.id)
@ -124,7 +124,7 @@ $(document).ready(function() {
});
// execute seatchart function for the rest slides
for(let i=1; i<parts_number; i++) {
for(var i = 1; i < parts_number - 1; i++) {
parts_elements[i].seatCharts({
map: parts_rows[i],
naming: {
@ -134,7 +134,7 @@ $(document).ready(function() {
},
click: function () {
if (this.status() === 'available' && !seat_selected) {
// //let's create a new <li> which we'll add to the cart items
// //var's create a new <li> which we'll add to the cart items
$('<span> ' + this.settings.label + ' <a href="#" class="cancel-cart-item">[x]</a></span>')
.attr('id', 'cart-item-' + this.settings.id)
.data('seatId', this.settings.id)