';
return html;
}
init(containerid) {
var html = "";
var instance = this;
instance.fileCacheHelper.loadJsFiles(["platform/appstore/components/appstore.js", "platform/integrations/components/createprovider.js"], function () {
instance.navigationHelper.loadSection(0, containerid, Unibase.Platform.AppStore.Components.AppStore.Instance(), null, null);
instance.InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
$(".div_details_stages").addClass("hidden");
instance.ProviderType = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_providertype").Value;
var appId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_appid").Value);
var reportUniqueId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_reportuniqueid").Value;
var widgetUniqueId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_widgetuniqueid").Value;
var appUniqueId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_uniqueid").Value;
instance.WidgetuniqueId = widgetUniqueId;
instance.uniqueId = appUniqueId;
instance.ReportuniqueId = reportUniqueId;
Unibase.Platform.Apps.Managers.AppManager.Instance().getInstallApp(appId).then(function (response) {
if (instance.ProviderType == "app") {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').hide();
Unibase.Platform.Apps.Managers.AppManager.Instance().appUniqueId(instance.uniqueId).then(function (latestRes) {
if (latestRes.result.IsUpgrade == false) {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').show();
$("#div_updateVersions").removeClass("hidden");
$("#span_updateversionno").text(latestRes.result.VersionNo);
$("#hf_updateversionno").val(latestRes.result.VersionNo);
$("#div_descriptioncard").removeClass("hidden");
$("#div_description").text(latestRes.result.Description);
}
else {
Unibase.Platform.Membership.Managers.AccountManager.Instance().parentanonymouslogin().then((userResponse) => {
Unibase.Platform.Membership.Infos.Identity.setCurrentUser(userResponse.result);
Unibase.Platform.Apps.Managers.AppManager.Instance().getUniqueId(instance.uniqueId).then(function (C02response) {
let postData = {
VersionFilePath: C02response.result.VersionFilePath,
IsUpgrade: C02response.result.IsUpgrade,
AppUniqueId: C02response.result.AppUniqueId,
VersionNo: C02response.result.VersionNo,
Description: C02response.result.Description,
QueryString: C02response.result.QueryString,
ProviderType: C02response.result.ProviderType,
};
var curversion = response.result.AppVersion;
var lastestVersion = C02response.result.VersionNo;
if (curversion != lastestVersion && postData.IsUpgrade == false) {
Unibase.Platform.Apps.Managers.AppManager.Instance().saveLatestVersionFromC02(postData).then(function (response) {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').show();
$("#div_updateVersions").removeClass("hidden");
$("#span_updateversionno").text(C02response.result.VersionNo);
$("#hf_updateversionno").val(C02response.result.VersionNo);
$("#div_descriptioncard").removeClass("hidden");
$("#div_description").text(C02response.result.Description);
});
}
else {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').hide();
}
});
});
}
});
}
else if (instance.ProviderType == "widget") {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').hide();
var widgetId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_widgetid").Value);
Unibase.Platform.Apps.Managers.AppManager.Instance().getWidgetVersion(widgetId).then(function (latestRes) {
if (latestRes.result != null && latestRes.result.IsUpgrade == false) {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').show();
$("#div_updateVersions").removeClass("hidden");
$("#span_updateversionno").text(latestRes.result.VersionNo);
$("#hf_updateversionno").val(latestRes.result.VersionNo);
$("#div_descriptioncard").removeClass("hidden");
$("#div_description").text(latestRes.result.Description);
}
else {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').hide();
Unibase.Platform.Apps.Managers.AppManager.Instance().getUniqueId(instance.WidgetuniqueId).then(function (C02response) {
let postData = {
VersionFilePath: C02response.result.VersionFilePath,
IsUpgrade: C02response.result.IsUpgrade,
AppUniqueId: C02response.result.AppUniqueId,
VersionNo: C02response.result.VersionNo,
Description: C02response.result.Description,
QueryString: C02response.result.QueryString,
ProviderType: C02response.result.ProviderType,
};
var curversion = response.result.AppVersion;
var lastestVersion = C02response.result.VersionNo;
if (curversion != lastestVersion && postData.IsUpgrade == false) {
Unibase.Platform.Apps.Managers.AppManager.Instance().saveLatestVersionFromC02(postData).then(function (response) {
if (response.message != null) {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').show();
$("#div_updateVersions").removeClass("hidden");
$("#span_updateversionno").text(C02response.result.VersionNo);
$("#hf_updateversionno").val(C02response.result.VersionNo);
$("#div_descriptioncard").removeClass("hidden");
$("#div_description").text(C02response.result.Description);
}
});
}
else {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').hide();
}
});
}
});
}
else if (instance.ProviderType == 'report') {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').hide();
var reportId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_reportid").Value);
Unibase.Platform.Apps.Managers.AppManager.Instance().getReportVersion(reportId).then(function (latestRes) {
if (latestRes.result != null && latestRes.result.IsUpgrade == false) {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').show();
$("#div_updateVersions").removeClass("hidden");
$("#span_updateversionno").text(latestRes.result.VersionNo);
$("#hf_updateversionno").val(latestRes.result.VersionNo);
$("#div_descriptioncard").removeClass("hidden");
$("#div_description").text(latestRes.result.Description);
}
else {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').hide();
Unibase.Platform.Apps.Managers.AppManager.Instance().getUniqueId(AppStore.instance.ReportuniqueId).then(function (C02response) {
let postData = {
VersionFilePath: C02response.result.VersionFilePath,
IsUpgrade: C02response.result.IsUpgrade,
AppUniqueId: C02response.result.AppUniqueId,
VersionNo: C02response.result.VersionNo,
Description: C02response.result.Description,
QueryString: C02response.result.QueryString,
ProviderType: C02response.result.ProviderType,
};
var curversion = response.result.AppVersion;
var lastestVersion = C02response.result.VersionNo;
if (curversion != lastestVersion && postData.IsUpgrade == false) {
Unibase.Platform.Apps.Managers.AppManager.Instance().saveLatestVersionFromC02(postData).then(function (response) {
if (response.message != null) {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').show();
$("#div_updateVersions").removeClass("hidden");
$("#span_updateversionno").text(C02response.result.VersionNo);
$("#hf_updateversionno").val(C02response.result.VersionNo);
$("#div_descriptioncard").removeClass("hidden");
$("#div_description").text(C02response.result.Description);
}
else {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').hide();
}
});
}
else {
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Update').hide();
}
});
}
});
}
$("#span_curversionno").text(response.result.AppVersion);
$("#hf_Currentversionno").val(response.result.AppVersion);
$("#div_currentVersion").removeClass("hidden");
$("#div_descriptioncard").removeClass("hidden");
$("#div_description").text(response.result.Description);
});
var statusId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_statusid").Value);
if (statusId == 1) {
$(".setting_status").text("UnInstall");
}
else {
$(".setting_status").text("Install");
}
});
}
updateactionBtn() {
var instance = this;
instance.InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + instance.InstalledAppId + '_Update').on('click', function () {
bootbox.dialog({
title: "App Updates",
message: `
- ${"Latest Vesion Update"}
`,
backdrop: true,
closeButton: false,
buttons: {
confirm: {
label: "Update",
className: "btn btn-success",
callback: function () {
instance.InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
var appId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_appid").Value);
var update = Unibase.Platform.AppStore.Components.AppStore.Instance().upgradeAvailableApp();
}
},
cancel: {
label: "Cancel",
className: "btn btn-default pull-right"
}
}
});
});
}
downloadFile() {
var instance = this;
instance.InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
var documentId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_documentid").Value);
if (documentId != 0) {
Unibase.Platform.Apps.Managers.AppManager.Instance().getDocumentFileId(documentId).then(function (docResponse) {
var documentFileId = docResponse.result.DocumentFileId;
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/controls/filedragndrop/w_documentfiles.js', function () {
Unibase.Platform.Forms.Components.DocumentFiles.Instance().downloadDocument(documentFileId);
});
});
}
else {
bootbox.alert("File Doesnot Exits");
}
}
previewFile() {
var instance = this;
instance.InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
var documentId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_documentid").Value);
if (documentId != 0) {
Unibase.Platform.Apps.Managers.AppManager.Instance().getDocumentFileId(documentId).then(function (docResponse) {
Unibase.Platform.Apps.Managers.AppManager.Instance().getDocumentFileId(documentId).then(function (docResponse) {
var documentFileId = docResponse.result.DocumentFileId;
Unibase.Platform.Apps.Managers.AppManager.Instance().previewDocument(documentFileId);
});
});
}
}
upgradeApp_popoup(id, providertype) {
var instance = this;
if (providertype == 'app') {
instance.navigationHelper.showLoading();
Unibase.Platform.Apps.Managers.AppManager.Instance().upgradeAvailableApp(id).then(function (response) {
if (response.status == Unibase.Data.Status.Success) {
instance.navigationHelper.hideLoading();
MessageHelper.Instance().showSuccess(response.message, "");
instance.InstalledAppId = Unibase.Platform.Helpers.NavigationHelper.installedAppId;
Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(instance.InstalledAppId, null);
}
else {
instance.navigationHelper.hideLoading();
bootbox.alert(response.message);
}
});
}
else if (providertype == 'widget') {
instance.navigationHelper.showLoading();
Unibase.Platform.Apps.Managers.AppManager.Instance().upgradeWidgetVersionAvailable(id).then(function (response) {
if (response.status == Unibase.Data.Status.Success) {
instance.navigationHelper.hideLoading();
MessageHelper.Instance().showSuccess(response.message, "div_message");
instance.InstalledAppId = Unibase.Platform.Helpers.NavigationHelper.installedAppId;
Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(instance.InstalledAppId, null);
}
else {
instance.navigationHelper.hideLoading();
bootbox.alert(response.message);
}
});
}
else if (providertype == 'report') {
instance.navigationHelper.showLoading();
Unibase.Platform.Apps.Managers.AppManager.Instance().upgradeReportVersionAvailable(id).then(function (response) {
if (response.status == Unibase.Data.Status.Success) {
instance.navigationHelper.hideLoading();
MessageHelper.Instance().showSuccess(response.message, "");
instance.InstalledAppId = Unibase.Platform.Helpers.NavigationHelper.installedAppId;
Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(instance.InstalledAppId, null);
}
else {
instance.navigationHelper.hideLoading();
bootbox.alert(response.message);
}
});
}
}
upgradeAvailableApp() {
var instance = this;
instance.InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
instance.ProviderType = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_providertype").Value;
var appId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_appid").Value);
if (instance.ProviderType == "app") {
instance.navigationHelper.showLoading();
Unibase.Platform.Apps.Managers.AppManager.Instance().upgradeAvailableApp(appId).then(function (response) {
if (response.status == Unibase.Data.Status.Success) {
instance.navigationHelper.hideLoading();
MessageHelper.Instance().showSuccess(response.message, "div_message");
instance.InstalledAppId = Unibase.Platform.Helpers.NavigationHelper.installedAppId;
Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(instance.InstalledAppId, null);
}
else {
instance.navigationHelper.hideLoading();
MessageHelper.Instance().showError(response.message, "div_importmessage");
bootbox.alert(response.message);
}
});
}
else if (instance.ProviderType == "widget") {
var widgetId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_widgetid").Value);
instance.navigationHelper.showLoading();
Unibase.Platform.Apps.Managers.AppManager.Instance().upgradeWidgetVersionAvailable(widgetId).then(function (response) {
if (response.status == Unibase.Data.Status.Success) {
instance.navigationHelper.hideLoading();
MessageHelper.Instance().showSuccess(response.message, "div_message");
instance.InstalledAppId = Unibase.Platform.Helpers.NavigationHelper.installedAppId;
Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(instance.InstalledAppId, null);
}
else {
instance.navigationHelper.hideLoading();
bootbox.alert(response.message);
}
});
}
else if (instance.ProviderType == "report") {
instance.navigationHelper.showLoading();
var reportId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_reportid").Value);
Unibase.Platform.Apps.Managers.AppManager.Instance().upgradeReportVersionAvailable(reportId).then(function (response) {
if (response.status == Unibase.Data.Status.Success) {
instance.navigationHelper.hideLoading();
MessageHelper.Instance().showSuccess(response.message, "");
instance.InstalledAppId = Unibase.Platform.Helpers.NavigationHelper.installedAppId;
Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(instance.InstalledAppId, null);
}
else {
instance.navigationHelper.hideLoading();
bootbox.alert(response.message);
}
});
}
}
upgradeApp() {
var instance = this;
instance.InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
var appId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_appid").Value);
var versionno = $("#hf_versionno").val();
Unibase.Platform.Apps.Managers.AppManager.Instance().upgradeApp(appId, versionno).then(function (response) {
if (response.status == Unibase.Data.Status.Success)
MessageHelper.Instance().showSuccess(response.message, "");
else
alert(response.message);
});
}
appStatus() {
var instance = this;
instance.InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
var instance = this;
var statusId;
instance.fileCacheHelper.loadJsFile('platform/analytics/components/menuuserdesign/userdesignmenu.js', function () {
Unibase.Platform.Analytics.Components.UserDesignMenu.Instance().IsAppRefresh = true;
});
if ($(".setting_status").text() == "Install") {
statusId = 1;
}
else {
statusId = 2;
}
var appId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + instance.InstalledAppId + "_appid").Value);
Unibase.Platform.Apps.Managers.AppManager.Instance().updateAppStatus(appId, statusId).then(function (statusresponse) {
return __awaiter(this, void 0, void 0, function* () {
Unibase.Platform.Apps.Managers.AppManager.Instance().getdependentApps(appId).then(function (dependentAppsResponse) {
return __awaiter(this, void 0, void 0, function* () {
var message = "";
if (dependentAppsResponse.result.length > 0) {
if (confirm("This app contain " + dependentAppsResponse.result.length + " dependent apps. Are you sure you want to continue")) {
getStatus();
}
}
else {
getStatus();
}
function getStatus() {
var succesMessage = "";
if (statusresponse.result.StatusId == 1) {
succesMessage = "App Installed Succesfully";
}
else {
succesMessage = "App Uninstalled Succesfully";
}
var detailobj = Unibase.Themes.Compact.Components.Details.Instance();
detailobj._recordId = appId;
detailobj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
detailobj._containerId = $("._bizgaze_detail_container:visible").attr("id");
var idetailObj = detailobj;
detailobj.loadAppConfigurations(idetailObj, detailobj._containerId);
MessageHelper.Instance().showSuccess(succesMessage, "");
}
});
});
});
});
}
addToWishListBtn() {
var wishlist;
wishlist = false;
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Addtowhishlist').on('click', function () {
Unibase.Platform.AppStore.Components.AppStore.Instance().changeWhishList(wishlist);
$('#DetailSetting_' + installedappid + '_Addtowhishlist').show();
$('#DetailSetting_' + installedappid + '_Removefromwhishlist').hide();
});
}
removeFromWishListBtn() {
var wishlist;
wishlist = true;
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
$('#DetailSetting_' + installedappid + '_Removefromwhishlist').on('click', function () {
Unibase.Platform.AppStore.Components.AppStore.Instance().changeWhishList(wishlist);
$('#DetailSetting_' + installedappid + '_Addtowhishlist').hide();
$('#DetailSetting_' + installedappid + '_Removefromwhishlist').show();
});
}
changeWhishList(wishlist) {
if (status) {
$("#btn_WishlistTrue").parent().removeClass("hidden");
$("#btn_WishlistFalse").parent().addClass("hidden");
}
else {
$("#btn_WishlistTrue").parent().addClass("hidden");
$("#btn_WishlistFalse").parent().removeClass("hidden");
}
var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
var installedAppId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + installedappid + "_appid").Value);
Unibase.Platform.Apps.Managers.AppManager.Instance().updateWishList(installedAppId, wishlist).then(function (response) {
if (response.status == Unibase.Data.Status.Success)
MessageHelper.Instance().showSuccess(response.message, "");
else
alert(response.message);
});
}
static Instance() {
if (this.instance === undefined) {
this.instance = new AppStore();
}
return this.instance;
}
}
Components.AppStore = AppStore;
})(Components = AppStore_1.Components || (AppStore_1.Components = {}));
})(AppStore = Platform.AppStore || (Platform.AppStore = {}));
})(Platform = Unibase.Platform || (Unibase.Platform = {}));
})(Unibase || (Unibase = {}));