add user edition to admin panel
This commit is contained in:
@@ -46,8 +46,14 @@
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
{ key: 'username', type: 'text', label: 'Spielername', options: { required: true } },
|
{ key: 'username', type: 'text', label: 'Spielername', options: { required: true } },
|
||||||
{ key: 'uuid', type: 'text', label: 'UUID', default: null }
|
{
|
||||||
]
|
key: 'edition',
|
||||||
|
type: 'select',
|
||||||
|
label: 'Edition',
|
||||||
|
options: { values: { java: 'Java', bedrock: 'Bedrock' }, required: true }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[{ key: 'uuid', type: 'text', label: 'UUID', default: null, options: { dynamicWidth: true } }]
|
||||||
]}
|
]}
|
||||||
onSubmit={addUser}
|
onSubmit={addUser}
|
||||||
bind:open={createPopupOpen}
|
bind:open={createPopupOpen}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#snippet edition(value: 'java' | 'bedrock')}
|
||||||
|
<span>{value.charAt(0).toUpperCase() + value.slice(1)}</span>
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
<DataTable
|
<DataTable
|
||||||
data={users}
|
data={users}
|
||||||
count={true}
|
count={true}
|
||||||
@@ -31,7 +35,8 @@
|
|||||||
{ key: 'lastname', label: 'Nachname', width: 15, sortable: true },
|
{ key: 'lastname', label: 'Nachname', width: 15, sortable: true },
|
||||||
{ key: 'birthday', label: 'Geburtstag', width: 5, sortable: true },
|
{ key: 'birthday', label: 'Geburtstag', width: 5, sortable: true },
|
||||||
{ key: 'telephone', label: 'Telefon', width: 12, sortable: true },
|
{ key: 'telephone', label: 'Telefon', width: 12, sortable: true },
|
||||||
{ key: 'username', label: 'Username', width: 20, sortable: true },
|
{ key: 'username', label: 'Username', width: 10, sortable: true },
|
||||||
|
{ key: 'edition', label: 'Edition', width: 10, sortable: true, transform: edition },
|
||||||
{ key: 'uuid', label: 'UUID', width: 23 }
|
{ key: 'uuid', label: 'UUID', width: 23 }
|
||||||
]}
|
]}
|
||||||
onEdit={(user) => (editPopupUser = user)}
|
onEdit={(user) => (editPopupUser = user)}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
import UserSearch from '@components/admin/search/UserSearch.svelte';
|
import UserSearch from '@components/admin/search/UserSearch.svelte';
|
||||||
import Checkbox from '@components/input/Checkbox.svelte';
|
import Checkbox from '@components/input/Checkbox.svelte';
|
||||||
import type { user } from '@db/schema/user.ts';
|
import type { user } from '@db/schema/user.ts';
|
||||||
|
import Select from '@components/input/Select.svelte';
|
||||||
|
|
||||||
// html bindings
|
// html bindings
|
||||||
let modal: HTMLDialogElement;
|
let modal: HTMLDialogElement;
|
||||||
@@ -44,6 +45,7 @@
|
|||||||
| 'datetime-local'
|
| 'datetime-local'
|
||||||
| 'number'
|
| 'number'
|
||||||
| 'password'
|
| 'password'
|
||||||
|
| 'select'
|
||||||
| 'tel'
|
| 'tel'
|
||||||
| 'text'
|
| 'text'
|
||||||
| 'textarea'
|
| 'textarea'
|
||||||
@@ -56,6 +58,7 @@
|
|||||||
['datetime-local']: string;
|
['datetime-local']: string;
|
||||||
['number']: number;
|
['number']: number;
|
||||||
['password']: string;
|
['password']: string;
|
||||||
|
['select']: string;
|
||||||
['tel']: string;
|
['tel']: string;
|
||||||
['text']: string;
|
['text']: string;
|
||||||
['textarea']: string;
|
['textarea']: string;
|
||||||
@@ -71,6 +74,9 @@
|
|||||||
['datetime-local']: {};
|
['datetime-local']: {};
|
||||||
['number']: {};
|
['number']: {};
|
||||||
['password']: {};
|
['password']: {};
|
||||||
|
['select']: {
|
||||||
|
options: Record<string, string>;
|
||||||
|
};
|
||||||
['tel']: {};
|
['tel']: {};
|
||||||
['text']: {};
|
['text']: {};
|
||||||
['textarea']: {
|
['textarea']: {
|
||||||
@@ -203,6 +209,14 @@
|
|||||||
label={k.label}
|
label={k.label}
|
||||||
required={k.options?.required}
|
required={k.options?.required}
|
||||||
/>
|
/>
|
||||||
|
{:else if k.type === 'select'}
|
||||||
|
<Select
|
||||||
|
bind:value={() => target[k.key] ?? k.default, (v) => onBindChange(k.key, v, k.options)}
|
||||||
|
label={k.label}
|
||||||
|
values={k.options.values}
|
||||||
|
required={k.options?.required}
|
||||||
|
dynamicWidth={k.options?.dynamicWidth}
|
||||||
|
/>
|
||||||
{:else if k.type === 'user-search'}
|
{:else if k.type === 'user-search'}
|
||||||
<UserSearch
|
<UserSearch
|
||||||
bind:value={
|
bind:value={
|
||||||
|
|||||||
Reference in New Issue
Block a user