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() const dispatch = createEventDispatcher()
import { Input, Select, Button } from "@budibase/bbui" import { Input, Select, Button } from "@budibase/bbui"
export let user export let user
let editMode = false
</script> </script>
<div class="inputs"> <div class="inputs">
<Input thin bind:value={user.username} name="Name" placeholder="Username" /> <Input
<Select bind:value={user.accessLevelId} thin> 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="ADMIN">Admin</option>
<option value="POWER_USER">Power User</option> <option value="POWER_USER">Power User</option>
</Select> </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> </div>
<style> <style>