"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["developer_tools-AwesomeboxTestViewController"],{6142:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "AwesomeboxTestViewController": () => (/* binding */ AwesomeboxTestViewController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass AwesomeboxTestViewController extends BaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: \'#awesomebox_test_view_container\',\n\n\t\t\t// _required_files: [\'TImage\', \'TImageAdvBrowser\'],\n\n\t\t\tuser_api: null,\n\t\t\tuser_group_api: null,\n\t\t\tcompany_api: null,\n\t\t\tuser_id_array: null\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\tthis.edit_view_tpl = \'AwesomeboxTestEditView.html\';\n\t\tthis.permission_id = \'user\';\n\t\tthis.viewId = \'AwesomeboxTest\';\n\t\tthis.script_name = \'AwesomeboxTestView\';\n\t\tthis.table_name_key = \'awesomebox_test\';\n\t\tthis.context_menu_name = $.i18n._( \'AwesomeBox Test\' );\n\t\tthis.navigation_label = $.i18n._( \'AwesomBox Test\' );\n\t\tthis.api = TTAPI.APIUser;\n\t\tthis.select_company_id = LocalCacheData.getCurrentCompany().id;\n\t\tthis.user_group_api = TTAPI.APIUserGroup;\n\t\tthis.company_api = TTAPI.APICompany;\n\t\tthis.user_id_array = [];\n\n\t\tthis.render();\n\t\tthis.buildContextMenu();\n\t\tthis.initData();\n\t}\n\n\tsetCurrentEditRecordData() {\n\t\tthis.collectUIDataToCurrentEditRecord();\n\t\tthis.setEditViewDataDone();\n\t}\n\n\tclearEditViewData() {\n\t\treturn false;\n\t}\n\n\tbuildEditViewUI() {\n\t\tvar $this = this;\n\n\t\tif( ContextMenuManager.getMenu( this.determineContextMenuMountAttributes().id ) === undefined ) {\n\t\t\tthis.buildContextMenu();\n\t\t} else {\n\t\t\tDebug.Warn( \'Context Menu (\'+ this.determineContextMenuMountAttributes().id +\') already exists for: \'+ this.viewId, \'AwesomeBoxTestView.js\', \'AwesomeBoxTestView\', \'buildEditViewUI\', 10 );\n\t\t}\n\n\t\tvar tab_model = {\n\t\t\t\'tab_employee\': { \'label\': $.i18n._( \'AWESOMEBOX TESTING VIEW\' ) },\n\t\t};\n\t\tthis.setTabModel( tab_model );\n\n\t\t//Tab 0 start\n\n\t\tvar tab_employee = this.edit_view_tab.find( \'#tab_employee\' );\n\n\t\tvar tab_employee_column1 = tab_employee.find( \'.first-column\' );\n\n\t\tthis.edit_view_tabs[0] = [];\n\t\tthis.edit_view_tabs[0].push( tab_employee_column1 );\n\n//\t\tUser\n\t\tvar form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_DROPDOWN );\n\t\tform_item_input.ADropDown( {\n\t\t\t//api_class: TTAPI.APIUser,\n\t\t\tfield: \'user_id\',\n\t\t\tdisplay_show_all: false,\n\t\t\tid: \'user_id_dropdown\',\n\t\t\tkey: \'id\',\n\t\t\tallow_drag_to_order: false,\n\t\t\tdisplay_close_btn: false,\n\t\t\tauto_sort: true,\n\t\t\tdisplay_column_settings: false,\n\t\t\tdefault_height: 100\n\t\t} );\n\n\t\t// form_item_input.setSourceData( $this.user_id_array );\n\t\tform_item_input.addClass( \'splayed-adropdown\' );\n\t\tvar display_columns = ALayoutCache.getDefaultColumn( \'global_user\' ); //Get Default columns base on different layout name\n\t\tdisplay_columns = Global.convertColumnsTojGridFormat( display_columns, \'global_user\' ); //Convert to jQgrid format\n\t\tthis.addEditFieldToColumn( $.i18n._( \'User\' ), form_item_input, tab_employee_column1 );\n\t\tform_item_input.setColumns( display_columns );\n\t\tform_item_input.setUnselectedGridData( this.user_id_array );\n\t\tform_item_input.setGridColumnsWidths();\n\t\tform_item_input.setHeight( 150 );\n\n\t\t//Company\n\t\tvar form_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: true,\n\t\t\tlayout_name: \'global_user\',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: \'user_id2\'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( \'User ( Big Multi-select)\' ), form_item_input, tab_employee_column1 );\n\t\tform_item_input.setEnabled( false );\n\n\t\t//Company\n\t\tvar form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APICompany,\n\t\t\tallow_multiple_selection: true,\n\t\t\tlayout_name: \'global_company\',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: \'company_id\'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( \'Company\' ), form_item_input, tab_employee_column1 );\n\t\tform_item_input.setEnabled( false );\n\n\t\t//Legal Entity\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\tform_item_input.AComboBox( {\n\t\t\tapi_class: TTAPI.APILegalEntity,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: \'global_legal_entity\',\n\t\t\tshow_search_inputs: true,\n\t\t\tset_empty: true,\n\t\t\tfield: \'legal_entity_id\'\n\t\t} );\n\t\tthis.addEditFieldToColumn( $.i18n._( \'Legal Entity\' ), form_item_input, tab_employee_column1 );\n\n\t\t//Group\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\ttree_mode: true,\n\t\t\tallow_multiple_selection: false,\n\t\t\tlayout_name: \'global_tree_column\',\n\t\t\tset_empty: true,\n\t\t\tfield: \'group_id\'\n\t\t} );\n\t\tform_item_input.setSourceData( $this.user_group_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( \'Group\' ), form_item_input, tab_employee_column1 );\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\n\t\tform_item_input.AComboBox( {\n\t\t\ttree_mode: true,\n\t\t\tallow_multiple_selection: true,\n\t\t\tlayout_name: \'global_tree_column\',\n\t\t\tset_empty: true,\n\t\t\tfield: \'group_id2\'\n\t\t} );\n\t\tform_item_input.setSourceData( $this.user_group_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( \'Group (Multi)\' ), form_item_input, tab_employee_column1 );\n\n\t\t//Status\n\n\t\tform_item_input = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tform_item_input.TComboBox( { field: \'status_id\' } );\n\t\tform_item_input.setSourceData( $this.status_array );\n\t\tthis.addEditFieldToColumn( $.i18n._( \'Status\' ), form_item_input, tab_employee_column1 );\n\n\t\tTTPromise.resolve( \'Awesomeboxtest\', \'init\' );\n\t}\n\n\tbuildSearchFields() {\n\n\t\tsuper.buildSearchFields();\n\n\t\tvar $this = this;\n\t\tthis.search_fields = [\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( \'Company\' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: \'company_id\',\n\t\t\t\tlayout_name: \'global_company\',\n\t\t\t\tapi_class: TTAPI.APICompany,\n\t\t\t\tmultiple: false,\n\t\t\t\tcustom_first_label: Global.default_item,\n\t\t\t\tbasic_search: PermissionManager.checkTopLevelPermission( \'Companies\' ) ? true : false,\n\t\t\t\tadv_search: PermissionManager.checkTopLevelPermission( \'Companies\' ) ? true : false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( \'Legal Entity\' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: \'legal_entity_id\',\n\t\t\t\tlayout_name: \'global_legal_entity\',\n\t\t\t\tapi_class: TTAPI.APILegalEntity,\n\t\t\t\tmultiple: true,\n\t\t\t\tcustom_first_label: Global.any_item,\n\t\t\t\tbasic_search: PermissionManager.checkTopLevelPermission( \'LegalEntity\' ) ? true : false,\n\t\t\t\tadv_search: PermissionManager.checkTopLevelPermission( \'LegalEntity\' ) ? true : false,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} ),\n\t\t\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( \'Status\' ),\n\t\t\t\tin_column: 1,\n\t\t\t\tfield: \'status_id\',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\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\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( \'Gender\' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tfield: \'sex_id\',\n\t\t\t\tmultiple: true,\n\t\t\t\tbasic_search: false,\n\t\t\t\tadv_search: true,\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\tnew SearchField( {\n\t\t\t\tlabel: $.i18n._( \'Group\' ),\n\t\t\t\tin_column: 2,\n\t\t\t\tmultiple: true,\n\t\t\t\tfield: \'group_id\',\n\t\t\t\tlayout_name: \'global_tree_column\',\n\t\t\t\ttree_mode: true,\n\t\t\t\tbasic_search: true,\n\t\t\t\tadv_search: true,\n\t\t\t\tform_item_type: FormItemType.AWESOME_BOX\n\t\t\t} )\n\t\t];\n\t}\n\n\tgetCustomContextMenuModel() {\n\t\tvar context_menu_model = {\n\t\t\texclude: [\'default\'],\n\t\t\tinclude: [\n\t\t\t\t\'view\',\n\t\t\t\t\'edit\',\n\t\t\t\t\'cancel\'\n\t\t\t]\n\t\t};\n\n\t\treturn context_menu_model;\n\t}\n\n\tinitOptions( callBack ) {\n\n\t\tvar options = [\n\t\t\t{ option_name: \'status\' },\n\t\t\t{ option_name: \'company_id\' }\n\t\t];\n\n\t\tthis.initDropDownOptions( options, function( result ) {\n\n\t\t\tif ( callBack ) {\n\t\t\t\tcallBack( result ); // First to initialize drop down options, and then to initialize edit view UI.\n\t\t\t}\n\n\t\t} );\n\t}\n\n\tinitDropDownOptions( options, callBack ) {\n\t\tvar $this = this;\n\t\tvar len = options.length + 2;\n\t\tvar complete_count = 0;\n\t\tvar option_result = [];\n\n\t\tvar res = \'[{"id":"00000000-0000-0000-0000-000000000000","name":"Root","level":0,"children":[{"id":"11e85213-a778-6410-bee1-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"00000000-0000-0000-0000-000000000000","name":"Corporate","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":1,"children":[{"id":"11e85213-a779-fa20-835f-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"11e85213-a778-6410-bee1-123456abcdef","name":"Executives","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":2,"expanded":true,"loaded":true,"parent":"11e85213-a778-6410-bee1-123456abcdef","isLeaf":true},{"id":"11e85213-a77a-39c0-9bc2-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"11e85213-a778-6410-bee1-123456abcdef","name":"Human Resources","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":2,"expanded":true,"loaded":true,"parent":"11e85213-a778-6410-bee1-123456abcdef","isLeaf":true}],"expanded":true,"loaded":true,"parent":"00000000-0000-0000-0000-000000000000"},{"id":"11e85213-a77a-7810-a67f-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"00000000-0000-0000-0000-000000000000","name":"Hourly (Non-Exempt)","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":1,"children":[{"id":"11e85213-a77a-bb40-b83e-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"11e85213-a77a-7810-a67f-123456abcdef","name":"Salary (Exempt)","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":2,"expanded":true,"loaded":true,"parent":"11e85213-a77a-7810-a67f-123456abcdef","isLeaf":true}],"expanded":true,"loaded":true,"parent":"00000000-0000-0000-0000-000000000000"}],"expanded":true,"loaded":true},{"id":"11e85213-a778-6410-bee1-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"00000000-0000-0000-0000-000000000000","name":"Corporate","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":1,"children":[{"id":"11e85213-a779-fa20-835f-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"11e85213-a778-6410-bee1-123456abcdef","name":"Executives","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":2,"expanded":true,"loaded":true,"parent":"11e85213-a778-6410-bee1-123456abcdef","isLeaf":true},{"id":"11e85213-a77a-39c0-9bc2-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"11e85213-a778-6410-bee1-123456abcdef","name":"Human Resources","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":2,"expanded":true,"loaded":true,"parent":"11e85213-a778-6410-bee1-123456abcdef","isLeaf":true}],"expanded":true,"loaded":true,"parent":"00000000-0000-0000-0000-000000000000"},{"id":"11e85213-a779-fa20-835f-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"11e85213-a778-6410-bee1-123456abcdef","name":"Executives","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":2,"expanded":true,"loaded":true,"parent":"11e85213-a778-6410-bee1-123456abcdef","isLeaf":true},{"id":"11e85213-a77a-39c0-9bc2-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"11e85213-a778-6410-bee1-123456abcdef","name":"Human Resources","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":2,"expanded":true,"loaded":true,"parent":"11e85213-a778-6410-bee1-123456abcdef","isLeaf":true},{"id":"11e85213-a77a-7810-a67f-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"00000000-0000-0000-0000-000000000000","name":"Hourly (Non-Exempt)","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":1,"children":[{"id":"11e85213-a77a-bb40-b83e-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"11e85213-a77a-7810-a67f-123456abcdef","name":"Salary (Exempt)","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":2,"expanded":true,"loaded":true,"parent":"11e85213-a77a-7810-a67f-123456abcdef","isLeaf":true}],"expanded":true,"loaded":true,"parent":"00000000-0000-0000-0000-000000000000"},{"id":"11e85213-a77a-bb40-b83e-123456abcdef","company_id":"11e85213-a6b2-93b0-a2cd-123456abcdef","parent_id":"11e85213-a77a-7810-a67f-123456abcdef","name":"Salary (Exempt)","deleted":false,"created_by_id":false,"created_by":false,"created_date":"07-May-18 9:28 AM","updated_by_id":false,"updated_by":false,"updated_date":"07-May-18 9:28 AM","level":2,"expanded":true,"loaded":true,"parent":"11e85213-a77a-7810-a67f-123456abcdef","isLeaf":true}]\';\n\t\tres = JSON.parse( res );\n\t\tif ( !$this.edit_only_mode ) {\n\t\t\tif ( !$this.sub_view_mode && $this.basic_search_field_ui_dic[\'group_id\'] ) {\n\t\t\t\t$this.basic_search_field_ui_dic[\'group_id\'].setSourceData( res );\n\t\t\t\t$this.adv_search_field_ui_dic[\'group_id\'].setSourceData( res );\n\t\t\t}\n\n\t\t}\n\n\t\t$this.user_group_array = res;\n\n\t\tcomplete_count = complete_count + 1;\n\n\t\tif ( complete_count === len ) {\n\n\t\t\tcallBack( option_result );\n\t\t}\n\n\t\tfor ( var i = 0; i < len - 2; i++ ) {\n\t\t\tvar option_info = options[i];\n\t\t\tthis.initDropDownOption( option_info.option_name, option_info.field_name, option_info.api, onGetOptionResult );\n\n\t\t}\n\n\t\tfunction onGetOptionResult( result ) {\n\n\t\t\toption_result.push( result );\n\n\t\t\tcomplete_count = complete_count + 1;\n\n\t\t\tif ( complete_count === len ) {\n\n\t\t\t\tcallBack( option_result );\n\t\t\t}\n\t\t}\n\t}\n\n\t//override that forces same data to grid at all times.\n\tsearch() {\n\t\tvar result_data = JSON.parse( \'[{"id":"11e85213-a799-d200-b041-123456abcdef","status":"Active","employee_number":100,"first_name":"Mr.","last_name":"FAKE","full_name":"Administrator, Mr.","home_phone":"471-438-3900","is_owner":true,"is_child":false},\' +\n\t\t\t\'{"id":"11e85213-ad34-e0e0-8541-123456abcdef","status":"Active","employee_number":13,"first_name":"Tristen","last_name":"Braun","full_name":"FAKE Braun, Tristen","home_phone":"527-500-4852","is_owner":false,"is_child":true},\' +\n\t\t\t\'{"id":"11e85213-af64-d0e0-9b00-123456abcdef","status":"Active","employee_number":20,"first_name":"Jane","last_name":"Doe","full_name":"FAKE Doe, Jane","home_phone":"477-443-9650","is_owner":false,"is_child":true},\' +\n\t\t\t\'{"id":"11e85213-ac44-1830-9908-123456abcdef","status":"Active","employee_number":10,"first_name":"John","last_name":"Doe","full_name":"FAKE Doe, John","home_phone":"464-547-9452","is_owner":false,"is_child":true}]\' );\n\t\tthis.user_id_array = result_data;\n\t\tresult_data = this.processResultData( result_data );\n\t\tthis.grid.setData( result_data );\n\t\tthis.grid.setGridColumnsWidth();\n\t\tthis.current_edit_record = result_data[0];\n\t\tthis.setCurrentEditViewState( \'edit\' );\n\n\t\tTTPromise.add( \'Awesomeboxtest\', \'init\' );\n\t\tvar $this = this;\n\t\tTTPromise.wait( \'Awesomeboxtest\', \'init\', function() {\n\t\t\t$this.initEditView();\n\t\t} );\n\n\t\tthis.initEditViewUI( this.viewId, this.edit_view_tpl );\n\t}\n\n\tsetEditViewDataDone() {\n\t\tvar $this = this;\n\t\tsetTimeout( function() {\n\t\t\tTAlertManager.showConfirmAlert( $.i18n._( \'Run tests?\' ), null, function( result ) {\n\t\t\t\tif ( result == true ) {\n\t\t\t\t\t$this.runTests();\n\t\t\t\t}\n\t\t\t} );\n\t\t\t$this.setTabOVisibility( true );\n\t\t\t$( \'.edit-view-tab-bar\' ).css( \'opacity\', 1 );\n\t\t}, 2500 );\n\t}\n\n\t/**\n\t * in the testing code are a lot of null null waits to ensure that all awesomeboxes are ready for next step in test\n\t */\n\trunTests() {\n\t\tif ( $( \'#qunit_script\' ).length == 0 ) {\n\t\t\t$( \'