mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2026-01-16 19:42:26 +01:00
[#10] Move to new endpoint (room schedule for given duration)
This commit is contained in:
@@ -1,32 +1,14 @@
|
||||
<script lang="ts" setup>
|
||||
|
||||
import {Ref, ref} from "vue";
|
||||
import {fetchEventsByRoomAndWeek, fetchRoom} from "../api/fetchRoom.ts";
|
||||
import InputNumber from 'primevue/inputnumber';
|
||||
import {fetchRoom} from "../api/fetchRoom.ts";
|
||||
import RoomOccupation from "./RoomOccupation.vue";
|
||||
import {Event} from "../model/event.ts";
|
||||
|
||||
const rooms = async () => {
|
||||
return await fetchRoom();
|
||||
};
|
||||
|
||||
const roomsList: Ref<{ name: string }[]> = ref([]);
|
||||
|
||||
const days: Ref<{ name: string; value: string }[]> = ref([
|
||||
{name: "Montag", value: "mo"},
|
||||
{name: "Dienstag", value: "di"},
|
||||
{name: "Mittwoch", value: "mi"},
|
||||
{name: "Donnerstag", value: "do"},
|
||||
{name: "Donnerstag", value: "fr"},
|
||||
{name: "Donnerstag", value: "sa"},
|
||||
]);
|
||||
|
||||
const selectedDay: Ref<{ name: string; value: string }> = ref(
|
||||
days.value[0],
|
||||
);
|
||||
|
||||
const selectedWeekNumber: Ref<number> = ref(
|
||||
1
|
||||
);
|
||||
const selectedRoom: Ref<{ name: string }> = ref({name: ""});
|
||||
|
||||
rooms().then(
|
||||
@@ -35,16 +17,6 @@ rooms().then(
|
||||
return {name: room};
|
||||
})),
|
||||
);
|
||||
|
||||
|
||||
const occupations: Ref<Event[]> = ref([]);
|
||||
|
||||
async function getOccupation() {
|
||||
occupations.value = await fetchEventsByRoomAndWeek(
|
||||
selectedRoom.value.name,
|
||||
selectedWeekNumber.value,
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -67,18 +39,8 @@ async function getOccupation() {
|
||||
filter
|
||||
option-label="name"
|
||||
placeholder="Select a Room"
|
||||
@change="getOccupation()"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="flex align-items-center justify-content-center border-round m-2"
|
||||
>
|
||||
<div class="flex flex-column gap-2">
|
||||
<InputNumber id="week-number-input" v-model="selectedWeekNumber" inputId="minmax" :min="0" :max="100"
|
||||
showButtons/>
|
||||
<small id="username-help">Planning Week</small>
|
||||
</div>
|
||||
</div>
|
||||
<RoomOccupation :occupations="occupations"/>
|
||||
<RoomOccupation :room="selectedRoom.name"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user