implemented cart button

This commit is contained in:
zino
2021-03-31 19:30:52 +02:00
parent d23fa35e42
commit eb640a6fb5
9 changed files with 1079 additions and 56 deletions

View File

@@ -13,5 +13,6 @@ export const config: I.Config = {
urlJSCMaster: "https://tickets.zinomedia.de/libs/jQuery-Seat-Charts/jquery.seat-charts.min.js",
urlCSSJSCStaging: "https://staging.tickets.zinomedia.de/libs/jQuery-Seat-Charts/jquery.seat-charts.css",
urlCSSJSCMaster: "https://tickets.zinomedia.de/libs/jQuery-Seat-Charts/jquery.seat-charts.css",
urlCSSjQueryUI: "https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css",
childHasVenueXML: false
}

View File

@@ -18,7 +18,7 @@ export function getSeats(inXML: any): I.JSCSeats {
return seatmapInitSeats;
}
export function activateSeatsBySectionID(inXML: any, seatmap: any, inValue: string, ) {
export function activateSeatsBySectionID(inXML: any, seatmap: any, inValue: string,) {
const pricescaleArr: I.SeatmapPricescale[] = inXML.seatmap[0].pricescale_config[0].pricescale;
pricescaleArr.forEach(element => {
@@ -38,33 +38,40 @@ export function getRows(inXML: any): number[] {
export function generateMap(inXML: any): string[] {
const layout: I.SeatmapLayout = inXML.seatmap[0].layouts[0].layout[0];
console.log(layout);
const rows: I.LayoutRow2[] = layout.rows[0].row;
const pricescaleArr: I.SeatmapPricescale[] = inXML.seatmap[0].pricescale_config[0].pricescale;
const availabilityArr: I.JSCAvailability = inXML.seatmap[0].view_modes[0].view_mode[0].availability[0];
// Form: arrMatrix[Y][X]
let arrMatrix: string[][] = createArrMatrix(parseInt(layout.height[0]), parseInt(layout.width[0]), "_");
arrMatrix = enterSeatsInMatrix(rows, arrMatrix, pricescaleArr);
arrMatrix = enterSeatsInMatrix(rows, arrMatrix, pricescaleArr, availabilityArr);
const stringArrMatrix = generateStringArrMatrix(arrMatrix);
return stringArrMatrix;
}
export function generateLegend(inXML: any, inNode: string): I.JSCLegend {
const pricescaleArr: I.SeatmapPricescale[] = inXML.seatmap[0].pricescale_config[0].pricescale;
console.log(pricescaleArr);
export function generateLegend(inVenueXML: I.VenueXML, inSeatmapXML: any, inNode: string): I.JSCLegend {
const pricescaleArr: I.SeatmapPricescale[] = inSeatmapXML.seatmap[0].pricescale_config[0].pricescale;
const venuePricescaleArr: I.Pricescale2[] = inVenueXML.venue[0].pricescales[0].pricescale;
let legend: I.JSCLegend = {
node: jQuery(inNode),
items: []
}
for (let key in pricescaleArr) {
for (let key in pricescaleArr) {
const id: string = pricescaleArr[key].id[0];
const seatsKey: string = String.fromCharCode(97 + parseInt(key)).toLocaleUpperCase();
const price: string = `${pricescaleArr[key].ref_price[0]}`;
const legendItem = [ seatsKey, "available", price ];
// get pricescale desc from venueXML
const desc = venuePricescaleArr.find(obj => {
const pricecaleID = obj.id[0];
return pricecaleID === id;
})?.desc[0];
const description: string = `${desc}${pricescaleArr[key].ref_price[0]}`;
const legendItem = [seatsKey, "available", description];
legend.items.push(legendItem);
}
}
return legend;
}
@@ -73,7 +80,7 @@ export function setUnavailableSeats(inXML: any, seatmap: any): void {
const availabilityArr: I.JSCAvailability = inXML.seatmap[0].view_modes[0].view_mode[0].availability[0];
if (availabilityArr.unavailable_unselectable_mask[0] === "")
return;
return;
const unavailableArr: string[] = availabilityArr.unavailable_unselectable_mask[0].split(",");
seatmap.status(unavailableArr, "unavailable");
@@ -90,7 +97,10 @@ export function generateStringArrMatrix(inArrMatrix: string[][]): string[] {
}
export function enterSeatsInMatrix(inRows: I.LayoutRow2[], inArrMatrix: string[][], inPricescaleArr: I.SeatmapPricescale[]): string[][] {
function enterSeatsInMatrix(inRows: I.LayoutRow2[], inArrMatrix: string[][], inPricescaleArr: I.SeatmapPricescale[], inAvailabilityArr: I.JSCAvailability): string[][] {
const availableArr: string[] = inAvailabilityArr.available_selectable_mask[0].split(",");
const unavailableArr: string[] = inAvailabilityArr.unavailable_unselectable_mask[0].split(",");
inRows.forEach(element => {
const row: I.LayoutRow2 = element;
const Y: number = parseInt(row.y_cell_coord[0]);
@@ -110,6 +120,10 @@ export function enterSeatsInMatrix(inRows: I.LayoutRow2[], inArrMatrix: string[]
// 4: "13" -> Reihenbezeichnung
// 5: "4" -> ?
// skip blacked out seats
if (!availableArr.includes(seatArr[0]) && !unavailableArr.includes(seatArr[0]))
return;
// const X: number = parseInt(seatArr[5]);
const X: number = parseInt(seatArr[2]);
const seatsKey = getSeatsKey(seatArr[0], inPricescaleArr);

View File

@@ -47,7 +47,8 @@ export function getAdditionalInputs(inContent: string): { [key: string]: string
const posturlRaw = inContent.match(/posturl:"(.+?)"/)![1];
const posturlRawDecoded = decodeURIComponent(posturlRaw);
const posturl = decodeURIComponent(`${posturlRaw}&event=${event}&holdcode=${holdcode}&nocache=0&inclpkg=Y&incloffer=Y&inclcartdetails=Y&inclCart=Y&inclvenue=Y`);
const venueLocation = getVenueLocation()
const venueLocation = getVenueLocation();
const ticketPurchaseUrl = `${posturlRawDecoded.split("?")[0].split('/').slice(0,-1).join('/')}/TicketPurchase`;
return {
"event": event,
@@ -55,7 +56,8 @@ export function getAdditionalInputs(inContent: string): { [key: string]: string
"posturlRaw": posturlRaw,
"posturlRawDecoded": posturlRawDecoded,
"posturl": posturl,
"venueLocation": venueLocation
"venueLocation": venueLocation,
"ticketPurchaseUrl": ticketPurchaseUrl
}
}

View File

@@ -17,7 +17,6 @@ export function setOptionSelect(inSeatmapListing: I.Seatmap[], inId: string) {
}
export function setEventInfo(inEventInfo: I.EventInfo, inInputswithValue: I.InputsWithValue): void {
// console.log(inEventInfo);
jQuery("#eventInfoDesc span.fl-heading-text")[0].childNodes[0].textContent = inEventInfo.desc[0];
jQuery("#eventInfoDate p")[0].childNodes[0].textContent = inEventInfo.start[0];
jQuery("#eventInfoCapacity p")[0].childNodes[0].textContent = inEventInfo.venue_config_capacity[0];