TimeTrex/interface/html5/dist/common-RequestViewCommonController.bundle.js

1 line
160 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["common-RequestViewCommonController"],{2343:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"RequestViewCommonController\": () => (/* binding */ RequestViewCommonController)\n/* harmony export */ });\n/* harmony import */ var _global_Global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9490);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\nclass RequestViewCommonController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tauthorization_history: null,\n\t\t\tselected_absence_policy_record: null,\n\t\t\tenable_edit_view_ui: false\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tsetGridCellBackGround() {\n\t\t//Error: Unable to get property 'getGridParam' of undefined or null reference\n\t\tif ( !this.grid ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar data = this.grid.getGridParam( 'data' );\n\t\t//Error: TypeError: data is undefined in /interface/html5/framework/jquery.min.js?v=7.4.6-20141027-074127 line 2 > eval line 70\n\t\tif ( !data ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar len = data.length;\n\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\tvar item = data[i];\n\n\t\t\tif ( item.status_id == 30 ) {\n\t\t\t\t$( 'tr#' + item.id ).addClass( 'bolder-request' );\n\t\t\t}\n\t\t}\n\t}\n\n\tonCancelClick( force, cancel_all, callback ) {\n\t\tTTPromise.add( 'base', 'onCancelClick' );\n\t\tvar $this = this;\n\n\t\t//#2571 - Unable to get property 'id' of undefined or null reference\n\t\tif ( this.current_edit_record && this.current_edit_record.id ) {\n\t\t\tvar $record_id = this.current_edit_record.id;\n\t\t}\n\n\t\tLocalCacheData.current_doing_context_action = 'cancel';\n\t\tif ( this.is_changed && !force ) {\n\t\t\tTAlertManager.showConfirmAlert( _global_Global__WEBPACK_IMPORTED_MODULE_0__/* .Global.modify_alert_message */ .x.modify_alert_message, null, function( flag ) {\n\n\t\t\t\tif ( flag === true ) {\n\t\t\t\t\tdoNext();\n\t\t\t\t}\n\n\t\t\t} );\n\t\t} else {\n\t\t\tdoNext();\n\t\t}\n\n\t\tfunction doNext() {\n\t\t\tif ( !$this.edit_view && $this.parent_view_controller && $this.sub_view_mode ) {\n\t\t\t\t$this.parent_view_controller.is_changed = false;\n\t\t\t\t$this.parent_view_controller.buildContextMenu( true );\n\t\t\t\t$this.parent_view_controller.onCancelClick();\n\n\t\t\t} else {\n\t\t\t\tif ( $this.is_edit && $record_id ) {\n\t\t\t\t\tContextMenuManager.unmountContextMenu( $this.determineContextMenuMountAttributes().id );\n\t\t\t\t\t$this.setCurrentEditViewState( 'view' );\n\t\t\t\t\t$this.onViewClick( $record_id, true );\n\t\t\t\t\t$this.setEditMenu();\n\t\t\t\t} else {\n\t\t\t\t\t$this.removeEditView();\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tif ( callback ) {\n\t\t\t\tcallback();\n\t\t\t}\n\n\t\t\t$this.search( false ); //Refresh the grid, as we don't do that during authorize/decline clicks anymore.\n\n\t\t\t_global_Global__WEBPACK_IMPORTED_MODULE_0__/* .Global.setUIInitComplete */ .x.setUIInitComplete();\n\t\t\tProgressBar.closeOverlay();\n\n\t\t\tTTPromise.resolve( 'base', 'onCancelClick' );\n\n\t\t}\n\n\t}\n\n\toverlappingShiftUIValidate() {\n\t\t//Same permissions as APISchedule->getOverlappingShifts()\n\t\tif ( !PermissionManager.validate( 'schedule', 'enabled' )\n\t\t\t|| !( PermissionManager.validate( 'schedule', 'view' ) || PermissionManager.validate( 'schedule', 'view_own' ) || PermissionManager.validate( 'schedule', 'view_child' ) ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tonCloseIconClick() {\n\t\tthis.onCancelClick();\n\t}\n\n\tbuildDataForAPI( data ) {\n\t\tif ( this.viewId == 'RequestAuthorization' && ( !data.request_schedule_id || data.request_schedule_id <= 0 ) ) {\n\t\t\treturn data;\n\t\t}\n\n\t\tvar user_id = LocalCacheData.loginUser.id;\n\t\tif ( _global_Global__WEBPACK_IMPORTED_MODULE_0__/* .Global.isSet */ .x.isSet( this.current_edit