mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-03 10:19:14 +02:00
added different pages for editing
This commit is contained in:
@@ -23,7 +23,7 @@ type Entry struct {
|
|||||||
type Entries []*Entry
|
type Entries []*Entry
|
||||||
|
|
||||||
type FeedCollection struct {
|
type FeedCollection struct {
|
||||||
Name string `db:"Name" json:"Name"`
|
Name string `db:"Name" json:"name"`
|
||||||
Course string `db:"course" json:"Course"`
|
Course string `db:"course" json:"course"`
|
||||||
UserDefinedName string `db:"userDefinedName" json:"UserDefinedName"`
|
UserDefinedName string `db:"userDefinedName" json:"userDefinedName"`
|
||||||
}
|
}
|
||||||
|
@@ -18,3 +18,21 @@ export async function createIndividualFeed(modules: Module[]): Promise<string> {
|
|||||||
});
|
});
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function saveIndividualFeed(token: string, modules: Module[]): Promise<string> {
|
||||||
|
|
||||||
|
await fetch("/api/collections/feeds/records/" + token, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: "{\"modules\":" + JSON.stringify(modules) + "}",
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
token = response;
|
||||||
|
});
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
@@ -38,7 +38,6 @@ const ModuleInformation = defineAsyncComponent(
|
|||||||
() => import("./ModuleInformation.vue"),
|
() => import("./ModuleInformation.vue"),
|
||||||
);
|
);
|
||||||
|
|
||||||
//TODO add missing module prop informations for ModuleInformation.vue
|
|
||||||
async function showInfo(moduleName : string) {
|
async function showInfo(moduleName : string) {
|
||||||
|
|
||||||
const module: Ref<Module> = ref(new Module("", "", "", "", "", []));
|
const module: Ref<Module> = ref(new Module("", "", "", "", "", []));
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, PropType, Ref, ref, watch } from "vue";
|
import { computed, ComputedRef, PropType, Ref, ref, watch } from "vue";
|
||||||
import { Module } from "../model/module.ts";
|
import { Module } from "../model/module.ts";
|
||||||
import moduleStore from "../store/moduleStore";
|
import moduleStore from "../store/moduleStore";
|
||||||
import router from "../router";
|
import router from "../router";
|
||||||
@@ -11,24 +11,27 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
type ModuleWithSelection = { module: Module; selected: boolean };
|
||||||
|
|
||||||
// array of modules with boolean if selected with getter and setter
|
// array of modules with boolean if selected with getter and setter
|
||||||
const modulesWithSelection: Ref<{ module: Module; selected: boolean }[]> = ref(
|
const modulesWithSelection: Ref<ModuleWithSelection[]> = ref(
|
||||||
props.modules.map((module) => {
|
props.modules.map((propModule) => {
|
||||||
return { module: module, selected: false };
|
return { module: propModule, selected: moduleStore().modules.some((module: Module) =>
|
||||||
|
module.isEqual ? module.isEqual(propModule) : false,
|
||||||
|
), };
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
//watch for changes in modules prop and update modulesWithSelection
|
const selectedModules: ComputedRef<Module[]> = computed(() =>
|
||||||
|
modulesWithSelection.value
|
||||||
function selectedModules(): Module[] {
|
|
||||||
return modulesWithSelection.value
|
|
||||||
.filter((module) => module.selected)
|
.filter((module) => module.selected)
|
||||||
.map((module) => module.module);
|
.map((module) => module.module),
|
||||||
}
|
);
|
||||||
|
|
||||||
const currentModules = computed(() => props.modules);
|
const currentModules = computed(() => props.modules);
|
||||||
|
|
||||||
function selectAllModules(selection: boolean) {
|
function selectAllModules(selection: boolean) {
|
||||||
|
console.debug(props.modules);
|
||||||
modulesWithSelection.value.forEach((module) => {
|
modulesWithSelection.value.forEach((module) => {
|
||||||
module.selected = selection;
|
module.selected = selection;
|
||||||
});
|
});
|
||||||
@@ -36,10 +39,6 @@ function selectAllModules(selection: boolean) {
|
|||||||
|
|
||||||
const allSelected: Ref<boolean> = ref(true);
|
const allSelected: Ref<boolean> = ref(true);
|
||||||
|
|
||||||
computed(() => {
|
|
||||||
return modulesWithSelection.value.every((module) => module.selected);
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(currentModules, (newValue: Module[]) => {
|
watch(currentModules, (newValue: Module[]) => {
|
||||||
modulesWithSelection.value = newValue.map((module) => {
|
modulesWithSelection.value = newValue.map((module) => {
|
||||||
return { module: module, selected: false };
|
return { module: module, selected: false };
|
||||||
@@ -47,33 +46,30 @@ watch(currentModules, (newValue: Module[]) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function nextStep() {
|
function nextStep() {
|
||||||
console.log("next step");
|
selectedModules.value.forEach((module: Module) => {
|
||||||
selectedModules().forEach((module) => {
|
|
||||||
moduleStore().addModule(module);
|
moduleStore().addModule(module);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.debug(moduleStore().modules);
|
|
||||||
|
|
||||||
router.push("/additional-modules");
|
router.push("/additional-modules");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-column card-container">
|
<div class="flex flex-column card-container mx-8 mt-2">
|
||||||
<div class="flex align-items-center justify-content-center mb-3">
|
<div class="flex align-items-center justify-content-center mb-3">
|
||||||
<Button
|
<Button
|
||||||
:disabled="selectedModules().length < 1"
|
:disabled="selectedModules.length < 1"
|
||||||
class="col-4 justify-content-center"
|
class="col-4 justify-content-center"
|
||||||
@click="nextStep()"
|
@click="nextStep()"
|
||||||
>Next Step
|
>Next Step
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex align-items-center justify-content-center">
|
<div class="flex align-items-center justify-content-center">
|
||||||
<DataView :value="modulesWithSelection" data-key="name">
|
<DataView :value="modulesWithSelection" data-key="module">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="flex justify-content-between flex-wrap">
|
<div class="flex justify-content-between flex-wrap">
|
||||||
<div class="flex align-items-center justify-content-center">
|
<div class="flex align-items-center justify-content-center">
|
||||||
<h3>Modules - {{ selectedModules().length }}</h3>
|
<h3>Modules - {{ selectedModules.length }}</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex align-items-center justify-content-center">
|
<div class="flex align-items-center justify-content-center">
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
@@ -96,20 +92,18 @@ function nextStep() {
|
|||||||
<template #list="slotProps">
|
<template #list="slotProps">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div
|
<div
|
||||||
class="flex flex-column xl:flex-row xl:align-items-start p-4 gap-4"
|
class="flex flex-column xl:flex-row xl:align-items-start p-2 gap-4"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="flex flex-column sm:flex-row justify-content-between align-items-center xl:align-items-start flex-1 gap-4"
|
class="flex flex-column sm:flex-row justify-content-between align-items-center flex-1 gap-4"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="flex flex-column align-items-center sm:align-items-start gap-3"
|
class="flex flex-column align-items-center justify-content-center sm:align-items-start gap-3"
|
||||||
>
|
>
|
||||||
<div class="text-2xl">
|
<p class="text-lg">{{ slotProps.data.module.name }}</p>
|
||||||
{{ slotProps.data.module.name }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="flex sm:flex-column align-items-center sm:align-items-end gap-3 sm:gap-2"
|
class="flex sm:flex-column justify-content-center sm:align-items-end gap-3 sm:gap-2"
|
||||||
>
|
>
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
v-model="modulesWithSelection[slotProps.index].selected"
|
v-model="modulesWithSelection[slotProps.index].selected"
|
||||||
@@ -135,4 +129,4 @@ function nextStep() {
|
|||||||
width: 50rem;
|
width: 50rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
145
frontend/src/components/editCalendar/EditAdditionalModules.vue
Normal file
145
frontend/src/components/editCalendar/EditAdditionalModules.vue
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { defineAsyncComponent, ref, Ref } from "vue";
|
||||||
|
import { Module } from "../../model/module";
|
||||||
|
import { fetchAllModules } from "../../api/fetchCourse";
|
||||||
|
import moduleStore from "../../store/moduleStore";
|
||||||
|
import { MultiSelectAllChangeEvent } from "primevue/multiselect";
|
||||||
|
import router from "../../router";
|
||||||
|
import { fetchModule } from "../../api/fetchModule";
|
||||||
|
import { useDialog } from "primevue/usedialog";
|
||||||
|
const dialog = useDialog();
|
||||||
|
|
||||||
|
const fetchedModules = async () => {
|
||||||
|
return await fetchAllModules();
|
||||||
|
};
|
||||||
|
|
||||||
|
const modules: Ref<Module[]> = ref([]);
|
||||||
|
|
||||||
|
const selectedModules: Ref<Module[]> = ref([] as Module[]);
|
||||||
|
|
||||||
|
fetchedModules().then(
|
||||||
|
(data) =>
|
||||||
|
(modules.value = data.map((module: Module) => {
|
||||||
|
return module;
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
|
||||||
|
async function nextStep() {
|
||||||
|
selectedModules.value.forEach((module: Module) => {
|
||||||
|
moduleStore().addModule(module);
|
||||||
|
});
|
||||||
|
|
||||||
|
await router.push("/edit-calendar");
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
dialog.open(ModuleInformation, {
|
||||||
|
props: {
|
||||||
|
style: {
|
||||||
|
width: "50vw",
|
||||||
|
},
|
||||||
|
breakpoints: {
|
||||||
|
"960px": "75vw",
|
||||||
|
"640px": "90vw",
|
||||||
|
},
|
||||||
|
modal: true,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
module: module,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const display = (module: Module) => module.name + " (" + module.course + ")";
|
||||||
|
|
||||||
|
const selectAll = ref(false);
|
||||||
|
|
||||||
|
const onSelectAllChange = (event: MultiSelectAllChangeEvent) => {
|
||||||
|
selectedModules.value = event.checked
|
||||||
|
? modules.value.map((module) => module)
|
||||||
|
: [];
|
||||||
|
selectAll.value = event.checked;
|
||||||
|
};
|
||||||
|
|
||||||
|
function selectChange() {
|
||||||
|
selectAll.value = selectedModules.value.length === modules.value.length;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-column">
|
||||||
|
<div class="flex align-items-center justify-content-center h-4rem m-2">
|
||||||
|
<h3>
|
||||||
|
Select additional Modules that are not listed in the regular semester
|
||||||
|
for your Course
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card flex align-items-center justify-content-center m-2">
|
||||||
|
<MultiSelect
|
||||||
|
v-model="selectedModules"
|
||||||
|
:max-selected-labels="1"
|
||||||
|
:option-label="display"
|
||||||
|
:options="modules"
|
||||||
|
:select-all="selectAll"
|
||||||
|
:virtual-scroller-options="{ itemSize: 70 }"
|
||||||
|
class="custom-multiselect"
|
||||||
|
filter
|
||||||
|
placeholder="Select additional modules"
|
||||||
|
@change="selectChange()"
|
||||||
|
@selectall-change="onSelectAllChange($event)"
|
||||||
|
>
|
||||||
|
<template #option="slotProps">
|
||||||
|
<div class="flex justify-content-between w-full">
|
||||||
|
<div class="flex align-items-center justify-content-center">
|
||||||
|
<p class="text-1xl white-space-normal p-mb-0">
|
||||||
|
{{ display(slotProps.option) }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="flex align-items-center justify-content-center ml-2">
|
||||||
|
<Button
|
||||||
|
icon="pi pi-info"
|
||||||
|
severity="secondary"
|
||||||
|
rounded
|
||||||
|
outlined
|
||||||
|
aria-label="Information"
|
||||||
|
@click.stop="showInfo(slotProps.option.name)"
|
||||||
|
></Button>
|
||||||
|
<DynamicDialog />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #footer>
|
||||||
|
<div class="py-2 px-3">
|
||||||
|
<b>{{ selectedModules ? selectedModules.length : 0 }}</b>
|
||||||
|
item{{
|
||||||
|
(selectedModules ? selectedModules.length : 0) > 1 ? "s" : ""
|
||||||
|
}}
|
||||||
|
selected.
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</MultiSelect>
|
||||||
|
</div>
|
||||||
|
<div class="flex align-items-center justify-content-center h-4rem m-2">
|
||||||
|
<Button @click="nextStep()">Next Step</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
:deep(.custom-multiselect) {
|
||||||
|
width: 50rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.custom-multiselect li) {
|
||||||
|
height: unset;
|
||||||
|
}
|
||||||
|
</style>
|
115
frontend/src/components/editCalendar/EditModules.vue
Normal file
115
frontend/src/components/editCalendar/EditModules.vue
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import {
|
||||||
|
computed,
|
||||||
|
Ref,
|
||||||
|
ref,
|
||||||
|
} from "vue";
|
||||||
|
import { Module } from "../../model/module";
|
||||||
|
import moduleStore from "../../store/moduleStore";
|
||||||
|
import { fetchAllModules } from "../../api/fetchCourse";
|
||||||
|
import { createIndividualFeed, saveIndividualFeed } from "../../api/createFeed.ts";
|
||||||
|
import tokenStore from "../../store/tokenStore.ts";
|
||||||
|
import router from "../../router";
|
||||||
|
|
||||||
|
const tableData = computed(() =>
|
||||||
|
moduleStore().modules.map((module: Module) => {
|
||||||
|
return {
|
||||||
|
Course: module.course,
|
||||||
|
Module: module,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
const columns = ref([
|
||||||
|
{ field: "Course", header: "Course" },
|
||||||
|
{ field: "Module", header: "Module" },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const fetchedModules = async () => {
|
||||||
|
return await fetchAllModules();
|
||||||
|
};
|
||||||
|
|
||||||
|
function deleteAllModules() {
|
||||||
|
moduleStore().removeAllModules();
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteModule(module: Module) {
|
||||||
|
console.debug(module);
|
||||||
|
moduleStore().removeModule(module);
|
||||||
|
}
|
||||||
|
|
||||||
|
const modules: Ref<Module[]> = ref([]);
|
||||||
|
|
||||||
|
fetchedModules().then(
|
||||||
|
(data) =>
|
||||||
|
(modules.value = data.map((module: Module) => {
|
||||||
|
return module;
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
|
||||||
|
async function finalStep() {
|
||||||
|
await saveIndividualFeed(tokenStore().token, moduleStore().modules);
|
||||||
|
await router.push("/calendar-link");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-column card-container mx-8 mt-2">
|
||||||
|
<div class="flex align-items-center justify-content-center border-round m-2">
|
||||||
|
<DataTable
|
||||||
|
:value="tableData"
|
||||||
|
editMode="cell"
|
||||||
|
tableClass="editable-cells-table"
|
||||||
|
responsiveLayout="scroll"
|
||||||
|
>
|
||||||
|
<Column
|
||||||
|
v-for="col of columns"
|
||||||
|
:key="col.field"
|
||||||
|
:field="col.field"
|
||||||
|
:header="col.header"
|
||||||
|
>
|
||||||
|
<template #body="{ data, field }">
|
||||||
|
<div>
|
||||||
|
{{field === "Module" ? data[field].userDefinedName : data[field]}}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #editor="{ data, field }">
|
||||||
|
<template v-if="field !== 'Module'">
|
||||||
|
<div>{{ data[field] }}</div>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<InputText
|
||||||
|
class="w-full"
|
||||||
|
v-model="data[field].userDefinedName"
|
||||||
|
autofocus
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</Column>
|
||||||
|
<Column>
|
||||||
|
<template #body="{ data }">
|
||||||
|
<Button
|
||||||
|
@click="deleteModule(data['Module'])"
|
||||||
|
icon="pi pi-trash"
|
||||||
|
severity="danger"
|
||||||
|
outlined
|
||||||
|
rounded
|
||||||
|
aria-label="Cancel"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</Column>
|
||||||
|
</DataTable>
|
||||||
|
</div>
|
||||||
|
<div class="flex align-items-center justify-content-center border-round m-2">
|
||||||
|
<Button label="Save Calendar" @click="finalStep()" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
@media screen and (min-width: 962px) {
|
||||||
|
.empty-message {
|
||||||
|
width: 50rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@@ -1,38 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
|
|
||||||
import { ref, Ref } from "vue";
|
|
||||||
import moduleStore from "../../store/moduleStore";
|
|
||||||
import { getCalender } from "../../api/loadCalendar";
|
|
||||||
|
|
||||||
const token: Ref<string> = ref("");
|
|
||||||
|
|
||||||
|
|
||||||
function loadCalendar() {
|
|
||||||
moduleStore().removeAllModules();
|
|
||||||
|
|
||||||
getCalender(token.value).then((data) => {
|
|
||||||
console.log(data);
|
|
||||||
data.forEach((module) => {
|
|
||||||
moduleStore().addModule(module);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="flex flex-column">
|
|
||||||
<div class="flex align-items-center justify-content-center h-4rem border-round">
|
|
||||||
<p class="text-2xl">Please enter your existing calendar token</p>
|
|
||||||
</div>
|
|
||||||
<div class="flex align-items-center justify-content-center border-round m-2">
|
|
||||||
<InputText type="text" v-model="token" />
|
|
||||||
</div>
|
|
||||||
<div class="flex align-items-center justify-content-center border-round m-2">
|
|
||||||
<Button label="Load Calendar" @click="loadCalendar" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
@@ -9,4 +9,13 @@ export class Module {
|
|||||||
public semester: string,
|
public semester: string,
|
||||||
public events: Event[] = [],
|
public events: Event[] = [],
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
isEqual(module: Module): Boolean{
|
||||||
|
return (
|
||||||
|
this.name === module.name &&
|
||||||
|
this.course === module.course
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -7,6 +7,8 @@ import Imprint from "../components/Imprint.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 EditCalendarView from "../view/editCalendarView.vue";
|
import EditCalendarView from "../view/editCalendarView.vue";
|
||||||
|
import EditAdditionalModules from "../components/editCalendar/EditAdditionalModules.vue";
|
||||||
|
import EditModules from "../components/editCalendar/EditModules.vue";
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
@@ -26,6 +28,16 @@ const router = createRouter({
|
|||||||
name: "additional-modules",
|
name: "additional-modules",
|
||||||
component: AdditionalModules,
|
component: AdditionalModules,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/edit-additional-modules",
|
||||||
|
name: "edit-additional-modules",
|
||||||
|
component: EditAdditionalModules,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/edit-calendar",
|
||||||
|
name: "edit-calendar",
|
||||||
|
component: EditModules,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/calendar-link",
|
path: "/calendar-link",
|
||||||
name: "calendar-link",
|
name: "calendar-link",
|
||||||
|
@@ -1,9 +1,28 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
import LoadCalender from "../components/editCalendar/loadCalender.vue";
|
import { Ref, ref } from "vue";
|
||||||
|
import { Module } from "../model/module";
|
||||||
|
import moduleStore from "../store/moduleStore";
|
||||||
|
import { getCalender } from "../api/loadCalendar";
|
||||||
|
import router from "../router";
|
||||||
|
import tokenStore from "../store/tokenStore";
|
||||||
|
|
||||||
|
const token: Ref<string> = ref("");
|
||||||
|
const modules: Ref<Module[]> = ref(moduleStore().modules);
|
||||||
|
|
||||||
|
function loadCalendar() {
|
||||||
|
moduleStore().removeAllModules();
|
||||||
|
tokenStore().setToken(token.value);
|
||||||
|
|
||||||
|
getCalender(token.value).then((data) => {
|
||||||
|
data.forEach((module) => {
|
||||||
|
moduleStore().addModule(module);
|
||||||
|
});
|
||||||
|
modules.value = data;
|
||||||
|
});
|
||||||
|
|
||||||
|
router.push("/edit-additional-modules")
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -11,8 +30,14 @@ import LoadCalender from "../components/editCalendar/loadCalender.vue";
|
|||||||
<div class="flex align-items-center justify-content-center h-4rem mt-2">
|
<div class="flex align-items-center justify-content-center h-4rem mt-2">
|
||||||
<h3 class="text-2xl">Edit your HTWKalender <i class="pi pi-calendar vertical-align-baseline" style="font-size: 2rem"></i></h3>
|
<h3 class="text-2xl">Edit your HTWKalender <i class="pi pi-calendar vertical-align-baseline" style="font-size: 2rem"></i></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex align-items-center justify-content-center">
|
<div class="flex align-items-center justify-content-center h-4rem border-round">
|
||||||
<LoadCalender />
|
<p class="text-2xl">Please enter your existing calendar token</p>
|
||||||
|
</div>
|
||||||
|
<div class="flex align-items-center justify-content-center border-round m-2">
|
||||||
|
<InputText type="text" v-model="token" />
|
||||||
|
</div>
|
||||||
|
<div class="flex align-items-center justify-content-center border-round m-2">
|
||||||
|
<Button label="Load Calendar" @click="loadCalendar" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
Reference in New Issue
Block a user