adds edit/save mode to update user list

This commit is contained in:
kevmodrome 2020-06-29 10:10:41 +02:00
parent 0ebb59dfa4
commit ae21d5c505
1 changed files with 21 additions and 3 deletions

View File

@ -3,15 +3,33 @@
const dispatch = createEventDispatcher()
import { Input, Select, Button } from "@budibase/bbui"
export let user
let editMode = false
</script>
<div class="inputs">
<Input thin bind:value={user.username} name="Name" placeholder="Username" />
<Select bind:value={user.accessLevelId} thin>
<Input
disabled={!editMode}
thin
bind:value={user.username}
name="Name"
placeholder="Username" />
<Select disabled={editMode} bind:value={user.accessLevelId} thin>
<option value="ADMIN">Admin</option>
<option value="POWER_USER">Power User</option>
</Select>
<Button on:click={() => dispatch('save', user)}>Edit</Button>
{#if editMode}
<Button
blue
on:click={() => {
dispatch('save', user)
editMode = false
}}>
Save
</Button>
{:else}
<Button secondary on:click={() => (editMode = true)}>Edit</Button>
{/if}
</div>
<style>