add delete to admin panel
All checks were successful
deploy / build-and-deploy (push) Successful in 21s

This commit is contained in:
2025-05-21 20:53:53 +02:00
parent e47268111a
commit 45f984e4da
16 changed files with 207 additions and 50 deletions

View File

@@ -1,7 +1,8 @@
<script lang="ts">
import { addTeam, teams } from '@app/admin/teams/teams.ts';
import { addTeam, deleteTeam, type Team, teams } from '@app/admin/teams/teams.ts';
import DataTable from '@components/admin/table/DataTable.svelte';
import CrudPopup from '@components/admin/popup/CrudPopup.svelte';
import { confirmPopupState } from '@components/popup/ConfirmPopup.ts';
// state
let editPopupTeam = $state(null);
@@ -11,6 +12,15 @@
$effect(() => {
if (!editPopupOpen) editPopupTeam = null;
});
// callback
function onTeamDelete(team: Team) {
$confirmPopupState = {
title: 'Team löschen?',
message: 'Soll das Team wirklich gelöscht werden?',
onConfirm: () => deleteTeam(team)
};
}
</script>
{#snippet color(value: string)}
@@ -27,6 +37,7 @@
{ key: 'memberTwo.username', label: 'Spieler 2', width: 30 }
]}
onEdit={(team) => (editPopupTeam = team)}
onDelete={onTeamDelete}
/>
<CrudPopup