diff --git a/src/components/admin/components/FightEditPart.svelte b/src/components/admin/components/FightEditPart.svelte
index 9c99dcf..50025c3 100644
--- a/src/components/admin/components/FightEditPart.svelte
+++ b/src/components/admin/components/FightEditPart.svelte
@@ -29,7 +29,7 @@
export let start = "";
export let gamemode = "";
export let map = "";
- export let kampfleiter: string | undefined = "";
+ export let spectatePort: string | null = null;
export let group: string | null = "";
export let groupSearch = "";
@@ -115,8 +115,10 @@
disabled={customGamemode} class={customGamemode ? "cursor-not-allowed" : ""}>
-
-
+
+
+
+
diff --git a/src/components/admin/pages/Event.svelte b/src/components/admin/pages/Event.svelte
index ba30f28..de2ff3a 100644
--- a/src/components/admin/pages/Event.svelte
+++ b/src/components/admin/pages/Event.svelte
@@ -24,6 +24,7 @@
import FightList from "./event/FightList.svelte";
import TeamList from "./event/TeamList.svelte";
import {eventRepo} from "@repo/event.ts";
+ import RefereesList from "@components/admin/pages/event/RefereesList.svelte";
export let params: { id: number };
@@ -54,6 +55,10 @@
Teams
+
+ Referees
+
+
Fights
diff --git a/src/components/admin/pages/event/EventEdit.svelte b/src/components/admin/pages/event/EventEdit.svelte
index be359fc..3626df4 100644
--- a/src/components/admin/pages/event/EventEdit.svelte
+++ b/src/components/admin/pages/event/EventEdit.svelte
@@ -39,7 +39,8 @@
let member = event.maxTeamMembers;
let schemType = event.schemType;
let publicOnly = event.publicSchemsOnly;
- let spectateSystem = event.spectateSystem;
+ let addReferee: {name: string, id: number}[] = [];
+ let removeReferee: {name: string, id: number}[] = [];
let errorOpen = false;
let error: any = undefined;
@@ -65,7 +66,9 @@
member !== event.maxTeamMembers ||
schemType != event.schemType ||
publicOnly !== event.publicSchemsOnly ||
- spectateSystem !== event.spectateSystem;
+ addReferee.length > 0 ||
+ removeReferee.length > 0;
+
async function del() {
try {
@@ -87,8 +90,9 @@
name: name,
publicSchemsOnly: publicOnly,
schemType: schemType ?? "null",
- spectateSystem: spectateSystem,
- start: startDate
+ start: startDate,
+ addReferee: addReferee.map((ref) => ref.id),
+ removeReferee: removeReferee.map((ref) => ref.id)
};
try {
@@ -138,7 +142,6 @@
Public Schematics Only
- Spectate System
diff --git a/src/components/admin/pages/event/FightList.svelte b/src/components/admin/pages/event/FightList.svelte
index cf2f233..3557ab3 100644
--- a/src/components/admin/pages/event/FightList.svelte
+++ b/src/components/admin/pages/event/FightList.svelte
@@ -92,21 +92,21 @@
deleteOpen = false;
}
- let kampfleiterOpen = false;
+ let spectatePortOpen = false;
$: selectPlayers = $players.map(player => {
return {
name: player.name,
value: player.id.toString()
};
}).sort((a, b) => a.name.localeCompare(b.name));
- let kampfleiter = "";
+ let spectatePort = "";
- async function updateKampfleiter() {
+ async function updateSpectatePort() {
for (const fight of selectedFights) {
let f: UpdateFight = {
blueTeam: null,
group: null,
- kampfleiter: Number.parseInt(kampfleiter),
+ spectatePort: Number.parseInt(spectatePort),
map: null,
redTeam: null,
spielmodus: null,
@@ -116,8 +116,8 @@
}
fights = await $fightRepo.listFights(data.event.id);
selectedFights = new Set();
- kampfleiter = "";
- kampfleiterOpen = false;
+ spectatePort = "";
+ spectatePortOpen = false;
}
let groupChangeOpen = false;
@@ -142,7 +142,7 @@
let f: UpdateFight = {
blueTeam: null,
group: group,
- kampfleiter: null,
+ spectatePort: null,
map: null,
redTeam: null,
spielmodus: null,
@@ -168,7 +168,7 @@
let f: UpdateFight = {
blueTeam: null,
group: null,
- kampfleiter: null,
+ spectatePort: null,
map: null,
redTeam: null,
spielmodus: null,
@@ -198,11 +198,11 @@
Reschedule Fights
-
selectedFights.size > 0 ? kampfleiterOpen = true : kampfleiterOpen = false}
+ selectedFights.size > 0 ? spectatePortOpen = true : spectatePortOpen = false}
disabled={changedTime === undefined}>
- Change Kampfleiter
+ Change Spectate Port
selectedFights.size > 0 ? groupChangeOpen = true : groupChangeOpen = false}>
@@ -249,14 +249,14 @@
-
+
-
+
-
-
+
+
diff --git a/src/components/admin/pages/event/RefereesList.svelte b/src/components/admin/pages/event/RefereesList.svelte
new file mode 100644
index 0000000..0c1032f
--- /dev/null
+++ b/src/components/admin/pages/event/RefereesList.svelte
@@ -0,0 +1,99 @@
+
+
+
+
+
+ {#each referees as referee}
+ -
+ {referee.name}
+
+ Entfernen
+
+
+ {/each}
+
+ {#if referees.length === 0}
+ - Keine Schiedsrichter
+ {/if}
+
+
+
+
+
+
+
+ ({ name: v.name, value: v.id.toString() }))}/>
+
+
+
+ Abbrechen
+ Hinzufügen
+
+
+
+
diff --git a/src/components/admin/pages/event/modals/CreateFightModal.svelte b/src/components/admin/pages/event/modals/CreateFightModal.svelte
index b6dcb14..39519cf 100644
--- a/src/components/admin/pages/event/modals/CreateFightModal.svelte
+++ b/src/components/admin/pages/event/modals/CreateFightModal.svelte
@@ -39,7 +39,7 @@
let gamemode: string = "";
let map: string = "";
- let kampfleiter: string | undefined = undefined;
+ let spectatePort: string | null = null;
let group: string | null = null;
let groupSearch = "";
@@ -57,7 +57,7 @@
redTeam: parseInt(redTeam),
start: dayjs(start),
map,
- kampfleiter: parseInt(kampfleiter!),
+ spectatePort: spectatePort ? parseInt(spectatePort) : null,
group,
});
reset();
@@ -76,7 +76,7 @@
start = "";
gamemode = "";
map = "";
- kampfleiter = "";
+ spectatePort = "";
group = null;
groupSearch = "";
}
@@ -88,7 +88,7 @@
bind:blueTeam
bind:redTeam
bind:start
- bind:kampfleiter
+ bind:spectatePort
bind:gamemode
bind:map
bind:group
diff --git a/src/components/admin/pages/event/modals/FightEditModal.svelte b/src/components/admin/pages/event/modals/FightEditModal.svelte
index 0a3339a..16c9e0f 100644
--- a/src/components/admin/pages/event/modals/FightEditModal.svelte
+++ b/src/components/admin/pages/event/modals/FightEditModal.svelte
@@ -36,7 +36,7 @@
let redTeam = fight.redTeam.id.toString();
let blueTeam = fight.blueTeam.id.toString();
let start = dayjs(fight.start).utc(true).toISOString().slice(0, -1);
- let kampfleiter = fight.kampfleiter?.id.toString();
+ let spectatePort = fight.spectatePort?.toString() ?? null;
let gamemode = fight.spielmodus;
let map = fight.map;
let group = fight.group;
@@ -51,7 +51,7 @@
const update: UpdateFight = {
blueTeam: parseInt(blueTeam),
group: group === "" ? null : group,
- kampfleiter: parseInt(kampfleiter),
+ spectatePort: spectatePort == null ? null : parseInt(spectatePort),
map: map,
redTeam: parseInt(redTeam),
spielmodus: gamemode,
@@ -77,7 +77,7 @@
bind:blueTeam
bind:redTeam
bind:start
- bind:kampfleiter
+ bind:spectatePort
bind:gamemode
bind:map
bind:group
diff --git a/src/components/admin/pages/generate/GroupGenerator.svelte b/src/components/admin/pages/generate/GroupGenerator.svelte
index 6fbb3ee..e62ff49 100644
--- a/src/components/admin/pages/generate/GroupGenerator.svelte
+++ b/src/components/admin/pages/generate/GroupGenerator.svelte
@@ -28,6 +28,10 @@
import {replace} from "svelte-spa-router";
import dayjs from "dayjs";
import {fightRepo} from "@repo/fight.ts";
+ import utc from "dayjs/plugin/utc";
+
+ dayjs.extend(utc);
+
export let data: ExtendedEvent;
$: teams = new Map(data.teams.map(team => [team.id, team]));
diff --git a/src/components/repo/event.ts b/src/components/repo/event.ts
index f7f253b..626c079 100644
--- a/src/components/repo/event.ts
+++ b/src/components/repo/event.ts
@@ -31,14 +31,15 @@ export interface CreateEvent {
}
export interface UpdateEvent {
- name: string;
- start: Dayjs;
- end: Dayjs;
- deadline: Dayjs;
- maxTeamMembers: number;
- schemType: string | null;
- publicSchemsOnly: boolean;
- spectateSystem: boolean;
+ name?: string;
+ start?: Dayjs;
+ end?: Dayjs;
+ deadline?: Dayjs;
+ maxTeamMembers?: number;
+ schemType?: string | null;
+ publicSchemsOnly?: boolean;
+ addReferee?: number[];
+ removeReferee?: number[];
}
export class EventRepo {
@@ -74,13 +75,14 @@ export class EventRepo {
method: "PUT",
body: JSON.stringify({
name: event.name,
- start: +event.start,
- end: +event.end,
- deadline: +event.deadline,
+ start: event.start?.valueOf(),
+ end: event.end?.valueOf(),
+ deadline: event.deadline?.valueOf(),
maxTeamMembers: event.maxTeamMembers,
schemType: event.schemType,
publicSchemsOnly: event.publicSchemsOnly,
- spectateSystem: event.spectateSystem,
+ addReferee: event.addReferee,
+ removeReferee: event.removeReferee,
}),
headers: {
"Content-Type": "application/json",
diff --git a/src/components/repo/fight.ts b/src/components/repo/fight.ts
index 93bca15..1a33728 100644
--- a/src/components/repo/fight.ts
+++ b/src/components/repo/fight.ts
@@ -30,7 +30,7 @@ export interface CreateFight {
blueTeam: number;
redTeam: number;
start: Dayjs;
- kampfleiter: number | null;
+ spectatePort: number | null;
group: string | null;
}
@@ -40,7 +40,7 @@ export interface UpdateFight {
blueTeam: number | null;
redTeam: number | null;
start: Dayjs | null;
- kampfleiter: number | null;
+ spectatePort: number | null;
group: string | null;
}
@@ -64,7 +64,7 @@ export class FightRepo {
blueTeam: fight.blueTeam,
redTeam: fight.redTeam,
start: +fight.start,
- kampfleiter: fight.kampfleiter,
+ spectatePort: fight.spectatePort,
group: fight.group,
}),
}).then(value => value.json())
@@ -80,7 +80,7 @@ export class FightRepo {
blueTeam: fight.blueTeam,
redTeam: fight.redTeam,
start: fight.start?.valueOf(),
- kampfleiter: fight.kampfleiter,
+ spectatePort: fight.spectatePort ?? 0,
group: fight.group,
}),
}).then(value => value.json())
diff --git a/src/components/styled/SWButton.svelte b/src/components/styled/SWButton.svelte
index 571b693..69db075 100644
--- a/src/components/styled/SWButton.svelte
+++ b/src/components/styled/SWButton.svelte
@@ -18,6 +18,7 @@
-->
diff --git a/src/components/types/event.ts b/src/components/types/event.ts
index a822cc1..68c2cac 100644
--- a/src/components/types/event.ts
+++ b/src/components/types/event.ts
@@ -35,7 +35,7 @@ export const SWEventSchema = ShortEventSchema.extend({
maxTeamMembers: z.number(),
schemType: z.string().nullable(),
publicSchemsOnly: z.boolean(),
- spectateSystem: z.boolean(),
+ referees: z.array(PlayerSchema),
});
export type SWEvent = z.infer;
@@ -46,9 +46,9 @@ export const EventFightSchema = z.object({
map: z.string(),
blueTeam: TeamSchema,
redTeam: TeamSchema,
- kampfleiter: PlayerSchema.nullable(),
start: z.number(),
ergebnis: z.number(),
+ spectatePort: z.number().nullable(),
group: z.string().nullable(),
});