Compare commits
No commits in common. "861f1f221653283e7586aa2c67b205337fd44398" and "ac586fec5abd324d590ba99cdfe8ddddefbf95e6" have entirely different histories.
861f1f2216
...
ac586fec5a
@ -216,73 +216,14 @@
|
|||||||
|
|
||||||
async function generateOrgCards(locale) {
|
async function generateOrgCards(locale) {
|
||||||
const toast = Toastify({
|
const toast = Toastify({
|
||||||
text: $_("generating-pdfs"),
|
text: $_("generating-pdf"),
|
||||||
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) {
|
||||||
count_orgs++;
|
const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
|
||||||
let count = 0;
|
o.id
|
||||||
let runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id, true)
|
|
||||||
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}_direct-${locale}.pdf`;
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
|
||||||
a.remove();
|
|
||||||
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 = [];
|
let cards = [];
|
||||||
for (let runner of runners) {
|
for (let runner of runners) {
|
||||||
@ -294,7 +235,7 @@
|
|||||||
}
|
}
|
||||||
cards.push(card);
|
cards.push(card);
|
||||||
}
|
}
|
||||||
await fetch(
|
fetch(
|
||||||
`${config.baseurl_documentserver}/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",
|
||||||
@ -318,14 +259,15 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.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}_${t.name}-${locale}.pdf`;
|
a.download = `${$_('runnercards')}_${o.name}-${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 === generate_orgs.length) {
|
||||||
toast.hideToast();
|
toast.hideToast();
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_("pdfs-successfully-generated"),
|
text: $_("pdfs-successfully-generated"),
|
||||||
@ -338,7 +280,6 @@
|
|||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if cards_show}
|
{#if cards_show}
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
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) || [];
|
||||||
@ -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
|
||||||
@ -154,75 +154,21 @@
|
|||||||
|
|
||||||
async function generateOrgCertificates(locale) {
|
async function generateOrgCertificates(locale) {
|
||||||
const toast = Toastify({
|
const toast = Toastify({
|
||||||
text: $_("generating-pdfs"),
|
text: $_("generating-pdf"),
|
||||||
duration: -1,
|
duration: -1,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
const current_donations = (await DonationService.donationControllerGetAll()) || [];
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let count_orgs =0;
|
const current_donations = await DonationService.donationControllerGetAll();
|
||||||
for (const o of generate_orgs) {
|
for (const o of generate_orgs) {
|
||||||
count_orgs++;
|
const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
|
||||||
let count = 0;
|
o.id
|
||||||
let runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id, true)
|
|
||||||
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}_direct-${locale}.pdf`;
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
|
||||||
a.remove();
|
|
||||||
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 = [];
|
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);
|
||||||
}
|
}
|
||||||
await fetch(
|
fetch(
|
||||||
`${config.baseurl_documentserver}/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",
|
||||||
@ -246,14 +192,15 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.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}_${t.name}-${locale}.pdf`;
|
a.download = `${$_('certificates')}_${o.name}-${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 === generate_orgs.length) {
|
||||||
toast.hideToast();
|
toast.hideToast();
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_("pdfs-successfully-generated"),
|
text: $_("pdfs-successfully-generated"),
|
||||||
@ -266,7 +213,6 @@
|
|||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if certificates_show}
|
{#if certificates_show}
|
||||||
|
@ -92,60 +92,11 @@
|
|||||||
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) {
|
||||||
count_orgs++;
|
const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
|
||||||
let count = 0;
|
o.id
|
||||||
let runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id, true)
|
|
||||||
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}_direct-${locale}.pdf`;
|
|
||||||
document.body.appendChild(a);
|
|
||||||
a.click();
|
|
||||||
a.remove();
|
|
||||||
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(
|
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}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@ -169,14 +120,15 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.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}_${t.name}-${locale}.pdf`;
|
a.download = `${$_('sponsorings')}_${o.name}-${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 === generate_orgs.length) {
|
||||||
toast.hideToast();
|
toast.hideToast();
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_("pdfs-successfully-generated"),
|
text: $_("pdfs-successfully-generated"),
|
||||||
@ -189,7 +141,6 @@
|
|||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function generateRunnerContracts(locale) {
|
function generateRunnerContracts(locale) {
|
||||||
const toast = Toastify({
|
const toast = Toastify({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user