mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-16 09:38:49 +02:00
feat:#16 added frontend button
This commit is contained in:
@ -30,6 +30,18 @@ defineProps<{
|
||||
disabled: boolean;
|
||||
onClick: () => void;
|
||||
};
|
||||
upperButton?: {
|
||||
label: string;
|
||||
icon: string;
|
||||
disabled: boolean;
|
||||
onClick: () => void;
|
||||
};
|
||||
lowerButton?: {
|
||||
label: string;
|
||||
icon: string;
|
||||
disabled: boolean;
|
||||
onClick: () => void;
|
||||
};
|
||||
}>();
|
||||
|
||||
const slots = useSlots();
|
||||
@ -98,6 +110,23 @@ const hasContent = computed(() => {
|
||||
@click="button.onClick()"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="lowerButton"
|
||||
class="flex flex-wrap my-3 gap-2 align-items-center justify-content-end"
|
||||
>
|
||||
<Button
|
||||
:disabled="lowerButton.disabled"
|
||||
class="col-12 md:col-4"
|
||||
:icon="lowerButton.icon"
|
||||
:label="lowerButton.label"
|
||||
@click="lowerButton.onClick()"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="button"
|
||||
class="flex flex-wrap my-3 gap-2 align-items-center justify-content-end"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -17,12 +17,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Ref, computed, ref, watch } from "vue";
|
||||
import { Ref, computed, ref, watch, inject } from "vue";
|
||||
import { fetchRoom } from "@/api/fetchRoom.ts";
|
||||
import DynamicPage from "@/view/DynamicPage.vue";
|
||||
import RoomOccupation from "@/components/RoomOccupation.vue";
|
||||
import { computedAsync } from "@vueuse/core";
|
||||
import { router } from "@/main";
|
||||
import tokenStore from "@/store/tokenStore.ts";
|
||||
|
||||
type Room = {
|
||||
name: string;
|
||||
@ -80,6 +81,27 @@ watch(selectedRoom, (newRoom: Room) => {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const domain = import.meta.env.SSR
|
||||
? inject<string>("domain")!
|
||||
: window.location.hostname;
|
||||
|
||||
const getLink = (selectedRoom: string) =>
|
||||
"https://" + domain + "/api/feed/room?id=" + selectedRoom;
|
||||
|
||||
const button = computed(() => {
|
||||
return {
|
||||
label: "Copy iCal Link for" + selectedRoom.value.name,
|
||||
icon: "pi pi-calendar",
|
||||
disabled: selectedRoom.value.name === "",
|
||||
onClick: () => {
|
||||
// Copy iCal link to clipboard
|
||||
// localhost/api/feed/room?id=selectedRoom.value.name
|
||||
navigator.clipboard.writeText(getLink(selectedRoom.value.name));
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -88,6 +110,7 @@ watch(selectedRoom, (newRoom: Room) => {
|
||||
:headline="$t('roomFinderPage.headline')"
|
||||
:sub-title="$t('roomFinderPage.detail')"
|
||||
icon="pi pi-search"
|
||||
:lower-button="button"
|
||||
>
|
||||
<template #selection>
|
||||
<Dropdown
|
||||
@ -104,5 +127,12 @@ watch(selectedRoom, (newRoom: Room) => {
|
||||
<template #content>
|
||||
<RoomOccupation :room="selectedRoom.name" />
|
||||
</template>
|
||||
<template #footer>
|
||||
<Button
|
||||
class="col-12 md:col-4 mt-3"
|
||||
:label="$t('roomFinderPage.reset')"
|
||||
@click="selectedRoom.name = ''"
|
||||
/>
|
||||
</template>
|
||||
</DynamicPage>
|
||||
</template>
|
||||
|
@ -2,10 +2,10 @@ package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
pb "htwkalender/common/genproto/modules"
|
||||
"htwkalender/data-manager/service/db"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
type RoomServiceHandler struct {
|
||||
@ -20,7 +20,7 @@ func (s *RoomServiceHandler) GetRoomEvents(ctx context.Context, in *pb.GetRoomRe
|
||||
"room", in.Room,
|
||||
)
|
||||
|
||||
fmt.Errorf("Getting events for room %s", in.Room)
|
||||
slog.Error("GetRoomEvents", "room", in.Room)
|
||||
|
||||
// get events from database by room
|
||||
events, err := db.GetRoomSchedule(s.app, in.Room)
|
||||
|
Reference in New Issue
Block a user