Compare commits
No commits in common. "195d182cc977b4ac9f342f09a9ea69d461892a95" and "f6c1fea17ce64d890ac810d9dff058dd589c2989" have entirely different histories.
195d182cc9
...
f6c1fea17c
@ -4,13 +4,11 @@
|
|||||||
|
|
||||||
import { RunnerCardService } from "@odit/lfk-client-js";
|
import { RunnerCardService } from "@odit/lfk-client-js";
|
||||||
import Toastify from "toastify-js";
|
import Toastify from "toastify-js";
|
||||||
import { createEventDispatcher } from "svelte";
|
|
||||||
export let bulk_modal_open;
|
export let bulk_modal_open;
|
||||||
|
export let current_cards;
|
||||||
function focus(el) {
|
function focus(el) {
|
||||||
el.focus();
|
el.focus();
|
||||||
}
|
}
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
$: card_count = 0;
|
$: card_count = 0;
|
||||||
$: is_card_count_valid = card_count > 0;
|
$: is_card_count_valid = card_count > 0;
|
||||||
$: processed_last_submit = true;
|
$: processed_last_submit = true;
|
||||||
@ -45,7 +43,6 @@
|
|||||||
duration: 500,
|
duration: 500,
|
||||||
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
}).showToast();
|
}).showToast();
|
||||||
dispatch("created", {cards: result})
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
//
|
//
|
||||||
@ -74,11 +71,11 @@
|
|||||||
duration: 500,
|
duration: 500,
|
||||||
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
}).showToast();
|
}).showToast();
|
||||||
|
current_cards = current_cards.concat(result);
|
||||||
const toast = Toastify({
|
const toast = Toastify({
|
||||||
text: $_("generating-pdf"),
|
text: $_("generating-pdf"),
|
||||||
duration: -1,
|
duration: -1,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
dispatch("created", {cards: result})
|
|
||||||
fetch(
|
fetch(
|
||||||
`${config.baseurl_documentserver}/cards?&download=true&key=${config.documentserver_key}`,
|
`${config.baseurl_documentserver}/cards?&download=true&key=${config.documentserver_key}`,
|
||||||
{
|
{
|
||||||
|
@ -9,10 +9,9 @@
|
|||||||
} from "@odit/lfk-client-js";
|
} from "@odit/lfk-client-js";
|
||||||
import Select from "svelte-select";
|
import Select from "svelte-select";
|
||||||
import Toastify from "toastify-js";
|
import Toastify from "toastify-js";
|
||||||
import { createEventDispatcher } from "svelte";
|
|
||||||
export let modal_open;
|
export let modal_open;
|
||||||
|
export let current_cards;
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
const getRunnerLabel = (option) => {
|
const getRunnerLabel = (option) => {
|
||||||
if (option.middlename) {
|
if (option.middlename) {
|
||||||
return option.firstname + " " + option.middlename + " " + option.lastname;
|
return option.firstname + " " + option.middlename + " " + option.lastname;
|
||||||
@ -22,7 +21,7 @@
|
|||||||
|
|
||||||
const filterRunners = (label, filterText, option) => {
|
const filterRunners = (label, filterText, option) => {
|
||||||
if (filterText.startsWith("#")) {
|
if (filterText.startsWith("#")) {
|
||||||
return option.value.id == parseInt(filterText.replace("#", ""));
|
return option.value.id == parseInt(filterText.replace("#",""))
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
label.toLowerCase().includes(filterText.toLowerCase()) ||
|
label.toLowerCase().includes(filterText.toLowerCase()) ||
|
||||||
@ -80,7 +79,8 @@
|
|||||||
duration: 500,
|
duration: 500,
|
||||||
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
}).showToast();
|
}).showToast();
|
||||||
dispatch("created", { cards: [result] });
|
current_cards.push(result);
|
||||||
|
current_cards = current_cards;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
//
|
//
|
||||||
@ -97,6 +97,7 @@
|
|||||||
{#if modal_open}
|
{#if modal_open}
|
||||||
<div
|
<div
|
||||||
class="fixed z-10 inset-0 overflow-y-auto"
|
class="fixed z-10 inset-0 overflow-y-auto"
|
||||||
|
|
||||||
use:clickOutside
|
use:clickOutside
|
||||||
on:click_outside={() => {
|
on:click_outside={() => {
|
||||||
modal_open = false;
|
modal_open = false;
|
||||||
|
@ -7,48 +7,34 @@
|
|||||||
$: current_cards = [];
|
$: current_cards = [];
|
||||||
export let modal_open = false;
|
export let modal_open = false;
|
||||||
export let bulk_modal_open = false;
|
export let bulk_modal_open = false;
|
||||||
let addCards;
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section class="container p-5">
|
<section class="container p-5">
|
||||||
<span class="mb-1 text-3xl font-extrabold leading-tight">
|
<span class="mb-1 text-3xl font-extrabold leading-tight">
|
||||||
{$_("cards")}
|
{$_('cards')}
|
||||||
{#if store.state.jwtinfo.userdetails.permissions.includes("CARD:CREATE")}
|
{#if store.state.jwtinfo.userdetails.permissions.includes('CARD:CREATE')}
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
modal_open = true;
|
modal_open = true;
|
||||||
}}
|
}}
|
||||||
type="button"
|
type="button"
|
||||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm"
|
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
|
||||||
>
|
{$_('add-card')}
|
||||||
{$_("add-card")}
|
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
bulk_modal_open = true;
|
bulk_modal_open = true;
|
||||||
}}
|
}}
|
||||||
type="button"
|
type="button"
|
||||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm"
|
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
|
||||||
>
|
{$_('create-bulk-cards')}
|
||||||
{$_("create-bulk-cards")}
|
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
<CardsOverview bind:current_cards bind:addCards />
|
<CardsOverview bind:current_cards />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{#if store.state.jwtinfo.userdetails.permissions.includes("CARD:CREATE")}
|
{#if store.state.jwtinfo.userdetails.permissions.includes('CARD:CREATE')}
|
||||||
<AddCardModal
|
<AddCardModal bind:current_cards bind:modal_open />
|
||||||
bind:modal_open
|
<AddCardBulkModal bind:current_cards bind:bulk_modal_open />
|
||||||
on:created={(event) => {
|
|
||||||
console.log(event)
|
|
||||||
addCards(event.detail.cards);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<AddCardBulkModal
|
|
||||||
bind:bulk_modal_open
|
|
||||||
on:created={(event) => {
|
|
||||||
addCards(event.detail.cards);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -31,14 +31,6 @@
|
|||||||
export let editable = {};
|
export let editable = {};
|
||||||
export let original_data = {};
|
export let original_data = {};
|
||||||
export let current_cards = [];
|
export let current_cards = [];
|
||||||
export const addCards = (cards) => {
|
|
||||||
console.log(cards)
|
|
||||||
current_cards = current_cards.concat(...cards);
|
|
||||||
options.update((options) => ({
|
|
||||||
...options,
|
|
||||||
data: current_cards,
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
|
|
||||||
$: dataLoaded = false;
|
$: dataLoaded = false;
|
||||||
$: selected =
|
$: selected =
|
||||||
@ -214,21 +206,9 @@
|
|||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
const prom = [];
|
const prom = [];
|
||||||
for (const card of selectedCards) {
|
for (const card of selectedCards) {
|
||||||
prom.push(
|
prom.push(deleteCard(card.id));
|
||||||
await RunnerCardService.runnerCardControllerRemove(
|
|
||||||
card.id,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
await Promise.all(prom);
|
await Promise.all(prom);
|
||||||
for (const card of selectedCards) {
|
|
||||||
current_cards = current_cards.filter((r) => r.id !== card.id);
|
|
||||||
}
|
|
||||||
options.update((options) => ({
|
|
||||||
...options,
|
|
||||||
data: current_cards,
|
|
||||||
}));
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{$_("delete-cards")}
|
{$_("delete-cards")}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user