|
|
@@ -8,12 +8,14 @@
|
|
|
import CreatorBaseInputs from '$lib/modules/CreatorBaseInputs.svelte';
|
|
|
import CreatorInputs from '$lib/modules/CreatorInputs.svelte';
|
|
|
import CreatorTimeInputs from '$lib/modules/CreatorTimeInputs.svelte';
|
|
|
+ import { t } from '$lib/translations';
|
|
|
import moment from 'moment';
|
|
|
import { onMount, tick } from 'svelte';
|
|
|
|
|
|
let creatorInputs: AppointmentInputs[] = [{ name: '', type: 'text' }];
|
|
|
let topic: string;
|
|
|
let location: string;
|
|
|
+ let participants: number = 0;
|
|
|
let selectedWeek: number = parseInt(moment().startOf("isoWeek").format("YYYYWW"), 10);
|
|
|
let previousWeek: number = selectedWeek;
|
|
|
let duration: number = 15;
|
|
|
@@ -48,7 +50,8 @@
|
|
|
* @returns An array of objects representing the days of the given week.
|
|
|
*/
|
|
|
export function generateAppointments(weekNumber: number, year: number): WeekdayAppointment[] {
|
|
|
- const weekdays = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'];
|
|
|
+ const weekdays = [$t("common.monday"), $t("common.tuesday"), $t("common.wednesday"), $t("common.thursday"), $t("common.friday"), $t("common.saturday"), $t("common.sunday")];
|
|
|
+
|
|
|
|
|
|
// Get the first day of the given calendar week (Monday-based week system)
|
|
|
const startOfWeek = moment().year(year).isoWeek(weekNumber).startOf('isoWeek');
|
|
|
@@ -130,7 +133,7 @@
|
|
|
|
|
|
async function saveAppointment() {
|
|
|
if (!topic || !description || !dueDate || !location || !duration || !creatorInputs || !appointmentList) {
|
|
|
- errorMessage = "not all parameters provided";
|
|
|
+ errorMessage = $t("common.error-parameters");
|
|
|
return;
|
|
|
}
|
|
|
console.log(appointmentList);
|
|
|
@@ -153,18 +156,19 @@
|
|
|
duration: duration,
|
|
|
times: convertedTimes,
|
|
|
inputs: creatorInputs,
|
|
|
- timeSpans: appointmentList
|
|
|
+ timeSpans: appointmentList,
|
|
|
+ participants: participants
|
|
|
})
|
|
|
});
|
|
|
|
|
|
appointmentSaved = response.status === 200;
|
|
|
|
|
|
if (response.status === 400) {
|
|
|
- errorMessage = "not all parameters provided";
|
|
|
+ errorMessage = $t("common.error-parameters");
|
|
|
}
|
|
|
|
|
|
if (response.status === 500) {
|
|
|
- errorMessage = "internal server error";
|
|
|
+ errorMessage = $t("common.error-server");
|
|
|
}
|
|
|
|
|
|
setTimeout(() => {
|
|
|
@@ -196,6 +200,7 @@
|
|
|
creatorInputs = js.inputs;
|
|
|
location = js.place;
|
|
|
duration = js.duration;
|
|
|
+ participants = js.participants;
|
|
|
dueDate = getDateString(js.dueDate);
|
|
|
console.log(js.dueDate);
|
|
|
description = js.description;
|
|
|
@@ -224,10 +229,10 @@
|
|
|
// get time slots before sending
|
|
|
</script>
|
|
|
|
|
|
-<h3 class="center-align top-padding bottom-padding">Termine</h3>
|
|
|
+<h3 class="center-align top-padding bottom-padding">{$t("common.appointments")}</h3>
|
|
|
|
|
|
<fieldset>
|
|
|
- <CreatorBaseInputs changeWeek={changeWeek} bind:weeks={weekSelection} bind:description bind:dueDate bind:topic bind:location bind:selectedWeek bind:duration />
|
|
|
+ <CreatorBaseInputs changeWeek={changeWeek} bind:participants bind:weeks={weekSelection} bind:description bind:dueDate bind:topic bind:location bind:selectedWeek bind:duration />
|
|
|
|
|
|
{#if selectedWeekAppointments}
|
|
|
{#key renderTimeSelection}
|
|
|
@@ -240,11 +245,11 @@
|
|
|
<CreatorInputs bind:creatorInputs />
|
|
|
|
|
|
<div class="grid">
|
|
|
- <button on:click={saveAppointment} class="top-margin s12 large">Speichern</button>
|
|
|
+ <button on:click={saveAppointment} class="top-margin s12 large">{$t("common.save")}</button>
|
|
|
</div>
|
|
|
|
|
|
{#if appointmentSaved}
|
|
|
- <div class="snackbar green active">Erfolgreich gespeichert</div>
|
|
|
+ <div class="snackbar green active">{$t("common.sucess-creator-save")}</div>
|
|
|
{/if}
|
|
|
|
|
|
{#if errorMessage}
|