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