var Unibase; (function (Unibase) { let Platform; (function (Platform) { let Membership; (function (Membership) { let Components; (function (Components) { class PopupDetails extends Platform.Core.BaseComponent { init(containerid) { let instance = this; instance.load(null, containerid, null); } loadPopupDetails(containerid) { let instance = this; let invisible = "d-none"; if (Unibase.Themes.Compact.Components.Index.Instance().isIframeObj.isDetailsPage) { invisible = ''; } let html = ``; $('#' + containerid).html(html); $("#activity_comment_btn").click(function () { $(".comments_section").removeClass("d-none"); }); } loadDetailsIfrme() { let instance = this; } loadDetailsForPopup(Pk_Value, installedappid, message, formid, appconfigid) { let instance = this; if (message != null) { $(".popupDetailsModal").find(".responseMessage").html(message); } if ((formid != null || formid != undefined) && (appconfigid != null || appconfigid != undefined)) { let onclickbtn = `Unibase.Platform.Helpers.NavigationHelper.Instance().loadForm(` + formid + `, 0, ` + appconfigid + `, 0, null)`; $("#popupdetails_btn_CreateTask").attr("onclick", onclickbtn); } var fromDate = ""; var toDate = ""; var cf_fromDate = Unibase.Platform.Helpers.NavigationHelper.commonFilter_FromDate; var cf_toDate = Unibase.Platform.Helpers.NavigationHelper.commonFilter_ToDate; if (cf_fromDate != null && cf_toDate != null) { fromDate = cf_fromDate.toString(); toDate = cf_toDate.toString(); } var expObj = { InstalledAppId: installedappid, RecordId: Pk_Value, FromDate: fromDate, ToDate: toDate }; instance.fileCacheHelper.loadJsFile("platform/widgets/managers/widgetmanager.js", function () { Unibase.Platform.Widgets.Managers.WidgetManager.Instance().getDefaultWidget(expObj).then(function (response) { let data1 = response.result.Data; let template = response.result.TemplateText; let model = JSON.parse(data1); let containerId = Unibase.Platform.Helpers.NavigationHelper.Instance().getLastContainerId(); let formData = response.result.AppConfigurations.filter(function (o) { return o.SettingUrlType == 1; })[0]; let editformbtn = `Unibase.Platform.Helpers.NavigationHelper.Instance().loadForm(` + formData.FormId + `, ` + model[0].pk_id + `, ` + formData.AppConfigurationId + `, 0, null)`; $('#' + containerId).find(".popup-Edit-Form").attr("onclick", editformbtn); $('#' + containerId).on('click', function () { window.parent.postMessage('Edit-Form', '*'); }); let html = '', stagehtml = ''; for (var i = 0; i < response.result.Stages.length; i++) { let data = response.result.Stages[i]; if (data.IsDefault) { stagehtml += ``; } if (Unibase.Platform.Membership.Infos.Identity.getCurrentUser().isAdmin) { html += `${data.StageName}`; } else { if (data.ChangeAll && data.StageRoles == null) { html += `${data.StageName}`; } if (data.StageRoles != null && data.StageRoles.length != 0) { for (var j = 0; j < data.StageRoles.length; j++) { if (data.ChangeAll && (!data.StageRoles[j].ExcludeChangeRole)) { html += `${data.StageName}`; } } } if (data.ChangeAll == false && data.StageRoles != null && data.StageRoles.length > 0) { html += `${data.StageName}`; } } } $('#' + containerId).find('.div_details_stages').html(`${stagehtml}`); let inptParamter = JSON.parse(response.result.Data)[0]; Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters = []; for (const property in inptParamter) { Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.push({ Key: "hf_" + installedappid + "_" + property.toLowerCase(), Value: inptParamter[property], DataType: typeof (inptParamter[property]) }); } Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.push({ Key: "hf_" + installedappid + "_" + "recordid", Value: Pk_Value.toString(), DataType: typeof (Pk_Value) }); instance.fileCacheHelper.loadJsFile("platform/core/helpers/token/tokenhelper.js", function () { let htmlcontent = Unibase.Core.Helpers.TokenHelper.Instance().replace(template, model[0]); $('#' + containerId).find(".popupdetails_app_defaultwidget").html(htmlcontent); $('#' + containerId).find(".popupdetails_app_defaultwidget .biz-detail-avatar").remove(); if ($('#' + containerId).find(".popupdetails_app_defaultwidget .biz-header-sub-text").hasClass("d-flex")) { $('#' + containerId).find(".popupdetails_app_defaultwidget .biz-header-sub-text").addClass("flex-column").removeClass("flex-row flex-wrap"); $('#' + containerId).find(".popupdetails_app_defaultwidget .biz-header-sub-text .fa-rupee").addClass("font-10"); } $('#' + containerId).find(".popupdetails_app_defaultwidget .app_defaultwidget").find(".ml-2").removeClass("ml-2"); $('#' + containerId).find(".popupdetails_app_defaultwidget .app_defaultwidget").find(".d-none.d-sm-block").removeClass("d-none d-sm-block"); }); var obj = Unibase.Themes.Compact.Components.Details.Instance(); if (response.status != Unibase.Data.Status.Error) { if (response.result != null) { var data = response.result.Data; var templatetext = response.result.TemplateText; var stages = response.result.Stages; var installedappinfo = response.result.InstalledApp; var statusinfo = response.result.Status; var permission = response.result.EditScreenPermission; if (data != null && data != "") { if (templatetext != null) { var icon = ''; if (response.result.AppConfigurations.length > 0) { var confightml = ""; $('#popupDetailsModal').find('.div_detailconfigurations_headerbtns').html(''); var appconfigurations = response.result.AppConfigurations; for (var i = 0; i < appconfigurations.length; i++) { if (appconfigurations[i].AppConfigType == Unibase.Platform.Apps.Enums.AppConfigeType.DetailSetting) { instance.settingsURL = appconfigurations[i].SettingUrl; instance.functionURL = appconfigurations[i].JsFunction; confightml = ""; var onclickurl = ""; var settingname = appconfigurations[i].SettingName; var description = appconfigurations[i].Description; var sname = settingname.replace(/ /g, ''); if (description != null && description != "" && description != undefined) { description = appconfigurations[i].Description; } else { description = appconfigurations[i].SettingName; } icon = appconfigurations[i].Icon; if (appconfigurations[i].SettingUrlType == Unibase.Platform.Apps.Enums.SettingUrlType.Form && appconfigurations[i].AppConfigType == Unibase.Platform.Apps.Enums.AppConfigeType.DetailSetting) { onclickurl = "onclick='Unibase.Platform.Helpers.NavigationHelper.Instance().loadDetailSettingForm(" + appconfigurations[i].FormId + ", " + obj._recordId + ", " + appconfigurations[i].AppConfigurationId + ")'"; } if (appconfigurations[i].SettingUrlType == Unibase.Platform.Apps.Enums.SettingUrlType.JsFunction) { onclickurl = ""; } if (appconfigurations[i].Icon != null && appconfigurations[i].Icon != "null" && appconfigurations[i].Icon != "") { confightml += '
  • ' + ' ' + settingname + '
  • '; } else { confightml += '
  • ' + settingname + '
  • '; } $('#popupDetailsModal').find('.div_detailconfigurations_headerbtns').append(confightml); } } instance.fileCacheHelper.loadJsFile(instance.settingsURL, function () { }); } } } } } }); }); let detailpage = `Unibase.Platform.Helpers.NavigationHelper.Instance().loadDetail(` + Pk_Value + `, ` + installedappid + `, null, null)`; $(".popup-Details-Page").attr("onclick", detailpage); $(".popup-Edit-Form, .popup-Details-Page").click(function () { instance.navigationHelper.closePopUp(); }); debugger; instance.fileCacheHelper.loadJsFile("platform/widgets/managers/widgetmanager.js", function () { }); } LoadApprovals(id, InstalledAppId) { var VersionGuid = ""; for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) { if (obj.Key === "hf_" + InstalledAppId + "_versionguid") { VersionGuid = obj.Value.toString(); } } Unibase.Platform.Communications.Managers.TaskManager.Instance().getTasksByRefId(VersionGuid).then(function (response) { var data = response.result; if (data != null && data.length != 0) { $('#div_App_DefaultWidgetSettings').parent().addClass('bg-white'); var html = ''; var confirmtext = ""; var rejecttext = ""; var rejectonclick = ""; for (var i = 0; i < data.length; i++) { var j = i + 1; confirmtext = "Confirm"; rejecttext = "Reject"; rejectonclick = 'Unibase.Themes.Compact.Components.Details.Instance().SaveTaskReason(' + data[i].TaskId + ',\'Reject\')'; if (data[i].ConfirmKeyText != null && data[i].ConfirmKeyText != undefined && data[i].ConfirmKeyText != "") { confirmtext = data[i].ConfirmKeyText; } if (data[i].RejectKeyText != null && data[i].RejectKeyText != undefined && data[i].RejectKeyText != "") { rejecttext = data[i].RejectKeyText; } if (Number(data[i].RejectFormId) != 0) { rejectonclick = 'Unibase.Themes.Compact.Components.Details.Instance().ChangeApprovalStatus(' + data[i].TaskId + ', \'Reject\',' + data[i].RejectFormId + ',' + data[i].RejectFormPkId + ')'; } html += '
  • ' + '
    ' + data[i].Subject + '' + '

    ' + data[i].Body + '

    ' + confirmtext + '' + '' + rejecttext + 'Close' + '
    ' + '
  • '; } $(".popupdetails-task").html(html); $(".span_notification_count").text(data.length); } }); } load(id, containerid, callback) { var instance = this; instance.loadPopupDetails(containerid); $(`#newAccountFormCloseBtn, .close-btn`).click(function () { instance.navigationHelper.closePopUp(); window.parent.postMessage('clickToBack', '*'); }); } jsFiles() { return ['tenants/themes/compact/components/popupdetails/popupdetails.js', 'tenants/themes/compact/components/details/details.js', 'platform/timeline/components/timeline.js']; } cssFiles() { return []; } html(id, containerid) { var instance = this; let html = ``; return html; } static Instance() { if (this.instance === undefined) this.instance = new PopupDetails(); return this.instance; } } Components.PopupDetails = PopupDetails; })(Components = Membership.Components || (Membership.Components = {})); })(Membership = Platform.Membership || (Platform.Membership = {})); })(Platform = Unibase.Platform || (Unibase.Platform = {})); })(Unibase || (Unibase = {}));