task(E5): CSV seat list export
This commit is contained in:
@@ -425,6 +425,23 @@ export class SeatingService {
|
||||
return { total, byRow, byBlock };
|
||||
}
|
||||
|
||||
/**
|
||||
* Task E5: Exportiert eine Sitzplatzliste als CSV-String.
|
||||
* Spalten: Typ, rowId, blockId, X, Y
|
||||
* Zeilentrenner: \n (kompatibel mit Excel via „Daten importieren“).
|
||||
*/
|
||||
exportSeatListCSV(elements: CADElement[]): string {
|
||||
const header = 'type,row_id,block_id,x,y';
|
||||
const rows: string[] = [header];
|
||||
for (const el of elements) {
|
||||
if (el.type !== 'chair') continue;
|
||||
const rowId = (el.properties.rowId as string | undefined) ?? '';
|
||||
const blockId = (el.properties.blockId as string | undefined) ?? '';
|
||||
rows.push(`chair,${rowId},${blockId},${el.x.toFixed(1)},${el.y.toFixed(1)}`);
|
||||
}
|
||||
return rows.join('\n');
|
||||
}
|
||||
|
||||
/** Get all chairs belonging to a specific row */
|
||||
getRowElements(elements: CADElement[], rowId: string): CADElement[] {
|
||||
return elements.filter(el => el.type === 'chair' && el.properties.rowId === rowId);
|
||||
|
||||
Reference in New Issue
Block a user