mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-23 14:59:36 +02:00
Fix special adventure types
This commit is contained in:
parent
d5814fe6df
commit
aada13ca40
2 changed files with 55 additions and 23 deletions
|
@ -10,6 +10,8 @@
|
||||||
export let latitude: number | null = null;
|
export let latitude: number | null = null;
|
||||||
export let collection_id: string | null = null;
|
export let collection_id: string | null = null;
|
||||||
|
|
||||||
|
export let is_collection: boolean = false;
|
||||||
|
|
||||||
import { DefaultMarker, MapEvents, MapLibre } from 'svelte-maplibre';
|
import { DefaultMarker, MapEvents, MapLibre } from 'svelte-maplibre';
|
||||||
let markers: Point[] = [];
|
let markers: Point[] = [];
|
||||||
let query: string = '';
|
let query: string = '';
|
||||||
|
@ -27,9 +29,28 @@
|
||||||
|
|
||||||
let noPlaces: boolean = false;
|
let noPlaces: boolean = false;
|
||||||
|
|
||||||
|
let adventure: Adventure = {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
type: 'visited',
|
||||||
|
date: null,
|
||||||
|
end_date: null,
|
||||||
|
link: null,
|
||||||
|
description: null,
|
||||||
|
activity_types: [],
|
||||||
|
rating: NaN,
|
||||||
|
is_public: false,
|
||||||
|
latitude: NaN,
|
||||||
|
longitude: NaN,
|
||||||
|
location: null,
|
||||||
|
images: [],
|
||||||
|
user_id: null,
|
||||||
|
collection: collection_id || null
|
||||||
|
};
|
||||||
|
|
||||||
export let adventureToEdit: Adventure | null = null;
|
export let adventureToEdit: Adventure | null = null;
|
||||||
|
|
||||||
let adventure: Adventure = {
|
adventure = {
|
||||||
id: adventureToEdit?.id || '',
|
id: adventureToEdit?.id || '',
|
||||||
name: adventureToEdit?.name || '',
|
name: adventureToEdit?.name || '',
|
||||||
type: adventureToEdit?.type || 'visited',
|
type: adventureToEdit?.type || 'visited',
|
||||||
|
@ -228,9 +249,8 @@
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
modal = document.getElementById('my_modal_1') as HTMLDialogElement;
|
modal = document.getElementById('my_modal_1') as HTMLDialogElement;
|
||||||
if (modal) {
|
modal.showModal();
|
||||||
modal.showModal();
|
console.log('open');
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
|
@ -342,7 +362,9 @@
|
||||||
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
||||||
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
||||||
<div class="modal-box w-11/12 max-w-2xl" role="dialog" on:keydown={handleKeydown} tabindex="0">
|
<div class="modal-box w-11/12 max-w-2xl" role="dialog" on:keydown={handleKeydown} tabindex="0">
|
||||||
<h3 class="font-bold text-lg">Edit {adventure.type} Adventure</h3>
|
<h3 class="font-bold text-lg">
|
||||||
|
{adventureToEdit ? 'Edit Adventure' : 'New Adventure'}
|
||||||
|
</h3>
|
||||||
{#if adventure.id === '' || isDetails}
|
{#if adventure.id === '' || isDetails}
|
||||||
<div class="modal-action items-center">
|
<div class="modal-action items-center">
|
||||||
<form method="post" style="width: 100%;" on:submit={handleSubmit}>
|
<form method="post" style="width: 100%;" on:submit={handleSubmit}>
|
||||||
|
@ -360,6 +382,7 @@
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class="form-control">
|
<div class="form-control">
|
||||||
<label class="label cursor-pointer">
|
<label class="label cursor-pointer">
|
||||||
|
@ -385,6 +408,32 @@
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
{#if is_collection}
|
||||||
|
<div class="form-control">
|
||||||
|
<label class="label cursor-pointer">
|
||||||
|
<span class="label-text">Lodging</span>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="radio-10"
|
||||||
|
class="radio checked:bg-blue-500"
|
||||||
|
on:click={() => (adventure.type = 'lodging')}
|
||||||
|
checked={adventure.type == 'lodging'}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-control">
|
||||||
|
<label class="label cursor-pointer">
|
||||||
|
<span class="label-text">Dining</span>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="radio-10"
|
||||||
|
class="radio checked:bg-blue-500"
|
||||||
|
on:click={() => (adventure.type = 'dining')}
|
||||||
|
checked={adventure.type == 'dining'}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -186,6 +186,7 @@
|
||||||
collection_id={collection.id}
|
collection_id={collection.id}
|
||||||
startDate={collection.start_date}
|
startDate={collection.start_date}
|
||||||
endDate={collection.end_date}
|
endDate={collection.end_date}
|
||||||
|
is_collection={true}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
@ -307,24 +308,6 @@
|
||||||
Adventure</button
|
Adventure</button
|
||||||
>
|
>
|
||||||
|
|
||||||
<button
|
|
||||||
class="btn btn-primary"
|
|
||||||
on:click={() => {
|
|
||||||
isShowingCreateModal = true;
|
|
||||||
newType = 'lodging';
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Lodging</button
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class="btn btn-primary"
|
|
||||||
on:click={() => {
|
|
||||||
isShowingCreateModal = true;
|
|
||||||
newType = 'dining';
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Dining</button
|
|
||||||
>
|
|
||||||
<button
|
<button
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue