nhance-enrollment/app/Views/excel_errors.php

135 lines
4.2 KiB
PHP
Executable File

<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg">
<title>Excel Error Report</title>
<!-- Include DataTables CSS -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
<!-- Include DataTables Buttons CSS -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/2.3.0/css/buttons.dataTables.min.css">
<!-- Include Font Awesome CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<style>
/* Table styles */
.table {
width: 100%;
border: 2px solid #ddd;
border-collapse: collapse;
}
.table th, .table td {
padding: 8px;
border: 1px solid #ddd;
}
.table th {
background-color: #f2f2f2;
font-weight: bold;
}
.table tr:nth-child(even) {
background-color: #f2f2f2;
}
.error-tooltip {
display: none;
/* Hide error message by default */
position: absolute;
z-index: 1;
background-color: #000;
color: #fff;
padding: 5px;
border-radius: 5px;
white-space: nowrap;
}
.error-icon {
cursor: pointer;
position: relative;
}
.error-icon:hover+.error-tooltip {
display: block;
/* Show error message when hovering over the icon */
}
/* .error-cell {
border: 2px solid red !important;
} */
/* .container{
position: relative;
bottom: 150px;
} */
table.dataTable tbody td {
padding: 4px 4px !important;
}
</style>
<!-- <button><a href="">download full file</a></button> -->
<div class="container">
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
<thead class="bg-light">
<tr>
<?php foreach ($excel_header as $header): ?>
<th><?php echo $header; ?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php for ($i = 0; $i < count($excel_data); $i++): ?>
<tr>
<?php foreach ($excel_data[$i] as $data): ?>
<td <?php if (isset($data['error'])) echo 'class="error-cell"'; ?>>
<?php
if (isset($data['value'])) {
echo $data['value'];
}
if (isset($data['error'])) {
echo '<span class="error-icon"> <i class="fas fa-exclamation-circle" style="color: red;"></i></span>';
echo '<span class="error-tooltip">' . implode("<br>", $data['error']) . '</span>';
}
?>
</td>
<?php endforeach; ?>
</tr>
<?php endfor; ?>
</tbody>
</table>
</div>
<!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Include DataTables JavaScript -->
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
<!-- Include DataTables Buttons JavaScript -->
<script src="https://cdn.datatables.net/buttons/2.3.0/js/dataTables.buttons.min.js"></script>
<!-- Include DataTables JSZip library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<!-- Include DataTables Buttons HTML5 export extension -->
<script src="https://cdn.datatables.net/buttons/2.3.0/js/buttons.html5.min.js"></script>
<script>
$(document).ready(function() {
$('#tickets-table').DataTable({
dom: 'Bfrtip',
buttons: [
{
extend: 'excel',
text: 'Excel', // Set the title for the Excel button
title: 'ExcelErrorData', // Set your custom title here
},
{
text: 'Excel Error', // Set the text for the custom button
action: function (e, dt, node, config) {
window.location.href = '<?= base_url("util/full-excel-error-file/") . $file_id ?>';
}
}
],
paging: false, // Disable pagination
lengthMenu: [[-1], ["All"]] // Display all rows
});
});
</script>