CHANGE_ADD_EXCE_EXPORT_OPTION_FOR_HR_ACTIVITY_HISTORY

This commit is contained in:
VENKATESHWARAN 2026-08-06 11:57:26 +05:30
parent 2cc7f9fe3a
commit 30ceb22676
2 changed files with 48 additions and 4 deletions

View File

@ -53,7 +53,7 @@
margin-left: 8px !important;
}
<?php foreach ($hr_access_data as $key => $value) {
<?php foreach ($hr_access_data ?? [] as $key => $value) {
$key = $key + 1;
?>
@ -207,7 +207,7 @@
<label>Select all In-Active policies</label>
</div>
<?php foreach ($pre_policy_data as $key1 => $policies) {
<?php foreach ($pre_policy_data ?? [] as $key1 => $policies) {
$statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active';
$statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive';
// if (
@ -272,7 +272,7 @@
<label>Select all In-Active policies</label>
</div>
<?php foreach ($post_policy_data as $key2 => $policies) {
<?php foreach ($post_policy_data ?? [] as $key2 => $policies) {
$statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active';
$statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive';
// if(
@ -334,7 +334,7 @@
<label>Select all</label>
</div>
<?php foreach ($post_cd_data as $key3 => $cd) { ?>
<?php foreach ($post_cd_data ?? [] as $key3 => $cd) { ?>
<div class="checkbox-item">
<input type="checkbox" class="policy-checkbox" data-user="<?= $key ?>" data-group="cd" id="<?= 'user' . $key ?>-icici1" name="<?= 'user' . $key ?>_cd" value="<?= $cd['cd_master_pk'] ?>" <?php if (in_array($cd['cd_master_pk'], $value['allowed_cd'])) {
echo 'checked';

View File

@ -44,6 +44,21 @@ table.dataTable tbody td {
box-shadow: 0px 2px 4px 0px #00000024 !important;
}
#scroll-horizontal-datatable_wrapper #hrActivityExcelBtn,
#scroll-horizontal-datatable_wrapper .hr-activity-excel-btn {
background-color: #217346 !important;
color: white !important;
border: 1px solid #217346 !important;
padding: 5px 10px !important;
border-radius: 10px !important;
cursor: pointer !important;
box-shadow: 0px 2px 4px 0px #00000024 !important;
margin-left: 8px !important;
display: inline-flex !important;
align-items: center !important;
gap: 4px;
}
#hr_activity_history_append_area tbody tr {
background-color: transparent !important;
}
@ -151,6 +166,35 @@ $(document).ready(function () {
action: function () {
appendHrActivityHistoryHtml(this, true);
}
},
{
extend: 'excelHtml5',
text: '<i class="mdi mdi-file-excel"></i><span class="btn-custom"> Excel</span>',
title: 'HR-Activity',
filename: function () {
return 'HR-Activity-' + (typeof moment !== 'undefined' ? moment().format('DD-MM-YYYY') : 'export');
},
sheetName: 'HR-Activity',
className: 'btn hr-activity-excel-btn',
attr: {
id: 'hrActivityExcelBtn',
title: 'Export HR Activity to Excel'
},
exportOptions: {
columns: [0, 1, 2, 3, 4]
},
action: function (e, dt, button, config) {
if (!dt.data().any()) {
if (typeof toastr !== 'undefined' && toastr.warning) {
toastr.warning('No data available to export.', 'Warning');
} else {
alert('No data available to export.');
}
return;
}
// Use DataTables built-in excelHtml5 action
$.fn.dataTable.ext.buttons.excelHtml5.action.call(this, e, dt, button, config);
}
}
]
});