diff --git a/client/src/modules/events.ts b/client/src/modules/events.ts index e15f761..73022e0 100644 --- a/client/src/modules/events.ts +++ b/client/src/modules/events.ts @@ -6,25 +6,27 @@ import * as I from "../types/types"; import * as JSC from "./jsc"; import * as Cart from "./cart"; -export function addCloseModal() { +export function addCloseModal(): void { const btnCloseModal: HTMLElement | undefined = jQuery("#btnCloseModal").get(0); if (btnCloseModal) 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"); + if (dropdownSeatmap) { dropdownSeatmap.addEventListener("change", function (this: HTMLSelectElement) { - UI.controlLoftloader("show"); + UI.controlLoftloader("show"); // todo: rewrite? UI.destroyCurrentSeatmap("#containerSeatmapInner", inPanzoom); Communication.needSeatmapXML(this.value); }); } } -export function addModalCart() { +export function addModalCart(): void { const btnCart: HTMLElement | undefined = jQuery("#modalCart .uabb-button").get(0); + if (btnCart) { btnCart.addEventListener("click", () => { 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) return; const btnCheckout = jQuery("#modalCart-overlay #checkout .fl-button").get(0); if (btnCheckout) { - btnCheckout.addEventListener("click", function () { + btnCheckout.addEventListener("click", () => { const message: I.Message = { message: { url: inUrl, @@ -59,27 +61,22 @@ export function addRedirectCheckout(inUrl: string | undefined) { } } -export function addCartClose() { - const btnClose = jQuery("#modalCart-overlay .uabb-close-icon").get(0); - if (btnClose) { - btnClose.addEventListener("click", function () { - Communication.sendEventToParent("child_show_dialog_titlebar"); - }); - } +export function addCartClose(): void { + const btnClose: HTMLElement = jQuery("#modalCart-overlay .uabb-close-icon").get(0); + if (btnClose) + btnClose.addEventListener("click", () => Communication.sendEventToParent("child_show_dialog_titlebar")); } -export function addCartBack() { - const btnBack = jQuery("#modalCart-overlay #goBack .fl-button").get(0); - if (btnBack) { - btnBack.addEventListener("click", function () { - jQuery("#modalCart-overlay .uabb-close-icon").trigger("click"); - }); - } +export function addCartBack(): void { + const btnBack: HTMLElement = jQuery("#modalCart-overlay #goBack .fl-button").get(0); + if (btnBack) + btnBack.addEventListener("click", () => jQuery("#modalCart-overlay .uabb-close-icon").trigger("click")); } -export function dropdownLegendOnChange(inSelector: string) { - const seatmap = config.state.seatmap; - const dropdownLegend = jQuery(inSelector).get(0); +export function dropdownLegendOnChange(inSelector: string): void { + const seatmap: any = config.state.seatmap; + const dropdownLegend: HTMLElement = jQuery(inSelector).get(0); + dropdownLegend.addEventListener("change", function (this: HTMLSelectElement) { const value: string = this.value; const className: string = `._${value}`; @@ -95,11 +92,11 @@ export function dropdownLegendOnChange(inSelector: string) { JSC.activateSeatsBySectionID(value); 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) { Cart.changedDropdownBuyerType(this, inSeatObj); });