Compare commits

...

6 Commits

Author SHA1 Message Date
f9cfd6bd06
🚀RELEASE v0.16.3
All checks were successful
continuous-integration/drone/push Build is passing
2023-02-23 14:01:35 +01:00
287f63fa52
Merge branch 'dev' of git.odit.services:lfk/frontend into dev
All checks were successful
continuous-integration/drone/push Build is passing
2023-02-23 14:00:20 +01:00
5fe47634e8
Bumped vite build targets 2023-02-23 13:59:27 +01:00
a6590910cf new license file version [CI SKIP] 2023-02-23 12:54:38 +00:00
ad454c386c
Merge pull request 'feature/156-pdf_names' (#157) from feature/156-pdf_names into dev
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #157
2023-02-23 12:54:04 +00:00
0b2c296de0
Added ids for generated pdfs
ref #156
2023-02-23 09:59:07 +01:00
8 changed files with 1124 additions and 1054 deletions

View File

@ -2,9 +2,19 @@
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.2-RELEASE_INFO</span> <span style="display: none;visibility: hidden;" id="buildinfo">RELEASE_INFO-0.16.3-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.2", "version": "0.16.3",
"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,5 +53,8 @@
"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,6 +6,9 @@
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 = [];
@ -67,7 +70,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}.pdf`; a.download = `${$_("runnercards")}-${locale}-${createId()}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
@ -75,8 +78,7 @@
Toastify({ Toastify({
text: $_("pdf-successfully-generated"), text: $_("pdf-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
}) })
.catch((err) => { .catch((err) => {
@ -128,10 +130,11 @@
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}_${generate_runners[0].lastname}-${locale}.pdf`; a.download = `${$_("runnercards")}_${generate_runners[0].firstname}_${
} generate_runners[0].lastname
else{ }-${locale}-${createId()}.pdf`;
a.download = `Runnercards-${locale}.pdf`; } else {
a.download = `${$_("runnercards")}-${locale}-${createId()}.pdf`;
} }
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
@ -140,8 +143,7 @@
Toastify({ Toastify({
text: $_("pdf-successfully-generated"), text: $_("pdf-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
}) })
.catch((err) => {}); .catch((err) => {});
@ -196,7 +198,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}.pdf`; a.download = `${$_("runnercards")}_${t.name}-${locale}-${createId()}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
@ -205,8 +207,7 @@
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -225,7 +226,11 @@
for (const o of generate_orgs) { for (const o of generate_orgs) {
count_orgs++; count_orgs++;
let count = 0; let count = 0;
let runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id, true) let runners =
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);
@ -263,18 +268,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}_direct-${locale}.pdf`; a.download = `${$_("runnercards")}_${o.name}_direct-${locale}-${createId()}.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: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -321,17 +325,21 @@
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}_${t.name}-${locale}.pdf`; a.download = `${$_("runnercards")}_${o.name}_${
t.name
}-${locale}-${createId()}.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();
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -352,49 +360,56 @@
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"><path class="-mr-1 ml-2 h-5 w-5"
fill="none" ><path fill="none" d="M0 0h24v24H0z" />
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" /></svg> 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
>
</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 >
class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span> <span class="block w-full text-left px-4 py-2 text-sm text-gray-700"
>{$_("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,9 +3,12 @@
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 = [];
@ -37,11 +40,13 @@
text: $_("generating-pdf"), text: $_("generating-pdf"),
duration: -1, duration: -1,
}).showToast(); }).showToast();
const current_donations = (await DonationService.donationControllerGetAll()) || []; const current_donations =
(await DonationService.donationControllerGetAll()) || [];
let certificateRunners = []; let certificateRunners = [];
for (let runner of generate_runners) { for (let runner of generate_runners) {
runner.distanceDonations = current_donations.filter((d) => d.runner?.id == runner.id) || []; runner.distanceDonations =
console.log(runner.distanceDonations) current_donations.filter((d) => d.runner?.id == runner.id) || [];
console.log(runner.distanceDonations);
certificateRunners.push(runner); certificateRunners.push(runner);
} }
fetch( fetch(
@ -72,10 +77,11 @@
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')}_${generate_runners[0].firstname}_${generate_runners[0].lastname}-${locale}.pdf`; a.download = `${$_("certificates")}_${
} generate_runners[0].firstname
else{ }_${generate_runners[0].lastname}-${locale}-${createId()}.pdf`;
a.download = `${$_('certificates')}-${locale}.pdf`; } else {
a.download = `${$_("certificates")}-${locale}.pdf`;
} }
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
@ -84,8 +90,7 @@
Toastify({ Toastify({
text: $_("pdf-successfully-generated"), text: $_("pdf-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
}) })
.catch((err) => {}); .catch((err) => {});
@ -97,14 +102,16 @@
duration: -1, duration: -1,
}).showToast(); }).showToast();
let count = 0; let count = 0;
const current_donations = (await DonationService.donationControllerGetAll()) || []; const current_donations =
(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 = current_donations.filter((d) => d.runner?.id == runner.id) || []; runner.distanceDonations =
current_donations.filter((d) => d.runner?.id == runner.id) || [];
certificateRunners.push(runner); certificateRunners.push(runner);
} }
fetch( fetch(
@ -135,7 +142,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}.pdf`; a.download = `${$_("certificates")}_${t.name}-${locale}-${createId()}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
@ -144,8 +151,7 @@
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -158,16 +164,22 @@
text: $_("generating-pdfs"), text: $_("generating-pdfs"),
duration: -1, duration: -1,
}).showToast(); }).showToast();
const current_donations = (await DonationService.donationControllerGetAll()) || []; const current_donations =
(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 = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id, true) let runners =
await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
o.id,
true
);
let certificateRunners = []; let certificateRunners = [];
for (let runner of runners) { for (let runner of runners) {
runner.distanceDonations = current_donations.filter((d) => d.runner?.id == runner.id) || []; runner.distanceDonations =
current_donations.filter((d) => d.runner?.id == runner.id) || [];
certificateRunners.push(runner); certificateRunners.push(runner);
} }
await fetch( await fetch(
@ -197,18 +209,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}_direct-${locale}.pdf`; a.download = `${$_("certificates")}_${o.name}-${locale}-${createId()}.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: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -220,7 +231,8 @@
); );
let certificateRunners = []; let certificateRunners = [];
for (let runner of runners) { for (let runner of runners) {
runner.distanceDonations = current_donations.filter((d) => d.runner?.id == runner.id) || []; runner.distanceDonations =
current_donations.filter((d) => d.runner?.id == runner.id) || [];
certificateRunners.push(runner); certificateRunners.push(runner);
} }
await fetch( await fetch(
@ -250,17 +262,21 @@
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}_${t.name}-${locale}.pdf`; a.download = `${$_("certificates")}_${o.name}_${
t.name
}-${locale}-${createId()}.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();
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -281,49 +297,56 @@
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"><path class="-mr-1 ml-2 h-5 w-5"
fill="none" ><path fill="none" d="M0 0h24v24H0z" />
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" /></svg> 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
>
</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 >
class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span> <span class="block w-full text-left px-4 py-2 text-sm text-gray-700"
>{$_("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,6 +5,9 @@
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 = [];
@ -69,7 +72,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}.pdf`; a.download = `${$_("sponsorings")}_${t.name}-${locale}-${createId()}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
@ -78,8 +81,7 @@
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -96,7 +98,11 @@
for (const o of generate_orgs) { for (const o of generate_orgs) {
count_orgs++; count_orgs++;
let count = 0; let count = 0;
let runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id, true) let runners =
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}`,
{ {
@ -124,18 +130,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}_direct-${locale}.pdf`; a.download = `${$_("sponsorings")}_${o.name}_direct-${locale}-${createId()}.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: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -172,17 +177,21 @@
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}_${t.name}-${locale}.pdf`; a.download = `${$_("sponsorings")}_${o.name}_${
t.name
}-${locale}-${createId()}.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();
Toastify({ Toastify({
text: $_("pdfs-successfully-generated"), text: $_("pdfs-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
} }
}) })
@ -224,9 +233,11 @@
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}_${generate_runners[0].lastname}-${locale}.pdf`; a.download = `${$_("sponsorings")}_${generate_runners[0].firstname}_${
generate_runners[0].lastname
}-${locale}-${createId()}.pdf`;
} }
a.download = `${$_('sponsorings')}-${locale}.pdf`; a.download = `${$_("sponsorings")}-${locale}-${createId()}.pdf`;
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
a.remove(); a.remove();
@ -234,8 +245,7 @@
Toastify({ Toastify({
text: $_("pdf-successfully-generated"), text: $_("pdf-successfully-generated"),
duration: 3500, duration: 3500,
backgroundColor: backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
"linear-gradient(to right, #00b09b, #96c93d)",
}).showToast(); }).showToast();
}) })
.catch((err) => { .catch((err) => {
@ -249,55 +259,63 @@
<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"><path class="-mr-1 ml-2 h-5 w-5"
fill="none" ><path fill="none" d="M0 0h24v24H0z" />
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" /></svg> 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
>
</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 >
class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span> <span class="block w-full text-left px-4 py-2 text-sm text-gray-700"
>{$_("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,7 +20,8 @@ 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({