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: '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}
|
||||
bind:open={createPopupOpen}
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{#snippet edition(value: 'java' | 'bedrock')}
|
||||
<span>{value.charAt(0).toUpperCase() + value.slice(1)}</span>
|
||||
{/snippet}
|
||||
|
||||
<DataTable
|
||||
data={users}
|
||||
count={true}
|
||||
@@ -31,7 +35,8 @@
|
||||
{ key: 'lastname', label: 'Nachname', width: 15, sortable: true },
|
||||
{ key: 'birthday', label: 'Geburtstag', width: 5, 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 }
|
||||
]}
|
||||
onEdit={(user) => (editPopupUser = user)}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import UserSearch from '@components/admin/search/UserSearch.svelte';
|
||||
import Checkbox from '@components/input/Checkbox.svelte';
|
||||
import type { user } from '@db/schema/user.ts';
|
||||
import Select from '@components/input/Select.svelte';
|
||||
|
||||
// html bindings
|
||||
let modal: HTMLDialogElement;
|
||||
@@ -44,6 +45,7 @@
|
||||
| 'datetime-local'
|
||||
| 'number'
|
||||
| 'password'
|
||||
| 'select'
|
||||
| 'tel'
|
||||
| 'text'
|
||||
| 'textarea'
|
||||
@@ -56,6 +58,7 @@
|
||||
['datetime-local']: string;
|
||||
['number']: number;
|
||||
['password']: string;
|
||||
['select']: string;
|
||||
['tel']: string;
|
||||
['text']: string;
|
||||
['textarea']: string;
|
||||
@@ -71,6 +74,9 @@
|
||||
['datetime-local']: {};
|
||||
['number']: {};
|
||||
['password']: {};
|
||||
['select']: {
|
||||
options: Record<string, string>;
|
||||
};
|
||||
['tel']: {};
|
||||
['text']: {};
|
||||
['textarea']: {
|
||||
@@ -203,6 +209,14 @@
|
||||
label={k.label}
|
||||
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'}
|
||||
<UserSearch
|
||||
bind:value={
|
||||
|
||||
Reference in New Issue
Block a user