File manager - Edit - /home/autoph/public_html/connectv1/dist/js/finance/pdc_import.js
Back
function sweetAlertSimple(icon, title, text) { toastr.remove(); switch (icon) { case 'success': toastr.success(text); break; case 'info': toastr.info(text); break; case 'warning': toastr.warning(text); break; case 'error': toastr.error(text); break; } } function initSummaryTable() { var columns = [{ data: '1', title: '' }, { data: '2', title: '' } ]; var table = $('#summaryTable').DataTable({ initComplete: function() { // $('#summaryTable_wrapper .buttons-csv').click() }, columns: columns, "paging": false, "lengthChange": false, "searching": false, "ordering": false, // "destroy": true, "info": false, "autoWidth": false, "responsive": true, "lengthMenu": [ [5, 50, 100, -1], [5, 50, 100, "All"] ], "buttons": [{ extend: 'csv', text: 'CSV', filename: function() { var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, ''); return filename + '_summary'; } }, { extend: 'excel', text: 'Excel', filename: function() { var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, ''); return filename + '_summary'; } }, { extend: 'pdf', text: 'PDF', filename: function() { var filename = $('input[type=file]').val().replace(/.*(\/|\\)/, ''); return filename + '_summary'; } }, "print", ] }).buttons().container().appendTo('#summaryTable_wrapper .col-md-6:eq(0)'); } Dropzone.autoDiscover = false; $(function() { $("#upload-finance-pdc-excel").dropzone({ url: "api/upload/upload_finance_pdc_spreadsheet.php", // If not using a form element acceptedFiles: '.csv, .xlsx, .xls', //allowed filetypes maxFilesize: 50, maxFiles: 1, clickable: true, addRemoveLinks: true, timeout: 0, autoProcessQueue: false, dictCancelUpload: '', removedfile: function(file) { // alert(file.upload.filename) $.ajax({ type: 'POST', url: 'api/upload/upload_finance_pdc_spreadsheet.php', dataType: 'json', data: { name: file.name, request: 'delete' }, sucess: function(data) { console.log('success: ' + data); } }); var _ref; return (_ref = file.previewElement) != null ? _ref.parentNode .removeChild(file .previewElement) : void 0; }, renameFile: function(file) { return file.name; }, init: function() { var myDropzone = this; // Update selector to match your button $("#submit").on('click', function(e) { if (myDropzone.getQueuedFiles().length < 1) { sweetAlertSimple('error', 'Oops...', 'Upload spreadsheet file.'); return; } e.preventDefault(); $('#loader').fadeIn(); $('#submit').attr('disabled', true); $('#invalid-report').fadeOut(); $('#summary-report').fadeOut(); myDropzone.processQueue(); }); this.on('sending', function(file, xhr, formData) { // Append all form inputs to the formData Dropzone will POST var data = $('#upload-finance-pdc-excel').serializeArray(); $.each(data, function(key, el) { formData.append(el.name, el.value); }); }); this.on("maxfilesexceeded", function(file) { // this.removeAllFiles(); // this.addFile(file); sweetAlertSimple('error', 'Oops...', 'Only 1 file allowed.'); return; }); this.on("error", function(file) { // upload_image_name.splice($.inArray(file.upload.filename, // upload_image_name), 1); //remove image // alert("Nice"); myDropzone.removeFile(file); return; }); this.on("complete", function(file) { if (this.getUploadingFiles().length === 0 && this.getQueuedFiles() .length === 0) { $('#loader').fadeOut(); $("#submit").prop("disabled", false); Dropzone.forElement('#upload-finance-pdc-excel').removeAllFiles(true) // sweetAlertSimple('success', 'Oops...', 'Upload done.'); } }); this.on("success", function(file, response) { var obj = jQuery.parseJSON(response); var summary_table = $('#summaryTable').DataTable(); summary_table.destroy(); var issue_table = $('#example2').DataTable(); issue_table.destroy(); // console.log(obj); if (parseInt(obj.status) === 1) { $('#summaryTable > tbody').html(''); // $('#summaryTable').find('tbody').append( // " <tr> <td>Company</td> <td class='text-center'><h5><span class='badge bg-primary' id='summary-company'></span></h5></td> </tr> <tr> <td>Dealer</td> <td class='text-center'><h5><span class='badge bg-primary' id='summary-dealer'></span></h5></td> </tr> <tr> <td>Source DMS</td> <td class='text-center'><h5><span class='badge ' id='summary-dms'></span></h5></td> </tr> <tr> <td>Database Type</td> <td class='text-center'><h5><span class='badge ' id='summary-db'></span></h5></td> </tr>" // ); $('#summaryTable').find('tbody').append(obj.data_count_list); initSummaryTable(); $('#summary-report').fadeIn(); } else if (parseInt(obj.status) === 2) { $('#invalid-report').fadeIn(); var columns = [{ data: 'message', title: 'Message' }]; var table = $('#example2').DataTable({ initComplete: function() { // $('#invalid-report .buttons-csv').click() }, // data:information, data: obj.header_column_not_found_message, columns: columns, columnDefs: [{ type: 'natural-nohtml', targets: 0 }], "paging": false, "lengthChange": false, "searching": false, // "destroy": true, "ordering": false, "info": false, "autoWidth": false, "responsive": true, "lengthMenu": [ [5, 50, 100, -1], [5, 50, 100, "All"] ] }).buttons().container().appendTo( '#example2_wrapper .col-md-6:eq(0)'); } }) } }); }); $(function() { $("#example1").DataTable({ "responsive": true, "lengthChange": false, "autoWidth": false, "buttons": ["copy", "csv", "excel", "pdf", "print", "colvis"] }).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)'); }); function isEmpty(string) { var flag = false; if (string == '') { flag = true; } else if (string == null) { flag = true; } else { if (string.trim() == '') { flag = true; } } return flag; }
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0.18 |
proxy
|
phpinfo
|
Settings