"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["portal-PortalBaseViewController","portal-header-HeaderUploadResumeWidget","portal-hr-recruitment-PortalJobVacancyRowController","portal-sign_in-PortalForgotPasswordController","portal-sign_in-PortalResetForgotPasswordController"],{1748:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"g\": () => (/* binding */ IndexViewController)\n/* harmony export */ });\n/* unused harmony export ApplicationRouter */\n/* harmony import */ var _views_portal_header_HeaderViewController__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3246);\n/* harmony import */ var _views_portal_PortalBaseViewController__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(97);\n/* harmony import */ var _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7526);\n/* harmony import */ var _global_TAlertManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9239);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\n\n\n\nclass ApplicationRouter extends Backbone.Router {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tcontroller: null,\n\t\t\theaderView: null,\n\t\t\troutes: {\n\t\t\t\t'': 'onViewChange',\n\t\t\t\t'!:viewName': 'onViewChange',\n\t\t\t\t'*notFound': 'notFound'\n\t\t\t}\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\treloadView( view_id ) {\n\t\t//error: Uncaught ReferenceError: XXXXViewController is not defined ininterface/html5/#!m=TimeSheet line 3\n\t\t// Happens when quickly click on context menu and network is slow.\n\t\tif ( eval( 'typeof '+ view_id + 'ViewController' ) === 'function' ) {\n\t\t\t_views_portal_PortalBaseViewController__WEBPACK_IMPORTED_MODULE_1__.PortalBaseViewController.loadView( view_id );\n\t\t}\n\t}\n\n\tnotFound( url ) {\n\t\tvar new_url = Global.getBaseURL();\n\n\t\tGlobal.setURLToBrowser( new_url + '#!m=PortalJobVacancy' );\n\t}\n\n\t/* jshint ignore:start */\n\tonViewChange( viewName ) {\n\t\tvar $this = this;\n\t\tvar args = {};\n\t\tvar view_id;\n\t\tvar edit_id;\n\t\tvar action;\n\n\t\tif ( Global.needReloadBrowser ) {\n\t\t\tGlobal.needReloadBrowser = false;\n\t\t\twindow.location.reload();\n\t\t\treturn;\n\t\t}\n\n\t\tif ( viewName ) {\n\t\t\targs = Global.buildArgDic( viewName.split( '&' ) );\n\t\t}\n\t\tif ( viewName && viewName.indexOf( 'm=' ) >= 0 ) {\n\t\t\tview_id = Global.sanitizeViewId( args.m );\n\t\t} else {\n\t\t\tview_id = 'PortalJobVacancy';\n\t\t}\n\n\t\tLocalCacheData.fullUrlParameterStr = viewName;\n\n\t\tLocalCacheData.setAllURLArgs( args );\n\n\t\tif ( LocalCacheData.getAllURLArgs() ) {\n\t\t\tif ( !LocalCacheData.getAllURLArgs().hasOwnProperty( 'company_id' ) ) {\n\t\t\t\tTTPromise.add( 'IndexController', 'onViewChange' );\n\t\t\t\tTTPromise.wait( null, null, function() {\n\t\t\t\t\tif ( IndexViewController && IndexViewController.instance && IndexViewController.instance.router ) {\n\t\t\t\t\t\tIndexViewController.instance.router.showTipModal( $.i18n._( 'Invalid Company' ) );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_global_TAlertManager__WEBPACK_IMPORTED_MODULE_3__/* .TAlertManager.showAlert */ .K.showAlert( $.i18n._( 'Invalid Company' ) );\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tsetTimeout( function() {\n\t\t\t\t\t//Ensure that the error is shown in a relatively timely fashion AFTER the framework needed to render properly is loaded.\n\t\t\t\t\tTTPromise.resolve( 'IndexController', 'onViewChange' );\n\t\t\t\t}, 4000 );\n\t\t\t}\n\t\t}\n\n\t\tedit_id = args.id;\n\n\t\taction = args.a;\n\n\t\tif ( LocalCacheData.current_open_view_id === view_id ) {\n\n\t\t\tif ( LocalCacheData.current_open_primary_controller ) {\n\n\t\t\t\tif ( action ) {\n\t\t\t\t\tswitch ( action ) {\n\t\t\t\t\t\tcase 'edit':\n\n\t\t\t\t\t\t\t//Error: Unable to get property 'id' of undefined or null reference in /interface/html5/IndexController.js?v=8.0.0-20141230-125406 line 87\n\t\t\t\t\t\t\tif ( !LocalCacheData.current_open_primary_controller.edit_view ||\n\t\t\t\t\t\t\t\t( LocalCacheData.current_open_primary_controller.current_edit_record &&\n\t\t\t\t\t\t\t\t\tLocalCacheData.current_open_primary_controller.current_edit_record.id != edit_id ) ) {\n\n\t\t\t\t\t\t\t\t//Makes ure when doing copy_as_new, don't open this\n\t\t\t\t\t\t\t\tif ( LocalCacheData.current_doing_context_action === 'edit' ) {\n\t\t\t\t\t\t\t\t\topenEditView( edit_id );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'new':\n\t\t\t\t\t\t\tif ( !LocalCacheData.current_open_primary_controller.edit_view ) {\n\t\t\t\t\t\t\t\topenEditView();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'view':\n\n\t\t\t\t\t\t\tswitch ( view_id ) {\n\t\t\t\t\t\t\t\tcase 'MessageControl':\n\t\t\t\t\t\t\t\t\tif ( args.t === 'message' ) {\n\t\t\t\t\t\t\t\t\t\tif ( !LocalCacheData.current_open_primary_controller.edit_view ||\n\t\t\t\t\t\t\t\t\t\t\t( !checkIds() ) ) {\n\t\t\t\t\t\t\t\t\t\t\topenEditView( edit_id, true );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t} else if ( args.t === 'request' ) {\n\t\t\t\t\t\t\t\t\t\tif ( !LocalCacheData.current_open_primary_controller.edit_view ||\n\t\t\t\t\t\t\t\t\t\t\t( LocalCacheData.current_open_primary_controller.current_select_message_control_data.id != edit_id ) ) {\n\t\t\t\t\t\t\t\t\t\t\topenEditView( edit_id, true );\n\t\t\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\tbreak;\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\tif ( !LocalCacheData.current_open_primary_controller.edit_view ||\n\t\t\t\t\t\t\t\t\t\t( LocalCacheData.current_open_primary_controller.current_edit_record.id != edit_id ) ) {\n\t\t\t\t\t\t\t\t\t\topenEditView( edit_id, true );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\tif ( LocalCacheData.current_open_primary_controller.edit_view &&\n\t\t\t\t\t\tLocalCacheData.current_open_primary_controller.current_edit_record ) {\n\n\t\t\t\t\t\tif ( LocalCacheData.current_open_primary_controller.viewId === 'TimeSheet' ) {\n\t\t\t\t\t\t\tif ( LocalCacheData.current_open_primary_controller.is_mass_editing ) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tLocalCacheData.current_open_primary_controller.buildContextMenu( true );\n\t\t\t\t\t\tLocalCacheData.current_open_primary_controller.removeEditView();\n\t\t\t\t\t\tthis.cleanAnySubViewUI();\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t\treturn;\n\n\t\t} else {\n\t\t\tLocalCacheData.edit_id_for_next_open_view = edit_id;\n\n\t\t\tif ( action ) {\n\t\t\t\tLocalCacheData.current_doing_context_action = action;\n\t\t\t}\n\n\t\t\tswitch ( view_id ) {\n\t\t\t\tcase 'TimeSheet':\n\t\t\t\tcase 'Schedule':\n\t\t\t\t\tif ( args.date ) {\n\t\t\t\t\t\tLocalCacheData.current_select_date = args.date;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t}\n\n\t\tvar timeout_count;\n\t\ttimeout_count = 0;\n\t\tif ( LocalCacheData.loadViewRequiredJSReady ) {\n\t\t\tshowRibbonMenuAndLoadView();\n\t\t} else {\n\t\t\tvar auto_login_timer = setInterval( function() {\n\t\t\t\tif ( timeout_count == 100 ) {\n\t\t\t\t\tclearInterval( auto_login_timer );\n\t\t\t\t}\n\t\t\t\ttimeout_count = timeout_count + 1;\n\t\t\t\tif ( LocalCacheData.loadViewRequiredJSReady ) {\n\t\t\t\t\tshowRibbonMenuAndLoadView();\n\t\t\t\t\tclearInterval( auto_login_timer );\n\t\t\t\t}\n\t\t\t}, 600 );\n\t\t}\n\n\t\tfunction showRibbonMenuAndLoadView() {\n\n\t\t\tIndexViewController.autoLogin( function() {\n\t\t\t\t$( 'body' ).removeClass( 'login-bg' );\n\t\t\t\t// Global.loadStyleSheet( '../../theme/default/portal/css/portal.css' + '?v=' + APIGlobal.pre_login_data.application_build ); // Trialling the loading of this stylesheet earlier, in portal-styles.js to aid with loading screen styling.\n\t\t\t\tGlobal.loadStyleSheet( '../../framework/bootstrap-select/css/bootstrap-select.min.css' + '?v=' + APIGlobal.pre_login_data.application_build );\n\t\t\t\t// $( 'link[title=\"application css\"]' ).prop( 'disabled', true ); // no longer needed as application.css not loaded now. See the lines above on portal.css. Or for context see #2833 and 65ae7d9c1bf7f9e6102e1faf43a989060416fa99\n\t\t\t\tif ( !$this.headerView ) {\n\t\t\t\t\t$this.headerView = new _views_portal_header_HeaderViewController__WEBPACK_IMPORTED_MODULE_0__.HeaderViewController();\n\t\t\t\t\t$( '#topContainer' ).html( $this.headerView.el );\n\t\t\t\t\tloadViewController();\n\t\t\t\t} else {\n\t\t\t\t\tif ( $this.headerView.profileView && $this.headerView.profileView.is_changed ) {\n\t\t\t\t\t\t$this.showConfirmModal( $.i18n._( 'You have modified data without saving, are you sure you want to continue and lose your changes' ), {\n\t\t\t\t\t\t\ttitle: '',\n\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tlabel: \"No\", isClose: true, callBack: function( e ) {\n\t\t\t\t\t\t\t\t\t\t$this.navigate( '#!m=MyProfile&company_id=' + LocalCacheData.getAllURLArgs().company_id, {\n\t\t\t\t\t\t\t\t\t\t\ttrigger: false,\n\t\t\t\t\t\t\t\t\t\t\treplace: true\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\treturn;\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\t{\n\t\t\t\t\t\t\t\t\tlabel: 'Yes', callBack: function( e ) {\n\t\t\t\t\t\t\t\t\t\t$this.hideConfirmModal();\n\t\t\t\t\t\t\t\t\t\theaderRender();\n\t\t\t\t\t\t\t\t\t\tloadViewController();\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\treturn;\n\t\t\t\t\t} else {\n\t\t\t\t\t\theaderRender();\n\t\t\t\t\t\tloadViewController();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\tfunction headerRender() {\n\t\t\t$this.headerView.jobVacancyViewController = null;\n\t\t\t$this.headerView.profileView = null;\n\t\t\t$this.headerView.render();\n\t\t}\n\n\t\tfunction loadViewController() {\n\t\t\tsetTimeout( function() {\n\t\t\t\tGlobal.topContainer().css( 'display', 'block' );\n\t\t\t\tGlobal.bottomContainer().css( 'display', 'block' );\n\n\t\t\t\tGlobal.showPoweredBy();\n\t\t\t}.bind(this), 50 );\n\n\t\t\tGlobal.loadViewSource( view_id, view_id + 'ViewController.js', function() {\n\t\t\t\t_views_portal_PortalBaseViewController__WEBPACK_IMPORTED_MODULE_1__.PortalBaseViewController.loadView( view_id );\n\t\t\t} );\n\t\t}\n\n\t\tfunction checkIds() {\n\n\t\t\tif ( Global.isArray( LocalCacheData.current_open_primary_controller.current_edit_record ) ) {\n\t\t\t\tfor ( var i = 0; i < LocalCacheData.current_open_primary_controller.current_edit_record.length; i++ ) {\n\t\t\t\t\tvar item = LocalCacheData.current_open_primary_controller.current_edit_record[i];\n\n\t\t\t\t\tif ( item.id === edit_id ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\titem = LocalCacheData.current_open_primary_controller.current_edit_record;\n\t\t\t\tif ( item.id === edit_id ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tfunction openEditView( edit_id, view_mode ) {\n\t\t\tvar type;\n\t\t\tswitch ( view_id ) {\n\t\t\t\tcase 'MessageControl':\n\t\t\t\t\ttype = args.t;\n\t\t\t\t\tvar item = {};\n\t\t\t\t\tif ( type === 'message' ) {\n\t\t\t\t\t\titem.id = edit_id;\n\t\t\t\t\t} else {\n\t\t\t\t\t\titem.object_id = edit_id;\n\t\t\t\t\t\titem.object_type_id = 50;\n\t\t\t\t\t}\n\t\t\t\t\tLocalCacheData.current_open_primary_controller.onViewClick( item );\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'TimeSheet':\n\t\t\t\t\ttype = args.t;\n\n\t\t\t\t\tif ( !view_mode ) {\n\t\t\t\t\t\tif ( edit_id ) {\n\t\t\t\t\t\t\tLocalCacheData.current_open_primary_controller.onEditClick( edit_id, type );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tLocalCacheData.current_open_primary_controller.onAddClick();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ( edit_id ) {\n\t\t\t\t\t\t\tLocalCacheData.current_open_primary_controller.onViewClick( edit_id, type );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\n\t\t\t\t\tif ( !view_mode ) {\n\t\t\t\t\t\tif ( edit_id ) {\n\t\t\t\t\t\t\tLocalCacheData.current_open_primary_controller.onEditClick( edit_id );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tLocalCacheData.current_open_primary_controller.onAddClick();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ( edit_id ) {\n\t\t\t\t\t\t\tLocalCacheData.current_open_primary_controller.onViewClick( edit_id );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t}\n\n\t/* jshint ignore:end */\n\n\tcleanAnySubViewUI() {\n\t\tvar children = Global.contentContainer().children();\n\n\t\tif ( children.length > 1 ) {\n\t\t\tfor ( var i = 1; i < children.length; i++ ) {\n\t\t\t\t// Object doesn't support property or method 'remove', Not sure why, add try catch to ingore this error since this should no harm\n\t\t\t\ttry {\n\n\t\t\t\t\tif ( $( children[i] ).attr( 'id' ) === LocalCacheData.current_open_primary_controller.ui_id ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tchildren[i].remove();\n\t\t\t\t\t}\n\n\t\t\t\t} catch ( e ) {\n\t\t\t\t\t//Do nothing\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\n\tsetContentDivHeight() {\n\t\tGlobal.contentContainer().removeClass( 'content-container' );\n\t\tGlobal.contentContainer().addClass( 'content-container-after-login' );\n\t\tGlobal.topContainer().addClass( 'top-container-after-login' );\n\n\t}\n\n\taddTopMenu() {\n\t\tGlobal.loadScript( 'global/widgets/top_menu/TopMenuController.js' );\n\t\tif ( TopMenuController ) {\n\t\t\tTopMenuController.loadView();\n\t\t}\n\n\t}\n\n\tshowFormModal( element, options ) {\n\t\tvar $this = this;\n\t\tif ( $( '#formModal' ).is( ':visible' ) ) {\n\t\t\tthis.hideFormModal();\n\t\t\tsetTimeout( function() {\n\t\t\t\tdoNext();\n\t\t\t}, 500 );\n\t\t} else {\n\t\t\tdoNext();\n\t\t}\n\n\t\tfunction doNext() {\n\t\t\t!options && ( options = { title: '...', actions: [] } );\n\t\t\tif ( $( '#formModal' ).length > 0 ) {\n\t\t\t\t$( '#formModal' ).modal( {\n\t\t\t\t\tbackdrop: 'static',\n\t\t\t\t\tshow: true\n\t\t\t\t} );\n\t\t\t}\n\t\t\t$( '#formModalLabel' ).text( options.title );\n\t\t\t$( '#formModalBody' ).html( element );\n\t\t\tif ( options.actions.length > 0 ) {\n\t\t\t\t$( '#formModalFooter' ).empty();\n\t\t\t\t_.each( options.actions, function( item ) {\n\t\t\t\t\tvar button = $( '' );\n\t\t\t\t\titem.isClose && button.attr( 'data-dismiss', 'modal' );\n\t\t\t\t\tbutton.text( item.label );\n\t\t\t\t\titem.class && ( button.addClass( item.class ) );\n\t\t\t\t\t!item.class && button.addClass( 'btn-primary' );\n\t\t\t\t\tif ( item.callBack ) {\n\t\t\t\t\t\tif ( item.isClose ) {\n\t\t\t\t\t\t\t$( '#formModal' ).find( 'button.close' ).unbind( 'click' ).bind( 'click', item.callBack.bind( self ) );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbutton.unbind( 'click' ).bind( 'click', item.callBack.bind( self ) );\n\t\t\t\t\t}\n\t\t\t\t\t$( '#formModalFooter' ).append( button );\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t}\n\n\tshowTipModal( element, options ) {\n\t\tvar $this = this;\n\t\tif ( $( '#tipModal' ).is( ':visible' ) ) {\n\t\t\tthis.hideTipModal();\n\t\t\tsetTimeout( function() {\n\t\t\t\tdoNext();\n\t\t\t}, 500 );\n\t\t} else {\n\t\t\tdoNext();\n\t\t}\n\n\t\tfunction doNext() {\n\t\t\t!options && ( options = { title: '...', actions: [], style: {} } );\n\t\t\t$( '#tipModal' ).find( '.modal-content' ).css( options.style );\n\t\t\tif ( $( '#tipModal' ).length > 0 ) {\n\t\t\t\t$( '#tipModal' ).modal( 'show' );\n\t\t\t}\n\t\t\t$( '#tipModalBody' ).html( element );\n\t\t\t$this.autoHideTipModal();\n\t\t}\n\t}\n\n\tshowConfirmModal( element, options ) {\n\t\tvar $this = this;\n\t\tif ( $( '#confirmModal' ).is( ':visible' ) ) {\n\t\t\tthis.hideConfirmModal();\n\t\t\tsetTimeout( function() {\n\t\t\t\tdoNext();\n\t\t\t}, 500 );\n\t\t} else {\n\t\t\tdoNext();\n\t\t}\n\n\t\tfunction doNext() {\n\t\t\t!options && ( options = { title: '...', actions: [] } );\n\t\t\tif ( $( '#confirmModal' ).length > 0 ) {\n\t\t\t\t$( '#confirmModal' ).modal( {\n\t\t\t\t\tbackdrop: 'static',\n\t\t\t\t\tshow: true\n\t\t\t\t} );\n\t\t\t}\n\t\t\t$( '#confirmModalLabel' ).text( options.title );\n\t\t\t$( '#confirmModalBody' ).html( element );\n\t\t\tif ( options.actions.length > 0 ) {\n\t\t\t\t$( '#confirmModalFooter' ).empty();\n\t\t\t\t_.each( options.actions, function( item ) {\n\t\t\t\t\tvar button = $( '' );\n\t\t\t\t\titem.isClose && button.attr( 'data-dismiss', 'modal' );\n\t\t\t\t\tbutton.text( item.label );\n\t\t\t\t\titem.class && ( button.addClass( item.class ) );\n\t\t\t\t\t!item.class && button.addClass( 'btn-primary' );\n\t\t\t\t\tif ( item.callBack ) {\n\t\t\t\t\t\tbutton.unbind( 'click' ).bind( 'click', item.callBack.bind( self ) );\n\t\t\t\t\t}\n\t\t\t\t\t$( '#confirmModalFooter' ).append( button );\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t}\n\n\tshowSignInModal( element, options ) {\n\t\tvar $this = this;\n\t\tif ( $( '#signinModal' ).is( ':visible' ) ) {\n\t\t\tthis.hideSignInModal();\n\t\t\tsetTimeout( function() {\n\t\t\t\tdoNext();\n\t\t\t}, 500 );\n\t\t} else {\n\t\t\tdoNext();\n\t\t}\n\n\t\tfunction doNext() {\n\t\t\t!options && ( options = { title: '...', actions: [] } );\n\t\t\tif ( $( '#signinModal' ).length > 0 ) {\n\t\t\t\t$( '#signinModal' ).modal( {\n\t\t\t\t\tbackdrop: 'static',\n\t\t\t\t\tshow: true\n\t\t\t\t} );\n\t\t\t}\n\t\t\t$( '#signinModalLabel' ).text( options.title );\n\t\t\t$( '#signinModalBody' ).html( element );\n\t\t\tif ( options.actions.length > 0 ) {\n\t\t\t\t$( '#signinModalFooter' ).empty();\n\t\t\t\t_.each( options.actions, function( item ) {\n\t\t\t\t\tvar button = $( '' );\n\t\t\t\t\titem.isClose && button.attr( 'data-dismiss', 'modal' );\n\t\t\t\t\tbutton.text( item.label );\n\t\t\t\t\titem.class && ( button.addClass( item.class ) );\n\t\t\t\t\t!item.class && button.addClass( 'btn-primary' );\n\t\t\t\t\tif ( item.callBack ) {\n\t\t\t\t\t\tif ( item.isClose ) {\n\t\t\t\t\t\t\t$( '#signinModal' ).find( 'button.close' ).unbind( 'click' ).bind( 'click', item.callBack.bind( self ) );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbutton.unbind( 'click' ).bind( 'click', item.callBack.bind( self ) );\n\t\t\t\t\t}\n\t\t\t\t\t$( '#signinModalFooter' ).append( button );\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t}\n\n\tautoHideTipModal() {\n\t\tvar $this = this;\n\t\tsetTimeout( function() {\n\t\t\t$this.hideTipModal();\n\t\t}, 5000 );\n\t}\n\n\thideTipModal() {\n\t\t$( '#tipModal' ).modal( 'hide' );\n\t}\n\n\thideFormModal() {\n\t\t$( '#formModal' ).modal( 'hide' );\n\t}\n\n\thideSignInModal() {\n\t\t$( '#signinModal' ).modal( 'hide' );\n\t}\n\n\thideConfirmModal() {\n\t\t$( '#confirmModal' ).modal( 'hide' );\n\t}\n\n\tremoveCurrentView( callBack ) {\n\t\tif ( LocalCacheData.current_open_edit_only_controller ) {\n\t\t\tclean( LocalCacheData.current_open_edit_only_controller );\n\t\t\tLocalCacheData.current_open_edit_only_controller = null;\n\t\t}\n\n\t\tif ( LocalCacheData.current_open_primary_controller ) {\n\t\t\tif ( LocalCacheData.current_open_primary_controller.edit_view ) {\n\t\t\t\tclean( LocalCacheData.current_open_primary_controller );\n\t\t\t}\n\t\t\tGlobal.contentContainer().empty();\n\t\t\tLocalCacheData.current_open_primary_controller.cleanWhenUnloadView( callBack );\n\t\t} else {\n\n\t\t\tif ( Global.isSet( callBack ) ) {\n\t\t\t\tcallBack();\n\t\t\t}\n\t\t}\n\n\t\tfunction clean( viewController ) {\n\t\t\tviewController.clearErrorTips();\n\t\t\t// Cannot read property 'remove' of null in interface/html5/IndexController.js?v=9.0.0-20151016-153057 line 439\n\t\t\tif ( viewController.edit_view ) {\n\t\t\t\tviewController.edit_view.remove();\n\t\t\t}\n\t\t\tviewController.sub_log_view_controller = null;\n\t\t\tviewController.edit_view_ui_dic = {};\n\t\t\tviewController.edit_view_ui_validation_field_dic = {};\n\t\t\tviewController.edit_view_form_item_dic = {};\n\t\t\tviewController.edit_view_error_ui_dic = {};\n\t\t\tLocalCacheData.current_doing_context_action = '';\n\t\t}\n\t}\n\n}\n\nclass IndexViewController extends Backbone.View {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: 'body', //So we can add event listener for all elements\n\t\t\trouter: null,\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinitialize( options ) {\n\t\tthis.router = new ApplicationRouter();\n\n\t\t//Set title in index.php instead.\n\t\t//$( 'title' ).html( '' );\n\n\t\tthis.router.controller = this;\n\t\t//Error: Backbone.history has already been started in interface/html5/framework/backbone/backbone-min.js?v=9.0.1-20151022-162110 line 28\n\t\tif ( !Backbone.History.started ) {\n\t\t\tBackbone.history.start();\n\t\t}\n\n\t\tIndexViewController.instance = this;\n\n\t}\n\n}\n\nIndexViewController.autoLogin = function( callback ) {\n\tvar session_cookie = getCookie( Global.getSessionIDKey() );\n\tvar login_data = LocalCacheData.getLoginData();\n\tif ( session_cookie && session_cookie.length >= 40 && login_data && login_data.is_logged_in == true ) {\n\t\t//Setup user data when browser is refreshed and they are already logged in.\n\t\tIndexViewController.setPortalLoginUserData( session_cookie, callback );\n\t} else {\n\t\tcallback();\n\t}\n};\n\nIndexViewController.setPortalLoginUserData = function( session_id, callback ) {\n\t//Setup Job Appicant data upon login.\n\tif ( LocalCacheData.getPortalLoginUser() === null ) {\n\t\tvar $this = this;\n\n\t\tLocalCacheData.setSessionID( session_id );\n\t\tsetCookie( Global.getSessionIDKey(), session_id );\n\n\t\tthis.doing_login = true;\n\n\t\tthis.jobapplicant_api = _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_2__/* .TTAPI.APIJobApplicantPortal */ .y.APIJobApplicantPortal;\n\t\tthis.jobapplicant_api.getJobApplicant( {\n\t\t\tonResult: function( result ) {\n\t\t\t\tif ( result.isValid() ) {\n\t\t\t\t\tLocalCacheData.setPortalLoginUser( result.getResult()[0] );\n\t\t\t\t}\n\n\t\t\t\t$this.doing_login = false;\n\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t} else {\n\t\tcallback();\n\t}\n};\n\nIndexViewController.goToView = function( view_name, filter ) {\n\n\t$( '#' + view_name ).addClass( 'selected-menu' );\n\tLocalCacheData.default_filter_for_next_open_view = filter;\n\n\t// TopMenuManager.goToView( view_name, true );\n\tMenuManager.goToView( view_name, true );\n\n};\n\nIndexViewController.goToViewByViewLabel = function( view_label ) {\n\tvar view_name;\n\tswitch ( view_label ) {\n\t\tcase 'Exceptions':\n\t\t\tview_name = 'Exception';\n\t\t\tbreak;\n\t\tcase 'Messages':\n\t\t\tview_name = 'MessageControl';\n\t\t\tbreak;\n\t\tcase 'Requests':\n\t\t\tview_name = 'Request';\n\t\t\tbreak;\n\t\tcase 'Contact Information':\n\t\t\tIndexViewController.openEditView( LocalCacheData.current_open_primary_controller, 'LoginUserContact' );\n\t\t\treturn;\n\t\tdefault:\n\t\t\tvar reg = /\\s/g;\n\t\t\tview_name = view_label.replace( reg, '' );\n\t\t\tbreak;\n\t}\n\n\tMenuManager.goToView( view_name, true );\n\n};\n\nIndexViewController.openWizard = function( wizardName, defaultData, callBack ) {\n\tBaseWizardController.default_data = defaultData;\n\tBaseWizardController.call_back = callBack;\n\tswitch ( wizardName ) {\n\t\tdefault:\n\t\t\t// track edit view only view\n\t\t\tGlobal.trackView( wizardName );\n\t\t\tGlobal.loadViewSource( wizardName, wizardName + 'Controller.js', function() {\n\t\t\t\tBaseWizardController.openWizard( wizardName, wizardName + '.html' );\n\t\t\t} );\n\t\t\tbreak;\n\t}\n\n};\n\nIndexViewController.openReport = function( parent_view_controller, view_name, id ) {\n\tvar view_controller = null;\n\n\tif ( LocalCacheData.current_open_report_controller ) {\n\t\tLocalCacheData.current_open_report_controller.removeEditView();\n\t}\n\n\tProgressBar.showOverlay();\n\n\tswitch ( view_name ) {\n\t\tdefault:\n\t\t\tGlobal.loadViewSource( view_name, view_name + 'ViewController.js', function() {\n\t\t\t\t/* jshint ignore:start */\n\t\t\t\tview_controller = eval( 'new ' + view_name + 'ViewController( {edit_only_mode: true} ); ' );\n\t\t\t\t/* jshint ignore:end */\n\t\t\t\tview_controller.parent_view_controller = parent_view_controller;\n\t\t\t\tview_controller.openEditView();\n\n\t\t\t\tvar current_url = window.location.href;\n\t\t\t\tif ( current_url.indexOf( '&sm' ) > 0 ) {\n\t\t\t\t\tcurrent_url = current_url.substring( 0, current_url.indexOf( '&sm' ) );\n\t\t\t\t}\n\t\t\t\tcurrent_url = current_url + '&sm=' + view_name;\n\n\t\t\t\tif ( LocalCacheData.default_edit_id_for_next_open_edit_view ) {\n\t\t\t\t\tcurrent_url = current_url + '&sid=' + LocalCacheData.default_edit_id_for_next_open_edit_view;\n\t\t\t\t}\n\t\t\t\tGlobal.setURLToBrowser( current_url );\n\n\t\t\t} );\n\t\t\tbreak;\n\t}\n\n};\n\n//Open edit view\nIndexViewController.openEditView = function( parent_view_controller, view_name, id ) {\n\tvar view_controller = null;\n\n\tif ( !PermissionManager.checkTopLevelPermission( view_name ) && view_name !== 'map' ) {\n\t\t_global_TAlertManager__WEBPACK_IMPORTED_MODULE_3__/* .TAlertManager.showAlert */ .K.showAlert( 'Permission denied' );\n\t\treturn;\n\t}\n\n\t//Merge conflict from RecruitmentPortal. This seemed to have removed the permission check, but that would break the application UI?\n\t//if ( LocalCacheData.current_open_edit_only_controller ) {\n\t//\tLocalCacheData.current_open_edit_only_controller.onCancelClick();\n\t//}\n\n\t// track edit view only view\n\tGlobal.trackView( view_name );\n\n\tswitch ( view_name ) {\n\n\t\tdefault:\n\t\t\tGlobal.loadViewSource( view_name, view_name + 'ViewController.js', function() {\n\t\t\t\t/* jshint ignore:start */\n\t\t\t\tview_controller = eval( 'new ' + view_name + 'ViewController( {edit_only_mode: true} ); ' );\n\t\t\t\t/* jshint ignore:end */\n\t\t\t\tview_controller.parent_view_controller = parent_view_controller;\n\t\t\t\tview_controller.openEditView( id );\n\n\t\t\t\tvar current_url = window.location.href;\n\t\t\t\tif ( current_url.indexOf( '&sm' ) > 0 ) {\n\t\t\t\t\tcurrent_url = current_url.substring( 0, current_url.indexOf( '&sm' ) );\n\t\t\t\t}\n\t\t\t\tif ( id ) {\n\t\t\t\t\tcurrent_url = current_url + '&sm=' + view_name + '&sid=' + id;\n\t\t\t\t} else {\n\t\t\t\t\tcurrent_url = current_url + '&sm=' + view_name;\n\t\t\t\t}\n\n\t\t\t\tGlobal.setURLToBrowser( current_url );\n\n\t\t\t\tLocalCacheData.current_open_edit_only_controller = view_controller;\n\n\t\t\t} );\n\t\t\tbreak;\n\n\t}\n\n};\n\nIndexViewController.instance = null;//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTc0OC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQWtGO0FBQ0M7QUFDOUI7QUFDRTs7QUFFaEQ7QUFDUCwyQkFBMkI7QUFDM0IsRUFBRSxDQUFDO0FBQ0g7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxJQUFJOztBQUVKO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ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N1cnJlbnRfdXJsLnN1YnN0cmluZyggMCwgY3VycmVudF91cmwuaW5kZXhPZiggJyZzbScgKSApO1xuXHRcdFx0XHR9XG5cdFx0XHRcdGlmICggaWQgKSB7XG5cdFx0XHRcdFx0Y3VycmVudF91cmwgPSBjdXJyZW50X3VybCArICcmc209JyArIHZpZXdfbmFtZSArICcmc2lkPScgKyBpZDtcblx0XHRcdFx0fSBlbHNlIHtcblx0XHRcdFx0XHRjdXJyZW50X3VybCA9IGN1cnJlbnRfdXJsICsgJyZzbT0nICsgdmlld19uYW1lO1xuXHRcdFx0XHR9XG5cblx0XHRcdFx0R2xvYmFsLnNldFVSTFRvQnJvd3NlciggY3VycmVudF91cmwgKTtcblxuXHRcdFx0XHRMb2NhbENhY2hlRGF0YS5jdXJyZW50X29wZW5fZWRpdF9vbmx5X2NvbnRyb2xsZXIgPSB2aWV3X2NvbnRyb2xsZXI7XG5cblx0XHRcdH0gKTtcblx0XHRcdGJyZWFrO1xuXG5cdH1cblxufTtcblxuSW5kZXhWaWV3Q29udHJvbGxlci5pbnN0YW5jZSA9IG51bGw7Il0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///1748\n")},97:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"PortalBaseViewController\": () => (/* binding */ PortalBaseViewController)\n/* harmony export */ });\n/* harmony import */ var bootstrap_select__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(300);\n/* harmony import */ var bootstrap_select__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bootstrap_select__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _views_TTBackboneView__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6739);\n/* harmony import */ var _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7526);\n/* harmony import */ var _portal_recruitment_IndexController__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1748);\n/* harmony import */ var _views_portal_hr_recruitment_PortalJobVacancyRowController__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1730);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\n\n // For the reference in the html file PortalJobVacancyView.html loaded from this file.\n\n\nclass PortalBaseViewController extends _views_TTBackboneView__WEBPACK_IMPORTED_MODULE_1__.TTBackboneView {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tcan_cache_controller: true, //if allow to cache current controller\n\t\t\tpager_data: null,\n\t\t\t// required_files: [],\n\n\t\t\tevents: {\n\t\t\t\t'click .search-btn': 'onSearchClick',\n\t\t\t\t'change select[id=\"country\"]': 'onCountryChange',\n\t\t\t\t// 'click .more': 'loadMore'\n\t\t\t\t// 'click .styled-select .glyphicon': 'onSelectClick',\n\t\t\t\t'keydown input[id=\"name\"]': 'autoSearch',\n\t\t\t\t// 'change select[id=\"province\"]': 'onSearchClick',\n\t\t\t\t'keydown input[id=\"city\"]': 'autoSearch'\n\t\t\t}\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinitialize( options ) {\n\t\tsuper.initialize( options );\n\n\t\tthis.preInit( options );\n\n\t\t// __non_webpack_require__( this.getRequiredFiles(), function() {\n\t\tthis.company_api = _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_2__/* .TTAPI.APICompanyPortal */ .y.APICompanyPortal;\n\t\tLocalCacheData.current_open_primary_controller = this;\n\t\tthis.init();\n\t\tthis.postInit( options );\n\t\t// } );\n\t}\n\n\t// getRequiredFiles() {\n\t// \t//override in child class\n\t// \treturn this.required_files.concat( this._required_files );\n\t// }\n\n\tpreInit() {\n\t\t//Override in child class.\n\t\treturn;\n\t}\n\n\tinit() {\n\t\t//Override in child class.\n\t\treturn;\n\t}\n\n\tpostInit() {\n\t\t//Override in child class.\n\t\treturn;\n\t}\n\n\trender() {\n\t\tvar $this = this;\n\t\tProgressBar.showOverlay();\n\t\tthis.initOptions( function() {\n\t\t\t$this.search();\n\t\t} );\n\n\t\t$( window ).off( 'scroll' ).on( 'scroll', Global.debounce( function() {\n\t\t\tif ( $this.isOnScreen( '.more.container' ) ) {\n\t\t\t\t$this.loadMore();\n\t\t\t}\n\t\t}, 200 ) );\n\t}\n\n\tisOnScreen( element_id ) {\n\t\tlet element = $( element_id );\n\n\t\tif ( element.length === 0 || !element.is( ':visible' ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tlet bounding = element[0].getBoundingClientRect();\n\n\t\tif ( bounding.top >= 0 && bounding.left >= 0 && bounding.right <= ( window.innerWidth || document.documentElement.clientWidth ) && bounding.bottom <= ( window.innerHeight || document.documentElement.clientHeight ) ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tautoSearch( e ) {\n\t\tif ( e.keyCode === 13 ) {\n\t\t\tthis.onSearchClick();\n\t\t}\n\t}\n\n\tinitOptions( callback ) {\n\t\tthis.initCountryOptions( callback );\n\t}\n\n\tinitCountryOptions( callback ) {\n\t\tvar $this = this;\n\t\tthis.company_api.getOptions( 'country', {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar result = result.getResult();\n\t\t\t\t$this.$( '#country' ).append( $( '' ).prop( 'value', '' ).attr( 'selected', 'selected' ).text( $.i18n._( 'All Countries' ) ) );\n\t\t\t\t$.each( result, function( value, label ) {\n\t\t\t\t\t$this.$( '#country' ).append( $( '' ).prop( 'value', value ).text( $.i18n._( label ) ) );\n\t\t\t\t} );\n\t\t\t\t$this.$( '#country' ).selectpicker();\n\t\t\t\t$this.$( '#province' ).selectpicker();\n\t\t\t\tcallback();\n\t\t\t}\n\t\t} );\n\t}\n\n\tonCountryChange() {\n\t\tthis.eSetProvince( this.$( 'select[id=\"country\"]' ).val() );\n\t}\n\n\teSetProvince( val ) {\n\t\tvar $this = this;\n\t\t$this.$( '#province' ).selectpicker( 'destroy' );\n\t\tif ( !val ) {\n\t\t\t$this.$( '#province' ).html( $( '' ).prop( 'value', '' ).attr( 'selected', 'selected' ).text( $.i18n._( 'All Province/States' ) ) );\n\t\t\t$this.$( '#province' ).selectpicker();\n\t\t\treturn;\n\t\t}\n\t\tthis.company_api.getOptions( 'province', val, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tresult = result.getResult();\n\t\t\t\tif ( !result ) {\n\t\t\t\t\tresult = [];\n\t\t\t\t}\n\t\t\t\t$this.$( '#province' ).html( $( '' ).prop( 'value', '' ).attr( 'selected', 'selected' ).text( $.i18n._( 'All Province/States' ) ) );\n\t\t\t\t$.each( result, function( value, label ) {\n\t\t\t\t\t$this.$( '#province' ).append( $( '' ).prop( 'value', value ).text( $.i18n._( label ) ) );\n\t\t\t\t} );\n\t\t\t\t$this.$( '#province' ).selectpicker();\n\t\t\t}\n\t\t} );\n\t}\n\n\tloadMore() {\n\t\tthis.onSearchClick( {\n\t\t\tpage_action: 'next'\n\t\t} );\n\t}\n\n\taddSearchResultPanel() {\n\t}\n\n\tonSearchClick( options ) {\n\t\tvar $this = this;\n\t\tvar filter = {};\n\t\tthis.addSearchResultPanel();\n\t\t// first load\n\t\tif ( typeof options == 'undefined' ) {\n\t\t\toptions = {};\n\t\t}\n\t\tif ( typeof options.page_action == 'undefined' ) {\n\t\t\tthis.$( '.search-result .content' ).empty();\n\t\t}\n\t\tthis.vacancy_list_panel = this.$( '.search-result .content' );\n\t\tthis.more_btn = this.$( '.search-result .more' );\n\t\tthis.more_btn.unbind( 'click' ).bind( 'click', function() {\n\t\t\t$this.loadMore();\n\t\t} );\n\t\tfilter.filter_data = {};\n\t\tfilter.filter_sort = {};\n\t\tfilter.filter_items_per_page = 0; // Default to 0 to load user preference defined\n\t\t// if ( this.$('#job_title_id').val() && parseInt( this.$('#job_title_id').val() ) > 0 ) {\n\t\t// \tfilter.filter_data['title_id'] = this.$('#job_title_id').val();\n\t\t// }\n\t\tif ( this.$( '#name' ).val() && this.$( '#name' ).val() != '' ) {\n\t\t\tfilter.filter_data['name'] = this.$( '#name' ).val();\n\t\t}\n\t\tif ( this.$( '#country' ).val() && this.$( '#country' ).val() != '' ) {\n\t\t\tfilter.filter_data['country'] = this.$( '#country' ).val();\n\t\t}\n\t\tif ( this.$( '#province' ).val() && this.$( '#province' ).val() != '' ) {\n\t\t\tfilter.filter_data['province'] = this.$( '#province' ).val();\n\t\t}\n\t\tif ( this.$( '#city' ).val() && this.$( '#city' ).val() != '' ) {\n\t\t\tfilter.filter_data['city'] = this.$( '#city' ).val();\n\t\t}\n\t\tif ( this.pager_data ) {\n\t\t\tif ( options.page_action === 'next' ) {\n\t\t\t\tfilter.filter_page = this.pager_data.next_page;\n\t\t\t} else {\n\t\t\t\tfilter.filter_page = 1;\n\t\t\t}\n\t\t} else {\n\t\t\tfilter.filter_page = 1;\n\t\t}\n\t\tthis.api['get' + this.api.key_name]( filter, false, { // paging or none\n\t\t\tonResult: function( result ) {\n\t\t\t\t$this.pager_data = result.getPagerData();\n\t\t\t\tvar result_data = result.getResult();\n\t\t\t\tvar no_result_panel = $this.vacancy_list_panel.find( '.vacancy-list-no-result' );\n\t\t\t\tif ( no_result_panel[0] || ( $this.pager_data && $this.pager_data.is_first_page ) ) {\n\t\t\t\t\t$this.vacancy_list_panel.empty();\n\t\t\t\t}\n\t\t\t\tif ( !Global.isArray( result_data ) ) {\n\t\t\t\t\tvar no_result_span = $( '