|
|
|
@ -1,3 +1,12 @@ |
|
|
|
$(document).ready(function () { |
|
|
|
|
|
|
|
const today = new Date().toLocaleDateString("en-GB"); |
|
|
|
|
|
|
|
$("#updatedDate").text("Updated Date : " + today); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Function to view Supporting Document in modal
|
|
|
|
function viewFileInModal(fileNum, fileType, filePath) { |
|
|
|
var pdfModal = new bootstrap.Modal(document.getElementById('pdf-modal')); |
|
|
|
@ -21,12 +30,12 @@ function viewFileInModal(fileNum, fileType, filePath) { |
|
|
|
method: 'POST', |
|
|
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, |
|
|
|
body: params.toString() |
|
|
|
}).then(function(response) { |
|
|
|
}).then(function (response) { |
|
|
|
if (!response.ok) { |
|
|
|
throw new Error('Failed to fetch PDF: ' + response.statusText); |
|
|
|
} |
|
|
|
return response.arrayBuffer(); |
|
|
|
}).then(function(pdfData) { |
|
|
|
}).then(function (pdfData) { |
|
|
|
var blob = new Blob([pdfData], { type: 'application/pdf' }); |
|
|
|
var blobUrl = URL.createObjectURL(blob); |
|
|
|
|
|
|
|
@ -36,9 +45,9 @@ function viewFileInModal(fileNum, fileType, filePath) { |
|
|
|
downloadBtn.download = fileName; |
|
|
|
|
|
|
|
return pdfjsLib.getDocument({ data: pdfData }).promise; |
|
|
|
}).then(function(pdf) { |
|
|
|
let renderPage = function(pageNum) { |
|
|
|
return pdf.getPage(pageNum).then(function(page) { |
|
|
|
}).then(function (pdf) { |
|
|
|
let renderPage = function (pageNum) { |
|
|
|
return pdf.getPage(pageNum).then(function (page) { |
|
|
|
var viewport = page.getViewport({ scale: 1.5 }); |
|
|
|
var canvas = document.createElement('canvas'); |
|
|
|
canvas.classList.add('mb-3'); |
|
|
|
@ -59,14 +68,14 @@ function viewFileInModal(fileNum, fileType, filePath) { |
|
|
|
} |
|
|
|
|
|
|
|
return sequence; |
|
|
|
}).then(function() { |
|
|
|
}).then(function () { |
|
|
|
pdfModal.show(); |
|
|
|
}).catch(function(error) { |
|
|
|
}).catch(function (error) { |
|
|
|
alert('Error loading PDF: ' + error.message); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
$(document).ready(function() { |
|
|
|
$(document).ready(function () { |
|
|
|
|
|
|
|
// Initialize DataTable
|
|
|
|
var table = $('#file-data-det-tbl').DataTable({ |
|
|
|
@ -86,7 +95,7 @@ $(document).ready(function() { |
|
|
|
{ |
|
|
|
orderable: false, |
|
|
|
targets: 0, // S.No column
|
|
|
|
render: function(data, type, row, meta) { |
|
|
|
render: function (data, type, row, meta) { |
|
|
|
return meta.row + 1; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -110,19 +119,19 @@ $(document).ready(function() { |
|
|
|
$('#custom-length').html($('.dataTables_length')); |
|
|
|
|
|
|
|
// Custom export buttons
|
|
|
|
$('#export-excel').on('click', function() { |
|
|
|
$('#export-excel').on('click', function () { |
|
|
|
table.button('.buttons-excel').trigger(); |
|
|
|
}); |
|
|
|
|
|
|
|
$('#export-pdf').on('click', function() { |
|
|
|
$('#export-pdf').on('click', function () { |
|
|
|
var originalLength = table.page.len(); |
|
|
|
table.one('draw', function() { |
|
|
|
table.one('draw', function () { |
|
|
|
var tableClone = $('#file-det-tbl').clone(); |
|
|
|
tableClone.removeClass('dataTable'); |
|
|
|
tableClone.find('thead, tbody, tfoot').removeAttr('style'); |
|
|
|
|
|
|
|
// Remove "Supporting Documents" column (13th col = index 12)
|
|
|
|
tableClone.find('tr').each(function() { |
|
|
|
tableClone.find('tr').each(function () { |
|
|
|
$(this).find('th:eq(12), td:eq(12)').remove(); |
|
|
|
}); |
|
|
|
|
|
|
|
@ -147,7 +156,7 @@ $(document).ready(function() { |
|
|
|
image: { type: 'jpeg', quality: 0.98 }, |
|
|
|
html2canvas: { scale: 2, useCORS: true }, |
|
|
|
jsPDF: { unit: 'in', format: 'a3', orientation: 'landscape' } |
|
|
|
}).from(pdfContainer[0]).save().then(function() { |
|
|
|
}).from(pdfContainer[0]).save().then(function () { |
|
|
|
table.page.len(originalLength).draw(); |
|
|
|
pdfContainer.hide(); |
|
|
|
}); |
|
|
|
|