var Unibase; (function (Unibase) { let Platform; (function (Platform) { let Tenants; (function (Tenants) { let SecondarySwitch; (function (SecondarySwitch) { class TenantPopup extends Platform.Core.BaseComponent { constructor() { super(); } jsFiles() { return ["platform/membership/requests/registeruser.js", "platform/membership/managers/accountmanager.js"]; } cssFiles() { return []; } html(id, containerid) { var html = ``; return html; } load(id, containerid, callback) { this._accountManager = Unibase.Platform.Membership.Managers.AccountManager.Instance(); var instance = this; $("#cmbBizgaze_Tenants").change(function () { bootbox.confirm("Do you want to change the tenant you want to login to?", function (result) { if (result) { var PresentTenantID = $("#hfBizgaze_TenantId").val(); var NewTenantID = $("#cmbBizgaze_Tenants").val(); } }); }); $('input[type=radio][name=radio_PrimaryData]').change(function () { instance.switchSecData(0); }); $('input[type=radio][name=radio_SecondaryData]').change(function () { instance.switchSecData(1); }); if ($('#hfBizgaze_SecDataEnabled').val() == "1") { $("#btnSecondaryData").addClass('active'); } else { $("#btnPrimaryData").addClass('active'); } } Disable() { this._accountManager = Unibase.Platform.Membership.Managers.AccountManager.Instance(); var instance = this; instance._accountManager.getconnectedtenant(1, 1).then(function (response) { let data; data = response; if (data.result.parentTenantId != data.result.childTenantId) { $("#btnPrimaryData").hide(); $("#btnSecondaryData").hide(); } else { if ($('#hfBizgaze_IsEmployee').val() == "1") { $("#btnPrimaryData").show(); $("#btnSecondaryData").show(); } } }); } switchSecData(id) { this._accountManager = Unibase.Platform.Membership.Managers.AccountManager.Instance(); var instance = this; var message = "Primary"; if (id == 1) { message = "Secondary"; } bootbox.confirm("You are about to change to " + message + " data.Are you sure?", function (result) { if (result) { instance._accountManager.switchtosecondary(id).then(function (response) { instance.navigationHelper.hideLoading(); window.location.reload(); }, function (response) { instance.navigationHelper.hideLoading(); MessageHelper.Instance().showError(response.errors[0], "got error while switching."); }); } }); } static Instance() { if (this._instance === undefined) this._instance = new TenantPopup(); return this._instance; } } SecondarySwitch.TenantPopup = TenantPopup; })(SecondarySwitch = Tenants.SecondarySwitch || (Tenants.SecondarySwitch = {})); })(Tenants = Platform.Tenants || (Platform.Tenants = {})); })(Platform = Unibase.Platform || (Unibase.Platform = {})); })(Unibase || (Unibase = {}));