Fix carousel parts
This commit is contained in:
parent
ea0afdb671
commit
634cf4c042
@ -1,8 +1,8 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
function createMap(seats_rows, seats_container) {
|
function createMap(seats_rows, seats_container) {
|
||||||
let $cart = $('#selected-seats');
|
var $cart = $('#selected-seats');
|
||||||
let seat_selected = false;
|
var seat_selected = false;
|
||||||
|
|
||||||
seats_container.seatCharts({
|
seats_container.seatCharts({
|
||||||
map: seats_rows,
|
map: seats_rows,
|
||||||
@ -20,7 +20,7 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
click: function () {
|
click: function () {
|
||||||
if (this.status() === 'available' && !seat_selected) {
|
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>')
|
$('<span> ' + this.settings.label + ' <a href="#" class="cancel-cart-item">[x]</a></span>')
|
||||||
.attr('id', 'cart-item-' + this.settings.id)
|
.attr('id', 'cart-item-' + this.settings.id)
|
||||||
.data('seatId', this.settings.id)
|
.data('seatId', this.settings.id)
|
||||||
@ -48,17 +48,17 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createMultiPartsMap(parts_number, seat_map) {
|
function createMultiPartsMap(parts_number, seat_map) {
|
||||||
let $cart = $('#selected-seats');
|
var $cart = $('#selected-seats');
|
||||||
let seat_selected = false;
|
var seat_selected = false;
|
||||||
|
|
||||||
// divide all rows into carousel slides
|
// divide all rows into carousel slides
|
||||||
let parts_elements = []; // slides elements
|
var parts_elements = []; // slides elements
|
||||||
let parts_rows = []; // sets of rows for slides
|
var parts_rows = []; // sets of rows for slides
|
||||||
const per_page = 4; // max number of rows on one slide
|
const per_page = 4; // max number of rows on one slide
|
||||||
let first_index = 0;
|
var first_index = 0;
|
||||||
let last_index = 4;
|
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}`);
|
parts_elements[i] = $(`#seat-map-${i}`);
|
||||||
if(seat_map[first_index] === '_') {
|
if(seat_map[first_index] === '_') {
|
||||||
seat_map.splice(first_index, 1) // remove unnecessary first row of every set if it's blank
|
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
|
} else if(last_rows.length < 4) { // fill the last slide to 4 rows
|
||||||
const diff = 4 - last_rows.length;
|
const diff = 4 - last_rows.length;
|
||||||
for(let i=0; i<diff; i++) {
|
for(var i=0; i<diff; i++) {
|
||||||
last_rows.push('_');
|
last_rows.push('_');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
click: function () {
|
click: function () {
|
||||||
if (this.status() === 'available' && !seat_selected) {
|
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>')
|
$('<span> ' + this.settings.label + ' <a href="#" class="cancel-cart-item">[x]</a></span>')
|
||||||
.attr('id', 'cart-item-' + this.settings.id)
|
.attr('id', 'cart-item-' + this.settings.id)
|
||||||
.data('seatId', this.settings.id)
|
.data('seatId', this.settings.id)
|
||||||
@ -124,7 +124,7 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// execute seatchart function for the rest slides
|
// 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({
|
parts_elements[i].seatCharts({
|
||||||
map: parts_rows[i],
|
map: parts_rows[i],
|
||||||
naming: {
|
naming: {
|
||||||
@ -134,7 +134,7 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
click: function () {
|
click: function () {
|
||||||
if (this.status() === 'available' && !seat_selected) {
|
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>')
|
$('<span> ' + this.settings.label + ' <a href="#" class="cancel-cart-item">[x]</a></span>')
|
||||||
.attr('id', 'cart-item-' + this.settings.id)
|
.attr('id', 'cart-item-' + this.settings.id)
|
||||||
.data('seatId', this.settings.id)
|
.data('seatId', this.settings.id)
|
||||||
|
Loading…
Reference in New Issue
Block a user