Compare commits

..

No commits in common. "0.16.3" and "0.16.2" have entirely different histories.

8 changed files with 1066 additions and 1136 deletions

View File

@ -2,19 +2,9 @@
All notable changes to this project will be documented in this file. Dates are displayed in UTC. All notable changes to this project will be documented in this file. Dates are displayed in UTC.
#### [0.16.3](https://git.odit.services/lfk/frontend/compare/0.16.2...0.16.3)
- Bumped vite build targets [`5fe4763`](https://git.odit.services/lfk/frontend/commit/5fe47634e8980e77b65c05f213c475cf49273609)
- new license file version [CI SKIP] [`a659091`](https://git.odit.services/lfk/frontend/commit/a6590910cfdc5e91fba91c1bc9237e407ef15fd2)
- Merge pull request 'feature/156-pdf_names' (#157) from feature/156-pdf_names into dev [`ad454c3`](https://git.odit.services/lfk/frontend/commit/ad454c386cbf11abc59d41d269d1a0ef7442c9ed)
- Added ids for generated pdfs [`0b2c296`](https://git.odit.services/lfk/frontend/commit/0b2c296de069a4ef302c5535de01bc18236675bc)
#### [0.16.2](https://git.odit.services/lfk/frontend/compare/0.16.1...0.16.2) #### [0.16.2](https://git.odit.services/lfk/frontend/compare/0.16.1...0.16.2)
> 23 February 2023
- Fixed scanmodal [`#154`](https://git.odit.services/lfk/frontend/issues/154) - Fixed scanmodal [`#154`](https://git.odit.services/lfk/frontend/issues/154)
- 🚀RELEASE v0.16.2 [`0e85940`](https://git.odit.services/lfk/frontend/commit/0e85940cba292cbccd1ec038aa24f4a719382c19)
- Merge pull request 'feature/147-cardoverview_performance' (#153) from feature/147-cardoverview_performance into dev [`8d479c3`](https://git.odit.services/lfk/frontend/commit/8d479c32f82938904aee6a10deb80fea85487e4b) - Merge pull request 'feature/147-cardoverview_performance' (#153) from feature/147-cardoverview_performance into dev [`8d479c3`](https://git.odit.services/lfk/frontend/commit/8d479c32f82938904aee6a10deb80fea85487e4b)
- Merge pull request 'Fixed scanmodal' (#155) from bugfix/154-scan_select_runner_by_id into dev [`549785c`](https://git.odit.services/lfk/frontend/commit/549785cf7d1c9edc1be37dc745b97096232a08ca) - Merge pull request 'Fixed scanmodal' (#155) from bugfix/154-scan_select_runner_by_id into dev [`549785c`](https://git.odit.services/lfk/frontend/commit/549785cf7d1c9edc1be37dc745b97096232a08ca)
- i18n [`ca6da15`](https://git.odit.services/lfk/frontend/commit/ca6da15ef761184a55b18d56f749f660a32cbb83) - i18n [`ca6da15`](https://git.odit.services/lfk/frontend/commit/ca6da15ef761184a55b18d56f749f660a32cbb83)

View File

@ -13,7 +13,7 @@
</head> </head>
<body> <body>
<span style="display: none;visibility: hidden;" id="buildinfo">RELEASE_INFO-0.16.3-RELEASE_INFO</span> <span style="display: none;visibility: hidden;" id="buildinfo">RELEASE_INFO-0.16.2-RELEASE_INFO</span>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<script src="/env.js"></script> <script src="/env.js"></script>
<script type="module" src="/src/main.js"></script> <script type="module" src="/src/main.js"></script>

View File

@ -1,6 +1,6 @@
{ {
"name": "@odit/lfk-frontend", "name": "@odit/lfk-frontend",
"version": "0.16.3", "version": "0.16.2",
"scripts": { "scripts": {
"i18n-order": "node order.js", "i18n-order": "node order.js",
"dev": "vite", "dev": "vite",
@ -10,11 +10,11 @@
}, },
"license": "CC-BY-NC-SA-4.0", "license": "CC-BY-NC-SA-4.0",
"devDependencies": { "devDependencies": {
"@vincjo/datatables": "^1.1.0",
"@odit/lfk-client-js": "0.13.1", "@odit/lfk-client-js": "0.13.1",
"@odit/license-exporter": "0.0.11", "@odit/license-exporter": "0.0.11",
"@sveltejs/vite-plugin-svelte": "1.0.0-next.6", "@sveltejs/vite-plugin-svelte": "1.0.0-next.6",
"@types/html-minifier": "4.0.0", "@types/html-minifier": "4.0.0",
"@vincjo/datatables": "^1.1.0",
"auto-changelog": "2.2.1", "auto-changelog": "2.2.1",
"autoprefixer": "10.2.5", "autoprefixer": "10.2.5",
"check-password-strength": "2.0.2", "check-password-strength": "2.0.2",
@ -53,8 +53,5 @@
"hooks": { "hooks": {
"after:bump": "npx auto-changelog --commit-limit false -p -u --hide-credit && git add CHANGELOG.md && node versionbuilder.js && git add index.html && node order.js && git add src/locales" "after:bump": "npx auto-changelog --commit-limit false -p -u --hide-credit && git add CHANGELOG.md && node versionbuilder.js && git add index.html && node order.js && git add src/locales"
} }
},
"dependencies": {
"@paralleldrive/cuid2": "^2.2.0"
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -6,9 +6,6 @@
RunnerTeamService, RunnerTeamService,
} from "@odit/lfk-client-js"; } from "@odit/lfk-client-js";
import Toastify from "toastify-js"; import Toastify from "toastify-js";
import { init } from "@paralleldrive/cuid2";
const createId = init({ length: 10, fingerprint: "lfk-frontend" });
export let cards_show = false; export let cards_show = false;
export let generate_cards = []; export let generate_cards = [];
export let generate_runners = []; export let generate_runners = [];
@ -70,7 +67,7 @@
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
a.download = `${$_("runnercards")}-${locale}-${createId()}.pdf`; a.download = `${$_('runnercards')}-${locale}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
@ -78,7 +75,8 @@
Toastify({ Toastify({
text: $_("pdf-successfully-generated"), text: $_("pdf-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
}) })
.catch((err) => { .catch((err) => {
@ -130,11 +128,10 @@
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
if(generate_runners.length == 1){ if(generate_runners.length == 1){
a.download = `${$_("runnercards")}_${generate_runners[0].firstname}_${ a.download = `${$_('runnercards')}_${generate_runners[0].firstname}_${generate_runners[0].lastname}-${locale}.pdf`;
generate_runners[0].lastname }
}-${locale}-${createId()}.pdf`; else{
} else { a.download = `Runnercards-${locale}.pdf`;
a.download = `${$_("runnercards")}-${locale}-${createId()}.pdf`;
} }
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
@ -143,7 +140,8 @@
Toastify({ Toastify({
text: $_("pdf-successfully-generated"), text: $_("pdf-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
}) })
.catch((err) => {}); .catch((err) => {});
@ -198,7 +196,7 @@
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
a.download = `${$_("runnercards")}_${t.name}-${locale}-${createId()}.pdf`; a.download = `${$_('runnercards')}_${t.name}-${locale}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
@ -207,7 +205,8 @@
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -226,11 +225,7 @@
for (const o of generate_orgs) { for (const o of generate_orgs) {
count_orgs++; count_orgs++;
let count = 0; let count = 0;
let runners = let runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id, true)
await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
o.id,
true
);
let cards = []; let cards = [];
for (let runner of runners) { for (let runner of runners) {
let card = current_cards.find((c) => c.runner?.id == runner.id); let card = current_cards.find((c) => c.runner?.id == runner.id);
@ -268,17 +263,18 @@
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
a.download = `${$_("runnercards")}_${o.name}_direct-${locale}-${createId()}.pdf`; a.download = `${$_('runnercards')}_${o.name}_direct-${locale}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
if (count === o.teams.length && count_orgs === generate_orgs.length) { if (count === o.teams.length && count_orgs === generate_orgs.length) {
toast.hideToast(); toast.hideToast();
console.log("here"); console.log("here")
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -325,21 +321,17 @@
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
a.download = `${$_("runnercards")}_${o.name}_${ a.download = `${$_('runnercards')}_${o.name}_${t.name}-${locale}.pdf`;
t.name
}-${locale}-${createId()}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
if ( if (count === o.teams.length && count_orgs === generate_orgs.length) {
count === o.teams.length &&
count_orgs === generate_orgs.length
) {
toast.hideToast(); toast.hideToast();
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -360,56 +352,49 @@
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex" class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex"
id="options-menu" id="options-menu"
aria-haspopup="true" aria-haspopup="true"
aria-expanded="true" aria-expanded="true">
> {$_('generate-runnercards')}
{$_("generate-runnercards")}
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width="24" width="24"
height="24" height="24"
viewBox="0 0 24 24" viewBox="0 0 24 24"
class="-mr-1 ml-2 h-5 w-5" class="-mr-1 ml-2 h-5 w-5"><path
><path fill="none" d="M0 0h24v24H0z" /> fill="none"
d="M0 0h24v24H0z" />
<path <path
fill="currentColor" fill="currentColor"
d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z" d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z" /></svg>
/></svg
>
</button> </button>
</div> </div>
{#if cards_dropdown_open} {#if cards_dropdown_open}
<div <div
class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-10" class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-10"
id="cards:dropdown:menu" id="cards:dropdown:menu">
>
<div <div
class="py-1" class="py-1"
role="menu" role="menu"
aria-orientation="vertical" aria-orientation="vertical"
aria-labelledby="options-menu" aria-labelledby="options-menu">
> <span
<span class="block w-full text-left px-4 py-2 text-sm text-gray-700" class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span>
>{$_("select-language")}</span
>
<button <button
on:click={() => { on:click={() => {
generateRunnerCards("de"); generateRunnerCards('de');
}} }}
type="submit" type="submit"
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900" class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
role="menuitem" role="menuitem">
> {$_('german')}
{$_("german")}
</button> </button>
<button <button
on:click={() => { on:click={() => {
generateRunnerCards("en"); generateRunnerCards('en');
}} }}
type="submit" type="submit"
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900" class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
role="menuitem" role="menuitem">
> {$_('english')}
{$_("english")}
</button> </button>
</div> </div>
</div> </div>

View File

@ -3,12 +3,9 @@
import { import {
DonationService, DonationService,
RunnerTeamService, RunnerTeamService,
RunnerOrganizationService, RunnerOrganizationService
} from "@odit/lfk-client-js"; } from "@odit/lfk-client-js";
import Toastify from "toastify-js"; import Toastify from "toastify-js";
import { init } from "@paralleldrive/cuid2";
const createId = init({ length: 10, fingerprint: "lfk-frontend" });
export let certificates_show = false; export let certificates_show = false;
export let generate_runners = []; export let generate_runners = [];
export let generate_orgs = []; export let generate_orgs = [];
@ -40,13 +37,11 @@
text: $_("generating-pdf"), text: $_("generating-pdf"),
duration: -1, duration: -1,
}).showToast(); }).showToast();
const current_donations = const current_donations = (await DonationService.donationControllerGetAll()) || [];
(await DonationService.donationControllerGetAll()) || [];
let certificateRunners = []; let certificateRunners = [];
for (let runner of generate_runners) { for (let runner of generate_runners) {
runner.distanceDonations = runner.distanceDonations = current_donations.filter((d) => d.runner?.id == runner.id) || [];
current_donations.filter((d) => d.runner?.id == runner.id) || []; console.log(runner.distanceDonations)
console.log(runner.distanceDonations);
certificateRunners.push(runner); certificateRunners.push(runner);
} }
fetch( fetch(
@ -77,11 +72,10 @@
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
if(generate_runners.length == 1){ if(generate_runners.length == 1){
a.download = `${$_("certificates")}_${ a.download = `${$_('certificates')}_${generate_runners[0].firstname}_${generate_runners[0].lastname}-${locale}.pdf`;
generate_runners[0].firstname }
}_${generate_runners[0].lastname}-${locale}-${createId()}.pdf`; else{
} else { a.download = `${$_('certificates')}-${locale}.pdf`;
a.download = `${$_("certificates")}-${locale}.pdf`;
} }
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
@ -90,7 +84,8 @@
Toastify({ Toastify({
text: $_("pdf-successfully-generated"), text: $_("pdf-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
}) })
.catch((err) => {}); .catch((err) => {});
@ -102,16 +97,14 @@
duration: -1, duration: -1,
}).showToast(); }).showToast();
let count = 0; let count = 0;
const current_donations = const current_donations = (await DonationService.donationControllerGetAll()) || [];
(await DonationService.donationControllerGetAll()) || [];
for (const t of generate_teams) { for (const t of generate_teams) {
const runners = await RunnerTeamService.runnerTeamControllerGetRunners( const runners = await RunnerTeamService.runnerTeamControllerGetRunners(
t.id t.id
); );
let certificateRunners = []; let certificateRunners = [];
for (let runner of runners) { for (let runner of runners) {
runner.distanceDonations = runner.distanceDonations = current_donations.filter((d) => d.runner?.id == runner.id) || [];
current_donations.filter((d) => d.runner?.id == runner.id) || [];
certificateRunners.push(runner); certificateRunners.push(runner);
} }
fetch( fetch(
@ -142,7 +135,7 @@
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
a.download = `${$_("certificates")}_${t.name}-${locale}-${createId()}.pdf`; a.download = `${$_('certificates')}_${t.name}-${locale}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
@ -151,7 +144,8 @@
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -164,22 +158,16 @@
text: $_("generating-pdfs"), text: $_("generating-pdfs"),
duration: -1, duration: -1,
}).showToast(); }).showToast();
const current_donations = const current_donations = (await DonationService.donationControllerGetAll()) || [];
(await DonationService.donationControllerGetAll()) || [];
let count = 0; let count = 0;
let count_orgs =0; let count_orgs =0;
for (const o of generate_orgs) { for (const o of generate_orgs) {
count_orgs++; count_orgs++;
let count = 0; let count = 0;
let runners = let runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id, true)
await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
o.id,
true
);
let certificateRunners = []; let certificateRunners = [];
for (let runner of runners) { for (let runner of runners) {
runner.distanceDonations = runner.distanceDonations = current_donations.filter((d) => d.runner?.id == runner.id) || [];
current_donations.filter((d) => d.runner?.id == runner.id) || [];
certificateRunners.push(runner); certificateRunners.push(runner);
} }
await fetch( await fetch(
@ -209,17 +197,18 @@
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
a.download = `${$_("certificates")}_${o.name}-${locale}-${createId()}.pdf`; a.download = `${$_('certificates')}_${o.name}_direct-${locale}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
if (count === o.teams.length && count_orgs === generate_orgs.length) { if (count === o.teams.length && count_orgs === generate_orgs.length) {
toast.hideToast(); toast.hideToast();
console.log("here"); console.log("here")
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -231,8 +220,7 @@
); );
let certificateRunners = []; let certificateRunners = [];
for (let runner of runners) { for (let runner of runners) {
runner.distanceDonations = runner.distanceDonations = current_donations.filter((d) => d.runner?.id == runner.id) || [];
current_donations.filter((d) => d.runner?.id == runner.id) || [];
certificateRunners.push(runner); certificateRunners.push(runner);
} }
await fetch( await fetch(
@ -262,21 +250,17 @@
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
a.download = `${$_("certificates")}_${o.name}_${ a.download = `${$_('certificates')}_${o.name}_${t.name}-${locale}.pdf`;
t.name
}-${locale}-${createId()}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
if ( if (count === o.teams.length && count_orgs === generate_orgs.length) {
count === o.teams.length &&
count_orgs === generate_orgs.length
) {
toast.hideToast(); toast.hideToast();
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -297,56 +281,49 @@
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex" class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex"
id="options-menu" id="options-menu"
aria-haspopup="true" aria-haspopup="true"
aria-expanded="true" aria-expanded="true">
> {$_('generate-runner-certificates')}
{$_("generate-runner-certificates")}
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width="24" width="24"
height="24" height="24"
viewBox="0 0 24 24" viewBox="0 0 24 24"
class="-mr-1 ml-2 h-5 w-5" class="-mr-1 ml-2 h-5 w-5"><path
><path fill="none" d="M0 0h24v24H0z" /> fill="none"
d="M0 0h24v24H0z" />
<path <path
fill="currentColor" fill="currentColor"
d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z" d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z" /></svg>
/></svg
>
</button> </button>
</div> </div>
{#if certificates_dropdown_open} {#if certificates_dropdown_open}
<div <div
class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-10" class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-10"
id="certificates:dropdown:menu" id="certificates:dropdown:menu">
>
<div <div
class="py-1" class="py-1"
role="menu" role="menu"
aria-orientation="vertical" aria-orientation="vertical"
aria-labelledby="options-menu" aria-labelledby="options-menu">
> <span
<span class="block w-full text-left px-4 py-2 text-sm text-gray-700" class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span>
>{$_("select-language")}</span
>
<button <button
on:click={() => { on:click={() => {
generateCertificates("de"); generateCertificates('de');
}} }}
type="submit" type="submit"
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900" class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
role="menuitem" role="menuitem">
> {$_('german')}
{$_("german")}
</button> </button>
<button <button
on:click={() => { on:click={() => {
generateCertificates("en"); generateCertificates('en');
}} }}
type="submit" type="submit"
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900" class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
role="menuitem" role="menuitem">
> {$_('english')}
{$_("english")}
</button> </button>
</div> </div>
</div> </div>

View File

@ -5,9 +5,6 @@
RunnerTeamService, RunnerTeamService,
} from "@odit/lfk-client-js"; } from "@odit/lfk-client-js";
import Toastify from "toastify-js"; import Toastify from "toastify-js";
import { init } from "@paralleldrive/cuid2";
const createId = init({ length: 10, fingerprint: "lfk-frontend" });
export let sponsoring_contracts_show = false; export let sponsoring_contracts_show = false;
export let generate_runners = []; export let generate_runners = [];
export let generate_orgs = []; export let generate_orgs = [];
@ -72,7 +69,7 @@
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
a.download = `${$_("sponsorings")}_${t.name}-${locale}-${createId()}.pdf`; a.download = `${$_('sponsorings')}_${t.name}-${locale}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
@ -81,7 +78,8 @@
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -98,11 +96,7 @@
for (const o of generate_orgs) { for (const o of generate_orgs) {
count_orgs++; count_orgs++;
let count = 0; let count = 0;
let runners = let runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id, true)
await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
o.id,
true
);
await fetch( await fetch(
`${config.baseurl_documentserver}/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`, `${config.baseurl_documentserver}/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
{ {
@ -130,17 +124,18 @@
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
a.download = `${$_("sponsorings")}_${o.name}_direct-${locale}-${createId()}.pdf`; a.download = `${$_('sponsorings')}_${o.name}_direct-${locale}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
if (count === o.teams.length && count_orgs === generate_orgs.length) { if (count === o.teams.length && count_orgs === generate_orgs.length) {
toast.hideToast(); toast.hideToast();
console.log("here"); console.log("here")
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -177,21 +172,17 @@
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
a.download = `${$_("sponsorings")}_${o.name}_${ a.download = `${$_('sponsorings')}_${o.name}_${t.name}-${locale}.pdf`;
t.name
}-${locale}-${createId()}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
if ( if (count === o.teams.length && count_orgs === generate_orgs.length) {
count === o.teams.length &&
count_orgs === generate_orgs.length
) {
toast.hideToast(); toast.hideToast();
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -233,11 +224,9 @@
let a = document.createElement("a"); let a = document.createElement("a");
a.href = url; a.href = url;
if(generate_runners.length == 1){ if(generate_runners.length == 1){
a.download = `${$_("sponsorings")}_${generate_runners[0].firstname}_${ a.download = `${$_('sponsorings')}_${generate_runners[0].firstname}_${generate_runners[0].lastname}-${locale}.pdf`;
generate_runners[0].lastname
}-${locale}-${createId()}.pdf`;
} }
a.download = `${$_("sponsorings")}-${locale}-${createId()}.pdf`; a.download = `${$_('sponsorings')}-${locale}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
@ -245,7 +234,8 @@
Toastify({ Toastify({
text: $_("pdf-successfully-generated"), text: $_("pdf-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", backgroundColor:
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
}) })
.catch((err) => { .catch((err) => {
@ -259,63 +249,55 @@
<div> <div>
<button <button
on:click={() => { on:click={() => {
sponsoring_contracts_download_open = sponsoring_contracts_download_open = !sponsoring_contracts_download_open;
!sponsoring_contracts_download_open;
}} }}
type="button" type="button"
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex" class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex"
id="options-menu" id="options-menu"
aria-haspopup="true" aria-haspopup="true"
aria-expanded="true" aria-expanded="true">
> {$_('generate-sponsoring-contracts')}
{$_("generate-sponsoring-contracts")}
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
width="24" width="24"
height="24" height="24"
viewBox="0 0 24 24" viewBox="0 0 24 24"
class="-mr-1 ml-2 h-5 w-5" class="-mr-1 ml-2 h-5 w-5"><path
><path fill="none" d="M0 0h24v24H0z" /> fill="none"
d="M0 0h24v24H0z" />
<path <path
fill="currentColor" fill="currentColor"
d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z" d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z" /></svg>
/></svg
>
</button> </button>
</div> </div>
{#if sponsoring_contracts_download_open} {#if sponsoring_contracts_download_open}
<div <div
class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-10" class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-10"
id="sponsoring:dropdown:menu" id="sponsoring:dropdown:menu">
>
<div <div
class="py-1" class="py-1"
role="menu" role="menu"
aria-orientation="vertical" aria-orientation="vertical"
aria-labelledby="options-menu" aria-labelledby="options-menu">
> <span
<span class="block w-full text-left px-4 py-2 text-sm text-gray-700" class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span>
>{$_("select-language")}</span
>
<button <button
on:click={() => { on:click={() => {
generateSponsoringContract("de"); generateSponsoringContract('de');
}} }}
type="submit" type="submit"
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900" class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
role="menuitem" role="menuitem">
> {$_('german')}
{$_("german")}
</button> </button>
<button <button
on:click={() => { on:click={() => {
generateSponsoringContract("en"); generateSponsoringContract('en');
}} }}
type="submit" type="submit"
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900" class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
role="menuitem" role="menuitem">
> {$_('english')}
{$_("english")}
</button> </button>
</div> </div>
</div> </div>

View File

@ -20,8 +20,7 @@ export default defineConfig(({ command, mode }) => {
build: { build: {
polyfillDynamicImport: false, polyfillDynamicImport: false,
cssCodeSplit: false, cssCodeSplit: false,
minify: isProduction, minify: isProduction
target: ["es2020", "esnext", "edge88", "chrome87", "safari14"]
}, },
plugins: [ plugins: [
svelte({ svelte({