(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["my_account-expense-ExpenseAuthorizationViewController","filebrowser-TImageBrowser"],{8326:(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval("/* provided dependency */ var jQuery = __webpack_require__(9755);\n( function( $ ) {\n\n\t$.fn.TImageBrowser = function( options ) {\n\t\tGlobal.addCss( 'global/widgets/filebrowser/TImageBrowser.css' );\n\t\tvar opts = $.extend( {}, $.fn.TImageBrowser.defaults, options );\n\n\t\tvar $this = this;\n\t\tvar field;\n\t\tvar id = 'file_browser';\n\t\tvar name = 'filedata';\n\t\tvar browser;\n\n\t\tvar accept_filter = '';\n\n\t\tvar default_width = 177;\n\t\tvar default_height = 42;\n\t\tvar enabled = true;\n\n\t\tthis.setEnabled = function( val ) {\n\t\t\tenabled = val;\n\n\t\t\tvar btn = this.find( '.browser-form input' );\n\n\t\t\tif ( !val ) {\n\t\t\t\tbtn.attr( 'disabled', true );\n\t\t\t\tbtn.removeClass( 'disable-element' ).addClass( 'disable-element' );\n\t\t\t} else {\n\t\t\t\tbtn.removeAttr( 'disabled' );\n\t\t\t\tbtn.removeClass( 'disable-element' );\n\t\t\t}\n\n\t\t};\n\n\t\tthis.clearErrorStyle = function() {\n\n\t\t};\n\n\t\tthis.getFileName = function() {\n\n\t\t\treturn browser.val();\n\t\t};\n\n\t\tthis.getField = function() {\n\t\t\treturn field;\n\t\t};\n\n\t\tthis.setEnableDelete = function( val ) {\n\t\t\tvar image = $this.find( '.image' );\n\t\t\tif ( !val ) {\n\t\t\t\timage.removeAttr( 'enable-delete' );\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\timage.attr( 'enable-delete', 1 );\n\t\t\t}\n\t\t};\n\n\t\tthis.getValue = function() {\n\t\t\tvar form_data;\n\t\t\tif ( browser && browser.val() ) {\n\n\t\t\t\tif ( typeof FormData == 'undefined' ) {\n\t\t\t\t\tform_data = $this.find( '.browser-form' );\n\t\t\t\t} else {\n\t\t\t\t\tform_data = new FormData( $( $this.find( '.browser-form' ) )[0] );\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tform_data = null;\n\t\t\t}\n\n\t\t\treturn form_data;\n\t\t};\n\n\t\tthis.getImageSrc = function() {\n\t\t\tvar image = $this.find( '.image' );\n\t\t\treturn image.attr( 'src' );\n\t\t};\n\n\t\tthis.setImage = function( val ) {\n\t\t\tvar image = $this.find( '.image' );\n\n\t\t\tif ( !val ) {\n\t\t\t\timage.attr( 'src', '' );\n\t\t\t\timage.hide();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar d = new Date();\n\t\t\timage.hide();\n\t\t\timage.attr( 'src', val + '&t=' + d.getTime() );\n\t\t\timage.css( 'height', 'auto' );\n\t\t\timage.css( 'width', 'auto' );\n\n\t\t};\n\n\t\tvar onImageLoad = function( image ) {\n\n\t\t\tvar image_height = $( image ).height() > 0 ? $( image ).height() : image.naturalHeight;\n\t\t\tvar image_width = $( image ).width() > 0 ? $( image ).width() : image.naturalWidth;\n\n\t\t\tif ( image_height > default_height ) {\n\t\t\t\t$( image ).css( 'height', default_height );\n\n\t\t\t}\n\n\t\t\tif ( image_width > default_width ) {\n\t\t\t\t$( image ).css( 'width', default_width );\n\t\t\t\t$( image ).css( 'height', 'auto' );\n\t\t\t}\n\n\t\t\t$this.trigger( 'setSize' );\n\n\t\t\tif ( image_height < 5 ) {\n\t\t\t\t$( image ).hide();\n\t\t\t} else {\n\t\t\t\t$( image ).show();\n\t\t\t}\n\t\t};\n\n\t\tthis.setValue = function( val ) {\n\n\t\t\tif ( !val ) {\n\t\t\t\tval = '';\n\t\t\t}\n\n\t\t};\n\n\t\tthis.each( function() {\n\t\t\tvar o = $.meta ? $.extend( {}, opts, $( this ).data() ) : opts;\n\n\t\t\tfield = o.field;\n\n\t\t\t// var $this = this;\n\n\t\t\tif ( o.default_width > 0 ) {\n\t\t\t\tdefault_width = o.default_width;\n\t\t\t}\n\n\t\t\tif ( o.default_height > 0 ) {\n\t\t\t\tdefault_height = o.default_height;\n\t\t\t}\n\n\t\t\tif ( Global.isSet( o.name ) ) {\n\t\t\t\tname = o.name;\n\t\t\t}\n\n\t\t\tif ( Global.isSet( accept_filter ) ) {\n\t\t\t\taccept_filter = o.accept_filter;\n\t\t\t}\n\n\t\t\tbrowser = $( this ).find( '.browser' );\n\t\t\tvar image = $( this ).find( '.image' );\n\t\t\timage.hide();\n\t\t\timage.on( 'load', function() {\n\t\t\t\tonImageLoad( this );\n\n\t\t\t} );\n\n\t\t\tif ( accept_filter ) {\n\t\t\t\tbrowser.attr( 'accept', accept_filter );\n\t\t\t} else {\n\t\t\t\taccept_filter = 'image/*';\n\t\t\t\tbrowser.attr( 'accept', 'image/*' );\n\t\t\t}\n\n\t\t\tbrowser.attr( 'id', id );\n\t\t\tbrowser.attr( 'name', name );\n\n\t\t\tif ( Global.isSet( o.changeHandler ) ) {\n\n\t\t\t\t$this.bind( 'imageChange', o.changeHandler );\n\t\t\t}\n\t\t\tif ( Global.isSet( o.deleteImageHandler ) ) {\n\t\t\t\tthis.find( '.file-browser' ).on( 'deleteClick', function() {\n\t\t\t\t\to.deleteImageHandler();\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\tbrowser.bind( 'change', function() {\n\t\t\t\timage.hide();\n\n\t\t\t\tif ( typeof FileReader != 'undefined' ) {\n\n\t\t\t\t\tvar files = !!this.files ? this.files : [];\n\n\t\t\t\t\t// If no files were selected, or no FileReader support, return\n\t\t\t\t\tif ( !files.length || !window.FileReader ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( accept_filter === 'image/*' ) {\n\t\t\t\t\t\t// Create a new instance of the FileReader\n\t\t\t\t\t\tvar reader = new FileReader();\n\n\t\t\t\t\t\t// Read the local file as a DataURL\n\t\t\t\t\t\treader.readAsDataURL( files[0] );\n\n\t\t\t\t\t\t// When loaded, set image data as background of div\n\t\t\t\t\t\treader.onloadend = function() {\n\t\t\t\t\t\t\tvar url = this.result;\n\t\t\t\t\t\t\timage.attr( 'src', url );\n\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t$this.trigger( 'imageChange', [$this] );\n\n\t\t\t} );\n\n\t\t} );\n\n\t\treturn this;\n\n\t};\n\n\t$.fn.TImageBrowser.defaults = {};\n\t$.fn.TImageBrowser.html_template = `\n\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t
\n\t
\n\t`;\n\n} )( jQuery );//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODMyNi5qcyIsIm1hcHBpbmdzIjoiO0FBQUE7O0FBRUE7QUFDQTtBQUNBLHlCQUF5Qjs7QUFFekI7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBOztBQUVBOztBQUVBOztBQUVBOztBQUVBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsTUFBTTtBQUNOO0FBQ0E7O0FBRUEsS0FBSzs7QUFFTDtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7O0FBRUE7QUFDQTs7QUFFQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOztBQUVBO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBOztBQUV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RcdH1cblxuXHRcdFx0XHR9XG5cblx0XHRcdFx0JHRoaXMudHJpZ2dlciggJ2ltYWdlQ2hhbmdlJywgWyR0aGlzXSApO1xuXG5cdFx0XHR9ICk7XG5cblx0XHR9ICk7XG5cblx0XHRyZXR1cm4gdGhpcztcblxuXHR9O1xuXG5cdCQuZm4uVEltYWdlQnJvd3Nlci5kZWZhdWx0cyA9IHt9O1xuXHQkLmZuLlRJbWFnZUJyb3dzZXIuaHRtbF90ZW1wbGF0ZSA9IGBcblx0PGRpdiBjbGFzcz1cImZpbGUtYnJvd3NlclwiPlxuXHRcdDxpbWcgY2xhc3M9XCJpbWFnZVwiPlxuXHRcdDxmb3JtIGVuY3R5cGU9XCJtdWx0aXBhcnQvZm9ybS1kYXRhXCIgY2xhc3M9XCJicm93c2VyLWZvcm1cIj5cblx0XHRcdDxpbnB1dCBuYW1lPVwiZmlsZWRhdGFcIiBjbGFzcz1cImJyb3dzZXJcIiB0eXBlPVwiZmlsZVwiLz5cblx0XHQ8L2Zvcm0+XG5cdDwvZGl2PlxuXHRgO1xuXG59ICkoIGpRdWVyeSApOyJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///8326\n")},936:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ExpenseAuthorizationViewController\": () => (/* binding */ ExpenseAuthorizationViewController)\n/* harmony export */ });\n/* harmony import */ var _global_widgets_filebrowser_TImageBrowser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8326);\n/* harmony import */ var _global_widgets_filebrowser_TImageBrowser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_global_widgets_filebrowser_TImageBrowser__WEBPACK_IMPORTED_MODULE_0__);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\nclass ExpenseAuthorizationViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '#expense_authorization_view_container',\n\n\t\t\t// _required_files: ['TImageBrowser'],\n\n\t\t\thierarchy_level_array: null,\n\t\t\tstatus_array: null,\n\n\t\t\tpayment_method_array: null,\n\n\t\t\tsub_document_view_controller: null,\n\n\t\t\tdocument_object_type_id: null,\n\n\t\t\trelatedExpenseArray: null,\n\n\t\t\tpunch_tag_api: null,\n\t\t\tdefault_punch_tag: [],\n\t\t\tprevious_punch_tag_selection: [],\n\n\t\t\tdocument_api: null\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\t//this._super('initialize', options );\n\t\tthis.edit_view_tpl = 'ExpenseAuthorizationEditView.html';\n\t\tthis.permission_id = 'user_expense';\n\t\tthis.viewId = 'ExpenseAuthorization';\n\t\tthis.script_name = 'ExpenseAuthorizationView';\n\t\tthis.table_name_key = 'user_expense';\n\t\tthis.context_menu_name = $.i18n._( 'Expense (Authorizations)' );\n\t\tthis.navigation_label = $.i18n._( 'Expense' );\n\t\tthis.api = TTAPI.APIUserExpense;\n\t\tthis.message_control_api = TTAPI.APIMessageControl;\n\n\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\tthis.job_api = TTAPI.APIJob;\n\t\t\tthis.job_item_api = TTAPI.APIJobItem;\n\t\t\tthis.punch_tag_api = TTAPI.APIPunchTag;\n\t\t}\n\n\t\tthis.document_api = TTAPI.APIDocument;\n\t\tthis.authorization_api = TTAPI.APIAuthorization;\n\n\t\tthis.document_object_type_id = 400;\n\n\t\tthis.hierarchy_type_id = 200;\n\t\tthis.event_bus = new TTEventBus({ view_id: this.viewId });\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\n\t\tthis.initData();\n\t}\n\n\tinitOptions() {\n\t\tvar $this = this;\n\n\t\tvar args = {};\n\t\tvar filter_data = {};\n\t\tfilter_data.type_id = [10, 20, 30];\n\t\tfilter_data.user_id = [this.current_edit_record ? this.current_edit_record.user_id : LocalCacheData.getLoginUser().id];\n\n\t\tthis.initDropDownOption( 'status' );\n\t\tthis.initDropDownOption( 'payment_method' );\n\n\t\targs.filter_data = filter_data;\n\n\t\tif ( Global.isSet( $this.basic_search_field_ui_dic['expense_policy_id'] ) ) {\n\t\t\t$this.basic_search_field_ui_dic['expense_policy_id'].setDefaultArgs( args );\n\t\t}\n\n\t\tvar res = this.api.getHierarchyLevelOptions( [-1], { async: false } );\n\t\tvar data = res.getResult();\n\t\t$this['hierarchy_level_array'] = Global.buildRecordArray( data );\n\t\tif ( Global.isSet( $this.basic_search_field_ui_dic['hierarchy_level'] ) ) {\n\t\t\t$this.basic_search_field_ui_dic['hierarchy_level'].setSourceData( Global.buildRecordArray( data ) );\n\t\t}\n\t}\n\n\tgetSubViewFilter( filter ) {\n\n\t\tif ( filter.length === 0 ) {\n\t\t\tfilter = {};\n\t\t}\n\n\t\tfilter['parent_id'] = 0;\n\t\tif ( !Global.isSet( filter.hierarchy_level ) ) {\n\t\t\tfilter['hierarchy_level'] = 1;\n\t\t\tthis.filter_data['hierarchy_level'] = {\n\t\t\t\tfield: 'hierarchy_level',\n\t\t\t\tid: '',\n\t\t\t\tvalue: this.basic_search_field_ui_dic['hierarchy_level'].getValue( true )\n\t\t\t};\n\t\t}\n\n\t\treturn filter;\n\t}\n\n\tgetFilterColumnsFromDisplayColumns() {\n\t\tvar column_filter = {};\n\t\t//Issue #2897 - The column user_id is required for the navigation icons to function properly while not in edit view.\n\t\tcolumn_filter.user_id = true;\n\n\t\treturn this._getFilterColumnsFromDisplayColumns( column_filter, true );\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\tgroups: {\n\t\t\t\tauthorization: {\n\t\t\t\t\tlabel: $.i18n._( 'Authorization' ),\n\t\t\t\t\tid: this.script_name + 'Authorization'\n\t\t\t\t},\n\t\t\t\tobjects: {\n\t\t\t\t\tlabel: $.i18n._( 'Objects' ),\n\t\t\t\t\tid: this.script_name + 'objects'\n\t\t\t\t}\n\t\t\t},\n\t\t\texclude: ['default'],\n\t\t\tinclude: [\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'View' ),\n\t\t\t\t\tid: 'edit', // copy pasted this value, but 'edit' seems deliberate. clicking this icon opens edit view, not view. Double check before changing.\n\t\t\t\t\tgroup: 'editor',\n\t\t\t\t\tvue_icon: 'tticon tticon-visibility_black_24dp',\n\t\t\t\t\tshow_on_right_click: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Cancel' ),\n\t\t\t\t\tid: 'cancel',\n\t\t\t\t\tgroup: 'editor',\n\t\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Authorize' ),\n\t\t\t\t\tid: 'authorization',\n\t\t\t\t\tvue_icon: 'tticon tticon-thumb_up_black_24dp',\n\t\t\t\t\tmenu_align: 'center'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Pass' ),\n\t\t\t\t\tid: 'pass',\n\t\t\t\t\tvue_icon: 'tticon tticon-redo_black_24dp',\n\t\t\t\t\tmenu_align: 'center'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Decline' ),\n\t\t\t\t\tid: 'decline',\n\t\t\t\t\tvue_icon: 'tticon tticon-thumb_down_black_24dp',\n\t\t\t\t\tmenu_align: 'center'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Jump To' ),\n\t\t\t\t\tid: 'jump_to_header',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\taction_group_header: true,\n\t\t\t\t\tpermission_result: false // to hide it in legacy context menu and avoid errors in legacy parsers.\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'TimeSheet' ),\n\t\t\t\t\tid: 'timesheet',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Schedule' ),\n\t\t\t\t\tid: 'schedule',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Export' ),\n\t\t\t\t\tid: 'export_excel',\n\t\t\t\t\tgroup: 'other',\n\t\t\t\t\tvue_icon: 'tticon tticon-file_upload_black_24dp',\n\t\t\t\t\tmenu_align: 'right'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: $.i18n._( 'Edit Employee' ),\n\t\t\t\t\tid: 'edit_employee',\n\t\t\t\t\tmenu_align: 'right',\n\t\t\t\t\taction_group: 'jump_to',\n\t\t\t\t\tgroup: 'navigation',\n\t\t\t\t\t}\n\t\t\t]\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tsetCustomDefaultMenuIcon( id, context_btn, grid_selected_length ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'authorization':\n\t\t\t\tthis.setDefaultMenuAuthorizationIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'pass':\n\t\t\t\tthis.setDefaultMenuPassIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'decline':\n\t\t\t\tthis.setDefaultMenuDeclineIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_request':\n\t\t\t\tthis.setDefaultMenuAuthorizationRequestIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_timesheet':\n\t\t\t\tthis.setDefaultMenuAuthorizationTimesheetIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_expense':\n\t\t\t\tthis.setDefaultMenuAuthorizationExpenseIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t\tcase 'timesheet':\n\t\t\t\tthis.setDefaultMenuViewIcon( context_btn, grid_selected_length, 'punch' );\n\t\t\t\tbreak;\n\t\t\tcase 'schedule':\n\t\t\t\tthis.setDefaultMenuViewIcon( context_btn, grid_selected_length, 'schedule' );\n\t\t\t\tbreak;\n\t\t\tcase 'edit_employee':\n\t\t\t\tthis.setDefaultMenuEditIcon( context_btn, grid_selected_length );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetDefaultMenuEditIcon( context_btn, grid_selected_length ) {\n\n\t\tif ( grid_selected_length === 1 ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\t}\n\n\tsetDefaultMenuSaveIcon( context_btn, grid_selected_length ) {\n\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t}\n\n\tsetDefaultMenuAuthorizationIcon( context_btn, grid_selected_length ) {\n\t\tif ( !this.is_viewing ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t}\n\n\tsetDefaultMenuPassIcon( context_btn, grid_selected_length ) {\n\t\tif ( !this.is_viewing ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t}\n\n\tsetDefaultMenuDeclineIcon( context_btn, grid_selected_length ) {\n\t\tif ( !this.is_viewing ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t}\n\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t}\n\n\tsetCustomEditMenuIcon( id, context_btn ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'authorization':\n\t\t\t\tthis.setEditMenuAuthorizationIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'pass':\n\t\t\t\tthis.setEditMenuPassIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'decline':\n\t\t\t\tthis.setEditMenuDeclineIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_request':\n\t\t\t\tthis.setEditMenuAuthorizationRequestIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_timesheet':\n\t\t\t\tthis.setEditMenuAuthorizationTimesheetIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_expense':\n\t\t\t\tthis.setEditMenuAuthorizationExpenseIcon( context_btn );\n\t\t\t\tbreak;\n\t\t\tcase 'timesheet':\n\t\t\t\tthis.setEditMenuNavViewIcon( context_btn, 'punch' );\n\t\t\t\tbreak;\n\t\t\tcase 'schedule':\n\t\t\t\tthis.setEditMenuNavViewIcon( context_btn, 'schedule' );\n\t\t\t\tbreak;\n\t\t\tcase 'edit_employee':\n\t\t\t\tthis.setEditMenuNavEditIcon( context_btn, 'user' );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tsetDefaultMenuAuthorizationRequestIcon( context_btn, grid_selected_length ) {\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t}\n\n\tsetDefaultMenuAuthorizationTimesheetIcon( context_btn, grid_selected_length ) {\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t}\n\n\tsetDefaultMenuAuthorizationExpenseIcon( context_btn, grid_selected_length ) {\n\t\tif ( !( Global.getProductEdition() >= 25 ) ) {\n\t\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t\t}\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t}\n\n\tsetEditMenuAuthorizationRequestIcon( context_btn ) {\n\t\tif ( !this.current_edit_record || !this.current_edit_record.id ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tsetEditMenuAuthorizationTimesheetIcon( context_btn ) {\n\t\tif ( !this.current_edit_record || !this.current_edit_record.id ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tsetEditMenuAuthorizationExpenseIcon( context_btn ) {\n\t\tif ( !this.current_edit_record || !this.current_edit_record.id ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tsetEditMenuEditIcon( context_btn ) {\n\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t}\n\n\tsetEditMenuSaveIcon( context_btn ) {\n\t\tContextMenuManager.hideMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false )\n\t}\n\n\tsetEditMenuAuthorizationIcon( context_btn ) {\n\t\tif ( !this.current_edit_record || !this.current_edit_record.id ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tsetEditMenuPassIcon( context_btn ) {\n\t\tif ( !this.current_edit_record || !this.current_edit_record.id ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tsetEditMenuDeclineIcon( context_btn ) {\n\t\tif ( !this.current_edit_record || !this.current_edit_record.id ) {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, false );\n\t\t} else {\n\t\t\tContextMenuManager.disableMenuItem( this.determineContextMenuMountAttributes().id, context_btn.id, true );\n\t\t}\n\t}\n\n\tonCustomContextClick( id ) {\n\t\tswitch ( id ) {\n\t\t\tcase 'authorization':\n\t\t\t\tthis.onAuthorizationClick();\n\t\t\t\tbreak;\n\t\t\tcase 'pass':\n\t\t\t\tthis.onPassClick();\n\t\t\t\tbreak;\n\t\t\tcase 'decline':\n\t\t\t\tthis.onDeclineClick();\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_request':\n\t\t\t\tthis.onAuthorizationRequestClick();\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_timesheet':\n\t\t\t\tthis.onAuthorizationTimesheetClick();\n\t\t\t\tbreak;\n\t\t\tcase 'authorization_expense':\n\t\t\t\tthis.onAuthorizationExpenseClick();\n\t\t\t\tbreak;\n\t\t\tcase 'timesheet':\n\t\t\tcase 'schedule':\n\t\t\tcase 'edit_employee':\n\t\t\tcase 'export_excel':\n\t\t\t\tthis.onNavigationClick( id );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tonNavigationClick( iconName ) {\n\n\t\tvar $this = this;\n\n\t\tvar grid_selected_id_array;\n\n\t\tvar filter = {};\n\n\t\tvar ids = [];\n\n\t\tvar user_ids = [];\n\n\t\tvar base_date;\n\t\tif ( $this.edit_view && $this.current_edit_record.id ) {\n\t\t\tids.push( $this.current_edit_record.id );\n\t\t\tuser_ids.push( $this.current_edit_record.user_id );\n\t\t\tbase_date = $this.current_edit_record.incurred_date;\n\t\t} else {\n\t\t\tgrid_selected_id_array = this.getGridSelectIdArray();\n\t\t\t$.each( grid_selected_id_array, function( index, value ) {\n\t\t\t\tvar grid_selected_row = $this.getRecordFromGridById( value );\n\t\t\t\tids.push( grid_selected_row.id );\n\t\t\t\tuser_ids.push( grid_selected_row.user_id );\n\t\t\t\tbase_date = grid_selected_row.incurred_date;\n\t\t\t} );\n\t\t}\n\n\t\tswitch ( iconName ) {\n\t\t\tcase 'edit_employee':\n\t\t\t\tif ( user_ids.length > 0 ) {\n\t\t\t\t\tIndexViewController.openEditView( this, $.i18n._( 'Employee' ), user_ids[0] );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'timesheet':\n\t\t\t\tif ( user_ids.length > 0 ) {\n\t\t\t\t\tfilter.user_id = user_ids[0];\n\t\t\t\t\tfilter.base_date = base_date;\n\t\t\t\t\tGlobal.addViewTab( $this.viewId, $.i18n._( 'Authorization - Expense' ), window.location.href );\n\t\t\t\t\tIndexViewController.goToView( 'TimeSheet', filter );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'schedule':\n\t\t\t\tfilter.filter_data = {};\n\t\t\t\tvar include_users = { value: user_ids };\n\t\t\t\tfilter.filter_data.include_user_ids = include_users;\n\t\t\t\tfilter.select_date = base_date;\n\t\t\t\tGlobal.addViewTab( this.viewId, $.i18n._( 'Authorization - Expense' ), window.location.href );\n\t\t\t\tIndexViewController.goToView( 'Schedule', filter );\n\t\t\t\tbreak;\n\t\t\tcase 'export_excel':\n\t\t\t\tthis.onExportClick( 'export' + this.api.key_name );\n\t\t\t\tbreak;\n\n\t\t}\n\t}\n\n\tonAuthorizationExpenseClick() {\n\t\tIndexViewController.goToView( 'ExpenseAuthorization' );\n\t}\n\n\tonAuthorizationTimesheetClick() {\n\t\tIndexViewController.goToView( 'TimeSheetAuthorization' );\n\t}\n\n\tonAuthorizationRequestClick() {\n\t\tIndexViewController.goToView( 'RequestAuthorization' );\n\t}\n\n\tonAuthorizationClick() {\n\t\tvar $this = this;\n\t\tvar record = this.current_edit_record;\n\t\trecord = this.uniformVariable( record );\n\n\t\tthis.api['set' + this.api.key_name]( record, false, false, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tif ( result.isValid() ) { //Don't try to authorize the expense if validation fails, display the validation errors and stop.\n\t\t\t\t\t$this.is_changed = false;\n\t\t\t\t\t$this.onSaveResult( result );\n\n\t\t\t\t\t$this.setAuthorization( true );\n\t\t\t\t} else {\n\t\t\t\t\t$this.setErrorMenu();\n\t\t\t\t\t$this.setErrorTips( result, true );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\tonPassClick() {\n\t\tvar $this = this;\n\t\tthis.onRightArrowClick( function() {\n\t\t\t$this.search();\n\t\t\t$().TFeedback( {\n\t\t\t\tsource: 'Pass'\n\t\t\t} );\n\t\t} );\n\t}\n\n\tonDeclineClick() {\n\t\tthis.setAuthorization( false );\n\t}\n\n\tsetAuthorization( authorized ) {\n\t\tvar $this = this;\n\t\tvar filter = {};\n\n\t\tfilter.authorized = authorized ? authorized : false;\n\t\tfilter.object_id = $this.current_edit_record.id;\n\t\tfilter.object_type_id = 200;\n\n\t\t$this.authorization_api['setAuthorization']( [filter], {\n\t\t\tonResult: function( res ) {\n\t\t\t\t$this.updateBadgeCount();\n\t\t\t\t$this.onRightArrowClick( function() {\n\t\t\t\t\t$this.search( false );\n\t\t\t\t\tvar authorization_value = authorized ? 'Authorize' : 'Decline';\n\t\t\t\t\t$().TFeedback( {\n\t\t\t\t\t\tsource: authorization_value\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\tbuildEditViewUI() {\n\n\t\tsuper.buildEditViewUI();\n\n\t\tvar $this = this;\n\n\t\tvar tab_model = {\n\t\t\t'tab_expense': {\n\t\t\t\t'label': $.i18n._( 'Expense' ),\n\t\t\t\t'html_template': this.getExpenseAuthorizationTabHtml(),\n\t\t\t\t'is_multi_column': true\n\t\t\t},\n\t\t\t'tab_attachment': true,\n\t\t\t'tab_audit': true,\n\t\t};\n\t\tthis.setTabModel( tab_model );\n\n\t\tthis.navigation.AComboBox( {\n\t\t\tapi_class: TTAPI.APIUserExpense,\n\t\t\tid: this.script_name + '_navigation',\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_expense',\n\t\t\tnavigation_mode: true,\n\t\t\tshow_search_inputs: true\n\t\t} );\n\n\t\tthis.setNavigation();\n\n\t\t//Tab 0 start\n\n\t\tvar tab_expense = this.edit_view_tab.find( '#tab_expense' );\n\n\t\tvar tab_expense_column1 = tab_expense.find( '.first-column' );\n\t\tvar tab_expense_column2 = tab_expense.find( '.second-column' );\n\t\t//var authorization_history_column = tab_expense.find( '.auth-history-column' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\n\t\tthis.edit_view_tabs[0].push( tab_expense_column1 );\n\t\tthis.edit_view_tabs[0].push( tab_expense_column2 );\n\t\t//this.edit_view_tabs[0].push( authorization_history_column );\n\n\t\tvar form_item_input;\n\t\tvar widgetContainer;\n\t\tvar label;\n\n\t\t// Employee\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIUser,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_user',\n\t\t\tfield: 'user_id',\n\t\t\tset_empty: false\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Employee' ), form_item_input, tab_expense_column1, '', null );\n\n\t\t// Date Incurred\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.DATE_PICKER );\n\t\tform_item_input.TDatePicker( { field: 'incurred_date' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Date Incurred' ), form_item_input, tab_expense_column1, '', null );\n\n\t\t// Description\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_AREA );\n\t\tform_item_input.TTextArea( { field: 'description', width: '100%' } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Description' ), form_item_input, tab_expense_column1, '', null, null, true );\n\n\t\tform_item_input.parent().width( '45%' );\n\n\t\t// Payment Method\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\n\t\tform_item_input.TComboBox( { field: 'payment_method_id' } );\n\t\tform_item_input.setSourceData( $this.payment_method_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Payment Method' ), form_item_input, tab_expense_column1 );\n\n\t\t// Type\n\n\t\tvar args = {};\n\t\tvar filter_data = {};\n\t\tfilter_data.type_id = [10, 20, 30];\n\t\tfilter_data.user_id = [LocalCacheData.getLoginUser().id];\n\n\t\targs.filter_data = filter_data;\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIExpensePolicy,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_expense_policy',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'expense_policy_id'\n\t\t} );\n\n\t\tform_item_input.setDefaultArgs( args );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Type' ), form_item_input, tab_expense_column1 );\n\n\t\t//Amount\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\tform_item_input.TTextInput( { field: 'gross_amount1' } );\n\n\t\twidgetContainer = $( '
' );\n\t\tlabel = $( ' ' + $.i18n._( 'Reimburse' ) + ' ' );\n\n\t\tvar widget_checkbox = Global.loadWidgetByName( FormItemType.CHECKBOX );\n\t\twidget_checkbox.TCheckbox( { field: 'is_reimbursable' } );\n\n\t\twidgetContainer.append( form_item_input );\n\t\twidgetContainer.append( label );\n\t\twidgetContainer.append( widget_checkbox );\n\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Amount' ), [form_item_input, widget_checkbox], tab_expense_column1, '', widgetContainer );\n\n\t\t// Currency\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APICurrency,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_currency',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'currency_id'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Currency' ), form_item_input, tab_expense_column2, '' );\n\n\t\t//Branch\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIBranch,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_branch',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'branch_id'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Branch' ), form_item_input, tab_expense_column2 );\n\n\t\t//Department\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APIDepartment,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: 'global_department',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: 'department_id'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Department' ), form_item_input, tab_expense_column2 );\n\n\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\t//Job\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\t\tform_item_input.AComboBox( {\n\t\t\t\tapi_class: TTAPI.APIJob,\n\t\t\t\tallow_multiple_selection: false,\n\t\t\t\tlayout_name: 'global_job',\n\t\t\t\tshow_search_inputs: true,\n\t\t\t\tset_empty: true,\n\t\t\t\tsetRealValueCallBack: ( function( val ) {\n\n\t\t\t\t\tif ( val ) {\n\t\t\t\t\t\tjob_coder.setValue( val.manual_id );\n\t\t\t\t\t}\n\t\t\t\t} ),\n\t\t\t\tfield: 'job_id'\n\t\t\t} );\n\n\t\t\twidgetContainer = $( '
' );\n\n\t\t\tvar job_coder = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\tjob_coder.TTextInput( { field: 'job_quick_search', disable_keyup_event: true } );\n\t\t\tjob_coder.addClass( 'job-coder' );\n\n\t\t\twidgetContainer.append( job_coder );\n\t\t\twidgetContainer.append( form_item_input );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Job' ), [form_item_input, job_coder], tab_expense_column2, '', widgetContainer );\n\n\t\t\t// Task\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\t\tform_item_input.AComboBox( {\n\t\t\t\tapi_class: TTAPI.APIJobItem,\n\t\t\t\tallow_multiple_selection: false,\n\t\t\t\tlayout_name: 'global_job_item',\n\t\t\t\tshow_search_inputs: true,\n\t\t\t\tset_empty: true,\n\t\t\t\tsetRealValueCallBack: ( function( val ) {\n\n\t\t\t\t\tif ( val ) {\n\t\t\t\t\t\tjob_item_coder.setValue( val.manual_id );\n\t\t\t\t\t}\n\t\t\t\t} ),\n\t\t\t\tfield: 'job_item_id'\n\t\t\t} );\n\n\t\t\twidgetContainer = $( '
' );\n\n\t\t\tvar job_item_coder = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\tjob_item_coder.TTextInput( { field: 'job_item_quick_search', disable_keyup_event: true } );\n\t\t\tjob_item_coder.addClass( 'job-coder' );\n\n\t\t\twidgetContainer.append( job_item_coder );\n\t\t\twidgetContainer.append( form_item_input );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Task' ), [form_item_input, job_item_coder], tab_expense_column2, '', widgetContainer );\n\n\t\t\t//Punch Tag\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\t\tform_item_input.AComboBox( {\n\t\t\t\tapi_class: TTAPI.APIPunchTag,\n\t\t\t\tallow_multiple_selection: true,\n\t\t\t\tlayout_name: 'global_punch_tag',\n\t\t\t\tshow_search_inputs: true,\n\t\t\t\tset_empty: true,\n\t\t\t\tget_real_data_on_multi: true,\n\t\t\t\tsetRealValueCallBack: ( ( punch_tags, get_real_data ) => {\n\t\t\t\t\tif ( punch_tags ) {\n\t\t\t\t\t\tthis.setPunchTagQuickSearchManualIds( punch_tags, get_real_data );\n\t\t\t\t\t}\n\t\t\t\t} ),\n\t\t\t\tfield: 'punch_tag_id'\n\t\t\t} );\n\n\t\t\twidgetContainer = $( '
' );\n\n\t\t\tvar punch_tag_coder = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\tpunch_tag_coder.TTextInput( { field: 'punch_tag_quick_search', disable_keyup_event: true } );\n\t\t\tpunch_tag_coder.addClass( 'job-coder' );\n\n\t\t\twidgetContainer.append( punch_tag_coder );\n\t\t\twidgetContainer.append( form_item_input );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Punch Tags' ), [form_item_input, punch_tag_coder], tab_expense_column2, '', widgetContainer, true );\n\n\t\t}\n\t\t//Tags\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TAG_INPUT );\n\n\t\tform_item_input.TTagInput( { field: 'tag', object_type_id: 930 } );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Tags' ), form_item_input, tab_expense_column2, '', null, null, true );\n\n\t\t//Inside editor\n\n\t\tvar inside_editor_div = tab_expense.find( '.inside-editor-div' );\n\n\t\tvar inside_editor_args = {\n\t\t\tname: $.i18n._( 'Attachment Name' ),\n\t\t\taction: $.i18n._( 'Action' )\n\t\t};\n\n\t\tthis.editor = Global.loadWidgetByName( FormItemType.INSIDE_EDITOR );\n\t\tthis.editor.InsideEditor( {\n\t\t\taddRow: this.insideEditorAddRow,\n\t\t\tremoveRow: this.insideEditorRemoveRow,\n\t\t\tgetValue: this.insideEditorGetValue,\n\t\t\tsetValue: this.insideEditorSetValue,\n\t\t\tparent_controller: this,\n\t\t\tapi: this.document_api,\n\t\t\trender: getRender(),\n\t\t\trender_args: inside_editor_args,\n\t\t\trender_inline_html: true,\n\t\t\trow_render: getRowRender(),\n\n\t\t} );\n\n\t\tfunction getRender() {\n\t\t\treturn `\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
<%= name %><%= action %>
`;\n\t\t}\n\n\t\tfunction getRowRender() {\n\t\t\treturn `\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t`;\n\t\t}\n\n\t\tinside_editor_div.append( this.editor );\n\t}\n\n\tbuildSearchFields() {\n\n\t\tsuper.buildSearchFields();\n\t\tthis.search_fields = [\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Type' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: 'expense_policy_id',\n\t\t\t\tlayout_name: 'global_expense_policy',\n\t\t\t\tapi_class: TTAPI.APIExpensePolicy,\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Tags' ),\n\t\t\t\tfield: 'tag',\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\n\t\t\t\tin_column: 1,\n\t\t\t\tobject_type_id: 930,\n\t\t\t\tform_item_type: FormItemType.TAG_INPUT\n\t\t\t} ),\n\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( 'Hierarchy Level' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tmultiple: false,\n\t\t\t\tset_any: false,\n\t\t\t\tfield: 'hierarchy_level',\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: false,\n\t\t\t\tlayout_name: 'global_option_column',\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} )\n\t\t];\n\t}\n\n\tsearch( set_default_menu, page_action, page_number, callBack ) {\n\t\tthis.updateBadgeCount();\n\t\tsuper.search( set_default_menu, page_action, page_number, callBack );\n\t}\n\n\tupdateBadgeCount() {\n\t\tthis.event_bus.emit( 'tt_topbar', 'profile_pending_counts', { //Update \"My Profile\" badge.\n\t\t\tobject_types: [ 'notification', 'expense_authorization' ]\n\t\t} );\n\t}\n\n\t/* jshint ignore:start */\n\tsetCurrentEditRecordData() {\n\t\tvar $this = this;\n\t\t//Set current edit record data to all widgets\n\t\tfor ( var key in this.current_edit_record ) {\n\n\t\t\tif ( !this.current_edit_record.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar widget = this.edit_view_ui_dic[key];\n\n\t\t\tif ( Global.isSet( widget ) ) {\n\t\t\t\tswitch ( key ) {\n\t\t\t\t\tcase 'user_id':\n\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\twidget.setEnabled( false );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'gross_amount1':\n\t\t\t\t\t\twidget.setValue( this.current_edit_record['gross_amount'] );\n\t\t\t\t\t\t//this.onFormItemChange(widget); //This causes onFormItemChange() to trigger for gross_amount1, causing the related expense policies to be recalculated when the view appears. So if the user specified custom taxes they will get wiped out.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'gross_amount':\n\t\t\t\t\tcase 'net_amount':\n\t\t\t\t\t\t// Don't do anything.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'job_id':\n\t\t\t\t\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'job_item_id':\n\t\t\t\t\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\t\t\t\t\tvar args = {};\n\t\t\t\t\t\t\targs.filter_data = { job_id: this.current_edit_record.job_id };\n\t\t\t\t\t\t\twidget.setDefaultArgs( args );\n\t\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'punch_tag_id':\n\t\t\t\t\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\t\tthis.previous_punch_tag_selection = this.current_edit_record[key];\n\n\t\t\t\t\t\t\tvar args = {};\n\t\t\t\t\t\t\targs.filter_data = $this.getPunchTagFilterData();\n\t\t\t\t\t\t\twidget.setDefaultArgs( args );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'punch_tag_quick_search':\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'job_quick_search':\n//\t\t\t\t\t\twidget.setValue( this.current_edit_record['job_id'] ? this.current_edit_record['job_id'] : 0 );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'job_item_quick_search':\n//\t\t\t\t\t\twidget.setValue( this.current_edit_record['job_item_id'] ? this.current_edit_record['job_item_id'] : 0 );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\twidget.setValue( this.current_edit_record[key] );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tthis.collectUIDataToCurrentEditRecord();\n\n\t\tthis.setEditViewDataDone();\n\t}\n\n\t/* jshint ignore:end */\n\n\tsetEditViewDataDone() {\n\t\tsuper.setEditViewDataDone();\n\t\tvar $this = this;\n\t\tthis.is_changed = false;\n\n\t\tif ( Global.isSet( this.current_edit_record['related_expenses'] ) ) {\n\t\t\tthis.relatedExpenseArray = this.current_edit_record['related_expenses'];\n\t\t\tthis.setRelatedExpense( this.current_edit_record['related_expenses'] );\n\t\t}\n\n\t\tthis.initInsideEditorData();\n\t\tAuthorizationHistory.init( this );\n\t}\n\n\tinitInsideEditorData() {\n\t\tvar $this = this;\n\t\tvar args = {};\n\t\targs.filter_data = {};\n\n\t\tif ( !this.current_edit_record || !this.current_edit_record.id ) {\n\t\t\t$this.editor.removeAllRows();\n\t\t\t$this.editor.getDefaultData();\n\t\t} else {\n\n\t\t\targs.filter_data.object_type_id = this.document_object_type_id;\n\t\t\targs.filter_data.object_id = this.current_edit_record['id'];\n\n\t\t\t$this.api['getAttachment']( args, {\n\t\t\t\tonResult: function( res ) {\n\n\t\t\t\t\tif ( !$this.edit_view ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tvar data = res.getResult();\n\t\t\t\t\t$this.editor.setValue( data );\n\n\t\t\t\t}\n\t\t\t} );\n\n\t\t}\n\t}\n\n\tinsideEditorSetValue( val ) {\n\t\tvar len = val.length;\n\t\tthis.removeAllRows();\n\n\t\tif ( len > 0 ) {\n\t\t\tfor ( var i = 0; i < val.length; i++ ) {\n\t\t\t\tif ( Global.isSet( val[i] ) ) {\n\t\t\t\t\tvar row = val[i];\n\t\t\t\t\tthis.addRow( row );\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis.getDefaultData();\n\t\t}\n\t}\n\n\tinsideEditorGetValue() {\n\n\t\tvar len = this.rows_widgets_array.length;\n\n\t\tvar result = [];\n\n\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\tvar row = this.rows_widgets_array[i];\n\t\t\tif ( Global.isSet( row.file ) ) {\n\t\t\t\tvar data = {\n\t\t\t\t\tname: row.name.getValue(),\n\t\t\t\t\tfile: row.file.getValue()\n\t\t\t\t};\n\n\t\t\t\tif ( data.name === 'No File Selected' ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tresult.push( data );\n\t\t\t}\n\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tinsideEditorAddRow( data, index ) {\n\n\t\tif ( !data ) {\n\t\t\tthis.getDefaultData( index );\n\t\t} else {\n\t\t\tvar row = this.getRowRender(); //Get Row render\n\t\t\tvar render = this.getRender(); //get render, should be a table\n\t\t\tvar widgets = {}; //Save each row's widgets\n\n\t\t\t//Build row widgets\n\n\t\t\t// Attachment Name\n\t\t\tvar form_item_file_name = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\tform_item_file_name.TText( { field: 'name', width: 400 } );\n\t\t\tform_item_file_name.setValue( data.name ? data.name : $.i18n._( 'No File Selected' ) );\n\t\t\tform_item_file_name.setClassStyle( data.name ? { 'font-weight': 'bold' } : null );\n\t\t\twidgets[form_item_file_name.getField()] = form_item_file_name;\n\t\t\trow.children().eq( 0 ).append( form_item_file_name );\n\t\t\tform_item_file_name.attr( 'document_id', ( data.id && this.parent_controller.current_edit_record.id ) ? data.id : '' );\n\t\t\tform_item_file_name.attr( 'document_revision_id', ( data.document_revision_id && this.parent_controller.current_edit_record.id ) ? data.document_revision_id : '' );\n\n\t\t\t// Action\n\t\t\tif ( data.name ) {\n\n\t\t\t\tvar widgetContainer = $( '
' );\n\t\t\t\tvar download = $( '' );\n\t\t\t\tvar view = $( '' );\n\n\t\t\t\tdownload.attr( {\n\t\t\t\t\tdocument_id: data.id,\n\t\t\t\t\tdocument_revision_id: data.document_revision_id,\n\t\t\t\t\tobject_type_id: this.parent_controller.document_object_type_id\n\t\t\t\t} );\n\t\t\t\tview.attr( {\n\t\t\t\t\tdocument_id: data.id,\n\t\t\t\t\tdocument_revision_id: data.document_revision_id,\n\t\t\t\t\tobject_type_id: this.parent_controller.document_object_type_id\n\t\t\t\t} );\n\n\t\t\t\tdownload.bind( 'click', this.parent_controller.downloadFile );\n\t\t\t\tview.bind( 'click', this.parent_controller.downloadFile );\n\n\t\t\t\twidgetContainer.append( download );\n\t\t\t\twidgetContainer.append( view );\n\n\t\t\t\trow.children().eq( 1 ).append( widgetContainer );\n\t\t\t} else {\n\t\t\t\tvar form_item_file = Global.loadWidgetByName( FormItemType.IMAGE_BROWSER );\n\n\t\t\t\tvar $this = this.file_browser = form_item_file.TImageBrowser( {\n\t\t\t\t\t\tfield: 'file',\n\t\t\t\t\t\tname: 'filedata',\n\t\t\t\t\t\taccept_filter: '*',\n\t\t\t\t\t\tchangeHandler: function( a ) {\n\t\t\t\t\t\t\tvar file_name = $( this ).find( '.browser' )[0].files[0].name;\n\t\t\t\t\t\t\tform_item_file_name.setValue( file_name );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\twidgets[form_item_file.getField()] = form_item_file;\n\t\t\t\trow.children().eq( 1 ).append( form_item_file );\n\n\t\t\t}\n\n\t\t\t// end\n\n\t\t\tif ( typeof index != 'undefined' ) {\n\n\t\t\t\trow.insertAfter( $( render ).find( 'tr' ).eq( index ) );\n\t\t\t\tthis.rows_widgets_array.splice( ( index ), 0, widgets );\n\n\t\t\t} else {\n\t\t\t\t$( render ).append( row );\n\t\t\t\tthis.rows_widgets_array.push( widgets );\n\t\t\t}\n\n\t\t\tif ( this.parent_controller.is_viewing ) {\n\t\t\t\trow.find( '.control-icon' ).hide();\n\t\t\t}\n\n\t\t\tthis.addIconsEvent( row ); //Bind event to add and minus icon\n\t\t\tthis.removeLastRowLine();\n\t\t}\n\t}\n\n\tdownloadFile() {\n\n\t\tvar $this = $( this );\n\t\tvar document_attachment_id = $this.attr( 'document_id' );\n\t\tvar document_revision_id = $this.attr( 'document_revision_id' );\n\t\tvar object_type_id = $this.attr( 'object_type_id' );\n\n\t\tvar url = ServiceCaller.getURLByObjectType( 'file_download' ) + '&object_type=document&parent_id=' + document_attachment_id + '&parent_object_type_id=' + object_type_id + '&object_id=' + document_revision_id;\n\n\t\tGlobal.APIFileDownload( null, null, null, url );\n\t}\n\n\tinsideEditorRemoveRow( row ) {\n\n\t\tvar $this = this;\n\t\tvar index = row[0].rowIndex - 1;\n\t\tvar remove_id = this.rows_widgets_array[index].name.attr( 'document_id' );\n\t\tif ( TTUUID.isUUID( remove_id ) && remove_id != TTUUID.zero_id && remove_id != TTUUID.not_exist_id ) {\n\t\t\tTAlertManager.showConfirmAlert( 'Are you sure to ' + this.rows_widgets_array[index].name.text() + '?', null, function( result ) {\n\t\t\t\tif ( result ) {\n\t\t\t\t\tProgressBar.showOverlay();\n\t\t\t\t\t$this.api['delete' + $this.api.key_name]( remove_id, {\n\t\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t\tProgressBar.closeOverlay();\n\t\t\t\t\t\t\tif ( result.isValid() ) {\n\t\t\t\t\t\t\t\trow.remove();\n\t\t\t\t\t\t\t\t$this.rows_widgets_array.splice( index, 1 );\n\t\t\t\t\t\t\t\tif ( $this.rows_widgets_array.length === 0 ) {\n\t\t\t\t\t\t\t\t\t$this.getDefaultData();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\trow.remove();\n\t\t\t$this.rows_widgets_array.splice( index, 1 );\n\t\t}\n\n\t\tthis.removeLastRowLine();\n\t}\n\n\t/* jshint ignore:start */\n\tonFormItemChange( target, doNotValidate ) {\n\t\tvar $this = this;\n\n\t\tthis.setIsChanged( target );\n\t\tthis.setMassEditingFieldsWhenFormChange( target );\n\n\t\tvar key = target.getField();\n\t\tvar c_value = target.getValue();\n\n\t\tthis.current_edit_record[key] = c_value;\n\n\t\tvar amount_arr = false;\n\n\t\tswitch ( key ) {\n\t\t\tcase 'expense_policy_id':\n\t\t\tcase 'gross_amount1':\n\t\t\t\tthis.current_edit_record['gross_amount1'] = this.current_edit_record['gross_amount1'] ? this.current_edit_record['gross_amount1'] : this.current_edit_record['gross_amount'];\n\t\t\t\tthis.api['calcRelatedExpenses'](\n\t\t\t\t\tthis.current_edit_record['expense_policy_id'], this.current_edit_record['gross_amount1'], amount_arr, this.current_edit_record['is_reimbursable'],\n\t\t\t\t\t{\n\t\t\t\t\t\tonResult: function( res ) {\n\t\t\t\t\t\t\t$this.relatedExpenseArray = res.getResult();\n\t\t\t\t\t\t\t$this.setRelatedExpense( $this.relatedExpenseArray );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tcase 'is_reimbursable':\n\t\t\t\tthis.current_edit_record['gross_amount1'] = this.current_edit_record['gross_amount1'] ? this.current_edit_record['gross_amount1'] : this.current_edit_record['gross_amount'];\n\t\t\t\tamount_arr = this.relatedExpenseArray ? this.relatedExpenseArray : false;\n\t\t\t\tthis.api['calcRelatedExpenses'](\n\t\t\t\t\tthis.current_edit_record['expense_policy_id'], this.current_edit_record['gross_amount1'], amount_arr, this.current_edit_record['is_reimbursable'],\n\t\t\t\t\t{\n\t\t\t\t\t\tonResult: function( res ) {\n\t\t\t\t\t\t\t$this.relatedExpenseArray = res.getResult();\n\t\t\t\t\t\t\t$this.setRelatedExpense( $this.relatedExpenseArray );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tcase 'amount':\n\t\t\t\tvar related_expense_policy_id = target.attr( 'id' );\n\t\t\t\tthis.current_edit_record['gross_amount1'] = this.current_edit_record['gross_amount1'] ? this.current_edit_record['gross_amount1'] : this.current_edit_record['gross_amount'];\n\t\t\t\tthis.relatedExpenseArray['taxes'][related_expense_policy_id]['amount'] = c_value;\n\t\t\t\tthis.api['calcRelatedExpenses'](\n\t\t\t\t\tthis.current_edit_record['expense_policy_id'], this.current_edit_record['gross_amount1'], this.relatedExpenseArray, this.current_edit_record['is_reimbursable'],\n\t\t\t\t\t{\n\t\t\t\t\t\tonResult: function( res ) {\n\t\t\t\t\t\t\t$this.relatedExpenseArray = res.getResult();\n\t\t\t\t\t\t\t$this.setRelatedExpenseData( $this.relatedExpenseArray, related_expense_policy_id );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tcase 'job_id':\n\t\t\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\t\t\tthis.edit_view_ui_dic['job_quick_search'].setValue( target.getValue( true ) ? ( target.getValue( true ).manual_id ? target.getValue( true ).manual_id : '' ) : '' );\n\t\t\t\t\tthis.setJobItemValueWhenJobChanged( target.getValue( true ), 'job_item_id', { job_id: this.current_edit_record.job_id } );\n\t\t\t\t\tthis.edit_view_ui_dic['job_quick_search'].setCheckBox( true );\n\t\t\t\t\tthis.setPunchTagValuesWhenCriteriaChanged( this.getPunchTagFilterData(), 'punch_tag_id' );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'job_item_id':\n\t\t\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\t\t\tthis.edit_view_ui_dic['job_item_quick_search'].setValue( target.getValue( true ) ? ( target.getValue( true ).manual_id ? target.getValue( true ).manual_id : '' ) : '' );\n\t\t\t\t\tthis.edit_view_ui_dic['job_item_quick_search'].setCheckBox( true );\n\t\t\t\t\tthis.setPunchTagValuesWhenCriteriaChanged( this.getPunchTagFilterData(), 'punch_tag_id' );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'punch_tag_id':\n\t\t\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\t\t\tif ( c_value !== TTUUID.zero_id && c_value !== false && c_value.length > 0 ) {\n\t\t\t\t\t\tthis.setPunchTagQuickSearchManualIds( target.getSelectItems() );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.edit_view_ui_dic['punch_tag_quick_search'].setValue( '' );\n\t\t\t\t\t}\n\t\t\t\t\t$this.previous_punch_tag_selection = c_value;\n\t\t\t\t\t//Reset source data to make sure correct punch tags are always shown.\n\t\t\t\t\tthis.edit_view_ui_dic['punch_tag_id'].setSourceData( null );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'user_id':\n\t\t\tcase 'branch_id':\n\t\t\tcase 'department_id':\n\t\t\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\t\t\tthis.setPunchTagValuesWhenCriteriaChanged( this.getPunchTagFilterData(), 'punch_tag_id' );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'job_quick_search':\n\t\t\tcase 'job_item_quick_search':\n\t\t\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\t\t\tthis.onJobQuickSearch( key, c_value );\n\n\t\t\t\t\t//Don't validate immediately as onJobQuickSearch is doing async API calls, and it would cause a guaranteed validation failure.\n\t\t\t\t\tdoNotValidate = true;\n\t\t\t\t\tthis.setPunchTagValuesWhenCriteriaChanged( this.getPunchTagFilterData(), 'punch_tag_id' );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'punch_tag_quick_search':\n\t\t\t\tif ( ( Global.getProductEdition() >= 20 ) ) {\n\t\t\t\t\tthis.onPunchTagQuickSearch( c_value, this.getPunchTagFilterData(), 'punch_tag_id' );\n\n\t\t\t\t\t//Don't validate immediately as onPunchTagQuickSearch is doing async API calls, and it would cause a guaranteed validation failure.\n\t\t\t\t\tdoNotValidate = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\t/* jshint ignore:end */\n\n\t/**\n\t * this just sets the subform data\n\t * should be called in most cases\n\t *\n\t * @param expenses\n\t */\n\tsetRelatedExpenseData( expenses, selected_related_expense_policy_id ) {\n\t\tvar tab_expense = this.edit_view_tab.find( '#tab_expense' );\n\t\tvar tab_expense_column3 = tab_expense.find( '.third-column' );\n\n\t\ttab_expense_column3.find( '#net_amount' ).val( expenses['net_amount'] );\n\t\ttab_expense_column3.find( '#gross_amount' ).val( expenses['gross_amount'] );\n\t\ttab_expense_column3.find( '#reimburse_amount' ).val( expenses['reimburse_amount'] );\n\n\t\tvar tax_inputs = tab_expense_column3.find( '.tax_input' );\n\t\tfor ( var n = 0; n < tax_inputs.length; n++ ) {\n\t\t\tvar el = $( tax_inputs[n] );\n\t\t\tif ( el.length > 0 ) {\n\t\t\t\tvar id = el.attr( 'id' );\n\t\t\t\tif ( !selected_related_expense_policy_id || selected_related_expense_policy_id != id ) {\n\t\t\t\t\tel.val( expenses['taxes'][id].amount );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\t/**\n\t * rebuilds the entire subform ui\n\t * we need to call this when type changes or reimburse is checked to add and remove fields\n\t *\n\t * @param expenses\n\t */\n\tsetRelatedExpense( expenses ) {\n\n\t\t// Third column start\n\t\tvar tab_expense = this.edit_view_tab.find( '#tab_expense' );\n\t\tvar tab_expense_column3 = tab_expense.find( '.third-column' ).empty();\n\n\t\tif ( this.edit_view_tabs[0].length < 3 ) {\n\t\t\tthis.edit_view_tabs[0].push( tab_expense_column3 );\n\t\t}\n\n\t\tif ( !expenses ) {\n\t\t\texpenses = { net_amount: 0, gross_amount: 0, reimburse_amount: this.current_edit_record.reimburse_amount };\n\t\t}\n\n\t\tif ( expenses && expenses['taxes'] && Object.keys( expenses['taxes'] ).length > 0 ) {\n\t\t\t// Net Amount\n\t\t\tvar form_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\tform_item_input.TTextInput( { field: 'net_amount' } );\n\t\t\tform_item_input.setValue( expenses['net_amount'] );\n\t\t\tform_item_input.attr( 'id', 'net_amount' );\n\t\t\tform_item_input.setEnabled( false );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Net Amount' ), form_item_input, tab_expense_column3, '', null, true );\n\n\t\t\tthis.edit_view_ui_dic['net_amount'].css( 'opacity', 1 );\n\n\t\t\tif ( expenses['taxes'] ) {\n\t\t\t\tfor ( var key in expenses['taxes'] ) {\n\t\t\t\t\tvar item = expenses['taxes'][key];\n\n\t\t\t\t\t// taxes\n\t\t\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT );\n\t\t\t\t\tform_item_input.TTextInput( { field: 'amount' } );\n\t\t\t\t\tform_item_input.setValue( item['amount'] );\n\t\t\t\t\tform_item_input.attr( 'id', item['expense_policy_id'] );\n\t\t\t\t\tform_item_input.addClass( 'tax_input' );\n\t\t\t\t\tthis.addEditFieldToColumn( $.i18n._( item['expense_policy_name'] ), form_item_input, tab_expense_column3, '', null, true );\n\n\t\t\t\t\tthis.edit_view_ui_dic['amount'].css( 'opacity', 1 );\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Amount\n\t\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\t\t\tform_item_input.TText( { field: 'gross_amount' } );\n\t\t\tform_item_input.setValue( expenses['gross_amount'] );\n\t\t\tform_item_input.attr( 'id', 'gross_amount' );\n\t\t\tthis.addEditFieldToColumn( $.i18n._( 'Amount' ), form_item_input, tab_expense_column3, '', null, true );\n\n\t\t\tthis.edit_view_ui_dic['gross_amount'].css( 'opacity', 1 );\n\t\t}\n\n\t\t// Reimburse Amount\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.TEXT );\n\t\tform_item_input.TText( { field: 'reimburse_amount' } );\n\t\tform_item_input.setValue( expenses['reimburse_amount'] );\n\t\tform_item_input.attr( 'id', 'reimburse_amount' );\n\t\tthis.addEditFieldToColumn( $.i18n._( 'Reimburse Amount' ), form_item_input, tab_expense_column3, '', null, true );\n\n\t\tthis.edit_view_ui_dic['reimburse_amount'].css( 'opacity', 1 );\n\n\t\tthis.editFieldResize( 0 );\n\t}\n\n\tuniformVariable( records ) {\n\t\tif ( this.relatedExpenseArray ) {\n\t\t\trecords.related_expenses = this.relatedExpenseArray;\n\t\t\trecords.gross_amount = this.relatedExpenseArray.gross_amount;\n\t\t\trecords.net_amount = this.relatedExpenseArray.net_amount;\n\t\t\trecords.reimburse_amount = this.relatedExpenseArray.reimburse_amount;\n\t\t}\n\n\t\treturn records;\n\t}\n\n\t// onSaveAndContinueResult( result ) {\n\t//\n\t// \tvar $this = this;\n\t// \tif ( result.isValid() ) {\n\t// \t\tvar result_data = result.getResult();\n\t// \t\tif ( result_data === true ) {\n\t// \t\t\t$this.refresh_id = $this.current_edit_record.id;\n\t//\n\t// \t\t} else if ( TTUUID.isUUID( result_data ) && result_data != TTUUID.zero_id && result_data != TTUUID.not_exist_id ) { // as new\n\t// \t\t\t$this.refresh_id = result_data;\n\t// \t\t}\n\t//\n\t// \t\t$this.saveInsideEditorData( function() {\n\t// \t\t\t$this.search( false );\n\t// \t\t\t$this.onEditClick( $this.refresh_id, true );\n\t//\n\t// \t\t\t$this.onSaveAndContinueDone( result );\n\t//\n\t// \t\t} );\n\t//\n\t// \t} else {\n\t// \t\t$this.setErrorTips( result );\n\t// \t\t$this.setErrorMenu();\n\t// \t}\n\t// },\n\n\t// onSaveAndNewResult: function( result ) {\n\t// \tvar $this = this;\n\t// \tif ( result.isValid() ) {\n\t// \t\tvar result_data = result.getResult();\n\t// \t\tif ( result_data === true ) {\n\t// \t\t\t$this.refresh_id = $this.current_edit_record.id;\n\t//\n\t// \t\t} else if ( TTUUID.isUUID( result_data ) && result_data != TTUUID.zero_id && result_data != TTUUID.not_exist_id ) { // as new\n\t// \t\t\t$this.refresh_id = result_data;\n\t// \t\t}\n\t//\n\t// \t\t$this.saveInsideEditorData( function() {\n\t// \t\t\t$this.search( false );\n\t// \t\t\t$this.onAddClick( true );\n\t//\n\t// \t\t} );\n\t// \t} else {\n\t// \t\t$this.setErrorTips( result );\n\t// \t\t$this.setErrorMenu();\n\t// \t}\n\t// },\n\n\tonCancelClick( force_no_confirm, cancel_all, callback ) {\n\t\t//Refresh grid on cancel as its not done during authorize/decline anymore.\n\t\tvar $this = this;\n\t\tsuper.onCancelClick( force_no_confirm, cancel_all, function() {\n\t\t\t//Since we are overriding the callback function to call this.search(), make sure the original callback is still called.\n\t\t\tif ( callback ) {\n\t\t\t\tcallback();\n\t\t\t}\n\n\t\t\t$this.search();\n\t\t} );\n\t}\n\n\tonSaveAndCopyResult( result ) {\n\t\tvar $this = this;\n\t\tif ( result.isValid() ) {\n\t\t\tvar result_data = result.getResult();\n\t\t\tif ( result_data === true ) {\n\t\t\t\t$this.refresh_id = $this.current_edit_record.id;\n\n\t\t\t} else if ( TTUUID.isUUID( result_data ) && result_data != TTUUID.zero_id && result_data != TTUUID.not_exist_id ) {\n\t\t\t\t$this.refresh_id = result_data;\n\t\t\t}\n\n\t\t\t$this.saveInsideEditorData( function() {\n\t\t\t\t$this.search( false );\n\n\t\t\t\t$this.onCopyAsNewClick();\n\n\t\t\t} );\n\n\t\t} else {\n\t\t\t$this.setErrorTips( result );\n\t\t\t$this.setErrorMenu();\n\t\t}\n\t}\n\n\t// onSaveAndNextResult( result ) {\n\t// \tvar $this = this;\n\t// \tif ( result.isValid() ) {\n\t// \t\tvar result_data = result.getResult();\n\t// \t\tif ( result_data === true ) {\n\t// \t\t\t$this.refresh_id = $this.current_edit_record.id;\n\t//\n\t// \t\t} else if ( TTUUID.isUUID( result_data ) && result_data != TTUUID.zero_id && result_data != TTUUID.not_exist_id ) {\n\t// \t\t\t$this.refresh_id = result_data;\n\t// \t\t}\n\t//\n\t// \t\t$this.saveInsideEditorData( function() {\n\t// \t\t\t$this.onRightArrowClick();\n\t// \t\t\t$this.search( false );\n\t// \t\t\t$this.onSaveAndNextDone( result );\n\t//\n\t// \t\t} );\n\t//\n\t// \t} else {\n\t// \t\t$this.setErrorTips( result );\n\t// \t\t$this.setErrorMenu();\n\t// \t}\n\t// },\n\n\tonSaveResult( result ) {\n\t\tvar $this = this;\n\t\tif ( result.isValid() ) {\n\t\t\tvar result_data = result.getResult();\n\t\t\tif ( result_data === true ) {\n\t\t\t\t$this.refresh_id = $this.current_edit_record.id;\n\t\t\t} else if ( TTUUID.isUUID( result_data ) && result_data != TTUUID.zero_id && result_data != TTUUID.not_exist_id ) {\n\t\t\t\t$this.refresh_id = result_data;\n\t\t\t}\n\n\t\t\t$this.saveInsideEditorData( function() {\n\t\t\t\t$this.search( false );\n\t\t\t} );\n\n\t\t} else {\n\t\t\t$this.setErrorMenu();\n\t\t\t$this.setErrorTips( result );\n\n\t\t}\n\t}\n\n\t/* jshint ignore:start */\n\tsaveInsideEditorData( callBack ) {\n\t\tvar $this = this;\n\t\tvar data = this.editor.getValue();\n\t\tvar files = data.length;\n\t\tif ( files > 0 ) {\n\t\t\tvar success = 0;\n\t\t\tfor ( var key in data ) {\n\t\t\t\tvar fileItem = data[key];\n\t\t\t\tif ( Global.isSet( fileItem.file ) ) {\n\n\t\t\t\t\tvar document_revision_id = this.api.addAttachment( fileItem.name, this.document_object_type_id, this.refresh_id, { async: false } ).getResult();\n\t\t\t\t\t$this.api.uploadFile( fileItem.file, 'object_type=document_revision&object_id=' + document_revision_id + '&parent_object_type_id=' + this.document_object_type_id, {} );\n\n\t\t\t\t\tsuccess++;\n\n\t\t\t\t} else {\n\t\t\t\t\tcallBack();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( success === files ) {\n\t\t\t\tcallBack();\n\t\t\t}\n\n\t\t} else {\n\t\t\tcallBack();\n\t\t}\n\t}\n\n\t/* jshint ignore:end */\n\n\tuploadFile( document_result, file_data ) {\n\t\tvar document_revision_id = document_result.getResult();\n\t\tvar $this = this;\n\n\t\t$this.api.uploadFile( file_data, 'object_type=document_revision&object_id=' + document_revision_id, {\n\t\t\tonResult: function( upload_file_result ) {\n\t\t\t}\n\t\t} );\n\t}\n\n\tgetExpenseAuthorizationTabHtml() {\n\t\treturn `
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
`;\n\t}\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW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