-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/frontend/web-laravel/resources/js/Pages/MapPools/Edit.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script> | ||
import Layout from '../../Shared/Layout.svelte' | ||
import { useForm } from '@inertiajs/svelte' | ||
import { preventDefault } from 'svelte/legacy' | ||
let { mapPool, mods } = $props() | ||
let form = useForm({ | ||
map_pool_id: mapPool.id, | ||
mod_id: null, | ||
}) | ||
</script> | ||
|
||
<Layout> | ||
<h1>{mapPool.id}</h1> | ||
|
||
<div class="flex flex-col justify-center text-center"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>#</th> | ||
<th>Name</th> | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{#each mapPool.maps as map, index (map.id)} | ||
<tr> | ||
<td>{index + 1}</td> | ||
<td>{map.name}</td> | ||
<td>{map.description}</td> | ||
</tr> | ||
{/each} | ||
</tbody> | ||
</table> | ||
<form onsubmit={preventDefault(() => $form.post('/map_pool_mods'))}> | ||
<button>Add Mod</button> | ||
</form> | ||
</div> | ||
</Layout> |
47 changes: 6 additions & 41 deletions
47
packages/frontend/web-laravel/resources/js/Pages/MapPools/Show.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,14 @@ | ||
<script> | ||
import { Link } from '@inertiajs/svelte' | ||
import Layout from '../../Shared/Layout.svelte' | ||
import { useForm } from '@inertiajs/svelte' | ||
import { preventDefault } from 'svelte/legacy' | ||
let { mapPool, mods } = $props() | ||
let form = useForm({ | ||
map_pool_id: mapPool.id, | ||
mod_id: null, | ||
}) | ||
const addMod = () => { | ||
$form.post(`/map_pool_maps`) | ||
} | ||
let { mapPool } = $props() | ||
</script> | ||
|
||
<Layout> | ||
<h1>{mapPool.id}</h1> | ||
<h1>{mapPool.name}</h1> | ||
|
||
<div class="flex flex-col justify-center text-center"> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>#</th> | ||
<th>Name</th> | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{#each mapPool.maps as map, index (map.id)} | ||
<tr> | ||
<td>{index + 1}</td> | ||
<td>{map.name}</td> | ||
<td>{map.description}</td> | ||
</tr> | ||
{/each} | ||
</tbody> | ||
</table> | ||
<form onsubmit={preventDefault(addMod)}> | ||
<select name="new-mod"> | ||
{#each mods as mod} | ||
<option value={mod.id}>{mod.name}</option> | ||
{/each} | ||
</select> | ||
<button>Add Mod</button> | ||
</form> | ||
</div> | ||
<Link href="/map_pools/{mapPool.id}/edit"> | ||
<button>Edit</button> | ||
</Link> | ||
</Layout> |