From 64c96f25d4a9277df431011f4660b59a2eb0a9da Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Thu, 18 Mar 2021 15:50:15 +0100 Subject: [PATCH] =?UTF-8?q?Switched=20the=20scanstation=20modal=20over=20t?= =?UTF-8?q?o=20svelte=20select=F0=9F=91=80=F0=9F=91=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #98 --- .../scanstations/AddScanStationModal.svelte | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/components/scanstations/AddScanStationModal.svelte b/src/components/scanstations/AddScanStationModal.svelte index 48ea18ae..207aa6ff 100644 --- a/src/components/scanstations/AddScanStationModal.svelte +++ b/src/components/scanstations/AddScanStationModal.svelte @@ -4,14 +4,16 @@ import { focusTrap } from "svelte-focus-trap"; import { ScanStationService, TrackService } from "@odit/lfk-client-js"; import Toastify from "toastify-js"; + import Select from "svelte-select"; export let modal_open; export let new_station; export let current_stations; export let copy_modal_open; let tracks = []; TrackService.trackControllerGetAll().then((val) => { - tracks = val; - track = tracks[0].id; + tracks = val.map((t) => { + return { label: t.name || `#${t.id}`, value: t }; + }); }); function focus(el) { el.focus(); @@ -39,7 +41,7 @@ if (processed_last_submit === true) { processed_last_submit = false; const toast = Toastify({ - text: $_('scanstation-is-being-added'), + text: $_("scanstation-is-being-added"), duration: -1, }).showToast(); let postdata = { @@ -55,14 +57,14 @@ modal_open = false; // Toastify({ - text: $_('scanstation-added'), + text: $_("scanstation-added"), duration: 500, backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", }).showToast(); current_stations.push(result); current_stations = current_stations; - new_station=result; - copy_modal_open=true; + new_station = result; + copy_modal_open = true; }) .catch((err) => { // @@ -111,7 +113,7 @@ width="24" height="24"> + d="M4 5v11h16V5H4zM2 4a1 1 0 011-1h18a1 1 0 011 1v14H2V4zM1 19h22v2H1v-2z" />

@@ -127,14 +129,21 @@ - +