feat: export excel file

refactor: align id columns between export and import

refactor: match column names with template
This commit is contained in:
Carlos Valente
2025-10-07 22:05:37 +02:00
committed by Carlos Valente
parent 10762f10bf
commit 1d8c04d0b4
16 changed files with 672 additions and 42 deletions
+16
View File
@@ -3,6 +3,7 @@ import { CustomFields, Rundown } from 'ontime-types';
import { ImportMap } from 'ontime-utils';
import { apiEntryUrl } from './constants';
import { downloadBlob } from './utils';
const excelPath = `${apiEntryUrl}/excel`;
@@ -39,3 +40,18 @@ export async function importRundownPreview(options: ImportMap): Promise<PreviewS
});
return response.data;
}
/**
* Downloads a xlsx representation of the rundown from the server
*/
export async function downloadAsExcel(rundownId: string, fileName?: string) {
try {
const response = await axios.get(`${excelPath}/${rundownId}/export`, {
responseType: 'blob',
});
downloadBlob(response.data, `${fileName ?? 'Ontime_rundown'}.xlsx`);
} catch (error) {
console.error('Error downloading file:', error);
}
}