82 lines
3.0 KiB
Svelte
82 lines
3.0 KiB
Svelte
<script lang="ts">
|
|
import {locals} from "../../ts/stores";
|
|
import BaseTemplate from "../templates/BaseTemplate.svelte";
|
|
import Pagination from "../components/Pagination.svelte";
|
|
import Form from "../utils/Form.svelte";
|
|
import Field from "../utils/Field.svelte";
|
|
import Breadcrumb from "../components/Breadcrumb.svelte";
|
|
import {hasRoute, route} from "../../../common/Routing";
|
|
|
|
const accounts = $locals.accounts || [];
|
|
</script>
|
|
|
|
<style>
|
|
td.empty {
|
|
text-align: center;
|
|
}
|
|
</style>
|
|
|
|
<BaseTemplate title="{$locals.app.name} - Review accounts" h1={false}>
|
|
{#if hasRoute('backend')}
|
|
<Breadcrumb currentPageTitle="Accounts pending review" pages={[
|
|
{link: route('backend'), title:'Backend'},
|
|
]}/>
|
|
{/if}
|
|
|
|
<h1>Accounts pending review</h1>
|
|
|
|
<Pagination pagination={$locals.pagination} routeName="accounts-approval" contextSize="3" />
|
|
|
|
<div class="panel data-table-container">
|
|
<table class="data-table">
|
|
<thead>
|
|
<tr>
|
|
<th class="shrink-col">#</th>
|
|
{#if $locals.has_user_name_component}
|
|
<th>Name</th>
|
|
{/if}
|
|
<th>Main email</th>
|
|
<th>Registered at</th>
|
|
<th class="shrink-col">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{#each accounts as user}
|
|
<tr>
|
|
<td>{user.id}</td>
|
|
{#if $locals.has_user_name_component}
|
|
<td>{user.name}</td>
|
|
{/if}
|
|
<td>{user.mainEmailStr || 'No email'}</td>
|
|
<td><time datetime={user.created_at_iso}>{user.created_at_human} ago</time></td>
|
|
<td>
|
|
<div class="max-content">
|
|
{#if hasRoute('approve-account')}
|
|
<Form action={route('approve-account')}
|
|
submitIcon="check" submitText="Approve" submitClass="success">
|
|
<Field type="hidden" name="user_id" value={user.id}/>
|
|
</Form>
|
|
{/if}
|
|
|
|
{#if hasRoute('reject-account')}
|
|
<Form action={route('reject-account')}
|
|
submitIcon="trash" submitText="Reject" submitClass="danger"
|
|
confirm="This will irrevocably delete the {user.mainEmailStr || user.name || user.id} account.">
|
|
<Field type="hidden" name="user_id" value={user.id}/>
|
|
</Form>
|
|
{/if}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{:else}
|
|
<tr>
|
|
<td colspan="5" class="empty">No account to review.</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<Pagination pagination={$locals.pagination} routeName="accounts-approval" contextSize="3" />
|
|
</BaseTemplate>
|