Add Card appends current cards

This commit is contained in:
2023-04-12 21:04:29 +02:00
parent 2f62c7ae89
commit 195d182cc9
4 changed files with 42 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
<script>
import { _ } from "svelte-i18n";
import { clickOutside } from "../base/outsideclick";
import {
RunnerCardService,
RunnerService,
@@ -9,9 +9,10 @@
} from "@odit/lfk-client-js";
import Select from "svelte-select";
import Toastify from "toastify-js";
import { createEventDispatcher } from "svelte";
export let modal_open;
export let current_cards;
const dispatch = createEventDispatcher();
const getRunnerLabel = (option) => {
if (option.middlename) {
return option.firstname + " " + option.middlename + " " + option.lastname;
@@ -21,7 +22,7 @@
const filterRunners = (label, filterText, option) => {
if (filterText.startsWith("#")) {
return option.value.id == parseInt(filterText.replace("#",""))
return option.value.id == parseInt(filterText.replace("#", ""));
}
return (
label.toLowerCase().includes(filterText.toLowerCase()) ||
@@ -79,8 +80,7 @@
duration: 500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast();
current_cards.push(result);
current_cards = current_cards;
dispatch("created", { cards: [result] });
})
.catch((err) => {
//
@@ -97,7 +97,6 @@
{#if modal_open}
<div
class="fixed z-10 inset-0 overflow-y-auto"
use:clickOutside
on:click_outside={() => {
modal_open = false;