"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["JobApplicantLocationSubViewController","portal-hr-my_profile-JobApplicantSubBaseViewController","JobApplicantSubBaseViewController"],{8157:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"JobApplicantLocationSubViewController\": () => (/* binding */ JobApplicantLocationSubViewController)\n/* harmony export */ });\n/* harmony import */ var _views_portal_hr_my_profile_JobApplicantSubBaseViewController__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3757);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\nclass JobApplicantLocationSubViewController extends _views_portal_hr_my_profile_JobApplicantSubBaseViewController__WEBPACK_IMPORTED_MODULE_0__.JobApplicantSubBaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {} );\n\n\t\tsuper( options );\n\t}\n\n\tinitOptions() {\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.setSourceData( 'country', result, true );\n\t\t\t}\n\t\t} );\n\t}\n\n\tgetJobApplicantLocation( callback ) {\n\t\tvar $this = this;\n\t\tvar filter = {};\n\t\tfilter.filter_data = {};\n\t\tfilter.filter_data.id = this.model.id;\n\t\tthis.api['getJobApplicantLocation']( filter, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tif ( result.isValid() ) {\n\t\t\t\t\tvar result_data = result.getResult();\n\t\t\t\t\tif ( !result_data ) {\n\t\t\t\t\t\tresult_data = [];\n\t\t\t\t\t}\n\t\t\t\t\tresult_data = result_data[0];\n\t\t\t\t\t$this.model.set( result_data );\n\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\tcallback();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$this.showErrorAlert( result );\n\t\t\t\t\tProgressBar.closeOverlay();\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t}\n\n\tsetCurrentEditRecordData() {\n\t\tsuper.setCurrentEditRecordData();\n\t\tvar field_selector;\n\t\tvar field_control;\n\t\t//Set current edit record data to all widgets\n\t\tfor ( var key in this.model.attributes ) {\n\t\t\tif ( !this.model.has( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// if ( this.current_edit_record[key] === false ) {\n\t\t\t// \tthis.current_edit_record[key] = '';\n\t\t\t// }\n\t\t\tswitch ( key ) {\n\t\t\t\tcase 'country':\n\t\t\t\t\t// if ( this.current_edit_record[key] === false ) {\n\t\t\t\t\t// \tthis.current_edit_record[key] = '';\n\t\t\t\t\t// }\n\t\t\t\t\tfield_selector = 'select[name=\"' + key + '\"]';\n\t\t\t\t\tthis.$( field_selector ).val( this.model.get( key ) );\n\t\t\t\t\tif ( key === 'country' ) {\n\t\t\t\t\t\tthis.eSetProvince( this.model.get( key ) );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tif ( this.model.get( key ) === false ) {\n\t\t\t\t\t\tthis.model.set( key, '' );\n\t\t\t\t\t}\n\t\t\t\t\tfield_selector = '.form-control[name=\"' + key + '\"]';\n\t\t\t\t\tfield_control = this.$( field_selector );\n\t\t\t\t\tif ( field_control && field_control[0] ) {\n\t\t\t\t\t\tthis.$( field_selector ).val( this.model.get( key ) );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t}\n\t\t}\n\t\t// this.collectUIDataToCurrentEditRecord();\n\t\t// this.setEditViewDataDone();\n\t}\n\n\tonFormItemChange( e, doNotValidate ) {\n\t\tvar key = e.currentTarget.name;\n\t\tvar $this = this;\n\t\tthis.model.set( key, $( e.currentTarget ).val() );\n\t\t// switch ( key ) {\n\t\t// case 'country':\n\t\t// case 'identification_country':\n\t\t// \tvar widget = this.$('select[name=\"' + key + '\"]');\n\t\t// \twidget.val( null );\n\t\t// \tbreak;\n\t\t// case 'is_current_employer':\n\t\t// case 'is_contact_available':\n\t\t// \tif ( $(e.currentTarget).is(':checked' ) ) {\n\t\t// \t\tthis.model.set( key, true )\n\t\t// \t} else {\n\t\t// \t\tthis.model.set( key, false )\n\t\t// \t}\n\t\t// \tbreak;\n\t\t// }\n\t\tif ( key == 'country' ) {\n\t\t\tthis.eSetProvince( this.$( 'select[name=\"country\"]' ).val(), true, function() {\n\t\t\t\t$this.validate();\n\t\t\t} );\n\t\t\t// this.clearErrorTips();\n\t\t\treturn;\n\t\t}\n\t\tif ( !doNotValidate ) {\n\t\t\tthis.validate();\n\t\t}\n\t}\n\n\teSetProvince( val, refresh, callback ) {\n\t\tvar $this = this;\n\t\t$this.$( 'select[name=\"province\"]' ).selectpicker( 'destroy' );\n\t\tif ( !val || val === '-1' || val === '0' ) {\n\t\t\t$this.e_province_array = [];\n\t\t\t$this.setSourceData( 'province', [] );\n\t\t} else {\n\t\t\tthis.company_api.getOptions( 'province', val, {\n\t\t\t\tonResult: function( res ) {\n\t\t\t\t\tres = res.getResult();\n\t\t\t\t\tif ( !res ) {\n\t\t\t\t\t\tres = [];\n\t\t\t\t\t}\n\t\t\t\t\t$this.e_province_array = Global.buildRecordArray( res );\n\t\t\t\t\tif ( refresh && $this.e_province_array.length > 0 ) {\n\t\t\t\t\t\t$this.model.set( 'province', $this.e_province_array[0].value );\n\t\t\t\t\t\t$this.$( 'select[name=\"province\"]' ).val( $this.model.get( 'province' ) );\n\t\t\t\t\t}\n\t\t\t\t\t$this.setSourceData( 'province', res );\n\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\tcallback();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODE1Ny5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQW1IOztBQUU1Ryx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y5nZXRSZXN1bHQoKTtcblx0XHRcdFx0XHRpZiAoICFyZXMgKSB7XG5cdFx0XHRcdFx0XHRyZXMgPSBbXTtcblx0XHRcdFx0XHR9XG5cdFx0XHRcdFx0JHRoaXMuZV9wcm92aW5jZV9hcnJheSA9IEdsb2JhbC5idWlsZFJlY29yZEFycmF5KCByZXMgKTtcblx0XHRcdFx0XHRpZiAoIHJlZnJlc2ggJiYgJHRoaXMuZV9wcm92aW5jZV9hcnJheS5sZW5ndGggPiAwICkge1xuXHRcdFx0XHRcdFx0JHRoaXMubW9kZWwuc2V0KCAncHJvdmluY2UnLCAkdGhpcy5lX3Byb3ZpbmNlX2FycmF5WzBdLnZhbHVlICk7XG5cdFx0XHRcdFx0XHQkdGhpcy4kKCAnc2VsZWN0W25hbWU9XCJwcm92aW5jZVwiXScgKS52YWwoICR0aGlzLm1vZGVsLmdldCggJ3Byb3ZpbmNlJyApICk7XG5cdFx0XHRcdFx0fVxuXHRcdFx0XHRcdCR0aGlzLnNldFNvdXJjZURhdGEoICdwcm92aW5jZScsIHJlcyApO1xuXHRcdFx0XHRcdGlmICggY2FsbGJhY2sgKSB7XG5cdFx0XHRcdFx0XHRjYWxsYmFjaygpO1xuXHRcdFx0XHRcdH1cblx0XHRcdFx0fVxuXHRcdFx0fSApO1xuXHRcdH1cblx0fVxufVxuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///8157\n")},3757:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"JobApplicantSubBaseViewController\": () => (/* binding */ JobApplicantSubBaseViewController)\n/* harmony export */ });\n/* harmony import */ var _views_portal_PortalBaseViewController__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(97);\n/* harmony import */ var _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7526);\n/* harmony import */ var _global_TTUUID__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4936);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\n\n\nclass JobApplicantSubBaseViewController extends _views_portal_PortalBaseViewController__WEBPACK_IMPORTED_MODULE_0__.PortalBaseViewController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tevents: {\n\t\t\t\t'change input[type=\"text\"]': 'onFormItemChange',\n\t\t\t\t'change input[type=\"checkbox\"]': 'onFormItemChange',\n\t\t\t\t'change select.form-control': 'onFormItemChange',\n\t\t\t\t'change textarea.form-control': 'onFormItemChange'\n\t\t\t\t// 'click .styled-select .glyphicon': 'onSelectClick',\n\t\t\t}\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tpreInit( options ) { //Since this is an intermediary class between *SubViewController and PortalBaseViewController, we need to use preInit() so this is called before init() of each child class.\n\t\tthis.api = _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_1__/* .TTAPI.APIJobApplicantPortal */ .y.APIJobApplicantPortal;\n\t\tthis.qualification_api = _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_1__/* .TTAPI.APIQualificationPortal */ .y.APIQualificationPortal;\n\t\tthis.company_api = _services_TimeTrexClientAPI__WEBPACK_IMPORTED_MODULE_1__/* .TTAPI.APICompanyPortal */ .y.APICompanyPortal;\n\t\tthis.sub_view_id = options.sub_view_id;\n\t\tthis.display_columns = options.display_columns;\n\t\tthis.table_container = options.table_container;\n\t\tthis.available_fields = options.available_fields;\n\t\tthis._delegate = options._delegate;\n\t\tthis.edit_view_error_ui_dic = {};\n\t\tthis.enable_add_qualification = options.enable_add_qualification || false;\n\n\t}\n\n\tpostInit() {\n\t\tif ( !this.model.id ) {\n\t\t\tthis.setEditView();\n\t\t} else {\n\t\t\tthis.render();\n\t\t}\n\t}\n\n\trender() {\n\t\tvar $this = this;\n\t\tvar list_tpl = Global.loadWidget( 'views/portal/hr/my_profile/MyProfileSubView.html' );\n\t\tvar unique_id = this.sub_view_id + '-' + this.model.id;\n\t\tthis.unique_id = unique_id;\n\t\tthis.sub_view = _.template( list_tpl )( {} );\n\t\tif ( this.table_container.find( '.table-container' ).length == 0 ) {\n\t\t\tthis.table_container.html( '
' );\n\t\t}\n\t\tif ( this.table_container.find( '#' + unique_id ).length === 0 ) {\n\t\t\tvar tbody = $( '' ).attr( 'id', unique_id );\n\t\t\t$( this.table_container.find( 'tbody' )[0] ).append( tbody );\n\t\t} else {\n\t\t\tthis.table_container.find( '#' + unique_id ).html( '' );\n\t\t}\n\t\tvar thead = $( '
' );\n\t\tfor ( var column in this.display_columns ) {\n\t\t\tif ( !this.display_columns.hasOwnProperty( column ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// comment this, this will cause some default display columns cannot be shown.\n\t\t\t// if ( !this.available_fields.hasOwnProperty( column ) ) {\n\t\t\t// \tcontinue;\n\t\t\t// }\n\t\t\tvar column_val;\n\t\t\tswitch ( column ) {\n\t\t\t\tcase 'is_current_employer':\n\t\t\t\tcase 'is_contact_available':\n\t\t\t\t\tif ( this.model.get( column ) ) {\n\t\t\t\t\t\tcolumn_val = $.i18n._( 'Yes' );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcolumn_val = $.i18n._( 'No' );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tif ( !this.model.get( column ) ) {\n\t\t\t\t\t\tcolumn_val = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcolumn_val = this.model.get( column );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthead.append( '' + this.display_columns[column] + ' | ' );\n\t\t\tthis.table_container.find( '#' + unique_id ).append( '' + column_val + ' | ' );\n\t\t}\n\t\tthead.append( '' + $.i18n._( 'Action' ) + ' | ' );\n\t\tif ( this.table_container.find( 'thead' ).html() === '' ) {\n\t\t\tthis.table_container.find( 'thead' ).html( thead );\n\t\t}\n\t\tthis.table_container.find( '#' + unique_id ).append( this.sub_view );\n\t\tthis.table_container.find( '#' + unique_id ).find( '.edit-icon' ).unbind( 'click' ).bind( 'click', function( e ) {\n\t\t\t$this['get' + $this.sub_view_id]( function() {\n\t\t\t\t$this.setEditView();\n\t\t\t} );\n\t\t} );\n\t\tthis.table_container.find( '#' + unique_id ).find( '.delete-icon' ).unbind( 'click' ).bind( 'click', function( e ) {\n\t\t\t$this['get' + $this.sub_view_id]( function() {\n\t\t\t\t$this.onDeleteClick();\n\t\t\t} );\n\t\t} );\n\t}\n\n\tinitOptions() {\n\t\tvar $this = this;\n\t\tvar args = {};\n\t\tvar filter_data = {};\n\t\tfilter_data.type_id = [this.qualification_type_id];\n\t\targs.filter_data = filter_data;\n\t\targs.filter_columns = {\n\t\t\t'id': true,\n\t\t\t'name': true\n\t\t};\n\t\tthis.qualification_api.getQualification( args, true, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar res = result.getResult();\n\t\t\t\tvar options = {};\n\t\t\t\tfor ( var i in res ) {\n\t\t\t\t\tif ( !res.hasOwnProperty( i ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tvar row = res[i];\n\t\t\t\t\toptions[row.id] = $.i18n._( row.name );\n\t\t\t\t}\n\t\t\t\t$this.setSourceData( 'qualification_id', options, true );\n\t\t\t}\n\t\t} );\n\t}\n\n\tonSelectClick( e ) {\n\t\tvar elem = $( e.currentTarget ).parent().find( 'select' );\n\t\tif ( document.createEvent ) {\n\t\t\tvar e = document.createEvent( 'MouseEvents' );\n\t\t\te.initMouseEvent( 'mousedown', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null );\n\t\t\telem[0].dispatchEvent( e );\n\t\t} else if ( element.fireEvent ) {\n\t\t\telem[0].fireEvent( 'onmousedown' );\n\t\t}\n\t}\n\n\tsetEditView() {\n\t\tvar tpl = Global.loadWidget( 'views/portal/hr/my_profile/' + this.sub_view_id + 'SubEditView.html' );\n\t\tthis.setElement( _.template( tpl )( {\n\t\t\tavailable_fields: this.available_fields,\n\t\t\tenable_add_qualification: this.enable_add_qualification\n\t\t} ) );\n\t\tthis.initOptions();\n\t\tthis.registerDatePicker();\n\t\tthis.setCurrentEditRecordData();\n\t\tthis.openEditView();\n\t}\n\n\tonDeleteClick() {\n\t\tvar $this = this;\n\t\tIndexViewController.instance.router.showConfirmModal( Global.delete_confirm_message, {\n\t\t\ttitle: '',\n\t\t\tactions: [\n\t\t\t\t{ label: 'No', isClose: true },\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Yes', callBack: function( e ) {\n\t\t\t\t\t\t$this.closeConfirmModal();\n\t\t\t\t\t\tProgressBar.showOverlay();\n\t\t\t\t\t\t$this.api['delete' + $this.sub_view_id]( $this.model.id, {\n\t\t\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t\t\tProgressBar.closeOverlay();\n\t\t\t\t\t\t\t\tif ( result.isValid() ) {\n\t\t\t\t\t\t\t\t\t// $this.remove();\n\t\t\t\t\t\t\t\t\t// $this.table_container.find('#'+$this.unique_id).remove();\n\t\t\t\t\t\t\t\t\t$this._delegate.setSubViews( $this.sub_view_id, $this.display_columns );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t$this.showErrorAlert( result );\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} );\n\t}\n\n\tsetSourceData( field, source_data, set_empty ) {\n\t\tvar $this = this;\n\t\tvar field_selector = 'select[name=\"' + field + '\"]';\n\t\tif ( this.$( field_selector ) && this.$( field_selector )[0] ) {\n\t\t\tthis.$( field_selector ).empty();\n\t\t} else {\n\t\t\treturn;\n\t\t}\n\t\tif ( !Global.isSet( this.model.get( field ) ) ) {\n\t\t\tthis.model.set( field, '' ); // initialize a value;\n\t\t}\n\t\tif ( _.size( source_data ) == 0 ) {\n\t\t\tset_empty = true;\n\t\t\tthis.model.set( field, '' );\n\t\t}\n\t\tswitch ( field ) {\n\t\t\tcase 'qualification_id':\n\t\t\t\tif ( this.enable_add_qualification ) {\n\t\t\t\t\tvar option_name;\n\t\t\t\t\tswitch ( this.sub_view_id ) {\n\t\t\t\t\t\tcase 'JobApplicantSkill':\n\t\t\t\t\t\t\toption_name = $.i18n._( 'Add New Skill' );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'JobApplicantEducation':\n\t\t\t\t\t\t\toption_name = $.i18n._( 'Add New Course' );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'JobApplicantLicense':\n\t\t\t\t\t\t\toption_name = $.i18n._( 'Add New Type' );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'JobApplicantLanguage':\n\t\t\t\t\t\t\toption_name = $.i18n._( 'Add New Language' );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'JobApplicantMembership':\n\t\t\t\t\t\t\toption_name = $.i18n._( 'Add New Membership' );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tset_empty = false;\n\t\t\t\t\tthis.$( field_selector ).append( $( '' ).prop( 'value', '' ).text( '-- ' + option_name + ' --' ) );\n\t\t\t\t}\n\t\t\t//break; -- Do not break here, it should fall through to default.\n\t\t\tdefault:\n\t\t\t\tif ( set_empty === true ) {\n\t\t\t\t\tthis.$( field_selector ).append( $( '' ).prop( 'value', '' ).text( '-- ' + $.i18n._( 'None' ) + ' --' ) );\n\t\t\t\t}\n\t\t\t\tif ( _.size( source_data ) > 0 ) {\n\t\t\t\t\t$.each( source_data, function( value, label ) {\n\t\t\t\t\t\t$this.$( field_selector ).append( $( '' ).prop( 'value', value ).text( label ) );\n\t\t\t\t\t\tif ( $this.model.get( field ) == value ) {\n\t\t\t\t\t\t\t$this.$( field_selector ).val( value );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\t$this.$( field_selector ).selectpicker();\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tregisterDatePicker() {\n\t\tvar time_format = 'h:mm TT';\n\t\tvar format = 'dd-M-y';\n\t\tvar focus_out_timer;\n\t\tvar is_open = false;\n\t\t// When portal mode, no user preference.\n\t\t// if ( LocalCacheData.getLoginUserPreference() ) {\n\t\t// \tformat = LocalCacheData.getLoginUserPreference().date_format_1;\n\t\t// \ttime_format = LocalCacheData.getLoginUserPreference().time_format_1;\n\t\t// }\n\t\tvar day_name_min = [\n\t\t\t$.i18n._( 'Sun' ), $.i18n._( 'Mon' ), $.i18n._( 'Tue' ),\n\t\t\t$.i18n._( 'Wed' ), $.i18n._( 'Thu' ), $.i18n._( 'Fri' ), $.i18n._( 'Sat' )\n\t\t];\n\t\tvar month_name_short = [\n\t\t\t$.i18n._( 'Jan' ), $.i18n._( 'Feb' ),\n\t\t\t$.i18n._( 'Mar' ), $.i18n._( 'Apr' ), $.i18n._( 'May' ),\n\t\t\t$.i18n._( 'Jun' ), $.i18n._( 'Jul' ), $.i18n._( 'Aug' ),\n\t\t\t$.i18n._( 'Sep' ), $.i18n._( 'Oct' ), $.i18n._( 'Nov' ),\n\t\t\t$.i18n._( 'Dec' )\n\t\t];\n\t\tvar current_text = $.i18n._( 'Today' );\n\t\tvar close_text = $.i18n._( 'Close' );\n\t\tvar options = {\n\t\t\tshowTime: false,\n\t\t\tdateFormat: format,\n\t\t\tshowHour: false,\n\t\t\tshowMinute: false,\n\t\t\tchangeMonth: true,\n\t\t\tchangeYear: true,\n\t\t\tshowButtonPanel: true,\n\t\t\tduration: '',\n\t\t\tshowAnim: '',\n\t\t\tyearRange: '-100:+10',\n\t\t\tshowOn: '',\n\t\t\tdayNamesMin: day_name_min,\n\t\t\tcurrentText: current_text,\n\t\t\tmonthNamesShort: month_name_short,\n\t\t\tcloseText: close_text,\n\t\t\tbeforeShow: function() {\n\t\t\t},\n\t\t\tonSelect: function( dateText ) {\n\t\t\t\t$( this ).change();\n\t\t\t},\n\t\t\tonClose: function() {\n\t\t\t\tfocus_out_timer = setTimeout( function() {\n\t\t\t\t\tis_open = false;\n\t\t\t\t}, 100 );\n\t\t\t}\n\n\t\t};\n\t\tthis.$( 'input[type=\"text\"].datepicker' ).datepicker( options );\n\t\tthis.$( 'input[type=\"text\"].datepicker' ).attr( 'placeholder', 'dd-mmm-yy' );\n\t\tthis.$( 'input[type=\"text\"].datepicker' ).bind( 'mouseup', function() {\n\t\t\tif ( !is_open ) {\n\t\t\t\t$( this ).datepicker( 'show' );\n\t\t\t\tis_open = true;\n\t\t\t} else {\n\t\t\t\tis_open = false;\n\t\t\t\tif ( focus_out_timer ) {\n\t\t\t\t\tclearTimeout( focus_out_timer );\n\t\t\t\t\tfocus_out_timer = null;\n\t\t\t\t}\n\t\t\t}\n\t\t} ).next('.glyphicon').bind( 'mouseup', function() { $(this).prev().trigger( 'mouseup' ) } ); // this allows clicking on the calendar icon as well as the input box\n\t}\n\n\tsetCurrentEditRecordData() {\n\t\tvar self = this;\n\t\tvar unindexed_array = this.$( '.detail-form' ).serializeArray();\n\t\t$.map( unindexed_array, function( row, i ) {\n\t\t\tif ( !Global.isSet( self.model.get( row['name'] ) ) ) {\n\t\t\t\tself.model.set( row['name'], row['value'] );\n\t\t\t}\n\t\t} );\n\t\tif ( !this.model.has( 'qualification_id' ) ) {\n\t\t\tthis.model.set( 'qualification_id', false );\n\t\t}\n\t}\n\n\taddQualification() {\n\t\tvar $this = this;\n\t\tvar args = {};\n\t\targs.type_id = this.qualification_type_id;\n\t\tvar name = args.name = this.getQualificationWidget().val();\n\t\tthis.qualification_api.setQualification( args, {\n\t\t\tonResult: function( res ) {\n\t\t\t\tif ( !res.isValid() ) {\n\t\t\t\t\t$this.setErrorTips( res );\n\t\t\t\t} else {\n\t\t\t\t\t$this.$( 'select[name=\\'qualification_id\\']' ).selectpicker( 'destroy' );\n\t\t\t\t\tvar new_id = res.getResult();\n\t\t\t\t\t$( '