Compare commits

..

No commits in common. "b810bb01dbbe3d506af3852fcda8e1365a570c70" and "434466b306ec11ad46e5ee99bec22bdcd01872b6" have entirely different histories.

8 changed files with 332 additions and 677 deletions

View File

@ -24,8 +24,7 @@
$: isAddress1Valid = editable.address?.address1?.trim().length !== 0; $: isAddress1Valid = editable.address?.address1?.trim().length !== 0;
$: iszipcodevalid = editable.address?.postalcode?.trim().length !== 0; $: iszipcodevalid = editable.address?.postalcode?.trim().length !== 0;
$: iscityvalid = editable.address?.city?.trim().length !== 0; $: iscityvalid = editable.address?.city?.trim().length !== 0;
$: sponsoring_contracts_download_open = false;
const promise = RunnerOrganizationService.runnerOrganizationControllerGetOne( const promise = RunnerOrganizationService.runnerOrganizationControllerGetOne(
params.orgid params.orgid
).then((value) => { ).then((value) => {
@ -55,14 +54,6 @@
}); });
let modal_open = false; let modal_open = false;
let delete_org = {}; let delete_org = {};
document.addEventListener("click", function (e) {
if (
e.target.parentNode.parentNode.id != "sponsoring:dropdown" &&
e.target.parentNode.parentNode.id != "sponsoring:dropdown:menu"
) {
sponsoring_contracts_download_open = false;
}
});
function deleteOrganization() { function deleteOrganization() {
RunnerOrganizationService.runnerOrganizationControllerRemove( RunnerOrganizationService.runnerOrganizationControllerRemove(
original_object.id, original_object.id,
@ -109,55 +100,6 @@
} }
} }
export let import_modal_open = false; export let import_modal_open = false;
async function generateSponsoringContract(locale) {
sponsoring_contracts_download_open = false;
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}`,
{
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_" + original_object.name + ".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) => {});
}
</script> </script>
<ImportRunnerModal <ImportRunnerModal
@ -176,54 +118,57 @@
<div class="mb-8 text-3xl font-extrabold leading-tight"> <div class="mb-8 text-3xl font-extrabold leading-tight">
{original_object.name} {original_object.name}
<span data-id="org_actions_${editable.id}"> <span data-id="org_actions_${editable.id}">
<div id="sponsoring:dropdown" class="relative inline-block"> <button
<div> on:click={async () => {
<button const locale = getLocaleFromNavigator();
on:click={() => { const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(original_object.id);
sponsoring_contracts_download_open = !sponsoring_contracts_download_open; const toast = Toastify({
}} text: $_('generating-pdf'),
type="button" duration: -1,
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex" }).showToast();
id="options-menu" fetch(
aria-haspopup="true" `https://dev.lauf-fuer-kaya.de/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
aria-expanded="true"> {
{$_('generate-sponsoring-contracts')} method: 'POST',
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="-mr-1 ml-2 h-5 w-5"><path fill="none" d="M0 0h24v24H0z"/><path fill="currentColor" d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z"/></svg> headers: {
</button> 'Content-Type': 'application/json',
</div> },
{#if sponsoring_contracts_download_open} body: JSON.stringify(runners),
<div }
class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5" )
id="sponsoring:dropdown:menu"> .then((response) => {
<div if (response.status != '200') {
class="py-1" toast.hideToast();
role="menu" Toastify({
aria-orientation="vertical" text: $_('pdf-generation-failed'),
aria-labelledby="options-menu"> duration: 3500,
<span backgroundColor:
class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span> 'linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)',
<button }).showToast();
on:click={() => { } else {
generateSponsoringContract('de'); return response.blob();
}} }
type="submit" })
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" .then((blob) => {
role="menuitem"> const url = window.URL.createObjectURL(blob);
{$_('german')} let a = document.createElement('a');
</button> a.href = url;
<button a.download = 'Sponsorings_' + original_object.name + '.pdf';
on:click={() => { document.body.appendChild(a);
generateSponsoringContract('en'); a.click();
}} a.remove();
type="submit" toast.hideToast();
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" Toastify({
role="menuitem"> text: $_('pdf-successfully-generated'),
{$_('english')} duration: 3500,
</button> backgroundColor:
</div> 'linear-gradient(to right, #00b09b, #96c93d)',
</div> }).showToast();
{/if} })
</div> .catch((err) => {});
}}
type="button"
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('generate-sponsoring-contracts')}</button>
{#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:IMPORT')} {#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:IMPORT')}
<button <button
on:click={() => { on:click={() => {

View File

@ -9,7 +9,6 @@
import ConfirmOrgDeletion from "./ConfirmOrgDeletion.svelte"; import ConfirmOrgDeletion from "./ConfirmOrgDeletion.svelte";
$: searchvalue = ""; $: searchvalue = "";
$: active_deletes = []; $: active_deletes = [];
$: sponsoring_contracts_download_open = false;
export let current_organizations = []; export let current_organizations = [];
const promise = RunnerOrganizationService.runnerOrganizationControllerGetAll().then( const promise = RunnerOrganizationService.runnerOrganizationControllerGetAll().then(
@ -17,72 +16,6 @@
current_organizations = val; current_organizations = val;
} }
); );
document.addEventListener("click", function (e) {
if (
e.target.parentNode.parentNode.id != "sponsoring:dropdown" &&
e.target.parentNode.parentNode.id != "sponsoring:dropdown:menu"
) {
sponsoring_contracts_download_open = false;
}
});
async function generateSponsoringContract(locale) {
sponsoring_contracts_download_open = false;
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(
`https://dev.lauf-fuer-kaya.de/documents/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) => {
count++;
const url = window.URL.createObjectURL(blob);
let a = document.createElement("a");
a.href = url;
a.download = "Sponsorings_" + o.name + ".pdf";
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) => {});
}
}
</script> </script>
<ConfirmOrgDeletion <ConfirmOrgDeletion
@ -112,54 +45,66 @@
class="gridjs-input gridjs-search-input mb-4" /> class="gridjs-input gridjs-search-input mb-4" />
<div class="h-12"> <div class="h-12">
{#if current_organizations.some((r) => r.is_selected === true)} {#if current_organizations.some((r) => r.is_selected === true)}
<div id="sponsoring:dropdown" class="relative inline-block"> <button
<div> on:click={async () => {
<button const locale = getLocaleFromNavigator();
on:click={() => { const orgs = current_organizations.filter((r) => r.is_selected === true);
sponsoring_contracts_download_open = !sponsoring_contracts_download_open; const toast = Toastify({
}} text: $_('generating-pdfs'),
type="button" duration: -1,
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex" }).showToast();
id="options-menu" let count = 0;
aria-haspopup="true" for await (const o of orgs) {
aria-expanded="true"> const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id);
{$_('generate-sponsoring-contracts')} fetch(
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="-mr-1 ml-2 h-5 w-5"><path fill="none" d="M0 0h24v24H0z"/><path fill="currentColor" d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z"/></svg> `https://dev.lauf-fuer-kaya.de/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
</button> {
</div> method: 'POST',
{#if sponsoring_contracts_download_open} headers: {
<div 'Content-Type': 'application/json',
class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5" },
id="sponsoring:dropdown:menu"> body: JSON.stringify(runners),
<div }
class="py-1" )
role="menu" .then((response) => {
aria-orientation="vertical" if (response.status != '200') {
aria-labelledby="options-menu"> toast.hideToast();
<span Toastify({
class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span> text: $_('pdf-generation-failed'),
<button duration: 3500,
on:click={() => { backgroundColor:
generateSponsoringContract('de'); 'linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)',
}} }).showToast();
type="submit" } else {
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" return response.blob();
role="menuitem"> }
{$_('german')} })
</button> .then((blob) => {
<button count++;
on:click={() => { const url = window.URL.createObjectURL(blob);
generateSponsoringContract('en'); let a = document.createElement('a');
}} a.href = url;
type="submit" a.download = 'Sponsorings_' + o.name + '.pdf';
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" document.body.appendChild(a);
role="menuitem"> a.click();
{$_('english')} a.remove();
</button> if (count === orgs.length) {
</div> toast.hideToast();
</div> Toastify({
{/if} text: $_('pdfs-successfully-generated'),
</div> duration: 3500,
backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast();
}
})
.catch((err) => {});
}
}}
type="button"
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:w-auto sm:text-sm">
{$_('generate-sponsoring-contracts')}
</button>
{/if} {/if}
</div> </div>
<div <div

View File

@ -14,7 +14,6 @@
export let params; export let params;
const runner_promise = RunnerService.runnerControllerGetOne(params.runnerid); const runner_promise = RunnerService.runnerControllerGetOne(params.runnerid);
$: delete_triggered = false; $: delete_triggered = false;
$: sponsoring_contracts_download_open = false;
$: original_data_pdf = {}; $: original_data_pdf = {};
$: original_data = {}; $: original_data = {};
$: editable = {}; $: editable = {};
@ -33,14 +32,6 @@
original_data.group = original_data.group.id; original_data.group = original_data.group.id;
editable = Object.assign(editable, original_data); editable = Object.assign(editable, original_data);
}); });
document.addEventListener("click", function (e) {
if (
e.target.parentNode.parentNode.id != "sponsoring:dropdown" &&
e.target.parentNode.parentNode.id != "sponsoring:dropdown:menu"
) {
sponsoring_contracts_download_open = false;
}
});
let orgs = []; let orgs = [];
RunnerOrganizationService.runnerOrganizationControllerGetAll().then((val) => { RunnerOrganizationService.runnerOrganizationControllerGetAll().then((val) => {
orgs = val; orgs = val;
@ -77,59 +68,6 @@
}) })
.catch((err) => {}); .catch((err) => {});
} }
function generateSponsoringContract(locale) {
sponsoring_contracts_download_open = false;
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}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify([original_data_pdf]),
}
)
.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 =
"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);
});
}
</script> </script>
{#await runner_promise} {#await runner_promise}
@ -194,54 +132,58 @@
}} }}
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-400 text-base font-medium text-white sm:w-auto sm:text-sm">{$_('cancel')}</button> class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-400 text-base font-medium text-white sm:w-auto sm:text-sm">{$_('cancel')}</button>
{/if} {/if}
<div id="sponsoring:dropdown" class="relative inline-block"> <button
<div> on:click={() => {
<button const locale = getLocaleFromNavigator();
on:click={() => { const toast = Toastify({
sponsoring_contracts_download_open = !sponsoring_contracts_download_open; text: $_('generating-pdf'),
}} duration: -1,
type="button" }).showToast();
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex" fetch(
id="options-menu" `https://dev.lauf-fuer-kaya.de/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
aria-haspopup="true" {
aria-expanded="true"> method: 'POST',
{$_('generate-sponsoring-contract')} headers: {
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="-mr-1 ml-2 h-5 w-5"><path fill="none" d="M0 0h24v24H0z"/><path fill="currentColor" d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z"/></svg> 'Content-Type': 'application/json',
</button> },
</div> body: JSON.stringify([original_data_pdf]),
{#if sponsoring_contracts_download_open} }
<div )
class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5" .then((response) => {
id="sponsoring:dropdown:menu"> if (response.status != '200') {
<div toast.hideToast();
class="py-1" Toastify({
role="menu" text: $_('pdf-generation-failed'),
aria-orientation="vertical" duration: 3500,
aria-labelledby="options-menu"> backgroundColor:
<span 'linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)',
class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span> }).showToast();
<button } else {
on:click={() => { return response.blob();
generateSponsoringContract('de'); }
}} })
type="submit" .then((blob) => {
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" const url = window.URL.createObjectURL(blob);
role="menuitem"> let a = document.createElement('a');
{$_('german')} a.href = url;
</button> a.download = 'Sponsoring_' + original_data.firstname + (original_data.middlename || '') + original_data.lastname + '.pdf';
<button document.body.appendChild(a);
on:click={() => { a.click();
generateSponsoringContract('en'); a.remove();
}} toast.hideToast();
type="submit" Toastify({
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" text: $_('pdf-successfully-generated'),
role="menuitem"> duration: 3500,
{$_('english')} backgroundColor:
</button> 'linear-gradient(to right, #00b09b, #96c93d)',
</div> }).showToast();
</div> })
{/if} .catch((err) => {
</div> console.error(err);
});
}}
type="button"
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('generate-sponsoring-contract')}</button>
{#if !delete_triggered} {#if !delete_triggered}
<button <button
on:click={() => { on:click={() => {

View File

@ -20,7 +20,6 @@
$: filter__teams = selectedFilter_teams || []; $: filter__teams = selectedFilter_teams || [];
$: filter__orgs = selectedFilter || []; $: filter__orgs = selectedFilter || [];
$: filterGroupIDs = filter__teams.concat(filter__orgs).map((i) => i.value); $: filterGroupIDs = filter__teams.concat(filter__orgs).map((i) => i.value);
$: sponsoring_contracts_download_open = false;
$: teams = []; $: teams = [];
$: orgs = []; $: orgs = [];
$: mappedteams = teams.map(function (g) { $: mappedteams = teams.map(function (g) {
@ -31,14 +30,6 @@
return { value: g.id, label: g.name }; return { value: g.id, label: g.name };
}) })
.concat(mappedteams); .concat(mappedteams);
document.addEventListener("click", function (e) {
if (
e.target.parentNode.parentNode.id != "sponsoring:dropdown" &&
e.target.parentNode.parentNode.id != "sponsoring:dropdown:menu"
) {
sponsoring_contracts_download_open = false;
}
});
RunnerTeamService.runnerTeamControllerGetAll().then((val) => { RunnerTeamService.runnerTeamControllerGetAll().then((val) => {
teams = val; teams = val;
}); });
@ -51,56 +42,6 @@
} }
return id.toString() === searchvalue; return id.toString() === searchvalue;
} }
function generateSponsoringContract(locale) {
sponsoring_contracts_download_open = false;
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}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(
current_runners.filter((r) => r.is_selected === true)
),
}
)
.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 = "Sponsoring.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);
});
}
</script> </script>
{#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:GET')} {#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:GET')}
@ -137,64 +78,62 @@
</div> </div>
<div class="h-12"> <div class="h-12">
{#if current_runners.some((r) => r.is_selected === true)} {#if current_runners.some((r) => r.is_selected === true)}
<div id="sponsoring:dropdown" class="relative inline-block"> <button
<div> on:click={() => {
<button const locale = getLocaleFromNavigator();
on:click={() => { const toast = Toastify({
sponsoring_contracts_download_open = !sponsoring_contracts_download_open; text: $_('generating-pdf'),
}} duration: -1,
type="button" }).showToast();
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex" fetch(
id="options-menu" `https://dev.lauf-fuer-kaya.de/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
aria-haspopup="true" {
aria-expanded="true"> method: 'POST',
{$_('generate-sponsoring-contracts')} headers: {
<svg 'Content-Type': 'application/json',
xmlns="http://www.w3.org/2000/svg" },
width="24" body: JSON.stringify(
height="24" current_runners.filter((r) => r.is_selected === true)
viewBox="0 0 24 24" ),
class="-mr-1 ml-2 h-5 w-5"><path }
fill="none" )
d="M0 0h24v24H0z" /> .then((response) => {
<path if (response.status != '200') {
fill="currentColor" toast.hideToast();
d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z" /></svg> Toastify({
</button> text: $_('pdf-generation-failed'),
</div> duration: 3500,
{#if sponsoring_contracts_download_open} backgroundColor:
<div 'linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)',
class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5" }).showToast();
id="sponsoring:dropdown:menu"> } else {
<div return response.blob();
class="py-1" }
role="menu" })
aria-orientation="vertical" .then((blob) => {
aria-labelledby="options-menu"> const url = window.URL.createObjectURL(blob);
<span let a = document.createElement('a');
class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span> a.href = url;
<button a.download = 'Sponsoring.pdf';
on:click={() => { document.body.appendChild(a);
generateSponsoringContract('de'); a.click();
}} a.remove();
type="submit" toast.hideToast();
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" Toastify({
role="menuitem"> text: $_('pdf-successfully-generated'),
{$_('german')} duration: 3500,
</button> backgroundColor:
<button 'linear-gradient(to right, #00b09b, #96c93d)',
on:click={() => { }).showToast();
generateSponsoringContract('en'); })
}} .catch((err) => {
type="submit" console.error(err);
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" });
role="menuitem"> }}
{$_('english')} type="button"
</button> class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:w-auto sm:text-sm">
</div> {$_('generate-sponsoring-contracts')}
</div> </button>
{/if}
</div>
{/if} {/if}
</div> </div>
<div <div

