parent
0361f8ad69
commit
eddfeb10a5
@ -3,54 +3,39 @@
|
|||||||
import lodashIsEqual from "lodash.isequal";
|
import lodashIsEqual from "lodash.isequal";
|
||||||
import store from "../store";
|
import store from "../store";
|
||||||
import {
|
import {
|
||||||
RunnerService,
|
UserGroupService
|
||||||
RunnerTeamService,
|
|
||||||
RunnerOrganizationService,
|
|
||||||
} from "@odit/lfk-client-js";
|
} from "@odit/lfk-client-js";
|
||||||
import Toastify from "toastify-js";
|
import Toastify from "toastify-js";
|
||||||
import PromiseError from "./PromiseError.svelte";
|
import PromiseError from "./PromiseError.svelte";
|
||||||
import isEmail from "validator/es/lib/isEmail";
|
|
||||||
let data_loaded = false;
|
let data_loaded = false;
|
||||||
export let params;
|
export let params;
|
||||||
const runner_promise = RunnerService.runnerControllerGetOne(params.groupid);
|
const promise = UserGroupService.userGroupControllerGetOne(params.groupid);
|
||||||
$: delete_triggered = false;
|
$: delete_triggered = false;
|
||||||
$: original_data = {};
|
$: original_data = {};
|
||||||
$: editable = {};
|
$: editable = {};
|
||||||
$: changes_performed = !lodashIsEqual(original_data, editable);
|
$: changes_performed = !lodashIsEqual(original_data, editable);
|
||||||
$: isEmailValid =
|
$: isGroupnameValid = editable.name !== "";
|
||||||
(editable.email || "") === "" ||
|
|
||||||
(editable.email && isEmail(editable.email || ""));
|
|
||||||
$: isFirstnameValid = editable.firstname !== "";
|
|
||||||
$: isLastnameValid = editable.lastname !== "";
|
|
||||||
$: save_enabled =
|
$: save_enabled =
|
||||||
changes_performed && isFirstnameValid && isLastnameValid && isEmailValid;
|
changes_performed && isGroupnameValid
|
||||||
runner_promise.then((data) => {
|
promise.then((data) => {
|
||||||
|
console.log(data);
|
||||||
data_loaded = true;
|
data_loaded = true;
|
||||||
original_data = Object.assign(original_data, data);
|
original_data = Object.assign(original_data, data);
|
||||||
original_data.group = original_data.group.id;
|
|
||||||
editable = Object.assign(editable, original_data);
|
editable = Object.assign(editable, original_data);
|
||||||
});
|
});
|
||||||
let orgs = [];
|
|
||||||
RunnerOrganizationService.runnerOrganizationControllerGetAll().then((val) => {
|
|
||||||
orgs = val;
|
|
||||||
});
|
|
||||||
let teams = [];
|
|
||||||
RunnerTeamService.runnerTeamControllerGetAll().then((val) => {
|
|
||||||
teams = val;
|
|
||||||
});
|
|
||||||
function submit() {
|
function submit() {
|
||||||
if (data_loaded === true && save_enabled) {
|
if (data_loaded === true && save_enabled) {
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_("updating-runner"),
|
text: $_('updating-group'),
|
||||||
duration: 2500,
|
duration: 2500,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
RunnerService.runnerControllerPut(original_data.id, editable)
|
UserGroupService.userGroupControllerPut(original_data.id, editable)
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
Object.assign(original_data, editable);
|
Object.assign(original_data, editable);
|
||||||
original_data = editable;
|
original_data = editable;
|
||||||
Object.assign(original_data, editable);
|
Object.assign(original_data, editable);
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_("runner-updated"),
|
text: $_('group-updated'),
|
||||||
duration: 2500,
|
duration: 2500,
|
||||||
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
}).showToast();
|
}).showToast();
|
||||||
@ -59,8 +44,8 @@
|
|||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function deleteRunner() {
|
function deleteGroup() {
|
||||||
RunnerService.runnerControllerRemove(original_data.id, true)
|
UserGroupService.userGroupControllerRemove(original_data.id, true)
|
||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
location.replace("./");
|
location.replace("./");
|
||||||
})
|
})
|
||||||
@ -68,8 +53,8 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#await runner_promise}
|
{#await promise}
|
||||||
{$_('loading-runners')}
|
{$_('loading-group-detail')}
|
||||||
{:then}
|
{:then}
|
||||||
<section class="container p-5 select-none">
|
<section class="container p-5 select-none">
|
||||||
<div class="flex flex-row mb-4">
|
<div class="flex flex-row mb-4">
|
||||||
@ -77,18 +62,10 @@
|
|||||||
<nav class="w-full flex">
|
<nav class="w-full flex">
|
||||||
<ol class="list-none flex flex-row items-center justify-start">
|
<ol class="list-none flex flex-row items-center justify-start">
|
||||||
<li class="flex items-center">
|
<li class="flex items-center">
|
||||||
<svg
|
<svg class="flex-shrink-0 w-5 h-5 mr-2" fill="currentColor" width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M610.5 341.3c2.6-14.1 2.6-28.5 0-42.6l25.8-14.9c3-1.7 4.3-5.2 3.3-8.5-6.7-21.6-18.2-41.2-33.2-57.4-2.3-2.5-6-3.1-9-1.4l-25.8 14.9c-10.9-9.3-23.4-16.5-36.9-21.3v-29.8c0-3.4-2.4-6.4-5.7-7.1-22.3-5-45-4.8-66.2 0-3.3.7-5.7 3.7-5.7 7.1v29.8c-13.5 4.8-26 12-36.9 21.3l-25.8-14.9c-2.9-1.7-6.7-1.1-9 1.4-15 16.2-26.5 35.8-33.2 57.4-1 3.3.4 6.8 3.3 8.5l25.8 14.9c-2.6 14.1-2.6 28.5 0 42.6l-25.8 14.9c-3 1.7-4.3 5.2-3.3 8.5 6.7 21.6 18.2 41.1 33.2 57.4 2.3 2.5 6 3.1 9 1.4l25.8-14.9c10.9 9.3 23.4 16.5 36.9 21.3v29.8c0 3.4 2.4 6.4 5.7 7.1 22.3 5 45 4.8 66.2 0 3.3-.7 5.7-3.7 5.7-7.1v-29.8c13.5-4.8 26-12 36.9-21.3l25.8 14.9c2.9 1.7 6.7 1.1 9-1.4 15-16.2 26.5-35.8 33.2-57.4 1-3.3-.4-6.8-3.3-8.5l-25.8-14.9zM496 368.5c-26.8 0-48.5-21.8-48.5-48.5s21.8-48.5 48.5-48.5 48.5 21.8 48.5 48.5-21.7 48.5-48.5 48.5zM96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64-64 28.7-64 64 28.7 64 64 64zm224 32c1.9 0 3.7-.5 5.6-.6 8.3-21.7 20.5-42.1 36.3-59.2 7.4-8 17.9-12.6 28.9-12.6 6.9 0 13.7 1.8 19.6 5.3l7.9 4.6c.8-.5 1.6-.9 2.4-1.4 7-14.6 11.2-30.8 11.2-48 0-61.9-50.1-112-112-112S208 82.1 208 144c0 61.9 50.1 112 112 112zm105.2 194.5c-2.3-1.2-4.6-2.6-6.8-3.9-8.2 4.8-15.3 9.8-27.5 9.8-10.9 0-21.4-4.6-28.9-12.6-18.3-19.8-32.3-43.9-40.2-69.6-10.7-34.5 24.9-49.7 25.8-50.3-.1-2.6-.1-5.2 0-7.8l-7.9-4.6c-3.8-2.2-7-5-9.8-8.1-3.3.2-6.5.6-9.8.6-24.6 0-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h255.4c-3.7-6-6.2-12.8-6.2-20.3v-9.2zM173.1 274.6C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4z"></path></svg>
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
class="flex-shrink-0 w-5 h-5 mr-2"
|
|
||||||
fill="currentColor"
|
|
||||||
width="24"
|
|
||||||
height="24"><path fill="none" d="M0 0h24v24H0z" />
|
|
||||||
<path
|
|
||||||
d="M9.83 8.79L8 9.456V13H6V8.05h.015l5.268-1.918c.244-.093.51-.14.782-.131a2.616 2.616 0 0 1 2.427 1.82c.186.583.356.977.51 1.182A4.992 4.992 0 0 0 19 11v2a6.986 6.986 0 0 1-5.402-2.547l-.581 3.297L15 15.67V23h-2v-5.986l-2.05-1.987-.947 4.298-6.894-1.215.348-1.97 4.924.868L9.83 8.79zM13.5 5.5a2 2 0 1 1 0-4 2 2 0 0 1 0 4z" /></svg>
|
|
||||||
</li>
|
</li>
|
||||||
<li class="flex items-center">
|
<li class="flex items-center">
|
||||||
<a class="mr-2" href="./">{$_('runners')}</a><svg
|
<a class="mr-2" href="./">{$_('groups')}</a><svg
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke-width="2"
|
stroke-width="2"
|
||||||
@ -106,23 +83,19 @@
|
|||||||
<polyline points="12 5 19 12 12 19" /></svg>
|
<polyline points="12 5 19 12 12 19" /></svg>
|
||||||
</li>
|
</li>
|
||||||
<li class="flex items-center">
|
<li class="flex items-center">
|
||||||
<span class="mr-2">{original_data.firstname}
|
<span class="mr-2">{original_data.name}</span>
|
||||||
{original_data.middlename || ''}
|
|
||||||
{original_data.lastname}</span>
|
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||||
{original_data.firstname}
|
{original_data.name}
|
||||||
{original_data.middlename || ''}
|
<span data-id="group_actions_${editable.id}">
|
||||||
{original_data.lastname}
|
{#if store.state.jwtinfo.userdetails.permissions.includes('USERGROUP:DELETE')}
|
||||||
<span data-id="runner_actions_${editable.id}">
|
|
||||||
{#if store.state.jwtinfo.userdetails.permissions.includes('RUNNER:DELETE')}
|
|
||||||
{#if delete_triggered}
|
{#if delete_triggered}
|
||||||
<button
|
<button
|
||||||
on:click={deleteRunner}
|
on:click={deleteGroup}
|
||||||
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('confirm-deletion')}</button>
|
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('confirm-deletion')}</button>
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
@ -136,7 +109,7 @@
|
|||||||
delete_triggered = true;
|
delete_triggered = true;
|
||||||
}}
|
}}
|
||||||
type="button"
|
type="button"
|
||||||
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('delete-runner')}</button>
|
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">{$_('delete-group')}</button>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{#if !delete_triggered}
|
{#if !delete_triggered}
|
||||||
@ -152,111 +125,40 @@
|
|||||||
<!-- -->
|
<!-- -->
|
||||||
<div class="text-sm w-full">
|
<div class="text-sm w-full">
|
||||||
<label
|
<label
|
||||||
for="firstname"
|
for="title"
|
||||||
class="font-medium text-gray-700">{$_('first-name')}</label>
|
class="font-medium text-gray-700">{$_('name')}</label>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
placeholder={$_('first-name')}
|
placeholder={$_('name')}
|
||||||
type="text"
|
type="text"
|
||||||
class:border-red-500={!isFirstnameValid}
|
bind:value={editable.name}
|
||||||
class:focus:border-red-500={!isFirstnameValid}
|
class:border-red-500={!isGroupnameValid}
|
||||||
class:focus:ring-red-500={!isFirstnameValid}
|
class:focus:border-red-500={!isGroupnameValid}
|
||||||
bind:value={editable.firstname}
|
class:focus:ring-red-500={!isGroupnameValid}
|
||||||
|
name="title"
|
||||||
|
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
|
||||||
|
{#if !isGroupnameValid}
|
||||||
|
<span
|
||||||
|
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
|
||||||
|
Group name is required
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<div class="text-sm w-full">
|
||||||
|
<label
|
||||||
|
for="firstname"
|
||||||
|
class="font-medium text-gray-700">{$_('description')}</label>
|
||||||
|
<input
|
||||||
|
autocomplete="off"
|
||||||
|
placeholder={$_('description')}
|
||||||
|
type="text"
|
||||||
|
bind:value={editable.description}
|
||||||
name="firstname"
|
name="firstname"
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
|
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
|
||||||
{#if !isFirstnameValid}
|
|
||||||
<span
|
|
||||||
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
|
|
||||||
{$_('first-name-is-required')}
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-sm w-full">
|
<div class="text-sm w-full">
|
||||||
<label
|
<span
|
||||||
for="middlename"
|
class="font-medium text-gray-700">{$_('permissions')}</span>
|
||||||
class="font-medium text-gray-700">{$_('middle-name')}</label>
|
|
||||||
<input
|
|
||||||
autocomplete="off"
|
|
||||||
placeholder={$_('middle-name')}
|
|
||||||
type="text"
|
|
||||||
bind:value={editable.middlename}
|
|
||||||
name="middlename"
|
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
|
|
||||||
</div>
|
|
||||||
<div class="text-sm w-full">
|
|
||||||
<label
|
|
||||||
for="lastname"
|
|
||||||
class="font-medium text-gray-700">{$_('last-name')}</label>
|
|
||||||
<input
|
|
||||||
autocomplete="off"
|
|
||||||
placeholder={$_('last-name')}
|
|
||||||
type="text"
|
|
||||||
bind:value={editable.lastname}
|
|
||||||
class:border-red-500={!isLastnameValid}
|
|
||||||
class:focus:border-red-500={!isLastnameValid}
|
|
||||||
class:focus:ring-red-500={!isLastnameValid}
|
|
||||||
name="lastname"
|
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
|
|
||||||
{#if !isLastnameValid}
|
|
||||||
<span
|
|
||||||
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
|
|
||||||
{$_('last-name-is-required')}
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<div class="text-sm w-full">
|
|
||||||
<label
|
|
||||||
for="email"
|
|
||||||
class="font-medium text-gray-700">{$_('e-mail-adress')}</label>
|
|
||||||
<input
|
|
||||||
autocomplete="off"
|
|
||||||
placeholder={$_('e-mail-adress')}
|
|
||||||
type="email"
|
|
||||||
bind:value={editable.email}
|
|
||||||
class:border-red-500={!isEmailValid}
|
|
||||||
class:focus:border-red-500={!isEmailValid}
|
|
||||||
class:focus:ring-red-500={!isEmailValid}
|
|
||||||
name="email"
|
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
|
|
||||||
{#if !isEmailValid}
|
|
||||||
<span
|
|
||||||
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
|
|
||||||
{$_('valid-email-is-required')}
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<div class="text-sm w-full">
|
|
||||||
<label for="phone" class="font-medium text-gray-700">{$_('phone')}</label>
|
|
||||||
<input
|
|
||||||
autocomplete="off"
|
|
||||||
placeholder={$_('phone')}
|
|
||||||
type="tel"
|
|
||||||
bind:value={editable.phone}
|
|
||||||
name="phone"
|
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
|
|
||||||
</div>
|
|
||||||
<div class="text-sm w-full">
|
|
||||||
<span class="font-medium text-gray-700">{$_('group')}</span>
|
|
||||||
<select
|
|
||||||
bind:value={editable.group}
|
|
||||||
name="team"
|
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2">
|
|
||||||
{#each teams as team}
|
|
||||||
<option value={team.id}>
|
|
||||||
{team.parentGroup.name}
|
|
||||||
>
|
|
||||||
{team.name}
|
|
||||||
</option>
|
|
||||||
{/each}
|
|
||||||
{#each orgs as org}
|
|
||||||
<option value={org.id}>{org.name}</option>
|
|
||||||
{/each}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="text-sm w-full">
|
|
||||||
<span class="font-medium text-gray-700">{$_('distance')}</span>
|
|
||||||
<br />
|
|
||||||
<span class="text-gray-700">{original_data.distance} km</span>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{:catch error}
|
{:catch error}
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
import { _ } from "svelte-i18n";
|
import { _ } from "svelte-i18n";
|
||||||
import store from "../store";
|
import store from "../store";
|
||||||
import AddGroupModal from "./AddGroupModal.svelte";
|
import AddGroupModal from "./AddGroupModal.svelte";
|
||||||
import RunnersOverview from "./RunnersOverview.svelte";
|
import UserGroupsOverview from "./UserGroupsOverview.svelte";
|
||||||
$: current_runners = [];
|
$: current_groups = [];
|
||||||
export let modal_open = false;
|
export let modal_open = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -21,9 +21,9 @@
|
|||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
<RunnersOverview bind:current_runners />
|
<UserGroupsOverview bind:current_groups />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{#if store.state.jwtinfo.userdetails.permissions.includes('USERGROUP:CREATE')}
|
{#if store.state.jwtinfo.userdetails.permissions.includes('USERGROUP:CREATE')}
|
||||||
<AddGroupModal bind:current_runners bind:modal_open />
|
<AddGroupModal bind:current_groups bind:modal_open />
|
||||||
{/if}
|
{/if}
|
||||||
|
12
src/components/UserGroupsEmptyState.svelte
Normal file
12
src/components/UserGroupsEmptyState.svelte
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<script>
|
||||||
|
import { _ } from "svelte-i18n";
|
||||||
|
import groups_empty from "./groups_empty.svg";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="text-center items-center justify-center">
|
||||||
|
<p class="mb-16 text-lg text-gray-500">
|
||||||
|
<img class="w-full h-44" src={groups_empty} alt="" />
|
||||||
|
<span class="font-bold">There are no group added yet.</span><br />
|
||||||
|
<span>Add your first group</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
125
src/components/UserGroupsOverview.svelte
Normal file
125
src/components/UserGroupsOverview.svelte
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
<script>
|
||||||
|
import { _ } from "svelte-i18n";
|
||||||
|
import { UserGroupService } from "@odit/lfk-client-js";
|
||||||
|
import store from "../store";
|
||||||
|
import UserGroupsEmptyState from "./UserGroupsEmptyState.svelte";
|
||||||
|
$: searchvalue = "";
|
||||||
|
$: active_deletes = [];
|
||||||
|
export let current_groups = [];
|
||||||
|
const groups_promise = UserGroupService.userGroupControllerGetAll().then((val) => {
|
||||||
|
current_groups = val;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if store.state.jwtinfo.userdetails.permissions.includes('USERGROUP:GET')}
|
||||||
|
{#await groups_promise}
|
||||||
|
<div
|
||||||
|
class="bg-teal-lightest border-t-4 border-teal rounded-b text-teal-darkest px-4 py-3 shadow-md my-2"
|
||||||
|
role="alert">
|
||||||
|
<p class="font-bold">{$_('groups-are-being-loaded')}</p>
|
||||||
|
<p class="text-sm">{$_('this-might-take-a-moment')}</p>
|
||||||
|
</div>
|
||||||
|
{:then}
|
||||||
|
{#if current_groups.length === 0}
|
||||||
|
<UserGroupsEmptyState />
|
||||||
|
{:else}
|
||||||
|
<input
|
||||||
|
type="search"
|
||||||
|
bind:value={searchvalue}
|
||||||
|
placeholder={$_('datatable.search')}
|
||||||
|
aria-label={$_('datatable.search')}
|
||||||
|
class="gridjs-input gridjs-search-input mb-4" />
|
||||||
|
<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">
|
||||||
|
{$_('name')}
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
scope="col"
|
||||||
|
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
|
{$_('description')}
|
||||||
|
</th>
|
||||||
|
<th scope="col" class="relative px-6 py-3">
|
||||||
|
<span class="sr-only">{$_('action')}</span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="divide-y divide-gray-200">
|
||||||
|
{#each current_groups as group}
|
||||||
|
{#if Object.values(group)
|
||||||
|
.toString()
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(searchvalue)}
|
||||||
|
<tr data-rowid="user_{group.id}">
|
||||||
|
<td class="px-6 py-4 whitespace-nowrap">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<div class="ml-4">
|
||||||
|
<div class="text-sm font-medium text-gray-900">
|
||||||
|
{group.name}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="px-6 py-4 whitespace-nowrap">
|
||||||
|
{group.description}
|
||||||
|
</td>
|
||||||
|
{#if active_deletes[group.id] === true}
|
||||||
|
<td
|
||||||
|
class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
active_deletes[group.id] = false;
|
||||||
|
}}
|
||||||
|
tabindex="0"
|
||||||
|
class="ml-4 text-indigo-600 hover:text-indigo-900 cursor-pointer">Cancel
|
||||||
|
Delete</button>
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
UserGroupService.userGroupControllerRemove(group.id, true)
|
||||||
|
.then((resp) => {
|
||||||
|
current_groups = current_groups.filter((obj) => obj.id !== group.id);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
// error deleting user
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
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="./{group.id}"
|
||||||
|
class="text-indigo-600 hover:text-indigo-900">Edit</a>
|
||||||
|
{#if store.state.jwtinfo.userdetails.permissions.includes('USERGROUP:DELETE')}
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
active_deletes[group.id] = true;
|
||||||
|
}}
|
||||||
|
tabindex="0"
|
||||||
|
class="ml-4 text-red-600 hover:text-red-900 cursor-pointer">{$_('delete')}</button>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
{/if}
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{:catch error}
|
||||||
|
<div class="text-white px-6 py-4 border-0 rounded relative mb-4 bg-red-500">
|
||||||
|
<span class="inline-block align-middle mr-8">
|
||||||
|
<b class="capitalize">{$_('general_promise_error')}</b>
|
||||||
|
{error}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{/await}
|
||||||
|
{/if}
|
1
src/components/groups_empty.svg
Normal file
1
src/components/groups_empty.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 854.63 686"><path fill="#3f3d56" d="M0 600h821v9.053H0zM0 676.947h821V686H0z"/><path d="M750.178 608.328c-.49-.802-12.06-20.12-16.071-60.234-3.68-36.802-1.313-98.836 30.858-185.367 60.947-163.928-14.046-296.194-14.812-297.512l3.7-2.146c.194.334 19.545 34.057 30.977 87.755a382.846 382.846 0 01-15.856 213.394c-60.844 163.648-15.61 241.118-15.146 241.882z" fill="#3f3d56"/><circle cx="726.346" cy="27.795" r="27.795" fill="#3f3d56"/><circle cx="814.007" cy="130.422" r="27.795" fill="#3f3d56"/><circle cx="754.141" cy="198.841" r="27.795" fill="#dfe5ee"/><circle cx="826.835" cy="256.569" r="27.795" fill="#dfe5ee"/><circle cx="732.76" cy="346.368" r="27.795" fill="#3f3d56"/><path d="M766.97 609.35s-27.796-68.418 55.59-119.731zM732.786 608.11s-12.65-72.758-110.557-72.134z" fill="#3f3d56"/><circle cx="136.5" cy="387.5" r="41" fill="#a0616a"/><path d="M143.928 336.504c-7.84-1.925-16.272-2.247-23.868.49-7.824 2.817-14.263 8.708-19 15.542s-7.918 14.613-10.767 22.425a78.442 78.442 0 00-3.845 13.14 44.992 44.992 0 008.167 34.325c-1.2-3.166 1.822-6.617 5.138-7.303s6.693.474 9.963 1.353a61.559 61.559 0 0017.68 2.078c2.284-.065 4.679-.295 6.578-1.565 5.952-3.98 2.802-14.263 7.754-19.434 1.767-1.845 4.29-2.708 6.567-3.865 8.2-4.167 13.604-12.576 16.156-21.413 1.599-5.54 5.567-21.45 2.185-26.598-3.057-4.653-17.516-7.9-22.708-9.175z" fill="#2f2e41"/><path d="M248.066 342.291a24.396 24.396 0 00-18.677 1.041c-10.695 5.016-29.608 17.167-28.889 40.168 1 32 12 53 12 53l-2 65-10 118s-49 40-30 50 51-48 51-48l25-67 9-65s15-68 0-98c0 0 17.328-40.17-7.434-49.209zM367.5 445.5s-17 72 43 92 139 54 139 54l10 17 23-31-4-24-39-11s-73-56-105-60l4-37zM527.307 387.717L548.5 422.5s70 40 88 67 61 56 61 56l-19 45s-54-63-77-69-125-88-125-88z" fill="#a0616a"/><path d="M338.568 265.819c-7.805 1.226-15.617 2.454-23.33 4.174-17.917 3.995-35.147 10.616-51.966 17.974a608.405 608.405 0 00-68.447 35.267 132.255 132.255 0 00-16.97 11.523c-3.559 2.964-6.91 6.363-8.82 10.584a33.406 33.406 0 00-2.33 9.221c-1.55 11.12-1.477 22.595 1.535 33.41s9.124 20.955 18.119 27.674a29.88 29.88 0 007.84 4.348 45.675 45.675 0 0011.675 1.957c12.617 1.003 25.798 1.923 37.474-2.964 7.42-3.105 13.701-8.354 20.528-12.607 28.913-18.008 65.646-17.241 97.26-29.92 3.074-1.233 6.204-2.67 8.354-5.189a22.578 22.578 0 003.62-7.187l11.99-33.188c2.533-7.01 5.067-14.023 7.193-21.167 2.224-7.472 3.996-15.07 5.766-22.661 1.524-6.534 3.093-13.376 2.507-20.13-.864-9.962-3.166-10.367-12.316-8.925q-24.839 3.915-49.682 7.806z" fill="#dfe5ee"/><path d="M218.066 342.291a24.396 24.396 0 00-18.677 1.041c-10.695 5.016-29.608 17.167-28.889 40.168 1 32 12 53 12 53l-2 65-10 118s-49 40-30 50 51-48 51-48l25-67 9-65s15-68 0-98c0 0 17.328-40.17-7.434-49.209z" fill="#a0616a"/><path d="M391.66 257.544S480.5 249.5 476.5 304.5s-34 150-34 150l-77 4s-10-65 4-87z" fill="#2f2e41"/><path d="M453.5 275.5s22 14 34 42 48 83 48 83l-59 42-44-45zM559.5 587.5s-19 7-6 21a126.61 126.61 0 0120 29s-4 26 13 25 24-36 20-48-9-69-9-69-35 3-34 8 6 30-4 34zM678.5 567.5s-18 9-13 17 21 31 21 31-6 30 11 33 27-36 24-44-3-39-3-39 1-31-9-31-27 4-27 4 4 28-4 29z" fill="#2f2e41"/><path fill="#dfe5ee" d="M96 617.871h29v50.612H96z"/></svg>
|
After Width: | Height: | Size: 3.2 KiB |
@ -49,11 +49,13 @@
|
|||||||
"an_error_happened_while_fetching_the_data": "An error happened while fetching the data"
|
"an_error_happened_while_fetching_the_data": "An error happened while fetching the data"
|
||||||
},
|
},
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
|
"delete-group": "Delete Group",
|
||||||
"delete-organization": "Delete Organization",
|
"delete-organization": "Delete Organization",
|
||||||
"delete-runner": "Delete Runner",
|
"delete-runner": "Delete Runner",
|
||||||
"delete-team": "Delete Team",
|
"delete-team": "Delete Team",
|
||||||
"delete-user": "Delete User",
|
"delete-user": "Delete User",
|
||||||
"dependency_name": "Name",
|
"dependency_name": "Name",
|
||||||
|
"description": "Description",
|
||||||
"distance": "Distance",
|
"distance": "Distance",
|
||||||
"distance-in-km": "Distance in km",
|
"distance-in-km": "Distance in km",
|
||||||
"dont-have-your-email-connected": "Don't have your email connected?",
|
"dont-have-your-email-connected": "Don't have your email connected?",
|
||||||
@ -92,7 +94,9 @@
|
|||||||
"go-to-login": "Go To Login",
|
"go-to-login": "Go To Login",
|
||||||
"goback": "Go Home",
|
"goback": "Go Home",
|
||||||
"group": "Group",
|
"group": "Group",
|
||||||
|
"group-updated": "Group updated!",
|
||||||
"groups": "Groups",
|
"groups": "Groups",
|
||||||
|
"groups-are-being-loaded": "Groups are being loaded...",
|
||||||
"hallo": "hello",
|
"hallo": "hello",
|
||||||
"icon-image-credits": "We also want to thank these projects for illustrations and icons:",
|
"icon-image-credits": "We also want to thank these projects for illustrations and icons:",
|
||||||
"import-runners": "Import runners",
|
"import-runners": "Import runners",
|
||||||
@ -106,6 +110,7 @@
|
|||||||
"lfk-is-os": "The \"Lauf für Kaya!\" Frontend is (like all other projects for the \"LfK!\" Also) an open source project.",
|
"lfk-is-os": "The \"Lauf für Kaya!\" Frontend is (like all other projects for the \"LfK!\" Also) an open source project.",
|
||||||
"license": "License",
|
"license": "License",
|
||||||
"licenses-are-being-loaded": "Licenses are being loaded...",
|
"licenses-are-being-loaded": "Licenses are being loaded...",
|
||||||
|
"loading-group-detail": "Loading group detail...",
|
||||||
"loading-runners": "loading runners...",
|
"loading-runners": "loading runners...",
|
||||||
"log_in": "Log in",
|
"log_in": "Log in",
|
||||||
"log_in_to_your_account": "Log in to your account",
|
"log_in_to_your_account": "Log in to your account",
|
||||||
@ -168,6 +173,7 @@
|
|||||||
"track-length-in-m": "Track Length in m",
|
"track-length-in-m": "Track Length in m",
|
||||||
"track-name": "Track name",
|
"track-name": "Track name",
|
||||||
"tracks": "Tracks",
|
"tracks": "Tracks",
|
||||||
|
"updating-group": "Updating group...",
|
||||||
"updating-runner": "Updating runner...",
|
"updating-runner": "Updating runner...",
|
||||||
"updating-user": "updating user...",
|
"updating-user": "updating user...",
|
||||||
"user-updated": "User updated",
|
"user-updated": "User updated",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user