TimeTrex/interface/html5/dist/wizard-quick_start-QuickStartWizardController.bundle.js

1 line
83 KiB
JavaScript

"use strict";(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["wizard-quick_start-QuickStartWizardController"],{5344:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"QuickStartWizardController\": () => (/* binding */ QuickStartWizardController)\n/* harmony export */ });\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\nclass QuickStartWizardController extends BaseWizardController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '.wizard-bg',\n\t\t\tselected_province_index: -1,\n\t\t\tselected_country_index: -1,\n\n\n\t\t} );\n\n\t\tsuper( options );\n\t}\n\n\tinit( options ) {\n\t\t//this._super('initialize', options );\n\n\t\tthis.title = $.i18n._( 'Quick Start Wizard' );\n\t\tthis.steps = 5;\n\t\tthis.current_step = 1;\n\n\t\tthis.render();\n\t}\n\n\trender() {\n\t\tsuper.render();\n\n\t\tthis.initCurrentStep();\n\t}\n\n\t//Create each page UI\n\tbuildCurrentStepUI() {\n\t\tvar $this = this;\n\t\tthis.content_div.empty();\n\t\tthis.stepsWidgetDic[this.current_step] = {};\n\t\tswitch ( this.current_step ) {\n\t\t\tcase 1:\n\t\t\t\tvar label = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Welcome to' ) + ' ' + LocalCacheData.getApplicationName() + ', ' + $.i18n._( 'this Quick Start Wizard will walk you through the initial setup by asking you a few basic questions about your company.' ) );\n\n\t\t\t\tvar guide_label = $( '<div><span class=\"clear-both-div\">' + $.i18n._( 'Press' ) + '<button style=\"display: inline\" class=\"forward-btn\"></button> ' + $.i18n._( 'below to continue' ) + '</span></div>' );\n\n\t\t\t\tthis.content_div.append( label );\n\n\t\t\t\tthis.content_div.append( guide_label );\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\n\t\t\t\tGlobal.setWidgetEnabled( this.next_btn, false );\n\t\t\t\tvar label = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Please choose the preferred settings that you would like to use to display information throughout' ) + ' ' + LocalCacheData.getApplicationName() + '.' );\n\n\t\t\t\tthis.content_div.append( label );\n\n\t\t\t\t//Time Zone\n\t\t\t\tvar form_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\tvar form_item_label = form_item.find( '.form-item-label' );\n\t\t\t\tvar form_item_input_div = form_item.find( '.form-item-input-div' );\n\n\t\t\t\tvar combobox = this.getComboBox( 'time_zone', true );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Timezone' ) );\n\t\t\t\tform_item_input_div.append( combobox );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\t//Date Format\n\t\t\t\tform_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\tform_item_label = form_item.find( '.form-item-label' );\n\t\t\t\tform_item_input_div = form_item.find( '.form-item-input-div' );\n\n\t\t\t\tvar date_format = this.getComboBox( 'date_format', true );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Date Format' ) );\n\t\t\t\tform_item_input_div.append( date_format );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\t//Time Format\n\t\t\t\tform_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\tform_item_label = form_item.find( '.form-item-label' );\n\t\t\t\tform_item_input_div = form_item.find( '.form-item-input-div' );\n\n\t\t\t\tvar time_format = this.getComboBox( 'time_format', true );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Time Format' ) );\n\t\t\t\tform_item_input_div.append( time_format );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\t//Calendar Starts On\n\t\t\t\tform_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\tform_item_label = form_item.find( '.form-item-label' );\n\t\t\t\tform_item_input_div = form_item.find( '.form-item-input-div' );\n\n\t\t\t\tvar calendar_starts_on = this.getComboBox( 'start_week_day', true );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Calendar Starts On' ) );\n\t\t\t\tform_item_input_div.append( calendar_starts_on );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step][combobox.getField()] = combobox;\n\t\t\t\tthis.stepsWidgetDic[this.current_step][date_format.getField()] = date_format;\n\t\t\t\tthis.stepsWidgetDic[this.current_step][time_format.getField()] = time_format;\n\t\t\t\tthis.stepsWidgetDic[this.current_step][calendar_starts_on.getField()] = calendar_starts_on;\n\t\t\t\tbreak;\n\n\t\t\tcase 3:\n\t\t\t\tvar label = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Pay period schedules are critical to the operation of' ) + ' ' + LocalCacheData.getApplicationName() + ' ' + $.i18n._( 'regardless if you use it for processing payroll or not. Please select the pay period frequency and enter the start date, end date and transaction date (date the employees are paid) for your next four pay periods. Based on this information' ) + ' ' + LocalCacheData.getApplicationName() + ' ' + $.i18n._( 'will automatically create subsequent pay periods for you.' ) );\n\n\t\t\t\tthis.content_div.append( label );\n\n\t\t\t\t//Pay Period Frequency\n\t\t\t\tform_item = $( Global.loadWidget( 'global/widgets/wizard_form_item/WizardFormItem.html' ) );\n\t\t\t\tform_item_label = form_item.find( '.form-item-label' );\n\t\t\t\tform_item_input_div = form_item.find( '.form-item-input-div' );\n\n\t\t\t\tvar frequency = this.getComboBox( 'type_id', false );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Pay Period Frequency' ) );\n\t\t\t\tform_item_input_div.append( frequency );\n\n\t\t\t\tfrequency.bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.onFrequencyChange( target );\n\t\t\t\t} );\n\n\t\t\t\tthis.content_div.append( form_item );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step][frequency.getField()] = frequency;\n\n\t\t\t\t//Example Dates\n\t\t\t\tvar grid_id = 'example_dates';\n\t\t\t\tvar grid_div = $( '<div style=\\'float: left; width: 100%\\' class=\\'grid-div wizard-grid-div\\'> <table id=\\'' + grid_id + '\\'></table></div>' );\n\t\t\t\tthis.setDateGrid( grid_id, grid_div, 300 );\n\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tvar label = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'To help determine how' ) + ' ' + LocalCacheData.getApplicationName() + ' ' + $.i18n._( 'should be initially setup, please select one or more locations that your employees reside within.' ) );\n\t\t\t\tthis.content_div.append( label );\n\n\t\t\t\tvar guide_label = $( '<div><span class=\"clear-both-div\">' + $.i18n._( 'Click' ) + ' <button style=\"display: inline\" class=\"plus-icon\"></button> ' + $.i18n._( 'icon to add additional locations' ) + '</span></div>' );\n\t\t\t\tthis.content_div.append( guide_label );\n\n\t\t\t\tvar legal_entity_label = $( '<br><div><span class=\"clear-both-div\">' + $.i18n._( 'Legal Entity' ) + '</span></div>' );\n\t\t\t\tthis.content_div.append( legal_entity_label );\n\n\t\t\t\tvar form_item_input = Global.loadWidgetByName( FormItemType.AWESOME_BOX );\n\t\t\t\tform_item_input.TText( { field: 'legal_entity_id' } );\n\t\t\t\tform_item_input.AComboBox( {\n\t\t\t\t\tapi_class: TTAPI.APILegalEntity,\n\t\t\t\t\tallow_multiple_selection: true,\n\t\t\t\t\tlayout_name: 'global_legal_entity',\n\t\t\t\t\tshow_search_inputs: false,\n\t\t\t\t\tset_empty: true,\n\t\t\t\t\tcustom_first_label: Global.all_item\n\t\t\t\t} );\n\n\t\t\t\tthis.content_div.append( form_item_input );\n\t\t\t\tthis.stepsWidgetDic[this.current_step].legal_entity_id = form_item_input;\n\n\t\t\t\t//Inside editor\n\n\t\t\t\tvar args = {\n\t\t\t\t\tcountry: $.i18n._( 'Country' ),\n\t\t\t\t\tprovince: $.i18n._( 'Province/State' )\n\t\t\t\t};\n\n\t\t\t\tvar editor = Global.loadWidgetByName( FormItemType.INSIDE_EDITOR );\n\n\t\t\t\teditor.InsideEditor( {\n\t\t\t\t\ttitle: '',\n\t\t\t\t\taddRow: this.insideEditorAddRow,\n\t\t\t\t\tremoveRow: this.insideEditorRemoveRow,\n\t\t\t\t\tgetValue: this.insideEditorGetValue,\n\t\t\t\t\tsetValue: this.insideEditorSetValue,\n\t\t\t\t\tparent_controller: this,\n\t\t\t\t\trender: 'views/wizard/quick_start/QuickStartInsideEditorRender.html',\n\t\t\t\t\trender_args: args,\n\t\t\t\t\trow_render: 'views/wizard/quick_start/QuickStartInsideEditorRow.html'\n\t\t\t\t} );\n\n\t\t\t\teditor.addClass( 'wizard-inside-editor' );\n\n\t\t\t\tthis.content_div.append( editor );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step]['country'] = editor;\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tvar label = this.getLabel();\n\t\t\t\tlabel.text( LocalCacheData.getApplicationName() + ' ' + $.i18n._( 'is now setup and ready for you to start adding employees and tracking their attendance.' ) );\n\t\t\t\tthis.content_div.append( label );\n\n\t\t\t\tvar guide_label = $( '<div><span class=\"clear-both-div\">' + $.i18n._( 'Click the' ) + ' <button style=\"display: inline\" class=\"done-btn\"></button> ' + $.i18n._( 'icon below to begin doing that now' ) + '</span></div>' );\n\t\t\t\tthis.content_div.append( guide_label );\n\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tinitInsideEditorData() {\n\t\tvar $this = this;\n\n\t\tvar current_step_data = this.stepsDataDic[this.current_step];\n\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\n\t\tvar editor = current_step_ui['country'];\n\t\tvar args = {};\n\t\targs.filter_data = {};\n\n\t\tif ( !current_step_data ) {\n\t\t\teditor.removeAllRows();\n\t\t\teditor.addRow();\n\n\t\t} else {\n\t\t\teditor.setValue( current_step_data.country );\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.addRow();\n\t\t}\n\t}\n\n\tinsideEditorRemoveRow( row ) {\n\t\tvar index = row[0].rowIndex - 1;\n\t\trow.remove();\n\t\tthis.rows_widgets_array.splice( index, 1 );\n\t\tthis.removeLastRowLine();\n\t}\n\n\tinsideEditorAddRow( data, index ) {\n\n\t\tvar form_item_input;\n\n\t\tvar $this = this;\n\t\tif ( !data ) {\n\t\t\tdata = {\n\t\t\t\tcountry: LocalCacheData.getCurrentCompany().country,\n\t\t\t\tprovince: LocalCacheData.getCurrentCompany().province\n\t\t\t};\n\t\t}\n\n\t\tvar row = this.getRowRender(); //Get Row render\n\t\tvar render = this.getRender(); //get render, should be a table\n\t\tvar widgets = {}; //Save each row's widgets\n\n\t\t//Build row widgets\n\n\t\t// Country\n\n\t\tvar widgetContainer = $( '<ul style=\\'list-style: none; padding: 0; margin: 0;\\'></ul>' );\n\n\t\tvar widgetContainer1 = $( '<li class=\\'widget-h-box\\' style=\\'float: left; margin-right: 10px\\'></li>' );\n\n\t\tvar country = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tcountry.TComboBox( { field: 'country', set_empty: true, set_select_item_when_set_source_data: true } );\n\n\t\tvar country_api = TTAPI.APICompany;\n\n\t\tcountry_api.getOptions( 'country', {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar result_data = result.getResult();\n\t\t\t\tcountry.setSourceData( Global.buildRecordArray( result_data ) );\n\n\t\t\t\tif ( $this.parent_controller.selected_country_index != -1 ) {\n\t\t\t\t\tcountry.setSelectedIndex( $this.parent_controller.selected_country_index );\n\t\t\t\t} else {\n\t\t\t\t\tcountry.setValue( data.country );\n\t\t\t\t\t$this.parent_controller.selected_country_index = country.getSelectedIndex();\n\t\t\t\t}\n\n\t\t\t\tif ( data.country != country.getValue() ) {\n\t\t\t\t\tdata.country = country.getValue();\n\t\t\t\t}\n\n\t\t\t\twidgets[country.getField()] = country;\n\n\t\t\t\tcountry.bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.parent_controller.selected_country_index = country.getSelectedIndex();\n\t\t\t\t\tTTPromise.add( 'QuickStartWizard', 'setProvince' );\n\t\t\t\t\t$this.parent_controller.setProvince( { country: target.getValue(), province: '' }, province );\n\t\t\t\t\tTTPromise.wait( 'QuickStartWizard', 'setProvince', function() {\n\t\t\t\t\t\t$this.parent_controller.selected_province_index = province.getSelectedIndex();\n\t\t\t\t\t} );\n\t\t\t\t} );\n\n\t\t\t\twidgetContainer1.append( country );\n\n\t\t\t\twidgetContainer.append( widgetContainer1 );\n\n\t\t\t\trow.children().eq( 0 ).append( widgetContainer );\n\n\t\t\t\t// Province\n\n\t\t\t\twidgetContainer = $( '<ul style=\\'list-style: none; padding: 0; margin: 0;\\'></ul>' );\n\n\t\t\t\twidgetContainer1 = $( '<li class=\\'widget-h-box\\' style=\\'float: left; margin-right: 10px\\'></li>' );\n\n\t\t\t\tvar province = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\t\t\tprovince.TComboBox( { field: 'province', set_empty: false } );\n\n\t\t\t\tTTPromise.add( 'QuickStartWizard', 'setProvince' );\n\t\t\t\t$this.parent_controller.setProvince( data, province );\n\t\t\t\tTTPromise.wait( 'QuickStartWizard', 'setProvince', function() {\n\t\t\t\t\tupdateProvince( province );\n\t\t\t\t} );\n\n\t\t\t\tprovince.bind( 'formItemChange', function() {\n\t\t\t\t\t$this.parent_controller.selected_province_index = province.getSelectedIndex();\n\t\t\t\t} );\n\n\t\t\t\twidgets[province.getField()] = province;\n\n\t\t\t\twidgetContainer1.append( province );\n\n\t\t\t\twidgetContainer.append( widgetContainer1 );\n\n\t\t\t\trow.children().eq( 1 ).append( widgetContainer );\n\n\t\t\t\tif ( typeof index != 'undefined' ) {\n\n\t\t\t\t\trow.insertAfter( $( render ).find( 'tr' ).eq( index ) );\n\t\t\t\t\t$this.rows_widgets_array.splice( ( index ), 0, widgets );\n\n\t\t\t\t} else {\n\t\t\t\t\t$( render ).append( row );\n\t\t\t\t\t$this.rows_widgets_array.push( widgets );\n\t\t\t\t}\n\n\t\t\t\twidgets.current_edit_item = data;\n\n\t\t\t\t$this.addIconsEvent( row ); //Bind event to add and minus icon\n\t\t\t\t$this.removeLastRowLine();\n\t\t\t\t$this.removeLastRowLine();\n\t\t\t}\n\t\t} );\n\n\t\tfunction updateProvince( province ) {\n\t\t\tif ( typeof index == 'undefined' ) {\n\t\t\t\t$this.parent_controller.selected_province_index = province.getSelectedIndex();\n\t\t\t} else {\n\t\t\t\t$this.parent_controller.selected_province_index++;\n\t\t\t\tprovince.setSelectedIndex( $this.parent_controller.selected_province_index );\n\t\t\t}\n\t\t}\n\t}\n\n\tsetProvince( val, province ) {\n\t\tvar $this = this;\n\n\t\tif ( !val.country ) {\n\t\t\tprovince.setSourceData( [] );\n\t\t\tprovince.setValue( 0 );\n\t\t\tTTPromise.reject( 'QuickStart', 'setProvince' );\n\t\t\treturn;\n\n\t\t}\n\n\t\tvar country_api = TTAPI.APICompany;\n\n\t\tcountry_api.getOptions( 'province', val.country, {\n\t\t\tonResult: function( res ) {\n\t\t\t\tres = res.getResult();\n\n\t\t\t\tprovince.setSourceData( Global.buildRecordArray( res ) );\n\t\t\t\tprovince.setValue( val.province );\n\t\t\t\tTTPromise.resolve( 'QuickStartWizard', 'setProvince' );\n\t\t\t}\n\t\t} );\n\t}\n\n\tonFrequencyChange( target ) {\n\n\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\t\tvar grid = current_step_ui['example_dates'];\n\t\tvar data = grid.getData();\n\n\t\tvar first_cell_val;\n\n\t\t//rror: Uncaught TypeError: Cannot read property 'start_date' of undefined in /interface/html5/#!m=Schedule&date=20141201&mode=week line 332\n\t\tif ( data && data[0] ) {\n\t\t\tfirst_cell_val = data[0].start_date;\n\t\t}\n\n\t\tif ( first_cell_val ) {\n\t\t\tthis.setDefaultDates( true );\n\t\t}\n\t}\n\n\tsetDateGrid( gridId, grid_div, height ) {\n\t\tvar $this = this;\n\n\t\tthis.content_div.append( grid_div );\n\n\t\tif ( !height ) {\n\t\t\theight = 370;\n\t\t}\n\n\t\tthis.getGridColumns( gridId, function( column_model ) {\n\n\t\t\t$this.stepsWidgetDic[$this.current_step][gridId] = new TTGrid( gridId, {\n\t\t\t\tsortable: false,\n\t\t\t\theight: height,\n\t\t\t\tediturl: 'QuickStart',\n\t\t\t\tmultiselect: false,\n\n\t\t\t\tonSelectRow: function( id ) {\n\t\t\t\t\tif ( id ) {\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}, column_model );\n\n\t\t\t$this.setGridSize( $this.stepsWidgetDic[$this.current_step][gridId] );\n\n\t\t\t$this.setGridGroupColumns( gridId );\n\n\t\t} );\n\t}\n\n\tonTextInputRender( cell_value, related_data, row ) {\n\n\t\tvar col_model = related_data.colModel;\n\t\tvar row_id = related_data.rowId;\n\n\t\tvar date_picker = $( '<div custom_cell=\"true\" render_type=\"date_picker\" id=\"' + row_id + '_' + col_model.name + '\" class=\"t-date-picker-div\"><input class=\"t-date-picker\" type=\"text\" value=\"' + cell_value + '\"></input><img id=\"tDatePickerIcon\" class=\"t-date-picker-icon\"></img>' );\n\n\t\treturn date_picker.get( 0 ).outerHTML;\n\t}\n\n\tonCloseClick() {\n\t\tvar $this = this;\n\t\tif ( !LocalCacheData.getCurrentCompany().is_setup_complete ) {\n\t\t\tTAlertManager.showConfirmAlert( $.i18n._( 'Would you like to be reminded to complete the Quick Start Wizard next time you login?' ), '', function( flag ) {\n\t\t\t\tif ( !flag ) {\n\t\t\t\t\tvar company = {};\n\t\t\t\t\tcompany.id = LocalCacheData.getCurrentCompany().id;\n\t\t\t\t\tcompany.is_setup_complete = true;\n\n\t\t\t\t\tvar company_api = TTAPI.APICompany;\n\t\t\t\t\tLocalCacheData.getCurrentCompany().is_setup_complete = true;\n\n\t\t\t\t\tcompany_api.setCompany( company, {\n\t\t\t\t\t\tonResult: function() {\n\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\t$( $this.el ).remove();\n\t\t\t\tLocalCacheData.current_open_wizard_controllers = LocalCacheData.current_open_wizard_controllers.filter( wizard => wizard.wizard_id !== $this.wizard_id );\n\t\t\t} );\n\t\t} else {\n\t\t\t$( $this.el ).remove();\n\t\t\tLocalCacheData.current_open_wizard_controllers = LocalCacheData.current_open_wizard_controllers.filter( wizard => wizard.wizard_id !== this.wizard_id );\n\n\t\t}\n\t}\n\n\tonStep3DatePickerChange( target ) {\n\n\t\tvar $this = this;\n\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\t\tvar grid = current_step_ui['example_dates'];\n\t\tvar target_id = target.attr( 'id' );\n\t\tvar row_id = target_id.split( '_' )[0];\n\t\tvar field = target_id.substring( target_id.indexOf( '_' ) + 1, target_id.length );\n\t\tvar data = grid.getData();\n\t\tvar target_val = target.getValue();\n\n\t\tvar first_cell_val = data[0].start_date;\n\n\t\tvar len = data.length;\n\n\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\tvar row_data = data[i];\n\n\t\t\tif ( row_data.id == row_id ) {\n\t\t\t\trow_data[field] = target_val;\n\n\t\t\t\tif ( i === 0 && field === 'start_date' ) {\n\t\t\t\t\tif ( first_cell_val && first_cell_val !== target_val ) {\n\t\t\t\t\t\t$this.setDefaultDates( true );\n\t\t\t\t\t} else if ( !first_cell_val ) {\n\t\t\t\t\t\t$this.setDefaultDates();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tsetDefaultDates( show_alert ) {\n\t\tvar $this = this;\n\t\tif ( show_alert ) {\n\t\t\tTAlertManager.showConfirmAlert( $.i18n._( 'Would you like to pre-populate all date fields based on the first start date' ), '', function( flag ) {\n\t\t\t\tif ( flag ) {\n\t\t\t\t\tdoNext();\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\tdoNext();\n\t\t}\n\n\t\tfunction doNext() {\n\n\t\t\tvar type_id = $this.stepsWidgetDic[3].type_id.getValue();\n\t\t\tvar grid = $this.stepsWidgetDic[3].example_dates;\n\t\t\tvar data = grid.getData();\n\t\t\tvar first_date = data[0].start_date;\n\n\t\t\tvar api = TTAPI.APIPayPeriodSchedule;\n\n\t\t\tapi.detectPayPeriodScheduleDates( type_id, first_date, {\n\t\t\t\tonResult: function( result ) {\n\t\t\t\t\tvar res_data = result.getResult();\n\t\t\t\t\tgrid.setData( res_data );\n\n\t\t\t\t\t$this.setStep3CellDatePickers( grid );\n\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\tgetGridColumns( gridId, callBack ) {\n\t\tvar column_info_array = [];\n\t\tvar $this = this;\n\n\t\tswitch ( gridId ) {\n\t\t\tcase 'example_dates':\n\n\t\t\t\tvar column_info = {\n\t\t\t\t\tname: 'start_date',\n\t\t\t\t\tindex: 'start_date',\n\t\t\t\t\tlabel: $.i18n._( 'Start Date' ),\n\t\t\t\t\twidth: 100,\n\t\t\t\t\tsortable: false,\n\t\t\t\t\ttitle: false,\n\t\t\t\t\tformatter: function( cell_value, related_data, row ) {\n\t\t\t\t\t\treturn $this.onTextInputRender( cell_value, related_data, row );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tcolumn_info_array.push( column_info );\n\n\t\t\t\tcolumn_info = {\n\t\t\t\t\tname: 'end_date',\n\t\t\t\t\tindex: 'end_date',\n\t\t\t\t\tlabel: $.i18n._( 'End Date' ),\n\t\t\t\t\twidth: 100,\n\t\t\t\t\tsortable: false,\n\t\t\t\t\ttitle: false,\n\t\t\t\t\tformatter: function( cell_value, related_data, row ) {\n\t\t\t\t\t\treturn $this.onTextInputRender( cell_value, related_data, row );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tcolumn_info_array.push( column_info );\n\n\t\t\t\tcolumn_info = {\n\t\t\t\t\tname: 'transaction_date',\n\t\t\t\t\tindex: 'transaction_date',\n\t\t\t\t\tlabel: $.i18n._( 'Transaction Date' ),\n\t\t\t\t\twidth: 100,\n\t\t\t\t\tsortable: false,\n\t\t\t\t\ttitle: false,\n\t\t\t\t\tformatter: function( cell_value, related_data, row ) {\n\t\t\t\t\t\treturn $this.onTextInputRender( cell_value, related_data, row );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tcolumn_info_array.push( column_info );\n\n\t\t\t\tbreak;\n\n\t\t}\n\n\t\tcallBack( column_info_array );\n\t}\n\n\tbuildCurrentStepData() {\n\t\tvar $this = this;\n\t\tvar current_step_data = this.stepsDataDic[this.current_step];\n\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\n\t\tvar api_return_count = 0;\n\n\t\tswitch ( this.current_step ) {\n\t\t\tcase 2:\n\n\t\t\t\tGlobal.setWidgetEnabled( this.next_btn, false );\n\t\t\t\tGlobal.setWidgetEnabled( this.back_btn, false );\n\t\t\t\tvar api_user_preference = TTAPI.APIUserPreference;\n\t\t\t\tvar api_current_user = TTAPI.APIAuthentication;\n\n\t\t\t\t//Time ZOne\n\t\t\t\tapi_user_preference.getOptions( 'time_zone', {\n\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\tcurrent_step_ui['time_zone'].setSourceData( Global.buildRecordArray( result.getResult() ) );\n\n\t\t\t\t\t\tif ( current_step_data ) {\n\t\t\t\t\t\t\tfor ( var key in current_step_data ) {\n\t\t\t\t\t\t\t\tif ( !current_step_data.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tcurrent_step_ui[key].setValue( current_step_data[key] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstep2OptionsCallBack();\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\t//Time Format\n\t\t\t\tapi_user_preference.getOptions( 'time_format', {\n\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\tcurrent_step_ui['time_format'].setSourceData( Global.buildRecordArray( result.getResult() ) );\n\n\t\t\t\t\t\tif ( current_step_data ) {\n\t\t\t\t\t\t\tfor ( var key in current_step_data ) {\n\t\t\t\t\t\t\t\tif ( !current_step_data.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tcurrent_step_ui[key].setValue( current_step_data[key] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstep2OptionsCallBack();\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\t//Calendar Starts On\n\t\t\t\tapi_user_preference.getOptions( 'start_week_day', {\n\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\tcurrent_step_ui['start_week_day'].setSourceData( Global.buildRecordArray( result.getResult() ) );\n\n\t\t\t\t\t\tif ( current_step_data ) {\n\t\t\t\t\t\t\tfor ( var key in current_step_data ) {\n\t\t\t\t\t\t\t\tif ( !current_step_data.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tcurrent_step_ui[key].setValue( current_step_data[key] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstep2OptionsCallBack();\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tapi_current_user.getCurrentUserPreference( {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\tvar res_data = result.getResult();\n\t\t\t\t\t\tsetStep2Values( res_data );\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tvar api_pp_schedule = TTAPI.APIPayPeriodSchedule;\n\t\t\t\tapi_pp_schedule.getOptions( 'type', {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\tvar res_data = Global.buildRecordArray( result.getResult() );\n\t\t\t\t\t\tres_data.splice( 0, 1 );\n\n\t\t\t\t\t\tcurrent_step_ui['type_id'].setSourceData( res_data );\n\n\t\t\t\t\t\tif ( current_step_data ) {\n\t\t\t\t\t\t\tvar array = current_step_data['example_dates'];\n\n\t\t\t\t\t\t\tvar grid = current_step_ui['example_dates'];\n\t\t\t\t\t\t\tgrid.setData( array );\n\t\t\t\t\t\t\t$this.setStep3CellDatePickers( grid );\n\t\t\t\t\t\t\tcurrent_step_ui['type_id'].setValue( current_step_data['type_id'] );\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbuildStep3EmptySource();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\t$this.initInsideEditorData();\n\t\t\t\tbreak;\n\t\t}\n\n\t\tfunction step2OptionsCallBack() {\n\t\t\tapi_return_count = api_return_count + 1;\n\t\t\tif ( api_return_count === 4 ) {\n\t\t\t\tGlobal.setWidgetEnabled( $this.next_btn, true );\n\t\t\t\tGlobal.setWidgetEnabled( $this.back_btn, true );\n\t\t\t}\n\t\t}\n\n\t\tfunction setStep2Values( user_preference ) {\n\n\t\t\tvar t = current_step_ui['time_zone'];\n\t\t\tvar d = current_step_ui['date_format'];\n\t\t\tvar tf = current_step_ui['time_format'];\n\t\t\tvar s = current_step_ui['start_week_day'];\n\n\t\t\tif ( user_preference.language === 'en' ) {\n\t\t\t\tapi_user_preference.getOptions( 'date_format', {\n\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\tcurrent_step_ui['date_format'].setSourceData( Global.buildRecordArray( result.getResult() ) );\n\n\t\t\t\t\t\tif ( current_step_data ) {\n\t\t\t\t\t\t\tfor ( var key in current_step_data ) {\n\t\t\t\t\t\t\t\tif ( !current_step_data.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tcurrent_step_ui[key].setValue( current_step_data[key] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tt.setValue( user_preference.time_zone );\n\t\t\t\t\t\t\td.setValue( user_preference.date_format );\n\t\t\t\t\t\t\ttf.setValue( user_preference.time_format );\n\t\t\t\t\t\t\ts.setValue( user_preference.start_week_day );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tapi_user_preference.getOptions( 'other_date_format', {\n\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\tcurrent_step_ui['date_format'].setSourceData( Global.buildRecordArray( result.getResult() ) );\n\n\t\t\t\t\t\tif ( current_step_data ) {\n\t\t\t\t\t\t\tfor ( var key in current_step_data ) {\n\t\t\t\t\t\t\t\tif ( !current_step_data.hasOwnProperty( key ) ) {\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tcurrent_step_ui[key].setValue( current_step_data[key] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tt.setValue( user_preference.time_zone );\n\t\t\t\t\t\t\td.setValue( user_preference.date_format );\n\t\t\t\t\t\t\ttf.setValue( user_preference.time_format );\n\t\t\t\t\t\t\ts.setValue( user_preference.start_week_day );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tstep2OptionsCallBack();\n\n\t\t}\n\n\t\tfunction buildStep3EmptySource() {\n\t\t\tvar array = [\n\t\t\t\t{ start_date: '', end_date: '', transaction_date: '' },\n\t\t\t\t{ start_date: '', end_date: '', transaction_date: '' },\n\t\t\t\t{ start_date: '', end_date: '', transaction_date: '' },\n\t\t\t\t{ start_date: '', end_date: '', transaction_date: '' }\n\t\t\t];\n\n\t\t\tvar grid = current_step_ui['example_dates'];\n\t\t\tgrid.setData( array );\n\n\t\t\t$this.setStep3CellDatePickers( grid );\n\n\t\t}\n\t}\n\n\tsetStep3CellDatePickers( grid ) {\n\t\tvar inputs = grid.grid.find( 'div[custom_cell=\"true\"]' );\n\t\tvar $this = this;\n\t\tfor ( var i = 0; i < inputs.length; i++ ) {\n\t\t\tvar input = $( inputs[i] ).TDatePicker( { width: 290 } );\n\n\t\t\tinput.bind( 'formItemChange', function( e, target ) {\n\t\t\t\t$this.onStep3DatePickerChange( target );\n\t\t\t} );\n\n\t\t}\n\t}\n\n\tonDoneClick() {\n\t\tvar $this = this;\n\t\tsuper.onDoneClick();\n\t\t$( $this.el ).remove();\n\t\tLocalCacheData.current_open_wizard_controllers = LocalCacheData.current_open_wizard_controllers.filter( wizard => wizard.wizard_id !== this.wizard_id );\n\n\t\tIndexViewController.goToView( 'Employee' );\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\tvar data = {\n\t\t\t\tcountry: row.country.getValue(),\n\t\t\t\tprovince: row.province.getValue()\n\t\t\t};\n\n\t\t\tresult.push( data );\n\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tonNextClick() {\n\n\t\tvar $this = this;\n\n\t\tthis.saveCurrentStep( 'forward', function( result ) {\n\t\t\tGlobal.setWidgetEnabled( $this.next_btn, true );\n\t\t\tGlobal.setWidgetEnabled( $this.back_btn, true );\n\t\t\tif ( result ) {\n\t\t\t\t$this.current_step = $this.current_step + 1;\n\t\t\t\t$this.initCurrentStep();\n\t\t\t}\n\t\t} );\n\t}\n\n\tonBackClick() {\n\t\tvar $this = this;\n\n\t\tthis.saveCurrentStep( 'back', function( result ) {\n\t\t\tGlobal.setWidgetEnabled( $this.next_btn, true );\n\t\t\tGlobal.setWidgetEnabled( $this.back_btn, true );\n\t\t\tif ( result ) {\n\t\t\t\t$this.current_step = $this.current_step - 1;\n\t\t\t\t$this.initCurrentStep();\n\t\t\t}\n\t\t} );\n\t}\n\n\tsaveCurrentStep( direction, callBack ) {\n\t\tthis.stepsDataDic[this.current_step] = {};\n\t\tvar current_step_data = this.stepsDataDic[this.current_step];\n\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\t\tswitch ( this.current_step ) {\n\t\t\tcase 1:\n\t\t\t\tcallBack( true );\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tGlobal.setWidgetEnabled( this.next_btn, false );\n\t\t\t\tGlobal.setWidgetEnabled( this.back_btn, false );\n\t\t\t\tcurrent_step_data.time_zone = current_step_ui.time_zone.getValue();\n\t\t\t\tcurrent_step_data.time_format = current_step_ui.time_format.getValue();\n\t\t\t\tcurrent_step_data.date_format = current_step_ui.date_format.getValue();\n\t\t\t\tcurrent_step_data.start_week_day = current_step_ui.start_week_day.getValue();\n\n\t\t\t\tif ( direction === 'forward' ) {\n\t\t\t\t\tvar api_current_user = TTAPI.APIAuthentication;\n\t\t\t\t\tvar api_user_preference = TTAPI.APIUserPreference;\n\t\t\t\t\tapi_current_user.getCurrentUserPreference( {\n\t\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t\tvar res_data = result.getResult();\n\n\t\t\t\t\t\t\tres_data.date_format = current_step_data.date_format;\n\t\t\t\t\t\t\tres_data.time_format = current_step_data.time_format;\n\t\t\t\t\t\t\tres_data.time_zone = current_step_data.time_zone;\n\t\t\t\t\t\t\tres_data.start_week_day = current_step_data.start_week_day;\n\n\t\t\t\t\t\t\tapi_user_preference.setUserPreference( res_data, {\n\t\t\t\t\t\t\t\tonResult: function() {\n\n\t\t\t\t\t\t\t\t\tGlobal.updateUserPreference( function() {\n\t\t\t\t\t\t\t\t\t\tcallBack( true );\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\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tcallBack( true );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tGlobal.setWidgetEnabled( this.next_btn, false );\n\t\t\t\tGlobal.setWidgetEnabled( this.back_btn, false );\n\n\t\t\t\tcurrent_step_data.type_id = current_step_ui.type_id.getValue();\n\t\t\t\tcurrent_step_data.example_dates = _.clone( current_step_ui.example_dates.getGridParam( 'data' ) );\n\n\t\t\t\tif ( direction === 'forward' ) {\n\t\t\t\t\tvar api_pp_schedule = TTAPI.APIPayPeriodSchedule;\n\n\t\t\t\t\tapi_pp_schedule.detectPayPeriodScheduleSettings( current_step_data.type_id, current_step_data.example_dates, {\n\t\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\t\tresult = result.getResult();\n\n\t\t\t\t\t\t\tif ( result.hasOwnProperty( 'company_id' ) ) {\n\n\t\t\t\t\t\t\t\tapi_pp_schedule.setPayPeriodSchedule( result, {\n\t\t\t\t\t\t\t\t\tonResult: function( result_1 ) {\n\n\t\t\t\t\t\t\t\t\t\tif ( result_1.isValid() ) {\n\t\t\t\t\t\t\t\t\t\t\tcallBack( true );\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tTAlertManager.showErrorAlert( result_1 );\n\t\t\t\t\t\t\t\t\t\t\tcallBack( false );\n\t\t\t\t\t\t\t\t\t\t}\n\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} else {\n\t\t\t\t\t\t\t\tcallBack( true );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tcallBack( true );\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tGlobal.setWidgetEnabled( this.next_btn, false );\n\t\t\t\tGlobal.setWidgetEnabled( this.back_btn, false );\n\n\t\t\t\tcurrent_step_data.country = current_step_ui.country.getValue();\n\n\t\t\t\tcurrent_step_data.legal_entity_id = null;\n\t\t\t\tvar selected_legal_entities = current_step_ui.legal_entity_id.getValue( true );\n\t\t\t\tif ( selected_legal_entities && selected_legal_entities.length > 0 ) {\n\t\t\t\t\tcurrent_step_data.legal_entity_id = [];\n\t\t\t\t\tfor ( var n in selected_legal_entities ) {\n\t\t\t\t\t\tcurrent_step_data.legal_entity_id.push( selected_legal_entities[n].id );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( direction === 'forward' ) {\n\t\t\t\t\tvar company_api = TTAPI.APISetupPresets;\n\t\t\t\t\tcompany_api.createPresets( current_step_data.country, current_step_data.legal_entity_id, {\n\t\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\t\tif ( result.isValid ) {\n\t\t\t\t\t\t\t\tcallBack( true );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tTAlertManager.showErrorAlert( result );\n\t\t\t\t\t\t\t\tcallBack( false );\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} else {\n\t\t\t\t\tcallBack( true );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tcallBack( true );\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTM0NC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7QUFBTztBQUNQLDJCQUEyQjtBQUMzQixFQUFFLENBQUM7QUFDSDtBQUNBO0FBQ0E7OztBQUdBLElBQUk7O0FBRUo7QUFDQTs7QUFFQTtBQUNBOztBQUVBLGVBQWUsQ0FBQztBQUNoQjtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTt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