generated from schreifuchs/wails-template
export functitionality
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
Modal,
|
||||
} from "flowbite-svelte";
|
||||
import TourCreator from "./TourCreator.svelte";
|
||||
import { Link } from "svelte-routing";
|
||||
import { Link, navigate } from "svelte-routing";
|
||||
|
||||
let thingsList: model.Tournament[] = $state([]);
|
||||
let newThing: boolean = $state(false);
|
||||
@ -46,9 +46,7 @@
|
||||
<TableBodyCell>{t.WinnerParticipant.Name}</TableBodyCell>
|
||||
|
||||
<TableBodyCell>
|
||||
<Link class="text-primary-500 underline" to={`/tournament/${t.ID}`}
|
||||
>Edit</Link
|
||||
>
|
||||
<Button onclick={() => navigate(`/tournament/${t.ID}`)}>View</Button>
|
||||
</TableBodyCell>
|
||||
</TableBodyRow>
|
||||
{/each}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
function saveMatch(m: model.Match): Promise<void> {
|
||||
if (matches[matches.length - 1].length == 1) {
|
||||
tournament.WinnerParticipantID = m.WinnerParticipantID;
|
||||
tournament.WinnerParticipant = m.WinnerParticipant;
|
||||
SaveTournament(tournament).then(update);
|
||||
}
|
||||
return SaveMatch(m);
|
||||
@ -71,32 +71,33 @@
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{#each ms as m}
|
||||
<TableBodyRow>
|
||||
<TableBodyRow class="h-20">
|
||||
<TableBodyCell>
|
||||
{m.Participant1.Name}
|
||||
</TableBodyCell>
|
||||
<TableBodyCell>
|
||||
{m.Participant2.Name}
|
||||
</TableBodyCell>
|
||||
<TableBodyCell>
|
||||
<TableBodyCell class="w-96">
|
||||
{#if m.WinnerParticipant.Name == ""}
|
||||
<Button
|
||||
class="m-1"
|
||||
onclick={() => {
|
||||
m.WinnerParticipant = m.Participant1;
|
||||
saveMatch(m).then(update);
|
||||
}}
|
||||
>
|
||||
{m.Participant1.Name}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
m.WinnerParticipantID = m.Participant2ID;
|
||||
saveMatch(m).then(update);
|
||||
}}
|
||||
>
|
||||
{m.Participant2.Name}
|
||||
</Button>
|
||||
<div class="grid grid-cols-2 gap-5">
|
||||
<Button
|
||||
onclick={() => {
|
||||
m.WinnerParticipant = m.Participant1;
|
||||
saveMatch(m).then(update);
|
||||
}}
|
||||
>
|
||||
{m.Participant1.Name}
|
||||
</Button>
|
||||
<Button
|
||||
onclick={() => {
|
||||
m.WinnerParticipant = m.Participant2;
|
||||
saveMatch(m).then(update);
|
||||
}}
|
||||
>
|
||||
{m.Participant2.Name}
|
||||
</Button>
|
||||
</div>
|
||||
{:else}
|
||||
{m.WinnerParticipant.Name}
|
||||
{/if}
|
||||
|
@ -67,7 +67,6 @@
|
||||
<TableHeadCell>Name</TableHeadCell>
|
||||
<TableHeadCell />
|
||||
<TableHeadCell />
|
||||
<TableHeadCell />
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{#each participants as p}
|
||||
@ -75,7 +74,7 @@
|
||||
<TableBodyCell>
|
||||
{p.Name}
|
||||
</TableBodyCell>
|
||||
<TableBodyCell>
|
||||
<TableBodyCell class="w-6">
|
||||
{#if tournament.Participants.find((pa) => pa.ID == p.ID)}
|
||||
<Button
|
||||
onclick={() => {
|
||||
@ -92,7 +91,7 @@
|
||||
>
|
||||
{/if}
|
||||
</TableBodyCell>
|
||||
<TableBodyCell>
|
||||
<TableBodyCell class="w-6">
|
||||
<Button onclick={() => DeleteParticipat(p).then(update)}
|
||||
>Delete</Button
|
||||
>
|
||||
|
Reference in New Issue
Block a user