removed state vars from function params
This commit is contained in:
@@ -79,7 +79,6 @@ export function addCartBack() {
|
|||||||
|
|
||||||
export function dropdownLegendOnChange(inSelector: string) {
|
export function dropdownLegendOnChange(inSelector: string) {
|
||||||
const seatmap = config.state.seatmap;
|
const seatmap = config.state.seatmap;
|
||||||
const seatmapXML = config.state.seatmapXML;
|
|
||||||
const dropdownLegend = jQuery(inSelector).get(0);
|
const dropdownLegend = jQuery(inSelector).get(0);
|
||||||
dropdownLegend.addEventListener("change", function (this: HTMLSelectElement) {
|
dropdownLegend.addEventListener("change", function (this: HTMLSelectElement) {
|
||||||
const value: string = this.value;
|
const value: string = this.value;
|
||||||
@@ -89,12 +88,12 @@ export function dropdownLegendOnChange(inSelector: string) {
|
|||||||
|
|
||||||
if (value === "all") {
|
if (value === "all") {
|
||||||
seatmap.find('unavailable').status('available');
|
seatmap.find('unavailable').status('available');
|
||||||
JSC.setUnavailableSeats(seatmapXML, seatmap);
|
JSC.setUnavailableSeats();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
seatmap.find('available').status('unavailable');
|
seatmap.find('available').status('unavailable');
|
||||||
JSC.activateSeatsBySectionID(value);
|
JSC.activateSeatsBySectionID(value);
|
||||||
JSC.setUnavailableSeats(seatmapXML, seatmap);
|
JSC.setUnavailableSeats();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -55,66 +55,6 @@ export function getRowsNaming(): string[] {
|
|||||||
return namingArr;
|
return namingArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// export function getColumnNaming(inXML: any): string[] {
|
|
||||||
// const layout: I.SeatmapLayout = inXML.seatmap[0].layouts[0].layout[0];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// const width: number = parseInt(layout.width[0]);
|
|
||||||
|
|
||||||
|
|
||||||
// const namingArr = Array.from({ length: width }, (_) => "");
|
|
||||||
// const rowsArr = layout.rows[0].row;
|
|
||||||
|
|
||||||
// // let seats: number[] = [];
|
|
||||||
// // let x: number[] = [];
|
|
||||||
// rowsArr.forEach(element => {
|
|
||||||
// // const index: number = parseInt(element.y_cell_coord[0]);
|
|
||||||
// const seatsArr: string[] = element.seats[0].split("|");
|
|
||||||
|
|
||||||
// seatsArr.forEach(seatStr => {
|
|
||||||
// const seatArr: string[] = splitSeatStr(seatStr);
|
|
||||||
// // seats.push(parseInt(seatArr[5]));
|
|
||||||
// // x.push(parseInt(seatArr[2]));
|
|
||||||
|
|
||||||
// const x = parseInt(seatArr[2]);
|
|
||||||
|
|
||||||
// // Form:
|
|
||||||
// // 0: "568528" -> ID
|
|
||||||
// // 1: "568528" -> ID
|
|
||||||
// // 2: "21" -> X-Coord benutzen
|
|
||||||
// // 3: "7024" -> section ID
|
|
||||||
// // 4: "13" -> Reihenbezeichnung
|
|
||||||
// // 5: "4" -> Platznummer
|
|
||||||
// namingArr[x] = seatArr[5];
|
|
||||||
|
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // const row = seatArr[4];
|
|
||||||
// // namingArr[index] = row;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // console.log(seats);
|
|
||||||
// // console.log(x);
|
|
||||||
// // console.log(Math.min.apply(Math, seats));
|
|
||||||
// // console.log(Math.max.apply(Math, seats));
|
|
||||||
// // console.log(Math.min.apply(Math, x));
|
|
||||||
// // console.log(Math.max.apply(Math, x));
|
|
||||||
|
|
||||||
// // const minimum = Math.min.apply(Math, seats);
|
|
||||||
// // let i = 0;
|
|
||||||
// // for (let index = Math.min.apply(Math, x); index < Math.max.apply(Math, x); index++) {
|
|
||||||
// // // const element = array[index];
|
|
||||||
|
|
||||||
// // namingArr[index] = (minimum + i).toString();
|
|
||||||
// // i++;
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// console.log(namingArr);
|
|
||||||
// return namingArr;
|
|
||||||
// }
|
|
||||||
|
|
||||||
export function generateMap(): string[] {
|
export function generateMap(): string[] {
|
||||||
const seatmapXML = config.state.seatmapXML;
|
const seatmapXML = config.state.seatmapXML;
|
||||||
const layout: I.SeatmapLayout = seatmapXML.seatmap[0].layouts[0].layout[0];
|
const layout: I.SeatmapLayout = seatmapXML.seatmap[0].layouts[0].layout[0];
|
||||||
@@ -130,9 +70,11 @@ export function generateMap(): string[] {
|
|||||||
return stringArrMatrix;
|
return stringArrMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateLegend(inVenueXML: I.VenueXML, inSeatmapXML: any, inNode: string): I.JSCLegend {
|
export function generateLegend(inNode: string): I.JSCLegend {
|
||||||
const pricescaleArr: I.SeatmapPricescale[] = inSeatmapXML.seatmap[0].pricescale_config[0].pricescale;
|
const seatmapXML = config.state.seatmapXML;
|
||||||
const venuePricescaleArr: I.Pricescale2[] = inVenueXML.venue[0].pricescales[0].pricescale;
|
const venueXML = config.state.inVenueXML!;
|
||||||
|
const pricescaleArr: I.SeatmapPricescale[] = seatmapXML.seatmap[0].pricescale_config[0].pricescale;
|
||||||
|
const venuePricescaleArr: I.Pricescale2[] = venueXML.venue[0].pricescales[0].pricescale;
|
||||||
let legend: I.JSCLegend = {
|
let legend: I.JSCLegend = {
|
||||||
node: jQuery(inNode),
|
node: jQuery(inNode),
|
||||||
items: []
|
items: []
|
||||||
@@ -157,8 +99,10 @@ export function generateLegend(inVenueXML: I.VenueXML, inSeatmapXML: any, inNode
|
|||||||
return legend;
|
return legend;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setUnavailableSeats(inXML: any, seatmap: any): void {
|
export function setUnavailableSeats(): void {
|
||||||
const availabilityArr: I.JSCAvailability = inXML.seatmap[0].view_modes[0].view_mode[0].availability[0];
|
const seatmapXML = config.state.seatmapXML;
|
||||||
|
const seatmap = config.state.seatmap;
|
||||||
|
const availabilityArr: I.JSCAvailability = seatmapXML.seatmap[0].view_modes[0].view_mode[0].availability[0];
|
||||||
|
|
||||||
if (availabilityArr.unavailable_unselectable_mask[0] === "")
|
if (availabilityArr.unavailable_unselectable_mask[0] === "")
|
||||||
return;
|
return;
|
||||||
@@ -254,8 +198,9 @@ export function createArrMatrix(inNumrows: number, inNumcols: number, inInitial:
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addTrims(inSeatmapXML: any) {
|
export function addTrims() {
|
||||||
const trimArr: I.Trim[] = inSeatmapXML.seatmap[0].trims[0].trim;
|
const seatmapXML = config.state.seatmapXML;
|
||||||
|
const trimArr: I.Trim[] = seatmapXML.seatmap[0].trims[0].trim;
|
||||||
trimArr.forEach(arr => {
|
trimArr.forEach(arr => {
|
||||||
const [xTrim, yTrim] = arr.coord[0].split(",").map(Number);
|
const [xTrim, yTrim] = arr.coord[0].split(",").map(Number);
|
||||||
const textArr: string[] = arr.text[0].split(";").filter(Boolean);
|
const textArr: string[] = arr.text[0].split(";").filter(Boolean);
|
||||||
@@ -306,23 +251,24 @@ function applyTrim(x: number, y: number, i: number, character: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectSeatsInCart(inSeatmap: any) {
|
export function selectSeatsInCart() {
|
||||||
|
const seatmapXML = config.state.seatmapXML;
|
||||||
config.state.selectedSeatsArr.forEach(arr => {
|
config.state.selectedSeatsArr.forEach(arr => {
|
||||||
const seatID: string = arr[0];
|
const seatID: string = arr[0];
|
||||||
|
|
||||||
if (inSeatmap.get(seatID))
|
if (seatmapXML.get(seatID))
|
||||||
inSeatmap.status(seatID, "selected");
|
seatmapXML.status(seatID, "selected");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addSeatmap(inSelector: string, inMap: string[], inRowsNaming: string[], inSeats: I.JSCSeats, inLegend: I.JSCLegend, inSeatmap: any): void {
|
export function addSeatmap(inSelector: string, inMap: string[], inRowsNaming: string[], inSeats: I.JSCSeats, inLegend: I.JSCLegend): void {
|
||||||
const containerSeatmap: any = (<any>window).jQuery(inSelector);
|
const containerSeatmap: any = (<any>window).jQuery(inSelector);
|
||||||
|
|
||||||
// console.log(inSeatmapInitMap);
|
// console.log(inSeatmapInitMap);
|
||||||
// console.log(inSeats);
|
// console.log(inSeats);
|
||||||
// console.log(inLegend);
|
// console.log(inLegend);
|
||||||
|
|
||||||
inSeatmap = containerSeatmap.seatCharts({
|
config.state.seatmap = containerSeatmap.seatCharts({
|
||||||
naming: {
|
naming: {
|
||||||
top: false,
|
top: false,
|
||||||
left: false,
|
left: false,
|
||||||
@@ -337,7 +283,7 @@ export function addSeatmap(inSelector: string, inMap: string[], inRowsNaming: st
|
|||||||
|
|
||||||
console.log(selectedSeat);
|
console.log(selectedSeat);
|
||||||
|
|
||||||
if (State.maximumSelectedSeatsReached(selectedSeat, inSeatmap))
|
if (State.maximumSelectedSeatsReached(selectedSeat))
|
||||||
return "available";
|
return "available";
|
||||||
|
|
||||||
State.addSeatToState(selectedSeat);
|
State.addSeatToState(selectedSeat);
|
||||||
|
|||||||
@@ -44,10 +44,11 @@ export function removeSeatFromState(inSelectedSeat: I.JSCSelectedSeat) {
|
|||||||
jQuery("#modalCart-overlay").hide();
|
jQuery("#modalCart-overlay").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function maximumSelectedSeatsReached(inSeatObj: I.JSCSelectedSeat, inSeatmap: any): boolean {
|
export function maximumSelectedSeatsReached(inSeatObj: I.JSCSelectedSeat): boolean {
|
||||||
|
const seatmap = config.state.seatmap;
|
||||||
if (config.state.selectedSeatsArr.length >= config.maxSelectedSeats) {
|
if (config.state.selectedSeatsArr.length >= config.maxSelectedSeats) {
|
||||||
UI.showJBoxNotice(`Sie können maximal ${config.maxSelectedSeats} Plätze auswählen.`);
|
UI.showJBoxNotice(`Sie können maximal ${config.maxSelectedSeats} Plätze auswählen.`);
|
||||||
inSeatmap.status(inSeatObj.id, "available");
|
seatmap.status(inSeatObj.id, "available");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,11 @@ export function setOptionSelect(inSeatmapListing: I.Seatmap[], inId: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setEventInfo(inEventInfo: I.EventInfo, inInputswithValue: I.InputsWithValue): void {
|
export function setEventInfo(inEventInfo: I.EventInfo): void {
|
||||||
|
const inputsWithValue = config.state.inputsWithValue!;
|
||||||
jQuery("#eventInfoDesc span.fl-heading-text")[0].childNodes[0].textContent = inEventInfo.desc[0];
|
jQuery("#eventInfoDesc span.fl-heading-text")[0].childNodes[0].textContent = inEventInfo.desc[0];
|
||||||
jQuery("#eventInfoDate p")[0].childNodes[0].textContent = inEventInfo.start[0];
|
jQuery("#eventInfoDate p")[0].childNodes[0].textContent = inEventInfo.start[0];
|
||||||
jQuery("#eventInfoLocation p")[0].childNodes[0].textContent = inInputswithValue.venueLocation;
|
jQuery("#eventInfoLocation p")[0].childNodes[0].textContent = inputsWithValue.venueLocation;
|
||||||
jQuery("#eventInfoCapacity p")[0].childNodes[0].textContent = `Verfügbare Plätze: ${inEventInfo.seats_available} von ${inEventInfo.venue_config_capacity[0]}`;
|
jQuery("#eventInfoCapacity p")[0].childNodes[0].textContent = `Verfügbare Plätze: ${inEventInfo.seats_available} von ${inEventInfo.venue_config_capacity[0]}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,9 +151,10 @@ export function addPanzoom(inSelector: string, inBtnZoomIn: string | null = null
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function changeVenueImage(inInputsWithValue: I.InputsWithValue) {
|
export function changeVenueImage() {
|
||||||
if (inInputsWithValue.venueImageSrc !== undefined)
|
const inputsWithValue = config.state.inputsWithValue!;
|
||||||
jQuery("#venueImage img").attr("src", inInputsWithValue.venueImageSrc);
|
if (inputsWithValue.venueImageSrc !== undefined)
|
||||||
|
jQuery("#venueImage img").attr("src", inputsWithValue.venueImageSrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showHideBtnCartLoading(inSwitch: string) {
|
export function showHideBtnCartLoading(inSwitch: string) {
|
||||||
|
|||||||
@@ -99,12 +99,6 @@ export default class Utils {
|
|||||||
|
|
||||||
static getDayName(date: Date, locale: string) {
|
static getDayName(date: Date, locale: string) {
|
||||||
return date.toLocaleDateString(locale, { weekday: 'long' });
|
return date.toLocaleDateString(locale, { weekday: 'long' });
|
||||||
}
|
}
|
||||||
|
|
||||||
static generateRandomColor(): string {
|
|
||||||
const randomNumber: number = Math.floor((Math.random() * 10000) + 1);
|
|
||||||
const hue = randomNumber * 137.508; // use golden angle approximation
|
|
||||||
return `hsl(${hue},100%,75%)`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ function messageHandler(inE: any) {
|
|||||||
case "parent_init_sendVenueXML": {
|
case "parent_init_sendVenueXML": {
|
||||||
config.state.inVenueXML = data.message.map_response;
|
config.state.inVenueXML = data.message.map_response;
|
||||||
const venueXML = config.state.inVenueXML!;
|
const venueXML = config.state.inVenueXML!;
|
||||||
const inputsWithValue = config.state.inputsWithValue!;
|
|
||||||
|
|
||||||
// Generate pricescale css classes
|
// Generate pricescale css classes
|
||||||
const css = XMLHelper.generatePricescaleCSS();
|
const css = XMLHelper.generatePricescaleCSS();
|
||||||
@@ -85,7 +84,7 @@ function messageHandler(inE: any) {
|
|||||||
|
|
||||||
// Fill event info
|
// Fill event info
|
||||||
const eventInfo = XMLHelper.getEventInfo();
|
const eventInfo = XMLHelper.getEventInfo();
|
||||||
UI.setEventInfo(eventInfo, inputsWithValue);
|
UI.setEventInfo(eventInfo);
|
||||||
|
|
||||||
// Fill select dropdown
|
// Fill select dropdown
|
||||||
const seatmapListing: I.Seatmap[] = venueXML.seatmap_config[0].seatmap;
|
const seatmapListing: I.Seatmap[] = venueXML.seatmap_config[0].seatmap;
|
||||||
@@ -104,29 +103,24 @@ function messageHandler(inE: any) {
|
|||||||
|
|
||||||
case "parent_init_sendInputsWithValue": {
|
case "parent_init_sendInputsWithValue": {
|
||||||
config.state.inputsWithValue = data.message;
|
config.state.inputsWithValue = data.message;
|
||||||
const inputsWithValue = config.state.inputsWithValue!;
|
UI.changeVenueImage();
|
||||||
|
|
||||||
UI.changeVenueImage(inputsWithValue!);
|
|
||||||
Communication.sendEventToParent("child_init_needVenueXML");
|
Communication.sendEventToParent("child_init_needVenueXML");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "parent_sendSeatmapXML": {
|
case "parent_sendSeatmapXML": {
|
||||||
config.state.seatmapXML = data.message.map_response;
|
config.state.seatmapXML = data.message.map_response;
|
||||||
const seatmapXML = config.state.seatmapXML;
|
|
||||||
const venueXML = config.state.inVenueXML!;
|
|
||||||
const seatmap = config.state.seatmap;
|
|
||||||
const map: string[] = JSC.generateMap();
|
const map: string[] = JSC.generateMap();
|
||||||
const rowsNaming: string[] = JSC.getRowsNaming();
|
const rowsNaming: string[] = JSC.getRowsNaming();
|
||||||
const seats: I.JSCSeats = JSC.getSeats();
|
const seats: I.JSCSeats = JSC.getSeats();
|
||||||
const legend: I.JSCLegend = JSC.generateLegend(venueXML, seatmapXML, "#JSCLegendInner");
|
const legend: I.JSCLegend = JSC.generateLegend("#JSCLegendInner");
|
||||||
|
|
||||||
JSC.addSeatmap("#containerSeatmapInner", map, rowsNaming, seats, legend, seatmap);
|
JSC.addSeatmap("#containerSeatmapInner", map, rowsNaming, seats, legend);
|
||||||
JSC.setUnavailableSeats(seatmapXML, seatmap);
|
JSC.setUnavailableSeats();
|
||||||
JSC.selectSeatsInCart(seatmap);
|
JSC.selectSeatsInCart();
|
||||||
UI.convertLegendToDropdown("dropdownLegend");
|
UI.convertLegendToDropdown("dropdownLegend");
|
||||||
Events.dropdownLegendOnChange("#dropdownLegend");
|
Events.dropdownLegendOnChange("#dropdownLegend");
|
||||||
JSC.addTrims(seatmapXML);
|
JSC.addTrims();
|
||||||
XMLHelper.processSMAP();
|
XMLHelper.processSMAP();
|
||||||
config.state.panzoom = UI.addPanzoom("#containerSeatmapInner", ".panzoomZoomIn", ".panzoomZoomOut", "#panzoomResetZoom");
|
config.state.panzoom = UI.addPanzoom("#containerSeatmapInner", ".panzoomZoomIn", ".panzoomZoomOut", "#panzoomResetZoom");
|
||||||
UI.controlLoftloader("hide");
|
UI.controlLoftloader("hide");
|
||||||
|
|||||||
Reference in New Issue
Block a user