mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-16 09:38:49 +02:00
fixed merge issue with main
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.idea/
|
||||||
|
.DS_Store
|
||||||
|
|
6
.idea/jsLibraryMappings.xml
generated
Normal file
6
.idea/jsLibraryMappings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptLibraryMappings">
|
||||||
|
<includedPredefinedLibrary name="Node.js Core" />
|
||||||
|
</component>
|
||||||
|
</project>
|
3
.idea/modules.xml
generated
3
.idea/modules.xml
generated
@ -2,7 +2,8 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/htwk-planner.iml" filepath="$PROJECT_DIR$/.idea/htwk-planner.iml" />
|
<module fileurl="file://$PROJECT_DIR$/backend/backend.iml" filepath="$PROJECT_DIR$/backend/backend.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/frontend/frontend.iml" filepath="$PROJECT_DIR$/frontend/frontend.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
169
.idea/workspace.xml
generated
Normal file
169
.idea/workspace.xml
generated
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AutoImportSettings">
|
||||||
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="81c34cb9-5538-45c5-b693-4f8a6bed15c4" name="Changes" comment="added missing idea files">
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
</list>
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="FormatOnSaveOptions">
|
||||||
|
<option name="myRunOnSave" value="false" />
|
||||||
|
<option name="myAllFileTypesSelected" value="true" />
|
||||||
|
<option name="mySelectedFileTypes">
|
||||||
|
<set />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="GOROOT" url="file://$USER_HOME$/sdk/go1.20" />
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||||
|
<map>
|
||||||
|
<entry key="$PROJECT_DIR$" value="main" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="GithubProjectSettings">
|
||||||
|
<option name="branchProtectionPatterns">
|
||||||
|
<list>
|
||||||
|
<option value="main" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="GoLibraries">
|
||||||
|
<option name="indexEntireGoPath" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="MacroExpansionManager">
|
||||||
|
<option name="directoryName" value="ps5ys6pz" />
|
||||||
|
</component>
|
||||||
|
<component name="MarkdownSettingsMigration">
|
||||||
|
<option name="stateVersion" value="1" />
|
||||||
|
</component>
|
||||||
|
<component name="OptimizeOnSaveOptions">
|
||||||
|
<option name="myRunOnSave" value="false" />
|
||||||
|
<option name="myAllFileTypesSelected" value="true" />
|
||||||
|
<option name="mySelectedFileTypes">
|
||||||
|
<set />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectColorInfo">{
|
||||||
|
"associatedIndex": 2
|
||||||
|
}</component>
|
||||||
|
<component name="ProjectId" id="2WqbaFt9UED5KZtHQV9GfCdMxMd" />
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
|
"keyToString": {
|
||||||
|
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
|
"RunOnceActivity.go.formatter.settings.were.checked": "true",
|
||||||
|
"RunOnceActivity.go.migrated.go.modules.settings": "true",
|
||||||
|
"WebServerToolWindowFactoryState": "false",
|
||||||
|
"git-widget-placeholder": "10-roomfinder",
|
||||||
|
"go.import.settings.migrated": "true",
|
||||||
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
|
"jdk.selected.JAVA_MODULE": "20",
|
||||||
|
"last_opened_file_path": "C:/Users/masterelmar/GolandProjects/htwk-planner",
|
||||||
|
"node.js.detected.package.eslint": "true",
|
||||||
|
"node.js.detected.package.tslint": "true",
|
||||||
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
|
"nodejs_package_manager_path": "npm",
|
||||||
|
"prettierjs.PrettierConfiguration.Package": "C:\\Users\\masterelmar\\GolandProjects\\htwk-planner\\frontend\\node_modules\\prettier",
|
||||||
|
"project.structure.last.edited": "Modules",
|
||||||
|
"project.structure.proportion": "0.0",
|
||||||
|
"project.structure.side.proportion": "0.42068964",
|
||||||
|
"settings.editor.selected.configurable": "com.goide.configuration.GoLibrariesConfigurableProvider",
|
||||||
|
"ts.external.directory.path": "C:\\Users\\masterelmar\\GolandProjects\\htwk-planner\\frontend\\node_modules\\typescript\\lib",
|
||||||
|
"vue.rearranger.settings.migration": "true"
|
||||||
|
}
|
||||||
|
}]]></component>
|
||||||
|
<component name="RecentsManager">
|
||||||
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
|
<recent name="$PROJECT_DIR$/frontend/src/components" />
|
||||||
|
</key>
|
||||||
|
</component>
|
||||||
|
<component name="RunManager">
|
||||||
|
<configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
|
||||||
|
<module name="htwk-planner" />
|
||||||
|
<working_directory value="$PROJECT_DIR$" />
|
||||||
|
<go_parameters value="-i" />
|
||||||
|
<kind value="FILE" />
|
||||||
|
<directory value="$PROJECT_DIR$" />
|
||||||
|
<filePath value="$PROJECT_DIR$" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration name="go build htwkalender" type="GoApplicationRunConfiguration" factoryName="Go Application" nameIsGenerated="true">
|
||||||
|
<module name="htwk-planner" />
|
||||||
|
<working_directory value="$PROJECT_DIR$/backend" />
|
||||||
|
<go_parameters value="-i" />
|
||||||
|
<kind value="PACKAGE" />
|
||||||
|
<package value="htwkalender" />
|
||||||
|
<directory value="$PROJECT_DIR$" />
|
||||||
|
<filePath value="$PROJECT_DIR$" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
<configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test">
|
||||||
|
<module name="htwk-planner" />
|
||||||
|
<working_directory value="$PROJECT_DIR$" />
|
||||||
|
<go_parameters value="-i" />
|
||||||
|
<kind value="DIRECTORY" />
|
||||||
|
<directory value="$PROJECT_DIR$" />
|
||||||
|
<filePath value="$PROJECT_DIR$" />
|
||||||
|
<framework value="gotest" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="81c34cb9-5538-45c5-b693-4f8a6bed15c4" name="Changes" comment="" />
|
||||||
|
<created>1697463118186</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1697463118186</updated>
|
||||||
|
<workItem from="1697463119285" duration="2319000" />
|
||||||
|
<workItem from="1697465553926" duration="3918000" />
|
||||||
|
<workItem from="1697823319671" duration="31000" />
|
||||||
|
<workItem from="1697823365338" duration="611000" />
|
||||||
|
<workItem from="1697823990507" duration="315000" />
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
<option name="version" value="3" />
|
||||||
|
</component>
|
||||||
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
<option name="TAB_STATES">
|
||||||
|
<map>
|
||||||
|
<entry key="MAIN">
|
||||||
|
<value>
|
||||||
|
<State />
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="VcsManagerConfiguration">
|
||||||
|
<MESSAGE value="restored idea git detection" />
|
||||||
|
<MESSAGE value="added missing idea files" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="added missing idea files" />
|
||||||
|
</component>
|
||||||
|
<component name="VgoProject">
|
||||||
|
<integration-enabled>false</integration-enabled>
|
||||||
|
<settings-migrated>true</settings-migrated>
|
||||||
|
</component>
|
||||||
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
|
<expand />
|
||||||
|
<select />
|
||||||
|
</component>
|
||||||
|
</project>
|
5
backend/.gitignore
vendored
5
backend/.gitignore
vendored
@ -21,3 +21,8 @@
|
|||||||
go.work
|
go.work
|
||||||
|
|
||||||
/pb_data/
|
/pb_data/
|
||||||
|
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
.vscode/
|
||||||
|
.DS_Store
|
||||||
|
12
backend/.idea/dataSources.xml
generated
Normal file
12
backend/.idea/dataSources.xml
generated
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="data" uuid="0cac75ec-a154-4b0c-a84d-58425c2050de">
|
||||||
|
<driver-ref>sqlite.xerial</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/pb_data/data.db</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
backend/.idea/jpa-buddy.xml
generated
Normal file
6
backend/.idea/jpa-buddy.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JpaBuddyIdeaProjectConfig">
|
||||||
|
<option name="renamerInitialized" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
9
backend/.idea/misc.xml
generated
Normal file
9
backend/.idea/misc.xml
generated
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectType">
|
||||||
|
<option name="id" value="jpab" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
backend/.idea/modules.xml
generated
Normal file
8
backend/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/backend.iml" filepath="$PROJECT_DIR$/backend.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
backend/.idea/vcs.xml
generated
Normal file
6
backend/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
9
backend/backend.iml
Normal file
9
backend/backend.iml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -107,6 +107,26 @@ func AddRoutes(app *pocketbase.PocketBase) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// API Endpoint to create a new iCal feed
|
// API Endpoint to create a new iCal feed
|
||||||
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||||
|
_, err := e.Router.AddRoute(echo.Route{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/api/schedule",
|
||||||
|
Handler: func(c echo.Context) error {
|
||||||
|
roomParam := c.QueryParam("room")
|
||||||
|
to := c.QueryParam("to")
|
||||||
|
from := c.QueryParam("from")
|
||||||
|
return room.GetRoomSchedule(c, app, roomParam, from, to)
|
||||||
|
},
|
||||||
|
Middlewares: []echo.MiddlewareFunc{
|
||||||
|
apis.ActivityLogger(app),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||||
_, err := e.Router.AddRoute(echo.Route{
|
_, err := e.Router.AddRoute(echo.Route{
|
||||||
Method: http.MethodPost,
|
Method: http.MethodPost,
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package db
|
package db
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/pocketbase/dbx"
|
"fmt"
|
||||||
"github.com/pocketbase/pocketbase"
|
|
||||||
"htwkalender/model"
|
"htwkalender/model"
|
||||||
"htwkalender/service/functions"
|
"htwkalender/service/functions"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/pocketbase/dbx"
|
||||||
|
"github.com/pocketbase/pocketbase"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetRooms(app *pocketbase.PocketBase) []string {
|
func GetRooms(app *pocketbase.PocketBase) []string {
|
||||||
@ -47,3 +50,31 @@ func GetRoomScheduleForDay(app *pocketbase.PocketBase, room string, date string)
|
|||||||
}
|
}
|
||||||
return events
|
return events
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetRoomSchedule(app *pocketbase.PocketBase, room string, from string, to string) []model.Event {
|
||||||
|
var events []model.Event
|
||||||
|
|
||||||
|
fromDate, err := time.Parse("2006-01-02", from)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Error parsing date 'from':", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
toDate, err := time.Parse("2006-01-02", to)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Error parsing date 'to':", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// get all events from event records in the events collection
|
||||||
|
err = app.Dao().DB().Select("*").From("events").
|
||||||
|
Where(dbx.Like("Rooms", room)).
|
||||||
|
AndWhere(dbx.Between("Start", fromDate, toDate)).
|
||||||
|
GroupBy("Week", "Start", "End", "Rooms").
|
||||||
|
All(&events)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
print("Error while getting events from database: ", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return events
|
||||||
|
}
|
||||||
|
@ -16,3 +16,8 @@ func GetRoomScheduleForDay(c echo.Context, app *pocketbase.PocketBase, room stri
|
|||||||
events := db.GetRoomScheduleForDay(app, room, date)
|
events := db.GetRoomScheduleForDay(app, room, date)
|
||||||
return c.JSON(http.StatusOK, events)
|
return c.JSON(http.StatusOK, events)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetRoomSchedule(c echo.Context, app *pocketbase.PocketBase, room string, from string, to string) error {
|
||||||
|
events := db.GetRoomSchedule(app, room, from, to)
|
||||||
|
return c.JSON(http.StatusOK, events)
|
||||||
|
}
|
||||||
|
1
frontend/.gitignore
vendored
1
frontend/.gitignore
vendored
@ -22,3 +22,4 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
*.iml
|
||||||
|
9
frontend/frontend.iml
Normal file
9
frontend/frontend.iml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
998
frontend/package-lock.json
generated
998
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,11 @@
|
|||||||
"format": "prettier . --write"
|
"format": "prettier . --write"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@fullcalendar/core": "^6.1.9",
|
||||||
|
"@fullcalendar/daygrid": "^6.1.9",
|
||||||
|
"@fullcalendar/interaction": "^6.1.9",
|
||||||
|
"@fullcalendar/timegrid": "^6.1.9",
|
||||||
|
"@fullcalendar/vue3": "^6.1.9",
|
||||||
"pinia": "^2.1.6",
|
"pinia": "^2.1.6",
|
||||||
"primeflex": "^3.3.1",
|
"primeflex": "^3.3.1",
|
||||||
"primeicons": "^6.0.1",
|
"primeicons": "^6.0.1",
|
||||||
@ -26,6 +31,8 @@
|
|||||||
"eslint-config-prettier": "^9.0.0",
|
"eslint-config-prettier": "^9.0.0",
|
||||||
"eslint-plugin-vue": "^9.17.0",
|
"eslint-plugin-vue": "^9.17.0",
|
||||||
"prettier": "3.0.2",
|
"prettier": "3.0.2",
|
||||||
|
"sass": "^1.69.5",
|
||||||
|
"sass-loader": "^13.3.2",
|
||||||
"typescript": "^5.0.2",
|
"typescript": "^5.0.2",
|
||||||
"vite": "^4.4.5",
|
"vite": "^4.4.5",
|
||||||
"vue-tsc": "^1.8.5"
|
"vue-tsc": "^1.8.5"
|
||||||
|
36
frontend/src/api/fetchRoom.ts
Normal file
36
frontend/src/api/fetchRoom.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import {Event} from "../model/event.ts";
|
||||||
|
|
||||||
|
export async function fetchRoom(): Promise<string[]> {
|
||||||
|
const rooms: string[] = [];
|
||||||
|
await fetch("/api/rooms")
|
||||||
|
.then((response) => {
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then((roomsResponse) => {
|
||||||
|
roomsResponse.forEach((room: string) => rooms.push(room));
|
||||||
|
});
|
||||||
|
return rooms;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchEventsByRoomAndDuration(
|
||||||
|
room: string,
|
||||||
|
from_date: string,
|
||||||
|
to_date: string,
|
||||||
|
): Promise<Event[]> {
|
||||||
|
const events: Event[] = [];
|
||||||
|
await fetch("/api/schedule?room=" + room + "&from=" + from_date + "&to=" + to_date)
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then((eventsResponse) => {
|
||||||
|
console.log("Response:", eventsResponse);
|
||||||
|
eventsResponse.forEach((event: Event) =>
|
||||||
|
events.push(event));
|
||||||
|
}).catch((error) => {
|
||||||
|
console.log("Error fetching events: ", error);
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
console.log("occupations: ", events);
|
||||||
|
return events;
|
||||||
|
}
|
@ -12,6 +12,11 @@ const items = ref([
|
|||||||
icon: "pi pi-fw pi-pencil",
|
icon: "pi pi-fw pi-pencil",
|
||||||
url: "/edit",
|
url: "/edit",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Check Room Availability",
|
||||||
|
icon: "pi pi-fw pi-calendar",
|
||||||
|
url: "/rooms",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "FAQ",
|
label: "FAQ",
|
||||||
icon: "pi pi-fw pi-book",
|
icon: "pi pi-fw pi-book",
|
||||||
|
50
frontend/src/components/RoomFinder.vue
Normal file
50
frontend/src/components/RoomFinder.vue
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
|
||||||
|
import {Ref, ref} from "vue";
|
||||||
|
import {fetchRoom} from "../api/fetchRoom.ts";
|
||||||
|
import RoomOccupation from "./RoomOccupation.vue";
|
||||||
|
|
||||||
|
const rooms = async () => {
|
||||||
|
return await fetchRoom();
|
||||||
|
};
|
||||||
|
|
||||||
|
const roomsList: Ref<{ name: string }[]> = ref([]);
|
||||||
|
const selectedRoom: Ref<{ name: string }> = ref({name: ""});
|
||||||
|
|
||||||
|
rooms().then(
|
||||||
|
(data) =>
|
||||||
|
(roomsList.value = data.map((room) => {
|
||||||
|
return {name: room};
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-column">
|
||||||
|
<div class="flex align-items-center justify-content-center h-4rem m-2">
|
||||||
|
<h3 class="text-4xl">Raumfinder</h3>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex align-items-center justify-content-center h-4rem border-round m-2"
|
||||||
|
>
|
||||||
|
<h5 class="text-2xl">Please select a room</h5>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex align-items-center justify-content-center border-round m-2"
|
||||||
|
>
|
||||||
|
<Dropdown
|
||||||
|
v-model="selectedRoom"
|
||||||
|
:options="roomsList"
|
||||||
|
class="w-full md:w-25rem mx-2"
|
||||||
|
filter
|
||||||
|
option-label="name"
|
||||||
|
placeholder="Select a Room"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="m-6"
|
||||||
|
>
|
||||||
|
<RoomOccupation :room="selectedRoom.name"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
139
frontend/src/components/RoomOccupation.vue
Normal file
139
frontend/src/components/RoomOccupation.vue
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import FullCalendar from '@fullcalendar/vue3'
|
||||||
|
import dayGridPlugin from '@fullcalendar/daygrid'
|
||||||
|
import interactionPlugin from '@fullcalendar/interaction'
|
||||||
|
import timeGridPlugin from '@fullcalendar/timegrid'
|
||||||
|
import {computed, ref, Ref, watch} from "vue";
|
||||||
|
import {CalendarOptions, EventInput} from "@fullcalendar/core";
|
||||||
|
import {fetchEventsByRoomAndDuration} from "../api/fetchRoom.ts";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
room: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
type CalenderEvent = {
|
||||||
|
id: number;
|
||||||
|
start: string;
|
||||||
|
end: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentDateFrom: Ref<string> = ref("");
|
||||||
|
const currentDateTo: Ref<string> = ref("");
|
||||||
|
const occupations: Ref<CalenderEvent[]> = ref([]);
|
||||||
|
|
||||||
|
const selectedRoom = computed(() => props.room);
|
||||||
|
|
||||||
|
watch(selectedRoom, (_newValue: string) => {
|
||||||
|
getOccupation();
|
||||||
|
});
|
||||||
|
|
||||||
|
const fullCalendar = ref<InstanceType<typeof FullCalendar>>()
|
||||||
|
|
||||||
|
async function getOccupation() {
|
||||||
|
if (selectedRoom.value === "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const events = await fetchEventsByRoomAndDuration(
|
||||||
|
selectedRoom.value,
|
||||||
|
currentDateFrom.value,
|
||||||
|
currentDateTo.value
|
||||||
|
);
|
||||||
|
occupations.value = events.map((event, index) => {
|
||||||
|
return {
|
||||||
|
id: index,
|
||||||
|
start: event.start.replace(/\s\+\d{4}\s\w+$/, '').replace(' ', 'T'),
|
||||||
|
end: event.end.replace(/\s\+\d{4}\s\w+$/, '').replace(' ', 'T')
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
let calendar = fullCalendar.value?.getApi()
|
||||||
|
calendar?.refetchEvents()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const calendarOptions: CalendarOptions = {
|
||||||
|
plugins: [dayGridPlugin, interactionPlugin, timeGridPlugin],
|
||||||
|
initialView: 'week',
|
||||||
|
dayHeaderFormat: {weekday: 'short', omitCommas: true},
|
||||||
|
slotDuration: "00:15:00",
|
||||||
|
eventTimeFormat: {
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
hour12: false
|
||||||
|
},
|
||||||
|
views: {
|
||||||
|
week: {
|
||||||
|
type: 'timeGrid',
|
||||||
|
slotLabelFormat: {
|
||||||
|
hour: 'numeric',
|
||||||
|
minute: '2-digit',
|
||||||
|
omitZeroMinute: false,
|
||||||
|
meridiem: false,
|
||||||
|
hour12: false
|
||||||
|
},
|
||||||
|
dateAlignment: "week",
|
||||||
|
titleFormat: {month: 'short', day: 'numeric'},
|
||||||
|
slotMinTime: "06:00:00",
|
||||||
|
slotMaxTime: "22:00:00",
|
||||||
|
|
||||||
|
duration: {days: 7},
|
||||||
|
firstDay: 1,
|
||||||
|
allDaySlot: false,
|
||||||
|
hiddenDays: [0]
|
||||||
|
},
|
||||||
|
Day: {
|
||||||
|
type: 'timeGrid',
|
||||||
|
slotLabelFormat: {
|
||||||
|
hour: 'numeric',
|
||||||
|
minute: '2-digit',
|
||||||
|
omitZeroMinute: false,
|
||||||
|
meridiem: false,
|
||||||
|
hour12: false
|
||||||
|
},
|
||||||
|
titleFormat: {month: 'short', day: 'numeric'},
|
||||||
|
slotMinTime: "06:00:00",
|
||||||
|
slotMaxTime: "22:00:00",
|
||||||
|
duration: {days: 1},
|
||||||
|
allDaySlot: false,
|
||||||
|
hiddenDays: [0]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
headerToolbar: {
|
||||||
|
end: 'prev,next today',
|
||||||
|
center: 'title',
|
||||||
|
start: 'week,Day'
|
||||||
|
},
|
||||||
|
|
||||||
|
datesSet: function (dateInfo) {
|
||||||
|
const view = dateInfo.view;
|
||||||
|
const offset = (new Date()).getTimezoneOffset();
|
||||||
|
const startDate = new Date(view.activeStart.getTime() - (offset*60*1000));
|
||||||
|
const endDate = new Date(view.activeEnd.getTime() - (offset*60*1000));
|
||||||
|
currentDateFrom.value = startDate.toISOString().split('T')[0]
|
||||||
|
currentDateTo.value = endDate.toISOString().split('T')[0]
|
||||||
|
getOccupation();
|
||||||
|
},
|
||||||
|
events: function(_info, successCallback, failureCallback) {
|
||||||
|
if (occupations.value.length === 0){
|
||||||
|
failureCallback(new Error("no events"))
|
||||||
|
}else{
|
||||||
|
successCallback(
|
||||||
|
occupations.value.map((event) => {
|
||||||
|
return {
|
||||||
|
id: event.id.toString(),
|
||||||
|
start: event.start,
|
||||||
|
end: event.end,
|
||||||
|
} as EventInput;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<FullCalendar ref="fullCalendar" :options="calendarOptions"/>
|
||||||
|
</template>
|
@ -1,13 +1,16 @@
|
|||||||
export class Event {
|
export class Event {
|
||||||
constructor(
|
constructor(
|
||||||
public name: string,
|
public bookedAt: string,
|
||||||
|
public course: string,
|
||||||
public day: string,
|
public day: string,
|
||||||
public start: string,
|
|
||||||
public end: string,
|
public end: string,
|
||||||
public prof: string,
|
|
||||||
public week: string,
|
|
||||||
public eventType: string,
|
public eventType: string,
|
||||||
public rooms: string,
|
public name: string,
|
||||||
public notes: string,
|
public notes: string,
|
||||||
|
public prof: string,
|
||||||
|
public rooms: string,
|
||||||
|
public semester: string,
|
||||||
|
public start: string,
|
||||||
|
public week: string,
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import CalendarLink from "../components/CalendarLink.vue";
|
|||||||
import Imprint from "../components/ImprintPage.vue";
|
import Imprint from "../components/ImprintPage.vue";
|
||||||
import PrivacyPolicy from "../components/PrivacyPolicy.vue";
|
import PrivacyPolicy from "../components/PrivacyPolicy.vue";
|
||||||
import RenameModules from "../components/RenameModules.vue";
|
import RenameModules from "../components/RenameModules.vue";
|
||||||
|
import RoomFinder from "../components/RoomFinder.vue";
|
||||||
import EditCalendarView from "../view/editCalendarView.vue";
|
import EditCalendarView from "../view/editCalendarView.vue";
|
||||||
import EditAdditionalModules from "../components/editCalendar/EditAdditionalModules.vue";
|
import EditAdditionalModules from "../components/editCalendar/EditAdditionalModules.vue";
|
||||||
import EditModules from "../components/editCalendar/EditModules.vue";
|
import EditModules from "../components/editCalendar/EditModules.vue";
|
||||||
@ -18,6 +19,11 @@ const router = createRouter({
|
|||||||
name: "course-selection",
|
name: "course-selection",
|
||||||
component: CourseSelection,
|
component: CourseSelection,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/rooms",
|
||||||
|
name: "room-finder",
|
||||||
|
component: RoomFinder,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/faq",
|
path: "/faq",
|
||||||
name: "faq",
|
name: "faq",
|
||||||
|
Reference in New Issue
Block a user