wip
This commit is contained in:
parent
5f5d8277b9
commit
824ecfab2e
@ -721,7 +721,7 @@ All notable changes to this project will be documented in this file. Dates are d
|
||||
- Org contract generation now runs in sequence [`01d2a7e`](https://git.odit.services/lfk/frontend/commit/01d2a7e6aa709b3f2d71575f705fc962e97e2742)
|
||||
- Emergency document server url change [`5476808`](https://git.odit.services/lfk/frontend/commit/5476808683a919bc34dbaea1f1ed276d49750096)
|
||||
- Fixed const -> let [`7447b2f`](https://git.odit.services/lfk/frontend/commit/7447b2f4c134a585905db6733093eab13e6f7c47)
|
||||
- Hotfix: Org * generation🐞 [`ac586fe`](https://git.odit.services/lfk/frontend/commit/ac586fec5abd324d590ba99cdfe8ddddefbf95e6)
|
||||
- Hotfix: Org \* generation🐞 [`ac586fe`](https://git.odit.services/lfk/frontend/commit/ac586fec5abd324d590ba99cdfe8ddddefbf95e6)
|
||||
|
||||
#### [0.12.5](https://git.odit.services/lfk/frontend/compare/0.12.4...0.12.5)
|
||||
|
||||
@ -1220,7 +1220,7 @@ All notable changes to this project will be documented in this file. Dates are d
|
||||
- Removed lodash as a dependency 🗑 [`f09224d`](https://git.odit.services/lfk/frontend/commit/f09224d5c02a2c2d2f1ac221314d2c22758143ba)
|
||||
- Added translation keys [`99c3050`](https://git.odit.services/lfk/frontend/commit/99c30504115b068b65a48c651091252371b180ae)
|
||||
- Found a hiddeen missing key👀👀 [`00d16ef`](https://git.odit.services/lfk/frontend/commit/00d16ef59f2af3a540708cd61c195ea0ead86995)
|
||||
- Bumped svelte-* dependencies (non-dev)🔝 [`b4e7f90`](https://git.odit.services/lfk/frontend/commit/b4e7f9046c29aa45661f175f7b8cdca5d6a1a9a0)
|
||||
- Bumped svelte-\* dependencies (non-dev)🔝 [`b4e7f90`](https://git.odit.services/lfk/frontend/commit/b4e7f9046c29aa45661f175f7b8cdca5d6a1a9a0)
|
||||
- Bumped svelte-related dev dependencies🔥 [`5204ba5`](https://git.odit.services/lfk/frontend/commit/5204ba5e24ca6e8ab0c5ad0255c54eede15a3baf)
|
||||
- Bumped router [`1b9b9ed`](https://git.odit.services/lfk/frontend/commit/1b9b9ed3723b0c12ab3b65eb0d94ec8c2c16ef42)
|
||||
- new license file version [CI SKIP] [`7521ad8`](https://git.odit.services/lfk/frontend/commit/7521ad8bbbb094bbe9ba723d03b3e9eb7f6a3243)
|
||||
@ -1824,7 +1824,7 @@ All notable changes to this project will be documented in this file. Dates are d
|
||||
- Added drone file with pipeline for dev [`9bf21a0`](https://git.odit.services/lfk/frontend/commit/9bf21a0eeb6d32cab18dcbb55f571969773fffac)
|
||||
- DataTable [`d293859`](https://git.odit.services/lfk/frontend/commit/d2938591bf157e88acfd274ff1dfd527a1ce8588)
|
||||
- 🚧 move to new config based env [`2cdd1cd`](https://git.odit.services/lfk/frontend/commit/2cdd1cd96196f586abfa50ba2f2b05f99545c669)
|
||||
- Dashboard - dropdown arrow change [`b27fb8c`](https://git.odit.services/lfk/frontend/commit/b27fb8c0b5532710c97947731f0725e37f13c579)
|
||||
- Dashboard - dropdown arrow change [`b27fb8c`](https://git.odit.services/lfk/frontend/commit/b27fb8c0b5532710c97947731f0725e37f13c579)
|
||||
- filepond integration ✅ [`ada6888`](https://git.odit.services/lfk/frontend/commit/ada68887a2e6a4a552c1d093f5ec1afaebd918d3)
|
||||
- more translations [`186803f`](https://git.odit.services/lfk/frontend/commit/186803f8216c991927d8f5c8ec6aa19016267858)
|
||||
- general cleanups [`428d2e2`](https://git.odit.services/lfk/frontend/commit/428d2e25790e7509c535970accbe9f79fbf6ab65)
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
3398
pnpm-lock.yaml
generated
3398
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,12 @@
|
||||
const config = {
|
||||
baseurl: "http://localhost:4010",
|
||||
baseurl_selfservice: "http://localhost:5174",
|
||||
baseurl_documentserver: "http://localhost:4010/documents",
|
||||
documentserver_key:
|
||||
"NqZSYTy5AFQ7MppbLW5moqpTk7u7YrNUHKYhKYuThnnya2WpCOIU694hIZT1FzYe",
|
||||
// optional
|
||||
default_username: "demo",
|
||||
default_password: "demo",
|
||||
prefersHashRouting: true,
|
||||
baseurl: "http://localhost:4010",
|
||||
baseurl_selfservice: "http://localhost:5174",
|
||||
baseurl_documentserver: "http://localhost:4010/documents",
|
||||
documentserver_key:
|
||||
"NqZSYTy5AFQ7MppbLW5moqpTk7u7YrNUHKYhKYuThnnya2WpCOIU694hIZT1FzYe",
|
||||
// optional
|
||||
default_username: "demo",
|
||||
default_password: "demo",
|
||||
prefersHashRouting: true,
|
||||
};
|
||||
window.config = config;
|
||||
|
File diff suppressed because one or more lines are too long
@ -125,7 +125,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
<div class="mb-4 text-3xl font-extrabold leading-tight">
|
||||
{original_data.firstname}
|
||||
{original_data.middlename || ""}
|
||||
{original_data.lastname}
|
||||
|
@ -299,7 +299,7 @@
|
||||
{/if}
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes("USERGROUP:GET")}
|
||||
<a
|
||||
class:activenav={$router.path === "/groups/"}
|
||||
class:activenav={$router.path.includes("/groups/")}
|
||||
class="flex items-center px-4 py-3 transition cursor-pointer group hover:bg-gray-200 hover:text-gray-900 w-full font-semibold"
|
||||
href="/groups/"
|
||||
>
|
||||
|
@ -121,7 +121,7 @@
|
||||
{:then}
|
||||
<section class="container p-5 select-none">
|
||||
<div class="flex flex-row mb-4">
|
||||
<div class="w-full">
|
||||
<div class="mt-2 w-full">
|
||||
<nav class="w-full flex">
|
||||
<ol class="list-none flex flex-row items-center justify-start">
|
||||
<li class="flex items-center">
|
||||
@ -146,7 +146,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
<div class="mb-4 text-3xl font-extrabold leading-tight">
|
||||
{original_data.donor.firstname}
|
||||
{original_data.donor.middlename || ""}
|
||||
{original_data.donor.lastname}
|
||||
@ -231,8 +231,8 @@
|
||||
{/if}
|
||||
</div>
|
||||
<br />
|
||||
<div class=" w-full">
|
||||
<label for="donor" class="block font-medium text-gray-700"
|
||||
<div class=" mt-2 w-full">
|
||||
<label for="donor" class="block font-semibold text-gray-700"
|
||||
>{$_("donor")}</label
|
||||
>
|
||||
<Select
|
||||
@ -254,8 +254,8 @@
|
||||
/>
|
||||
</div>
|
||||
{#if original_data.responseType == "DISTANCEDONATION"}
|
||||
<div class=" w-full">
|
||||
<label for="donor" class="block font-medium text-gray-700"
|
||||
<div class=" mt-2 w-full">
|
||||
<label for="donor" class="block font-semibold text-gray-700"
|
||||
>{$_("runner")}</label
|
||||
>
|
||||
<Select
|
||||
@ -273,7 +273,7 @@
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
<div class=" w-full">
|
||||
<div class=" mt-2 w-full">
|
||||
<label for="lastname" class="font-semibold text-gray-700">
|
||||
{#if original_data.responseType == "DISTANCEDONATION"}
|
||||
{$_("amount-per-kilometer")}
|
||||
@ -305,8 +305,8 @@
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="w-full">
|
||||
<label for="token" class="block text-sm font-medium text-gray-700"
|
||||
<div class="mt-2 w-full">
|
||||
<label for="token" class="block font-semibold text-gray-700"
|
||||
>{$_("paid-amount")}</label
|
||||
>
|
||||
<div
|
||||
|
@ -107,7 +107,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
<div class="mb-4 text-3xl font-extrabold leading-tight">
|
||||
{original_data.firstname}
|
||||
{original_data.middlename || ""}
|
||||
{original_data.lastname}
|
||||
|
@ -1,237 +1,227 @@
|
||||
<script>
|
||||
import { _ } from "svelte-i18n";
|
||||
import store from "../../store";
|
||||
import { UserGroupService } from "@odit/lfk-client-js";
|
||||
import toast from 'svelte-french-toast'
|
||||
import { _ } from "svelte-i18n";
|
||||
import store from "../../store";
|
||||
import { UserGroupService } from "@odit/lfk-client-js";
|
||||
import toast from "svelte-french-toast";
|
||||
|
||||
import PromiseError from "../base/PromiseError.svelte";
|
||||
let data_loaded = false;
|
||||
export let params;
|
||||
const promise = UserGroupService.userGroupControllerGetOne(params.groupid);
|
||||
const colors = [
|
||||
"#f3558e",
|
||||
"#17b978",
|
||||
"#3498db",
|
||||
"#3f3b3b",
|
||||
"#775ada",
|
||||
"#7ed6df_#000000",
|
||||
"#000000",
|
||||
"#21e6c1_#000000",
|
||||
"#c0392b",
|
||||
"#d35400",
|
||||
"#7f8c8d",
|
||||
"#6ab04c",
|
||||
"#4834d4",
|
||||
"#ff1f5a",
|
||||
"#eac100",
|
||||
];
|
||||
let matched_colors = [];
|
||||
$: delete_triggered = false;
|
||||
$: search_permission = "";
|
||||
$: original_data = {};
|
||||
$: editable = {};
|
||||
$: changes_performed = !(
|
||||
JSON.stringify(original_data) == JSON.stringify(editable)
|
||||
);
|
||||
$: isGroupnameValid = editable.name !== "";
|
||||
$: save_enabled = changes_performed && isGroupnameValid;
|
||||
promise.then((data) => {
|
||||
let current_target = "";
|
||||
let colorindex = -1;
|
||||
data.permissions = data.permissions.sort();
|
||||
data.permissions.forEach((p) => {
|
||||
const target = p.split(":")[0];
|
||||
if (current_target !== p.split(":")[0]) {
|
||||
colorindex++;
|
||||
current_target = p.split(":")[0];
|
||||
}
|
||||
let background = colors[colorindex];
|
||||
let foreground = "#fff";
|
||||
if (background.includes("_")) {
|
||||
foreground = background.split("_")[1];
|
||||
background = background.split("_")[0];
|
||||
}
|
||||
matched_colors[target] = [background, foreground];
|
||||
});
|
||||
data_loaded = true;
|
||||
original_data = Object.assign(original_data, data);
|
||||
editable = Object.assign(editable, original_data);
|
||||
});
|
||||
function submit() {
|
||||
if (data_loaded === true && save_enabled) {
|
||||
toast($_("updating-group"));
|
||||
UserGroupService.userGroupControllerPut(original_data.id, editable)
|
||||
.then((resp) => {
|
||||
Object.assign(original_data, editable);
|
||||
original_data = editable;
|
||||
Object.assign(original_data, editable);
|
||||
toast.success($_("group-updated"));
|
||||
})
|
||||
.catch((err) => {});
|
||||
} else {
|
||||
}
|
||||
}
|
||||
function deleteGroup() {
|
||||
UserGroupService.userGroupControllerRemove(original_data.id, true)
|
||||
.then((resp) => {
|
||||
location.replace("./");
|
||||
})
|
||||
.catch((err) => {});
|
||||
}
|
||||
import PromiseError from "../base/PromiseError.svelte";
|
||||
let data_loaded = false;
|
||||
export let params;
|
||||
const promise = UserGroupService.userGroupControllerGetOne(params.groupid);
|
||||
const colors = [
|
||||
"#f3558e",
|
||||
"#17b978",
|
||||
"#3498db",
|
||||
"#3f3b3b",
|
||||
"#775ada",
|
||||
"#7ed6df_#000000",
|
||||
"#000000",
|
||||
"#21e6c1_#000000",
|
||||
"#c0392b",
|
||||
"#d35400",
|
||||
"#7f8c8d",
|
||||
"#6ab04c",
|
||||
"#4834d4",
|
||||
"#ff1f5a",
|
||||
"#eac100",
|
||||
];
|
||||
let matched_colors = [];
|
||||
$: delete_triggered = false;
|
||||
$: search_permission = "";
|
||||
$: original_data = {};
|
||||
$: editable = {};
|
||||
$: changes_performed = !(
|
||||
JSON.stringify(original_data) == JSON.stringify(editable)
|
||||
);
|
||||
$: isGroupnameValid = editable.name !== "";
|
||||
$: save_enabled = changes_performed && isGroupnameValid;
|
||||
promise.then((data) => {
|
||||
let current_target = "";
|
||||
let colorindex = -1;
|
||||
data.permissions = data.permissions.sort();
|
||||
data.permissions.forEach((p) => {
|
||||
const target = p.split(":")[0];
|
||||
if (current_target !== p.split(":")[0]) {
|
||||
colorindex++;
|
||||
current_target = p.split(":")[0];
|
||||
}
|
||||
let background = colors[colorindex];
|
||||
let foreground = "#fff";
|
||||
if (background.includes("_")) {
|
||||
foreground = background.split("_")[1];
|
||||
background = background.split("_")[0];
|
||||
}
|
||||
matched_colors[target] = [background, foreground];
|
||||
});
|
||||
data_loaded = true;
|
||||
original_data = Object.assign(original_data, data);
|
||||
editable = Object.assign(editable, original_data);
|
||||
});
|
||||
function submit() {
|
||||
if (data_loaded === true && save_enabled) {
|
||||
toast($_("updating-group"));
|
||||
UserGroupService.userGroupControllerPut(original_data.id, editable)
|
||||
.then((resp) => {
|
||||
Object.assign(original_data, editable);
|
||||
original_data = editable;
|
||||
Object.assign(original_data, editable);
|
||||
toast.success($_("group-updated"));
|
||||
})
|
||||
.catch((err) => {});
|
||||
} else {
|
||||
}
|
||||
}
|
||||
function deleteGroup() {
|
||||
UserGroupService.userGroupControllerRemove(original_data.id, true)
|
||||
.then((resp) => {
|
||||
location.replace("./");
|
||||
})
|
||||
.catch((err) => {});
|
||||
}
|
||||
</script>
|
||||
|
||||
{#await promise}
|
||||
{$_("loading-group-detail")}
|
||||
{$_("loading-group-detail")}
|
||||
{:then}
|
||||
<section class="container p-5 select-none">
|
||||
<div class="flex flex-row mb-4">
|
||||
<div class="w-full">
|
||||
<nav class="w-full flex">
|
||||
<ol class="list-none flex flex-row items-center justify-start">
|
||||
<li class="flex items-center">
|
||||
<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"
|
||||
/></svg
|
||||
>
|
||||
</li>
|
||||
<li class="flex items-center">
|
||||
<a class="mr-2" href="../">{$_("groups")}</a><svg
|
||||
stroke="currentColor"
|
||||
fill="none"
|
||||
stroke-width="2"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="h-3 w-3 mr-2 stroke-current"
|
||||
height="1em"
|
||||
width="1em"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
><line x1="5" y1="12" x2="19" y2="12" />
|
||||
<polyline points="12 5 19 12 12 19" /></svg
|
||||
>
|
||||
</li>
|
||||
<li class="flex items-center">
|
||||
<span class="mr-2">{editable.name}</span>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
<div data-id="group_actions_${editable.id}">
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes("USERGROUP:DELETE")}
|
||||
{#if delete_triggered}
|
||||
<button
|
||||
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:w-auto sm:text-sm"
|
||||
>{$_("confirm-deletion")}</button
|
||||
>
|
||||
<button
|
||||
on:click={() => {
|
||||
delete_triggered = !delete_triggered;
|
||||
}}
|
||||
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 !delete_triggered}
|
||||
<button
|
||||
on:click={() => {
|
||||
delete_triggered = true;
|
||||
}}
|
||||
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:w-auto sm:text-sm"
|
||||
>{$_("delete-group")}</button
|
||||
>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if !delete_triggered}
|
||||
<button
|
||||
disabled={!save_enabled}
|
||||
class:opacity-50={!save_enabled}
|
||||
type="button"
|
||||
on:click={submit}
|
||||
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:w-auto sm:text-sm"
|
||||
>{$_("save-changes")}</button
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<!-- -->
|
||||
<div class="text-sm w-full mt-2">
|
||||
<label for="title" class="font-semibold text-gray-700">{$_("name")}</label>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("name")}
|
||||
type="text"
|
||||
bind:value={editable.name}
|
||||
class:border-red-500={!isGroupnameValid}
|
||||
class:focus:border-red-500={!isGroupnameValid}
|
||||
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-neutral-800 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 mt-2">
|
||||
<label for="firstname" class="font-semibold text-gray-700"
|
||||
>{$_("description")}</label
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("description")}
|
||||
type="text"
|
||||
bind:value={editable.description}
|
||||
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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
<div class="text-sm w-full mt-8">
|
||||
<p class="font-medium mb-4">
|
||||
{$_("permissions")}
|
||||
<a
|
||||
class="px-4 py-2 bg-gray-500 rounded-md text-white"
|
||||
href="/groups/{params.groupid}/permissions/"
|
||||
>{$_("edit-permissions")}</a
|
||||
>
|
||||
</p>
|
||||
<div class="w-full sm:my-px sm:px-px sm:w-1/2">
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("search-for-permission")}
|
||||
type="text"
|
||||
bind:value={search_permission}
|
||||
class="mt-4 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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
{#each original_data.permissions as p}
|
||||
{#if p.toLowerCase().includes(search_permission.toLowerCase())}
|
||||
<span
|
||||
style="background:{matched_colors[
|
||||
p.split(':')[0]
|
||||
][0]};color:{matched_colors[p.split(':')[0]][1]};"
|
||||
class="mt-1 inline-flex items-center justify-center px-2 py-1 text-xs font-bold leading-none text-indigo-100 rounded"
|
||||
>{p}</span
|
||||
>
|
||||
<!-- -->
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
<section class="container p-5 select-none">
|
||||
<div class="flex flex-row mb-4">
|
||||
<div class="w-full">
|
||||
<nav class="w-full flex">
|
||||
<ol class="list-none flex flex-row items-center justify-start">
|
||||
<li class="flex items-center"></li>
|
||||
<li class="flex items-center">
|
||||
<a class="mr-2" href="../"
|
||||
><svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="inline-block"
|
||||
><path d="m12 19-7-7 7-7" /><path d="M19 12H5" /></svg
|
||||
>
|
||||
{$_("groups")}</a
|
||||
>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-4 text-3xl font-extrabold leading-tight">
|
||||
{editable.name}
|
||||
<div data-id="group_actions_${editable.id}">
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes("USERGROUP:DELETE")}
|
||||
{#if delete_triggered}
|
||||
<button
|
||||
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:w-auto sm:text-sm"
|
||||
>{$_("confirm-deletion")}</button
|
||||
>
|
||||
<button
|
||||
on:click={() => {
|
||||
delete_triggered = !delete_triggered;
|
||||
}}
|
||||
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 !delete_triggered}
|
||||
<button
|
||||
on:click={() => {
|
||||
delete_triggered = true;
|
||||
}}
|
||||
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:w-auto sm:text-sm"
|
||||
>{$_("delete-group")}</button
|
||||
>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if !delete_triggered}
|
||||
<button
|
||||
disabled={!save_enabled}
|
||||
class:opacity-50={!save_enabled}
|
||||
type="button"
|
||||
on:click={submit}
|
||||
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:w-auto sm:text-sm"
|
||||
>{$_("save-changes")}</button
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<!-- -->
|
||||
<div class="text-sm w-full mt-2">
|
||||
<label for="title" class="font-semibold text-gray-700">{$_("name")}</label
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("name")}
|
||||
type="text"
|
||||
bind:value={editable.name}
|
||||
class:border-red-500={!isGroupnameValid}
|
||||
class:focus:border-red-500={!isGroupnameValid}
|
||||
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-neutral-800 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 mt-2">
|
||||
<label for="groupdescription" class="font-semibold text-gray-700"
|
||||
>{$_("description")}</label
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("description")}
|
||||
type="text"
|
||||
bind:value={editable.description}
|
||||
name="groupdescription"
|
||||
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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
<div class="text-sm w-full mt-2">
|
||||
<p class="font-semibold mb-4">
|
||||
{$_("permissions")}
|
||||
</p>
|
||||
<div>
|
||||
<a
|
||||
class="px-4 py-2 bg-gray-500 rounded-md text-white"
|
||||
href="/groups/{params.groupid}/permissions/"
|
||||
>{$_("edit-permissions")}</a
|
||||
>
|
||||
</div>
|
||||
<div class="w-full sm:my-px sm:px-px sm:w-1/2">
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("search-for-permission")}
|
||||
type="text"
|
||||
bind:value={search_permission}
|
||||
class="mt-4 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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
{#each original_data.permissions as p}
|
||||
{#if p.toLowerCase().includes(search_permission.toLowerCase())}
|
||||
<span
|
||||
style="background:{matched_colors[
|
||||
p.split(':')[0]
|
||||
][0]};color:{matched_colors[p.split(':')[0]][1]};"
|
||||
class="mt-1 inline-flex items-center justify-center px-2 py-1 text-xs font-bold leading-none text-indigo-100 rounded"
|
||||
>{p}</span
|
||||
>
|
||||
<!-- -->
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
{:catch error}
|
||||
<PromiseError {error} />
|
||||
<PromiseError {error} />
|
||||
{/await}
|
||||
|
@ -133,7 +133,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold">
|
||||
<div class="mb-4 text-3xl font-extrabold">
|
||||
<div>
|
||||
{#if promises.length === 0}
|
||||
<button
|
||||
|
@ -174,7 +174,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
<div class="mb-4 text-3xl font-extrabold leading-tight">
|
||||
{original_object.name} [#{params.orgid}]
|
||||
<span data-id="org_actions_${editable.id}">
|
||||
<GenerateSponsoringContracts
|
||||
|
@ -1,142 +1,150 @@
|
||||
class DocumentServer {
|
||||
baseUrl: string;
|
||||
apiKey: string;
|
||||
baseUrl: string;
|
||||
apiKey: string;
|
||||
|
||||
constructor(baseUrl: string, apiKey: string){
|
||||
this.baseUrl = baseUrl;
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
constructor(baseUrl: string, apiKey: string) {
|
||||
this.baseUrl = baseUrl;
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
async generateCards(cards: any[], locale: string) {
|
||||
const generateCards = new Array<any>();
|
||||
async generateCards(cards: any[], locale: string) {
|
||||
const generateCards = new Array<any>();
|
||||
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
const card = {
|
||||
id: cards[i].id,
|
||||
enabled: cards[i].enabled,
|
||||
code: cards[i].code,
|
||||
runner: {
|
||||
id: cards[i]?.runner?.id,
|
||||
first_name: cards[i]?.runner?.firstname,
|
||||
middle_name: cards[i]?.runner?.middlename,
|
||||
last_name: cards[i]?.runner?.lastname,
|
||||
group: {
|
||||
id: cards[i]?.runner?.group.id,
|
||||
name: cards[i]?.runner?.group.name,
|
||||
parent_group: {
|
||||
id: cards[i]?.runner?.group?.parentGroup?.id,
|
||||
name: cards[i]?.runner?.group?.parentGroup?.name,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
generateCards.push(card)
|
||||
|
||||
}
|
||||
|
||||
const response = await fetch(`${this.baseUrl}/v1/pdfs/cards?key=${this.apiKey}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
const card = {
|
||||
id: cards[i].id,
|
||||
enabled: cards[i].enabled,
|
||||
code: cards[i].code,
|
||||
runner: {
|
||||
id: cards[i]?.runner?.id,
|
||||
first_name: cards[i]?.runner?.firstname,
|
||||
middle_name: cards[i]?.runner?.middlename,
|
||||
last_name: cards[i]?.runner?.lastname,
|
||||
group: {
|
||||
id: cards[i]?.runner?.group.id,
|
||||
name: cards[i]?.runner?.group.name,
|
||||
parent_group: {
|
||||
id: cards[i]?.runner?.group?.parentGroup?.id,
|
||||
name: cards[i]?.runner?.group?.parentGroup?.name,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
locale,
|
||||
cards: generateCards,
|
||||
}),
|
||||
});
|
||||
|
||||
const blob = await response.blob();
|
||||
return blob;
|
||||
},
|
||||
},
|
||||
};
|
||||
generateCards.push(card);
|
||||
}
|
||||
|
||||
async generateContracts(runners: any[], locale: string) {
|
||||
const generateRunners = new Array<any>();
|
||||
|
||||
for (let i = 0; i < runners.length; i++) {
|
||||
console.log(runners[i])
|
||||
const card = {
|
||||
id: runners[i].id,
|
||||
first_name: runners[i].firstname,
|
||||
middle_name: runners[i].middlename,
|
||||
last_name: runners[i].lastname,
|
||||
group: {
|
||||
id: runners[i].group.id,
|
||||
name: runners[i].group.name,
|
||||
parent_group: {
|
||||
id: runners[i]?.group?.parentGroup?.id,
|
||||
name: runners[i]?.group?.parentGroup?.name,
|
||||
}
|
||||
}
|
||||
}
|
||||
generateRunners.push(card)
|
||||
|
||||
}
|
||||
const response = await fetch(
|
||||
`${this.baseUrl}/v1/pdfs/cards?key=${this.apiKey}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
locale,
|
||||
cards: generateCards,
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
const response = await fetch(`${this.baseUrl}/v1/pdfs/contracts?key=${this.apiKey}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
locale,
|
||||
runners: generateRunners,
|
||||
}),
|
||||
});
|
||||
const blob = await response.blob();
|
||||
return blob;
|
||||
}
|
||||
|
||||
const blob = await response.blob();
|
||||
return blob;
|
||||
async generateContracts(runners: any[], locale: string) {
|
||||
const generateRunners = new Array<any>();
|
||||
|
||||
for (let i = 0; i < runners.length; i++) {
|
||||
console.log(runners[i]);
|
||||
const card = {
|
||||
id: runners[i].id,
|
||||
first_name: runners[i].firstname,
|
||||
middle_name: runners[i].middlename,
|
||||
last_name: runners[i].lastname,
|
||||
group: {
|
||||
id: runners[i].group.id,
|
||||
name: runners[i].group.name,
|
||||
parent_group: {
|
||||
id: runners[i]?.group?.parentGroup?.id,
|
||||
name: runners[i]?.group?.parentGroup?.name,
|
||||
},
|
||||
},
|
||||
};
|
||||
generateRunners.push(card);
|
||||
}
|
||||
|
||||
async generateCertificates(runners: any[], locale: string) {
|
||||
const generateRunners = new Array<any>();
|
||||
|
||||
for (let i = 0; i < runners.length; i++) {
|
||||
const certificate = {
|
||||
id: runners[i].id,
|
||||
first_name: runners[i].firstname,
|
||||
middle_name: runners[i].middlename,
|
||||
last_name: runners[i].lastname,
|
||||
group: {
|
||||
id: runners[i].group.id,
|
||||
name: runners[i].group.name,
|
||||
parent_group: {
|
||||
id: runners[i]?.group?.parentGroup?.id,
|
||||
name: runners[i]?.group?.parentGroup?.name,
|
||||
}
|
||||
},
|
||||
distance: runners[i].distance,
|
||||
distance_donations: runners[i].distanceDonations.map((distanceDonation: any) =>{
|
||||
return {
|
||||
id: distanceDonation.id,
|
||||
amount: distanceDonation.amount,
|
||||
amount_per_distance: distanceDonation.amountPerDistance,
|
||||
donor: {
|
||||
id: distanceDonation.donor.id,
|
||||
first_name: distanceDonation.donor.firstname,
|
||||
middle_name: distanceDonation.donor.middlename,
|
||||
last_name: distanceDonation.donor.lastname,
|
||||
}
|
||||
}
|
||||
}),
|
||||
}
|
||||
generateRunners.push(certificate)
|
||||
|
||||
}
|
||||
const response = await fetch(
|
||||
`${this.baseUrl}/v1/pdfs/contracts?key=${this.apiKey}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
locale,
|
||||
runners: generateRunners,
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
const response = await fetch(`${this.baseUrl}/v1/pdfs/certificates?key=${this.apiKey}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
locale,
|
||||
runners: generateRunners,
|
||||
}),
|
||||
});
|
||||
const blob = await response.blob();
|
||||
return blob;
|
||||
}
|
||||
|
||||
const blob = await response.blob();
|
||||
return blob;
|
||||
async generateCertificates(runners: any[], locale: string) {
|
||||
const generateRunners = new Array<any>();
|
||||
|
||||
for (let i = 0; i < runners.length; i++) {
|
||||
const certificate = {
|
||||
id: runners[i].id,
|
||||
first_name: runners[i].firstname,
|
||||
middle_name: runners[i].middlename,
|
||||
last_name: runners[i].lastname,
|
||||
group: {
|
||||
id: runners[i].group.id,
|
||||
name: runners[i].group.name,
|
||||
parent_group: {
|
||||
id: runners[i]?.group?.parentGroup?.id,
|
||||
name: runners[i]?.group?.parentGroup?.name,
|
||||
},
|
||||
},
|
||||
distance: runners[i].distance,
|
||||
distance_donations: runners[i].distanceDonations.map(
|
||||
(distanceDonation: any) => {
|
||||
return {
|
||||
id: distanceDonation.id,
|
||||
amount: distanceDonation.amount,
|
||||
amount_per_distance: distanceDonation.amountPerDistance,
|
||||
donor: {
|
||||
id: distanceDonation.donor.id,
|
||||
first_name: distanceDonation.donor.firstname,
|
||||
middle_name: distanceDonation.donor.middlename,
|
||||
last_name: distanceDonation.donor.lastname,
|
||||
},
|
||||
};
|
||||
},
|
||||
),
|
||||
};
|
||||
generateRunners.push(certificate);
|
||||
}
|
||||
|
||||
const response = await fetch(
|
||||
`${this.baseUrl}/v1/pdfs/certificates?key=${this.apiKey}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
locale,
|
||||
runners: generateRunners,
|
||||
}),
|
||||
},
|
||||
);
|
||||
|
||||
const blob = await response.blob();
|
||||
return blob;
|
||||
}
|
||||
}
|
||||
|
||||
export default DocumentServer;
|
||||
export default DocumentServer;
|
||||
|
@ -121,7 +121,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
<div class="mb-4 text-3xl font-extrabold leading-tight">
|
||||
{original_data.firstname}
|
||||
{original_data.middlename || ""}
|
||||
{original_data.lastname} [#{params.runnerid}]
|
||||
|
@ -131,7 +131,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
<div class="mb-4 text-3xl font-extrabold leading-tight">
|
||||
{runner.value?.firstname}
|
||||
{runner.value?.middlename || ""}
|
||||
{runner.value?.lastname}
|
||||
|
@ -90,7 +90,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
<div class="mb-4 text-3xl font-extrabold leading-tight">
|
||||
{$_("scanstation")} #{original_data.id}<br>"{original_data.description}"
|
||||
<div data-id="stations_actions_${editable.id}">
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes("STATION:DELETE")}
|
||||
|
@ -62,21 +62,13 @@
|
||||
</script>
|
||||
|
||||
<ConfirmProfileDeletion bind:modal_open bind:delete_triggered />
|
||||
<div class="pt-12 px-4 sm:px-6 lg:px-8 lg:pt-20 bg-gray-900 pb-12">
|
||||
<div class="text-center mb-8">
|
||||
<h1
|
||||
class="mt-9 font-display text-4xl leading-none font-semibold text-white sm:text-5xl lg:text-6xl"
|
||||
>
|
||||
🔨<br />{$_("settings")}
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pt-0 pb-16 bg-gray-50 overflow-hidden lg:pt-12 lg:py-24">
|
||||
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
|
||||
<span class="text-3xl font-bold">{$_("settings")}</span>
|
||||
<div>
|
||||
<div class="md:grid md:grid-cols-3 md:gap-6">
|
||||
<div class="md:col-span-1">
|
||||
<div class="px-4 sm:px-0">
|
||||
<div class="sm:px-0">
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900">
|
||||
{$_("profile")}
|
||||
</h3>
|
||||
@ -184,7 +176,7 @@
|
||||
<div>
|
||||
<div class="md:grid md:grid-cols-3 md:gap-6">
|
||||
<div class="md:col-span-1">
|
||||
<div class="px-4 sm:px-0">
|
||||
<div class="sm:px-0">
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900">
|
||||
{$_("password")}
|
||||
</h3>
|
||||
@ -255,7 +247,7 @@
|
||||
<div>
|
||||
<div class="md:grid md:grid-cols-3 md:gap-6">
|
||||
<div class="md:col-span-1">
|
||||
<div class="px-4 sm:px-0">
|
||||
<div class="sm:px-0">
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900">
|
||||
{$_("danger-zone")}
|
||||
</h3>
|
||||
|
@ -61,7 +61,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
<div class="mb-4 text-3xl font-extrabold leading-tight">
|
||||
{$_("statsclient")} #{original_data.id}
|
||||
<div data-id="stations_actions_${original_data.id}">
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes("STATSCLIENT:DELETE")}
|
||||
|
@ -181,7 +181,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold leading-tight">
|
||||
<div class="mb-4 text-3xl font-extrabold leading-tight">
|
||||
{#if group}
|
||||
{group.label}{" > "}
|
||||
{/if}
|
||||
|
@ -1,234 +1,216 @@
|
||||
<script>
|
||||
import { _ } from "svelte-i18n";
|
||||
import store from "../../store";
|
||||
import isEmail from "validator/es/lib/isEmail";
|
||||
import { UserService, UserGroupService } from "@odit/lfk-client-js";
|
||||
import PromiseError from "../base/PromiseError.svelte";
|
||||
import toast from "svelte-french-toast";
|
||||
export let params;
|
||||
const user_promise = UserService.userControllerGetOne(params.userid);
|
||||
let data_loaded = false;
|
||||
let usergroups_array_original = [];
|
||||
const colors = [
|
||||
"#f3558e",
|
||||
"#17b978",
|
||||
"#3498db",
|
||||
"#3f3b3b",
|
||||
"#775ada",
|
||||
"#7ed6df_#000000",
|
||||
"#000000",
|
||||
"#21e6c1_#000000",
|
||||
"#c0392b",
|
||||
"#d35400",
|
||||
"#7f8c8d",
|
||||
"#6ab04c",
|
||||
"#4834d4",
|
||||
"#ff1f5a",
|
||||
"#eac100",
|
||||
];
|
||||
let matched_colors = [];
|
||||
$: delete_triggered = false;
|
||||
$: original_data = {};
|
||||
$: editable_userdata = {};
|
||||
$: allgroups = [];
|
||||
$: allgroups_ids = [];
|
||||
$: usergroups_array = [];
|
||||
$: search_permission = "";
|
||||
user_promise.then((data) => {
|
||||
let current_target = "";
|
||||
let colorindex = -1;
|
||||
// alphabetically sort permissions for color compatibility for target
|
||||
data.permissions = data.permissions.sort();
|
||||
data.permissions.forEach((p) => {
|
||||
const target = p.split(":")[0];
|
||||
if (current_target !== p.split(":")[0]) {
|
||||
colorindex++;
|
||||
current_target = p.split(":")[0];
|
||||
}
|
||||
let background = colors[colorindex];
|
||||
let foreground = "#fff";
|
||||
if (background.includes("_")) {
|
||||
foreground = background.split("_")[1];
|
||||
background = background.split("_")[0];
|
||||
}
|
||||
matched_colors[target] = [background, foreground];
|
||||
});
|
||||
//
|
||||
data_loaded = true;
|
||||
original_data = Object.assign(original_data, data);
|
||||
editable_userdata = data;
|
||||
data.groups.forEach((g) => {
|
||||
usergroups_array = usergroups_array.concat([g.id]);
|
||||
});
|
||||
usergroups_array_original = usergroups_array;
|
||||
allgroups.forEach((g) => {
|
||||
allgroups_ids.push(g.id);
|
||||
});
|
||||
});
|
||||
UserGroupService.userGroupControllerGetAll().then((data) => {
|
||||
allgroups = data;
|
||||
});
|
||||
$: changes_performed = !(
|
||||
JSON.stringify(original_data) == JSON.stringify(editable_userdata)
|
||||
);
|
||||
$: groups_changed =
|
||||
JSON.stringify(usergroups_array) ===
|
||||
JSON.stringify(usergroups_array_original);
|
||||
$: save_enabled =
|
||||
(changes_performed || !groups_changed) && isEmail(editable_userdata.email);
|
||||
function submit() {
|
||||
if (data_loaded === true && save_enabled) {
|
||||
editable_userdata.groups = usergroups_array;
|
||||
toast.loading($_("updating-user"));
|
||||
UserService.userControllerPut(original_data.id, editable_userdata)
|
||||
.then((resp) => {
|
||||
Object.assign(original_data, resp);
|
||||
Object.assign(editable_userdata, resp);
|
||||
original_data.permissions = resp.permissions;
|
||||
usergroups_array = [];
|
||||
resp.groups.forEach((g) => {
|
||||
usergroups_array = usergroups_array.concat([g.id]);
|
||||
});
|
||||
usergroups_array_original = usergroups_array;
|
||||
//
|
||||
toast.dismiss();
|
||||
toast($_("user-updated"));
|
||||
})
|
||||
.catch((err) => {});
|
||||
}
|
||||
}
|
||||
function deleteUser() {
|
||||
UserService.userControllerRemove(original_data.id, true)
|
||||
.then((resp) => {
|
||||
location.replace("./");
|
||||
})
|
||||
.catch((err) => {});
|
||||
}
|
||||
import { _ } from "svelte-i18n";
|
||||
import store from "../../store";
|
||||
import isEmail from "validator/es/lib/isEmail";
|
||||
import { UserService, UserGroupService } from "@odit/lfk-client-js";
|
||||
import PromiseError from "../base/PromiseError.svelte";
|
||||
import toast from "svelte-french-toast";
|
||||
export let params;
|
||||
const user_promise = UserService.userControllerGetOne(params.userid);
|
||||
let data_loaded = false;
|
||||
let usergroups_array_original = [];
|
||||
const colors = [
|
||||
"#f3558e",
|
||||
"#17b978",
|
||||
"#3498db",
|
||||
"#3f3b3b",
|
||||
"#775ada",
|
||||
"#7ed6df_#000000",
|
||||
"#000000",
|
||||
"#21e6c1_#000000",
|
||||
"#c0392b",
|
||||
"#d35400",
|
||||
"#7f8c8d",
|
||||
"#6ab04c",
|
||||
"#4834d4",
|
||||
"#ff1f5a",
|
||||
"#eac100",
|
||||
];
|
||||
let matched_colors = [];
|
||||
$: delete_triggered = false;
|
||||
$: original_data = {};
|
||||
$: editable_userdata = {};
|
||||
$: allgroups = [];
|
||||
$: allgroups_ids = [];
|
||||
$: usergroups_array = [];
|
||||
$: search_permission = "";
|
||||
user_promise.then((data) => {
|
||||
let current_target = "";
|
||||
let colorindex = -1;
|
||||
// alphabetically sort permissions for color compatibility for target
|
||||
data.permissions = data.permissions.sort();
|
||||
data.permissions.forEach((p) => {
|
||||
const target = p.split(":")[0];
|
||||
if (current_target !== p.split(":")[0]) {
|
||||
colorindex++;
|
||||
current_target = p.split(":")[0];
|
||||
}
|
||||
let background = colors[colorindex];
|
||||
let foreground = "#fff";
|
||||
if (background.includes("_")) {
|
||||
foreground = background.split("_")[1];
|
||||
background = background.split("_")[0];
|
||||
}
|
||||
matched_colors[target] = [background, foreground];
|
||||
});
|
||||
//
|
||||
data_loaded = true;
|
||||
original_data = Object.assign(original_data, data);
|
||||
editable_userdata = data;
|
||||
data.groups.forEach((g) => {
|
||||
usergroups_array = usergroups_array.concat([g.id]);
|
||||
});
|
||||
usergroups_array_original = usergroups_array;
|
||||
allgroups.forEach((g) => {
|
||||
allgroups_ids.push(g.id);
|
||||
});
|
||||
});
|
||||
UserGroupService.userGroupControllerGetAll().then((data) => {
|
||||
allgroups = data;
|
||||
});
|
||||
$: changes_performed = !(
|
||||
JSON.stringify(original_data) == JSON.stringify(editable_userdata)
|
||||
);
|
||||
$: groups_changed =
|
||||
JSON.stringify(usergroups_array) ===
|
||||
JSON.stringify(usergroups_array_original);
|
||||
$: save_enabled =
|
||||
(changes_performed || !groups_changed) && isEmail(editable_userdata.email);
|
||||
function submit() {
|
||||
if (data_loaded === true && save_enabled) {
|
||||
editable_userdata.groups = usergroups_array;
|
||||
toast.loading($_("updating-user"));
|
||||
UserService.userControllerPut(original_data.id, editable_userdata)
|
||||
.then((resp) => {
|
||||
Object.assign(original_data, resp);
|
||||
Object.assign(editable_userdata, resp);
|
||||
original_data.permissions = resp.permissions;
|
||||
usergroups_array = [];
|
||||
resp.groups.forEach((g) => {
|
||||
usergroups_array = usergroups_array.concat([g.id]);
|
||||
});
|
||||
usergroups_array_original = usergroups_array;
|
||||
//
|
||||
toast.dismiss();
|
||||
toast($_("user-updated"));
|
||||
})
|
||||
.catch((err) => {});
|
||||
}
|
||||
}
|
||||
function deleteUser() {
|
||||
UserService.userControllerRemove(original_data.id, true)
|
||||
.then((resp) => {
|
||||
location.replace("./");
|
||||
})
|
||||
.catch((err) => {});
|
||||
}
|
||||
</script>
|
||||
|
||||
{#await user_promise}
|
||||
<!-- -->
|
||||
<!-- -->
|
||||
{:then user}
|
||||
<section class="container p-5 select-none">
|
||||
<div class="flex flex-row mb-4">
|
||||
<div class="w-full">
|
||||
<nav class="w-full flex">
|
||||
<ol class="list-none flex flex-row items-center justify-start">
|
||||
<li class="flex items-center">
|
||||
<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 24 24"
|
||||
><path
|
||||
fill="currentColor"
|
||||
d="M12 14v8H4a8 8 0 018-8zm0-1a6 6 0 110-12 6 6 0 010 12zm2.6 5.81a3.51 3.51 0 010-1.62l-1-.57 1-1.74 1 .58a3.5 3.5 0 011.4-.82V13.5h2v1.15a3.5 3.5 0 011.4.8l1-.57 1 1.74-1 .57a3.51 3.51 0 010 1.62l1 .57-1 1.74-1-.58a3.5 3.5 0 01-1.4.82v1.14h-2v-1.15a3.5 3.5 0 01-1.4-.8l-1 .57-1-1.74 1-.57zM18 17a1 1 0 100 2 1 1 0 000-2z"
|
||||
/></svg
|
||||
>
|
||||
</li>
|
||||
<li class="flex items-center">
|
||||
<a class="mr-2" href="./">{$_("users")}</a><svg
|
||||
stroke="currentColor"
|
||||
fill="none"
|
||||
stroke-width="2"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="h-3 w-3 mr-2 stroke-current"
|
||||
height="1em"
|
||||
width="1em"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
><line x1="5" y1="12" x2="19" y2="12" />
|
||||
<polyline points="12 5 19 12 12 19" /></svg
|
||||
>
|
||||
</li>
|
||||
<li class="flex items-center">
|
||||
<span class="mr-2"
|
||||
>{original_data.firstname}
|
||||
{original_data.lastname}</span
|
||||
>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold">
|
||||
{original_data.firstname}
|
||||
{original_data.lastname}
|
||||
<span data-id="user_actions_${editable_userdata.id}">
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes("USER:DELETE")}
|
||||
{#if delete_triggered}
|
||||
<button
|
||||
on:click={deleteUser}
|
||||
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:w-auto sm:text-sm"
|
||||
>{$_("confirm-delete")}</button
|
||||
>
|
||||
<button
|
||||
on:click={() => {
|
||||
delete_triggered = !delete_triggered;
|
||||
}}
|
||||
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 !delete_triggered}
|
||||
<button
|
||||
on:click={() => {
|
||||
delete_triggered = true;
|
||||
}}
|
||||
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:w-auto sm:text-sm"
|
||||
>{$_("delete-user")}</button
|
||||
>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if !delete_triggered}
|
||||
<button
|
||||
disabled={!save_enabled}
|
||||
class:opacity-50={!save_enabled}
|
||||
type="button"
|
||||
on:click={submit}
|
||||
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:w-auto sm:text-sm"
|
||||
>{$_("save-changes")}</button
|
||||
>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-3 text-sm w-full">
|
||||
<label for="enabled" class="ml-1 font-medium text-gray-700"
|
||||
>{$_("active")}?</label
|
||||
>
|
||||
<br />
|
||||
<p class="text-gray-500">
|
||||
<input
|
||||
id="enabled"
|
||||
on:change={() => {
|
||||
editable_userdata.enabled = !editable_userdata.enabled;
|
||||
}}
|
||||
name="enabled"
|
||||
type="checkbox"
|
||||
checked={editable_userdata.enabled}
|
||||
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded"
|
||||
/>
|
||||
{$_("set-the-user-active-inactive")}
|
||||
</p>
|
||||
</div>
|
||||
<div class="text-sm w-full mt-2">
|
||||
<label for="firstname" class="font-semibold text-gray-700"
|
||||
>{$_("first-name")}</label
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("first-name")}
|
||||
type="text"
|
||||
bind:value={editable_userdata.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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
<!-- <div class="text-sm w-full mt-2">
|
||||
<section class="container p-5 select-none">
|
||||
<div class="flex flex-row mb-4">
|
||||
<div class="w-full">
|
||||
<nav class="w-full flex">
|
||||
<ol class="list-none flex flex-row items-center justify-start">
|
||||
<li class="flex items-center">
|
||||
<a class="mr-2" href="./"
|
||||
><svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="inline-block"
|
||||
><path d="m12 19-7-7 7-7" /><path d="M19 12H5" /></svg
|
||||
>
|
||||
{$_("users")}</a
|
||||
>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-4 text-3xl font-extrabold">
|
||||
{original_data.firstname}
|
||||
{original_data.lastname}
|
||||
<span data-id="user_actions_${editable_userdata.id}">
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes("USER:DELETE")}
|
||||
{#if delete_triggered}
|
||||
<button
|
||||
on:click={deleteUser}
|
||||
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:w-auto sm:text-sm"
|
||||
>{$_("confirm-delete")}</button
|
||||
>
|
||||
<button
|
||||
on:click={() => {
|
||||
delete_triggered = !delete_triggered;
|
||||
}}
|
||||
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 !delete_triggered}
|
||||
<button
|
||||
on:click={() => {
|
||||
delete_triggered = true;
|
||||
}}
|
||||
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:w-auto sm:text-sm"
|
||||
>{$_("delete-user")}</button
|
||||
>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if !delete_triggered}
|
||||
<button
|
||||
disabled={!save_enabled}
|
||||
class:opacity-50={!save_enabled}
|
||||
type="button"
|
||||
on:click={submit}
|
||||
class="w-full justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:w-auto sm:text-sm"
|
||||
>{$_("save-changes")}</button
|
||||
>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-3 text-sm w-full">
|
||||
<label for="enabled" class="font-semibold text-gray-700"
|
||||
>{$_("active")}?</label
|
||||
>
|
||||
<br />
|
||||
<p class="text-gray-500">
|
||||
<input
|
||||
id="enabled"
|
||||
on:change={() => {
|
||||
editable_userdata.enabled = !editable_userdata.enabled;
|
||||
}}
|
||||
name="enabled"
|
||||
type="checkbox"
|
||||
checked={editable_userdata.enabled}
|
||||
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded"
|
||||
/>
|
||||
{$_("set-the-user-active-inactive")}
|
||||
</p>
|
||||
</div>
|
||||
<div class="text-sm w-full mt-2">
|
||||
<label for="firstname" class="font-semibold text-gray-700"
|
||||
>{$_("first-name")}</label
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("first-name")}
|
||||
type="text"
|
||||
bind:value={editable_userdata.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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
<!-- <div class="text-sm w-full mt-2">
|
||||
<label for="middlename" class="font-semibold text-gray-700"
|
||||
>{$_("middle-name")}</label
|
||||
>
|
||||
@ -241,99 +223,99 @@
|
||||
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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div> -->
|
||||
<div class="text-sm w-full mt-2">
|
||||
<label for="lastname" class="font-semibold text-gray-700"
|
||||
>{$_("last-name")}</label
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("last-name")}
|
||||
type="text"
|
||||
bind:value={editable_userdata.lastname}
|
||||
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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
<div class="text-sm w-full mt-2">
|
||||
<label for="email" class="font-semibold text-gray-700"
|
||||
>{$_("e-mail-adress")}</label
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("e-mail-adress")}
|
||||
type="email"
|
||||
bind:value={editable_userdata.email}
|
||||
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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
{#if !isEmail(editable_userdata.email)}
|
||||
<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 class="text-sm w-full mt-2">
|
||||
<label for="username" class="font-semibold text-gray-700"
|
||||
>{$_("username")}</label
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("username")}
|
||||
type="text"
|
||||
bind:value={editable_userdata.username}
|
||||
name="username"
|
||||
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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
<div class="text-sm w-full mt-2">
|
||||
<span class="font-medium">{$_("groups")}</span>
|
||||
<!-- svelte-ignore a11y-no-onchange -->
|
||||
<select
|
||||
bind:value={usergroups_array}
|
||||
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-neutral-800 rounded-md p-2"
|
||||
multiple
|
||||
>
|
||||
{#each allgroups as g}
|
||||
{#if usergroups_array.includes(g.id)}
|
||||
<option selected value={g.id}>{g.name}</option>
|
||||
{:else}
|
||||
<option value={g.id}>{g.name}</option>
|
||||
{/if}
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
<div class="text-sm w-full mt-8">
|
||||
<p class="font-medium mb-4">
|
||||
{$_("permissions")}
|
||||
<a
|
||||
class="px-4 py-2 bg-gray-500 rounded-md text-white"
|
||||
href="/users/{params.userid}/permissions/">{$_("edit-permissions")}</a
|
||||
>
|
||||
</p>
|
||||
<div class="w-full sm:my-px sm:px-px sm:w-1/2">
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("search-for-permission")}
|
||||
type="text"
|
||||
bind:value={search_permission}
|
||||
class="mt-4 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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
{#each original_data.permissions as p}
|
||||
{#if p.toLowerCase().includes(search_permission.toLowerCase())}
|
||||
<span
|
||||
style="background:{matched_colors[
|
||||
p.split(':')[0]
|
||||
][0]};color:{matched_colors[p.split(':')[0]][1]};"
|
||||
class="mt-1 inline-flex items-center justify-center px-2 py-1 text-xs font-bold leading-none text-indigo-100 rounded"
|
||||
>{p}</span
|
||||
>
|
||||
<!-- -->
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
<div class="text-sm w-full mt-2">
|
||||
<label for="lastname" class="font-semibold text-gray-700"
|
||||
>{$_("last-name")}</label
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("last-name")}
|
||||
type="text"
|
||||
bind:value={editable_userdata.lastname}
|
||||
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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
<div class="text-sm w-full mt-2">
|
||||
<label for="email" class="font-semibold text-gray-700"
|
||||
>{$_("e-mail-adress")}</label
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("e-mail-adress")}
|
||||
type="email"
|
||||
bind:value={editable_userdata.email}
|
||||
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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
{#if !isEmail(editable_userdata.email)}
|
||||
<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 class="text-sm w-full mt-2">
|
||||
<label for="username" class="font-semibold text-gray-700"
|
||||
>{$_("username")}</label
|
||||
>
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("username")}
|
||||
type="text"
|
||||
bind:value={editable_userdata.username}
|
||||
name="username"
|
||||
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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
<div class="text-sm w-full mt-2">
|
||||
<span class="font-semibold">{$_("groups")}</span>
|
||||
<!-- svelte-ignore a11y-no-onchange -->
|
||||
<select
|
||||
bind:value={usergroups_array}
|
||||
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-neutral-800 rounded-md p-2"
|
||||
multiple
|
||||
>
|
||||
{#each allgroups as g}
|
||||
{#if usergroups_array.includes(g.id)}
|
||||
<option selected value={g.id}>{g.name}</option>
|
||||
{:else}
|
||||
<option value={g.id}>{g.name}</option>
|
||||
{/if}
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
<div class="text-sm w-full mt-8">
|
||||
<p class="font-medium mb-4">
|
||||
{$_("permissions")}
|
||||
<a
|
||||
class="px-4 py-2 bg-gray-500 rounded-md text-white"
|
||||
href="/users/{params.userid}/permissions/">{$_("edit-permissions")}</a
|
||||
>
|
||||
</p>
|
||||
<div class="w-full sm:my-px sm:px-px sm:w-1/2">
|
||||
<input
|
||||
autocomplete="off"
|
||||
placeholder={$_("search-for-permission")}
|
||||
type="text"
|
||||
bind:value={search_permission}
|
||||
class="mt-4 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-neutral-800 rounded-md p-2"
|
||||
/>
|
||||
</div>
|
||||
{#each original_data.permissions as p}
|
||||
{#if p.toLowerCase().includes(search_permission.toLowerCase())}
|
||||
<span
|
||||
style="background:{matched_colors[
|
||||
p.split(':')[0]
|
||||
][0]};color:{matched_colors[p.split(':')[0]][1]};"
|
||||
class="mt-1 inline-flex items-center justify-center px-2 py-1 text-xs font-bold leading-none text-indigo-100 rounded"
|
||||
>{p}</span
|
||||
>
|
||||
<!-- -->
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
{:catch error}
|
||||
<PromiseError {error} />
|
||||
<PromiseError {error} />
|
||||
{/await}
|
||||
|
@ -138,7 +138,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-8 text-3xl font-extrabold">
|
||||
<div class="mb-4 text-3xl font-extrabold">
|
||||
{$_("permissions")}:
|
||||
{original_data.firstname}
|
||||
{original_data.middlename || ""}
|
||||
|
1022
src/locales/de.json
1022
src/locales/de.json
File diff suppressed because it is too large
Load Diff
1022
src/locales/en.json
1022
src/locales/en.json
File diff suppressed because it is too large
Load Diff
12
src/main.js
12
src/main.js
@ -1,11 +1,11 @@
|
||||
import "./style.css";
|
||||
import App from "./App.svelte";
|
||||
import '@fontsource/athiti/200.css';
|
||||
import '@fontsource/athiti/300.css';
|
||||
import '@fontsource/athiti/400.css';
|
||||
import '@fontsource/athiti/500.css';
|
||||
import '@fontsource/athiti/600.css';
|
||||
import '@fontsource/athiti/700.css';
|
||||
import "@fontsource/athiti/200.css";
|
||||
import "@fontsource/athiti/300.css";
|
||||
import "@fontsource/athiti/400.css";
|
||||
import "@fontsource/athiti/500.css";
|
||||
import "@fontsource/athiti/600.css";
|
||||
import "@fontsource/athiti/700.css";
|
||||
|
||||
const app = new App({
|
||||
target: document.body,
|
||||
|
@ -1,10 +1,10 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
.activenav {
|
||||
@apply bg-gray-300;
|
||||
@apply text-black;
|
||||
@apply bg-gray-300;
|
||||
@apply text-black;
|
||||
}
|
||||
*{
|
||||
font-family: Athiti;
|
||||
* {
|
||||
font-family: Athiti;
|
||||
}
|
||||
@tailwind utilities;
|
||||
|
@ -1,10 +1,10 @@
|
||||
import fs from "fs";
|
||||
const packagejson = JSON.parse(
|
||||
fs.readFileSync(`./package.json`, { encoding: "utf-8" })
|
||||
fs.readFileSync(`./package.json`, { encoding: "utf-8" }),
|
||||
);
|
||||
const original = fs.readFileSync(`./index.html`, { encoding: "utf-8" });
|
||||
let out = original.replace(
|
||||
/RELEASE_INFO-(\S)+-RELEASE_INFO/gi,
|
||||
"RELEASE_INFO-" + packagejson.version + "-RELEASE_INFO"
|
||||
"RELEASE_INFO-" + packagejson.version + "-RELEASE_INFO",
|
||||
);
|
||||
fs.writeFileSync(`./index.html`, out);
|
||||
|
Loading…
x
Reference in New Issue
Block a user