This commit is contained in:
Alex
2025-01-29 16:02:37 +01:00
parent f68ca9abc5
commit c2d5188765
8 changed files with 1632 additions and 1535 deletions

2
frontend/.gitignore vendored
View File

@@ -35,3 +35,5 @@ Thumbs.db
!vite.config.js # Vite configuration
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
!src/**

View File

@@ -1,304 +1,338 @@
<script>
import { createEventDispatcher } from "svelte";
import { t } from "svelte-i18n";
import { createEventDispatcher } from 'svelte';
import { t } from 'svelte-i18n';
/** @type {string} */
export let name;
/** @type {string} */
export let name;
/** @type {string} */
export let type = "text";
/** @type {string} */
export let type = 'text';
/** @type {string|Number|null} */
export let value;
/** @type {string|Number|null} */
export let value;
/** @type {string} */
export let placeholder = "";
/** @type {string} */
export let placeholder = '';
/** @type {Number} */
export let rows = 4;
/** @type {Number} */
export let rows = 4;
/** @type {Array<{value: string | number, label: string, color?:string}>} */
export let options = [];
/** @type {Array<{value: string | number, label: string, color?:string}>} */
export let options = [];
/** @type {Boolean} */
export let required = false;
/** @type {Boolean} */
export let required = false;
/** @type {string} */
export let label = "";
/** @type {string} */
export let label = '';
/** @type {string} */
export let otherPasswordValue = "";
/** @type {string} */
export let otherPasswordValue = '';
/** @type {boolean} */
export let toUpperCase = false;
/** @type {boolean} */
export let toUpperCase = false;
/** @type {boolean} */
export let checked = false;
/** @type {boolean} */
export let checked = false;
/** @type {boolean} */
export let readonly = false;
/** @type {boolean} */
export let readonly = false;
/**
* @param {Event} event - The input event
*/
function handleInput(event) {
const target = event.target;
/**
* @param {Event} event - The input event
*/
function handleInput(event) {
const target = event.target;
if (target instanceof HTMLInputElement) {
let inputValue = target.value;
if (toUpperCase) {
inputValue = inputValue.toUpperCase();
target.value = inputValue; // Update the input field value
}
value = inputValue;
}
}
if (target instanceof HTMLInputElement) {
let inputValue = target.value;
if (toUpperCase) {
inputValue = inputValue.toUpperCase();
target.value = inputValue; // Update the input field value
}
value = inputValue;
}
}
/**
* Validates the field
* @param {string} name - The name of the field
* @param {string|Number|null} value - The value of the field
* @param {Boolean} required - The requirements of the field
* @returns {string|null} The error message or null if valid
*/
function validateField(name, value, required) {
if (
value === null ||
(typeof value === "string" && !value.trim() && !required)
)
return null;
switch (name) {
case "membership_start_date":
return typeof value === "string" && value.trim()
? null
: $t("validation.date");
case "email":
return typeof value === "string" && /^\S+@\S+\.\S+$/.test(value)
? null
: $t("validation.email");
case "password":
case "password2":
if (typeof value === "string" && value.length < 8) {
return $t("validation.password");
}
if (otherPasswordValue && value !== otherPasswordValue) {
return $t("validation.password_match");
}
return null;
case "phone":
return typeof value === "string" && /^\+?[0-9\s()-]{7,}$/.test(value)
? null
: $t("validation.phone");
case "zip_code":
return typeof value === "string" && /^\d{5}$/.test(value)
? null
: $t("validation.zip_code");
case "iban":
return typeof value === "string" &&
/^[A-Z]{2}\d{2}[A-Z0-9]{1,30}$/.test(value)
? null
: $t("validation.iban");
case "bic":
return typeof value === "string" &&
/^[A-Z]{6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3})?$/.test(value)
? null
: $t("validation.bic");
case "licence_number":
return typeof value === "string" && value.length == 11
? null
: $t("validation.licence");
/**
* Validates the field
* @param {string} name - The name of the field
* @param {string|Number|null} value - The value of the field
* @param {Boolean} required - The requirements of the field
* @returns {string|null} The error message or null if valid
*/
function validateField(name, value, required) {
if (value === null || (typeof value === 'string' && !value.trim() && !required)) return null;
switch (name) {
case 'membership_start_date':
return typeof value === 'string' && value.trim() ? null : $t('validation.date');
case 'email':
return typeof value === 'string' && /^\S+@\S+\.\S+$/.test(value)
? null
: $t('validation.email');
case 'password':
case 'password2':
if (typeof value === 'string' && value.length < 8) {
return $t('validation.password');
}
if (otherPasswordValue && value !== otherPasswordValue) {
return $t('validation.password_match');
}
return null;
case 'phone':
return typeof value === 'string' && /^\+?[0-9\s()-]{7,}$/.test(value)
? null
: $t('validation.phone');
case 'zip_code':
return typeof value === 'string' && /^\d{5}$/.test(value)
? null
: $t('validation.zip_code');
case 'iban':
return typeof value === 'string' && /^[A-Z]{2}\d{2}[A-Z0-9]{1,30}$/.test(value)
? null
: $t('validation.iban');
case 'bic':
return typeof value === 'string' &&
/^[A-Z]{6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3})?$/.test(value)
? null
: $t('validation.bic');
case 'licence_number':
return typeof value === 'string' && value.length == 11 ? null : $t('validation.licence');
default:
return typeof value === "string" && !value.trim() && required
? $t("validation.required")
: null;
}
}
default:
return typeof value === 'string' && !value.trim() && required
? $t('validation.required')
: null;
}
}
$: error = validateField(name, value, required);
$: selectedOption = options.find((option) => option.value == value);
$: selectedColor = selectedOption ? selectedOption.color : "";
$: error = validateField(name, value, required);
$: selectedOption = options.find((option) => option.value == value);
$: selectedColor = selectedOption ? selectedOption.color : '';
</script>
<div class="input-box {type === 'checkbox' ? 'checkbox-container' : ''}">
{#if type === "checkbox"}
<label class="form-control {readonly ? 'form-control--disabled' : ''}">
<input
type="checkbox"
{name}
{value}
{checked}
{readonly}
on:change={() => (checked = !checked)}
/>
<span class="checkbox-text"> {label} </span>
</label>
{:else}
<span class="label">{label}</span>
{/if}
<div class="input-error-container">
{#if error}
<span class="error-message">{error}</span>
{/if}
{#if type === "select"}
<select
{name}
bind:value
{required}
class="input select"
style={selectedColor ? `color: ${selectedColor};` : ""}
>
{#each options as option}
<option value={option.value}>{option.label}</option>
{/each}
</select>
{:else if type === "textarea"}
<textarea
{name}
{placeholder}
{required}
{value}
{readonly}
{rows}
class="input textarea {readonly ? 'readonly' : ''}"
style="height:{rows * 1.5}em;"
/>
{:else if type != "checkbox"}
<input
{name}
{type}
{placeholder}
{readonly}
{value}
{required}
on:input={handleInput}
on:blur={handleInput}
class="input {readonly ? 'readonly' : ''}"
/>
{/if}
</div>
{#if type === 'checkbox'}
<label class="form-control {readonly ? 'form-control--disabled' : ''}">
<input
type="checkbox"
{name}
{value}
{checked}
{readonly}
on:change={() => (checked = !checked)}
/>
<span class="checkbox-text"> {label} </span>
</label>
{:else}
<span class="label">{label}</span>
{/if}
<div class="input-error-container">
{#if error}
<span class="error-message">{error}</span>
{/if}
{#if type === 'select'}
<select
{name}
bind:value
{required}
class="input select"
style={selectedColor ? `color: ${selectedColor};` : ''}
>
{#each options as option}
<option value={option.value}>{option.label}</option>
{/each}
</select>
{:else if type === 'textarea'}
<textarea
{name}
{placeholder}
{required}
{value}
{readonly}
{rows}
class="input textarea {readonly ? 'readonly' : ''}"
style="height:{rows * 1.5}em;"
></textarea>
{:else if type != 'checkbox'}
<input
{name}
{type}
{placeholder}
{readonly}
{value}
{required}
on:input={handleInput}
on:blur={handleInput}
class="input {readonly ? 'readonly' : ''}"
/>
{/if}
</div>
</div>
<style>
:root {
--form-control-color: #6bff55;
--form-control-disabled: #959495;
}
:root {
--form-control-color: var(--green); /* Changed from #6bff55 */
--form-control-disabled: var(--overlay0); /* Changed from #959495 */
}
.form-control {
font-size: 1rem;
font-weight: bold;
line-height: 1.1;
display: grid;
grid-template-columns: 1.5em auto;
gap: 0.75em;
align-items: center;
opacity: 0.8;
}
.form-control {
font-size: 1rem;
font-weight: bold;
line-height: 1.1;
display: grid;
grid-template-columns: 1.5em auto;
gap: 0.75em;
align-items: center;
opacity: 0.8;
color: var(--text);
}
.form-control--disabled {
color: var(--form-control-disabled);
cursor: not-allowed;
}
.form-control--disabled {
color: var(--form-control-disabled);
cursor: not-allowed;
}
input[type="checkbox"] {
-webkit-appearance: none;
appearance: none;
background-color: var(--form-background);
margin: 0;
font: inherit;
color: currentColor;
width: 1.75em;
height: 1.75em;
border: 0.15em solid currentColor;
border-radius: 0.5em;
transform: translateY(-0.075em);
display: grid;
place-content: center;
transition: transform 0.2s ease-in-out;
}
input[type='checkbox'] {
-webkit-appearance: none;
appearance: none;
background-color: var(--surface0);
margin: 0;
font: inherit;
color: var(--text);
width: 1.75em;
height: 1.75em;
border: 0.15em solid var(--overlay0);
border-radius: 0.5em;
transform: translateY(-0.075em);
display: grid;
place-content: center;
transition: transform 0.2s ease-in-out;
}
input[type="checkbox"]::before {
content: "";
width: 1em;
height: 1em;
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
transform: scale(0);
transform-origin: bottom left;
transition: 120ms transform ease-in-out;
box-shadow: inset 1em 1em var(--form-control-color);
background-color: CanvasText;
}
input[type='checkbox']::before {
content: '';
width: 1em;
height: 1em;
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
transform: scale(0);
transform-origin: bottom left;
transition: 120ms transform ease-in-out;
box-shadow: inset 1em 1em var(--form-control-color);
background-color: var(--crust);
}
input[type="checkbox"]:checked::before {
transform: scale(1);
}
input[type='checkbox']:checked::before {
transform: scale(1);
}
input[type="checkbox"]:hover {
outline: max(2px, 0.15em) solid currentColor;
outline-offset: max(2px, 0.15em);
transform: scale(1.3);
}
input[type='checkbox']:hover {
outline: max(2px, 0.15em) solid var(--lavender);
outline-offset: max(2px, 0.15em);
transform: scale(1.3);
}
input[type="checkbox"]:disabled {
--form-control-color: var(--form-control-disabled);
color: var(--form-control-disabled);
cursor: not-allowed;
}
.readonly {
background-color: #ececec;
cursor: not-allowed;
opacity: 0.7;
color: #4f4f4f;
}
input[type='checkbox']:disabled {
--form-control-color: var(--form-control-disabled);
color: var(--form-control-disabled);
cursor: not-allowed;
}
.readonly {
background-color: var(--surface0);
cursor: not-allowed;
opacity: 0.7;
color: var(--overlay1);
}
.checkbox-container {
display: inline-flex;
align-items: center;
background-color: transparent;
}
.checkbox-container {
display: inline-flex;
align-items: center;
background-color: transparent;
margin: 0.5rem 0;
}
.checkbox-text {
font-size: 16px;
}
.checkbox-text {
font-size: 16px;
color: var(--text);
}
@media (min-width: 768px) {
.checkbox-text {
flex-direction: row;
align-items: center;
}
}
.select {
padding-right: 1.5em;
}
.input-error-container {
display: flex;
align-items: flex-end;
width: 100%;
max-width: 444px;
}
@media (min-width: 768px) {
.checkbox-text {
flex-direction: row;
align-items: center;
}
}
.select {
padding-right: 1.5em;
background-color: var(--surface0);
}
.input-error-container {
display: flex;
flex-direction: column;
gap: 0.5rem;
width: 100%;
max-width: 444px;
}
.error-message {
color: #eb5424;
font-size: 12px;
margin-bottom: 5px;
align-self: flex-start;
}
.error-message {
color: var(--red); /* Changed from #eb5424 */
font-size: 12px;
margin-bottom: 5px;
align-self: flex-start;
}
.input {
width: 100%;
}
input,
textarea,
select {
width: 100%;
padding: 0.5rem;
border: 1px solid #ccc;
border-radius: 4px;
color: white;
}
textarea {
resize: vertical;
min-height: 100px;
}
.input {
width: 100%;
margin: 0.5rem 0;
}
input,
textarea,
select {
width: 100%;
padding: 0.75rem 0;
background-color: var(--surface0);
border: 1px solid var(--overlay0);
border-radius: 6px;
color: var(--text);
transition: border-color 0.2s ease-in-out;
}
input:focus,
textarea:focus,
select:focus {
outline: none;
border-color: var(--lavender);
}
input:hover:not(:disabled),
textarea:hover:not(:disabled),
select:hover:not(:disabled) {
border-color: var(--overlay2);
}
textarea {
resize: vertical;
min-height: 100px;
}
/* Add consistent spacing between input boxes */
.input-box {
margin: 1rem 0;
padding: 0.5rem;
background-color: var(--surface0);
border-radius: 6px;
}
.input-box .label {
display: block;
margin-bottom: 0.5rem;
color: var(--lavender);
font-weight: 500;
}
/* Style select dropdown */
select option {
background-color: var(--base);
color: var(--text);
padding: 0.5rem;
}
</style>

View File

@@ -1,128 +1,155 @@
<script>
import { quintOut } from "svelte/easing";
import { quintOut } from 'svelte/easing';
import { t } from "svelte-i18n";
import { createEventDispatcher } from "svelte";
import { t } from 'svelte-i18n';
import { createEventDispatcher } from 'svelte';
const modal = (/** @type {Element} */ node, { duration = 300 } = {}) => {
const transform = getComputedStyle(node).transform;
const modal = (/** @type {Element} */ node, { duration = 300 } = {}) => {
const transform = getComputedStyle(node).transform;
return {
duration,
easing: quintOut,
css: (/** @type {any} */ t, /** @type {number} */ u) => {
return `transform:
return {
duration,
easing: quintOut,
css: (/** @type {any} */ t, /** @type {number} */ u) => {
return `transform:
${transform}
scale(${t})
translateY(${u * -100}%)
`;
},
};
};
}
};
};
const dispatch = createEventDispatcher();
function closeModal() {
dispatch("close", {});
}
const dispatch = createEventDispatcher();
function closeModal() {
dispatch('close', {});
}
</script>
<div class="modal-background">
<div
transition:modal|global={{ duration: 1000 }}
class="modal"
role="dialog"
aria-modal="true"
>
<!-- svelte-ignore a11y-missing-attribute -->
<a
title={$t("cancel")}
class="modal-close"
on:click={closeModal}
role="button"
tabindex="0"
on:keydown={(e) => e.key == "Enter" && closeModal()}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 384 512"
aria-hidden="true"
>
<path
d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
/>
</svg>
<span class="sr-only">{$t("cancel")}</span>
</a>
<div class="container">
<slot />
</div>
</div>
<div transition:modal|global={{ duration: 1000 }} class="modal" role="dialog" aria-modal="true">
<!-- svelte-ignore a11y-missing-attribute -->
<a
title={$t('cancel')}
class="modal-close"
on:click={closeModal}
role="button"
tabindex="0"
on:keydown={(e) => e.key == 'Enter' && closeModal()}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 384 512"
aria-hidden="true"
>
<path
d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
/>
</svg>
<span class="sr-only">{$t('cancel')}</span>
</a>
<div class="container">
<slot />
</div>
</div>
</div>
<style>
.modal-background {
width: 100%;
height: 100%;
position: fixed;
top: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.9);
z-index: 9999;
display: flex;
}
.modal-background {
width: 100%;
height: 100%;
position: fixed;
top: 0;
right: 0;
bottom: 0;
background: rgba(30, 30, 46, 0.65); /* var(--base) with 0.75 opacity */
backdrop-filter: blur(4px); /* Optional: adds a slight blur effect */
z-index: 9999;
display: flex;
}
.modal {
position: relative;
left: 50%;
top: 50%;
width: 70%;
box-shadow: 0 0 10px hsl(0 0% 0% / 10%);
transform: translate(-50%, -50%);
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
@media (max-width: 990px) {
.modal {
width: 90%;
}
}
.modal-close {
border: none;
}
.modal {
position: relative;
left: 50%;
top: 50%;
width: 70%;
background-color: var(--base);
border: 1px solid var(--surface0);
border-radius: 8px;
box-shadow: 0 4px 20px rgba(17, 17, 27, 0.5); /* var(--crust) with opacity */
transform: translate(-50%, -50%);
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
@media (max-width: 990px) {
.modal {
width: 90%;
}
}
.modal-close {
border: none;
padding: 1rem;
cursor: pointer;
position: absolute;
right: 0;
top: 0;
}
.modal-close svg {
display: block;
margin-left: auto;
margin-right: auto;
fill: rgb(14 165 233 /1);
transition: all 0.5s;
}
.modal-close:hover svg {
fill: rgb(225 29 72);
transform: scale(1.5);
}
.modal .container {
max-height: 90vh;
overflow-y: auto;
align-items: center;
}
@media (min-width: 680px) {
.modal .container {
flex-direction: column;
left: 0;
width: 100%;
}
}
.modal-close svg {
display: block;
margin-left: auto;
margin-right: auto;
transition: all 0.3s ease-in-out;
fill: var(--blue); /* Using Catppuccin blue */
}
.modal-close:hover svg {
fill: var(--red); /* Using Catppuccin red */
transform: scale(1.2);
}
.modal .container {
max-height: 90vh;
overflow-y: auto;
align-items: center;
padding: 2rem;
background-color: var(--base);
border-radius: 8px;
}
/* Scrollbar styling */
.modal .container::-webkit-scrollbar {
width: 8px;
}
.modal .container::-webkit-scrollbar-track {
background: var(--surface0);
border-radius: 4px;
}
.modal .container::-webkit-scrollbar-thumb {
background: var(--surface2);
border-radius: 4px;
}
.modal .container::-webkit-scrollbar-thumb:hover {
background: var(--surface1);
}
@media (min-width: 680px) {
.modal .container {
flex-direction: column;
left: 0;
width: 100%;
}
}
</style>

View File

@@ -1,24 +1,24 @@
<script>
/** @type {number | null} */
export let width;
/** @type {string | null} */
export let message;
/** @type {number | null} */
export let width;
/** @type {string | null} */
export let message;
</script>
<div class="loading">
<p class="simple-loader" style={width ? `width: ${width}px` : ""} />
{#if message}
<p>{message}</p>
{/if}
<p class="simple-loader" style={width ? `width: ${width}px` : ''}></p>
{#if message}
<p>{message}</p>
{/if}
</div>
<style>
.loading {
display: flex;
align-items: center;
justify-content: center;
}
.loading p {
margin-left: 0.5rem;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
}
.loading p {
margin-left: 0.5rem;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -1,46 +1,75 @@
:root {
--rosewater: #f5e0dc;
--flamingo: #f2cdcd;
--pink: #f5c2e7;
--mauve: #cba6f7;
--red: #f38ba8;
--maroon: #eba0ac;
--peach: #fab387;
--yellow: #f9e2af;
--green: #a6e3a1;
--teal: #94e2d5;
--sky: #89dceb;
--sapphire: #74c7ec;
--blue: #89b4fa;
--lavender: #b4befe;
--text: #cdd6f4;
--subtext1: #bac2de;
--subtext0: #a6adc8;
--overlay2: #9399b2;
--overlay1: #7f849c;
--overlay0: #6c7086;
--surface2: #585b70;
--surface1: #45475a;
--surface0: #313244;
--base: #1e1e2e;
--mantle: #181825;
--crust: #11111b;
}
@font-face {
font-family: "Roboto Mono";
font-style: normal;
font-weight: 300;
src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_gPq_ROW9.ttf)
format("truetype");
font-family: 'Roboto Mono';
font-style: normal;
font-weight: 300;
src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_gPq_ROW9.ttf)
format('truetype');
}
@font-face {
font-family: "Roboto Mono";
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_ROW9.ttf)
format("truetype");
font-family: 'Roboto Mono';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/robotomono/v22/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vq_ROW9.ttf)
format('truetype');
}
html {
padding: 0 30px;
background-color: black;
color: #9b9b9b;
font-family: "Quicksand", sans-serif;
font-size: 16px;
font-weight: normal;
padding: 0 30px;
background-color: var(--base);
color: var(--text);
font-family: 'Quicksand', sans-serif;
font-size: 16px;
font-weight: normal;
}
body {
max-width: 1200px;
margin: 5em auto 0 auto;
max-width: 1200px;
margin: 5em auto 0 auto;
}
pre,
code {
display: inline;
font-family: "Roboto Mono", monospace;
font-size: 16px;
display: inline;
font-family: 'Roboto Mono', monospace;
font-size: 16px;
}
input {
font-family: "Roboto Mono", monospace;
color: white;
border-style: none;
height: 21px;
font-size: 16px;
font-family: 'Roboto Mono', monospace;
color: var(--text);
border-style: none;
height: 21px;
font-size: 16px;
}
button {
font-size: 16px;
font-size: 16px;
}
h1,
h2,
@@ -48,506 +77,514 @@ h3,
h4,
h5,
h6 {
margin: 0;
font-weight: normal;
margin: 0;
font-weight: normal;
}
h2 {
margin: 0 0 45px 0;
color: #fff;
font-size: 36px;
margin: 0 0 45px 0;
color: var(--lavender);
font-size: 36px;
}
h3 {
margin: 0 0 2rem 0;
color: #fff;
font-size: 32px;
margin: 0 0 2rem 0;
color: var(--lavender);
font-size: 32px;
}
p {
margin: 0 0 45px;
line-height: 1.8;
margin: 0 0 45px;
line-height: 1.8;
}
ul {
margin: 0 0 32px;
margin: 0 0 32px;
}
a {
transition: border 0.2s ease-in-out;
border-bottom: 1px solid transparent;
text-decoration: none;
color: #00b7ef;
transition: border 0.2s ease-in-out;
border-bottom: 1px solid transparent;
text-decoration: none;
color: var(--blue);
}
a:hover {
border-bottom-color: #00b7ef;
border-bottom-color: var(--blue);
}
li {
line-height: 1.8;
line-height: 1.8;
}
li strong {
color: #fff;
color: var(--text);
}
.image {
width: 100%;
margin: 0 0 32px;
padding: 0;
width: 100%;
margin: 0 0 32px;
padding: 0;
}
.image img {
width: 100%;
width: 100%;
}
.optanon-alert-box-wrapper {
left: 0;
left: 0;
}
.hidden {
display: none !important;
display: none !important;
}
.hide-mobile {
display: none;
display: none;
}
@media (min-width: 680px) {
body {
margin: 8em auto 0 auto;
}
.hide-mobile {
display: initial;
}
body {
margin: 8em auto 0 auto;
}
.hide-mobile {
display: initial;
}
}
.header {
position: fixed;
top: 0;
left: 0;
z-index: 1;
box-sizing: border-box;
width: 100%;
padding: 3em 0 0;
background: black;
position: fixed;
top: 0;
left: 0;
z-index: 1;
box-sizing: border-box;
width: 100%;
padding: 3em 0 0;
background: var(--base);
}
.header.top-banner-open {
margin-top: 5px;
transition: all 0.2s linear;
margin-top: 5px;
transition: all 0.2s linear;
}
.header .header-container {
width: 100%;
max-width: calc(1200px + 10em);
height: 5em;
display: flex;
flex-direction: column;
align-items: center;
margin: 0 auto;
width: 100%;
max-width: calc(1200px + 10em);
height: 5em;
display: flex;
flex-direction: column;
align-items: center;
margin: 0 auto;
background-color: var(--base);
}
.header .header-container .header-left {
display: flex;
flex-grow: 1;
display: flex;
flex-grow: 1;
}
.header .header-container .header-left .header-crafted-by-container {
font-size: 18px;
font-weight: 300;
font-size: 18px;
font-weight: 300;
}
.header .header-container .header-left .header-crafted-by-container a {
display: flex;
color: #9b9b9b;
border: none;
display: flex;
color: var(--subtext0);
border: none;
}
.header .header-container .header-left .header-crafted-by-container a img {
height: 28px;
height: 28px;
}
.header .header-container .header-left .header-crafted-by-container a span {
display: inline-block;
margin: 2px 1ch 0 0;
display: inline-block;
margin: 2px 1ch 0 0;
}
.header .header-container .header-left .header-crafted-by-container .auth0 {
margin-left: 1ch;
color: #fff;
font-weight: bold;
margin-left: 1ch;
color: var(--text);
font-weight: bold;
}
.header .header-container .header-right {
display: flex;
flex-grow: 1;
justify-content: space-between;
letter-spacing: 1px;
font-weight: 500;
display: flex;
flex-grow: 1;
justify-content: space-between;
letter-spacing: 1px;
font-weight: 500;
}
.header .header-container .header-right .header-nav-item {
text-transform: uppercase;
margin-left: 10px;
text-transform: uppercase;
margin-left: 10px;
}
.header .header-container .header-right .header-nav-item button {
all: unset;
cursor: pointer;
all: unset;
cursor: pointer;
}
.header .header-container .header-right .header-nav-item.active a,
.header .header-container .header-right .header-nav-item.active button {
color: #fff;
color: var(--text);
}
.header .header-container .header-right a img {
margin-top: -0.4rem;
height: 28px;
margin-top: -0.4rem;
height: 28px;
}
.header .header-container .header-right .header-nav-item a,
.header .header-container .header-right .header-nav-item button {
transition: color 0.3s ease-in-out;
display: block;
padding: 20px 0;
border: none;
color: #9b9b9b;
transition: color 0.3s ease-in-out;
display: block;
padding: 20px 0;
border: none;
color: var(--subtext0);
}
.header .header-container .header-right .header-nav-item:hover a,
.header .header-container .header-right .header-nav-item:hover button {
color: #fdfff5;
color: var(--lavender);
}
@media (min-width: 680px) {
.header {
padding: 3em 5rem 0;
}
.header.top-banner-open {
margin-top: 48px;
}
.header .header-container {
flex-direction: row;
}
.header .header-container .header-right {
justify-content: flex-end;
}
.header .header-container .header-right .header-nav-item {
margin-left: 26px;
}
.header {
padding: 3em 5rem 0;
}
.header.top-banner-open {
margin-top: 48px;
}
.header .header-container {
flex-direction: row;
}
.header .header-container .header-right {
justify-content: flex-end;
}
.header .header-container .header-right .header-nav-item {
margin-left: 26px;
}
}
.button-dark {
transition: border-color 0.3s ease-in-out, background-color 0.3s ease-in-out;
color: white;
text-transform: uppercase;
font-weight: 500;
padding: 18px 28px;
letter-spacing: 1px;
cursor: pointer;
background-color: transparent;
border: 1px solid #595b5c;
margin: 2px;
transition:
border-color 0.3s ease-in-out,
background-color 0.3s ease-in-out;
color: white;
text-transform: uppercase;
font-weight: 500;
padding: 18px 28px;
letter-spacing: 1px;
cursor: pointer;
background-color: transparent;
border: 1px solid var(--surface1);
margin: 2px;
}
.button-dark:hover {
border-color: #fff;
border-color: var(--text);
}
.button-colorful {
transition: border-color 0.3s ease-in-out, background-color 0.3s ease-in-out;
color: white;
text-transform: uppercase;
font-weight: 500;
padding: 18px 28px;
letter-spacing: 1px;
cursor: pointer;
background-color: #d43aff;
border: 1px solid #d43aff;
transition:
border-color 0.3s ease-in-out,
background-color 0.3s ease-in-out;
color: white;
text-transform: uppercase;
font-weight: 500;
padding: 18px 28px;
letter-spacing: 1px;
cursor: pointer;
background-color: var(--mauve);
border: 1px solid var(--mauve);
}
.button-colorful:hover {
background-color: #c907ff;
border-color: #c907ff;
background-color: #c907ff;
border-color: #c907ff;
}
.button-orange {
transition: border-color 0.3s ease-in-out, background-color 0.3s ease-in-out;
color: white;
text-transform: uppercase;
font-weight: 500;
padding: 18px 28px;
letter-spacing: 1px;
cursor: pointer;
background-color: #eb5424;
border: 1px solid #eb5424;
transition:
border-color 0.3s ease-in-out,
background-color 0.3s ease-in-out;
color: white;
text-transform: uppercase;
font-weight: 500;
padding: 18px 28px;
letter-spacing: 1px;
cursor: pointer;
background-color: var(--peach);
border: 1px solid var(--peach);
}
.button-orange:hover {
background-color: #ca3f12;
border-color: #ca3f12;
background-color: #ca3f12;
border-color: #ca3f12;
}
.button-colorful:disabled {
transition: border-color 0.3s ease-in-out, background-color 0.3s ease-in-out;
color: white;
text-transform: uppercase;
font-weight: 500;
padding: 18px 28px;
letter-spacing: 1px;
cursor: pointer;
background-color: #9a9a9a;
border: 1px solid #9a9a9a;
transition:
border-color 0.3s ease-in-out,
background-color 0.3s ease-in-out;
color: white;
text-transform: uppercase;
font-weight: 500;
padding: 18px 28px;
letter-spacing: 1px;
cursor: pointer;
background-color: var(--overlay0);
border: 1px solid var(--overlay0);
}
.hero-container {
max-width: 795px;
display: flex;
flex-direction: column;
align-items: center;
margin: 0 auto 70px auto;
max-width: 795px;
display: flex;
flex-direction: column;
align-items: center;
margin: 0 auto 70px auto;
}
.hero-container .hero-logo {
margin-top: 88px;
margin-bottom: 32px;
margin-top: 88px;
margin-bottom: 32px;
}
.hero-container .hero-subtitle {
font-size: 20px;
text-align: center;
line-height: 32px;
margin: 0 0 45px 0;
font-size: 20px;
text-align: center;
line-height: 32px;
margin: 0 0 45px 0;
}
.hero-container .hero-buttons-container {
display: flex;
display: flex;
}
.hero-container .hero-buttons-container button {
margin: 0 8px;
margin: 0 8px;
}
@media (min-width: 680px) {
.hero-container {
margin: 0 auto 140px auto;
}
.hero-container {
margin: 0 auto 140px auto;
}
}
.container {
transition: opacity 0.2s ease-in-out;
color: white;
letter-spacing: 0;
opacity: 1;
transition: opacity 0.2s ease-in-out;
color: white;
letter-spacing: 0;
opacity: 1;
}
.container .content {
width: 100%;
flex-grow: 1;
width: 100%;
flex-grow: 1;
}
.container .content .step-title {
color: #fff;
font-size: 20px;
font-weight: 500;
line-height: 86px;
opacity: 1;
color: #fff;
font-size: 20px;
font-weight: 500;
line-height: 86px;
opacity: 1;
}
.container .content .step-subtitle {
position: relative;
top: -5px;
font-size: 16px;
font-weight: 300;
position: relative;
top: -5px;
font-size: 16px;
font-weight: 300;
}
@media (max-width: 680px) {
.container .content {
margin-top: 120px;
}
.container .content {
margin-top: 120px;
}
}
@media (min-width: 680px) {
.container {
position: relative;
left: 100px;
display: flex;
width: calc(100% - 100px);
padding: 0;
}
.container .content {
max-width: 795px;
}
.container .content .step-title {
font-size: 36px;
}
.container {
position: relative;
left: 100px;
display: flex;
width: calc(100% - 100px);
padding: 0;
}
.container .content {
max-width: 795px;
}
.container .content .step-title {
font-size: 36px;
}
}
.input-box {
display: flex;
align-items: center;
justify-content: space-between;
margin: 10px 0;
padding: 10px;
width: 100%;
height: auto;
box-sizing: border-box;
background-color: #2f2f2f;
border-radius: 3px;
font-family: "Roboto Mono", monospace;
font-size: 13px;
display: flex;
align-items: center;
justify-content: space-between;
margin: 10px 0;
padding: 10px;
width: 100%;
height: auto;
box-sizing: border-box;
background-color: var(--surface0);
border-radius: 3px;
font-family: 'Roboto Mono', monospace;
font-size: 13px;
}
.input-box .label {
margin: 0 1ch 0 0;
font-size: 16px;
margin: 0 1ch 0 0;
font-size: 16px;
}
.input-box .input {
background-color: #494848;
border-radius: 6px;
outline: none;
border: 3px solid #494848;
width: 100%;
max-width: 444px;
font-size: 13px;
background-color: var(--surface1);
border: 3px solid var(--surface1);
border-radius: 6px;
outline: none;
width: 100%;
max-width: 444px;
font-size: 13px;
}
@media (min-width: 680px) {
.input-box {
padding: 10px;
}
.input-box {
padding: 10px;
}
}
.btn-container {
display: flex;
justify-content: space-between;
align-items: first baseline;
display: flex;
justify-content: space-between;
align-items: first baseline;
}
@media (max-width: 680px) {
.btn-container {
align-items: flex-start;
}
.btn-container p {
margin-left: 1rem;
}
.btn-container {
align-items: flex-start;
}
.btn-container p {
margin-left: 1rem;
}
}
.button-group {
display: flex;
gap: 0.5rem;
margin-top: 1rem;
display: flex;
gap: 0.5rem;
margin-top: 1rem;
}
.btn {
font-family: "Roboto Mono", monospace;
letter-spacing: 1px;
padding: 18px 28px;
border: 1px solid;
cursor: pointer;
display: flex;
align-items: center;
gap: 0.5rem;
transition: border-color 0.3s ease-in-out, background-color 0.3s ease-in-out;
border-radius: 5px;
font-family: 'Roboto Mono', monospace;
letter-spacing: 1px;
padding: 18px 28px;
border: 1px solid;
cursor: pointer;
display: flex;
align-items: center;
gap: 0.5rem;
transition:
border-color 0.3s ease-in-out,
background-color 0.3s ease-in-out;
border-radius: 5px;
}
.btn.primary {
background-color: #4361ee;
border-color: #4361ee;
color: white;
background-color: var(--blue);
border-color: var(--blue);
color: white;
}
.btn.primary:hover {
background-color: #3651d4;
border-color: #3651d4;
background-color: var(--sapphire);
border-color: var(--sapphire);
}
.btn.danger {
background-color: #dc2626;
border-color: #dc2626;
color: white;
background-color: var(--red);
border-color: var(--red);
color: white;
}
.btn.danger:hover {
background-color: #c51f1f;
border-color: #c51f1f;
background-color: var(--maroon);
border-color: var(--maroon);
}
.warning {
margin: 20px 0;
padding: 1rem;
width: 100%;
box-sizing: border-box;
background-color: rgb(255 228 230);
border: 1px solid rgb(225 29 72);
border-radius: 6px;
color: rgb(225 29 72);
font-size: 16px;
margin: 20px 0;
padding: 1rem;
width: 100%;
box-sizing: border-box;
background-color: var(--surface0);
border: 1px solid var(--red);
color: var(--red);
border-radius: 6px;
font-size: 16px;
}
.warning a {
color: rgb(225 29 72);
text-decoration: underline;
color: var(--red);
text-decoration: underline;
}
.warning.hidden {
display: none;
display: none;
}
.error {
margin-top: 10rem;
padding: 30px 40px;
background: #2f3132;
color: #fff;
margin-top: 10rem;
padding: 30px 40px;
background: var(--surface0);
color: var(--text);
}
.error p {
margin: 0 0 1rem;
margin: 0 0 1rem;
}
.error p.intro {
font-size: 1.3rem;
font-size: 1.3rem;
}
.error .button-colorful {
display: inline-block;
display: inline-block;
}
@media (min-width: 680px) {
.error {
padding: 65px 80px;
}
.error {
padding: 65px 80px;
}
}
.footer-branding-container {
color: white;
font-weight: 300;
margin-bottom: 73px;
color: white;
font-weight: 300;
margin-bottom: 73px;
}
.footer-branding-container .footer-branding {
display: flex;
width: 400px;
display: flex;
width: 400px;
}
.footer-branding-container .footer-branding {
flex-direction: column;
text-align: center;
margin: 30px 0 0;
flex-direction: column;
text-align: center;
margin: 30px 0 0;
}
.footer-branding-container .footer-branding .footer-crafted-by-container {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16px;
color: white;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16px;
color: white;
}
.footer-branding-container .footer-branding .footer-crafted-by-container span {
display: inline-block;
margin: 3px 1ch 0 0;
display: inline-block;
margin: 3px 1ch 0 0;
}
.footer-branding-container
.footer-branding
.footer-crafted-by-container
.footer-branded-crafted-img {
height: 28px;
.footer-branding
.footer-crafted-by-container
.footer-branded-crafted-img {
height: 28px;
}
.footer-branding-container .footer-branding .footer-copyright {
color: #696969;
letter-spacing: 0.5px;
color: #696969;
letter-spacing: 0.5px;
}
.footer-container {
width: 100%;
color: white;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
color: white;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
}
@media (min-width: 680px) {
.footer-container {
padding: 0;
}
.footer-container {
padding: 0;
}
}
.simple-loader {
--b: 20px; /* border thickness */
--n: 15; /* number of dashes*/
--g: 7deg; /* gap between dashes*/
--c: #d43aff; /* the color */
--b: 20px; /* border thickness */
--n: 15; /* number of dashes*/
--g: 7deg; /* gap between dashes*/
--c: var(--mauve); /* Changed loader color to match theme */
width: 40px; /* size */
aspect-ratio: 1;
border-radius: 50%;
padding: 1px; /* get rid of bad outlines */
background: conic-gradient(#0000, var(--c)) content-box;
--_m: /* we use +/-1deg between colors to avoid jagged edges */ repeating-conic-gradient(
#0000 0deg,
#000 1deg calc(360deg / var(--n) - var(--g) - 1deg),
#0000 calc(360deg / var(--n) - var(--g)) calc(360deg / var(--n))
),
radial-gradient(
farthest-side,
#0000 calc(98% - var(--b)),
#000 calc(100% - var(--b))
);
-webkit-mask: var(--_m);
mask: var(--_m);
-webkit-mask-composite: destination-in;
mask-composite: intersect;
animation: load 1s infinite steps(var(--n));
width: 40px; /* size */
aspect-ratio: 1;
border-radius: 50%;
padding: 1px; /* get rid of bad outlines */
background: conic-gradient(#0000, var(--c)) content-box;
--_m: /* we use +/-1deg between colors to avoid jagged edges */ repeating-conic-gradient(
#0000 0deg,
#000 1deg calc(360deg / var(--n) - var(--g) - 1deg),
#0000 calc(360deg / var(--n) - var(--g)) calc(360deg / var(--n))
),
radial-gradient(farthest-side, #0000 calc(98% - var(--b)), #000 calc(100% - var(--b)));
-webkit-mask: var(--_m);
mask: var(--_m);
-webkit-mask-composite: destination-in;
mask-composite: intersect;
animation: load 1s infinite steps(var(--n));
}
@keyframes load {
to {
transform: rotate(1turn);
}
to {
transform: rotate(1turn);
}
}

View File

@@ -1,156 +1,156 @@
<script>
import Modal from "$lib/components/Modal.svelte";
import UserEditForm from "$lib/components/UserEditForm.svelte";
import { onMount } from "svelte";
import { page } from "$app/stores";
import { t } from "svelte-i18n";
import Modal from '$lib/components/Modal.svelte';
import UserEditForm from '$lib/components/UserEditForm.svelte';
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { t } from 'svelte-i18n';
/** @type {import('./$types').ActionData} */
export let form;
/** @type {import('./$types').ActionData} */
export let form;
$: ({ user, licence_categories, subscriptions } = $page.data);
$: ({ user, licence_categories, subscriptions } = $page.data);
let showModal = false;
let showModal = false;
const open = () => (showModal = true);
const close = () => {
showModal = false;
if (form) {
form.errors = undefined;
}
};
const open = () => (showModal = true);
const close = () => {
showModal = false;
if (form) {
form.errors = undefined;
}
};
onMount(() => {
console.dir(user);
});
onMount(() => {
console.dir(user);
});
</script>
<div class="hero-container">
<div class="user-info">
{#if user.status}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Status:</span>
<span class="value block-value">
<span
>{$t(`userStatus.${user.status}`, {
default: "unknown status",
})}</span
>
<span
>{$t(`userRole.${user.role_id}`, { default: "unknown role" })}</span
>
</span>
</h3>
{/if}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Name:</span>
<span class="value">{`${user.first_name} ${user.last_name}`}</span>
</h3>
{#if user.email}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Email:</span>
<span class="value">{user.email}</span>
</h3>
{/if}
{#if user.address}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Adresse:</span>
<span class="value block-value">
<span>{user.address}</span>
<span>{`${user.zip_code} ${user.city}`}</span>
</span>
</h3>
{/if}
{#if user.phone}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Telefon:</span>
<span class="value">{user.phone}</span>
</h3>
{/if}
{#if user.date_of_birth}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Geburtstag:</span>
<span class="value">{user.date_of_birth}</span>
</h3>
{/if}
{#if user.notes}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">{$t("notes")}:</span>
<span class="value">{user.notes}</span>
</h3>
{/if}
</div>
<div class="user-info">
{#if user.status}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Status:</span>
<span class="value block-value">
<span
>{$t(`userStatus.${user.status}`, {
default: 'unknown status'
})}</span
>
<span>{$t(`userRole.${user.role_id}`, { default: 'unknown role' })}</span>
</span>
</h3>
{/if}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Name:</span>
<span class="value">{`${user.first_name} ${user.last_name}`}</span>
</h3>
{#if user.email}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Email:</span>
<span class="value">{user.email}</span>
</h3>
{/if}
{#if user.address}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Adresse:</span>
<span class="value block-value">
<span>{user.address}</span>
<span>{`${user.zip_code} ${user.city}`}</span>
</span>
</h3>
{/if}
{#if user.phone}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Telefon:</span>
<span class="value">{user.phone}</span>
</h3>
{/if}
{#if user.date_of_birth}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">Geburtstag:</span>
<span class="value">{user.date_of_birth}</span>
</h3>
{/if}
{#if user.notes}
<h3 class="hero-subtitle subtitle info-row">
<span class="label">{$t('notes')}:</span>
<span class="value">{user.notes}</span>
</h3>
{/if}
</div>
<div class="hero-buttons-container">
<button class="button-dark" on:click={open}>Ändern</button>
</div>
<div class="hero-buttons-container">
<button class="button-dark" on:click={open}>Ändern</button>
</div>
</div>
{#if showModal}
<Modal on:close={close}>
<UserEditForm
{form}
{user}
{subscriptions}
{licence_categories}
on:cancel={close}
/>
</Modal>
<Modal on:close={close}>
<UserEditForm {form} {user} {subscriptions} {licence_categories} on:cancel={close} />
</Modal>
{/if}
<style>
.hero-container .hero-subtitle:not(:last-of-type) {
margin: 0 0 0 0;
}
.hero-container .hero-subtitle:not(:last-of-type) {
margin: 0 0 0 0;
}
.hero-container {
display: flex;
flex-direction: column;
align-items: center;
}
.hero-container {
display: flex;
flex-direction: column;
align-items: center;
}
.user-info {
display: grid;
grid-template-columns: auto 1fr;
gap: 0.5rem 1rem;
align-items: start;
text-align: left;
margin-top: 1rem;
}
.user-info {
display: grid;
grid-template-columns: auto 1fr;
gap: 0.5rem 1rem;
align-items: start;
text-align: left;
margin-top: 1rem;
color: var(--text);
background-color: var(--surface0);
padding: 1.5rem;
border-radius: 8px;
border: 1px solid var(--surface1);
}
.info-row {
display: contents;
}
.info-row {
display: contents;
}
.label {
font-size: 1.3rem;
font-weight: bold;
text-align: left;
padding-right: 1rem;
}
.label {
font-size: 1.3rem;
font-weight: bold;
text-align: left;
padding-right: 1rem;
color: var(--lavender);
}
.value {
margin: 0;
font-size: 1.2rem;
text-align: left;
}
.value {
margin: 0;
font-size: 1.2rem;
text-align: left;
color: var(--text);
}
.block-value {
display: flex;
align-items: flex-start;
flex-direction: column;
}
.block-value {
display: flex;
align-items: flex-start;
flex-direction: column;
color: var(--subtext0);
}
.hero-buttons-container {
margin-top: 1rem;
}
.hero-buttons-container {
margin-top: 1rem;
}
.user-info {
font-size: 1rem;
}
.user-info {
font-size: 1rem;
}
.label,
.value {
font-size: 1.1rem;
}
.label,
.value {
font-size: 1.1rem;
}
</style>

View File

@@ -1,50 +1,50 @@
<script>
import Modal from "$lib/components/Modal.svelte";
import UserEditForm from "$lib/components/UserEditForm.svelte";
import { t } from "svelte-i18n";
import { page } from "$app/stores";
import Modal from '$lib/components/Modal.svelte';
import UserEditForm from '$lib/components/UserEditForm.svelte';
import { t } from 'svelte-i18n';
import { page } from '$app/stores';
/** @type {import('./$types').ActionData} */
export let form;
/** @type {import('./$types').ActionData} */
export let form;
$: ({
user,
users = [],
licence_categories = [],
subscriptions = [],
payments = [],
} = $page.data);
$: ({
user,
users = [],
licence_categories = [],
subscriptions = [],
payments = []
} = $page.data);
let activeSection = "users";
/** @type{App.Locals['user'] | null} */
let selectedUser = null;
let showModal = false;
let activeSection = 'users';
/** @type{App.Locals['user'] | null} */
let selectedUser = null;
let showModal = false;
/**
* Opens the edit modal for the selected user.
* @param {App.Locals['user'] | null} user The user to edit.
*/
const openEditModal = (user) => {
selectedUser = user;
console.dir(selectedUser);
showModal = true;
};
/**
* Opens the edit modal for the selected user.
* @param {App.Locals['user'] | null} user The user to edit.
*/
const openEditModal = (user) => {
selectedUser = user;
console.dir(selectedUser);
showModal = true;
};
const close = () => {
showModal = false;
selectedUser = null;
if (form) {
form.errors = undefined;
}
};
const close = () => {
showModal = false;
selectedUser = null;
if (form) {
form.errors = undefined;
}
};
/**
* sets the active admin section for display
* @param {string} section The new active section.
*/
const setActiveSection = (section) => {
activeSection = section;
};
/**
* sets the active admin section for display
* @param {string} section The new active section.
*/
const setActiveSection = (section) => {
activeSection = section;
};
</script>
<div class="container">
@@ -57,7 +57,7 @@
class="nav-link {activeSection === 'users' ? 'active' : ''}"
on:click={() => setActiveSection('users')}
>
<i class="fas fa-users" />
<i class="fas fa-users"></i>
<span class="nav-badge">{users.length}</span>
{$t('users')}
</button>
@@ -67,7 +67,7 @@
class="nav-link {activeSection === 'subscriptions' ? 'active' : ''}"
on:click={() => setActiveSection('subscriptions')}
>
<i class="fas fa-clipboard-list" />
<i class="fas fa-clipboard-list"></i>
<span class="nav-badge">{subscriptions.length}</span>
{$t('subscriptions')}
</button>
@@ -77,7 +77,7 @@
class="nav-link {activeSection === 'payments' ? 'active' : ''}"
on:click={() => setActiveSection('payments')}
>
<i class="fas fa-credit-card" />
<i class="fas fa-credit-card"></i>
{$t('payments')}
</button>
</li>
@@ -90,7 +90,7 @@
<div class="section-header">
<h2>{$t('users')}</h2>
<button class="btn primary" on:click={() => openEditModal(null)}>
<i class="fas fa-plus" />
<i class="fas fa-plus"></i>
{$t('add_new')}
</button>
</div>
@@ -124,11 +124,11 @@
</table>
<div class="button-group">
<button class="btn primary" on:click={() => openEditModal(user)}>
<i class="fas fa-edit" />
<i class="fas fa-edit"></i>
{$t('edit')}
</button>
<button class="btn danger">
<i class="fas fa-trash" />
<i class="fas fa-trash"></i>
{$t('delete')}
</button>
</div>
@@ -140,7 +140,7 @@
<div class="section-header">
<h2>{$t('subscriptions')}</h2>
<button class="btn primary" on:click={() => openEditModal(null)}>
<i class="fas fa-plus" />
<i class="fas fa-plus"></i>
{$t('add_new')}
</button>
</div>