outsourced inject and seatmap to modules
This commit is contained in:
97
client/src/modules/child.ts
Normal file
97
client/src/modules/child.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
import * as Communication from "./communication";
|
||||
import * as UI from "./ui";
|
||||
import { config } from "./config";
|
||||
import Utils from "./utils";
|
||||
import * as Parser from './parser';
|
||||
import * as I from "../types/types";
|
||||
import * as JSC from "./jsc";
|
||||
import * as Legend from "./legend";
|
||||
import * as Events from "./events";
|
||||
import * as Trims from "./trims";
|
||||
import * as XMLHelper from "./xmlhelper";
|
||||
import * as Panzoom from "./panzoom";
|
||||
import * as jBoxHelper from "./jBoxHelper";
|
||||
import * as Cart from "./cart";
|
||||
import * as CartButtons from "./cartButtons";
|
||||
|
||||
export function initVenue() {
|
||||
UI.controlLoftloader("show");
|
||||
Communication.sendEventToParent("child_init_needInputsWithValue");
|
||||
}
|
||||
|
||||
export function initSendVenueXML(inE: any) {
|
||||
const data: I.Message = JSON.parse(inE.data);
|
||||
config.state.inVenueXML = data.message.map_response;
|
||||
const venueXML = config.state.inVenueXML!;
|
||||
|
||||
// Generate pricescale css classes
|
||||
const css = UI.generatePricescaleCSS();
|
||||
Utils.inject(css, "cssCustom", "body");
|
||||
|
||||
// Fill event info
|
||||
const eventInfo = Parser.getEventInfo();
|
||||
UI.setEventInfo(eventInfo);
|
||||
|
||||
// Fill select dropdown
|
||||
const seatmapListing: I.Seatmap[] = venueXML.seatmap_config[0].seatmap;
|
||||
UI.setOptionSelect(seatmapListing, "dropdownSeatmap");
|
||||
|
||||
// Display first seatmapXML
|
||||
const id: string = seatmapListing[0].id[0];
|
||||
jQuery("#dropdownSeatmap").val(id);
|
||||
Communication.needSeatmapXML(id);
|
||||
|
||||
console.log(css);
|
||||
console.log(seatmapListing);
|
||||
|
||||
}
|
||||
|
||||
export function initSendInputsWithValue(inE: any) {
|
||||
const data: I.Message = JSON.parse(inE.data);
|
||||
config.state.inputsWithValue = data.message;
|
||||
UI.changeVenueImage();
|
||||
Communication.sendEventToParent("child_init_needVenueXML");
|
||||
}
|
||||
|
||||
|
||||
export function sendSeatmapXML(inE: any) {
|
||||
const data: I.Message = JSON.parse(inE.data);
|
||||
config.state.seatmapXML = data.message.map_response;
|
||||
const map: string[] = JSC.generateMap();
|
||||
const rowsNaming: string[] = JSC.getRowsNaming();
|
||||
const seats: I.JSCSeats = JSC.getSeats();
|
||||
const legend: I.JSCLegend = JSC.generateLegend("#JSCLegendInner");
|
||||
|
||||
JSC.addSeatmap("#containerSeatmapInner", map, rowsNaming, seats, legend);
|
||||
JSC.setUnavailableSeats();
|
||||
JSC.selectSeatsInCart();
|
||||
Legend.convertLegendToDropdown("dropdownLegend");
|
||||
Events.dropdownLegendOnChange("#dropdownLegend");
|
||||
Trims.addTrims();
|
||||
XMLHelper.processSMAP();
|
||||
config.state.panzoom = Panzoom.addPanzoom("#containerSeatmapInner", ".panzoomZoomIn", ".panzoomZoomOut", "#panzoomResetZoom");
|
||||
UI.controlLoftloader("hide");
|
||||
jBoxHelper.createSeatTooltips();
|
||||
}
|
||||
|
||||
export function sendCheckoutResponse(inE: any) {
|
||||
const data: I.Message = JSON.parse(inE.data);
|
||||
config.state.isValidSeatSelection = data.message.isValidSeatSelection;
|
||||
|
||||
console.log(data.message);
|
||||
|
||||
if (!config.state.isValidSeatSelection) {
|
||||
jBoxHelper.showJBoxNotice(`Auswahl nicht möglich: Bitte lassen Sie keinen einzelnen Platz frei.`);
|
||||
CartButtons.showHideBtnCartLoading("hide");
|
||||
}
|
||||
else {
|
||||
Cart.removeCartItems();
|
||||
Cart.generateCartItems();
|
||||
const url = Cart.generateCheckoutUrl();
|
||||
Events.addRedirectCheckout(url);
|
||||
UI.fadeInCartModal();
|
||||
CartButtons.showHideBtnCartLoading("hide");
|
||||
}
|
||||
|
||||
config.state.cartChanged = false;
|
||||
}
|
||||
Reference in New Issue
Block a user