Merge branch 'main' of github.com:masterElmar/htwkalender into 10-roomfinder

This commit is contained in:
Tom Wahl
2023-10-28 13:44:14 +02:00
24 changed files with 585 additions and 309 deletions

View File

@@ -27,6 +27,7 @@ export async function fetchModulesByCourseAndSemester(
modulesResponse.forEach((module: Module) =>
modules.push(
new Module(
module.uuid,
module.name,
course,
module.name,
@@ -50,6 +51,7 @@ export async function fetchAllModules(): Promise<Module[]> {
responseModules.forEach((module: Module) => {
modules.push(
new Module(
module.uuid,
module.name,
module.course,
module.name,

View File

@@ -1,12 +1,12 @@
import { Module } from "../model/module";
export async function fetchModule(name: string): Promise<Module> {
export async function fetchModule(module: Module): Promise<Module> {
const request = new Request("/api/module", {
method: "GET",
method: "POST",
headers: {
"Content-Type": "application/json",
Name: encodeURI(name),
},
body: JSON.stringify(module),
});
return await fetch(request)
@@ -16,6 +16,7 @@ export async function fetchModule(name: string): Promise<Module> {
.then(
(module: Module) =>
new Module(
module.uuid,
module.name,
module.course,
module.name,

View File

@@ -38,10 +38,9 @@ const ModuleInformation = defineAsyncComponent(
() => import("./ModuleInformation.vue"),
);
async function showInfo(moduleName: string) {
const module: Ref<Module> = ref(new Module("", "", "", "", "", []));
await fetchModule(moduleName).then((data) => {
module.value = data;
async function showInfo(module: Module) {
await fetchModule(module).then((data) => {
module = data;
});
dialog.open(ModuleInformation, {
props: {
@@ -66,7 +65,7 @@ const selectAll = ref(false);
const onSelectAllChange = (event: MultiSelectAllChangeEvent) => {
selectedModules.value = event.checked
? modules.value.map((module) => module)
? modules.value.map((module: Module) => module)
: [];
selectAll.value = event.checked;
};
@@ -112,7 +111,7 @@ function selectChange() {
rounded
outlined
aria-label="Information"
@click.stop="showInfo(slotProps.option.name)"
@click.stop="showInfo(slotProps.option)"
></Button>
<DynamicDialog />
</div>

View File

@@ -36,9 +36,8 @@ const ModuleInformation = defineAsyncComponent(
() => import("../ModuleInformation.vue"),
);
async function showInfo(moduleName: string) {
const module: Ref<Module> = ref(new Module("", "", "", "", "", []));
await fetchModule(moduleName).then((data) => {
async function showInfo(module: Module) {
await fetchModule(module).then((data) => {
module.value = data;
});
dialog.open(ModuleInformation, {
@@ -110,7 +109,7 @@ function selectChange() {
rounded
outlined
aria-label="Information"
@click.stop="showInfo(slotProps.option.name)"
@click.stop="showInfo(slotProps.option)"
></Button>
<DynamicDialog />
</div>

View File

@@ -2,6 +2,7 @@ import { Event } from "./event";
export class Module {
constructor(
public uuid: string,
public name: string,
public course: string,
public userDefinedName: string,