basic progress toasts

ref #62
This commit is contained in:
Philipp Dormann 2021-02-20 17:19:17 +01:00
parent dbc0ab76af
commit a7642c2da4
7 changed files with 70 additions and 1 deletions

View File

@ -122,6 +122,10 @@
on:click={async () => {
const locale = getLocaleFromNavigator();
const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(original_object.id);
const toast = Toastify({
text: $_('generating-pdf'),
duration: -1,
}).showToast();
fetch(
`https://dev.lauf-fuer-kaya.de/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
{
@ -141,6 +145,13 @@
document.body.appendChild(a);
a.click();
a.remove();
toast.hideToast();
Toastify({
text: $_('pdf-successfully-generated'),
duration: 3500,
backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast();
})
.catch((err) => {});
}}

View File

@ -49,6 +49,11 @@
on:click={async () => {
const locale = getLocaleFromNavigator();
const orgs = current_organizations.filter((r) => r.is_selected === true);
const toast = Toastify({
text: $_('generating-pdfs'),
duration: -1,
}).showToast();
let count = 0;
for await (const o of orgs) {
const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id);
fetch(
@ -63,6 +68,7 @@
)
.then((response) => response.blob())
.then((blob) => {
count++;
const url = window.URL.createObjectURL(blob);
let a = document.createElement('a');
a.href = url;
@ -70,6 +76,15 @@
document.body.appendChild(a);
a.click();
a.remove();
if (count === orgs.length) {
toast.hideToast();
Toastify({
text: $_('pdfs-successfully-generated'),
duration: 3500,
backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast();
}
})
.catch((err) => {});
}

View File

@ -135,6 +135,10 @@
<button
on:click={() => {
const locale = getLocaleFromNavigator();
const toast = Toastify({
text: $_('generating-pdf'),
duration: -1,
}).showToast();
fetch(
`https://dev.lauf-fuer-kaya.de/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
{
@ -150,10 +154,17 @@
const url = window.URL.createObjectURL(blob);
let a = document.createElement('a');
a.href = url;
a.download = 'Sponsoring.pdf';
a.download = 'Sponsoring_' + original_data.firstname + (original_data.middlename || '') + original_data.lastname + '.pdf';
document.body.appendChild(a);
a.click();
a.remove();
toast.hideToast();
Toastify({
text: $_('pdf-successfully-generated'),
duration: 3500,
backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast();
})
.catch((err) => {
console.error(err);

View File

@ -104,6 +104,10 @@
on:click={async () => {
const locale = getLocaleFromNavigator();
const runners = await RunnerTeamService.runnerTeamControllerGetRunners(teamdata.id);
const toast = Toastify({
text: $_('generating-pdf'),
duration: -1,
}).showToast();
fetch(
`https://dev.lauf-fuer-kaya.de/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
{
@ -123,6 +127,13 @@
document.body.appendChild(a);
a.click();
a.remove();
toast.hideToast();
Toastify({
text: $_('pdf-successfully-generated'),
duration: 3500,
backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast();
})
.catch((err) => {});
}}

View File

@ -50,7 +50,13 @@
on:click={async () => {
const locale = getLocaleFromNavigator();
const teams = current_teams.filter((r) => r.is_selected === true);
const toast = Toastify({
text: $_('generating-pdfs'),
duration: -1,
}).showToast();
let count = 0;
for await (const t of teams) {
count++;
const runners = await RunnerTeamService.runnerTeamControllerGetRunners(t.id);
fetch(
`https://dev.lauf-fuer-kaya.de/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
@ -71,6 +77,15 @@
document.body.appendChild(a);
a.click();
a.remove();
if (count === teams.length) {
toast.hideToast();
Toastify({
text: $_('pdfs-successfully-generated'),
duration: 3500,
backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast();
}
})
.catch((err) => {});
}

View File

@ -105,6 +105,7 @@
"geerbte": "geerbte",
"general-stats": "Allgemeine Statistiken",
"general_promise_error": "😢 Ein unbekannter Fehler ist aufgetreten",
"generating-pdfs": "PDFs werden generiert...",
"generic-ui-logic-error": "Etwas ist in der Benutzeroberfläche schiefgelaufen.",
"go-to-login": "Zum Login",
"goback": "Zur Startseite",
@ -161,6 +162,7 @@
"password-reset-in-progress": "Passwort wird zurückgesetzt...",
"password-reset-mail-sent": "Passwort-Reset Mail wurde an \"{usersEmail}\" geschickt.",
"password-reset-successful": "Passwort erfolgreich zurückgesetzt!",
"pdfs-successfully-generated": "Alle PDFs wurden generiert!",
"permissions": "Berechtigungen",
"permissions-updated": "Berechtigungen aktualisiert!",
"phone": "Telefon",

View File

@ -109,6 +109,8 @@
"general_promise_error": "😢 Error",
"generate-sponsoring-contract": "generate sponsoring contract",
"generate-sponsoring-contracts": "generate sponsoring contracts",
"generating-pdf": "generating PDF...",
"generating-pdfs": "generating PDFs...",
"generic-ui-logic-error": "Something went wrong in the UI logic",
"go-to-login": "Go To Login",
"goback": "Go Home",
@ -165,6 +167,8 @@
"password-reset-in-progress": "Password Reset in Progress...",
"password-reset-mail-sent": "Password reset mail was sent to \"{usersEmail}\".",
"password-reset-successful": "Password Reset successful!",
"pdf-successfully-generated": "PDF successfully generated!",
"pdfs-successfully-generated": "PDFs successfully generated!",
"permissions": "Permissions",
"permissions-updated": "Permissions updated!",
"phone": "Phone",