TimeTrex/interface/html5/dist/wizard-share_report-ShareReportWizardController.bundle.js

1 line
12 KiB
JavaScript
Raw Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["wizard-share_report-ShareReportWizardController"],{3238:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ShareReportWizardController\": () => (/* binding */ ShareReportWizardController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass ShareReportWizardController extends BaseWizardController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '.wizard-bg'\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\t//this._super('initialize', options );\n\n\t\tthis.title = $.i18n._( 'Share Report Wizard' );\n\t\tthis.steps = 2;\n\t\tthis.current_step = 1;\n\n\t\tthis.render();\n\t}\n\n\trender() {\n\t\tsuper.render();\n\n\t\tthis.initCurrentStep();\n\t}\n\n\t//Create each page UI\n\tbuildCurrentStepUI() {\n\t\tvar $this = this;\n\t\tthis.content_div.empty();\n\n\t\tthis.stepsWidgetDic[this.current_step] = {};\n\t\tswitch ( this.current_step ) {\n\t\t\tcase 1:\n\t\t\t\tvar label = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Select one or more saved report you wish to share' ) );\n\n\t\t\t\tvar a_combobox = this.getAComboBox( TTAPI.APIUserReportData, true, 'global_job', 'user_report_data_ids', false );\n\t\t\t\tvar div = $( '<div class=\\'wizard-acombobox-div\\'></div>' );\n\t\t\t\tdiv.append( a_combobox );\n\n\t\t\t\tthis.content_div.append( label );\n\t\t\t\tthis.content_div.append( div );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step][a_combobox.getField()] = a_combobox;\n\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tlabel = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Select one or more employees to share report with' ) );\n\n\t\t\t\ta_combobox = this.getAComboBox( TTAPI.APIUser, true, 'global_user', 'destination_user_ids', false );\n\t\t\t\tdiv = $( '<div class=\\'wizard-acombobox-div\\'></div>' );\n\t\t\t\tdiv.append( a_combobox );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step] = {};\n\t\t\t\tthis.stepsWidgetDic[this.current_step][a_combobox.getField()] = a_combobox;\n\n\t\t\t\tthis.content_div.append( label );\n\t\t\t\tthis.content_div.append( div );\n\t\t\t\tbreak;\n\n\t\t}\n\t}\n\n\tbuildCurrentStepData() {\n\t\tvar $this = this;\n\t\tvar current_step_data = this.stepsDataDic[this.current_step];\n\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\n\t\tswitch ( this.current_step ) {\n\t\t\tcase 1:\n\t\t\t\tif ( !current_step_data ) {\n\t\t\t\t\tfor ( var key in current_step_ui ) {\n\n\t\t\t\t\t\tif ( !current_step_ui.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( this.default_data ) {\n\t\t\t\t\t\t\tcurrent_step_ui[key].setValue( this.default_data );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfor ( var key in current_step_data ) {\n\t\t\t\t\t\tif ( !current_step_data.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurrent_step_ui[key].setValue( current_step_data[key] );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tfor ( var key in current_step_data ) {\n\t\t\t\t\tif ( !current_step_data.hasOwnProperty( key ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrent_step_ui[key].setValue( current_step_data[key] );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tonDoneClick() {\n\t\tvar $this = this;\n\t\tsuper.onDoneClick();\n\t\tthis.saveCurrentStep();\n\n\t\tvar report_ids = this.stepsDataDic[1].user_report_data_ids;\n\t\tvar user_ids = this.stepsDataDic[2].destination_user_ids;\n\n\t\tvar api = TTAPI.APIUserReportData;\n\n\t\tapi.shareUserReportData( report_ids, user_ids, {\n\t\t\tonResult: function( result ) {\n\n\t\t\t\tif ( result.isValid() ) {\n\t\t\t\t\tTAlertManager.showAlert( $.i18n._( 'Report shared successfully' ) );\n\t\t\t\t\t$( $this.el ).remove();\n\t\t\t\t} else {\n\t\t\t\t\tTAlertManager.showEr