implemented check tick selected seat

This commit is contained in:
zino
2021-03-24 21:37:06 +01:00
parent c7a6267975
commit 04cf55e4fe
10 changed files with 252 additions and 78 deletions

View File

@@ -0,0 +1,56 @@
import axios, { AxiosResponse } from 'axios';
var xml2jsParser = require('xml2js').parseString;
import * as I from "../types/types";
import Utils from './utils';
export function getXMLPromise(url: string): Promise<unknown> {
return axios.get(url)
.then(function (response: void | AxiosResponse<any>) {
return new Promise(function (resolve: any, reject: any) {
const AxiosResponse = <AxiosResponse>response;
if (AxiosResponse.status === 200 && AxiosResponse.headers["content-type"] === "text/xml;charset=utf-8") {
xml2jsParser(AxiosResponse.data, { normalizeTags: true, normalize: true, mergeAttrs: true }, function (err: any, result: any) {
if (err)
reject(err);
else {
resolve(result);
}
});
}
});
})
.catch(function (error) {
console.log(error);
})
}
export function getSeatmapListing(inVenueXML: I.VenueXML): I.Seatmap[] {
return inVenueXML.seatmap_config[0].seatmap;
}
export function getEventInfo(inVenueXML: I.VenueXML): I.EventInfo {
const eventObj: I.Event = inVenueXML.event[0];
const event = inVenueXML.event[0];
const venue_config = inVenueXML.venue_config[0];
const dateObj: Date = new Date(parseInt(event.year[0]), parseInt(event.month[0])-1, parseInt(event.hour[0]), parseInt(event.minute[0]));
const start: string[] = [ dateObj.toLocaleString(["de-DE"], { weekday: "long", day: "2-digit", month: "2-digit", year: "numeric", hour: "2-digit", minute: "2-digit", timeZoneName: "short" }) ];
const weekday = [ Utils.getDayName(dateObj, "de-DE") ];
const eventExtend: I.EventExtend = {
venue_config_capacity: venue_config.capacity,
venue_config_code: venue_config.code,
venue_config_desc: venue_config.desc,
venue_config_id: venue_config.id,
venue_config_nav_image: venue_config.nav_image,
venue_config_nav_image_height: venue_config.nav_image_height,
venue_config_nav_image_width: venue_config.nav_image_width,
start: start,
weekday: weekday,
};
let eventInfo: I.EventInfo = { ...eventObj, ...eventExtend };
return eventInfo;
}