Merge pull request 'feature/62-contract-generation' (#76) from feature/62-contract-generation into dev
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #76 close #62
This commit is contained in:
commit
dee0e37a85
@ -1,5 +1,6 @@
|
||||
const config = {
|
||||
baseurl: 'https://dev.lauf-fuer-kaya.de',
|
||||
documentserver_key: 'NqZSYTy5AFQ7MppbLW5moqpTk7u7YrNUHKYhKYuThnnya2WpCOIU694hIZT1FzYe',
|
||||
fallback_username: 'admin',
|
||||
fallback_password: '72fpTzsev4xUu78QPs2FCbwZ3',
|
||||
prefersHashRouting: true
|
||||
|
@ -1,5 +1,6 @@
|
||||
const config = {
|
||||
baseurl: 'http://localhost:4010',
|
||||
documentserver_key: 'NqZSYTy5AFQ7MppbLW5moqpTk7u7YrNUHKYhKYuThnnya2WpCOIU694hIZT1FzYe'
|
||||
// optional
|
||||
prefersHashRouting: true
|
||||
};
|
||||
|
@ -148,7 +148,7 @@
|
||||
class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<a
|
||||
href="./{t.id}"
|
||||
class="text-indigo-600 hover:text-indigo-900">{$_('edit')}</a>
|
||||
class="text-indigo-600 hover:text-indigo-900">{$_('details')}</a>
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes('TEAM:DELETE')}
|
||||
<button
|
||||
on:click={() => {
|
||||
|
@ -3,7 +3,7 @@
|
||||
GroupContactService,
|
||||
RunnerOrganizationService,
|
||||
} from "@odit/lfk-client-js";
|
||||
import { _ } from "svelte-i18n";
|
||||
import { getLocaleFromNavigator, _ } from "svelte-i18n";
|
||||
import Toastify from "toastify-js";
|
||||
import store from "../../store";
|
||||
import ConfirmOrgDeletion from "./ConfirmOrgDeletion.svelte";
|
||||
@ -35,14 +35,14 @@
|
||||
}
|
||||
}
|
||||
value.address_checked = value.address.address1 !== null;
|
||||
if(value.address_checked===false){
|
||||
if (value.address_checked === false) {
|
||||
value.address = {
|
||||
address1: "",
|
||||
address2: "",
|
||||
city: "",
|
||||
postalcode: "",
|
||||
country: ""
|
||||
}
|
||||
country: "",
|
||||
};
|
||||
}
|
||||
editable = Object.assign(editable, value);
|
||||
editable = editable;
|
||||
@ -82,7 +82,6 @@
|
||||
if (postdata.address_checked === false) {
|
||||
postdata.address = null;
|
||||
}
|
||||
console.log(postdata)
|
||||
postdata.contact = postdata.contact === "null" ? null : postdata.contact;
|
||||
RunnerOrganizationService.runnerOrganizationControllerPut(
|
||||
original_object.id,
|
||||
@ -119,6 +118,57 @@
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
{original_object.name}
|
||||
<span data-id="org_actions_${editable.id}">
|
||||
<button
|
||||
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}`,
|
||||
{
|
||||
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) => {});
|
||||
}}
|
||||
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')}
|
||||
<button
|
||||
on:click={() => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { _ } from "svelte-i18n";
|
||||
import { getLocaleFromNavigator, _ } from "svelte-i18n";
|
||||
let modal_open = false;
|
||||
let delete_org = {};
|
||||
import { RunnerOrganizationService } from "@odit/lfk-client-js";
|
||||
@ -43,11 +43,91 @@
|
||||
placeholder={$_('datatable.search')}
|
||||
aria-label={$_('datatable.search')}
|
||||
class="gridjs-input gridjs-search-input mb-4" />
|
||||
<div class="h-12">
|
||||
{#if current_organizations.some((r) => r.is_selected === true)}
|
||||
<button
|
||||
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(
|
||||
`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) => {});
|
||||
}
|
||||
}}
|
||||
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}
|
||||
</div>
|
||||
<div
|
||||
class="shadow border-b border-gray-200 sm:rounded-lg overflow-x-scroll">
|
||||
<table class="divide-y divide-gray-200 w-full">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
<span
|
||||
on:click={() => {
|
||||
const newstate = !current_organizations.some((r) => r.is_selected === true);
|
||||
current_organizations = current_organizations.map((r) => {
|
||||
r.is_selected = newstate;
|
||||
return r;
|
||||
});
|
||||
}}
|
||||
class="underline cursor-pointer select-none">{#if current_organizations.some((r) => r.is_selected === true)}
|
||||
{$_('deselect-all')}
|
||||
{:else}{$_('select-all')}{/if}
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
@ -75,6 +155,12 @@
|
||||
.toLowerCase()
|
||||
.includes(searchvalue)}
|
||||
<tr data-rowid="org_{o.id}">
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<input
|
||||
bind:checked={o.is_selected}
|
||||
type="checkbox"
|
||||
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded" />
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-4">
|
||||
@ -148,7 +234,7 @@
|
||||
class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<a
|
||||
href="./{o.id}"
|
||||
class="text-indigo-600 hover:text-indigo-900">{$_('edit')}</a>
|
||||
class="text-indigo-600 hover:text-indigo-900">{$_('details')}</a>
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes('ORGANIZATION:DELETE')}
|
||||
<button
|
||||
on:click={() => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { _ } from "svelte-i18n";
|
||||
import { getLocaleFromNavigator, _ } from "svelte-i18n";
|
||||
import lodashIsEqual from "lodash.isequal";
|
||||
import store from "../../store";
|
||||
import {
|
||||
@ -14,6 +14,7 @@
|
||||
export let params;
|
||||
const runner_promise = RunnerService.runnerControllerGetOne(params.runnerid);
|
||||
$: delete_triggered = false;
|
||||
$: original_data_pdf = {};
|
||||
$: original_data = {};
|
||||
$: editable = {};
|
||||
$: changes_performed = !lodashIsEqual(original_data, editable);
|
||||
@ -26,6 +27,7 @@
|
||||
changes_performed && isFirstnameValid && isLastnameValid && isEmailValid;
|
||||
runner_promise.then((data) => {
|
||||
data_loaded = true;
|
||||
original_data_pdf = Object.assign(original_data_pdf, data);
|
||||
original_data = Object.assign(original_data, data);
|
||||
original_data.group = original_data.group.id;
|
||||
editable = Object.assign(editable, original_data);
|
||||
@ -130,6 +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>
|
||||
{/if}
|
||||
<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}`,
|
||||
{
|
||||
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);
|
||||
});
|
||||
}}
|
||||
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}
|
||||
<button
|
||||
on:click={() => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { _ } from "svelte-i18n";
|
||||
import { getLocaleFromNavigator, _ } from "svelte-i18n";
|
||||
import {
|
||||
RunnerService,
|
||||
RunnerTeamService,
|
||||
@ -8,6 +8,7 @@
|
||||
import store from "../../store";
|
||||
import RunnersEmptyState from "./RunnersEmptyState.svelte";
|
||||
import Select from "svelte-select";
|
||||
import Toastify from "toastify-js";
|
||||
$: searchvalue = "";
|
||||
$: active_deletes = [];
|
||||
export let current_runners = [];
|
||||
@ -61,7 +62,7 @@
|
||||
placeholder={$_('datatable.search')}
|
||||
aria-label={$_('datatable.search')}
|
||||
class="gridjs-input gridjs-search-input mb-4" />
|
||||
<div class="block mb-1">
|
||||
<div class="block mb-6">
|
||||
<label
|
||||
for="country"
|
||||
class="text-sm font-medium text-gray-700">{$_('filter-by-organization-team')}</label>
|
||||
@ -75,11 +76,87 @@
|
||||
items={selectgroups}
|
||||
isMulti={true} />
|
||||
</div>
|
||||
<div class="h-12">
|
||||
{#if current_runners.some((r) => r.is_selected === true)}
|
||||
<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}`,
|
||||
{
|
||||
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);
|
||||
});
|
||||
}}
|
||||
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}
|
||||
</div>
|
||||
<div
|
||||
class="shadow border-b border-gray-200 sm:rounded-lg overflow-x-scroll">
|
||||
<table class="divide-y divide-gray-200 w-full">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
<span
|
||||
on:click={() => {
|
||||
const newstate = !current_runners.some((r) => r.is_selected === true);
|
||||
current_runners = current_runners.map((r) => {
|
||||
r.is_selected = newstate;
|
||||
return r;
|
||||
});
|
||||
}}
|
||||
class="underline cursor-pointer select-none">{#if current_runners.some((r) => r.is_selected === true)}
|
||||
{$_('deselect-all')}
|
||||
{:else}{$_('select-all')}{/if}
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
@ -124,6 +201,12 @@
|
||||
<tr
|
||||
data-rowid="user_{runner.id}"
|
||||
data-groupid={runner.group.id}>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<input
|
||||
bind:checked={runner.is_selected}
|
||||
type="checkbox"
|
||||
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded" />
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-4">
|
||||
@ -135,63 +218,62 @@
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{#if runner.email}
|
||||
<div class="text-sm text-gray-500">{runner.email}</div>
|
||||
{/if}
|
||||
{#if runner.phone}
|
||||
<div class="text-sm text-gray-500">{runner.phone}</div>
|
||||
{/if}
|
||||
{#if runner.address.address1 !== null}
|
||||
{runner.address.address1}<br />
|
||||
{runner.address.address2 || ''}<br />
|
||||
{runner.address.postalcode}
|
||||
{runner.address.city}
|
||||
{runner.address.country}
|
||||
{/if}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{#if runner.group.responseType === 'RUNNERTEAM'}
|
||||
<a
|
||||
href="../teams/{runner.group.id}"
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{runner.group.name}</a>
|
||||
{/if}
|
||||
{#if runner.group.responseType === 'RUNNERORGANIZATION'}
|
||||
<a
|
||||
href="../orgs/{runner.group.id}"
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{runner.group.name}</a>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">{runner.distance}</td>
|
||||
{#if active_deletes[runner.id] === true}
|
||||
<td
|
||||
class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<button
|
||||
on:click={() => {
|
||||
active_deletes[runner.id] = false;
|
||||
}}
|
||||
tabindex="0"
|
||||
class="ml-4 text-indigo-600 hover:text-indigo-900 cursor-pointer">Cancel
|
||||
Delete</button>
|
||||
<button
|
||||
on:click={() => {
|
||||
RunnerService.runnerControllerRemove(runner.id, true)
|
||||
.then((resp) => {
|
||||
current_runners = current_runners.filter((obj) => obj.id !== runner.id);
|
||||
})
|
||||
.catch((err) => {
|
||||
// error deleting user
|
||||
});
|
||||
}}
|
||||
tabindex="0"
|
||||
class="ml-4 text-red-600 hover:text-red-900 cursor-pointer">{$_('confirm-delete')}</button>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{#if runner.email}
|
||||
<div class="text-sm text-gray-500">{runner.email}</div>
|
||||
{/if}
|
||||
{#if runner.phone}
|
||||
<div class="text-sm text-gray-500">{runner.phone}</div>
|
||||
{/if}
|
||||
{#if runner.address.address1 !== null}
|
||||
{runner.address.address1}<br />
|
||||
{runner.address.address2 || ''}<br />
|
||||
{runner.address.postalcode}
|
||||
{runner.address.city}
|
||||
{runner.address.country}
|
||||
{/if}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{#if runner.group.responseType === 'RUNNERTEAM'}
|
||||
<a
|
||||
href="../teams/{runner.group.id}"
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{runner.group.name}</a>
|
||||
{/if}
|
||||
{#if runner.group.responseType === 'RUNNERORGANIZATION'}
|
||||
<a
|
||||
href="../orgs/{runner.group.id}"
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">{runner.group.name}</a>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
{runner.distance}
|
||||
</td>
|
||||
{#if active_deletes[runner.id] === true}
|
||||
<td
|
||||
class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<button
|
||||
on:click={() => {
|
||||
active_deletes[runner.id] = false;
|
||||
}}
|
||||
tabindex="0"
|
||||
class="ml-4 text-indigo-600 hover:text-indigo-900 cursor-pointer">{$_('cancel-delete')}</button>
|
||||
<button
|
||||
on:click={() => {
|
||||
RunnerService.runnerControllerRemove(runner.id, true)
|
||||
.then((resp) => {
|
||||
current_runners = current_runners.filter((obj) => obj.id !== runner.id);
|
||||
})
|
||||
.catch((err) => {});
|
||||
}}
|
||||
tabindex="0"
|
||||
class="ml-4 text-red-600 hover:text-red-900 cursor-pointer">{$_('confirm-delete')}</button>
|
||||
</td>
|
||||
{:else}
|
||||
<td
|
||||
class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<a
|
||||
href="./{runner.id}"
|
||||
class="text-indigo-600 hover:text-indigo-900">{$_('edit')}</a>
|
||||
class="text-indigo-600 hover:text-indigo-900">{$_('details')}</a>
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:DELETE')}
|
||||
<button
|
||||
on:click={() => {
|
||||
|
@ -4,7 +4,7 @@
|
||||
RunnerOrganizationService,
|
||||
RunnerTeamService,
|
||||
} from "@odit/lfk-client-js";
|
||||
import { _ } from "svelte-i18n";
|
||||
import { getLocaleFromNavigator, _ } from "svelte-i18n";
|
||||
import Toastify from "toastify-js";
|
||||
import store from "../../store";
|
||||
import ImportRunnerModal from "../runners/ImportRunnerModal.svelte";
|
||||
@ -100,6 +100,57 @@
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
{original.name}
|
||||
<span data-id="org_actions_${teamdata.id}">
|
||||
<button
|
||||
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}`,
|
||||
{
|
||||
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) => {});
|
||||
}}
|
||||
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')}
|
||||
<button
|
||||
on:click={() => {
|
||||
@ -255,7 +306,7 @@
|
||||
</section>
|
||||
{:else}
|
||||
{#await promise}
|
||||
team detail is being loaded...
|
||||
{$_('team-detail-is-being-loaded')}
|
||||
{:catch error}
|
||||
<PromiseError />
|
||||
{/await}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { t, _ } from "svelte-i18n";
|
||||
import { getLocaleFromNavigator, t, _ } from "svelte-i18n";
|
||||
import Toastify from "toastify-js";
|
||||
import { RunnerTeamService } from "@odit/lfk-client-js";
|
||||
const teams_promise = RunnerTeamService.runnerTeamControllerGetAll();
|
||||
@ -44,11 +44,91 @@
|
||||
placeholder={$_('datatable.search')}
|
||||
aria-label={$_('datatable.search')}
|
||||
class="gridjs-input gridjs-search-input mb-4" />
|
||||
<div class="h-12">
|
||||
{#if current_teams.some((r) => r.is_selected === true)}
|
||||
<button
|
||||
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}`,
|
||||
{
|
||||
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) => {});
|
||||
}
|
||||
}}
|
||||
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}
|
||||
</div>
|
||||
<div
|
||||
class="shadow border-b border-gray-200 sm:rounded-lg overflow-x-scroll">
|
||||
<table class="divide-y divide-gray-200 w-full">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
<span
|
||||
on:click={() => {
|
||||
const newstate = !current_teams.some((r) => r.is_selected === true);
|
||||
current_teams = current_teams.map((r) => {
|
||||
r.is_selected = newstate;
|
||||
return r;
|
||||
});
|
||||
}}
|
||||
class="underline cursor-pointer select-none">{#if current_teams.some((r) => r.is_selected === true)}
|
||||
{$_('deselect-all')}
|
||||
{:else}{$_('select-all')}{/if}
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
@ -76,6 +156,12 @@
|
||||
.toLowerCase()
|
||||
.includes(searchvalue)}
|
||||
<tr data-rowid="team_{t.id}">
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<input
|
||||
bind:checked={t.is_selected}
|
||||
type="checkbox"
|
||||
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded" />
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex items-center">
|
||||
<div class="ml-4">
|
||||
@ -148,7 +234,7 @@
|
||||
class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<a
|
||||
href="./{t.id}"
|
||||
class="text-indigo-600 hover:text-indigo-900">{$_('edit')}</a>
|
||||
class="text-indigo-600 hover:text-indigo-900">{$_('details')}</a>
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes('TEAM:DELETE')}
|
||||
<button
|
||||
on:click={() => {
|
||||
|
@ -143,7 +143,7 @@
|
||||
class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<a
|
||||
href="./{u.id}"
|
||||
class="text-indigo-600 hover:text-indigo-900">{$_('edit')}</a>
|
||||
class="text-indigo-600 hover:text-indigo-900">{$_('details')}</a>
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes('USER:DELETE')}
|
||||
<button
|
||||
on:click={() => {
|
||||
|
@ -84,6 +84,8 @@
|
||||
"delete-team": "Team Löschen",
|
||||
"delete-user": "Benutzer:in löschen",
|
||||
"dependency_name": "Name",
|
||||
"deselect-all": "Alle abwählen",
|
||||
"details": "Details",
|
||||
"distance": "Distanz",
|
||||
"distance-in-km": "Distanz (in KM)",
|
||||
"do-you-want-to-delete-the-organization-delete_org-name": "Möchtest du die Organisation {orgname} löschen?",
|
||||
@ -105,6 +107,10 @@
|
||||
"geerbte": "geerbte",
|
||||
"general-stats": "Allgemeine Statistiken",
|
||||
"general_promise_error": "😢 Ein unbekannter Fehler ist aufgetreten",
|
||||
"generate-sponsoring-contract": "Sponsoringvertrag generieren",
|
||||
"generate-sponsoring-contracts": "Sponsoringverträge generieren",
|
||||
"generating-pdf": "Pdf wird generiert...",
|
||||
"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 +167,9 @@
|
||||
"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!",
|
||||
"pdf-generation-failed": "PDF Generierung fehlgeschlagen!",
|
||||
"pdf-successfully-generated": "PDF wurde erfolgreich generiert!",
|
||||
"pdfs-successfully-generated": "Alle PDFs wurden generiert!",
|
||||
"permissions": "Berechtigungen",
|
||||
"permissions-updated": "Berechtigungen aktualisiert!",
|
||||
"phone": "Telefon",
|
||||
@ -191,12 +200,14 @@
|
||||
"runners-are-being-loaded": "Läufer:innen werden geladen ...",
|
||||
"save": "Speichern",
|
||||
"save-changes": "Änderungen speichern",
|
||||
"select-all": "Alle auswählen",
|
||||
"send-a-mail-to-lfk-odit-services": "Sende eine Mail an lfk@odit.services",
|
||||
"settings": "Einstellungen",
|
||||
"stats-are-being-loaded": "Die Statistiken werden geladen...",
|
||||
"status": "Status",
|
||||
"successful-password-reset": "Passwort erfolgreich zurückgesetzt!",
|
||||
"team": "Team",
|
||||
"team-detail-is-being-loaded": "Team wird geladen...",
|
||||
"team-name": "Teamname",
|
||||
"team-name-is-required": "Teamname ist erforderlich",
|
||||
"teams": "Teams",
|
||||
|
@ -84,6 +84,8 @@
|
||||
"delete-team": "Delete Team",
|
||||
"delete-user": "Delete User",
|
||||
"dependency_name": "Name",
|
||||
"deselect-all": "deselect all",
|
||||
"details": "Details",
|
||||
"distance": "Distance",
|
||||
"distance-in-km": "Distance in km",
|
||||
"do-you-want-to-delete-the-organization-delete_org-name": "Do you want to delete the organization {orgname}?",
|
||||
@ -105,6 +107,10 @@
|
||||
"geerbte": "inherited",
|
||||
"general-stats": "General Stats",
|
||||
"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",
|
||||
@ -161,6 +167,9 @@
|
||||
"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-generation-failed": "PDF generation failed!",
|
||||
"pdf-successfully-generated": "PDF successfully generated!",
|
||||
"pdfs-successfully-generated": "PDFs successfully generated!",
|
||||
"permissions": "Permissions",
|
||||
"permissions-updated": "Permissions updated!",
|
||||
"phone": "Phone",
|
||||
@ -191,12 +200,14 @@
|
||||
"runners-are-being-loaded": "runners are being loaded...",
|
||||
"save": "Save",
|
||||
"save-changes": "Save Changes",
|
||||
"select-all": "select all",
|
||||
"send-a-mail-to-lfk-odit-services": "send a mail to lfk@odit.services",
|
||||
"settings": "Settings",
|
||||
"stats-are-being-loaded": "stats are being loaded...",
|
||||
"status": "Status",
|
||||
"successful-password-reset": "Successful password reset!",
|
||||
"team": "Team",
|
||||
"team-detail-is-being-loaded": "team detail is being loaded...",
|
||||
"team-name": "Team name",
|
||||
"team-name-is-required": "team name is required",
|
||||
"teams": "Teams",
|
||||
|
Loading…
x
Reference in New Issue
Block a user