Fix: Add missing closing brace for addEventListener in reportButtons
- Fixed 'missing ) after argument list' syntax error - Added proper indentation and closing }) for button.addEventListener - Added null checks for reportTitle to prevent errors
This commit is contained in:
@@ -174,7 +174,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
|
||||
// Update the title dynamically
|
||||
reportTitle.textContent = `Data for "${reportLabel}"`;
|
||||
if (reportTitle) reportTitle.textContent = `Data for "${reportLabel}"`;
|
||||
|
||||
// Fetch data for the selected report
|
||||
fetch(`/get_report_data?report=${reportNumber}`)
|
||||
@@ -189,11 +189,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// Update title with additional info
|
||||
if (data.message) {
|
||||
reportTitle.textContent = data.message;
|
||||
if (reportTitle) reportTitle.textContent = data.message;
|
||||
} else if (data.rows && data.rows.length > 0) {
|
||||
reportTitle.textContent = `${reportLabel} (${data.rows.length} records)`;
|
||||
if (reportTitle) reportTitle.textContent = `${reportLabel} (${data.rows.length} records)`;
|
||||
} else {
|
||||
reportTitle.textContent = `${reportLabel} - No data found`;
|
||||
if (reportTitle) reportTitle.textContent = `${reportLabel} - No data found`;
|
||||
}
|
||||
|
||||
populateTable(data);
|
||||
@@ -203,6 +203,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
if (reportTitle) reportTitle.textContent = 'Error loading data.';
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Bind the export functionality to the CSV button
|
||||
|
||||
Reference in New Issue
Block a user