fix(activity): highlight table row in red when status is "freeze"

This commit is contained in:
majid
2025-07-11 21:09:51 +07:00
parent fd7f5fb9c2
commit 1338085481

View File

@@ -268,7 +268,7 @@
return `
<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>
</a>
${
@@ -290,8 +290,38 @@
};
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() {
const searchValue = this.value.trim();
dataTable.search(searchValue, true);