SaveReportPopup = function( options ) { let instance = this; options = options ? options : {}; instance.savedReportId = options.savedReportId ? parseInt( options.savedReportId ) : 0; instance.frm_reportCenter = options.frm_reportCenter; instance.reportCode = options.reportCode; } SaveReportPopup.prototype.constructor = SaveReportPopup; SaveReportPopup.prototype.show = function() { let instance = this; let cancelButton = null; let saveAsNewButton = null; let saveAndReplaceButton = null; let form = null; let popup = null; let savePromise = $.Deferred(); let saveReport = function( saveAsNew ) { let saveReportURL = Fse.Util.updateURL( $("link#PortalDocRootURL").attr( "href" ) + "/apps//RPT/index.cfm", { do : "saveReport", saveType : 2, mode : "direct" }); let saveData = form.option( "formData" ); if( saveAsNew && saveData.savedReportId ) { saveData.savedReportId = 0; saveData.saveAs = true; } else { saveData.saveAs = false; } $.ajax( { method : "POST", url : saveReportURL, data : saveData }).done( function( saveResult ) { popup.hide(); savePromise.resolve( saveResult ); }) } popup = $("
").text( "Enter a name by which you can refer to this saved report." )) // .append( $("
").text( "If you use a name that you have already used you will overwrite the existing saved report definition with this one." )) // .append( $("
").text( "Change the name of the report to \"Save As\" a copy." )) // } // }, { dataField : "userReportName", label : { text : "Report Name" }, editorType : "dxTextBox", isRequired : true, editorOptions : { maxLength : 200 } } // , // { // template : function() { // return $("
").text( "You can group your saved reports by entering a name or phrase below." ) ) // } // } , { dataField : "userReportGroup", editorType : "dxDropDownBox", label : { text : "Group Name" }, editorOptions : { valueExpr : "userReportGroup", displayExpr : "userReportGroup", showClearButton : true, onValueChanged : function ( e ) { e.component.close(); }, fieldTemplate: function (value, fieldElement) { let field = $("
").text( "By Sharing this report it will be available for other users to run as it is saved. Only users that can already run this report will be able to run the saved copy. They will not be able to alter the saved report or schedule delivery of it." )); // } // } // , // { // dataField : "setReportDefaults", // label : { text : "Set Report Defaults" }, // editorType : "dxRadioGroup", // editorOptions : { // layout : "horizontal", // items : [ // { text : "Yes", value : "Y" }, // { text : "No", value : "N" } // ], // valueExpr : "value" // } // } // , // { // template : function() { // return $("
").text( "Select \"Yes\" to use the settings from this report to set the default settings of this report for all users. Selecting \"Yes\" does not affect any user's previously saved definitions of this report." )); // } // } ] }).dxForm( "instance") ; if( instance.savedReportId ) { Fse.Data.newDataSource( { object : "RPT.savedReports", key : "savedReportId" } ).store().byKey( instance.savedReportId ).done( function( savedReport ) { form.updateData( { "shareThisReport" : savedReport.shared == "Y" ? "Y" : "N", "userReportName" : savedReport.userReportName, "userReportGroup" : savedReport.userReportGroup }) }) } return form.element(); }, toolbarItems : [ { toolbar : "top", location : "after", widget : "dxButton", options : { icon : "help", stylingMode : "text", onClick : function( e ) { Fse.Portal.showQuickHelp( "ReportCenterSaveReport" ); } } }, { toolbar : "bottom", location : "after", template : function() { cancelButton = $( '