Merge branch 'feature-69438/FHC4_Studierendenverwaltung/FeedbackPunkte' into demo-cis40

This commit is contained in:
Harald Bamberger
2025-12-02 09:46:25 +01:00
15 changed files with 506 additions and 307 deletions
+31 -20
View File
@@ -38,16 +38,18 @@ export default {
url: 'api/frontend/v1/messages/messages/getMsgVarsLoggedInUser/'
};
},
getMessageVarsPerson(userParams){
getMessageVarsPerson(ids, type_id){
return {
method: 'post',
url: 'api/frontend/v1/messages/messages/getMessageVarsPerson/' + userParams.id + '/' + userParams.type_id
url: 'api/frontend/v1/messages/messages/getMessageVarsPerson/' + type_id,
params: {ids}
};
},
getMsgVarsPrestudent(userParams){
getMsgVarsPrestudent(ids, type_id){
return {
method: 'post',
url: 'api/frontend/v1/messages/messages/getMsgVarsPrestudent/' + userParams.id + '/' + userParams.type_id
url: 'api/frontend/v1/messages/messages/getMsgVarsPrestudent/' + type_id,
params: {ids}
};
},
getPersonId(params){
@@ -56,28 +58,30 @@ export default {
url: 'api/frontend/v1/messages/messages/getPersonId/' + params.id + '/' + params.type_id
};
},
getUid(userParams){
/* getUid(ids, type_id){
return {
method: 'get',
url: 'api/frontend/v1/messages/messages/getUid/' + userParams.id + '/' + userParams.type_id
method: 'post',
url: 'api/frontend/v1/messages/messages/getUids/' + type_id,
params: {ids}
};
},
},*/
getDataVorlage(vorlage_kurzbz){
return {
method: 'get',
url: 'api/frontend/v1/messages/messages/getDataVorlage/' + vorlage_kurzbz
};
},
getNameOfDefaultRecipient(params){
return {
method: 'get',
url: 'api/frontend/v1/messages/messages/getNameOfDefaultRecipient/' + params.id + '/' + params.type_id
};
},
getPreviewText(userParams, params){
getNameOfDefaultRecipients(ids, type_id){
return {
method: 'post',
url: 'api/frontend/v1/messages/messages/getPreviewText/' + userParams.id + '/' + userParams.type_id,
url: 'api/frontend/v1/messages/messages/getNameOfDefaultRecipients/' + type_id,
params: {ids}
};
},
getPreviewText(type_id, params){
return {
method: 'post',
url: 'api/frontend/v1/messages/messages/getPreviewText/' + type_id,
params
};
},
@@ -87,17 +91,24 @@ export default {
url: 'api/frontend/v1/messages/messages/getReplyData/' + messageId
};
},
sendMessageFromModalContext(id, params) {
/* sendMessageFromModalContext(id, params) {
return {
method: 'post',
url: 'api/frontend/v1/messages/messages/sendMessage/' + id,
params
};
},
sendMessage(id, params) {
}, */
sendMessageFromModalContext(type_id, params) {
return {
method: 'post',
url: 'api/frontend/v1/messages/messages/sendMessage/' + id,
url: 'api/frontend/v1/messages/messages/sendMessage/' + type_id,
params
};
},
sendMessage(type_id, params) {
return {
method: 'post',
url: 'api/frontend/v1/messages/messages/sendMessage/' + type_id,
params
};
},
+4 -3
View File
@@ -1,14 +1,15 @@
import NewMessage from "../components/Messages/Details/NewMessage/NewDiv.js";
import Phrasen from "../plugin/Phrasen.js";
import Phrasen from "../plugins/Phrasen.js";
const ciPath = FHC_JS_DATA_STORAGE_OBJECT.app_root.replace(/(https:|)(^|\/\/)(.*?\/)/g, '') + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
const router = VueRouter.createRouter({
history: VueRouter.createWebHistory(),
routes: [
{ path: `/${ciPath}/NeueNachricht/:id/:typeId`, component: NewMessage },
{ path: `/${ciPath}/NeueNachricht/:id/:typeId/:messageId`, component: NewMessage },
{ path: `/${ciPath}/NeueNachricht`, component: NewMessage, props: true },
{ path: `/${ciPath}/NeueNachricht/:id/:typeId`, component: NewMessage, props: true },
{ path: `/${ciPath}/NeueNachricht/:id/:typeId/:messageId`, component: NewMessage, props: true },
]
});
@@ -20,7 +20,7 @@ export default {
},
typeId: String,
id: {
type: [Number, String],
type: Array,
required: true
},
messageId: {
@@ -43,6 +43,8 @@ export default {
vorlagen: [],
recipientsArray: [],
defaultRecipient: null,
defaultRecipients: [],
defaultRecipientString: null,
editor: null,
fieldsUser: [],
fieldsPerson: [],
@@ -56,7 +58,7 @@ export default {
previewText: null,
previewBody: "",
replyData: null,
uid: null,
}
},
methods: {
@@ -111,28 +113,22 @@ export default {
},
sendMessage() {
const data = new FormData();
const params = {
id: this.id,
type_id: this.typeId
};
const merged = {
...this.formData,
...params
};
data.append('data', JSON.stringify(merged));
data.append('data', JSON.stringify(this.formData));
data.append('ids', JSON.stringify(this.id));
return this.$refs.formMessage
.call(this.endpoint.sendMessageFromModalContext(this.uid, data))
.call(this.endpoint.sendMessageFromModalContext(this.typeId, data))
.then(response => {
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSent'));
this.hideModal('modalNewMessage');
this.resetForm();
}).catch(this.$fhcAlert.handleSystemError)
.finally(() => {
//this.resetForm();
//closeModal
//closewindwo
//just emit if no multitasking
if(this.id.length == 1){
this.$emit('reloadTable');
}
}
);
},
@@ -146,14 +142,15 @@ export default {
},
getPreviewText(){
const data = new FormData();
data.append('data', JSON.stringify(this.formData.body));
data.append('ids', JSON.stringify(this.id));
return this.$api
.call(this.endpoint.getPreviewText({
id: this.id,
type_id: this.typeId}, data))
.call(this.endpoint.getPreviewText(
this.typeId, data))
.then(response => {
this.previewText = response.data;
const previews = response.data;
this.previewText = previews[this.defaultRecipient];
}).catch(this.$fhcAlert.handleSystemError)
.finally(() => {
//this.resetForm();
@@ -201,18 +198,6 @@ export default {
this.previewBody = this.previewText;
});
},
getUid(id, typeId){
const params = {
id: id,
type_id: typeId
};
this.$api
.call(this.endpoint.getUid(params))
.then(result => {
this.uid = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
},
show(){
this.$refs.modalNewMessage.show();
},
@@ -260,15 +245,9 @@ export default {
}
},
created(){
this.getUid(this.id, this.typeId);
if(this.typeId == 'person_id' || this.typeId == 'mitarbeiter_uid'){
const params = {
id: this.id,
type_id: this.typeId
};
this.$api
.call(this.endpoint.getMessageVarsPerson(params))
.call(this.endpoint.getMessageVarsPerson(this.id, this.typeId))
.then(result => {
this.fieldsPerson = result.data;
const person = this.fieldsPerson[0];
@@ -281,12 +260,8 @@ export default {
}
if(this.typeId == 'prestudent_id' || this.typeId == 'uid'){
const params = {
id: this.id,
type_id: this.typeId
};
this.$api
.call(this.endpoint.getMsgVarsPrestudent(params))
.call(this.endpoint.getMsgVarsPrestudent(this.id, this.typeId))
.then(result => {
this.fieldsPrestudent = result.data;
const prestudent = this.fieldsPrestudent[0];
@@ -311,14 +286,11 @@ export default {
.catch(this.$fhcAlert.handleSystemError);
this.$api
.call(this.endpoint.getNameOfDefaultRecipient({
id: this.id,
type_id: this.typeId}))
.call(this.endpoint.getNameOfDefaultRecipients(this.id, this.typeId))
.then(result => {
this.defaultRecipient = result.data;
this.recipientsArray.push({
'uid': this.uid,
'details': this.defaultRecipient});
this.defaultRecipients = result.data;
this.defaultRecipientString = Object.values(this.defaultRecipients).join("; ");
})
.catch(this.$fhcAlert.handleSystemError);
@@ -381,7 +353,7 @@ export default {
type="text"
name="recipient"
:label="$p.t('messages/recipient')"
v-model="defaultRecipient"
v-model="defaultRecipientString"
disabled
>
</form-input>
@@ -502,17 +474,17 @@ export default {
>
<option :value="null">{{ $p.t('messages', 'recipient') }}...</option>
<option
v-for="recipient in recipientsArray"
:key="recipient.uid"
:value="recipient.uid"
>{{recipient.details}}
v-for="(name, id) in defaultRecipients"
:key="id"
:value="Number(id)"
> {{name}}
</option>
</form-input>
</div>
<div class="col-md-2 mt-4">
<br>
<button type="button" class="btn btn-secondary" @click="showPreview()">{{ $p.t('ui', 'btnAktualisieren') }}</button>
<button type="button" class="btn btn-secondary" @click="showPreview(defaultRecipient)">{{ $p.t('ui', 'btnAktualisieren') }}</button>
</div>
</form-form>
@@ -2,6 +2,7 @@ import FormForm from '../../../Form/Form.js';
import FormInput from '../../../Form/Input.js';
import ListBox from "../../../../../../index.ci.php/public/js/components/primevue/listbox/listbox.esm.min.js";
import DropdownComponent from '../../../VorlagenDropdown/VorlagenDropdown.js';
import ApiMessages from "../../../../api/factory/messages/messages.js"; //props not working with route
export default {
name: "ComponentNewMessages",
@@ -12,33 +13,23 @@ export default {
DropdownComponent,
},
props: {
/*
endpoint: {
type: Object,
required: true
},
*/
openMode: String,
tempTypeId: String,
tempId: {
type: [Number, String],
typeId: String,
id: {
type: Array,
required: false
},
tempMessageId: {
messageId: {
type: Number,
required: false,
}
},
computed: {
//params with routes for new tab and new window AND props for inSamePage
id(){
return this.$props.tempId || this.$route.params.id;
},
typeId(){
return this.$props.tempTypeId || this.$route.params.typeId;
},
messageId(){
return this.$props.tempMessageId ||this.$route.params.messageId;
}
},
data(){
return {
formData: {
@@ -53,6 +44,8 @@ export default {
vorlagen: [],
recipientsArray: [],
defaultRecipient: null,
defaultRecipients: [],
defaultRecipientString: null,
editor: null,
isVisible: false,
fieldsUser: [],
@@ -67,8 +60,7 @@ export default {
previewText: null,
previewBody: "",
replyData: null,
uid: null,
messageSent: false
messageSent: false,
}
},
methods: {
@@ -106,19 +98,11 @@ export default {
},
sendMessage() {
const data = new FormData();
data.append('data', JSON.stringify(this.formData));
data.append('ids', JSON.stringify(this.id));
const params = {
id: this.id,
type_id: this.typeId
};
const merged = {
...this.formData,
...params
};
data.append('data', JSON.stringify(merged));
return this.$api
.call(this.endpoint.sendMessage(this.uid, data))
.call(ApiMessages.sendMessage(this.typeId, data))
.then(response => {
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSent'));
this.hideTemplate();
@@ -126,37 +110,34 @@ export default {
this.messageSent = true;
}).catch(this.$fhcAlert.handleSystemError)
.finally(() => {
//TODO(Manu) hier route definieren für openmode in Tab, Page?
// ist kein child sondern mit route aufgerufen
//würde allerdings neues fenster aktualisiert öffnen, altes bleibt ohne reload gleich
//Reload vorheriges tab???
if(this.openMode == "inSamePage"){
if(this.openMode == "inSamePage" && this.id.length == 1 ){
this.$emit('reloadTable');
}
this.resetForm();
}
);
},
getDataVorlage(vorlage_kurzbz){
return this.$api
.call(this.endpoint.getDataVorlage(vorlage_kurzbz))
.call(ApiMessages.getDataVorlage(vorlage_kurzbz))
.then(response => {
this.formData.body = response.data.text;
this.formData.subject = response.data.subject;
}).catch(this.$fhcAlert.handleSystemError);
},
getPreviewText(id, typeId){
getPreviewText(){
const data = new FormData();
data.append('data', JSON.stringify(this.formData.body));
data.append('ids', JSON.stringify(this.id));
return this.$api
.call(this.endpoint.getPreviewText({
id: this.id,
type_id: this.typeId}, data))
.call(ApiMessages.getPreviewText(
this.typeId, data))
.then(response => {
this.previewText = response.data;
const previews = response.data;
this.previewText = previews[this.defaultRecipient];
}).catch(this.$fhcAlert.handleSystemError)
.finally(() => {
//this.resetForm();
});
},
insertVariable(selectedItem){
@@ -177,11 +158,13 @@ export default {
vorlage_kurzbz: null,
body: null,
subject: null,
recipient: null,
selectedValue: null
};
if (this.editor) {
this.editor.setContent("");
}
this.$refs.dropdownComp.setValue(null);
// this.$refs.dropdownComp.setValue(null);
this.previewBody = null;
@@ -202,23 +185,11 @@ export default {
if (this.openMode == "inSamePage")
this.isVisible = true;
},
showPreview(id, typeId){
this.getPreviewText(id, typeId).then(() => {
showPreview(){
this.getPreviewText().then(() => {
this.previewBody = this.previewText;
});
},
getUid(id, typeId){
const params = {
id: id,
type_id: typeId
};
this.$api
.call(this.endpoint.getUid(params))
.then(result => {
this.uid = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
}
},
watch: {
'formData.body': {
@@ -242,38 +213,45 @@ export default {
},
},
created(){
this.getUid(this.id, this.typeId);
const missingparamsmsgs = [];
if(!this.typeId)
{
// TODO(bh) Phrase
missingparamsmsgs.push('Fehlender oder ungültiger Parameter Empfänger-Id-Typ.');
}
if (['person_id', 'mitarbeiter_uid'].includes(this.typeId)){
const params = {
id: this.id,
type_id: this.typeId
};
if(!this.id || this.id.length < 1)
{
// TODO(bh) Phrase
missingparamsmsgs.push('Fehlender oder ungültiger Parameter Empfänger-Id(s).');
}
this.$api
.call(this.endpoint.getMessageVarsPerson(params))
.then(result => {
this.fieldsPerson = result.data;
const person = this.fieldsPerson[0];
this.itemsPerson = Object.entries(person).map(([key, value]) => ({
label: key.toLowerCase(),
value: '{' + key.toLowerCase() + '}'
}));
})
.catch(this.$fhcAlert.handleSystemError);
}
if(missingparamsmsgs.length > 0)
{
this.$fhcAlert.alertMultiple(missingparamsmsgs, 'warn', 'Warning', true);
return;
}
if (['prestudent_id', 'uid'].includes(this.typeId)){
const params = {
id: this.id,
type_id: this.typeId
};
if(this.typeId == 'person_id' || this.typeId == 'mitarbeiter_uid'){
this.$api
.call(this.endpoint.getMsgVarsPrestudent(params))
.call(ApiMessages.getMessageVarsPerson(this.id, this.typeId))
.then(result => {
this.fieldsPerson = result.data;
const person = this.fieldsPerson[0];
this.itemsPerson = Object.entries(person).map(([key, value]) => ({
label: key.toLowerCase(),
value: '{' + key.toLowerCase() + '}'
}));
})
.catch(this.$fhcAlert.handleSystemError);
}
if(this.typeId == 'prestudent_id' || this.typeId == 'uid'){
this.$api
.call(ApiMessages.getMsgVarsPrestudent(this.id, this.typeId))
.then(result => {
this.fieldsPrestudent = result.data;
const prestudent = this.fieldsPrestudent[0];
this.itemsPrestudent = Object.entries(prestudent).map(([key, value]) => ({
label: key.toLowerCase(),
value: '{' + key.toLowerCase() + '}'
@@ -283,7 +261,7 @@ export default {
}
this.$api
.call(this.endpoint.getMsgVarsLoggedInUser())
.call(ApiMessages.getMsgVarsLoggedInUser())
.then(result => {
this.fieldsUser = result.data;
const user = this.fieldsUser;
@@ -295,21 +273,18 @@ export default {
.catch(this.$fhcAlert.handleSystemError);
this.$api
.call(this.endpoint.getNameOfDefaultRecipient({
id: this.id,
type_id: this.typeId}))
.call(ApiMessages.getNameOfDefaultRecipients(this.id, this.typeId))
.then(result => {
this.defaultRecipient = result.data;
this.recipientsArray.push({
'uid': this.uid,
'details': this.defaultRecipient});
this.defaultRecipients = result.data;
this.defaultRecipientString = Object.values(this.defaultRecipients).join("; ");
})
.catch(this.$fhcAlert.handleSystemError);
//case of reply
if(this.messageId != null) {
this.$api
.call(this.endpoint.getReplyData(this.messageId))
.call(ApiMessages.getReplyData(this.messageId))
.then(result => {
this.replyData = result.data;
this.formData.subject = this.replyData[0].replySubject;
@@ -343,7 +318,7 @@ export default {
type="text"
name="recipient"
:label="$p.t('messages/recipient')"
v-model="defaultRecipient"
v-model="defaultRecipientString"
disabled
>
</form-input>
@@ -472,18 +447,18 @@ export default {
v-model="defaultRecipient"
>
<option :value="null">{{ $p.t('messages', 'recipient') }}...</option>
<option
v-for="recipient in recipientsArray"
:key="recipient.uid"
:value="recipient.uid"
>{{recipient.details}}
<option
v-for="(name, id) in defaultRecipients"
:key="id"
:value="Number(id)"
> {{name}}
</option>
</form-input>
</div>
<div class="col-md-2 mt-4">
<br>
<button type="button" class="btn btn-secondary" @click="showPreview(id, typeId)">{{ $p.t('ui', 'btnAktualisieren') }}</button>
<button type="button" class="btn btn-secondary" @click="showPreview(defaultRecipient)">{{ $p.t('ui', 'btnAktualisieren') }}</button>
</div>
</form-form>
@@ -19,7 +19,7 @@ export default {
},
typeId: String,
id: {
type: [Number, String],
type: Array,
required: true
},
messageLayout: String,
@@ -38,12 +38,13 @@ export default {
},
ajaxResponse: (url, params, response) => this.buildTreemap(response),
columns: [
{title: "subject", field: "subject"},
{title: "body", field: "body", formatter: "html", visible: false},
{title: "message_id", field: "message_id", visible: false},
{title: "subject", field: "subject", headerFilter: true},
{title: "body", field: "body", formatter: "html", visible: false, headerFilter: true},
{title: "message_id", field: "message_id", visible: false, headerFilter: true},
{
title: "Datum",
field: "insertamum",
headerFilter: true,
formatter: function (cell) {
const dateStr = cell.getValue();
const date = new Date(dateStr); // Convert to Date object
@@ -55,16 +56,28 @@ export default {
minute: "2-digit",
hour12: false
});
},
headerFilterFunc(headerValue, rowValue) {
const matches = headerValue.match(/^(([0-9]{2})\.)?([0-9]{2})\.([0-9]{4})?$/);
let comparestr = headerValue;
if(matches !== null) {
const year = (matches[4] !== undefined) ? matches[4] : '';
const month = matches[3];
const day = (matches[2] !== undefined) ? matches[2] : '';
comparestr = year + '-' + month + '-' + day;
}
return rowValue.match(comparestr);
}
},
{title: "sender", field: "sender"},
{title: "recipient", field: "recipient"},
{title: "senderId", field: "sender_id"},
{title: "recipientId", field: "recipient_id"},
{title: "Relationmessage ID", field: "relationmessage_id"},
{title: "sender", field: "sender", headerFilter: true},
{title: "recipient", field: "recipient", headerFilter: true},
{title: "senderId", field: "sender_id", headerFilter: true},
{title: "recipientId", field: "recipient_id", headerFilter: true},
{title: "Relationmessage ID", field: "relationmessage_id", headerFilter: true},
{
title: "Status",
field: "status",
headerFilter: true,
formatterParams: [
"unread",
"read",
@@ -73,11 +86,12 @@ export default {
],
formatter: (cell, formatterParams) => {
return formatterParams[cell.getValue()];
}
},
},
{
title: "letzte Änderung",
field: "statusdatum",
headerFilter: true,
formatter: function (cell) {
const dateStr = cell.getValue();
const date = new Date(dateStr); // Convert to Date object
@@ -89,6 +103,17 @@ export default {
minute: "2-digit",
hour12: false
});
},
headerFilterFunc(headerValue, rowValue) {
const matches = headerValue.match(/^(([0-9]{2})\.)?([0-9]{2})\.([0-9]{4})?$/);
let comparestr = headerValue;
if(matches !== null) {
const year = (matches[4] !== undefined) ? matches[4] : '';
const month = matches[3];
const day = (matches[2] !== undefined) ? matches[2] : '';
comparestr = year + '-' + month + '-' + day;
}
return rowValue.match(comparestr);
}
},
{
@@ -347,7 +372,7 @@ export default {
});*/
},
created(){
if(this.typeId != 'person_id') {
if(this.typeId != 'person_id' && Array.isArray(this.id) && this.id.length === 1) {
const params = {
id: this.id,
type_id: this.typeId
+46 -21
View File
@@ -31,7 +31,7 @@ export default {
}
},
id: {
type: [Number, String],
type: Array,
required: true
},
showTable: Boolean,
@@ -65,15 +65,20 @@ export default {
}
},
methods: {
getControllerUrl() {
return FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/NeueNachricht';
},
reloadTable(){
this.$refs.templateTableMessage.reload();
},
handleMessage(id, typeId, messageId){
this.messageId = messageId;
if (this.openMode == "window") {
//this.$refs['newMsgForm'].submit();
this.openInNewWindow(id, typeId, messageId);
}
else if (this.openMode == "newTab"){
//this.$refs['newMsgForm'].submit();
this.openInNewTab(id, typeId, messageId);
}
else if (this.openMode == "modal"){
@@ -85,36 +90,48 @@ export default {
else
console.log("no valid openMode");
},
openInNewTab(id, typeId, messageId= null){
openInNewTab(id, typeId, messageId=null){
if(id.length > 1)
{
this.$refs['newMsgForm'].submit();
return;
}
let path = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
let path = this.getControllerUrl();
if (messageId){
path += "/NeueNachricht/" + id + "/" + typeId + "/" + messageId;
path += "/" + encodeURIComponent(id) + "/" + encodeURIComponent(typeId) + "/" + encodeURIComponent(messageId);
}
else {
path += "/NeueNachricht/" + id + "/" + typeId;
path += "/" + encodeURIComponent(id) + "/" + encodeURIComponent(typeId);
}
const newTab = window.open(path, "_blank");
},
openInNewWindow(id, typeId, messageId){
let path = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
if (messageId){
path += "/NeueNachricht/" + id + "/" + typeId + "/" + messageId;
}
else {
path += "/NeueNachricht/" + id + "/" + typeId;
}
const width = Math.round(window.innerWidth * 0.75);
const height = Math.round(window.innerHeight * 0.75);
const left = Math.round((window.innerWidth - width) / 2);
const top = Math.round((window.innerHeight - height) / 2);
if(id.length > 1)
{
const newWindow = window.open('', "NewMsgWindow", `width=${width},height=${height},left=${left},top=${top}`);
this.$refs['newMsgForm'].submit();
return;
}
let path = this.getControllerUrl();
if (messageId){
path += "/" + encodeURIComponent(id) + "/" + encodeURIComponent(typeId) + "/" + encodeURIComponent(messageId);
}
else {
path += "/" + encodeURIComponent(id) + "/" + encodeURIComponent(typeId);
}
const newWindow = window.open(path, "_blank", `width=${width},height=${height},left=${left},top=${top}`);
},
resetMessageId(){
@@ -124,6 +141,15 @@ export default {
},
template: `
<div class="core-messages h-100 pb-3">
<!-- TODO(bh) set target _self for debugging post but _blank for newTab -->
<form ref="newMsgForm"
method="post"
:action="getControllerUrl()"
:target="(openMode === 'window') ? 'NewMsgWindow' : '_blank'"
>
<input type="hidden" name="typeid" :value="typeId">
<input type="hidden" name="ids" :value="id">
</form>
<message-modal
ref="modalMsg"
@@ -141,18 +167,17 @@ export default {
<div v-if="isVisibleDiv" class="overflow-auto m-3" style="max-height: 500px; border: 1px solid #ccc;">
<form-only
ref="templateNewMessage"
:temp-type-id="typeId"
:temp-id="id"
:temp-message-id="messageId"
:type-id="typeId"
:id="id"
:message-id="messageId"
:endpoint="endpoint"
:openMode="openMode"
@reloadTable="reloadTable"
>
</form-only>
</div>
<div v-if="showTable">
<div v-if="showTable && id.length==1">
<table-messages
ref="templateTableMessage"
:type-id="typeId"
@@ -14,26 +14,49 @@ export default {
endpoint: ApiMessages
};
},
computed: {
prestudent_ids() {
if (this.modelValue.prestudent_id)
{
return [this.modelValue.prestudent_id];
}
return this.modelValue.map(e => e.prestudent_id);
},
person_ids() {
if (this.modelValue.person_id)
{
return [this.modelValue.person_id];
}
return this.modelValue.map(e => e.person_id);
},
},
template: `
<div class="stv-details-messages h-100 pb-3 overflow-hidden">
<template v-if="modelValue.prestudent_id">
<core-messages
ref="formc"
:endpoint="endpoint"
type-id="prestudent_id"
:id="modelValue.prestudent_id"
messageLayout="twoColumnsTableLeft"
open-mode="modal"
show-table
>
</core-messages>
</template>
<template v-else>
<h3><strong>No valid prestudent_id!</strong></h3>
<p>{{modelValue.anmerkungen}}</p>
</template>
<template v-if="prestudent_ids">
<core-messages
ref="formc"
:endpoint="endpoint"
type-id="prestudent_id"
:id="prestudent_ids"
messageLayout="twoColumnsTableLeft"
open-mode="modal"
show-table
>
</core-messages>
</template>
<template v-else >
<core-messages
ref="formc"
:endpoint="endpoint"
type-id="person_id"
:id="person_ids"
messageLayout="twoColumnsTableLeft"
open-mode="modal"
show-table
>
</core-messages>
</template>
</div>
`
};