revised events

This commit is contained in:
zino
2021-05-16 01:29:57 +02:00
parent 0472564034
commit 1968fa0f74

View File

@@ -6,25 +6,27 @@ import * as I from "../types/types";
import * as JSC from "./jsc"; import * as JSC from "./jsc";
import * as Cart from "./cart"; import * as Cart from "./cart";
export function addCloseModal() { export function addCloseModal(): void {
const btnCloseModal: HTMLElement | undefined = jQuery("#btnCloseModal").get(0); const btnCloseModal: HTMLElement | undefined = jQuery("#btnCloseModal").get(0);
if (btnCloseModal) if (btnCloseModal)
btnCloseModal.addEventListener("click", () => Communication.sendEventToParent("child_closeDialog")); btnCloseModal.addEventListener("click", () => Communication.sendEventToParent("child_closeDialog"));
} }
export function addDropdownSeatmap(inPanzoom: any) { export function addDropdownSeatmap(inPanzoom: any): void {
const dropdownSeatmap: HTMLElement | null = document.getElementById("dropdownSeatmap"); const dropdownSeatmap: HTMLElement | null = document.getElementById("dropdownSeatmap");
if (dropdownSeatmap) { if (dropdownSeatmap) {
dropdownSeatmap.addEventListener("change", function (this: HTMLSelectElement) { dropdownSeatmap.addEventListener("change", function (this: HTMLSelectElement) {
UI.controlLoftloader("show"); UI.controlLoftloader("show"); // todo: rewrite?
UI.destroyCurrentSeatmap("#containerSeatmapInner", inPanzoom); UI.destroyCurrentSeatmap("#containerSeatmapInner", inPanzoom);
Communication.needSeatmapXML(this.value); Communication.needSeatmapXML(this.value);
}); });
} }
} }
export function addModalCart() { export function addModalCart(): void {
const btnCart: HTMLElement | undefined = jQuery("#modalCart .uabb-button").get(0); const btnCart: HTMLElement | undefined = jQuery("#modalCart .uabb-button").get(0);
if (btnCart) { if (btnCart) {
btnCart.addEventListener("click", () => { btnCart.addEventListener("click", () => {
if (!config.state.selectedSeatsArr.length) if (!config.state.selectedSeatsArr.length)
@@ -39,13 +41,13 @@ export function addModalCart() {
} }
} }
export function addRedirectCheckout(inUrl: string | undefined) { export function addRedirectCheckout(inUrl: string | undefined): void {
if (!inUrl) if (!inUrl)
return; return;
const btnCheckout = jQuery("#modalCart-overlay #checkout .fl-button").get(0); const btnCheckout = jQuery("#modalCart-overlay #checkout .fl-button").get(0);
if (btnCheckout) { if (btnCheckout) {
btnCheckout.addEventListener("click", function () { btnCheckout.addEventListener("click", () => {
const message: I.Message = { const message: I.Message = {
message: { message: {
url: inUrl, url: inUrl,
@@ -59,27 +61,22 @@ export function addRedirectCheckout(inUrl: string | undefined) {
} }
} }
export function addCartClose() { export function addCartClose(): void {
const btnClose = jQuery("#modalCart-overlay .uabb-close-icon").get(0); const btnClose: HTMLElement = jQuery("#modalCart-overlay .uabb-close-icon").get(0);
if (btnClose) { if (btnClose)
btnClose.addEventListener("click", function () { btnClose.addEventListener("click", () => Communication.sendEventToParent("child_show_dialog_titlebar"));
Communication.sendEventToParent("child_show_dialog_titlebar");
});
}
} }
export function addCartBack() { export function addCartBack(): void {
const btnBack = jQuery("#modalCart-overlay #goBack .fl-button").get(0); const btnBack: HTMLElement = jQuery("#modalCart-overlay #goBack .fl-button").get(0);
if (btnBack) { if (btnBack)
btnBack.addEventListener("click", function () { btnBack.addEventListener("click", () => jQuery("#modalCart-overlay .uabb-close-icon").trigger("click"));
jQuery("#modalCart-overlay .uabb-close-icon").trigger("click");
});
}
} }
export function dropdownLegendOnChange(inSelector: string) { export function dropdownLegendOnChange(inSelector: string): void {
const seatmap = config.state.seatmap; const seatmap: any = config.state.seatmap;
const dropdownLegend = jQuery(inSelector).get(0); const dropdownLegend: HTMLElement = jQuery(inSelector).get(0);
dropdownLegend.addEventListener("change", function (this: HTMLSelectElement) { dropdownLegend.addEventListener("change", function (this: HTMLSelectElement) {
const value: string = this.value; const value: string = this.value;
const className: string = `._${value}`; const className: string = `._${value}`;
@@ -95,11 +92,11 @@ export function dropdownLegendOnChange(inSelector: string) {
JSC.activateSeatsBySectionID(value); JSC.activateSeatsBySectionID(value);
JSC.setUnavailableSeats(); JSC.setUnavailableSeats();
} }
}); });
} }
export function addCartDropdownBuyerTypes(inSelector: string, inSeatObj: I.JSCSelectedSeat) { export function addCartDropdownBuyerTypes(inSelector: string, inSeatObj: I.JSCSelectedSeat): void {
// todo: which variant is not deprecated?
jQuery(inSelector).on('change', function (this: HTMLSelectElement) { jQuery(inSelector).on('change', function (this: HTMLSelectElement) {
Cart.changedDropdownBuyerType(this, inSeatObj); Cart.changedDropdownBuyerType(this, inSeatObj);
}); });