🌎 added locale based csv/xlsx header parsing

ref #13
This commit is contained in:
Philipp Dormann 2021-01-19 21:44:41 +01:00
parent 74d9b94119
commit b606037890
3 changed files with 32 additions and 1 deletions

View File

@ -50,8 +50,27 @@
}
}
}
function importAction() {
if (recent_processed === true) {
const toast = Toastify({
text: "Runners are being imported...",
duration: -1,
}).showToast();
recent_processed = false;
const mapped = json_output.map(function (runner) {
return {
firstname: runner[`${$_("csv_import__firstname")}`],
middlename: runner[`${$_("csv_import__middlename")}`],
lastname: runner[`${$_("csv_import__lastname")}`],
team: runner[`${$_("csv_import__team")}`],
};
});
reader.readAsText(files[0]);
console.log(mapped);
// ImportService.importControllerPostOrgsJson(1, mapped);
setTimeout(() => {
toast.hideToast();
recent_processed = true;
}, 500);
}
}
</script>
@ -169,6 +188,12 @@
{/each}
</tbody>
</table>
<button
on:click={importAction}
type="button"
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
Läufer importieren
</button>
<button
on:click={() => {
json_output = [];

View File

@ -6,6 +6,8 @@
"by": "von",
"cannot-reset-your-password-directly": "Schade. \nWir können das Passwort leider nicht direkt zurücksetzen.\nBitte sende uns eine Mail in der du deine Identität bestätigst.",
"credits": "",
"csv_import__firstname": "Vorname",
"csv_import__middlename": "Mittelname",
"dashboard-greeting": "Moin",
"datatable": {
"search": "🔍 Suche ...",

View File

@ -22,6 +22,10 @@
"create-organization": "Create Organization",
"create-user": "Create User",
"credits": "Credits",
"csv_import__firstname": "First Name",
"csv_import__lastname": "Nachname",
"csv_import__middlename": "Middlename",
"csv_import__team": "Team",
"dashboard-greeting": "hello there",
"dashboard-title": "Dashboard",
"datatable": {