1 line
111 KiB
JavaScript
1 line
111 KiB
JavaScript
(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["wizard-import_csv-ImportCSVWizardController","filebrowser-TImageBrowser"],{8326:(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval("/* provided dependency */ var jQuery = __webpack_require__(9755);\n( function( $ ) {\n\n\t$.fn.TImageBrowser = function( options ) {\n\t\tGlobal.addCss( 'global/widgets/filebrowser/TImageBrowser.css' );\n\t\tvar opts = $.extend( {}, $.fn.TImageBrowser.defaults, options );\n\n\t\tvar $this = this;\n\t\tvar field;\n\t\tvar id = 'file_browser';\n\t\tvar name = 'filedata';\n\t\tvar browser;\n\n\t\tvar accept_filter = '';\n\n\t\tvar default_width = 177;\n\t\tvar default_height = 42;\n\t\tvar enabled = true;\n\n\t\tthis.setEnabled = function( val ) {\n\t\t\tenabled = val;\n\n\t\t\tvar btn = this.find( '.browser-form input' );\n\n\t\t\tif ( !val ) {\n\t\t\t\tbtn.attr( 'disabled', true );\n\t\t\t\tbtn.removeClass( 'disable-element' ).addClass( 'disable-element' );\n\t\t\t} else {\n\t\t\t\tbtn.removeAttr( 'disabled' );\n\t\t\t\tbtn.removeClass( 'disable-element' );\n\t\t\t}\n\n\t\t};\n\n\t\tthis.clearErrorStyle = function() {\n\n\t\t};\n\n\t\tthis.getFileName = function() {\n\n\t\t\treturn browser.val();\n\t\t};\n\n\t\tthis.getField = function() {\n\t\t\treturn field;\n\t\t};\n\n\t\tthis.setEnableDelete = function( val ) {\n\t\t\tvar image = $this.find( '.image' );\n\t\t\tif ( !val ) {\n\t\t\t\timage.removeAttr( 'enable-delete' );\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\timage.attr( 'enable-delete', 1 );\n\t\t\t}\n\t\t};\n\n\t\tthis.getValue = function() {\n\t\t\tvar form_data;\n\t\t\tif ( browser && browser.val() ) {\n\n\t\t\t\tif ( typeof FormData == 'undefined' ) {\n\t\t\t\t\tform_data = $this.find( '.browser-form' );\n\t\t\t\t} else {\n\t\t\t\t\tform_data = new FormData( $( $this.find( '.browser-form' ) )[0] );\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tform_data = null;\n\t\t\t}\n\n\t\t\treturn form_data;\n\t\t};\n\n\t\tthis.getImageSrc = function() {\n\t\t\tvar image = $this.find( '.image' );\n\t\t\treturn image.attr( 'src' );\n\t\t};\n\n\t\tthis.setImage = function( val ) {\n\t\t\tvar image = $this.find( '.image' );\n\n\t\t\tif ( !val ) {\n\t\t\t\timage.attr( 'src', '' );\n\t\t\t\timage.hide();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar d = new Date();\n\t\t\timage.hide();\n\t\t\timage.attr( 'src', val + '&t=' + d.getTime() );\n\t\t\timage.css( 'height', 'auto' );\n\t\t\timage.css( 'width', 'auto' );\n\n\t\t};\n\n\t\tvar onImageLoad = function( image ) {\n\n\t\t\tvar image_height = $( image ).height() > 0 ? $( image ).height() : image.naturalHeight;\n\t\t\tvar image_width = $( image ).width() > 0 ? $( image ).width() : image.naturalWidth;\n\n\t\t\tif ( image_height > default_height ) {\n\t\t\t\t$( image ).css( 'height', default_height );\n\n\t\t\t}\n\n\t\t\tif ( image_width > default_width ) {\n\t\t\t\t$( image ).css( 'width', default_width );\n\t\t\t\t$( image ).css( 'height', 'auto' );\n\t\t\t}\n\n\t\t\t$this.trigger( 'setSize' );\n\n\t\t\tif ( image_height < 5 ) {\n\t\t\t\t$( image ).hide();\n\t\t\t} else {\n\t\t\t\t$( image ).show();\n\t\t\t}\n\t\t};\n\n\t\tthis.setValue = function( val ) {\n\n\t\t\tif ( !val ) {\n\t\t\t\tval = '';\n\t\t\t}\n\n\t\t};\n\n\t\tthis.each( function() {\n\t\t\tvar o = $.meta ? $.extend( {}, opts, $( this ).data() ) : opts;\n\n\t\t\tfield = o.field;\n\n\t\t\t// var $this = this;\n\n\t\t\tif ( o.default_width > 0 ) {\n\t\t\t\tdefault_width = o.default_width;\n\t\t\t}\n\n\t\t\tif ( o.default_height > 0 ) {\n\t\t\t\tdefault_height = o.default_height;\n\t\t\t}\n\n\t\t\tif ( Global.isSet( o.name ) ) {\n\t\t\t\tname = o.name;\n\t\t\t}\n\n\t\t\tif ( Global.isSet( accept_filter ) ) {\n\t\t\t\taccept_filter = o.accept_filter;\n\t\t\t}\n\n\t\t\tbrowser = $( this ).find( '.browser' );\n\t\t\tvar image = $( this ).find( '.image' );\n\t\t\timage.hide();\n\t\t\timage.on( 'load', function() {\n\t\t\t\tonImageLoad( this );\n\n\t\t\t} );\n\n\t\t\tif ( accept_filter ) {\n\t\t\t\tbrowser.attr( 'accept', accept_filter );\n\t\t\t} else {\n\t\t\t\taccept_filter = 'image/*';\n\t\t\t\tbrowser.attr( 'accept', 'image/*' );\n\t\t\t}\n\n\t\t\tbrowser.attr( 'id', id );\n\t\t\tbrowser.attr( 'name', name );\n\n\t\t\tif ( Global.isSet( o.changeHandler ) ) {\n\n\t\t\t\t$this.bind( 'imageChange', o.changeHandler );\n\t\t\t}\n\t\t\tif ( Global.isSet( o.deleteImageHandler ) ) {\n\t\t\t\tthis.find( '.file-browser' ).on( 'deleteClick', function() {\n\t\t\t\t\to.deleteImageHandler();\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\tbrowser.bind( 'change', function() {\n\t\t\t\timage.hide();\n\n\t\t\t\tif ( typeof FileReader != 'undefined' ) {\n\n\t\t\t\t\tvar files = !!this.files ? this.files : [];\n\n\t\t\t\t\t// If no files were selected, or no FileReader support, return\n\t\t\t\t\tif ( !files.length || !window.FileReader ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( accept_filter === 'image/*' ) {\n\t\t\t\t\t\t// Create a new instance of the FileReader\n\t\t\t\t\t\tvar reader = new FileReader();\n\n\t\t\t\t\t\t// Read the local file as a DataURL\n\t\t\t\t\t\treader.readAsDataURL( files[0] );\n\n\t\t\t\t\t\t// When loaded, set image data as background of div\n\t\t\t\t\t\treader.onloadend = function() {\n\t\t\t\t\t\t\tvar url = this.result;\n\t\t\t\t\t\t\timage.attr( 'src', url );\n\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\t$this.trigger( 'imageChange', [$this] );\n\n\t\t\t} );\n\n\t\t} );\n\n\t\treturn this;\n\n\t};\n\n\t$.fn.TImageBrowser.defaults = {};\n\t$.fn.TImageBrowser.html_template = `\n\t<div class=\"file-browser\">\n\t\t<img class=\"image\">\n\t\t<form enctype=\"multipart/form-data\" class=\"browser-form\">\n\t\t\t<input name=\"filedata\" class=\"browser\" type=\"file\"/>\n\t\t</form>\n\t</div>\n\t`;\n\n} )( jQuery );//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODMyNi5qcyIsIm1hcHBpbmdzIjoiO0FBQUE7O0FBRUE7QUFDQTtBQUNBLHlCQUF5Qjs7QUFFekI7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBOztBQUVBOztBQUVBOztBQUVBOztBQUVBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxLQUFLO0FBQ0w7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0EsTUFBTTtBQUNOO0FBQ0E7O0FBRUEsS0FBSzs7QUFFTDtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7O0FBRUE7O0FBRUE7QUFDQTs7Q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gPSB0aGlzLnJlc3VsdDtcblx0XHRcdFx0XHRcdFx0aW1hZ2UuYXR0ciggJ3NyYycsIHVybCApO1xuXG5cdFx0XHRcdFx0XHR9O1xuXHRcdFx0XHRcdH1cblxuXHRcdFx0XHR9XG5cblx0XHRcdFx0JHRoaXMudHJpZ2dlciggJ2ltYWdlQ2hhbmdlJywgWyR0aGlzXSApO1xuXG5cdFx0XHR9ICk7XG5cblx0XHR9ICk7XG5cblx0XHRyZXR1cm4gdGhpcztcblxuXHR9O1xuXG5cdCQuZm4uVEltYWdlQnJvd3Nlci5kZWZhdWx0cyA9IHt9O1xuXHQkLmZuLlRJbWFnZUJyb3dzZXIuaHRtbF90ZW1wbGF0ZSA9IGBcblx0PGRpdiBjbGFzcz1cImZpbGUtYnJvd3NlclwiPlxuXHRcdDxpbWcgY2xhc3M9XCJpbWFnZVwiPlxuXHRcdDxmb3JtIGVuY3R5cGU9XCJtdWx0aXBhcnQvZm9ybS1kYXRhXCIgY2xhc3M9XCJicm93c2VyLWZvcm1cIj5cblx0XHRcdDxpbnB1dCBuYW1lPVwiZmlsZWRhdGFcIiBjbGFzcz1cImJyb3dzZXJcIiB0eXBlPVwiZmlsZVwiLz5cblx0XHQ8L2Zvcm0+XG5cdDwvZGl2PlxuXHRgO1xuXG59ICkoIGpRdWVyeSApOyJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///8326\n")},8884:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ImportCSVWizardController\": () => (/* binding */ ImportCSVWizardController)\n/* harmony export */ });\n/* harmony import */ var _global_widgets_filebrowser_TImageBrowser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8326);\n/* harmony import */ var _global_widgets_filebrowser_TImageBrowser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_global_widgets_filebrowser_TImageBrowser__WEBPACK_IMPORTED_MODULE_0__);\n/* provided dependency */ var _ = __webpack_require__(9050);\n/* provided dependency */ var $ = __webpack_require__(9755);\n\n\nclass ImportCSVWizardController extends BaseWizardController {\n\tconstructor( options = {} ) {\n\t\t_.defaults( options, {\n\t\t\tel: '.wizard-bg',\n\n\t\t\tapi_import: null,\n\n\t\t\tparse_hint_source: null,\n\n\t\t\tfield_source: null,\n\n\t\t\tselect_grid_last_row: null,\n\n\t\t\tlast_id: 0, // Last grid id\n\n\t\t\tsaved_layout_array: null,\n\n\t\t\tcolumn_map_data: null, //Used to build grid data\n\n\t\t\t// _required_files: ['TImageBrowser']\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._( 'Import Wizard' );\n\t\tthis.steps = 6;\n\t\tthis.current_step = 1;\n\t\tthis.wizard_id = 'ProcessPayrollWizard';\n\t\tthis.api_import = TTAPI.APIImport;\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\n\t\tvar $this = this;\n\t\tthis.content_div.empty();\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._( 'Select the type of objects that you wish to import' ) );\n\n\t\t\t\tvar combo_box = this.getComboBox( 'import_class' );\n\n\t\t\t\tvar example_label = this.getLabel();\n\t\t\t\texample_label.text( $.i18n._( 'Download example CSV file' ) );\n\t\t\t\texample_label.css( 'text-decoration', 'underline' );\n\t\t\t\texample_label.css( 'cursor', 'pointer' );\n\t\t\t\texample_label.css( 'margin-top', '25px' );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step] = {};\n\t\t\t\tthis.stepsWidgetDic[this.current_step][combo_box.getField()] = combo_box;\n\n\t\t\t\texample_label.unbind( 'click' ).bind( 'click', function() {\n\n\t\t\t\t\tvar current_step_ui = $this.stepsWidgetDic[$this.current_step];\n\t\t\t\t\tvar current_value = current_step_ui.import_class.getValue().toLowerCase();\n\t\t\t\t\tvar url = ServiceCaller.getURLByObjectType( 'import_csv_example' ) + 'import_' + current_value + '_example.csv';\n\t\t\t\t\twindow.open( url, '_blank' );\n\t\t\t\t} );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step]['example_label'] = example_label;\n\n\t\t\t\tcombo_box.unbind( 'change' ).bind( 'change', function( e ) {\n\t\t\t\t\texample_label.text( $.i18n._( 'Download example' ) + ' ' + combo_box.getLabel() + ' ' + $.i18n._( 'CSV file' ) );\n\t\t\t\t} );\n\n\t\t\t\tthis.content_div.append( label );\n\t\t\t\tthis.content_div.append( combo_box );\n\t\t\t\tthis.content_div.append( example_label );\n\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tlabel = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Upload Comma Separated Value (CSV) text file' ) );\n\n\t\t\t\tvar file_browser = this.getFileBrowser( 'file_uploader', '.csv, .txt, .xls, .xlsx, .ods' );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step] = {};\n\t\t\t\tthis.stepsWidgetDic[this.current_step][file_browser.getField()] = file_browser;\n\n\t\t\t\tthis.content_div.append( label );\n\t\t\t\tthis.content_div.append( file_browser );\n\n\t\t\t\tfile_browser.unbind( 'imageChange' ).bind( 'imageChange', function() {\n\t\t\t\t\tif ( file_browser.getValue() ) {\n\t\t\t\t\t\tGlobal.setWidgetEnabled( $this.back_btn, true );\n\t\t\t\t\t\tGlobal.setWidgetEnabled( $this.next_btn, true );\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\tlabel = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Map columns from the uploaded file' ) );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step] = {};\n\n\t\t\t\t//Saved layout\n\n\t\t\t\tvar saved_layout_div = $( '<div></div>' );\n\n\t\t\t\tvar form_item_label = $( '<span></span>' );\n\n\t\t\t\tsaved_layout_div.append( form_item_label );\n\n\t\t\t\tform_item_label.text( $.i18n._( 'Save Mapping As' ) );\n\n\t\t\t\tvar save_mapping_input = Global.loadWidgetByName( FormItemType.TEXT_INPUT ).TTextInput();\n\n\t\t\t\tvar save_btn = $( '<input class=\\'t-button\\' style=\\'margin-left: 5px\\' type=\\'button\\' value=\\'' + $.i18n._( 'Save' ) + '\\'></input>' );\n\n\t\t\t\tsaved_layout_div.append( save_mapping_input );\n\t\t\t\tsaved_layout_div.append( save_btn );\n\n\t\t\t\tform_item_label = $( '<span style=\\'margin-left: 5px\\' >' + $.i18n._( 'Saved Mapping' ) + ':</span>' );\n\n\t\t\t\tvar previous_saved_layout_selector = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\t\t\tprevious_saved_layout_selector = previous_saved_layout_selector.TComboBox();\n\t\t\t\tprevious_saved_layout_selector.setValueKey( 'id' );\n\t\t\t\tprevious_saved_layout_selector.setLabelKey( 'name' );\n\n\t\t\t\tvar update_btn = $( '<input class=\\'t-button\\' style=\\'margin-left: 5px\\' type=\\'button\\' value=\\'' + $.i18n._( 'Update' ) + '\\'></input>' );\n\t\t\t\tvar del_btn = $( '<input class=\\'t-button\\' style=\\'margin-left: 5px\\' type=\\'button\\' value=\\'' + $.i18n._( 'Delete' ) + '\\'></input>' );\n\n\t\t\t\tsave_btn.unbind( 'click' ).bind( 'click', function() {\n\t\t\t\t\tvar name = save_mapping_input.getValue();\n\t\t\t\t\tif ( !name ) {\n\t\t\t\t\t\tTAlertManager.showAlert( $.i18n._( 'Mapping Name is blank' ) );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t$this.saveNewMapping( save_mapping_input.getValue() );\n\t\t\t\t} );\n\n\t\t\t\tupdate_btn.unbind( 'click' ).bind( 'click', function() {\n\t\t\t\t\t$this.updateSelectMapping( previous_saved_layout_selector.getValue() );\n\t\t\t\t} );\n\n\t\t\t\tdel_btn.unbind( 'click' ).bind( 'click', function() {\n\t\t\t\t\t$this.deleteSelectMapping( previous_saved_layout_selector.getValue() );\n\t\t\t\t} );\n\n\t\t\t\tsaved_layout_div.append( form_item_label );\n\t\t\t\tsaved_layout_div.append( previous_saved_layout_selector );\n\t\t\t\tsaved_layout_div.append( update_btn );\n\t\t\t\tsaved_layout_div.append( del_btn );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step]['saved_mapping'] = previous_saved_layout_selector;\n\n\t\t\t\tprevious_saved_layout_selector.bind( 'formItemChange', function( e, target ) {\n\t\t\t\t\t$this.onSavedLayoutChange( target.getValue() );\n\t\t\t\t} );\n\n\t\t\t\t//add minus buttons\n\t\t\t\tvar action_button_div = $( '<div style=\"margin-left: 15px;text-align: left; margin-bottom: 5px;\"></div>' );\n\t\t\t\tvar add_icon = $( '<button class=\"plus-icon\" style=\"margin-right: 5px;\"></button>' );\n\t\t\t\tvar minus_icon = $( '<button class=\"minus-icon\"></button>' );\n\n\t\t\t\taction_button_div.append( add_icon );\n\t\t\t\taction_button_div.append( minus_icon );\n\n\t\t\t\tthis.content_div.append( label );\n\t\t\t\tthis.content_div.append( saved_layout_div );\n\t\t\t\tthis.content_div.append( action_button_div );\n\n\t\t\t\tvar grid_id = 'import_data';\n\t\t\t\tvar grid_div = $( '<div class=\\'grid-div wizard-grid-div\\'> <table id=\\'' + grid_id + '\\'></table></div>' );\n\t\t\t\tthis.setImportGrid( grid_id, grid_div );\n\n\t\t\t\tadd_icon.bind( 'click', function() {\n\t\t\t\t\t$this.addRow();\n\t\t\t\t} );\n\n\t\t\t\tminus_icon.bind( 'click', function() {\n\t\t\t\t\t$this.minusRow();\n\t\t\t\t} );\n\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tlabel = this.getLabel();\n\t\t\t\tlabel.text( $.i18n._( 'Select import settings' ) );\n\n\t\t\t\tthis.content_div.append( label );\n\n\t\t\t\tthis.stepsWidgetDic[this.current_step] = {};\n\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\n\t\t}\n\t}\n\n\tonSavedLayoutChange( value ) {\n\t\tvar grid = this.stepsWidgetDic[this.current_step].import_data;\n\n\t\tvar len = this.saved_layout_array.length;\n\n\t\tvar id = 1;\n\n\t\tvar select_data = {};\n\n\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\tvar layout = this.saved_layout_array[i];\n\n\t\t\tif ( layout.id === value ) {\n\t\t\t\tselect_data = layout.data;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tfor ( var i = 0; i < select_data.length; i++ ) {\n\t\t\tvar item = select_data[i];\n\t\t\titem.id = 'csv' + id;\n\t\t\titem.field = item.field ? item.field : TTUUID.zero_id; //Make sure any blank fields are converted to zero_ids to prevent \"undefined\" from appearing in place of the dropdown box.\n\t\t\tid = id + 1;\n\t\t}\n\n\t\tthis.last_id = id;\n\n\t\t//Clone this array because its currently a reference to the raw grid data itself and grid.setData() clears out the grid before rendering it again, which results in a blank grid when switching from a saved mapping, then back to the original.\n\t\tselect_data = this.setSampleRowBaseOnImportFile( select_data ).slice( 0 );\n\n\t\tgrid.setData( select_data );\n\n\t\tthis.bindGridRenderEvents( grid );\n\t}\n\n\tsetSampleRowBaseOnImportFile( grid_data ) {\n\t\tif ( !this.import_data || !grid_data ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor ( var i = 0; i < grid_data.length; i++ ) {\n\t\t\tvar item = grid_data[i];\n\t\t\titem.row_1 = '';\n\t\t\tfor ( var j = 0; j < this.import_data.length; j++ ) {\n\t\t\t\tvar import_data = this.import_data[j];\n\n\t\t\t\t//#2132 - match based on map_column_name\n\t\t\t\tif ( item && item.map_column_name && import_data && import_data.map_column_name ) {\n\t\t\t\t\tif ( item.map_column_name.trim() === import_data.map_column_name.trim() ) {\n\t\t\t\t\t\titem.row_1 = import_data.row_1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn grid_data;\n\t}\n\n\tgetSavedMapping( select_layout_id ) {\n\t\tvar $this = this;\n\t\tvar args = {};\n\t\tvar filter_data = {};\n\t\tfilter_data.script = 'import_wizard' + this.stepsDataDic[1].import_class;\n\t\tfilter_data.deleted = false;\n\t\targs.filter_data = filter_data;\n\t\tTTAPI.APIUserGenericData.getUserGenericData( args, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tvar res_data = result.getResult();\n\t\t\t\tif ( $.type( res_data ) !== 'array' ) {\n\t\t\t\t\t$this.saveNewMapping( BaseViewController.default_layout_name, true );\n\t\t\t\t} else {\n\t\t\t\t\t//Force sorting by name so -- DEFAULT -- record appears at the top.\n\t\t\t\t\tres_data.sort( function( a, b ) {\n\t\t\t\t\t\t\treturn Global.compare( a, b, 'name' );\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\n\t\t\t\t\t$this.saved_layout_array = res_data;\n\n\t\t\t\t\t//If not set select layout, default to first one and update it to current upload columns\n\t\t\t\t\tif ( !select_layout_id ) {\n\t\t\t\t\t\tselect_layout_id = res_data[0].id;\n\n\t\t\t\t\t\t//Only update the first saved import data record if it is infact the DEFAULT one, otherwise it could overwrite some other random saved mapping, especially if they happen to the delete the default one.\n\t\t\t\t\t\t// It has to update the DEFAULT saved mapping, otherwise if the user changes to a different mapping, then changes back, all the settings will be lost.\n\t\t\t\t\t\tif ( res_data[0].is_default == true || res_data[0].name == BaseViewController.default_layout_name ) {\n\t\t\t\t\t\t\t$this.updateSelectMapping( select_layout_id );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$this.saveNewMapping( BaseViewController.default_layout_name, true );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$this.setSavedMappingOptions( res_data, select_layout_id );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tgetLayoutById( select_id ) {\n\t\tvar len = this.saved_layout_array.length;\n\n\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\tvar layout = this.saved_layout_array[i];\n\n\t\t\tif ( layout.id === select_id ) {\n\t\t\t\treturn layout;\n\t\t\t}\n\t\t}\n\t}\n\n\tdeleteSelectMapping( select_id ) {\n\t\tvar $this = this;\n\t\tvar select_layout = this.getLayoutById( select_id );\n\n\t\tif ( select_layout.is_default == true || select_layout.name === BaseViewController.default_layout_name ) {\n\t\t\tTAlertManager.showAlert( $.i18n._( 'Can\\'t delete default layout' ) );\n\t\t\treturn;\n\t\t}\n\n\t\tTAlertManager.showConfirmAlert( $.i18n._( 'Are you sure you wish to continue?' ), null, function( flag ) {\n\t\t\tif ( flag ) {\n\t\t\t\tTTAPI.APIUserGenericData.deleteUserGenericData( select_id, {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t$this.onSavedLayoutChange( $this.saved_layout_array[0].id );\n\t\t\t\t\t\t$this.getSavedMapping();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\tupdateSelectMapping( select_id ) {\n\t\tvar $this = this;\n\n\t\tthis.saveCurrentStep();\n\t\tvar select_layout = this.getLayoutById( select_id );\n\n\t\tselect_layout.data = this.stepsDataDic[this.current_step].import_data_for_layout;\n\n\t\tTTAPI.APIUserGenericData.setUserGenericData( select_layout, {\n\t\t\tonResult: function( result ) {\n\t\t\t\t//Refresh saved mapping data once it has been saved on the server.\n\t\t\t\t// This makes it so if the user clicks the UPDATE button, then switches to another saved mapping, then switches back, they will see their most recent settings.\n\t\t\t\t$this.getSavedMapping( select_id );\n\t\t\t}\n\t\t} );\n\t}\n\n\tsaveNewMapping( name, is_default ) {\n\t\tthis.saveCurrentStep();\n\n\t\tvar $this = this;\n\t\tvar args = {};\n\t\targs.script = 'import_wizard' + this.stepsDataDic[1].import_class;\n\t\targs.name = name;\n\t\targs.is_default = ( is_default && is_default == true ? true : false );\n\t\targs.data = this.stepsDataDic[this.current_step].import_data_for_layout;\n\n\t\tTTAPI.APIUserGenericData.setUserGenericData( args, {\n\t\t\tonResult: function( result ) {\n\t\t\t\tif ( !result.isValid() ) {\n\t\t\t\t\tTAlertManager.showErrorAlert( result );\n\t\t\t\t} else {\n\t\t\t\t\t$this.getSavedMapping( result.getResult() );\n\t\t\t\t}\n\n\t\t\t}\n\t\t} );\n\t}\n\n\tsetSavedMappingOptions( array, select_layout_id ) {\n\t\tvar $this = this;\n\n\t\tif ( Global.isSet( $this.stepsWidgetDic[$this.current_step]['saved_mapping'] ) == true ) {\n\t\t\tvar selector = $this.stepsWidgetDic[$this.current_step]['saved_mapping'];\n\n\t\t\tselector.setSourceData( array );\n\n\t\t\tif ( select_layout_id ) {\n\t\t\t\tselector.setValue( select_layout_id );\n\t\t\t}\n\t\t}\n\t\t$this.saved_layout_array = array;\n\t}\n\n\taddRow() {\n\t\tvar grid = this.stepsWidgetDic[this.current_step].import_data;\n\t\tvar all_data = grid.getData();\n\n\t\tvar data = {};\n\t\tdata.id = 'csv' + this.last_id;\n\t\tdata.field = TTUUID.zero_id;\n\t\tdata.default_value = '';\n\t\tdata.parse_hint = '';\n\t\tdata.map_column_name = $.i18n._( 'New Field Column' );\n\t\tdata.row_1 = '';\n\n\t\tthis.last_id = this.last_id + 1;\n\n\t\tall_data.push( data );\n\n\t\tgrid.setData( all_data, false );\n\n\t\tgrid.grid.jqGrid( 'setSelection', data.id );\n\n\t\tthis.bindGridRenderEvents( grid );\n\t}\n\n\tminusRow() {\n\n\t\tvar grid = this.stepsWidgetDic[this.current_step].import_data;\n\t\tvar sel_id = grid.getGridParam( 'selrow' );\n\n\t\tif ( !sel_id ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar all_data = grid.getGridParam( 'data' );\n\n\t\tfor ( var i = all_data.length - 1; i >= 0; i-- ) {\n\t\t\tvar data = all_data[i];\n\n\t\t\tif ( data.id === sel_id ) {\n\t\t\t\tall_data.splice( i, 1 );\n\t\t\t}\n\t\t}\n\n\t\tgrid.setData( all_data, false );\n\n\t\tgrid.grid.jqGrid( 'setSelection', all_data[all_data.length - 1].id );\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 'import_data':\n\n\t\t\t\tvar column_info = {\n\t\t\t\t\tname: 'map_column_name',\n\t\t\t\t\tindex: 'map_column_name',\n\t\t\t\t\tlabel: $.i18n._( 'File Column' ),\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: 'field',\n\t\t\t\t\tindex: 'field',\n\t\t\t\t\tlabel: $.i18n._( 'Field' ),\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.onFieldRender( 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: 'default_value',\n\t\t\t\t\tindex: 'default_value',\n\t\t\t\t\tlabel: $.i18n._( 'Default Value' ),\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: 'parse_hint',\n\t\t\t\t\tindex: 'parse_hint',\n\t\t\t\t\tlabel: $.i18n._( 'Parse Hint' ),\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.onParseHintRender( 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: 'row_1',\n\t\t\t\t\tindex: 'row_1',\n\t\t\t\t\tlabel: $.i18n._( 'Sample Row' ),\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};\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\tonParseHintRender( cell_value, related_data, row ) {\n\t\tvar widget;\n\t\tvar col_model = related_data.colModel;\n\t\tvar row_id = related_data.rowId;\n\n\t\tif ( this.parse_hint_source[row.field] ) {\n\t\t\twidget = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\t\twidget = widget.TComboBox( { set_empty: false } );\n\n\t\t\twidget.attr( 'custom_cell', 'true' );\n\t\t\twidget.attr( 'render_type', 'combobox' );\n\t\t\twidget.attr( 'id', row_id + '_' + col_model.name );\n\t\t\twidget.width( '97%' );\n\n\t\t\tvar source = Global.buildRecordArray( this.parse_hint_source[row.field] );\n\t\t\twidget.setSourceData( source );\n\n\t\t\tif ( cell_value ) {\n\t\t\t\twidget.setValue( cell_value );\n\t\t\t} else {\n\t\t\t\twidget.setValue( source[0].value );\n\t\t\t\trow.parse_hint = source[0].value;\n\t\t\t}\n\n\t\t} else {\n\t\t\twidget = $( '<input custom_cell=\"true\" ' +\n\t\t\t\t'render_type=\"text\" ' +\n\t\t\t\t'id=\"' + row_id + '_' + col_model.name + '\" ' +\n\t\t\t\t'type=\"text\" ' +\n\t\t\t\t'class=\"t-text-input\" ' +\n\t\t\t\t'style=\"width: 97%\">' );\n\n\t\t\twidget.text( cell_value );\n\t\t}\n\n\t\treturn widget.get( 0 ).outerHTML;\n\t}\n\n\tonFieldRender( cell_value, related_data, row ) {\n\t\tif ( !cell_value ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar col_model = related_data.colModel;\n\t\tvar row_id = related_data.rowId;\n\n\t\tvar acombobox = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\tacombobox = acombobox.TComboBox( { set_empty: true } );\n\n\t\tacombobox.attr( 'custom_cell', 'true' );\n\t\tacombobox.attr( 'render_type', 'combobox' );\n\t\tacombobox.attr( 'id', row_id + '_' + col_model.name );\n\t\tacombobox.width( '97%' );\n\n\t\tacombobox.setSourceData( this.field_source );\n\n\t\t$( acombobox[0] ).find( '[value=' + cell_value + ']' ).attr( 'selected', true );\n\n\t\treturn acombobox.get( 0 ).outerHTML;\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\treturn '<input custom_cell=\"true\" render_type=\"text\" id=\"' + row_id + '_' + col_model.name + '\" value=\"' + cell_value + '\" type=\"text\" class=\"t-text-input\" style=\"width: 97%\">';\n\t}\n\n\tbuildCurrentStepData() {\n\n\t\tvar grid;\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\tswitch ( this.current_step ) {\n\t\t\tcase 1:\n\t\t\t\tthis.api_import.getImportObjects( {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\tvar combo_box = current_step_ui['import_class'];\n\t\t\t\t\t\tvar array = Global.buildRecordArray( result.getResult() );\n\t\t\t\t\t\tcombo_box.setSourceData( array );\n\n\t\t\t\t\t\tif ( current_step_data ) {\n\t\t\t\t\t\t\tcombo_box.setValue( current_step_data.import_class );\n\t\t\t\t\t\t} else if ( $this.default_data ) {\n\t\t\t\t\t\t\tcombo_box.setValue( $this.default_data );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar example_label = current_step_ui.example_label;\n\t\t\t\t\t\texample_label.text( $.i18n._( 'Download example' ) + ' ' + combo_box.getLabel() + ' ' + $.i18n._( 'CSV file' ) );\n\t\t\t\t\t\t$this.setButtonsStatus(); // set button enabled or disabled\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\n\t\t\t\tgrid = current_step_ui.import_data;\n\t\t\t\tif ( current_step_data && current_step_data.import_data_for_layout ) {\n\n\t\t\t\t\tcurrent_step_data.import_data_for_layout = this.setSampleRowBaseOnImportFile( current_step_data.import_data_for_layout );\n\n\t\t\t\t\tgrid.setData( current_step_data.import_data_for_layout );\n\n\t\t\t\t\t$this.bindGridRenderEvents( grid );\n\n\t\t\t\t\t$this.setSavedMappingOptions( $this.saved_layout_array, current_step_data.saved_mapping );\n\n\t\t\t\t\t$this.setButtonsStatus(); // set button enabled or disabled\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.api_import.getOptions( 'parse_hint', {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t$this.parse_hint_source = result.getResult();\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\tthis.api_import.getOptions( 'columns', {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\t$this.field_source = Global.buildRecordArray( result.getResult() );\n\t\t\t\t\t\t$this.api_import.getRawData( 1, {\n\t\t\t\t\t\t\tonResult: function( getRawDataRes ) {\n\n\t\t\t\t\t\t\t\tvar raw_data = getRawDataRes.getResult();\n\t\t\t\t\t\t\t\traw_data = $this.buildMappingGridDataArray( raw_data[0] );\n\n\t\t\t\t\t\t\t\t$this.api_import.generateColumnMap( {\n\t\t\t\t\t\t\t\t\tonResult: function( generateColumnMapRes ) {\n\t\t\t\t\t\t\t\t\t\t$this.column_map_data = generateColumnMapRes.getResult();\n\n\t\t\t\t\t\t\t\t\t\tvar len = raw_data.length;\n\t\t\t\t\t\t\t\t\t\tfor ( var key in $this.column_map_data ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tvar raw_data_item = raw_data[i];\n\t\t\t\t\t\t\t\t\t\t\t\tvar col_map_data_item = $this.column_map_data[key];\n\t\t\t\t\t\t\t\t\t\t\t\tif ( raw_data_item.map_column_name == col_map_data_item.map_column_name ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\traw_data_item.field = key;\n\t\t\t\t\t\t\t\t\t\t\t\t\traw_data_item.default_value = $this.column_map_data[key].default_value ? $this.column_map_data[key].default_value : '';\n\t\t\t\t\t\t\t\t\t\t\t\t\traw_data_item.parse_hint = $this.column_map_data[key].parse_hint ? $this.column_map_data[key].parse_hint : '';\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\traw_data.sort( function( a, b ) {\n\t\t\t\t\t\t\t\t\t\t\t\treturn Global.compare( a, b, 'map_column_name' );\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t\t// use to set Sample row to same layout\n\t\t\t\t\t\t\t\t\t\t$this.import_data = raw_data;\n\n\t\t\t\t\t\t\t\t\t\tgrid.setData( raw_data );\n\n\t\t\t\t\t\t\t\t\t\t$this.bindGridRenderEvents( grid );\n\n\t\t\t\t\t\t\t\t\t\t$this.getSavedMapping();\n\t\t\t\t\t\t\t\t\t\t$this.setButtonsStatus(); // set button enabled or disabled\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}\n\t\t\t\t\t\t} );\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\tthis.api_import.getOptions( 'import_options', {\n\t\t\t\t\tonResult: function( result ) {\n\t\t\t\t\t\tvar result_data = Global.buildRecordArray( result.getResult() );\n\t\t\t\t\t\tvar div = $( '<div style=\"text-align: left;margin-left: 15px;\"></div>' );\n\n\t\t\t\t\t\tfor ( var i = 0; i < result_data.length; i++ ) {\n\t\t\t\t\t\t\tvar item = result_data[i];\n\t\t\t\t\t\t\tvar check_box = $this.getCheckBox( item.value );\n\n\t\t\t\t\t\t\tif ( current_step_data && current_step_data[item.value] ) {\n\t\t\t\t\t\t\t\tcheck_box.setValue( current_step_data[item.value] );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar label = $( '<label class=\"wizard-checkbox-label\" style=\"display: block;\">' + item.label + '</label>' );\n\t\t\t\t\t\t\tlabel.prepend( check_box );\n\t\t\t\t\t\t\t$this.stepsWidgetDic[$this.current_step][item.value] = check_box;\n\n\t\t\t\t\t\t\tdiv.append( label );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this.content_div.append( div );\n\t\t\t\t\t\t$this.setButtonsStatus(); // set button enabled or disabled\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tvar import_data = this.stepsDataDic[3].import_data;\n\t\t\t\tvar import_options = this.stepsDataDic[4];\n\n\t\t\t\tthis.api_import.import( import_data, import_options, true, {\n\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\tif ( $this.current_step != 5 ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( result.isValid() ) {\n\t\t\t\t\t\t\tvar label = $this.getLabel();\n\t\t\t\t\t\t\tlabel.text( $.i18n._( 'Data verification successful' ) );\n\n\t\t\t\t\t\t\t$this.content_div.append( label );\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tvar data_grid_error_source = $this.createErrorSource( result.getDetails() );\n\t\t\t\t\t\t\t$this.showErrorGrid( $.i18n._( 'Verification failed due to the following reasons' ) + ': ',\n\t\t\t\t\t\t\t\tdata_grid_error_source,\n\t\t\t\t\t\t\t\t$.i18n._( 'Continue to the next step to skip importing invalid records.' ),\n\t\t\t\t\t\t\t\tresult.getRecordDetails() );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this.setButtonsStatus(); // set button enabled or disabled\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\timport_data = this.stepsDataDic[3].import_data;\n\t\t\t\timport_options = this.stepsDataDic[4];\n\n\t\t\t\tthis.api_import.setIsIdempotent( true ); //Force to idempotent API call to avoid duplicate network requests from causing errors displayed to the user.\n\t\t\t\tthis.api_import.import( import_data, import_options, false, {\n\t\t\t\t\tonResult: function( result ) {\n\n\t\t\t\t\t\tif ( $this.current_step != 6 ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( result.isValid() ) {\n\t\t\t\t\t\t\tvar label = $this.getLabel();\n\t\t\t\t\t\t\tlabel.text( $.i18n._( 'Import successful' ) );\n\n\t\t\t\t\t\t\t$this.content_div.append( label );\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tvar data_grid_error_source = $this.createErrorSource( result.getDetails() );\n\n\t\t\t\t\t\t\t$this.showErrorGrid( $.i18n._( 'Import failed due to the following reasons' ) + ':',\n\t\t\t\t\t\t\t\tdata_grid_error_source,\n\t\t\t\t\t\t\t\t$.i18n._( 'Invalid records have been skipped, all other records have been imported successfully.' ),\n\t\t\t\t\t\t\t\tresult.getRecordDetails() );\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this.setButtonsStatus(); // set button enabled or disabled\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$this.setButtonsStatus(); // set button enabled or disabled\n\t\t\t\tbreak;\n\n\t\t}\n\t}\n\n\tshowErrorGrid( top_des, data_grid_error_source, bottom_des, records_details ) {\n\t\tvar label = $( '<span class=\\'top-des clear-both-div\\'></span>' );\n\t\tlabel.text( top_des );\n\n\t\tthis.content_div.append( label );\n\n\t\tvar grid = $( '<table id=\"error_grid\"></table>' );\n\n\t\tvar columns = [];\n\n\t\tvar column_info = {\n\t\t\tname: 'rowIndex',\n\t\t\tindex: 'rowIndex',\n\t\t\tlabel: $.i18n._( 'Row' ),\n\t\t\twidth: 60,\n\t\t\tsortable: false,\n\t\t\ttitle: false,\n\t\t\tfixed: true\n\t\t};\n\t\tcolumns.push( column_info );\n\n\t\tcolumn_info = {\n\t\t\tname: 'row',\n\t\t\tindex: 'row',\n\t\t\tlabel: $.i18n._( 'File Column' ),\n\t\t\twidth: 100,\n\t\t\tsortable: false,\n\t\t\ttitle: false\n\t\t};\n\t\tcolumns.push( column_info );\n\n\t\tcolumn_info = {\n\t\t\tname: 'column',\n\t\t\tindex: 'column',\n\t\t\tlabel: $.i18n._( 'Field' ),\n\t\t\twidth: 100,\n\t\t\tsortable: false,\n\t\t\ttitle: false\n\t\t};\n\t\tcolumns.push( column_info );\n\n\t\tcolumn_info = {\n\t\t\tname: 'message',\n\t\t\tindex: 'message',\n\t\t\tlabel: $.i18n._( 'Message' ),\n\t\t\twidth: 100,\n\t\t\tsortable: false,\n\t\t\ttitle: false\n\t\t};\n\t\tcolumns.push( column_info );\n\n\t\tthis.content_div.append( grid );\n\n\t\tlabel = $( '<span class=\\'total-des clear-both-div\\'></span>' );\n\t\tlabel.text( $.i18n._( 'Records' ) + ':' + $.i18n._( 'Total' ) + ': ' + records_details.total + ' ' + $.i18n._( 'Valid' ) + ': ' + records_details.valid + ' ' + $.i18n._( 'Invalid' ) + ': ' + records_details.invalid );\n\n\t\tthis.content_div.append( label );\n\n\t\tlabel = $( '<span class=\\'bottom-des clear-both-div\\'></span>' );\n\t\tlabel.text( bottom_des );\n\n\t\tthis.content_div.append( label );\n\n\t\tgrid = new TTGrid( 'error_grid', {\n\t\t\tsortable: false,\n\t\t\twidth: ( this.content_div.width() - 2 )\n\t\t}, columns );\n\t\tgrid.setData( data_grid_error_source );\n\t\tgrid.setGridColumnsWidth( null, { max_grid_width: ( this.content_div.width() - 2 ) } );\n\t}\n\n\tcreateErrorSource( error_array ) {\n\n\t\t//Error: Uncaught TypeError: Cannot read property 'import_data' of undefined in /interface/html5/#!m=TimeSheet&date=00070609&user_id=14372 line 773\n\t\tif ( !this.stepsDataDic || !this.stepsDataDic[3] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar import_data = this.stepsDataDic[3].import_data;\n\t\tvar result = [];\n\t\tvar error_row = {};\n\n\t\tfor ( var key in error_array ) {\n\t\t\tvar error_info = error_array[key]['error'];\n\t\t\tfor ( var error_key in error_info ) {\n\t\t\t\tif ( !error_info.hasOwnProperty( error_key ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\terror_row = {};\n\t\t\t\t// #2345 - we always want the row and column name to show in the error report.\n\t\t\t\terror_row.rowIndex = parseInt( key ) + 2;\n\t\t\t\terror_row.row = $.i18n._( 'Unknown' );\n\t\t\t\terror_row.column = error_key;\n\t\t\t\terror_row.message = error_info[error_key][0];\n\n\t\t\t\t// Try to get more specific error info.\n\t\t\t\tfor ( var import_key in import_data ) {\n\t\t\t\t\tif ( import_key == error_key ) { // #2345 - This won't match in cases where the csv columns do not match the object properties being validated. For example 'branch' != 'branch_id'\n\t\t\t\t\t\terror_row.row = import_data[import_key].map_column_name;\n\t\t\t\t\t\terror_row.column = import_data[import_key].field_name;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tresult.push( error_row );\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tbindGridRenderEvents( grid ) {\n\t\tvar $this = this;\n\t\tvar inputs = grid.grid.find( 'input[custom_cell=\"true\"]' );\n\t\tvar select = grid.grid.find( 'select[custom_cell=\"true\"]' );\n\n\t\tinputs.unbind( 'change' ).bind( 'change', function( e ) {\n\t\t\t$this.onCellInputChange( e );\n\t\t} );\n\n\t\tselect.unbind( 'change' ).bind( 'change', function( e ) {\n\t\t\t$this.onCellInputChange( e );\n\t\t} );\n\n\t\tinputs.unbind( 'focusin' ).bind( 'focusin', function( e ) {\n\t\t\t$this.onCellFocusIn( e );\n\t\t} );\n\n\t\tselect.unbind( 'focusin' ).bind( 'focusin', function( e ) {\n\t\t\t$this.onCellFocusIn( e );\n\t\t} );\n\t}\n\n\tonCellFocusIn( e ) {\n\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\t\tvar grid = current_step_ui['import_data'];\n\t\tvar target = $( e.target );\n\t\tvar target_id = target.attr( 'id' );\n\t\tvar row_id = target_id.split( '_' )[0];\n\n\t\tgrid.grid.jqGrid( 'setSelection', row_id );\n\t}\n\n\tonCellInputChange( e ) {\n\t\tvar $this = this;\n\t\tvar current_step_ui = this.stepsWidgetDic[this.current_step];\n\t\tvar grid = current_step_ui['import_data'];\n\t\tvar target = $( e.target );\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.val();\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\t\t\tif ( row_data.id === row_id ) {\n\t\t\t\trow_data[field] = target_val;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif ( field === 'field' ) {\n\t\t\tupdateParseHintWidget();\n\t\t}\n\n\t\tfunction updateParseHintWidget() {\n\t\t\tvar widget;\n\t\t\tvar parse_hint_widget = target.parent().parent().find( '#' + row_id + '_parse_hint' );\n\t\t\tvar render_type = parse_hint_widget.attr( 'render_type' );\n\n\t\t\trow_data['parse_hint'] = '';\n\n\t\t\tif ( $this.parse_hint_source[target_val] ) {\n\n\t\t\t\twidget = Global.loadWidgetByName( FormItemType.COMBO_BOX );\n\t\t\t\twidget = widget.TComboBox( { set_empty: false } );\n\n\t\t\t\twidget.attr( 'custom_cell', 'true' );\n\t\t\t\twidget.attr( 'render_type', 'combobox' );\n\t\t\t\twidget.attr( 'id', row_id + '_parse_hint' );\n\t\t\t\twidget.width( '97%' );\n\n\t\t\t\tvar source = Global.buildRecordArray( $this.parse_hint_source[target_val] );\n\t\t\t\twidget.setSourceData( Global.buildRecordArray( $this.parse_hint_source[target_val] ) );\n\t\t\t\twidget.setValue( source[0].value );\n\t\t\t\trow_data['parse_hint'] = source[0].value;\n\n\t\t\t\tparse_hint_widget.parent().append( widget );\n\t\t\t\tparse_hint_widget.remove();\n\n\t\t\t} else {\n\n\t\t\t\twidget = $( '<input custom_cell=\"true\" ' +\n\t\t\t\t\t'render_type=\"text\" ' +\n\t\t\t\t\t'id=\"' + row_id + '_parse_hint\" ' +\n\t\t\t\t\t'value=\"\" ' +\n\t\t\t\t\t'type=\"text\" ' +\n\t\t\t\t\t'class=\"t-text-input\" ' +\n\t\t\t\t\t'style=\"width: 97%\">' );\n\n\t\t\t\tparse_hint_widget.parent().append( widget );\n\t\t\t\tparse_hint_widget.remove();\n\n\t\t\t}\n\n\t\t\twidget.bind( 'change', function( e ) {\n\t\t\t\t$this.onCellInputChange( e );\n\t\t\t} );\n\n\t\t}\n\t}\n\n\tsetImportGrid( gridId, grid_div, allMultipleSelection ) {\n\n\t\tif ( !allMultipleSelection ) {\n\t\t\tallMultipleSelection = false;\n\t\t}\n\n\t\tvar $this = this;\n\n\t\tthis.content_div.append( grid_div );\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: 300,\n\t\t\t\tmultiselect: allMultipleSelection,\n\t\t\t\tmultiboxonly: allMultipleSelection,\n\t\t\t\tediturl: 'clientArray'\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\tbuildMappingGridDataArray( mappingData ) {\n\n\t\tvar result = [];\n\t\tvar id = 1;\n\t\tfor ( var key in mappingData ) {\n\t\t\tif ( !mappingData.hasOwnProperty( key ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar item = mappingData[key];\n\t\t\tvar data = {};\n\t\t\tdata.id = 'csv' + id;\n\t\t\tdata.field = item.field ? item.field : TTUUID.zero_id;\n\t\t\tdata.default_value = item.default_value ? item.default_value : '';\n\t\t\tdata.parse_hint = item.parse_hint ? item.parse_hint : '';\n\t\t\tdata.map_column_name = item.map_column_name ? item.map_column_name : key;\n\t\t\tdata.row_1 = item.row_1 ? item.row_1 : item;\n\t\t\tresult.push( data );\n\n\t\t\tid = id + 1;\n\n\t\t}\n\n\t\tthis.last_id = id;\n\n\t\treturn result;\n\t}\n\n\tonDoneClick() {\n\t\tthis.cleanStepsData();\n\t\tLocalCacheData.current_open_wizard_controllers = LocalCacheData.current_open_wizard_controllers.filter( wizard => wizard.wizard_id !== this.wizard_id );\n\t\tthis.saveAllStepsToUserGenericData( function() {\n\n\t\t} );\n\n\t\tif ( this.call_back ) {\n\t\t\tthis.call_back();\n\t\t}\n\n\t\t$( this.el ).remove();\n\t}\n\n\tinitCurrentStep() {\n\n\t\tvar $this = this;\n\t\t$this.progress_label.text( 'Step ' + $this.current_step + ' of ' + $this.steps );\n\t\t$this.progress.attr( 'max', $this.steps );\n\t\t$this.progress.val( $this.current_step );\n\n\t\t$this.buildCurrentStepUI();\n\t\t$this.buildCurrentStepData();\n\t\t$this.setCurrentStepValues();\n\t}\n\n\tonNextClick() {\n\t\tvar $this = this;\n\t\tthis.saveCurrentStep();\n\t\tvar current_step_data = this.stepsDataDic[this.current_step];\n\t\tGlobal.setWidgetEnabled( this.back_btn, false );\n\t\tGlobal.setWidgetEnabled( this.next_btn, false );\n\t\tif ( this.current_step === 2 ) {\n\n\t\t\tif ( !current_step_data.file_uploader ) {\n\t\t\t\tTAlertManager.showAlert( $.i18n._( 'Please choose a CSV file first' ) );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$this.api_import.uploadFile( current_step_data.file_uploader, 'object_type=import&object_id=' + this.api_import.className, {\n\t\t\t\tonResult: function( upload_file_result ) {\n\t\t\t\t\tif ( upload_file_result.toLowerCase() !== 'true' ) {\n\t\t\t\t\t\t$this.setButtonsStatus(); // set button enabled or disabled\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t$this.current_step = $this.current_step + 1;\n\n\t\t\t\t\t$this.stepsDataDic[$this.current_step] = null;\n\t\t\t\t\t$this.initCurrentStep();\n\n\t\t\t\t}\n\t\t\t} );\n\n\t\t} else {\n\n\t\t\tthis.current_step = this.current_step + 1;\n\t\t\tthis.initCurrentStep();\n\t\t}\n\t}\n\n\tbuildImportMapping( array ) {\n\n\t\tvar result = {};\n\t\tvar content;\n\n\t\tvar len = array.length;\n\n\t\tfor ( var i = 0; i < len; i++ ) {\n\t\t\tvar item = array[i];\n\t\t\tif ( item.field ) {\n\t\t\t\tcontent = {};\n\t\t\t\tcontent.field = item.field;\n\t\t\t\tcontent.map_column_name = item.map_column_name;\n\t\t\t\tcontent.default_value = item.default_value;\n\t\t\t\tcontent.parse_hint = item.parse_hint;\n\t\t\t\tresult[item.field] = content;\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/* jshint ignore:start */\n\tsaveCurrentStep() {\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\tcurrent_step_data.import_class = current_step_ui.import_class.getValue();\n\n\t\t\t\tvar formatted_import_class = current_step_data.import_class.charAt( 0 ).toUpperCase() + current_step_data.import_class.slice( 1 );\n\n\t\t\t\tthis.api_import.className = 'APIImport' + formatted_import_class;\n\t\t\t\tthis.api_import.key_name = 'Import' + formatted_import_class;\n\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tcurrent_step_data.file_uploader = current_step_ui.file_uploader.getValue();\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tvar grid = current_step_ui.import_data;\n\t\t\t\tcurrent_step_data.import_data = this.buildImportMapping( grid.getData() );\n\t\t\t\tcurrent_step_data.import_data_for_layout = grid.getData();\n\t\t\t\tcurrent_step_data.saved_mapping = current_step_ui.saved_mapping.getValue();\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tfor ( var key in current_step_ui ) {\n\n\t\t\t\t\tif ( !current_step_ui.hasOwnProperty( key ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tcurrent_step_data[key] = current_step_ui[key].getValue();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* jshint ignore:end */\n\tsetDefaultDataToSteps() {\n\n\t\tif ( !this.default_data ) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODg4NC5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7OztBQUFvRDs7QUFFN0M7QUFDUCwyQkFBMkI7QUFDM0IsRUFBRSxDQUFDO0FBQ0g7O0FBRUE7O0FBRUE7O0FBRUE7O0FBRUE7O0FBRUE7O0FBRUE7O0FBRUE7O0FBRUE7QUFDQSxJQUFJOztBQUVKO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQSxlQUFlLENBQUM7QUFDaEI7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsZ0JBQWdCLENBQUM7O0FBRWpC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