add delete to admin panel
All checks were successful
deploy / build-and-deploy (push) Successful in 21s
All checks were successful
deploy / build-and-deploy (push) Successful in 21s
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user