From 1338085481d12668cf68fdf718873b97af16eb8a Mon Sep 17 00:00:00 2001 From: majid Date: Fri, 11 Jul 2025 21:09:51 +0700 Subject: [PATCH] fix(activity): highlight table row in red when status is "freeze" --- resources/views/activity/index.blade.php | 56 ++++++++++++++++++------ 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/resources/views/activity/index.blade.php b/resources/views/activity/index.blade.php index eda029b..2f8d2df 100644 --- a/resources/views/activity/index.blade.php +++ b/resources/views/activity/index.blade.php @@ -261,37 +261,67 @@ }, }, actions: { - title: 'Action', - render: (item, data) => { - const status = data.status; // Anggap status berada di dalam objek data - const dokumenjaminan = data.dokumenjaminan || []; + title: 'Action', + render: (item, data) => { + const status = data.status; // Anggap status berada di dalam objek data + const dokumenjaminan = data.dokumenjaminan || []; - return ` + return `
- + ${ ['survey', 'done', 'proses-laporan', 'laporan', 'paparan'].includes(status) ? dokumenjaminan.map(dokumen => { return ` - - - - `; + + + + `; }).join('') : '' }
`; - }, -}, + }, + }, } - + }; + + + 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);