Added feature to specify first seatmap on load by defining second value of SMAP (must be valid code). If invalid code given, first seatmap will be returned.
This commit is contained in:
@@ -37,7 +37,9 @@ export function initSendVenueXML(inE: any) {
|
||||
UI.setOptionSelect(seatmapListing, "dropdownSeatmap");
|
||||
|
||||
// Display first seatmapXML
|
||||
const id: string = seatmapListing[0].id[0];
|
||||
// If smap[1] is given by user, display specific seatmap on load
|
||||
const id: string = XMLHelper.getFirstSeatmapIDToLoad();
|
||||
|
||||
jQuery("#dropdownSeatmap").val(id);
|
||||
Communication.needSeatmapXML(id);
|
||||
|
||||
@@ -67,7 +69,7 @@ export function sendSeatmapXML(inE: any) {
|
||||
Legend.convertLegendToDropdown("dropdownLegend");
|
||||
Events.dropdownLegendOnChange("#dropdownLegend");
|
||||
Trims.addTrims();
|
||||
XMLHelper.processSMAP();
|
||||
XMLHelper.showHideVenueCapacity();
|
||||
config.state.panzoom = Panzoom.addPanzoom("#containerSeatmapInner", ".panzoomZoomIn", ".panzoomZoomOut", "#panzoomResetZoom");
|
||||
Cart.setImportantNote();
|
||||
UI.controlLoftloader("hide");
|
||||
|
||||
@@ -83,7 +83,10 @@ export function getSMAP(): string | undefined {
|
||||
return undefined;
|
||||
|
||||
const str: string = jQuery("#seating_map_url a").attr("onclick");
|
||||
const re = /openNewWindow\(\'(\d+)\'/;
|
||||
|
||||
//const re = /openNewWindow\(\'(\d+)\'/;
|
||||
const re = /openNewWindow\(\'(.+?)\'/;
|
||||
|
||||
const found: RegExpMatchArray | null = str.match(re);
|
||||
|
||||
return found ? found[1] : undefined;
|
||||
|
||||
@@ -1,19 +1,43 @@
|
||||
|
||||
import * as I from "../types/types";
|
||||
import { config } from "./config";
|
||||
|
||||
export function processSMAP(): void {
|
||||
export function showHideVenueCapacity(): void {
|
||||
const inputsWithValue = config.state.inputsWithValue!;
|
||||
|
||||
if (!inputsWithValue.smap)
|
||||
return;
|
||||
|
||||
const smapArr: number[] = inputsWithValue.smap.split("").map(Number);
|
||||
// TODO: We are sure that there are always only two elements [number, string], so we can declare it as a tuple?
|
||||
const smapArr = inputsWithValue.smap.split(";");
|
||||
// Form:
|
||||
// 0: = "0" -> Show venue capacity 1=yes 0=no
|
||||
// 1: = "SC02" -> Show specific seat plan when loading for the first time
|
||||
|
||||
if (!smapArr[0])
|
||||
// Convert first SMAP element to Number and hide or show venue capacity data
|
||||
if (!Number(smapArr[0]))
|
||||
jQuery("#eventInfoCapacity").hide();
|
||||
}
|
||||
|
||||
export function getFirstSeatmapIDToLoad() {
|
||||
const inputsWithValue = config.state.inputsWithValue!;
|
||||
const venueXML = config.state.inVenueXML!;
|
||||
const seatmapListing: I.Seatmap[] = venueXML.seatmap_config[0].seatmap;
|
||||
const firstSeatmapID: string = seatmapListing[0].id[0];
|
||||
|
||||
// If SMAP field is missing, return ID of first seatmap
|
||||
if (!inputsWithValue.smap)
|
||||
return firstSeatmapID;
|
||||
|
||||
// If seatmap code is given in SMAP, return corresponding seatmap ID, otherwise return ID of first seatmap
|
||||
const smapArr = inputsWithValue.smap.split(";"); // Form described above
|
||||
if (!smapArr[1])
|
||||
return firstSeatmapID;
|
||||
|
||||
const seatmapID: string | undefined = seatmapListing.find(arr => smapArr[1] === arr.code[0])?.id[0];
|
||||
|
||||
return seatmapID ? seatmapID : firstSeatmapID;
|
||||
}
|
||||
|
||||
export function getSectionDescBySectionID(inSectionID: string): string | undefined {
|
||||
const venueXML: I.VenueXML = config.state.inVenueXML!;
|
||||
const sectionArr: I.Section[] = venueXML.master_config[0].section_config[0].section;
|
||||
|
||||
Reference in New Issue
Block a user