Fix: combined report generation formatting fixed and cleaned up. (i think its good now?)

This commit is contained in:
2026-03-07 01:32:49 +00:00
parent f89f04cd6f
commit 86010de60c
3 changed files with 151 additions and 79 deletions

View File

@@ -187,7 +187,7 @@ document.addEventListener('DOMContentLoaded', function() {
const el = document.getElementById('spreadsheet-' + idx);
if (!el) return;
const opts = Object.assign({}, jssOptions, { data: loc.spreadsheet_data });
spreadsheets[loc.location_name] = jspreadsheet(el, opts);
spreadsheets[idx] = jspreadsheet(el, opts);
});
if (allLocationData.length > 0) {
switchTab(0);
@@ -228,9 +228,8 @@ function switchTab(idx) {
}
// Refresh jspreadsheet rendering after showing panel
const loc = allLocationData[idx];
if (loc && spreadsheets[loc.location_name]) {
try { spreadsheets[loc.location_name].updateTable(); } catch(e) {}
if (spreadsheets[idx]) {
try { spreadsheets[idx].updateTable(); } catch(e) {}
}
}
@@ -241,10 +240,14 @@ async function downloadCombinedReport() {
btn.innerHTML = '<svg class="w-5 h-5 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg> Generating ZIP...';
try {
const locations = allLocationData.map(function(loc) {
const locations = allLocationData.map(function(loc, idx) {
return {
location_name: loc.location_name,
spreadsheet_data: spreadsheets[loc.location_name] ? spreadsheets[loc.location_name].getData() : loc.spreadsheet_data,
session_id: loc.session_id || '',
session_label: loc.session_label || '',
period_type: loc.period_type || '',
started_at: loc.started_at || '',
location_name: loc.location_name,
spreadsheet_data: spreadsheets[idx] ? spreadsheets[idx].getData() : loc.spreadsheet_data,
};
});