From 03b3683b638055c9251c9808eece0e6268bff575 Mon Sep 17 00:00:00 2001
From: Alex <$(pass /github/email)>
Date: Thu, 20 Feb 2025 10:16:48 +0100
Subject: [PATCH] frontend moved select fields to themed coloring, added
permissions to usereditmodal
---
frontend/src/lib/components/InputField.svelte | 6 +-
.../src/lib/components/UserEditForm.svelte | 80 +++++++++++--------
frontend/src/lib/css/styles.min.css | 7 +-
.../src/routes/auth/about/[id]/+page.svelte | 1 +
4 files changed, 56 insertions(+), 38 deletions(-)
diff --git a/frontend/src/lib/components/InputField.svelte b/frontend/src/lib/components/InputField.svelte
index b1f2bb1..0802071 100644
--- a/frontend/src/lib/components/InputField.svelte
+++ b/frontend/src/lib/components/InputField.svelte
@@ -38,7 +38,7 @@
export let readonly = false;
/** @type {string} */
- export let backgroundColor = '--surface0'; // New prop for background color
+ export let backgroundColor = '--surface0';
/**
* @param {Event} event - The input event
@@ -110,7 +110,7 @@
$: error = validateField(name, value, required);
$: selectedOption = options.find((option) => option.value == value);
- $: selectedColor = selectedOption ? selectedOption.color : '';
+ $: selectedColor = selectedOption ? `var(${selectedOption.color})` : '';
{#each options as option}
@@ -270,6 +271,7 @@
.select {
padding-right: 1.5em;
background-color: var(--surface0);
+ font-weight: bold;
}
.input-error-container {
display: flex;
diff --git a/frontend/src/lib/components/UserEditForm.svelte b/frontend/src/lib/components/UserEditForm.svelte
index ec31aef..022761f 100644
--- a/frontend/src/lib/components/UserEditForm.svelte
+++ b/frontend/src/lib/components/UserEditForm.svelte
@@ -70,6 +70,9 @@
/** @type {App.Locals['user'] | null} */
export let user;
+ /** @type {Number} */
+ export let role_id;
+
/** @type {App.Locals['user'] } */
let localUser;
@@ -94,29 +97,28 @@
export let licence_categories;
const userStatusOptions = [
- { value: 1, label: $t('userStatus.1'), color: '#b1b1b1' }, // Grey for "Nicht verifiziert"
- { value: 2, label: $t('userStatus.2'), color: '#90EE90' }, // Light green for "Verifiziert"
- { value: 3, label: $t('userStatus.3'), color: '#00bc00' }, // Green for "Aktiv"
- { value: 4, label: $t('userStatus.4'), color: '#FFC0CB' }, // Pink for "Passiv"
- { value: 5, label: $t('userStatus.5'), color: '#FF4646' } // Red for "Deaktiviert"
+ { value: 1, label: $t('userStatus.1'), color: '--subtext1' }, // Grey for "Nicht verifiziert"
+ { value: 2, label: $t('userStatus.2'), color: '--light-green' }, // Light green for "Verifiziert"
+ { value: 3, label: $t('userStatus.3'), color: '--green' }, // Green for "Aktiv"
+ { value: 4, label: $t('userStatus.4'), color: '--pink' }, // Pink for "Passiv"
+ { value: 5, label: $t('userStatus.5'), color: '--red' } // Red for "Deaktiviert"
];
-
const userRoleOptions = [
- { value: 0, label: $t('userRole.0'), color: '#b1b1b1' }, // Grey for "Mitglied"
- { value: 1, label: $t('userRole.1'), color: '#00bc00' }, // Green for "Betrachter"
- { value: 4, label: $t('userRole.4'), color: '#FFC0CB' }, // Pink for "Bearbeiter"
- { value: 8, label: $t('userRole.8'), color: '#FF4646' } // Red for "Admin"
+ { value: 0, label: $t('userRole.0'), color: '--subtext1' }, // Grey for "Nicht verifiziert"
+ { value: 1, label: $t('userRole.1'), color: '--light-green' }, // Light green for "Verifiziert"
+ { value: 4, label: $t('userRole.4'), color: '--green' }, // Green for "Aktiv"
+ { value: 8, label: $t('userRole.8'), color: '--pink' } // Pink for "Passiv"
];
const membershipStatusOptions = [
- { value: 3, label: $t('userStatus.3'), color: '#00bc00' }, // Green for "Aktiv"
- { value: 4, label: $t('userStatus.4'), color: '#FFC0CB' }, // Pink for "Passiv"
- { value: 5, label: $t('userStatus.5'), color: '#FF4646' } // Red for "Deaktiviert"
+ { value: 3, label: $t('userStatus.3'), color: '--green' }, // Green for "Aktiv"
+ { value: 4, label: $t('userStatus.4'), color: '--pink' }, // Pink for "Passiv"
+ { value: 5, label: $t('userStatus.5'), color: '--red' } // Red for "Deaktiviert"
];
const licenceStatusOptions = [
- { value: 1, label: $t('userStatus.1'), color: '#b1b1b1' }, // Grey for "Nicht verifiziert"
- { value: 3, label: $t('userStatus.3'), color: '#00bc00' }, // Green for "Aktiv"
- { value: 4, label: $t('userStatus.4'), color: '#FFC0CB' }, // Pink for "Passiv"
- { value: 5, label: $t('userStatus.5'), color: '#FF4646' } // Red for "Deaktiviert"
+ { value: 1, label: $t('userStatus.1'), color: '--subtext1' }, // Grey for "Nicht verifiziert"
+ { value: 3, label: $t('userStatus.3'), color: '--green' }, // Green for "Aktiv"
+ { value: 4, label: $t('userStatus.4'), color: '--pink' }, // Pink for "Passiv"
+ { value: 5, label: $t('userStatus.5'), color: '--red' } // Red for "Deaktiviert"
];
const dispatch = createEventDispatcher();
@@ -211,13 +213,6 @@
{/each}
{/if}
-
-
{#each TABS as tab}
{#if localUser.role_id === 8}
-
+ {#if localUser.role_id > 0}
+
+ {/if}
{$t('licence_categories')}
@@ -407,6 +413,7 @@
label={$t('status')}
bind:value={localUser.membership.status}
options={membershipStatusOptions}
+ readonly={role_id === 0}
/>
@@ -457,6 +465,7 @@
label={$t('start')}
bind:value={localUser.membership.start_date}
placeholder={$t('placeholder.start_date')}
+ readonly={role_id === 0}
/>
@@ -505,6 +516,7 @@
label={$t('mandate_reference')}
bind:value={localUser.bank_account.mandate_reference}
placeholder={$t('placeholder.mandate_reference')}
+ readonly={role_id === 0}
/>
{/if}