Skip to content

Commit

Permalink
Switch import result to CSV
Browse files Browse the repository at this point in the history
  • Loading branch information
marode-cap committed Feb 21, 2025
1 parent 057227f commit ca751e3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/views/admin/PersonImportView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@
}
function downloadFileContent(fileContent: string): void {
const blob: Blob = new Blob([fileContent], { type: 'text/plain' });
const blob: Blob = new Blob([fileContent], { type: 'text/csv' });
const url: string = window.URL.createObjectURL(blob);
const link: HTMLAnchorElement = document.createElement('a');
link.href = url;
link.setAttribute('download', `${t('admin.import.fileName.person')}.txt`);
link.setAttribute('download', `${t('admin.import.fileName.person')}.csv`);
document.body.appendChild(link);
link.click();
link.remove();
Expand All @@ -307,20 +307,20 @@
(user: ImportedUserResponse) => user.status === ImportDataItemStatus.Failed,
);
let fileContent: string = `Schule: ${importStore.importResponse?.organisationsname} - Rolle: ${importStore.importResponse?.rollenname}`;
let fileContent: string = `Schule: ${importStore.importResponse?.organisationsname}; Rolle: ${importStore.importResponse?.rollenname}`;
fileContent += `\n\n${t('admin.import.successfullyImportedUsersNotice')}\n\n`;
fileContent += 'Klasse - Vorname - Nachname - Benutzername - Passwort\n';
fileContent += 'Klasse; Vorname; Nachname; Benutzername; Passwort\n';
successfulUsers.forEach((user: ImportedUserResponse) => {
fileContent += `${user.klasse} - ${user.vorname} - ${user.nachname} - ${user.benutzername} - ${user.startpasswort}\n`;
fileContent += `${user.klasse}; ${user.vorname}; ${user.nachname}; ${user.benutzername}; ${user.startpasswort}\n`;
});
if (failedUsers.length > 0) {
fileContent += `\n\n${t('admin.import.failedToImportUsersNotice')}\n\n`;
fileContent += 'Klasse - Vorname - Nachname - Benutzername\n';
fileContent += 'Klasse; Vorname; Nachname; Benutzername\n';
failedUsers.forEach((user: ImportedUserResponse) => {
fileContent += `${user.klasse} - ${user.vorname} - ${user.nachname} - ${user.benutzername}\n`;
fileContent += `${user.klasse}; ${user.vorname}; ${user.nachname}; ${user.benutzername}\n`;
});
}
Expand Down

0 comments on commit ca751e3

Please sign in to comment.