adds notifications to users pages
This commit is contained in:
parent
ea8e6d675d
commit
6645e0d61d
|
@ -1,20 +1,19 @@
|
||||||
<script>
|
<script>
|
||||||
import { Body, Input, Select, ModalContent } from "@budibase/bbui"
|
import { Body, Input, Select, ModalContent } from "@budibase/bbui"
|
||||||
import { createEventDispatcher } from "svelte"
|
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
export let options
|
||||||
const onChange = ({ detail }) => {
|
export let selected
|
||||||
if (detail === options[1]) dispatch("basic")
|
export let email = ""
|
||||||
}
|
export let onConfirm
|
||||||
|
export let disabled
|
||||||
const options = ["Email onboarding", "Basic onboarding"]
|
|
||||||
let selected = options[0]
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
|
{onConfirm}
|
||||||
size="M"
|
size="M"
|
||||||
title="Add new user options"
|
title="Add new user options"
|
||||||
confirmText="Add user"
|
confirmText="Add user"
|
||||||
|
confirmDisabled={disabled}
|
||||||
cancelText="Cancel"
|
cancelText="Cancel"
|
||||||
showCloseIcon={false}
|
showCloseIcon={false}
|
||||||
>
|
>
|
||||||
|
@ -26,9 +25,13 @@
|
||||||
<Select
|
<Select
|
||||||
placeholder={null}
|
placeholder={null}
|
||||||
bind:value={selected}
|
bind:value={selected}
|
||||||
on:change={onChange}
|
|
||||||
{options}
|
{options}
|
||||||
label="Add new user via:"
|
label="Add new user via:"
|
||||||
/>
|
/>
|
||||||
<Input label="Email" />
|
<Input
|
||||||
|
type="email"
|
||||||
|
bind:value={email}
|
||||||
|
placeholder="john@doe.com"
|
||||||
|
label="Email"
|
||||||
|
/>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { ModalContent, Body, Input, ActionButton } from "@budibase/bbui"
|
import { ModalContent, Body, Input, ActionButton } from "@budibase/bbui"
|
||||||
|
|
||||||
|
export let email
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ModalContent
|
<ModalContent
|
||||||
|
@ -13,8 +15,8 @@
|
||||||
>Below you will find the user’s username and password. The password will not
|
>Below you will find the user’s username and password. The password will not
|
||||||
be accessible from this point. Please download the credentials.</Body
|
be accessible from this point. Please download the credentials.</Body
|
||||||
>
|
>
|
||||||
<Input disabled label="Username" value="joebudibase" />
|
<Input type="email" disabled label="Username" value={email} />
|
||||||
<Input disabled label="Password" value="kjhfweiufqohy87t23" />
|
<Input disabled label="Password" value="asduiayewkjh3243i5oucy" />
|
||||||
<div class="download">
|
<div class="download">
|
||||||
<ActionButton icon="Download">Download user credentials</ActionButton>
|
<ActionButton icon="Download">Download user credentials</ActionButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
Label,
|
Label,
|
||||||
Layout,
|
Layout,
|
||||||
Modal,
|
Modal,
|
||||||
|
notifications,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import AddUserModal from "./_components/AddUserModal.svelte"
|
import AddUserModal from "./_components/AddUserModal.svelte"
|
||||||
import BasicOnboardingModal from "./_components/BasicOnboardingModal.svelte"
|
import BasicOnboardingModal from "./_components/BasicOnboardingModal.svelte"
|
||||||
|
@ -25,15 +26,22 @@
|
||||||
// group: {}
|
// group: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let onboardingOptions = ["Email onboarding", "Basic onboarding"]
|
||||||
|
let selectedOnboardingOption = onboardingOptions[0]
|
||||||
let search
|
let search
|
||||||
|
let email
|
||||||
$: filteredUsers = $users.filter(user => user.email.includes(search || ""))
|
$: filteredUsers = $users.filter(user => user.email.includes(search || ""))
|
||||||
|
|
||||||
let userModal
|
let createUserModal
|
||||||
let basicOnboardingModal
|
let basicOnboardingModal
|
||||||
|
|
||||||
function openBasicOnboardingModal() {
|
function createUserFlow() {
|
||||||
userModal.hide()
|
if (selectedOnboardingOption === onboardingOptions[0]) {
|
||||||
basicOnboardingModal.show()
|
notifications.success("Email sent.")
|
||||||
|
} else {
|
||||||
|
createUserModal.hide()
|
||||||
|
basicOnboardingModal.show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -57,7 +65,7 @@
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<Button disabled secondary>Import users</Button>
|
<Button disabled secondary>Import users</Button>
|
||||||
<Button overBackground on:click={userModal.show}>Add user</Button>
|
<Button overBackground on:click={createUserModal.show}>Add user</Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
<Table
|
<Table
|
||||||
|
@ -71,10 +79,16 @@
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<Modal bind:this={userModal}
|
<Modal bind:this={createUserModal}
|
||||||
><AddUserModal on:basic={openBasicOnboardingModal} /></Modal
|
><AddUserModal
|
||||||
|
options={onboardingOptions}
|
||||||
|
onConfirm={createUserFlow}
|
||||||
|
disabled={!email}
|
||||||
|
bind:selected={selectedOnboardingOption}
|
||||||
|
bind:email
|
||||||
|
/></Modal
|
||||||
>
|
>
|
||||||
<Modal bind:this={basicOnboardingModal}><BasicOnboardingModal /></Modal>
|
<Modal bind:this={basicOnboardingModal}><BasicOnboardingModal {email} /></Modal>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.users {
|
.users {
|
||||||
|
|
Loading…
Reference in New Issue