implemented cart button
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user