parent
8b451b3c67
commit
c87321f804
@ -18,27 +18,25 @@
|
|||||||
|
|
||||||
function generateSponsoringContract(locale) {
|
function generateSponsoringContract(locale) {
|
||||||
sponsoring_contracts_download_open = false;
|
sponsoring_contracts_download_open = false;
|
||||||
|
|
||||||
|
if (generate_orgs.length > 0) {
|
||||||
|
generateOrgContracts(locale);
|
||||||
|
} else if (generate_teams.length > 0) {
|
||||||
|
generateTeamContracts(locale);
|
||||||
|
} else {
|
||||||
|
generateRunnerContracts(locale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateTeamContracts(locale) {
|
||||||
|
//TODO:
|
||||||
|
}
|
||||||
|
|
||||||
|
async function generateOrgContracts(locale) {
|
||||||
const toast = Toastify({
|
const toast = Toastify({
|
||||||
text: $_("generating-pdf"),
|
text: $_("generating-pdf"),
|
||||||
duration: -1,
|
duration: -1,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
|
|
||||||
if(generate_orgs.length>0){
|
|
||||||
generateOrgContracts(toast, locale);
|
|
||||||
}
|
|
||||||
else if(generate_teams.length>0){
|
|
||||||
generateTeamContracts(toast, locale);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
generateRunnerContracts(toast, locale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function generateTeamContracts(toast, locale) {
|
|
||||||
//TODO:
|
|
||||||
}
|
|
||||||
|
|
||||||
async function generateOrgContracts(toast, locale) {
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
for await (const o of generate_orgs) {
|
for await (const o of generate_orgs) {
|
||||||
const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
|
const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(
|
||||||
@ -76,12 +74,13 @@
|
|||||||
document.body.appendChild(a);
|
document.body.appendChild(a);
|
||||||
a.click();
|
a.click();
|
||||||
a.remove();
|
a.remove();
|
||||||
if (count === orgs.length) {
|
if (count === 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();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -89,7 +88,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateRunnerContracts(toast, locale) {
|
function generateRunnerContracts(locale) {
|
||||||
|
const toast = Toastify({
|
||||||
|
text: $_("generating-pdf"),
|
||||||
|
duration: -1,
|
||||||
|
}).showToast();
|
||||||
fetch(
|
fetch(
|
||||||
`${config.baseurl}/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl}/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
@ -97,9 +100,7 @@
|
|||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify(
|
body: JSON.stringify(generate_runners),
|
||||||
generate_runners
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user