View File

@ -24,7 +24,6 @@
$: save_enabled = !data_changed; $: save_enabled = !data_changed;
$: data_loaded = false; $: data_loaded = false;
$: data_changed = JSON.stringify(teamdata) === JSON.stringify(original); $: data_changed = JSON.stringify(teamdata) === JSON.stringify(original);
$: sponsoring_contracts_download_open = false;
// //
const promise = RunnerTeamService.runnerTeamControllerGetOne( const promise = RunnerTeamService.runnerTeamControllerGetOne(
params.teamid params.teamid
@ -44,14 +43,6 @@
GroupContactService.groupContactControllerGetAll().then((val) => { GroupContactService.groupContactControllerGetAll().then((val) => {
contacts = val; contacts = val;
}); });
document.addEventListener("click", function (e) {
if (
e.target.parentNode.parentNode.id != "sponsoring:dropdown" &&
e.target.parentNode.parentNode.id != "sponsoring:dropdown:menu"
) {
sponsoring_contracts_download_open = false;
}
});
function deleteTeam() { function deleteTeam() {
RunnerTeamService.runnerTeamControllerRemove(original.id, false) RunnerTeamService.runnerTeamControllerRemove(original.id, false)
.then((resp) => { .then((resp) => {
@ -91,55 +82,6 @@
.catch((err) => {}); .catch((err) => {});
} }
} }
async function generateSponsoringContract(locale) {
sponsoring_contracts_download_open = false;
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}`,
{
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_" + teamdata.name + ".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) => {});
}
</script> </script>
<ImportRunnerModal <ImportRunnerModal
@ -158,54 +100,57 @@
<div class="mb-8 text-3xl font-extrabold leading-tight"> <div class="mb-8 text-3xl font-extrabold leading-tight">
{original.name} {original.name}
<span data-id="org_actions_${teamdata.id}"> <span data-id="org_actions_${teamdata.id}">
<div id="sponsoring:dropdown" class="relative inline-block"> <button
<div> on:click={async () => {
<button const locale = getLocaleFromNavigator();
on:click={() => { const runners = await RunnerTeamService.runnerTeamControllerGetRunners(teamdata.id);
sponsoring_contracts_download_open = !sponsoring_contracts_download_open; const toast = Toastify({
}} text: $_('generating-pdf'),
type="button" duration: -1,
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex" }).showToast();
id="options-menu" fetch(
aria-haspopup="true" `https://dev.lauf-fuer-kaya.de/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
aria-expanded="true"> {
{$_('generate-sponsoring-contracts')} method: 'POST',
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="-mr-1 ml-2 h-5 w-5"><path fill="none" d="M0 0h24v24H0z"/><path fill="currentColor" d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z"/></svg> headers: {
</button> 'Content-Type': 'application/json',
</div> },
{#if sponsoring_contracts_download_open} body: JSON.stringify(runners),
<div }
class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5" )
id="sponsoring:dropdown:menu"> .then((response) => {
<div if (response.status != '200') {
class="py-1" toast.hideToast();
role="menu" Toastify({
aria-orientation="vertical" text: $_('pdf-generation-failed'),
aria-labelledby="options-menu"> duration: 3500,
<span backgroundColor:
class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span> 'linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)',
<button }).showToast();
on:click={() => { } else {
generateSponsoringContract('de'); return response.blob();
}} }
type="submit" })
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" .then((blob) => {
role="menuitem"> const url = window.URL.createObjectURL(blob);
{$_('german')} let a = document.createElement('a');
</button> a.href = url;
<button a.download = 'Sponsorings_' + teamdata.name + '.pdf';
on:click={() => { document.body.appendChild(a);
generateSponsoringContract('en'); a.click();
}} a.remove();
type="submit" toast.hideToast();
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" Toastify({
role="menuitem"> text: $_('pdf-successfully-generated'),
{$_('english')} duration: 3500,
</button> backgroundColor:
</div> 'linear-gradient(to right, #00b09b, #96c93d)',
</div> }).showToast();
{/if} })
</div> .catch((err) => {});
}}
type="button"
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('generate-sponsoring-contracts')}</button>
{#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:IMPORT')} {#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:IMPORT')}
<button <button
on:click={() => { on:click={() => {
@ -348,9 +293,7 @@
</select> </select>
</div> </div>
<div class="text-sm w-full"> <div class="text-sm w-full">
<label <label for="org" class="font-medium text-gray-700">{$_('organization')}</label>
for="org"
class="font-medium text-gray-700">{$_('organization')}</label>
<select <select
name="org" name="org"
bind:value={teamdata.parentGroup} bind:value={teamdata.parentGroup}

View File

@ -8,7 +8,6 @@
import ConfirmTeamDeletion from "./ConfirmTeamDeletion.svelte"; import ConfirmTeamDeletion from "./ConfirmTeamDeletion.svelte";
$: searchvalue = ""; $: searchvalue = "";
$: active_deletes = []; $: active_deletes = [];
$: sponsoring_contracts_download_open = false;
export let current_teams = []; export let current_teams = [];
let modal_open = false; let modal_open = false;
let delete_team = {}; let delete_team = {};
@ -18,70 +17,6 @@
teams_promise.then((data) => { teams_promise.then((data) => {
usersstore.set(data); usersstore.set(data);
}); });
document.addEventListener("click", function (e) {
if (
e.target.parentNode.parentNode.id != "sponsoring:dropdown" &&
e.target.parentNode.parentNode.id != "sponsoring:dropdown:menu"
) {
sponsoring_contracts_download_open = false;
}
});
async function generateSponsoringContract(locale) {
sponsoring_contracts_download_open = false;
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}`,
{
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_" + t.name + ".pdf";
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) => {});
}
}
</script> </script>
<ConfirmTeamDeletion <ConfirmTeamDeletion
@ -111,54 +46,66 @@
class="gridjs-input gridjs-search-input mb-4" /> class="gridjs-input gridjs-search-input mb-4" />
<div class="h-12"> <div class="h-12">
{#if current_teams.some((r) => r.is_selected === true)} {#if current_teams.some((r) => r.is_selected === true)}
<div id="sponsoring:dropdown" class="relative inline-block"> <button
<div> on:click={async () => {
<button const locale = getLocaleFromNavigator();
on:click={() => { const teams = current_teams.filter((r) => r.is_selected === true);
sponsoring_contracts_download_open = !sponsoring_contracts_download_open; const toast = Toastify({
}} text: $_('generating-pdfs'),
type="button" duration: -1,
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:ml-3 sm:w-auto sm:text-sm inline-flex" }).showToast();
id="options-menu" let count = 0;
aria-haspopup="true" for await (const t of teams) {
aria-expanded="true"> count++;
{$_('generate-sponsoring-contracts')} const runners = await RunnerTeamService.runnerTeamControllerGetRunners(t.id);
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="-mr-1 ml-2 h-5 w-5"><path fill="none" d="M0 0h24v24H0z"/><path fill="currentColor" d="M3 19h18v2H3v-2zm10-5.83l6.07-6.07 1.42 1.41L12 17 3.52 8.52l1.4-1.42L11 13.17V2h2v11.17z"/></svg> fetch(
</button> `https://dev.lauf-fuer-kaya.de/documents/contracts?locale=${locale}&download=true&key=${config.documentserver_key}`,
</div> {
{#if sponsoring_contracts_download_open} method: 'POST',
<div headers: {
class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5" 'Content-Type': 'application/json',
id="sponsoring:dropdown:menu"> },
<div body: JSON.stringify(runners),
class="py-1" }
role="menu" )
aria-orientation="vertical" .then((response) => {
aria-labelledby="options-menu"> if (response.status != '200') {
<span toast.hideToast();
class="block w-full text-left px-4 py-2 text-sm text-gray-700">{$_('select-language')}</span> Toastify({
<button text: $_('pdf-generation-failed'),
on:click={() => { duration: 3500,
generateSponsoringContract('de'); backgroundColor:
}} 'linear-gradient(90deg, hsla(281, 37%, 45%, 1) 0%, hsla(1, 62%, 48%, 1) 100%)',
type="submit" }).showToast();
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" } else {
role="menuitem"> return response.blob();
{$_('german')} }
</button> })
<button .then((blob) => {
on:click={() => { const url = window.URL.createObjectURL(blob);
generateSponsoringContract('en'); let a = document.createElement('a');
}} a.href = url;
type="submit" a.download = 'Sponsorings_' + t.name + '.pdf';
class="block w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900 inline-flex" document.body.appendChild(a);
role="menuitem"> a.click();
{$_('english')} a.remove();
</button> if (count === teams.length) {
</div> toast.hideToast();
</div> Toastify({
{/if} text: $_('pdfs-successfully-generated'),
</div> duration: 3500,
backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast();
}
})
.catch((err) => {});
}
}}
type="button"
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-600 text-base font-medium text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 sm:w-auto sm:text-sm">
{$_('generate-sponsoring-contracts')}
</button>
{/if} {/if}
</div> </div>
<div <div

View File

@ -128,7 +128,6 @@
"edit": "Bearbeiten", "edit": "Bearbeiten",
"edit-permissions": "Berechtigungen bearbeiten", "edit-permissions": "Berechtigungen bearbeiten",
"email_address_or_username": "E-Mail-Adresse/ Benutzername", "email_address_or_username": "E-Mail-Adresse/ Benutzername",
"english": "Englisch",
"error_on_login": "😢Fehler beim Login", "error_on_login": "😢Fehler beim Login",
"erteilte": "Direkt erteilte", "erteilte": "Direkt erteilte",
"everything-is-more-fun-together": "Im Team macht's mehr Spaß 🏃‍♂️🏃‍♀️🏃‍♂️", "everything-is-more-fun-together": "Im Team macht's mehr Spaß 🏃‍♂️🏃‍♀️🏃‍♂️",
@ -146,7 +145,6 @@
"generating-pdf": "Pdf wird generiert...", "generating-pdf": "Pdf wird generiert...",
"generating-pdfs": "PDFs werden generiert...", "generating-pdfs": "PDFs werden generiert...",
"generic-ui-logic-error": "Etwas ist in der Benutzeroberfläche schiefgelaufen.", "generic-ui-logic-error": "Etwas ist in der Benutzeroberfläche schiefgelaufen.",
"german": "Deutsch",
"go-to-login": "Zum Login", "go-to-login": "Zum Login",
"goback": "Zur Startseite", "goback": "Zur Startseite",
"granted": "Gewährt", "granted": "Gewährt",
@ -251,7 +249,6 @@
"save-changes": "Änderungen speichern", "save-changes": "Änderungen speichern",
"search-for-permission": "Berechtigungen durchsuchen", "search-for-permission": "Berechtigungen durchsuchen",
"select-all": "Alle auswählen", "select-all": "Alle auswählen",
"select-language": "Sprache auswählen",
"send-a-mail-to-lfk-odit-services": "Sende eine Mail an lfk@odit.services", "send-a-mail-to-lfk-odit-services": "Sende eine Mail an lfk@odit.services",
"set-the-user-active-inactive": "Den Benutzer auf (in)aktiv setzen", "set-the-user-active-inactive": "Den Benutzer auf (in)aktiv setzen",
"settings": "Einstellungen", "settings": "Einstellungen",

View File

@ -128,7 +128,6 @@
"edit": "Edit", "edit": "Edit",
"edit-permissions": "edit permissions", "edit-permissions": "edit permissions",
"email_address_or_username": "Email / username", "email_address_or_username": "Email / username",
"english": "English",
"error_on_login": "Error on login", "error_on_login": "Error on login",
"erteilte": "Directly granted", "erteilte": "Directly granted",
"everything-is-more-fun-together": "everything is more fun together 🏃‍♂️🏃‍♀️🏃‍♂️", "everything-is-more-fun-together": "everything is more fun together 🏃‍♂️🏃‍♀️🏃‍♂️",
@ -146,7 +145,6 @@
"generating-pdf": "generating PDF...", "generating-pdf": "generating PDF...",
"generating-pdfs": "generating PDFs...", "generating-pdfs": "generating PDFs...",
"generic-ui-logic-error": "Something went wrong in the UI logic", "generic-ui-logic-error": "Something went wrong in the UI logic",
"german": "German",
"go-to-login": "Go To Login", "go-to-login": "Go To Login",
"goback": "Go Home", "goback": "Go Home",
"granted": "granted", "granted": "granted",
@ -251,7 +249,6 @@
"save-changes": "Save Changes", "save-changes": "Save Changes",
"search-for-permission": "Search for permission", "search-for-permission": "Search for permission",
"select-all": "select all", "select-all": "select all",
"select-language": "Select language",
"send-a-mail-to-lfk-odit-services": "send a mail to lfk@odit.services", "send-a-mail-to-lfk-odit-services": "send a mail to lfk@odit.services",
"set-the-user-active-inactive": "set the user active/ inactive", "set-the-user-active-inactive": "set the user active/ inactive",
"settings": "Settings", "settings": "Settings",