Data/Season: Add create team button
This commit is contained in:
@ -38,7 +38,10 @@
|
|||||||
const meta = $modalStore[0].meta;
|
const meta = $modalStore[0].meta;
|
||||||
|
|
||||||
team = meta.team;
|
team = meta.team;
|
||||||
|
require_inputs = meta.require_inputs;
|
||||||
disable_inputs = meta.disable_inputs;
|
disable_inputs = meta.disable_inputs;
|
||||||
|
banner_template = meta.banner_template;
|
||||||
|
logo_template = meta.logo_template;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -14,13 +14,13 @@
|
|||||||
children: Snippet;
|
children: Snippet;
|
||||||
|
|
||||||
/** The main color variant, e.g. "primary" or "secondary". */
|
/** The main color variant, e.g. "primary" or "secondary". */
|
||||||
color?: string | undefined;
|
color?: string;
|
||||||
|
|
||||||
/** Set the button type to "submit" (otherwise "button"). Only if "href" is undefined. */
|
/** Set the button type to "submit" (otherwise "button"). Only if "href" is undefined. */
|
||||||
submit?: boolean;
|
submit?: boolean;
|
||||||
|
|
||||||
/** Make the button act as a link. */
|
/** Make the button act as a link. */
|
||||||
href?: string | undefined;
|
href?: string;
|
||||||
|
|
||||||
/** Add a width class to the button. */
|
/** Add a width class to the button. */
|
||||||
width?: string;
|
width?: string;
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
type ModalStore,
|
type ModalStore,
|
||||||
} from "@skeletonlabs/skeleton";
|
} from "@skeletonlabs/skeleton";
|
||||||
|
|
||||||
import { Table, type LazyDropdownOption, type TableColumn } from "$lib/components";
|
import { Button, Table, type LazyDropdownOption, type TableColumn } from "$lib/components";
|
||||||
import { get_by_value } from "$lib/database";
|
import { get_by_value } from "$lib/database";
|
||||||
import {
|
import {
|
||||||
DRIVER_HEADSHOT_HEIGHT,
|
DRIVER_HEADSHOT_HEIGHT,
|
||||||
@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
let current_tab: number = $state(0);
|
let current_tab: number = $state(0);
|
||||||
if (form?.tab) {
|
if (form?.tab) {
|
||||||
// console.log(`Form returned current_tab=${form.current_tab}`);
|
|
||||||
current_tab = form.tab;
|
current_tab = form.tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +127,23 @@
|
|||||||
modalStore.trigger(modalSettings);
|
modalStore.trigger(modalSettings);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const create_team_handler = (event: Event) => {
|
||||||
|
const modalSettings: ModalSettings = {
|
||||||
|
type: "component",
|
||||||
|
component: "teamCard",
|
||||||
|
meta: {
|
||||||
|
banner_template:
|
||||||
|
get_by_value(data.graphics, "name", "team_banner_template")?.file_url ?? "Invalid",
|
||||||
|
logo_template:
|
||||||
|
get_by_value(data.graphics, "name", "team_logo_template")?.file_url ?? "Invalid",
|
||||||
|
require_inputs: true,
|
||||||
|
disable_inputs: !data.admin,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
modalStore.trigger(modalSettings);
|
||||||
|
};
|
||||||
|
|
||||||
const drivers_columns: TableColumn[] = [
|
const drivers_columns: TableColumn[] = [
|
||||||
{
|
{
|
||||||
data_value_name: "code",
|
data_value_name: "code",
|
||||||
@ -291,7 +307,11 @@
|
|||||||
<!-- Teams Tab -->
|
<!-- Teams Tab -->
|
||||||
<!-- Teams Tab -->
|
<!-- Teams Tab -->
|
||||||
<!-- Teams Tab -->
|
<!-- Teams Tab -->
|
||||||
<!-- TODO: Add team -->
|
<div class="pb-2">
|
||||||
|
<Button width="w-full" color="surface" onclick={create_team_handler}>
|
||||||
|
<b>Create New Team</b>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
<Table data={data.teams} columns={teams_columns} handler={teams_handler} />
|
<Table data={data.teams} columns={teams_columns} handler={teams_handler} />
|
||||||
{:else if current_tab === 1}
|
{:else if current_tab === 1}
|
||||||
<!-- Drivers Tab -->
|
<!-- Drivers Tab -->
|
||||||
|
|||||||
Reference in New Issue
Block a user