added dialog information transfer

This commit is contained in:
masterelmar
2023-10-17 00:04:10 +02:00
parent b9acdd3a34
commit 87b51fd6fe
4 changed files with 17 additions and 18 deletions

View File

@ -25,7 +25,7 @@ export async function fetchModulesByCourseAndSemester(
})
.then((modulesResponse) => {
modulesResponse.forEach((module: Module) =>
modules.push(new Module(module.id, module.name, course, module.name)),
modules.push(new Module(module.name, course, module.name)),
);
});
return modules;
@ -39,7 +39,7 @@ export async function fetchAllModules(): Promise<Module[]> {
})
.then((responseModules: Module[]) => {
responseModules.forEach((module: Module) => {
modules.push(new Module(module.id, module.name, module.course, module.name));
modules.push(new Module(module.name, module.course, module.name));
});
});

View File

@ -38,10 +38,9 @@ const ModuleInformation = defineAsyncComponent(
);
//TODO add missing module prop informations for ModuleInformation.vue
const showInfo = () => {
function showInfo(module : Module) {
dialog.open(ModuleInformation, {
props: {
header: "Product List",
style: {
width: "50vw",
},
@ -51,8 +50,11 @@ const showInfo = () => {
},
modal: true,
},
data: {
module: module,
},
});
};
}
const display = (module: Module) => module.name + " (" + module.course + ")";
@ -106,7 +108,7 @@ function selectChange() {
rounded
outlined
aria-label="Information"
@click.stop="showInfo()"
@click.stop="showInfo(slotProps.option)"
></Button>
<DynamicDialog />
</div>

View File

@ -1,26 +1,24 @@
<script lang="ts" setup>
import { PropType } from "vue";
import { inject } from "vue";
import { Module } from "../model/module.ts";
const props = defineProps({
module: {
type: Object as PropType<Module>,
required: true,
},
});
const dialogRef = inject("dialogRef") as any;
const module = dialogRef.value.data.module as Module;
console.debug(module);
</script>
<template>
<div>
<h2>{{ props.module.name }}</h2>
<h2>{{ module.name }}</h2>
<table>
<tr>
<td>Course:</td>
<td>{{ props.module.course }}</td>
<td>{{ module.course }}</td>
</tr>
<tr>
<td>ID:</td>
<td>{{ props.module.id }}</td>
<td>Termine:</td>
</tr>
</table>
</div>

View File

@ -1,6 +1,5 @@
export class Module {
constructor(
public id: string,
public name: string,
public course: string,
public userDefinedName: string,