File manager - Edit - /home/autoph/public_html/projects/tickets-autohub/storage/framework/views/c50bf57aeffe7dd4a955c6d5ecec01dab450484c.php
Back
<head> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> <link rel="stylesheet" href="<?php echo e(asset('css/select2-bootstrap-5-theme-1.3.0/select2-bootstrap-5-theme.css')); ?>"> <link rel="stylesheet" href="<?php echo e(asset('css/select2-bootstrap-5-theme-1.3.0/select2-bootstrap-5-theme.min.css')); ?>"> <link rel="stylesheet" href="<?php echo e(asset('css/select2-bootstrap-5-theme-1.3.0/select2-bootstrap-5-theme.rtl.min.css')); ?>"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> </head> <div class="supports_sla_masterfile" style="width: 98%; padding:10px;"> <center> <h4>Technical Summary Masterfile</h4> </center> <hr> <form class="suppForm" id="suppForm" action="" novalidate> <div class="row ml-3"> <div class="col"> <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>"> <div class="row mb-3"> <div class="col"> <div class="form-group"> <label class="form-label" for="from_date">Start Date: </label> <input class="form-control" type="date" value="<?= date('Y-m-d') ?>" name="from_date" id="from_date"> </div> </div> <div class="col"> <div class="form-group"> <label class="form-label" for="from_date">End Date: </label> <input class="form-control" value="<?= date('Y-m-d') ?>" type="date" name="to_date" id="to_date"> </div> </div> </div> <div class="row mb-3"> <div class="form-group"> <label class="form-label">Support Personnnel:</label> <label style="margin-left:2rem;" class="form-label">All <input type="checkbox" id="all_personnel"></label> <div id="div-personnel"><select class="form-select" name="ticket_status" id="multiple-select-clear-field-personnel" data-placeholder="Select Personnel" multiple> <?php $__currentLoopData = $list_tech_personnel; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $personnel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option style="margin-left:50px;" value="<?php echo e($personnel->user_id); ?>"> <?php echo e($personnel->fullname); ?> - <small style="color:gray !important;font-style:Italic;">(<?php echo e($personnel->position); ?>)</small></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </div> </div> <div class="row mb-3"> <div class="form-group"> <label class="form-label" for="from_date">Status:</label> <select class="form-select" name="ticket_status" id="ticket_status"> <option value="All">ALL</option> <option value="pending">PENDING</option> <option value="closed">CLOSED</option> <option value="transferred">TRANSFERRED</option> </select> </div> </div> <button class="btn btn-primary btn-md mt-3 btn-submit" id="btn-submit">SUBMIT</button> </div> </div> </form> <div class="modal fade" id="loading-modals" data-bs-backdrop="static" data-bs-keyboard="false" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="loading-modalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-5" id="loading-modalLabel"></h1> <button type="button" class="btn-close close-modal-btn" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <div class="progress"> <div id="progrss-loading-bar" class="progress-bar progress-bar-striped" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div> </div> <br> <button class="btn btn-xs btn-outline-danger" style="display:none;border:none;color:#343a40;" title="Pdf view" id="btn-pdf"><i class="fa fa-file-pdf-o" style="font-size:30px"></i> <span>Pdf view</span></button> <button class="btn btn-xs btn-outline-success" style="display:none;border:none;color:#343a40;" title="Export Excel File" id="btn-table"><i class="fa fa-file-excel-o" style="font-size:30px" aria-hidden="true"></i> <span> Export excel</span></button> </div> </div> </div> </div> </div> <script src="https://unpkg.com/jspdf@latest/dist/jspdf.umd.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"> </script> <script src="<?php echo e(asset('js/js_v2/swal.js')); ?>"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.4/xlsx.full.min.js"></script> <script> const form = document.getElementById('suppForm'); const rbt = document.getElementsByName('type'); const employee_name ="<?php echo e(auth()->user()->f_name.' '.auth()->user()->l_name); ?>"; let radioButtonsChecked = false; const logo = "<?php echo e(asset('files/img/ahg_logo.png')); ?>"; $(document).ready(function() { window.jsPDF = window.jspdf.jsPDF; $('#multiple-select-clear-field-personnel').select2({ theme: "bootstrap-5", width: $(this).data('width') ? $(this).data('width') : $(this).hasClass('w-100') ? '100%' : 'style', placeholder: $(this).data('placeholder'), closeOnSelect: false, allowClear: true, }); $("#all_personnel").on('click',function(){ if ($(this).prop('checked')) { $(this).val(1); $("#div-personnel").hide(); } else { $(this).val(0); // alert($(this).val()); $("#div-personnel").show(); } // alert($(this).val());return; }); var data_set = []; var date_from = ''; var date_to = ''; var totalRecords = 0; var totalClosedTicket = 0; var totalOngoingTicket = 0; var total_sla = 0; $('.btn-submit').click(function(e) { e.preventDefault(); $('#progrss-loading-bar').css('width', 0 + '%'); $('#progrss-loading-bar').text(0 + '%'); $('#progrss-loading-bar').attr('aria-valuenow', 0); $("#btn-pdf").hide(); $("#btn-table").hide(); data_set = []; // let comp_code = $("#multiple-select-clear-field-company").val(); let personnel = $("#multiple-select-clear-field-personnel").val(); let from_date = $("#from_date").val(); let to_date = $("#to_date").val(); let status = $("#ticket_status").val(); $.ajax({ url: "/reports/get/tech_support_summary?page=1", type: "POST", data: { from_date : from_date, to_date : to_date, personnel : personnel, all_personnels: $("#all_personnel").val(), ticket_status : status }, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, success: function(result) { // console.log(result);return; if(result.total_records ===0) { swal.fire({ icon: 'warning', title: 'Oops...', text: 'No record found in database.', }); return; } totalRecords = 0; totalClosedTicket = 0; totalOngoingTicket = 0; total_sla = 0; data_set.push(...result.data); date_from = result.date_from; date_to = result.date_to; totalRecords = result.total_records; totalClosedTicket = result.total_closed_ticket; totalOngoingTicket = result.total_ongoing_ticket; total_sla = result.total_sla_ticket; $('#loading-modals').modal('show'); if (result.total_records == 0 || result.total_page == 1) { $('#progrss-loading-bar').css('width', 100 + '%'); $('#progrss-loading-bar').text(100 + '%'); $("#btn-pdf").show(); $("#btn-table").show(); // return; } fetchData(result.total_page,personnel,status,from_date,to_date); }, error: function(xhr, status, error) { console.error(xhr.responseText); alert('Error processing data. Please try again.'); } }); $("#close-moda-btn").on('click', function() { data_set = []; }); }); async function fetchData(totalPages,personnel,status,from_date,to_date) { for (var i = 2; i <= totalPages; i++) { if (i != 0 && i> 1) { console.log('count '+i) try { const response = await collectData(i,personnel,status,from_date,to_date); var loadingPercentage = computeLoadingPercentage(response.currentPage, response .total_records, response.total_page, response.perPage); incPercent = loadingPercentage; // console.log(incPercent); $('#progrss-loading-bar').attr('aria-valuenow', loadingPercentage.toFixed(2)); $('#progrss-loading-bar').css('width', loadingPercentage.toFixed(2) + '%'); $('#progrss-loading-bar').text(loadingPercentage.toFixed(2) + '%'); data_set.push(...response.data); if (loadingPercentage == 100) { isDone = true; $("#btn-pdf").show(); $("#btn-table").show(); } } catch (error) { console.error(error); } } } } async function collectData(page,personnel,status,from_date,to_date) { return new Promise(function(resolve, reject) { $.ajax({ url: "/reports/get/tech_support_summary?page=" + page, type: "POST", data: { from_date : from_date, to_date : to_date, personnel : personnel, all_personnels: $("#all_personnel").val(), ticket_status : status }, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, success: function(response) { resolve(response); }, error: function(xhr, status, error) { reject(error); } }); }); } function computeLoadingPercentage(currentPage, totalRows, totalPageCount, rowsPerPage) { totalPageCount = Math.ceil(totalRows / rowsPerPage); const loadedPageCount = Math.min(currentPage, totalPageCount); return (loadedPageCount / totalPageCount) * 100; } $("#btn-pdf").on('click', function() { generatePDFtable(data_set); }); $("#btn-table").on('click', function() { generateExcel(data_set); }); function generatePDFtable(data) { // console.log(data); var doc = new jsPDF({ orientation: 'landscape', format: 'a4' }); var pageSize =doc.internal.pageSize; var pageWidth = pageSize.width; var imgWidth = 40; var imgHeight = 30; // doc.addImage("<?php echo e(asset('files/img/ahg_logo.png')); ?>", 'PNG', 240, 1, imgWidth, imgHeight); doc.addImage(logo, 'PNG', 240, 1, imgWidth, imgHeight); var addFooter = function() { var totalPages = doc.internal.getNumberOfPages(); doc.setFontSize(8); for (var i = 1; i <= totalPages; i++) { doc.setPage(i); if (i === totalPages) { doc.text('Page ' + i + ' of ' + totalPages, doc.internal.pageSize.getWidth() - 160, doc.internal.pageSize.getHeight() - 8); } else if(i ===1){ doc.text('Page ' + i + ' of ' + totalPages, doc.internal.pageSize.getWidth() - 160, doc.internal.pageSize.getHeight() - 3); } else { doc.text('Page ' + i + ' of ' + totalPages, doc.internal.pageSize.getWidth() - 160, doc.internal.pageSize.getHeight() -7); } } }; var startXtitle = 10; doc.setFont('sans serif', 'bold'); doc.setFontSize(10); doc.text('Support SLA Masterfile', pageWidth /2, 10,'center'); doc.setFont('sans serif', 'normal') doc.setFontSize(8); const setDateFrom = new Date(date_from); const DateFrom_formattedDateTime = setDateFrom.toLocaleString('en-US', { // weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', // hour: 'numeric', // minute: 'numeric', // second: 'numeric', // hour12: true // Include AM/PM indicator }); const setDateTo = new Date(date_to); const DateTo_formattedDateTime = setDateTo.toLocaleString('en-US', { // weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', }); doc.text('Period covered', startXtitle, 15); doc.text(':', 28, 15); doc.text(DateFrom_formattedDateTime + ' to ' + DateTo_formattedDateTime, 30, 15); doc.setFont('sans serif', 'normal') doc.text('Closed', 90, 15); doc.text(':', 104, 15); doc.setFont('sans serif', 'italic'); doc.text(totalClosedTicket.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), 107, 15); // doc.setFont('sans serif', 'normal') // doc.text('Prepared by :',startXtitle, 19); // doc.setFont('sans serif', 'italic'); // doc.text(employee_name,28, 19); doc.setFont('sans serif', 'normal') doc.text('Prepared date', startXtitle, 19); doc.text(':', 28, 19); doc.setFont('sans serif', 'italic'); let now = new Date(); const formattedDateTime = now.toLocaleString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true // Include AM/PM indicator }); doc.text(formattedDateTime, 30, 19); doc.setFont('sans serif', 'normal') doc.text('Pending', 90, 19); doc.text(':', 104, 19); doc.setFont('sans serif', 'italic'); doc.text(totalOngoingTicket.toString(), 107, 19); doc.setFont('sans serif', 'normal') doc.text('Total SLA', 90, 23); doc.text(':', 104, 23); doc.setFont('sans serif', 'italic'); // doc.setFont(undefined, 'bold'); set italic to bold doc.text((total_sla / 60).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + ' hrs.', 107, 23); doc.setFont('sans serif', 'normal') doc.text('Prepared by', startXtitle, 23); doc.text(':', 28, 23); doc.setFont('sans serif', 'italic'); doc.text(employee_name, 30, 23); doc.setFont('sans serif', 'normal'); doc.text('Total Records ', startXtitle, 27); doc.text(':', 28, 27); doc.setFont('sans serif', 'italic'); doc.text(totalRecords.toString(), 30, 27); doc.setFontSize(10); var startY = 28; var startX = 10; var lineHeight = 8; var cellWidth = 20; var cellHeight = 10; var headers = [ 'No.', 'Ticket No', 'Name', 'Position', 'Company', 'Dealer', 'Category', 'Sub\nCategory', 'Date created', 'Date started', 'Date ended', 'Sender', 'SLA', 'Elapsed', 'Status' ]; // Define the widths of each column var cellWidths = [12, 19, 19,19,20,19,20,20,19,19,19,19,19,19,19 ]; // Adjust the width of the first column doc.setFont('helvetica', 'bold'); doc.setFillColor(200, 200, 200); // Light gray background color // Calculate the total width of the headers var totalHeaderWidth = cellWidths.reduce((acc, curr) => acc + curr, 0); // Draw background rectangle for the header row doc.rect(startX, startY, totalHeaderWidth, cellHeight, 'F'); doc.setFontSize(8); // Draw headers with adjusted column widths var currentX = startX; // Track the current X position headers.forEach(function(header, i) { var splitValue = doc.splitTextToSize(header, cellWidths[i] - 7); // Adjust width as needed doc.text(currentX + cellWidths[i] / 2, startY + cellHeight / 2, splitValue, null, null, 'center'); currentX += cellWidths[i]; // Move to the next column }); // Draw data rows with adjusted column widths var startY = 23; doc.setFont('helvetica', 'normal'); var lineHeight = 15; // Adjusted line height doc.setFillColor(255, 255, 255); // Reset background color cellHeight = 10; doc.setFontSize(7); var counter = 1; // Counter variable for the first column data.forEach(function(item, rowIndex) { startY += lineHeight; if (startY > doc.internal.pageSize.height - 20) { doc.addPage(); // Add a new page if startY exceeds the height startY = 20; // Reset startY for the new page } var currentX = startX; // Track the current X position doc.text(14, startY + 10 / 2, counter.toString(), null, null, 'center'); counter++; // Increment the counter Object.values(item).forEach(function(value, colIndex) { if(colIndex ===13) { value = formatElapsedTime(value); } var splitValue = doc.splitTextToSize(value, cellWidths[colIndex] - 5); // Adjust width as needed splitValue = (splitValue == 'null' || splitValue == 'null' || splitValue == 'NULL' ? '' : splitValue); doc.rect(currentX, startY, cellWidths[colIndex], 15); doc.text(currentX + cellWidths[colIndex] / 2, startY + cellHeight / 2, splitValue, null, null, 'center'); currentX += cellWidths[colIndex]; // Move to the next column }); }); addFooter(); var pdfData = doc.output('datauristring'); var pdfData = doc.output('blob'); var blobUrl = URL.createObjectURL(pdfData); window.open(blobUrl); } function generateExcel(data) { var headers = [ 'Ticket No', 'fullname', 'Position', 'Company', 'Dealer', 'Category', 'Sub_category', 'Date_created', 'Start_date', 'End_date', 'Sender', 'SLA', 'Time_elapsed', 'Status' ]; var dataArray = []; // Convert data to array of arrays var dataArray = [headers]; data.forEach(function(item) { var row = []; headers.forEach(function(header) { var key = header.toLowerCase().replace(/\s/g, '_'); var value = item[key] !== null ? String(item[key]) : ''; // Replace null with empty string // var value = String(item[key]); // Convert value to string row.push(value); // row.push(item[header.toLowerCase().replace(/\s/g, '_')]); // Adjusted to match keys in data }); dataArray.push(row); }); // Create a worksheet var worksheet = XLSX.utils.aoa_to_sheet(dataArray); // Create a workbook var workbook = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1'); // Convert the workbook to a binary Excel file var excelFile = XLSX.write(workbook, { bookType: 'xlsx', type: 'binary' }); // Convert the binary Excel data to a Blob var blob = new Blob([s2ab(excelFile)], { type: 'application/octet-stream' }); // Create a download link var url = window.URL.createObjectURL(blob); var a = document.createElement('a'); a.href = url; const dateTime = new Date().toLocaleString(); a.download = 'Technical Summary Report ' + dateTime + '.xlsx'; // Trigger a click event to download the file a.click(); window.URL.revokeObjectURL(url); } // Helper function to convert string to array buffer function s2ab(s) { var buf = new ArrayBuffer(s.length); var view = new Uint8Array(buf); for (var i = 0; i < s.length; i++) view[i] = s.charCodeAt(i) & 0xFF; return buf; } function formatElapsedTime(time) { let formattedTime = ''; if (time != null) { let [hours, minutes, seconds] = time.split(':').map(Number); let totalMinutes = hours * 60 + minutes; if (totalMinutes > 0) { formattedTime += totalMinutes + ' min' + (totalMinutes > 1 ? 's' : ''); } if (seconds > 0) { if (formattedTime.length > 0) { formattedTime += ' and '; } formattedTime += seconds + ' second' + (seconds > 1 ? 's' : ''); } } return formattedTime; } }); </script> <?php /**PATH C:\laragon\www\DEVELOPMENT\autohub-ticketing\resources\views/layouts/authentication/admin/report/technical_summary_report.blade.php ENDPATH**/ ?>
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings