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:
zino
2022-09-20 14:45:48 +02:00
parent 468f0a46b0
commit 8126d7be13
9 changed files with 64832 additions and 7 deletions

1
client/dist/inject.css vendored Normal file
View File

@@ -0,0 +1 @@
#containerBookingBtn{display:none;margin:0;text-align:center}#get_flash{display:none}.ui-dialog-title{text-align:center;display:none}.ui-widget-overlay{background:#fff;opacity:1;width:100vw;height:100vh}#openSeatmap img{width:64px}#openSeatmap{padding:1rem!important;cursor:pointer;border-radius:5px}#openSeatmap span{font-size:1.2rem}#foobarParent{display:none}div#dialogSeatmap{padding-top:0}.ui-widget-header{background:#fff;border:1px solid #c6c6c6;border-bottom-right-radius:0;border-bottom-left-radius:0}.ui-dialog{background:#fff;left:0!important;padding:0;top:0!important;right:0!important}.ui-dialog .ui-dialog-content{padding:0}.ui-dialog-titlebar{margin-left:0;margin-right:0;padding:0!important;display:none}#iframeSeatmap{height:100vh;background:#fff;width:100%}.ui-corner-all{border-radius:0}.ui-widget{border:none!important}

32742
client/dist/inject.js vendored Normal file

File diff suppressed because one or more lines are too long

1
client/dist/seatmap.css vendored Normal file

File diff suppressed because one or more lines are too long

32050
client/dist/seatmap.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
"name": "client",
"version": "1.0.0",
"license": "ISC",
"dependencies": {

View File

@@ -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");

View File

@@ -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;

View File

@@ -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;

Submodule libs/jQuery-Seat-Charts added at f43f2a1884