93 lines
2.3 KiB
TypeScript
93 lines
2.3 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"
|
|
|
|
|
|
class ShopSettingsModule {
|
|
private _moduleName = "ShopSettingsModule";
|
|
private _component = "#shopSettingsContainer";
|
|
private _global: Global;
|
|
private _eventManager: EventManager;
|
|
private _uiManager: Ui;
|
|
private _localizationMananger: LocalizationManager;
|
|
private _data: any;
|
|
|
|
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}`;
|
|
}
|
|
|
|
/**
|
|
* Bearbeiten
|
|
*/
|
|
private edit(): void {
|
|
var self = this;
|
|
self._uiManager.blockMainUi();
|
|
$.ajax({
|
|
url: <string>$(self.prefix("#jsEditUrl")).val(),
|
|
data: <any>{ },
|
|
dataType: "HTML",
|
|
type: "GET",
|
|
success(data) {
|
|
$(self.prefix("#detail")).html(data);
|
|
},
|
|
error() {
|
|
|
|
},
|
|
complete() {
|
|
self._uiManager.unblockMainUi();
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Bindungen erstellen
|
|
*/
|
|
private setupBindings(): void {
|
|
var self = this;
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
* Aktivieren des Moduls
|
|
*/
|
|
public activate(): void {
|
|
|
|
var self = this;
|
|
$.setupValidator();
|
|
$.reinitializeValidator();
|
|
this.setupBindings();
|
|
self.edit();
|
|
$.randomAutocompleteValue();
|
|
}
|
|
|
|
/**
|
|
* Initialisieren des Moduls
|
|
*/
|
|
public init(): void {
|
|
if (this._global.appInitialized) {
|
|
shopSettingsModule.activate();
|
|
} else {
|
|
setTimeout(() => { this.init(); }, 10);
|
|
}
|
|
}
|
|
}
|
|
|
|
let shopSettingsModule = new ShopSettingsModule();
|
|
shopSettingsModule.init(); |