💬 AddOrgModal bindings

ref #16
This commit is contained in:
Philipp Dormann 2021-01-15 19:24:46 +01:00
parent 7a09869b0c
commit bc239eead1

View File

@ -10,10 +10,10 @@
function focus(el) { function focus(el) {
el.focus(); el.focus();
} }
$: firstname_input_value = ""; $: name = "";
$: processed_last_submit = true; $: processed_last_submit = true;
$: isFirstnameValid = firstname_input_value.trim().length !== 0; $: isOrgnameValid = name.trim().length !== 0;
$: createbtnenabled = isFirstnameValid; $: createbtnenabled = isOrgnameValid;
(function () { (function () {
document.onkeydown = function (e) { document.onkeydown = function (e) {
e = e || window.event; e = e || window.event;
@ -42,11 +42,7 @@
}) })
.then((result) => { .then((result) => {
console.log(result); console.log(result);
firstname_input_value = ""; name = "";
lastname_input_value = "";
middlename_input_value = "";
email_input_value = "";
username_input_value = "";
modal_open = false; modal_open = false;
// //
Toastify({ Toastify({
@ -123,15 +119,15 @@
use:focus use:focus
autocomplete="off" autocomplete="off"
placeholder="Name" placeholder="Name"
class:border-red-500={!isFirstnameValid} class:border-red-500={!isOrgnameValid}
class:focus:border-red-500={!isFirstnameValid} class:focus:border-red-500={!isOrgnameValid}
class:focus:ring-red-500={!isFirstnameValid} class:focus:ring-red-500={!isOrgnameValid}
bind:value={firstname_input_value} bind:value={name}
bind:this={firstname_input} bind:this={firstname_input}
type="text" type="text"
name="firstname" name="firstname"
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" /> class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-gray-500 rounded-md p-2" />
{#if !isFirstnameValid} {#if !isOrgnameValid}
<span <span
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1"> class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
Organization name is required Organization name is required