|
|
|
@ -1,22 +1,30 @@ |
|
|
|
<script> |
|
|
|
import { Body, Input, Select, ModalContent } from "@budibase/bbui" |
|
|
|
import { createValidationStore, emailValidator } from "helpers/validation" |
|
|
|
import { users } from "stores/portal" |
|
|
|
|
|
|
|
export let options |
|
|
|
export let selected |
|
|
|
export let onConfirm |
|
|
|
export let disabled |
|
|
|
|
|
|
|
const [email, emailError] = createValidationStore("", emailValidator) |
|
|
|
const options = ["Email onboarding", "Basic onboarding"] |
|
|
|
let selected = options[0] |
|
|
|
|
|
|
|
const [email, error, touched] = createValidationStore("", emailValidator) |
|
|
|
|
|
|
|
async function createUserFlow() { |
|
|
|
const response = await users.invite(email) |
|
|
|
console.log(response) |
|
|
|
notifications.success("Email sent.") |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<ModalContent |
|
|
|
{onConfirm} |
|
|
|
onConfirm={createUserFlow} |
|
|
|
size="M" |
|
|
|
title="Add new user options" |
|
|
|
confirmText="Add user" |
|
|
|
confirmDisabled={disabled} |
|
|
|
cancelText="Cancel" |
|
|
|
disabled={!$touched && !$error} |
|
|
|
showCloseIcon={false} |
|
|
|
> |
|
|
|
<Body noPadding |
|
|
|
@ -27,13 +35,14 @@ |
|
|
|
<Select |
|
|
|
placeholder={null} |
|
|
|
bind:value={selected} |
|
|
|
on:change |
|
|
|
{options} |
|
|
|
label="Add new user via:" |
|
|
|
/> |
|
|
|
<Input |
|
|
|
type="email" |
|
|
|
bind:value={$email} |
|
|
|
error={$emailError} |
|
|
|
error={$touched && $error} |
|
|
|
placeholder="john@doe.com" |
|
|
|
label="Email" |
|
|
|
/> |
|
|
|
|