Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
467808abef | |||
861f1f2216 | |||
509b22bea0 | |||
7447b2f4c1 | |||
fef14b6e4f | |||
01d2a7e6aa | |||
ac586fec5a | |||
5476808683 |
13
CHANGELOG.md
13
CHANGELOG.md
@ -2,8 +2,21 @@
|
|||||||
|
|
||||||
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.13.0](https://git.odit.services/lfk/frontend/compare/0.12.5...0.13.0)
|
||||||
|
|
||||||
|
- Merge pull request 'Better org pdf generation feature/130-org_doc_splitting' (#131) from feature/130-org_doc_splitting into dev [`861f1f2`](https://git.odit.services/lfk/frontend/commit/861f1f221653283e7586aa2c67b205337fd44398)
|
||||||
|
- Org card generation now runs in sequence [`fef14b6`](https://git.odit.services/lfk/frontend/commit/fef14b6e4fb47ad92da61de91fedce96aea26b2c)
|
||||||
|
- Org certificate generation now runs in sequence [`509b22b`](https://git.odit.services/lfk/frontend/commit/509b22bea0dd3e4446e6ecc37d27644e9bf2ad50)
|
||||||
|
- Org contract generation now runs in sequence [`01d2a7e`](https://git.odit.services/lfk/frontend/commit/01d2a7e6aa709b3f2d71575f705fc962e97e2742)
|
||||||
|
- Emergency document server url change [`5476808`](https://git.odit.services/lfk/frontend/commit/5476808683a919bc34dbaea1f1ed276d49750096)
|
||||||
|
- Fixed const -> let [`7447b2f`](https://git.odit.services/lfk/frontend/commit/7447b2f4c134a585905db6733093eab13e6f7c47)
|
||||||
|
- Hotfix: Org * generation🐞 [`ac586fe`](https://git.odit.services/lfk/frontend/commit/ac586fec5abd324d590ba99cdfe8ddddefbf95e6)
|
||||||
|
|
||||||
#### [0.12.5](https://git.odit.services/lfk/frontend/compare/0.12.4...0.12.5)
|
#### [0.12.5](https://git.odit.services/lfk/frontend/compare/0.12.4...0.12.5)
|
||||||
|
|
||||||
|
> 8 April 2021
|
||||||
|
|
||||||
|
- 🚀RELEASE v0.12.5 [`331d737`](https://git.odit.services/lfk/frontend/commit/331d737796c82454b1c19fa1840ccc20e36d2626)
|
||||||
- Merge pull request 'Added runner team's parentorg name to runenr overciew' (#129) from feature/128-runner_orgs into dev [`ef81b8a`](https://git.odit.services/lfk/frontend/commit/ef81b8adf9bef685a55936d7544bf645c0d6ecbe)
|
- Merge pull request 'Added runner team's parentorg name to runenr overciew' (#129) from feature/128-runner_orgs into dev [`ef81b8a`](https://git.odit.services/lfk/frontend/commit/ef81b8adf9bef685a55936d7544bf645c0d6ecbe)
|
||||||
- Switched to html entity [`8a7d635`](https://git.odit.services/lfk/frontend/commit/8a7d635cef2d465e70c84e1f7a7b90b98a8dbab1)
|
- Switched to html entity [`8a7d635`](https://git.odit.services/lfk/frontend/commit/8a7d635cef2d465e70c84e1f7a7b90b98a8dbab1)
|
||||||
- Added runner team's parentorg name to runenr overciew [`4c259c1`](https://git.odit.services/lfk/frontend/commit/4c259c1eef2b0166ce6a8493d0c9e9d5ede11146)
|
- Added runner team's parentorg name to runenr overciew [`4c259c1`](https://git.odit.services/lfk/frontend/commit/4c259c1eef2b0166ce6a8493d0c9e9d5ede11146)
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<span style="display: none;visibility: hidden;" id="buildinfo">RELEASE_INFO-0.12.5-RELEASE_INFO</span>
|
<span style="display: none;visibility: hidden;" id="buildinfo">RELEASE_INFO-0.13.0-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>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@odit/lfk-frontend",
|
"name": "@odit/lfk-frontend",
|
||||||
"version": "0.12.5",
|
"version": "0.13.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"i18n-order": "node order.js",
|
"i18n-order": "node order.js",
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const config = {
|
const config = {
|
||||||
baseurl: 'http://localhost:4010',
|
baseurl: 'http://localhost:4010',
|
||||||
|
baseurl_documentserver: 'http://localhost:4010/documents',
|
||||||
documentserver_key: 'NqZSYTy5AFQ7MppbLW5moqpTk7u7YrNUHKYhKYuThnnya2WpCOIU694hIZT1FzYe',
|
documentserver_key: 'NqZSYTy5AFQ7MppbLW5moqpTk7u7YrNUHKYhKYuThnnya2WpCOIU694hIZT1FzYe',
|
||||||
// optional
|
// optional
|
||||||
default_username: 'demo',
|
default_username: 'demo',
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
duration: -1,
|
duration: -1,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
fetch(
|
fetch(
|
||||||
`${config.baseurl}/documents/cards?&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/cards?&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
$: active_deletes = [];
|
$: active_deletes = [];
|
||||||
$: sponsoring_contracts_show = current_organizations.some((r) => r.is_selected === true);
|
$: sponsoring_contracts_show = current_organizations.some((r) => r.is_selected === true);
|
||||||
$: cards_show = current_organizations.some((r) => r.is_selected === true);
|
$: cards_show = current_organizations.some((r) => r.is_selected === true);
|
||||||
$: generate_orgs = current_organizations.some((r) => r.is_selected === true);
|
$: generate_orgs = current_organizations.filter((r) => r.is_selected === true);
|
||||||
$: certificates_show = current_organizations.some(
|
$: certificates_show = current_organizations.some(
|
||||||
(r) => r.is_selected === true
|
(r) => r.is_selected === true
|
||||||
);
|
);
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
duration: -1,
|
duration: -1,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
fetch(
|
fetch(
|
||||||
`${config.baseurl}/documents/cards?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/cards?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -101,7 +101,7 @@
|
|||||||
cards.push(card);
|
cards.push(card);
|
||||||
}
|
}
|
||||||
fetch(
|
fetch(
|
||||||
`${config.baseurl}/documents/cards?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/cards?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -169,7 +169,7 @@
|
|||||||
cards.push(card);
|
cards.push(card);
|
||||||
}
|
}
|
||||||
fetch(
|
fetch(
|
||||||
`${config.baseurl}/documents/cards?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/cards?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -216,15 +216,16 @@
|
|||||||
|
|
||||||
async function generateOrgCards(locale) {
|
async function generateOrgCards(locale) {
|
||||||
const toast = Toastify({
|
const toast = Toastify({
|
||||||
text: $_("generating-pdf"),
|
text: $_("generating-pdfs"),
|
||||||
duration: -1,
|
duration: -1,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
let count = 0;
|
|
||||||
const current_cards = await RunnerCardService.runnerCardControllerGetAll();
|
const current_cards = await RunnerCardService.runnerCardControllerGetAll();
|
||||||
|
let count = 0;
|
||||||
|
let count_orgs =0;
|
||||||
for (const o of generate_orgs) {
|
for (const o of generate_orgs) {
|
||||||
const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
|
count_orgs++;
|
||||||
o.id
|
let count = 0;
|
||||||
);
|
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);
|
||||||
@ -235,8 +236,8 @@
|
|||||||
}
|
}
|
||||||
cards.push(card);
|
cards.push(card);
|
||||||
}
|
}
|
||||||
fetch(
|
await fetch(
|
||||||
`${config.baseurl}/documents/cards?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/cards?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -259,15 +260,72 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((blob) => {
|
.then((blob) => {
|
||||||
count++;
|
|
||||||
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}-${locale}.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 === generate_orgs.length) {
|
if (count === o.teams.length && count_orgs === generate_orgs.length) {
|
||||||
|
toast.hideToast();
|
||||||
|
console.log("here")
|
||||||
|
Toastify({
|
||||||
|
text: $_("pdfs-successfully-generated"),
|
||||||
|
duration: 3500,
|
||||||
|
backgroundColor:
|
||||||
|
"linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
|
}).showToast();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {});
|
||||||
|
for await (const t of o.teams) {
|
||||||
|
count++;
|
||||||
|
let runners = await RunnerTeamService.runnerTeamControllerGetRunners(
|
||||||
|
t.id
|
||||||
|
);
|
||||||
|
let cards = [];
|
||||||
|
for (let runner of runners) {
|
||||||
|
let card = current_cards.find((c) => c.runner?.id == runner.id);
|
||||||
|
if (!card) {
|
||||||
|
card = await RunnerCardService.runnerCardControllerPost({
|
||||||
|
runner: runner.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
cards.push(card);
|
||||||
|
}
|
||||||
|
await fetch(
|
||||||
|
`${config.baseurl_documentserver}/cards?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(cards),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((response) => {
|
||||||
|
if (response.status != "200") {
|
||||||
|
toast.hideToast();
|
||||||
|
Toastify({
|
||||||
|
text: $_("pdf-generation-failed"),
|
||||||
|
duration: 3500,
|
||||||
|
backgroundColor:
|
||||||
|
"linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)",
|
||||||
|
}).showToast();
|
||||||
|
} else {
|
||||||
|
return response.blob();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((blob) => {
|
||||||
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
let a = document.createElement("a");
|
||||||
|
a.href = url;
|
||||||
|
a.download = `${$_('runnercards')}_${o.name}_${t.name}-${locale}.pdf`;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
if (count === o.teams.length && count_orgs === generate_orgs.length) {
|
||||||
toast.hideToast();
|
toast.hideToast();
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_("pdfs-successfully-generated"),
|
text: $_("pdfs-successfully-generated"),
|
||||||
@ -280,6 +338,7 @@
|
|||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if cards_show}
|
{#if cards_show}
|
||||||
|
@ -37,14 +37,14 @@
|
|||||||
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.find((d) => d.runner?.id == runner.id) || [];
|
runner.distanceDonations = current_donations.find((d) => d.runner?.id == runner.id) || [];
|
||||||
certificateRunners.push(runner);
|
certificateRunners.push(runner);
|
||||||
}
|
}
|
||||||
fetch(
|
fetch(
|
||||||
`${config.baseurl}/documents/certificates?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/certificates?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -96,7 +96,7 @@
|
|||||||
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
|
||||||
@ -107,7 +107,7 @@
|
|||||||
certificateRunners.push(runner);
|
certificateRunners.push(runner);
|
||||||
}
|
}
|
||||||
fetch(
|
fetch(
|
||||||
`${config.baseurl}/documents/certificates?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/certificates?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -154,22 +154,23 @@
|
|||||||
|
|
||||||
async function generateOrgCertificates(locale) {
|
async function generateOrgCertificates(locale) {
|
||||||
const toast = Toastify({
|
const toast = Toastify({
|
||||||
text: $_("generating-pdf"),
|
text: $_("generating-pdfs"),
|
||||||
duration: -1,
|
duration: -1,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
|
const current_donations = (await DonationService.donationControllerGetAll()) || [];
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const current_donations = await DonationService.donationControllerGetAll();
|
let count_orgs =0;
|
||||||
for (const o of generate_orgs) {
|
for (const o of generate_orgs) {
|
||||||
const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
|
count_orgs++;
|
||||||
o.id
|
let count = 0;
|
||||||
);
|
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.find((d) => d.runner?.id == runner.id) || [];
|
runner.distanceDonations = current_donations.find((d) => d.runner?.id == runner.id) || [];
|
||||||
certificateRunners.push(runner);
|
certificateRunners.push(runner);
|
||||||
}
|
}
|
||||||
fetch(
|
await fetch(
|
||||||
`${config.baseurl}/documents/certificates?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/certificates?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -192,15 +193,67 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((blob) => {
|
.then((blob) => {
|
||||||
count++;
|
|
||||||
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}.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 === generate_orgs.length) {
|
if (count === o.teams.length && count_orgs === generate_orgs.length) {
|
||||||
|
toast.hideToast();
|
||||||
|
console.log("here")
|
||||||
|
Toastify({
|
||||||
|
text: $_("pdfs-successfully-generated"),
|
||||||
|
duration: 3500,
|
||||||
|
backgroundColor:
|
||||||
|
"linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
|
}).showToast();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {});
|
||||||
|
for await (const t of o.teams) {
|
||||||
|
count++;
|
||||||
|
let runners = await RunnerTeamService.runnerTeamControllerGetRunners(
|
||||||
|
t.id
|
||||||
|
);
|
||||||
|
let certificateRunners = [];
|
||||||
|
for (let runner of runners) {
|
||||||
|
runner.distanceDonations = current_donations.find((d) => d.runner?.id == runner.id) || [];
|
||||||
|
certificateRunners.push(runner);
|
||||||
|
}
|
||||||
|
await fetch(
|
||||||
|
`${config.baseurl_documentserver}/certificates?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(certificateRunners),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((response) => {
|
||||||
|
if (response.status != "200") {
|
||||||
|
toast.hideToast();
|
||||||
|
Toastify({
|
||||||
|
text: $_("pdf-generation-failed"),
|
||||||
|
duration: 3500,
|
||||||
|
backgroundColor:
|
||||||
|
"linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)",
|
||||||
|
}).showToast();
|
||||||
|
} else {
|
||||||
|
return response.blob();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((blob) => {
|
||||||
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
let a = document.createElement("a");
|
||||||
|
a.href = url;
|
||||||
|
a.download = `${$_('certificates')}_${o.name}_${t.name}-${locale}.pdf`;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
if (count === o.teams.length && count_orgs === generate_orgs.length) {
|
||||||
toast.hideToast();
|
toast.hideToast();
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_("pdfs-successfully-generated"),
|
text: $_("pdfs-successfully-generated"),
|
||||||
@ -213,6 +266,7 @@
|
|||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if certificates_show}
|
{#if certificates_show}
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
t.id
|
t.id
|
||||||
);
|
);
|
||||||
fetch(
|
fetch(
|
||||||
`${config.baseurl}/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -92,12 +92,13 @@
|
|||||||
text: $_("generating-pdf"),
|
text: $_("generating-pdf"),
|
||||||
duration: -1,
|
duration: -1,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
|
let count_orgs =0;
|
||||||
for (const o of generate_orgs) {
|
for (const o of generate_orgs) {
|
||||||
const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
|
count_orgs++;
|
||||||
o.id
|
let count = 0;
|
||||||
);
|
let runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id, true)
|
||||||
fetch(
|
await fetch(
|
||||||
`${config.baseurl}/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -120,15 +121,62 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((blob) => {
|
.then((blob) => {
|
||||||
count++;
|
|
||||||
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}-${locale}.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 === generate_orgs.length) {
|
if (count === o.teams.length && count_orgs === generate_orgs.length) {
|
||||||
|
toast.hideToast();
|
||||||
|
console.log("here")
|
||||||
|
Toastify({
|
||||||
|
text: $_("pdfs-successfully-generated"),
|
||||||
|
duration: 3500,
|
||||||
|
backgroundColor:
|
||||||
|
"linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
|
}).showToast();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {});
|
||||||
|
for await (const t of o.teams) {
|
||||||
|
count++;
|
||||||
|
let runners = await RunnerTeamService.runnerTeamControllerGetRunners(
|
||||||
|
t.id
|
||||||
|
);
|
||||||
|
await fetch(
|
||||||
|
`${config.baseurl_documentserver}/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(runners),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((response) => {
|
||||||
|
if (response.status != "200") {
|
||||||
|
toast.hideToast();
|
||||||
|
Toastify({
|
||||||
|
text: $_("pdf-generation-failed"),
|
||||||
|
duration: 3500,
|
||||||
|
backgroundColor:
|
||||||
|
"linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)",
|
||||||
|
}).showToast();
|
||||||
|
} else {
|
||||||
|
return response.blob();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((blob) => {
|
||||||
|
const url = window.URL.createObjectURL(blob);
|
||||||
|
let a = document.createElement("a");
|
||||||
|
a.href = url;
|
||||||
|
a.download = `${$_('sponsorings')}_${o.name}_${t.name}-${locale}.pdf`;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
if (count === o.teams.length && count_orgs === generate_orgs.length) {
|
||||||
toast.hideToast();
|
toast.hideToast();
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_("pdfs-successfully-generated"),
|
text: $_("pdfs-successfully-generated"),
|
||||||
@ -141,6 +189,7 @@
|
|||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function generateRunnerContracts(locale) {
|
function generateRunnerContracts(locale) {
|
||||||
const toast = Toastify({
|
const toast = Toastify({
|
||||||
@ -148,7 +197,7 @@
|
|||||||
duration: -1,
|
duration: -1,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
fetch(
|
fetch(
|
||||||
`${config.baseurl}/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user