Merge branch 'feature-63411/Notizen_Anzahl_im_Tab_Header_anzeigen' into demo-cis40

This commit is contained in:
Harald Bamberger
2025-08-14 15:34:25 +02:00
5 changed files with 41 additions and 37 deletions
@@ -63,12 +63,12 @@ class Config extends FHCAPI_Controller
'config' => $config['details']
];
$showSuffix = $config['notes']['showCountNotes'] ?? false;
$result['notes'] = [
'title' => $this->p->t('stv', 'tab_notes'),
'component' => './Stv/Studentenverwaltung/Details/Notizen.js',
'config' => $config['notes'],
'showSuffix' => $showSuffix && ($config['notes']['showCountNotes'] ?? false)
'showSuffix' => ($config['notes']['showCountNotes'] ?? false),
'suffixhelper' => APP_ROOT . 'public/js/helpers/Stv/Studentenverwaltung/Details/Notizen/NotizenSuffixHelper.js'
];
$result['contact'] = [
+1 -20
View File
@@ -295,8 +295,7 @@ export default {
showType_id: false,
showId: false,
showLastupdate: false
},
newCount: null
}
}
},
methods: {
@@ -368,7 +367,6 @@ export default {
.catch(this.$fhcAlert.handleSystemError)
.finally(() => {
window.scrollTo(0, 0);
this.getCountNotes();
});
},
deleteNotiz(notiz_id) {
@@ -383,7 +381,6 @@ export default {
.catch(this.$fhcAlert.handleSystemError)
.finally(() => {
window.scrollTo(0, 0);
this.getCountNotes();
});
},
loadNotiz(notiz_id) {
@@ -427,7 +424,6 @@ export default {
.catch(this.$fhcAlert.handleSystemError)
.finally(() => {
window.scrollTo(0, 0);
this.getCountNotes();
});
},
reload() {
@@ -505,18 +501,6 @@ export default {
const columnToShow = "show" + column.charAt(0).toUpperCase() + column.slice(1);
this.showVariables[columnToShow] = true;
});
},
getCountNotes(){
return this.$api
.call(this.endpoint.getCountNotes(this.id))
.then(
result => {
this.newCount = result.data;
this.$nextTick(() => {
this.$emit('updateCount', this.newCount);
});
})
.catch(this.$fhcAlert.handleSystemError);
}
},
created() {
@@ -527,9 +511,6 @@ export default {
if (this.showTinyMce) {
await this.initTinyMCE();
}
this.$nextTick(() => {
this.getCountNotes();
});
},
watch: {
//watcher für Tinymce-Textfeld
@@ -16,12 +16,6 @@ export default {
countNotiz: ''
};
},
methods: {
updateCountNotes(countNew){
this.headerSuffix = "(" + countNew + ")";
this.$emit('update:suffix', this.headerSuffix);
}
},
template: `
<div class="stv-details-notizen h-100 pb-3">
@@ -37,7 +31,7 @@ export default {
show-document
show-tiny-mce
:visibleColumns="['titel','text','verfasser','bearbeiter','dokumente']"
@updateCount="updateCountNotes"
@reload="$emit('update:suffix')"
>
</core-notiz>
+29 -8
View File
@@ -14,7 +14,7 @@ export default {
emits: [
'update:modelValue',
'change',
'changed',
'changed'
],
props: {
config: {
@@ -67,9 +67,9 @@ export default {
}
},
methods: {
handleTabClick: function(index) {
handleTabClick: function (e) {
let keys = Object.keys(this.tabs);
this.change(keys[index]);
this.change(keys[e.index]);
},
change(key) {
this.$emit("change", key)
@@ -108,7 +108,8 @@ export default {
title: Vue.computed(() => item.title || key),
config: item.config,
key,
value
value,
suffixhelper: item.suffixhelper ?? null
};
}
@@ -125,15 +126,35 @@ export default {
}
this.tabs = tabs;
},
updateSuffix(event) {
if (this.currentTab?.value) {
this.currentTab.value.suffix = event;
updateSuffix() {
this.getTabSuffix(this.currentTab);
},
async getTabSuffix(tab) {
if (!tab.value.showSuffix) {
return;
}
if (tab.suffixhelper !== null) {
const suffixhelper = await import(tab.suffixhelper);
const suffix = await suffixhelper.getSuffix(this.$api, this.modelValue);
tab.value.suffix = suffix;
} else {
tab.value.suffix = '';
}
},
getTabSuffixes() {
Object.entries(this.tabs).forEach(([key, item]) => this.getTabSuffix(item));
}
},
created() {
this.initConfig(this.config);
},
mounted() {
this.getTabSuffixes();
},
updated() {
this.getTabSuffixes();
},
template: `
<template v-if="useprimevue">
@@ -146,7 +167,7 @@ export default {
<tabpanel
v-for="tab in tabs"
:key="tab.key"
:header="tab.title + (tab.value.showSuffix && tab.value.suffix ? tab.value.suffix : '')"
:header="tab.title + ((tab.value.showSuffix && tab.value.suffix !== '') ? ' ' + tab.value.suffix : '')"
>
<keep-alive>
<component
@@ -0,0 +1,8 @@
import ApiNotizPerson from '../../../../../api/factory/notiz/person.js';
export async function getSuffix(api, modelValue) {
const response = await api
.call(ApiNotizPerson.getCountNotes(modelValue.person_id));
const suffix = '(' + response.data + ')';
return suffix;
}