1 var template_stockbulkimporter = function (static)
5 csvFile: new App.TemplateElement.FieldComponent('csvFile'),
6 importType: new App.TemplateElement.FieldComponent('importType')
9 this.init = function (ti) {
11 App.DataStore.loadSelectListData('groups', true, 'Company', 'Group.SelectList');
13 'StockBulkImporter', 'Stock', 'BulkImport.Upload',
14 null, {}, function () {}, _w.taskContractError
17 var importTypeData = [];
18 if(App.permissions.stockBulkImportDrive)
20 importTypeData.push({"value": "Drive", "label": "Drive"});
22 if(App.permissions.stockBulkImportPinnacle)
24 importTypeData.push({"value": "Pinnacle", "label": "Pinnacle"});
27 App.DataStore.setData('importType', importTypeData);
31 type: 'document_button',
33 title: 'TransUnion CSV file'
39 dataStoreId: 'importType'
44 this.construct = function () {
46 $('#frmStockBulkUpload').validate({
48 csvFile: {required: true},
49 importType: {required: true}
53 required: "CSV file required."
56 required: "This field required."
59 submitHandler: function (form) {
60 var data = {Upload: _t['stockbulkimporter'].harvest()};
62 if ('' == data.Upload.csvFile)
64 alert('Please select a file to import.');
69 'StockBulkImporter', data, {},
72 alert('Import Running in background!\n\nYou will be notified via email when the import is complete.\n\nPlease note that this page will return to stock grid when you click "OK."');
73 //window.location.reload(false);
74 window.location.hash = '/stock';
78 alert(response.StatusReason);
83 $('#btnSubmitFile').prop('disabled', false);
85 this.destruct = function () {};