TimeTrex/interface/html5/dist/DocumentSubViewController.bundle.js

1 line
74 KiB
JavaScript
Raw Permalink Normal View History

2022-12-13 07:10:06 +01:00
"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["DocumentSubViewController","portal-hr-my_profile-JobApplicantSubBaseViewController","JobApplicantSubBaseViewController"],{9495:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"DocumentSubViewController\": () => (/* binding */ DocumentSubViewController)\n/* harmony export */ });\n/* harmony import */ var _views_portal_hr_my_profile_JobApplicantSubBaseViewController__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3757);\n/* harmony import */ var _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7526);\n/* harmony import */ var _global_TTUUID__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4936);\n/* harmony import */ var _services_ServiceCaller__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\n\n\n\nclass DocumentSubViewController extends _views_portal_hr_my_profile_JobApplicantSubBaseViewController__WEBPACK_IMPORTED_MODULE_0__.JobApplicantSubBaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\tthis.document_api = _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_1__/* .TTAPI.APIDocumentPortal */ .y.APIDocumentPortal;\n\t\tthis.attachment_data = null;\n\t}\n\n\trender() {\n\t\tvar $this = this;\n\t\tvar list_tpl = Global.loadWidget( 'views/portal/hr/my_profile/MyProfileSubView.html' );\n\t\tvar unique_id = this.sub_view_id + '-' + this.model.id;\n\t\tthis.unique_id = unique_id;\n\t\tthis.sub_view = _.template( list_tpl )( {} );\n\t\tif ( this.table_container.find( '.table-container' ).length == 0 ) {\n\t\t\tthis.table_container.html( '<div class=\"table-responsive\"><table class=\"table table-condensed table-bordered table-container\"><thead></thead><tbody></tbody></table></div>' );\n\t\t}\n\t\tif ( this.table_container.find( '#' + unique_id ).length === 0 ) {\n\t\t\tvar tbody = $( '<tr>' ).attr( 'id', unique_id );\n\t\t\t$( this.table_container.find( 'tbody' )[0] ).append( tbody );\n\t\t} else {\n\t\t\tthis.table_container.find( '#' + unique_id ).html( '' );\n\t\t}\n\t\tvar thead = $( '<tr>' );\n\t\tfor ( var column in this.display_columns ) {\n\t\t\tif ( !this.display_columns.hasOwnProperty( column ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar column_val;\n\t\t\tswitch ( column ) {\n\t\t\t\tdefault:\n\t\t\t\t\tif ( !this.model.get( column ) ) {\n\t\t\t\t\t\tcolumn_val = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcolumn_val = this.model.get( column );\n\t\t\t\t\t}\n\t\t\t\t\tif ( column === 'name' ) {\n\t\t\t\t\t\tthis.table_container.find( '#' + unique_id ).append( '<td><a class=\"download-attachment\" href=\"javascript:void(0);\">' + column_val + '</a></td>' );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.table_container.find( '#' + unique_id ).append( '<td>' + column_val + '</td>' );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthead.append( '<th>' + this.display_columns[column] + '</th>' );\n\t\t}\n\t\tthead.append( '<th>' + $.i18n._( 'Action' ) + '</th>' );\n\t\tif ( this.table_container.find( 'thead' ).html() === '' ) {\n\t\t\tthis.table_container.find( 'thead' ).html( thead );\n\t\t}\n\t\tthis.table_container.find( '#' + unique_id ).append( this.sub_view );\n\t\tthis.table_container.find( '#' + unique_id ).find( '.download-attachment' ).unbind( 'click' ).bind( 'click', function( e ) {\n\t\t\tvar filter = {};\n\t\t\tfilter.filter_data = {};\n\t\t\tfilter.filter_data.id = $this.model.id;\n\t\t\t$this.document_api['getAttachment']( filter, {\n\t\t\t\tonResult: function( result_data ) {\n\t\t\t\t\t$this.downloadFile( result_data );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t\tthis.table_container.find( '#' + unique_id ).find( '.edit-icon' ).unbind( 'click' ).bind( 'click', function( e ) {\n\t\t\t$this['get' + $this.sub_view_id]( functi