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