Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
153b1b3c2b
|
|||
ec63c7c1c5
|
|||
05c2535698
|
|||
e261d5e345
|
|||
c00497d776
|
|||
766eeab49f
|
|||
3c9b404234
|
|||
9c56b3883e
|
28
CHANGELOG.md
28
CHANGELOG.md
@@ -2,9 +2,37 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
||||
|
||||
#### [1.9.9](https://git.odit.services/lfk/frontend/compare/1.9.8...1.9.9)
|
||||
|
||||
- fix(CopyScanStationTokenModal): code sizes [`ec63c7c`](https://git.odit.services/lfk/frontend/commit/ec63c7c1c51ccaf25bdd1eacffda66c820003a4c)
|
||||
|
||||
#### [1.9.8](https://git.odit.services/lfk/frontend/compare/1.9.7...1.9.8)
|
||||
|
||||
> 2 April 2025
|
||||
|
||||
- feat(GenerateSponsoringContracts): show download progress [`e261d5e`](https://git.odit.services/lfk/frontend/commit/e261d5e345f3175672bf86646ed838dd23400e50)
|
||||
- chore(release): 1.9.8 [`05c2535`](https://git.odit.services/lfk/frontend/commit/05c253569877a45f3c4759262255ca70aa9ee4a3)
|
||||
|
||||
#### [1.9.7](https://git.odit.services/lfk/frontend/compare/1.9.6...1.9.7)
|
||||
|
||||
> 2 April 2025
|
||||
|
||||
- fix: ImportRunnerModal scrolling & team select [`766eeab`](https://git.odit.services/lfk/frontend/commit/766eeab49fb3ca5715c19dbf9bc53cb71124d3df)
|
||||
- chore(release): 1.9.7 [`c00497d`](https://git.odit.services/lfk/frontend/commit/c00497d7760a935965cc83213f72f35999a3c168)
|
||||
|
||||
#### [1.9.6](https://git.odit.services/lfk/frontend/compare/1.9.5...1.9.6)
|
||||
|
||||
> 29 March 2025
|
||||
|
||||
- chore(release): 1.9.6 [`3c9b404`](https://git.odit.services/lfk/frontend/commit/3c9b404234c7d7d2f0c48256be2130a0ed8ae047)
|
||||
- pnpm allow builds [`9c56b38`](https://git.odit.services/lfk/frontend/commit/9c56b3883eeab9e1a5e1c4921bfb6528c230e0d4)
|
||||
|
||||
#### [1.9.5](https://git.odit.services/lfk/frontend/compare/1.9.4...1.9.5)
|
||||
|
||||
> 29 March 2025
|
||||
|
||||
- feat: modal improvements [`d7e84a7`](https://git.odit.services/lfk/frontend/commit/d7e84a79a892294d532cc93aa3391c14a7a5ce99)
|
||||
- chore(release): 1.9.5 [`3d506db`](https://git.odit.services/lfk/frontend/commit/3d506db97502399e8b381b4cf38af2f07a584aec)
|
||||
|
||||
#### [1.9.4](https://git.odit.services/lfk/frontend/compare/1.9.3...1.9.4)
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
<body>
|
||||
<span style="display: none; visibility: hidden" id="buildinfo"
|
||||
>RELEASE_INFO-1.9.5-RELEASE_INFO</span
|
||||
>RELEASE_INFO-1.9.9-RELEASE_INFO</span
|
||||
>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<script src="/env.js"></script>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@odit/lfk-frontend",
|
||||
"version": "1.9.5",
|
||||
"version": "1.9.9",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"i18n-order": "node order.js",
|
||||
|
3
pnpm-workspace.yaml
Normal file
3
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
onlyBuiltDependencies:
|
||||
- es5-ext
|
||||
- esbuild
|
81
src/components/pdf_generation/DownloadProgressModal.svelte
Normal file
81
src/components/pdf_generation/DownloadProgressModal.svelte
Normal file
@@ -0,0 +1,81 @@
|
||||
<script>
|
||||
import { _ } from "svelte-i18n";
|
||||
import { clickOutside } from "../base/outsideclick";
|
||||
import { onMount } from "svelte";
|
||||
export let download_details = "";
|
||||
export let modal_open;
|
||||
onMount(() => {
|
||||
document.onkeydown = (e) => {
|
||||
e = e || window.event;
|
||||
if (e.key === "Escape") {
|
||||
modal_open = false;
|
||||
}
|
||||
if (e.keyCode === 13) {
|
||||
if (createbtnenabled === true) {
|
||||
createbtnenabled = false;
|
||||
submit();
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if modal_open}
|
||||
<div
|
||||
class="fixed z-10 inset-0 overflow-y-hidden"
|
||||
use:clickOutside
|
||||
on:click_outside={() => {
|
||||
modal_open = false;
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex items-end justify-center h-screen text-center sm:block p-0 lg:p-4"
|
||||
>
|
||||
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
||||
<div
|
||||
class="absolute inset-0 bg-gray-500 opacity-75"
|
||||
data-id="modal_backdrop"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
class="hidden sm:inline-block sm:align-middle sm:h-screen"
|
||||
aria-hidden="true">​</span
|
||||
>
|
||||
<div
|
||||
class="inline-block align-bottom text-left shadow-xl transform transition-all sm:align-middle w-full lg:w-auto min-w-auto lg:min-w-[35vw]"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="modal-headline"
|
||||
>
|
||||
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4 rounded-t-xl">
|
||||
<div class="">
|
||||
<div
|
||||
class="flex-shrink-0 flex items-center justify-center size-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
class="h-6 w-6 text-blue-600"
|
||||
fill="currentColor"
|
||||
width="24"
|
||||
height="24"
|
||||
><path fill="none" d="M0 0h24v24H0z" />
|
||||
<path
|
||||
d="M9.83 8.79L8 9.456V13H6V8.05h.015l5.268-1.918c.244-.093.51-.14.782-.131a2.616 2.616 0 0 1 2.427 1.82c.186.583.356.977.51 1.182A4.992 4.992 0 0 0 19 11v2a6.986 6.986 0 0 1-5.402-2.547l-.581 3.297L15 15.67V23h-2v-5.986l-2.05-1.987-.947 4.298-6.894-1.215.348-1.97 4.924.868L9.83 8.79zM13.5 5.5a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"
|
||||
/></svg
|
||||
>
|
||||
</div>
|
||||
<div class="mt-3 sm:text-left text-base">
|
||||
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
||||
{$_('download_laeuft')}
|
||||
</h3>
|
||||
<div class="w-full">
|
||||
{download_details}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
@@ -7,6 +7,7 @@
|
||||
import DocumentServer from "./DocumentServer";
|
||||
import { init } from "@paralleldrive/cuid2";
|
||||
import toast from "svelte-french-toast";
|
||||
import DownloadProgressModal from "./DownloadProgressModal.svelte";
|
||||
const createId = init({ length: 10, fingerprint: "lfk-frontend" });
|
||||
const documentServer = new DocumentServer(
|
||||
config.baseurl_documentserver,
|
||||
@@ -17,8 +18,12 @@
|
||||
export let generate_runners = [];
|
||||
export let generate_orgs = [];
|
||||
export let generate_teams = [];
|
||||
//
|
||||
export let download_modal_open = false;
|
||||
export let download_details = "";
|
||||
|
||||
function generateSponsoringContract(locale) {
|
||||
download_modal_open = true;
|
||||
if (generate_orgs.length > 0) {
|
||||
generateOrgContracts(locale);
|
||||
} else if (generate_teams.length > 0) {
|
||||
@@ -41,19 +46,24 @@
|
||||
|
||||
async function generateTeamContracts(locale) {
|
||||
toast.loading($_("generating-pdfs"));
|
||||
let totalCount = generate_teams.length;
|
||||
let count = 0;
|
||||
for (const t of generate_teams) {
|
||||
count++;
|
||||
download_details = `${t.parentGroup.name} > ${t.name}`;
|
||||
const runners = await RunnerTeamService.runnerTeamControllerGetRunners(
|
||||
t.id
|
||||
);
|
||||
documentServer
|
||||
await documentServer
|
||||
.generateContracts(runners, locale)
|
||||
.then((blob) => {
|
||||
download(
|
||||
blob,
|
||||
`${$_("sponsorings")}_${t.name}-${locale}-${createId()}.pdf`
|
||||
);
|
||||
if (count === totalCount) {
|
||||
download_modal_open = false;
|
||||
}
|
||||
})
|
||||
.catch((err) => {});
|
||||
}
|
||||
@@ -61,15 +71,23 @@
|
||||
|
||||
async function generateOrgContracts(locale) {
|
||||
toast.loading($_("generating-pdf"));
|
||||
let count_orgs = 0;
|
||||
let totalCount = 0;
|
||||
for (const o of generate_orgs) {
|
||||
count_orgs++;
|
||||
let count = 0;
|
||||
totalCount++;
|
||||
for (const t of o.teams) {
|
||||
totalCount++;
|
||||
}
|
||||
}
|
||||
console.log({ totalCount });
|
||||
let count = 0;
|
||||
for (const o of generate_orgs) {
|
||||
count++;
|
||||
let runners =
|
||||
await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
|
||||
o.id,
|
||||
true
|
||||
);
|
||||
download_details = o.name;
|
||||
await documentServer
|
||||
.generateContracts(runners, locale)
|
||||
.then((blob) => {
|
||||
@@ -84,6 +102,7 @@
|
||||
let runners = await RunnerTeamService.runnerTeamControllerGetRunners(
|
||||
t.id
|
||||
);
|
||||
download_details = `${o.name} > ${t.name}`;
|
||||
await documentServer
|
||||
.generateContracts(runners, locale)
|
||||
.then((blob) => {
|
||||
@@ -93,15 +112,19 @@
|
||||
t.name
|
||||
}-${locale}-${createId()}.pdf`
|
||||
);
|
||||
console.log({ count });
|
||||
if (count === totalCount) {
|
||||
download_modal_open = false;
|
||||
}
|
||||
})
|
||||
.catch((err) => {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateRunnerContracts(locale) {
|
||||
async function generateRunnerContracts(locale) {
|
||||
toast.loading($_("generating-pdf"));
|
||||
documentServer
|
||||
await documentServer
|
||||
.generateContracts(generate_runners, locale)
|
||||
.then((blob) => {
|
||||
let fileName = `${$_("sponsorings")}-${locale}-${createId()}.pdf`;
|
||||
@@ -111,6 +134,7 @@
|
||||
}-${locale}-${createId()}.pdf`;
|
||||
}
|
||||
download(blob, fileName);
|
||||
download_modal_open = false;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
@@ -119,6 +143,7 @@
|
||||
</script>
|
||||
|
||||
{#if sponsoring_contracts_show}
|
||||
<DownloadProgressModal {download_details} modal_open={download_modal_open} />
|
||||
<button
|
||||
on:click={() => {
|
||||
generateSponsoringContract("de");
|
||||
|
@@ -74,7 +74,7 @@
|
||||
/></svg
|
||||
>
|
||||
</div>
|
||||
<div class="mt-3 sm:text-left max-h-[75vh] overflow-y-auto">
|
||||
<div class="mt-3 sm:text-left">
|
||||
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
||||
{$_('delete_runner')}
|
||||
</h3>
|
||||
|
@@ -1,401 +1,386 @@
|
||||
<script>
|
||||
import csv from "csvtojson";
|
||||
import { read as readXlsx, utils as xlsx_utils } from "xlsx";
|
||||
import { _ } from "svelte-i18n";
|
||||
import { clickOutside } from "../base/outsideclick";
|
||||
import csv from "csvtojson";
|
||||
import { read as readXlsx, utils as xlsx_utils } from "xlsx";
|
||||
import { _ } from "svelte-i18n";
|
||||
import { clickOutside } from "../base/outsideclick";
|
||||
|
||||
import {
|
||||
ImportService,
|
||||
RunnerTeamService,
|
||||
RunnerOrganizationService,
|
||||
} from "@odit/lfk-client-js";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import Select from "svelte-select";
|
||||
import toast from "svelte-french-toast";
|
||||
export let opened_from;
|
||||
export let passed_org;
|
||||
export let passed_orgs;
|
||||
export let passed_team;
|
||||
export let import_modal_open;
|
||||
$: searchvalue = "";
|
||||
$: importButtonEnabled =
|
||||
recent_processed &&
|
||||
(!(selected_org_or_team == "" || selected_org_or_team == null) ||
|
||||
!(passed_org?.id == null || passed_org?.id == 0) ||
|
||||
!(passed_team?.id == null || passed_team?.id == 0));
|
||||
const dispatch = createEventDispatcher();
|
||||
function cancelModal() {
|
||||
json_output = [];
|
||||
import_modal_open = false;
|
||||
dispatch("cancel");
|
||||
}
|
||||
(() => {
|
||||
document.onkeydown = (e) => {
|
||||
e = e || window.event;
|
||||
if (e.key === "Escape") {
|
||||
cancelModal();
|
||||
}
|
||||
if (e.keyCode === 13) {
|
||||
//
|
||||
}
|
||||
};
|
||||
})();
|
||||
let groups = [];
|
||||
RunnerOrganizationService.runnerOrganizationControllerGetAll().then((val) => {
|
||||
const orgs = val.map((r) => {
|
||||
return { label: r.name, value: `ORG_${r.id}` };
|
||||
});
|
||||
groups = groups.concat(orgs);
|
||||
RunnerTeamService.runnerTeamControllerGetAll().then((val) => {
|
||||
const teams = val.map((r) => {
|
||||
return {
|
||||
label: `${r.parentGroup.name} > ${r.name}`,
|
||||
value: `TEAM_${r.id}`,
|
||||
};
|
||||
});
|
||||
groups = groups.concat(teams);
|
||||
});
|
||||
});
|
||||
let selected_org;
|
||||
$: selected_org_or_team = "";
|
||||
let files;
|
||||
let recent_processed = true;
|
||||
$: json_output = [];
|
||||
$: {
|
||||
if (files) {
|
||||
if (
|
||||
files[0].type ===
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
) {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener("load", async (e) => {
|
||||
const data = new Uint8Array(e.target.result);
|
||||
const out = readXlsx(data, { type: "array" });
|
||||
json_output = xlsx_utils.sheet_to_json(
|
||||
out.Sheets[Object.keys(out.Sheets)[0]]
|
||||
);
|
||||
});
|
||||
reader.readAsArrayBuffer(files[0]);
|
||||
} else {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener("load", async (e) => {
|
||||
json_output = await csv({
|
||||
delimiter: [";", ","],
|
||||
trim: true,
|
||||
}).fromString(e.target.result);
|
||||
});
|
||||
reader.readAsText(files[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
function importAction() {
|
||||
if (recent_processed === true) {
|
||||
toast.loading($_("runners-are-being-imported"));
|
||||
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")}`] ||
|
||||
runner[`${$_("csv_import__class")}`],
|
||||
};
|
||||
});
|
||||
let org = 0;
|
||||
if (opened_from === "OrgDetail") {
|
||||
org = passed_org.id;
|
||||
}
|
||||
if (opened_from === "OrgOverview") {
|
||||
org = parseInt(selected_org);
|
||||
}
|
||||
if (opened_from === "OrgOverview" || opened_from === "OrgDetail") {
|
||||
ImportService.importControllerPostOrgsJson(org, mapped)
|
||||
.then((resp) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.success($_("import-finished"));
|
||||
cancelModal();
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.error($_("error-during-import"));
|
||||
cancelModal();
|
||||
});
|
||||
}
|
||||
if (opened_from === "TeamDetail") {
|
||||
ImportService.importControllerPostTeamsJson(passed_team.id, mapped)
|
||||
.then((resp) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.success($_("import-finished"));
|
||||
cancelModal();
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.error($_("error-during-import"));
|
||||
cancelModal();
|
||||
});
|
||||
}
|
||||
if (opened_from === "RunnerOverview") {
|
||||
if (selected_org_or_team.includes("ORG_")) {
|
||||
selected_org_or_team = selected_org_or_team.split("_")[1];
|
||||
ImportService.importControllerPostOrgsJson(
|
||||
selected_org_or_team,
|
||||
mapped
|
||||
)
|
||||
.then((resp) => {
|
||||
dispatch("created", { runners: resp });
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.success($_("import-finished"));
|
||||
cancelModal();
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.error($_("error-during-import"));
|
||||
cancelModal();
|
||||
});
|
||||
}
|
||||
if (selected_org_or_team.includes("TEAM_")) {
|
||||
selected_org_or_team = selected_org_or_team.split("_")[1];
|
||||
ImportService.importControllerPostTeamsJson(
|
||||
selected_org_or_team,
|
||||
mapped
|
||||
)
|
||||
.then((resp) => {
|
||||
dispatch("created", { runners: resp });
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.success($_("import-finished"));
|
||||
cancelModal();
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.error($_("error-during-import"));
|
||||
cancelModal();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
import {
|
||||
ImportService,
|
||||
RunnerTeamService,
|
||||
RunnerOrganizationService,
|
||||
} from "@odit/lfk-client-js";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import Select from "svelte-select";
|
||||
import toast from "svelte-french-toast";
|
||||
export let opened_from;
|
||||
export let passed_org;
|
||||
export let passed_orgs;
|
||||
export let passed_team;
|
||||
export let import_modal_open;
|
||||
$: searchvalue = "";
|
||||
$: importButtonEnabled =
|
||||
recent_processed &&
|
||||
(!(selected_org_or_team == "" || selected_org_or_team == null) ||
|
||||
!(passed_org?.id == null || passed_org?.id == 0) ||
|
||||
!(passed_team?.id == null || passed_team?.id == 0));
|
||||
const dispatch = createEventDispatcher();
|
||||
function cancelModal() {
|
||||
json_output = [];
|
||||
import_modal_open = false;
|
||||
dispatch("cancel");
|
||||
}
|
||||
(() => {
|
||||
document.onkeydown = (e) => {
|
||||
e = e || window.event;
|
||||
if (e.key === "Escape") {
|
||||
cancelModal();
|
||||
}
|
||||
if (e.keyCode === 13) {
|
||||
//
|
||||
}
|
||||
};
|
||||
})();
|
||||
let groups = [];
|
||||
RunnerOrganizationService.runnerOrganizationControllerGetAll().then((val) => {
|
||||
const orgs = val.map((r) => {
|
||||
return { label: r.name, value: `ORG_${r.id}` };
|
||||
});
|
||||
groups = groups.concat(orgs);
|
||||
RunnerTeamService.runnerTeamControllerGetAll().then((val) => {
|
||||
const teams = val.map((r) => {
|
||||
return {
|
||||
label: `${r.parentGroup.name} > ${r.name}`,
|
||||
value: `TEAM_${r.id}`,
|
||||
};
|
||||
});
|
||||
groups = groups.concat(teams);
|
||||
});
|
||||
});
|
||||
let selected_org;
|
||||
$: selected_org_or_team = "";
|
||||
let files;
|
||||
let recent_processed = true;
|
||||
$: json_output = [];
|
||||
$: {
|
||||
if (files) {
|
||||
if (
|
||||
files[0].type ===
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
) {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener("load", async (e) => {
|
||||
const data = new Uint8Array(e.target.result);
|
||||
const out = readXlsx(data, { type: "array" });
|
||||
json_output = xlsx_utils.sheet_to_json(
|
||||
out.Sheets[Object.keys(out.Sheets)[0]]
|
||||
);
|
||||
});
|
||||
reader.readAsArrayBuffer(files[0]);
|
||||
} else {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener("load", async (e) => {
|
||||
json_output = await csv({
|
||||
delimiter: [";", ","],
|
||||
trim: true,
|
||||
}).fromString(e.target.result);
|
||||
});
|
||||
reader.readAsText(files[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
function importAction() {
|
||||
if (recent_processed === true) {
|
||||
toast.loading($_("runners-are-being-imported"));
|
||||
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")}`] ||
|
||||
runner[`${$_("csv_import__class")}`],
|
||||
};
|
||||
});
|
||||
let org = 0;
|
||||
if (opened_from === "OrgDetail") {
|
||||
org = passed_org.id;
|
||||
}
|
||||
if (opened_from === "OrgOverview") {
|
||||
org = parseInt(selected_org);
|
||||
}
|
||||
if (opened_from === "OrgOverview" || opened_from === "OrgDetail") {
|
||||
ImportService.importControllerPostOrgsJson(org, mapped)
|
||||
.then((resp) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.success($_("import-finished"));
|
||||
cancelModal();
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.error($_("error-during-import"));
|
||||
cancelModal();
|
||||
});
|
||||
}
|
||||
if (opened_from === "TeamDetail") {
|
||||
ImportService.importControllerPostTeamsJson(passed_team.id, mapped)
|
||||
.then((resp) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.success($_("import-finished"));
|
||||
cancelModal();
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.error($_("error-during-import"));
|
||||
cancelModal();
|
||||
});
|
||||
}
|
||||
if (opened_from === "RunnerOverview") {
|
||||
if (selected_org_or_team.includes("ORG_")) {
|
||||
selected_org_or_team = selected_org_or_team.split("_")[1];
|
||||
ImportService.importControllerPostOrgsJson(
|
||||
selected_org_or_team,
|
||||
mapped
|
||||
)
|
||||
.then((resp) => {
|
||||
dispatch("created", { runners: resp });
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.success($_("import-finished"));
|
||||
cancelModal();
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.error($_("error-during-import"));
|
||||
cancelModal();
|
||||
});
|
||||
}
|
||||
if (selected_org_or_team.includes("TEAM_")) {
|
||||
selected_org_or_team = selected_org_or_team.split("_")[1];
|
||||
ImportService.importControllerPostTeamsJson(
|
||||
selected_org_or_team,
|
||||
mapped
|
||||
)
|
||||
.then((resp) => {
|
||||
dispatch("created", { runners: resp });
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.success($_("import-finished"));
|
||||
cancelModal();
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.dismiss();
|
||||
recent_processed = true;
|
||||
toast.error($_("error-during-import"));
|
||||
cancelModal();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if import_modal_open}
|
||||
<div
|
||||
class="fixed z-10 inset-0 overflow-y-hidden"
|
||||
use:clickOutside
|
||||
on:click_outside={() => {
|
||||
cancelModal();
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex items-end justify-center h-screen text-center sm:block p-0 lg:p-4"
|
||||
>
|
||||
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
||||
<div
|
||||
class="absolute inset-0 bg-gray-500 opacity-75"
|
||||
data-id="modal_backdrop"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
class="hidden sm:inline-block sm:align-middle sm:h-screen"
|
||||
aria-hidden="true">​</span
|
||||
>
|
||||
<div
|
||||
class="inline-block align-bottom text-left shadow-xl transform transition-all sm:align-middle w-full lg:w-auto min-w-auto lg:min-w-[35vw]"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="modal-headline"
|
||||
>
|
||||
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4 rounded-t-xl lg:rounded-xl">
|
||||
<div class="">
|
||||
<div
|
||||
class="flex-shrink-0 flex items-center justify-center size-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
class="h-6 w-6 text-blue-600"
|
||||
fill="currentColor"
|
||||
width="24"
|
||||
height="24"
|
||||
><path fill="none" d="M0 0h24v24H0z" />
|
||||
<path
|
||||
d="M9.83 8.79L8 9.456V13H6V8.05h.015l5.268-1.918c.244-.093.51-.14.782-.131a2.616 2.616 0 0 1 2.427 1.82c.186.583.356.977.51 1.182A4.992 4.992 0 0 0 19 11v2a6.986 6.986 0 0 1-5.402-2.547l-.581 3.297L15 15.67V23h-2v-5.986l-2.05-1.987-.947 4.298-6.894-1.215.348-1.97 4.924.868L9.83 8.79zM13.5 5.5a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"
|
||||
/></svg
|
||||
>
|
||||
</div>
|
||||
<div class="mt-3 sm:mt-0 sm:text-left w-full">
|
||||
<h3 class="text-lg leading-6 font-bold mt-2 text-gray-900">
|
||||
{$_("runner-import")}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:text-left w-full">
|
||||
{#if json_output.length === 0}
|
||||
<div class="mb-6">
|
||||
<p class="text-sm text-gray-500">
|
||||
{$_("please-provide-the-required-csv-xlsx-file")}
|
||||
</p>
|
||||
</div>
|
||||
<div class="overflow-hidden relative mt-4 mb-4">
|
||||
<input
|
||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
bind:files
|
||||
type="file"
|
||||
/>
|
||||
</div>
|
||||
<div class="overflow-hidden relative mt-4 mb-4">
|
||||
<button
|
||||
on:click={() => {
|
||||
cancelModal();
|
||||
}}
|
||||
type="button"
|
||||
class="w-full justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 hidden lg:block"
|
||||
>
|
||||
{$_("cancel")}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
{#if json_output.length > 0}
|
||||
{#if opened_from === "OrgOverview"}
|
||||
<p>{$_("import__target-organization")}</p>
|
||||
<select
|
||||
name="team"
|
||||
bind:value={selected_org}
|
||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
||||
>
|
||||
{#each passed_orgs as o}
|
||||
<option value={o.id}>{o.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<p>{$_("confirm-runner-import")}</p>
|
||||
{/if}
|
||||
{#if opened_from === "RunnerOverview"}
|
||||
<p>{$_("group")}</p>
|
||||
<Select
|
||||
containerClasses="rounded-l-md mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
||||
itemFilter={(label, filterText, option) =>
|
||||
label.toLowerCase().includes(filterText.toLowerCase()) ||
|
||||
option.id.value
|
||||
.toString()
|
||||
.startsWith(filterText.toLowerCase())}
|
||||
items={groups}
|
||||
showChevron={true}
|
||||
placeholder={$_(
|
||||
"search-for-an-organization-or-team-by-name-or-id"
|
||||
)}
|
||||
noOptionsMessage={$_("no-organization-or-team-found")}
|
||||
on:select={(selectedValue) => {
|
||||
selected_org_or_team = selectedValue.detail.value;
|
||||
}}
|
||||
on:clear={() => (selected_org_or_team = null)}
|
||||
/>
|
||||
{/if}
|
||||
{#if opened_from === "OrgDetail"}
|
||||
<p>
|
||||
{$_("runnerimport_verify_runners_org", {
|
||||
values: { org_name: passed_org.name },
|
||||
})}
|
||||
</p>
|
||||
{/if}
|
||||
<input
|
||||
type="search"
|
||||
bind:value={searchvalue}
|
||||
placeholder={$_("datatable.search")}
|
||||
aria-label={$_("datatable.search")}
|
||||
class="p-2 w-full"
|
||||
/>
|
||||
<div class="relative w-full mt-4 mb-4">
|
||||
<div class="w-full overflow-x-auto">
|
||||
<table class="divide-y divide-gray-200 w-full">
|
||||
<thead class="bg-gray-50">
|
||||
<tr class="odd:bg-white even:bg-gray-100">
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
||||
>
|
||||
{$_("csv_import__firstname")}
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
||||
>
|
||||
{$_("csv_import__middlename")}
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
||||
>
|
||||
{$_("csv_import__lastname")}
|
||||
</th>
|
||||
{#if (opened_from !== "TeamDetail" && opened_from !== "RunnerOverview") || (opened_from === "RunnerOverview" && selected_org_or_team.includes("ORG_"))}
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
||||
>
|
||||
{$_("csv_import__team")}
|
||||
</th>
|
||||
{/if}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200">
|
||||
{#each json_output as runner}
|
||||
{#if Object.values(runner)
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(searchvalue)}
|
||||
<tr class="odd:bg-white even:bg-gray-100">
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{runner[`${$_("csv_import__firstname")}`]}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{runner[`${$_("csv_import__middlename")}`] || ""}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{runner[`${$_("csv_import__lastname")}`]}
|
||||
</td>
|
||||
{#if (opened_from !== "TeamDetail" && opened_from !== "RunnerOverview") || (opened_from === "RunnerOverview" && selected_org_or_team.includes("ORG_"))}
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{runner[`${$_("csv_import__team")}`] ||
|
||||
runner[`${$_("csv_import__class")}`] ||
|
||||
"---"}
|
||||
</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<button
|
||||
disabled={!importButtonEnabled}
|
||||
class:opacity-50={!importButtonEnabled}
|
||||
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"
|
||||
>
|
||||
{$_("import-runners")}
|
||||
</button>
|
||||
<button
|
||||
on:click={() => {
|
||||
cancelModal();
|
||||
}}
|
||||
type="button"
|
||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500"
|
||||
>
|
||||
{$_("cancel")}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="fixed z-10 inset-0 overflow-y-hidden"
|
||||
use:clickOutside
|
||||
on:click_outside={() => {
|
||||
cancelModal();
|
||||
}}
|
||||
>
|
||||
<div
|
||||
class="flex items-end justify-center h-screen text-center sm:block p-0 lg:p-4"
|
||||
>
|
||||
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
||||
<div
|
||||
class="absolute inset-0 bg-gray-500 opacity-75"
|
||||
data-id="modal_backdrop"
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
class="hidden sm:inline-block sm:align-middle sm:h-screen"
|
||||
aria-hidden="true">​</span
|
||||
>
|
||||
<div
|
||||
class="inline-block align-bottom text-left shadow-xl transform transition-all sm:align-middle w-full lg:w-auto min-w-auto lg:min-w-[35vw]"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="modal-headline"
|
||||
>
|
||||
<div
|
||||
class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4 rounded-t-xl lg:rounded-xl"
|
||||
>
|
||||
<div class="">
|
||||
<div
|
||||
class="flex-shrink-0 flex items-center justify-center size-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
class="h-6 w-6 text-blue-600"
|
||||
fill="currentColor"
|
||||
width="24"
|
||||
height="24"
|
||||
><path fill="none" d="M0 0h24v24H0z" />
|
||||
<path
|
||||
d="M9.83 8.79L8 9.456V13H6V8.05h.015l5.268-1.918c.244-.093.51-.14.782-.131a2.616 2.616 0 0 1 2.427 1.82c.186.583.356.977.51 1.182A4.992 4.992 0 0 0 19 11v2a6.986 6.986 0 0 1-5.402-2.547l-.581 3.297L15 15.67V23h-2v-5.986l-2.05-1.987-.947 4.298-6.894-1.215.348-1.97 4.924.868L9.83 8.79zM13.5 5.5a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"
|
||||
/></svg
|
||||
>
|
||||
</div>
|
||||
<div class="mt-3 sm:mt-0 sm:text-left w-full">
|
||||
<h3 class="text-lg leading-6 font-bold mt-2 text-gray-900">
|
||||
{$_("runner-import")}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sm:text-left w-full">
|
||||
{#if json_output.length === 0}
|
||||
<div class="mb-6">
|
||||
<p class="text-sm text-gray-500">
|
||||
{$_("please-provide-the-required-csv-xlsx-file")}
|
||||
</p>
|
||||
</div>
|
||||
<div class="overflow-hidden relative mt-4 mb-4">
|
||||
<input
|
||||
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
bind:files
|
||||
type="file"
|
||||
/>
|
||||
</div>
|
||||
<div class="overflow-hidden relative mt-4 mb-4">
|
||||
<button
|
||||
on:click={() => {
|
||||
cancelModal();
|
||||
}}
|
||||
type="button"
|
||||
class="w-full justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 hidden lg:block"
|
||||
>
|
||||
{$_("cancel")}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
{#if json_output.length > 0}
|
||||
{#if opened_from === "OrgOverview"}
|
||||
<p>{$_("import__target-organization")}</p>
|
||||
<select
|
||||
name="team"
|
||||
bind:value={selected_org}
|
||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
||||
>
|
||||
{#each passed_orgs as o}
|
||||
<option value={o.id}>{o.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
<p>{$_("confirm-runner-import")}</p>
|
||||
{/if}
|
||||
{#if opened_from === "RunnerOverview"}
|
||||
<p>{$_("group")}</p>
|
||||
<select
|
||||
bind:value={selected_org_or_team}
|
||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
||||
>
|
||||
{#each groups as g}
|
||||
<option value={g.value}>{g.label}</option>
|
||||
{/each}
|
||||
</select>
|
||||
{/if}
|
||||
{#if opened_from === "OrgDetail"}
|
||||
<p>
|
||||
{$_("runnerimport_verify_runners_org", {
|
||||
values: { org_name: passed_org.name },
|
||||
})}
|
||||
</p>
|
||||
{/if}
|
||||
<div class="relative w-full mt-4 mb-4">
|
||||
<div class="w-full overflow-x-auto max-h-[50vh]">
|
||||
<table class="divide-y divide-gray-200 w-full">
|
||||
<thead class="bg-gray-50">
|
||||
<tr class="odd:bg-white even:bg-gray-100">
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
||||
>
|
||||
{$_("csv_import__firstname")}
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
||||
>
|
||||
{$_("csv_import__middlename")}
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
||||
>
|
||||
{$_("csv_import__lastname")}
|
||||
</th>
|
||||
{#if (opened_from !== "TeamDetail" && opened_from !== "RunnerOverview") || (opened_from === "RunnerOverview" && selected_org_or_team.includes("ORG_"))}
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
||||
>
|
||||
{$_("csv_import__team")}
|
||||
</th>
|
||||
{/if}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200">
|
||||
{#each json_output as runner}
|
||||
{#if Object.values(runner)
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(searchvalue)}
|
||||
<tr class="odd:bg-white even:bg-gray-100">
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{runner[`${$_("csv_import__firstname")}`]}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{runner[`${$_("csv_import__middlename")}`] || ""}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{runner[`${$_("csv_import__lastname")}`]}
|
||||
</td>
|
||||
{#if (opened_from !== "TeamDetail" && opened_from !== "RunnerOverview") || (opened_from === "RunnerOverview" && selected_org_or_team.includes("ORG_"))}
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{runner[`${$_("csv_import__team")}`] ||
|
||||
runner[`${$_("csv_import__class")}`] ||
|
||||
"---"}
|
||||
</td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<button
|
||||
disabled={!importButtonEnabled}
|
||||
class:opacity-50={!importButtonEnabled}
|
||||
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"
|
||||
>
|
||||
{$_("import-runners")}
|
||||
</button>
|
||||
<button
|
||||
on:click={() => {
|
||||
cancelModal();
|
||||
}}
|
||||
type="button"
|
||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500"
|
||||
>
|
||||
{$_("cancel")}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
@@ -180,6 +180,7 @@
|
||||
import store from "../../store";
|
||||
import AddRunnerModal from "./AddRunnerModal.svelte";
|
||||
import ImportRunnerModal from "./ImportRunnerModal.svelte";
|
||||
import toast from "svelte-french-toast";
|
||||
$: current_runners = [];
|
||||
export let modal_open = false;
|
||||
export let import_modal_open = false;
|
||||
|
@@ -170,7 +170,7 @@
|
||||
<img
|
||||
class:w-[50%]={is_qrcode}
|
||||
class:w-full={!is_qrcode}
|
||||
class="md:w-auto mb-2 mx-auto"
|
||||
class="w-full lg:max-w-[50vw] lg:max-h-[10rem] object-contain mb-2 mx-auto"
|
||||
alt="Registrierungscode"
|
||||
src={textToBase64Barcode(window.config.baseurl, is_qrcode)}
|
||||
/>
|
||||
@@ -178,7 +178,7 @@
|
||||
<img
|
||||
class:w-[50%]={is_qrcode}
|
||||
class:w-full={!is_qrcode}
|
||||
class="md:w-auto mb-2 mx-auto"
|
||||
class="w-full lg:max-w-[50vw] lg:max-h-[10rem] object-contain mb-2 mx-auto"
|
||||
alt="Registrierungscode"
|
||||
src={barcode}
|
||||
/>
|
||||
|
@@ -204,6 +204,7 @@
|
||||
"donors-are-being-loaded": "Sponsoren werden geladen",
|
||||
"dont-have-your-email-connected": "Deine E-Mail ist nicht verknüpft?",
|
||||
"dont-panic-were-resetting-it": "Keine Panik, wir setzen es zurück ✌",
|
||||
"download_laeuft": "Download läuft...",
|
||||
"e-mail-adress": "E-Mail-Adresse",
|
||||
"edit": "Bearbeiten",
|
||||
"edit-a-card": "Läuferkarte bearbeiten",
|
||||
|
@@ -204,6 +204,7 @@
|
||||
"donors-are-being-loaded": "donors are being loaded",
|
||||
"dont-have-your-email-connected": "Don't have your email connected?",
|
||||
"dont-panic-were-resetting-it": "Don't panic, we're resetting it ✌",
|
||||
"download_laeuft": "Download in progress...",
|
||||
"e-mail-adress": "E-Mail Adress",
|
||||
"edit": "Edit",
|
||||
"edit-a-card": "Edit a card",
|
||||
|
Reference in New Issue
Block a user