No log entry found with this ID.
'; - } - }) - .catch(error => { - console.error('Error loading details:', error); - modalBody.innerHTML = 'Error loading details.
'; - }); -} - -/** - * Close modal - */ -function closeModal() { - const modal = document.getElementById('details-modal'); - modal.style.display = 'none'; -} - -/** - * Get current filters - */ -function getCurrentFilters() { - return { - model_type: document.getElementById('model-filter').value, - state: document.getElementById('state-filter').value, - start_date: document.getElementById('start-date').value, - end_date: document.getElementById('end-date').value, - user_id: document.getElementById('user-filter').value, - }; -} - -/** - * Event listeners - */ -document.addEventListener('DOMContentLoaded', function() { - // Apply filters button - document.getElementById('apply-filters').addEventListener('click', () => { - currentPage = 1; - const filters = getCurrentFilters(); - loadHistory(null, filters); - }); - - // Clear filters button - document.getElementById('clear-filters').addEventListener('click', () => { - document.getElementById('model-filter').value = ''; - document.getElementById('state-filter').value = ''; - document.getElementById('start-date').value = ''; - document.getElementById('end-date').value = ''; - document.getElementById('user-filter').value = ''; - currentPage = 1; - loadHistory(); - }); - - // Pagination buttons - document.getElementById('prev-page').addEventListener('click', () => { - if (previousPageUrl) { - currentPage--; - loadHistory(previousPageUrl); - } - }); - - document.getElementById('next-page').addEventListener('click', () => { - if (nextPageUrl) { - currentPage++; - loadHistory(nextPageUrl); - } - }); - - // Close modal on background click - document.getElementById('details-modal').addEventListener('click', (e) => { - if (e.target.id === 'details-modal') { - closeModal(); - } - }); - - // Initial load - loadHistory(); -}); - -// Additional CSS for badges (inline styles) -const style = document.createElement('style'); -style.textContent = ` - .badge { - display: inline-block; - padding: 4px 8px; - border-radius: 4px; - font-size: 0.75rem; - font-weight: 600; - text-transform: uppercase; - } - - .badge-model { - background-color: #e7f3ff; - color: #0066cc; - } - - .badge-transition { - background-color: #fff3cd; - color: #856404; - } - - .badge-state { - background-color: #d4edda; - color: #155724; - } - - .badge-state-PENDING { - background-color: #fff3cd; - color: #856404; - } - - .badge-state-APPROVED { - background-color: #d4edda; - color: #155724; - } - - .badge-state-REJECTED { - background-color: #f8d7da; - color: #721c24; - } - - .badge-state-IN_PROGRESS { - background-color: #d1ecf1; - color: #0c5460; - } - - .badge-state-COMPLETED { - background-color: #d4edda; - color: #155724; - } - - .badge-state-ESCALATED { - background-color: #f8d7da; - color: #721c24; - } - - .object-link { - color: #007bff; - text-decoration: none; - } - - .object-link:hover { - text-decoration: underline; - } - - .btn-view { - background-color: #007bff; - color: white; - border: none; - padding: 4px 12px; - border-radius: 4px; - cursor: pointer; - } - - .btn-view:hover { - background-color: #0056b3; - } - - .detail-grid { - display: grid; - grid-template-columns: repeat(2, 1fr); - gap: 15px; - } - - .detail-item { - padding: 10px; - background-color: #f8f9fa; - border-radius: 4px; - } - - .detail-item.full-width { - grid-column: 1 / -1; - } - - .detail-item strong { - display: block; - margin-bottom: 5px; - color: #666; - font-size: 0.875rem; - } -`; -document.head.appendChild(style); +// No functionality provided - all history features now use HTMX diff --git a/backend/templates/base/base.html b/backend/templates/base/base.html index b474c87d..6b6a398f 100644 --- a/backend/templates/base/base.html +++ b/backend/templates/base/base.html @@ -136,6 +136,27 @@ + + + + {% block extra_js %}{% endblock %}