fixed legend filtering option and adjusted saalplanbuchung button styles

This commit is contained in:
zino
2021-05-27 15:50:47 +02:00
parent 2518d80631
commit 6097da1f1d
9 changed files with 237 additions and 151 deletions

View File

@@ -2,6 +2,7 @@ import { config } from "./config";
import * as I from "../types/types";
import Utils from "./utils";
import * as Cart from "./cart";
import * as JSC from "./jsc";
export function convertLegendToDropdown(inID: string): void {
jQuery('ul.seatCharts-legendList').each(function () {
@@ -12,24 +13,10 @@ export function convertLegendToDropdown(inID: string): void {
select.attr({ id: inID });
appendFirstLegendOption(select);
appendLegendOptions(this, select);
appendLegendOptions(this, select);
});
}
export function changeDropdownLegendBGColor(inSelector: string, inValue: string, inClassName: string): void {
let bgColor: string = "#fafafa";
let color: string = "#5c5c5c";
if (inValue !== "all") {
color = "white";
bgColor = jQuery(inClassName).css("background-color");
}
jQuery(inSelector).css("color", color);
jQuery(inSelector).css("background-color", bgColor);
jQuery(`${inSelector} option[value="all"]`).css("color", color);
}
export function generateLegend(inNode: string): I.JSCLegend {
const seatmapXML: any = config.state.seatmapXML;
const venueXML: I.VenueXML = config.state.inVenueXML!;
@@ -42,6 +29,42 @@ export function generateLegend(inNode: string): I.JSCLegend {
}
}
export function dropdownLegendOnChange(inHTMLSelectElement: HTMLSelectElement, inSelector: string) {
const seatmap: any = config.state.seatmap;
const sectionID: string = inHTMLSelectElement.value;
const className: string = `._${sectionID}`;
changeDropdownLegendBGColor(inSelector, sectionID, className);
console.log(sectionID);
if (sectionID === "all") {
seatmap.find('unavailable').status('available');
}
else {
seatmap.find('available').status('unavailable');
JSC.activateSeatsBySectionID(sectionID);
}
JSC.setBookedSeatsUnavailable();
JSC.selectSeatsInCart();
}
function changeDropdownLegendBGColor(inSelector: string, inValue: string, inClassName: string): void {
return;
let bgColor: string = "#fafafa";
let color: string = "#5c5c5c";
if (inValue !== "all") {
color = "white";
bgColor = jQuery(inClassName).css("background-color");
}
jQuery(inSelector).css("color", color);
jQuery(inSelector).css("background-color", bgColor);
jQuery(`${inSelector} option[value="all"]`).css("color", color);
}
function appendLegendOptions(inElement: HTMLElement, inSelect: JQuery<HTMLSelectElement>): void {
jQuery('>li', inElement).each(function () {
const className: string = jQuery(this)[0].children[0].classList[3];
@@ -69,7 +92,7 @@ function createLegendItems(pricescaleArr: I.SeatmapPricescale[], venuePricescale
return pricescaleArr.map((arr, index: number) => {
const id: string = arr.id[0];
const seatsKey: string = String.fromCharCode(97 + index).toLocaleUpperCase();
const desc: string | undefined = Utils.encodeCP850DecodeUTF8( venuePricescaleArr.find(obj => obj.id[0] === id)?.desc[0]! );
const desc: string | undefined = Utils.encodeCP850DecodeUTF8(venuePricescaleArr.find(obj => obj.id[0] === id)?.desc[0]!);
const price: string = Cart.getPriceInEur(pricescaleArr[index].ref_price[0]);
const description: string = `${desc} ${price}`;
return [seatsKey, "available", description];