var __awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},Unibase;(function(n){let t;(function(t){let i;(function(i){let r;(function(r){class u extends t.Core.BaseComponent{constructor(){super();this.subReportId=0;this.isDetail=!1;this.linkreport_aliasname="";this.inline=!0;this.appName="";this.childReportName="";this.filters=[];this.filterIndex=0;this.subReportsExists=!1;this.childReportId=0;this.parentReportId=0;this.isReportDuplicate=!1;this._reportManager=i.Managers.ReportManager.Instance();this._reportBuilder=r.ReportBuilder.Instance();this._reportBuilderTemplate=r.ReportBuilder_Template.Instance()}cssFiles(){return[]}jsFiles(){return["platform/analytics/managers/reportmanager.js","platform/analytics/enums/subreporttype.js"]}html(){return this._reportBuilderTemplate.loadLinkToOtherReportForm()}load(n,t){var i=this;i.filters=[];i.filterIndex=0;i.isDetail=!1;i.inline=!0;i.subReportEdit();$("#btnConfigAddFilter").click(function(n){i.filterIndex++;let o=$(n.target).closest(".form-row").find("[id^=isvalue_radio]"),t=o.prop("checked"),r=$("#cmbmainrptCols option:selected").text().trim(),u=$("#cmbsbrptCols option:selected").text().trim(),f=$("#slctdoperater option:selected").text().trim(),e=$("#cmbmainrptCols_textbox").val();if(t||r.toLowerCase()!="main report columns"){if(t&&!e)return MessageHelper.Instance().showError("Please enter text in main report value column","sub_report_error_message")}else return MessageHelper.Instance().showError("Please select main report column","sub_report_error_message");if(f.toLowerCase()=="-select-")return MessageHelper.Instance().showError("Please select operator type","sub_report_error_message");if(t&&e==u.toLowerCase())return MessageHelper.Instance().showError("Main report column name and value column and is value text cannot be same","sub_report_error_message");if(u.toLowerCase()=="sub report column")return MessageHelper.Instance().showError("Please select sub report column","sub_report_error_message");t&&(r=e);i.filters.push({ParameterName:r,ParameterValue:u,Operator:f,Isvalue:t});i.addSubReportFilter(r,u,f,t);t&&($("#cmbmainrptCols_textbox").val(""),o.trigger("click"));$("#cmbmainrptCols").val(0).trigger("change");$("#cmbsbrptCols").val(0).trigger("change");$("#slctdoperater").val(0).trigger("change")});$("#btnLinkReportSave").click(()=>{var n,r,u;let f=i.getSubReportContainerArray();if(i.isDetail)i.saveSubReport_DetailFields();else if(i.saveSubReport_Report(f))return;i.linkreport_aliasname==undefined&&(n=i._reportBuilder.table,r=function(n){var t=n.getRow(),i=t.getPosition(!1);return i+1},n.element&&n.element.children[1]&&n.element.children[1].lastChild&&n.element.children[1].lastChild.firstChild&&n.element.children[1].lastChild.firstChild.firstElementChild&&n.element.children[1].lastChild.firstChild.firstElementChild.firstChild&&n.element.children[1].lastChild.firstChild.firstElementChild.firstChild.className!="fa fa-eye"&&(u=function(){return"<\/i>"},n.addColumn({formatter:r,title:"",headerSort:!1,minWidth:20},!0),n.addColumn({formatter:u,title:"",headerSort:!1},!0)));$("#"+t).modal("hide");$("#"+t).remove()});$("#btnLinkReportClose").click(function(){$("#"+t).modal("hide");$("#"+t).remove()});$("#subrpt_clear").click(function(){if(i._reportBuilder.subreportdata.length!=0){var n=i._reportBuilder.subreportdata.findIndex(n=>n.AliasName==i.linkreport_aliasname);n>-1&&i._reportBuilder.subreportdata.splice(n,1)}});$(".select_reports").change(function(){let n=Number($(".select_reports").val());i.subReportColumns(n)});$(".subreport-radio-btn").change(function(){$(this).val()=="report"?($("#linkreport_modal,#detailScreenBody").toggleClass("d-none"),$(".opentype-radio-btn:checked").val()=="inline"&&$("#subrpt_plus").removeClass("d-none")):($("#linkreport_modal,#detailScreenBody").toggleClass("d-none"),$("#subrpt_plus").addClass("d-none"))});$(".opentype-radio-btn").change(function(){if($(this).val()=="inline"?(i.inline=!0,$("#subrpt_plus").removeClass("d-none")):(i.inline=!1,$("#subrpt_plus").addClass("d-none")),i._reportBuilder.subreportdata.length!=0){let n;n=i.linkreport_aliasname?i._reportBuilder.subreportdata.findIndex(n=>n.AliasName==i.linkreport_aliasname):i._reportBuilder.subreportdata.findIndex(n=>n.RowClick==!0);n>-1&&(i._reportBuilder.subreportdata[n].Inline=i.inline)}});$("#isvalue_radio_0").unbind().click(n=>{let t=$(n.target).prop("checked");$(n.target).closest(".form-row").find("#div_mainreportColumn_textbox").parent().toggleClass("hidden");$(n.target).closest(".form-row").find("#div_mainreportColumn").parent().toggleClass("hidden")})}loadForm(){return[]}linkreport(n){var i=this;i.linkreport_aliasname=n;i.navigationHelper.popup(0,"",this,null,t.Helpers.Size.Medium)}loadReports(){var n=this,t;n.childReportName="";t=_appsettings.server_url()+"/apis/v4/unibase/platform/analytics/reports";AutoCompleteHelper.getHelper().Create(".select_reports","hfReportAutoComplete",t,function(t){n.childReportName=t.text.trim()})}mainReportColumns(){var n=this,t=[];if(n._reportBuilder.selectedColumns.length!=0){t.push({id:0,text:"Main Report Columns"});for(let i=0;i
`;$(".ul2list_0").append(u);$(".ul2list_0").children().length==1&&$(".ul2list_0").children().first().find(".filter-remove-btn").addClass("disabled")}subReportEdit(){return __awaiter(this,void 0,void 0,function*(){var t=this,u,i,e,f,o;yield t.loadReports();t.mainReportColumns();t.primaryColumns();yield t.loadInstalledApps();t.subReportsExists=!1;let r=t.getSubReportContainerArray();if(r!=undefined&&(r.length&&(t.subReportsExists=!0),t.linkreport_aliasname?u=r.findIndex(n=>n.AliasName==t.linkreport_aliasname):(u=r.findIndex(n=>n.RowClick==!0),u==-1&&(u=r.findIndex(t=>t.AliasName||t.SubReportTypeId==n.Platform.Analytics.Reports.Enums.SubReportType.Detail))),u>-1))if(i=r[u],i.SubReportTypeId==n.Platform.Analytics.Reports.Enums.SubReportType.Report){for($("#reportRadioBtn").prop("checked",!0),$(".select_reports").empty().append('