fix(activity): highlight table row in red when status is "freeze"
This commit is contained in:
@@ -268,7 +268,7 @@
|
|||||||
|
|
||||||
return `
|
return `
|
||||||
<div class="flex flex-nowrap justify-center">
|
<div class="flex flex-nowrap justify-center">
|
||||||
<a class="btn btn-sm btn-icon btn-clear btn-warning" href="activity/${data.id}/show" title="Lihat Detail">
|
<a class="btn btn-sm btn-icon ${status === 'freeze' ? 'btn-light' : 'btn-warning btn-clear'}" href="activity/${data.id}/show" title="Lihat Detail">
|
||||||
<i class="ki-outline ki-eye"></i>
|
<i class="ki-outline ki-eye"></i>
|
||||||
</a>
|
</a>
|
||||||
${
|
${
|
||||||
@@ -284,14 +284,44 @@
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let dataTable = new KTDataTable(element, dataTableOptions);
|
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||||
|
|
||||||
|
function highlightFreezeRows() {
|
||||||
|
const table = document.querySelector('#permohonan-table table[data-datatable-table="true"]');
|
||||||
|
if (!table) return;
|
||||||
|
|
||||||
|
const rows = table.querySelectorAll('tbody tr');
|
||||||
|
|
||||||
|
rows.forEach(row => {
|
||||||
|
const statusCell = row.cells[7];
|
||||||
|
if (!statusCell) return;
|
||||||
|
|
||||||
|
const statusText = statusCell.textContent.trim().toLowerCase();
|
||||||
|
|
||||||
|
if (statusText === 'freeze') {
|
||||||
|
row.classList.add('bg-red-400', 'text-white');
|
||||||
|
} else {
|
||||||
|
row.classList.remove('bg-red-400', 'text-white');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Polling setiap 1 detik untuk sementara
|
||||||
|
setInterval(() => {
|
||||||
|
highlightFreezeRows();
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
searchInput.addEventListener('input', function() {
|
searchInput.addEventListener('input', function() {
|
||||||
const searchValue = this.value.trim();
|
const searchValue = this.value.trim();
|
||||||
dataTable.search(searchValue, true);
|
dataTable.search(searchValue, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user