From d8bfb1c41373a681582ee9567097325a0af81022 Mon Sep 17 00:00:00 2001 From: Denis Bunakalya Date: Mon, 20 Mar 2023 12:45:19 +0300 Subject: [PATCH] Extend CreateEmployee dialog for extra controls (#2766) * Extend CreateEmployee dialog for extra controls Signed-off-by: Denis Bunakalya * Provide onCreate prop instead of dispatching event Signed-off-by: Denis Bunakalya --------- Signed-off-by: Denis Bunakalya --- .../src/components/CreateEmployee.svelte | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/contact-resources/src/components/CreateEmployee.svelte b/plugins/contact-resources/src/components/CreateEmployee.svelte index 85903a78e6..591d0e4040 100644 --- a/plugins/contact-resources/src/components/CreateEmployee.svelte +++ b/plugins/contact-resources/src/components/CreateEmployee.svelte @@ -22,6 +22,9 @@ import contact from '../plugin' import PersonPresenter from './PersonPresenter.svelte' + export let canSave: boolean = true + export let onCreate: ((id: Ref) => Promise) | undefined = undefined + let avatarEditor: EditableAvatar let firstName = '' @@ -66,6 +69,9 @@ provider: channel.provider }) } + if (onCreate) { + await onCreate(id) + } dispatch('close') } @@ -102,7 +108,11 @@ 0 && lastName.trim().length > 0 && matches.length === 0 && email.trim().length > 0} + canSave={firstName.trim().length > 0 && + lastName.trim().length > 0 && + matches.length === 0 && + email.trim().length > 0 && + canSave} on:close={() => { dispatch('close') }} @@ -142,6 +152,7 @@ on:blur={changeEmail} /> +