|
@@ -1,7 +1,7 @@
|
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
|
import { api_host, authToken } from '$lib';
|
|
import { api_host, authToken } from '$lib';
|
|
|
- import type { AppointmentInputs, AppointmentList, AppointmentTimes, WeekdayAppointment } from '$lib/dbdata';
|
|
|
|
|
- import { authFetch, getTimeSlots } from '$lib/funcs';
|
|
|
|
|
|
|
+ import type { AppointmentInputs, AppointmentList, AppointmentTimes, WeekdayAppointment, WeekSelection } from '$lib/dbdata';
|
|
|
|
|
+ import { authFetch, generateDateArray, getTimeSlots } from '$lib/funcs';
|
|
|
import CreatorBaseInputs from '$lib/modules/CreatorBaseInputs.svelte';
|
|
import CreatorBaseInputs from '$lib/modules/CreatorBaseInputs.svelte';
|
|
|
import CreatorInputs from '$lib/modules/CreatorInputs.svelte';
|
|
import CreatorInputs from '$lib/modules/CreatorInputs.svelte';
|
|
|
import CreatorTimeInputs from '$lib/modules/CreatorTimeInputs.svelte';
|
|
import CreatorTimeInputs from '$lib/modules/CreatorTimeInputs.svelte';
|
|
@@ -11,12 +11,14 @@
|
|
|
let creatorInputs: AppointmentInputs[] = [{ name: '', type: 'text' }];
|
|
let creatorInputs: AppointmentInputs[] = [{ name: '', type: 'text' }];
|
|
|
let topic: string;
|
|
let topic: string;
|
|
|
let location: string;
|
|
let location: string;
|
|
|
- let selectedWeek: number = 202502;
|
|
|
|
|
|
|
+ let selectedWeek: number = parseInt(moment().startOf("isoWeek").format("YYYYWW"), 10);
|
|
|
let previousWeek: number = selectedWeek;
|
|
let previousWeek: number = selectedWeek;
|
|
|
let duration: number = 15;
|
|
let duration: number = 15;
|
|
|
let dueDate: Date = new Date();
|
|
let dueDate: Date = new Date();
|
|
|
let description: string = "test";
|
|
let description: string = "test";
|
|
|
let renderTimeSelection: boolean = false;
|
|
let renderTimeSelection: boolean = false;
|
|
|
|
|
+ let appointmentSaved: boolean = false;
|
|
|
|
|
+ let weekSelection: WeekSelection[] = generateDateArray(50);
|
|
|
|
|
|
|
|
let appointmentList: AppointmentList[] = [
|
|
let appointmentList: AppointmentList[] = [
|
|
|
{
|
|
{
|
|
@@ -148,6 +150,12 @@
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ appointmentSaved = response.status === 200;
|
|
|
|
|
+
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ appointmentSaved = false;
|
|
|
|
|
+ }, 5000);
|
|
|
|
|
+
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
console.log(error);
|
|
|
}
|
|
}
|
|
@@ -155,6 +163,7 @@
|
|
|
|
|
|
|
|
onMount(() => {
|
|
onMount(() => {
|
|
|
// implement editor if query id param was detected
|
|
// implement editor if query id param was detected
|
|
|
|
|
+
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// get time slots before sending
|
|
// get time slots before sending
|
|
@@ -163,7 +172,7 @@
|
|
|
<h3 class="center-align top-padding bottom-padding">Termine</h3>
|
|
<h3 class="center-align top-padding bottom-padding">Termine</h3>
|
|
|
|
|
|
|
|
<fieldset>
|
|
<fieldset>
|
|
|
- <CreatorBaseInputs changeWeek={changeWeek} bind:topic bind:location bind:selectedWeek bind:duration />
|
|
|
|
|
|
|
+ <CreatorBaseInputs changeWeek={changeWeek} bind:weeks={weekSelection} bind:description bind:dueDate bind:topic bind:location bind:selectedWeek bind:duration />
|
|
|
|
|
|
|
|
{#if selectedWeekAppointments}
|
|
{#if selectedWeekAppointments}
|
|
|
{#key renderTimeSelection}
|
|
{#key renderTimeSelection}
|
|
@@ -179,6 +188,10 @@
|
|
|
<button on:click={saveAppointment} class="top-margin s12 large">Speichern</button>
|
|
<button on:click={saveAppointment} class="top-margin s12 large">Speichern</button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+{#if appointmentSaved}
|
|
|
|
|
+ <div class="snackbar green active">Erfolgreich erstellt</div>
|
|
|
|
|
+{/if}
|
|
|
|
|
+
|
|
|
<style>
|
|
<style>
|
|
|
fieldset {
|
|
fieldset {
|
|
|
max-width: 90%;
|
|
max-width: 90%;
|