From 6324bc50b957ac0f374dc78f9fef97bcd02f79f2 Mon Sep 17 00:00:00 2001 From: chfhtw Date: Fri, 11 Sep 2026 11:32:27 +0200 Subject: [PATCH] Add CalculatedVars "Studiengang of user" --- .../Edit/Report/Vars/Calc/Right.js | 38 +++++++++++++++++++ .../DashboardWidget/Report/CalculatedVars.js | 2 + .../Report/CalculatedVars/UserStgs.js | 34 +++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars/Calc/Right.js create mode 100644 public/js/composables/DashboardWidget/Report/CalculatedVars/UserStgs.js diff --git a/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars/Calc/Right.js b/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars/Calc/Right.js new file mode 100644 index 000000000..cb17c1d9b --- /dev/null +++ b/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars/Calc/Right.js @@ -0,0 +1,38 @@ +import FormInput from '../../../../../../Form/Input.js'; + +export default { + name: "WidgetsGenteratorReportVarsVarCalcRight", + components: { + FormInput, + }, + props: { + modelValue: { + type: String, + default: '' + }, + }, + emits: [ + "update:modelValue", + ], + computed: { + modelValueCmp: { + get() { + return this.modelValue; + }, + set(v) { + this.$emit('update:modelValue', v); + }, + }, + }, + // TODO(chris): phrases: placeholder + template: /*html*/ ` + + + `, +}; diff --git a/public/js/composables/DashboardWidget/Report/CalculatedVars.js b/public/js/composables/DashboardWidget/Report/CalculatedVars.js index 254071a1b..abca0f331 100644 --- a/public/js/composables/DashboardWidget/Report/CalculatedVars.js +++ b/public/js/composables/DashboardWidget/Report/CalculatedVars.js @@ -17,11 +17,13 @@ import CurrentStudienjahr from './CalculatedVars/CurrentStudienjahr.js'; import CalcDate from './CalculatedVars/CalcDate.js'; +import UserStgs from './CalculatedVars/UserStgs.js'; export function useCalculatedVars() { let calculations = { CurrentStudienjahr, CalcDate, + UserStgs, }; const components = Vue.ref({}); diff --git a/public/js/composables/DashboardWidget/Report/CalculatedVars/UserStgs.js b/public/js/composables/DashboardWidget/Report/CalculatedVars/UserStgs.js new file mode 100644 index 000000000..e19991e4c --- /dev/null +++ b/public/js/composables/DashboardWidget/Report/CalculatedVars/UserStgs.js @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2026 fhcomplete.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import CalcRight from '../../../../components/Dashboard/WidgetAdmin/Edit/Report/Vars/Calc/Right.js'; + +import ApiStudiengang from '../../../../api/factory/studiengang.js'; + +export default { + label: 'UserStgs', + component: CalcRight, + async calculate(instructions) { + try { + const result = await this.$api.call(ApiStudiengang.getAllowed(instructions[2])); + return result.data; + } catch(error) { + this.$fhcAlert.handleSystemError(error); + } + return null; + }, +} \ No newline at end of file