1 line
19 KiB
JavaScript
1 line
19 KiB
JavaScript
|
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["common-AuthorizationHistoryCommon"],{5533:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AuthorizationHistory\": () => (/* binding */ AuthorizationHistory)\n/* harmony export */ });\n/* provided dependency */ var $ = __webpack_require__(9755);\nvar AuthorizationHistory = {\n\n\t/**\n\t * There's only 4 steps for ading auth history to a view file:\n\t * 1. Copy the authorization-grid-div from RequestEditView.html\n\t * 2. Paste that div into the editview html of the new view\n\t * 3. Add AuthorizationHistory.init(this) to setEditViewDataDone() or to the end of onViewClick() if you experience screen flashing with it in setEditViewDataDone()\n\t * 4a.If the view only has one hierarchytype id, add this.hierarchy_type_id = [**the correct id**]; to the init function of the view\n\t * 4b.Else, ensure that hierarch_type_id is set in the view's current_edit_record\n\t *\n\t */\n\n\tauthorization_api: null,\n\tauthorization_history_columns: [],\n\tauthorization_history_default_display_columns: [],\n\n\thost_view_controller: null,\n\n\t/**\n\t * call this to render the auth grid.\n\t * assumes this.edit_view exists.\n\t * @param $this\n\t * @returns {AuthorizationHistory}\n\t */\n\tinit: function( host ) {\n\t\t$( '.authorization-grid-div' ).hide();\n\t\tif ( host.is_add ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar separate_box = $( '.authorization-grid-div .grid-title' );\n\t\tseparate_box.html( '' );\n\n\t\tvar form_item_input = Global.loadWidgetByName( FormItemType.SEPARATED_BOX );\n\t\tform_item_input.SeparatedBox( { label: $.i18n._( 'Authorization History' ) } );\n\t\tform_item_input.attr( 'id', 'authorization_history' );\n\t\thost.addEditFieldToColumn( null, form_item_input, separate_box );\n\n\t\tthis.host_view_controller = host;\n\t\tthis.authorization_api = TTAPI.APIAuthorization;\n\n\t\tvar $this = this;\n\t\tthis.getAuthorizationHistoryColumns( function() {\n\t\t\t$this.initAuthorizationHistoryLayout( function() {\n\t\t\t\t$this.setAuthorizationGridSize();\n\t\t\t} );\n\t\t} );\n\n\t\treturn $this;\n\t},\n\n\tinitAuthorizationHistoryLayout: function( callback ) {\n\t\tvar $this = this;\n\t\tthis.getAuthorizationHistoryDefaultDisplayColumns( function() {\n\t\t\tif ( !$this.host_view_controller.edit_view ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$this.setAuthorizationHistorySelectLayout();\n\t\t\t$this.initAuthorizationHistoryData();\n\t\t\tif ( callback ) {\n\t\t\t\tcallback();\n\t\t\t}\n\t\t} );\n\t},\n\n\t/**\n\t * Gets data from the API and puts it into the authorization history grid.\n\t *\n\t * @param callback\n\t */\n\tinitAuthorizationHistoryData: function( callback ) {\n\t\tvar filter = {};\n\t\tfilter.filter_data = {};\n\n\t\tfilter.filter_columns = { 'created_by': true, 'created_date': true, 'authorized': true };\n\t\tfilter.filter_data.object_id = [this.host_view_controller.current_edit_record.id];\n\t\tfilter.filter_data.object_type_id = this.host_view_controller.hierarchy_type_id ? this.host_view_controller.hierarchy_type_id : this.host_view_controller.current_edit_record.hierarchy_type_id;\n\n\t\tvar $this = this;\n\t\tthis.authorization_api['get' + this.authorization_api.key_name]( filter, {\n\t\t\tonResult: function( result ) {\n\n\t\t\t\tif ( !$this.host_view_controller.edit_view ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar result_data = result.getResult();\n\t\t\t\tif ( result.isValid() && Global.isArray( result_data ) && result_data.length >= 1 ) {\n\t\t\t\t\tresult_data = Global.formatGridData( result_data, $this.authorization_api.key_name );\n\n\t\t\t\t\t$this.authorization_history_grid.setData( result_data );\n\n\t\t\t\t\t$( $this.host_view_controller.edit_view.find( '.authorization-grid-div' ) ).show();\n\t\t\t\t\t$this.showAuthorizationHistoryGridBorders();\n\t\t\t\t\t$this.setAuthorizationGridSize();\n\t\t\t\t} else {\n\t\t\t\t\t$( $this.host_view_controller.edit_vie
|