frontend: add defaultUser, supporter
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
import { applyAction, enhance } from '$app/forms';
|
||||
import { hasPrivilige, receive, send } from '$lib/utils/helpers';
|
||||
import { PERMISSIONS } from '$lib/utils/constants';
|
||||
import { defaultSupporter, defaultUser } from '$lib/utils/defaults';
|
||||
|
||||
/** @type {import('./$types').ActionData} */
|
||||
export let form;
|
||||
@@ -96,7 +97,7 @@
|
||||
|
||||
/**
|
||||
* Opens the edit modal for the selected user.
|
||||
* @param {App.Locals['user'] | null} user The user to edit.
|
||||
* @param {App.Locals['user']} user The user to edit.
|
||||
*/
|
||||
const openEditUserModal = (user) => {
|
||||
selectedUser = user;
|
||||
@@ -213,7 +214,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn primary" on:click={() => openEditUserModal(null)}>
|
||||
<button class="btn primary" on:click={() => openEditUserModal(defaultUser())}>
|
||||
<i class="fas fa-plus"></i>
|
||||
{$t('add_new')}
|
||||
</button>
|
||||
@@ -314,7 +315,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn primary" on:click={() => openEditUserModal(null)}>
|
||||
<button class="btn primary" on:click={() => openEditUserModal(defaultSupporter())}>
|
||||
<i class="fas fa-plus"></i>
|
||||
{$t('add_new')}
|
||||
</button>
|
||||
@@ -330,21 +331,17 @@
|
||||
<div class="accordion-content">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{$t('user.id')}</th>
|
||||
<td>{user.id}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$t('name')}</th>
|
||||
<td>{user.first_name} {user.last_name}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$t('user.email')}</th>
|
||||
<td>{user.email}</td>
|
||||
<th>{$t('company')}</th>
|
||||
<td>{user.company}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$t('subscription.subscription')}</th>
|
||||
<td>{user.membership?.subscription_model?.name}</td>
|
||||
<th>{$t('user.email')}</th>
|
||||
<td>{user.email}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{$t('status')}</th>
|
||||
@@ -536,7 +533,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if showUserModal}
|
||||
{#if showUserModal && selectedUser !== null}
|
||||
<Modal on:close={close}>
|
||||
<UserEditForm
|
||||
{form}
|
||||
|
||||
Reference in New Issue
Block a user