MERGE_UAT_BUG_FIXES

This commit is contained in:
Ubuntu 2026-08-06 14:26:52 +05:30
commit a0c01b10d5
3 changed files with 57 additions and 9 deletions

View File

@ -808,13 +808,17 @@ class EmployeeRestController extends AdminController
$policyName = preg_replace('/[^A-Za-z0-9_\- ]/', '', (string) ($empData[0]['policy_name'] ?? 'Employees'));
$filename = trim($policyName) !== '' ? $policyName . '-Employees.xlsx' : 'Employees.xlsx';
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="' . $filename . '"');
header('Cache-Control: max-age=0');
// Return via CI Response (no header()/exit) so global Cors after-filter can attach ACAO headers.
$writer = new Xlsx($spreadsheet);
ob_start();
$writer->save('php://output');
exit;
$content = ob_get_clean();
return $this->response
->setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
->setHeader('Content-Disposition', 'attachment;filename="' . $filename . '"')
->setHeader('Cache-Control', 'max-age=0')
->setBody($content);
} catch (\Exception $e) {
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
}

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);
}
}
]
});