81 lines
2.4 KiB
TypeScript

import { Global } from "../../Core/Globals"
import { EventManager } from "../../Core/Events"
import { Ui } from "../../Core/Ui"
import * as Events from "../../Core/EventDefinitions"
import { LocalizationManager } from "../../Core/Localization"
import * as Utility from "../../Core/Utility";
import { FormValidation } from "../../Core/Forms"
import * as Models from "../../Common/Models";
class AppUserReportShowDogOwnerProfileModule {
private _moduleName = "appUserReportShowDogOwnerProfileContainer";
private _component = "#appUserReportShowDogProfileContainer";
private _global: Global;
private _eventManager: EventManager;
private _uiManager: Ui;
private _localizationMananger: LocalizationManager;
constructor() {
this._global = Global.getInstance();
this._eventManager = EventManager.getInstance();
this._uiManager = Ui.getInstance();
this._localizationMananger = LocalizationManager.getInstance();
}
/**
* Stellt einen Prefix vor einen Selektor
* @param selector
*/
private prefix(selector: string): string {
const self = this;
if ($(`${self._component} ${selector}`).length > 0)
return `${self._component} ${selector}`;
return `html ${selector}`;
}
/**
* Bindungen erstellen
*/
private setupBindings(): void {
var self = this;
$(self.prefix("#btnClose")).off("click").on("click", function () {
self._uiManager.pageTitleClear(self._component);
self._eventManager.unSubscribeAll(self._moduleName);
self._eventManager.publish(Events.AppUserReport.showCancel);
});
//#region Events
//#endregion
$('[data-toggle="tooltip"]').tooltip();
}
/**
* Aktivieren des Moduls
*/
public activate(): void {
var self = this;
$.setupValidator();
$.reinitializeValidator();
this.setupBindings();
self._uiManager.pageTitleAdd(self._component, self.prefix("#pageTitleAdd"));
$.randomAutocompleteValue();
}
/**
* Initialisieren des Moduls
*/
public init(): void {
if (this._global.appInitialized) {
appUserReportShowDogOwnerProfileModule.activate();
} else {
setTimeout(() => { this.init() }, 10);
}
}
}
let appUserReportShowDogOwnerProfileModule = new AppUserReportShowDogOwnerProfileModule();
appUserReportShowDogOwnerProfileModule.init();