120 lines
3.7 KiB
PHP
120 lines
3.7 KiB
PHP
<style>
|
|
.table th,
|
|
.table td {
|
|
padding: 8px;
|
|
}
|
|
|
|
table.dataTable tbody td {
|
|
padding: 4px 4px !important;
|
|
}
|
|
|
|
/* .col-12 {
|
|
|
|
max-width: 98% !important;
|
|
} */
|
|
|
|
/* .dataTables_filter {
|
|
position: absolute;
|
|
margin-left: -25px;
|
|
} */
|
|
|
|
/* .right-align-input {
|
|
text-align: right;
|
|
} */
|
|
</style>
|
|
|
|
<div class="row" style="position: relative;left: 250px;top: 55px;">
|
|
<div class="form-group col-md-3" id="date_div">
|
|
<!-- <label>ActivityDate<span class="text-danger"></span></label> -->
|
|
<div id="reportrange" class="form-control" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
|
|
<i class="mdi mdi-calendar-blank"></i>
|
|
<span></span> <i class="mdi mdi-menu-down"></i>
|
|
</div>
|
|
<input type="hidden" id="startDate">
|
|
<input type="hidden" id="endDate">
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<button type="button" class="btn btn-primary" onclick="appendHrActivityHistoryHtml(this, true)"> submit </button>
|
|
</div>
|
|
</div>
|
|
|
|
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
|
<thead class="bg-light">
|
|
<tr>
|
|
<th>S. No</th>
|
|
<th>Timestamp</th>
|
|
<th>HR Name</th>
|
|
<th>HR Mail</th>
|
|
<th>Activity</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (isset($data) && !empty($data)) { ?>
|
|
<?php foreach ($data as $index => $row) { ?>
|
|
<tr>
|
|
<td><?= $index + 1 ?></td>
|
|
<td><?php echo $row['created_at']; ?></td>
|
|
<td><?php echo $row['user_name']; ?></td>
|
|
<td><?php echo $row['user_mail']; ?></td>
|
|
<td><?php echo $row['activity']; ?></td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function () {
|
|
var ticketsTable = $('#scroll-horizontal-datatable');
|
|
|
|
if (ticketsTable.length) {
|
|
ticketsTable.DataTable({
|
|
scrollX: true,
|
|
dom: "<'row'<'col-sm-2'f><'col-sm-2'>>" + // Filter left, buttons right
|
|
"<'row'<'col-sm-12'tr>>" +
|
|
"<'row'<'col-sm-3'i><'col-sm-2'l><'col-sm-7'p>>",
|
|
language: {
|
|
search: "_INPUT_",
|
|
searchPlaceholder: "Search..."
|
|
},
|
|
paging: true,
|
|
pageLength: 25,
|
|
ordering: false
|
|
});
|
|
} else {
|
|
console.error("Table not found.");
|
|
}
|
|
|
|
// Daterangepicker setup
|
|
const params = new URLSearchParams(window.location.search);
|
|
const startDateParam = params.get('start_date') || moment().subtract(29, 'days').format('DD-MM-YYYY');
|
|
const endDateParam = params.get('end_date') || moment().format('DD-MM-YYYY');
|
|
|
|
const start = moment(startDateParam, 'DD-MM-YYYY');
|
|
const end = moment(endDateParam, 'DD-MM-YYYY');
|
|
|
|
function cb(start, end) {
|
|
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
|
|
$('#startDate').val(start.format('DD-MM-YYYY'));
|
|
$('#endDate').val(end.format('DD-MM-YYYY'));
|
|
}
|
|
|
|
$('#reportrange').daterangepicker({
|
|
startDate: start,
|
|
endDate: end,
|
|
ranges: {
|
|
'Today': [moment(), moment()],
|
|
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
|
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
|
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
|
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
|
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
|
}
|
|
}, cb);
|
|
|
|
cb(start, end);
|
|
});
|
|
|
|
|
|
</script>
|