Tree structure for messages, preview in NewDiv, Note to close window, check recipient_id, save relationmessage_id

This commit is contained in:
ma0068
2025-03-10 07:51:53 +01:00
parent 815307e392
commit 1989e65d72
6 changed files with 329 additions and 124 deletions
@@ -19,7 +19,8 @@ class Messages extends FHCAPI_Controller
'getVorlagentext' => ['admin:r', 'assistenz:r'],
'getPreviewText' => ['admin:r', 'assistenz:r'],
'getReplyData' => ['admin:r', 'assistenz:r'],
'getPersonIdFromUid' => ['admin:r', 'assistenz:r'],
'getPersonId' => ['admin:r', 'assistenz:r'],
'getUid' => ['admin:r', 'assistenz:r'],
]);
//Load Models
@@ -42,17 +43,8 @@ class Messages extends FHCAPI_Controller
public function getMessages($id, $type_id)
{
switch($type_id)
{
case 'uid':
$id = $this->_getPersonIdFromUid($id);
break;
case 'person_id':
$id = $id;
break;
default:
$this->terminateWithError("MESSAGES::getMessages logic for type_id " . $type_id . " not defined yet", self::ERROR_TYPE_GENERAL);
break;
if($type_id != 'person_id'){
$id = $this->_getPersonId($id, $type_id);
}
$result = $this->MessageModel->getMessagesForTable($id);
@@ -74,15 +66,13 @@ class Messages extends FHCAPI_Controller
$this->load->model('system/Vorlage_model', 'VorlageModel');
//39 Stück Variante OE
$result = $this->VorlageModel->getAllVorlagenByOe($oe_kurzbz->oe_kurzbz);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
//IF ADMIN 167
//If admin
$this->VorlageModel->addOrder('vorlage_kurzbz', 'ASC');
//only HTML-vorlagen -> for admin
$result = $this->VorlageModel->loadWhere(
array(
'mimetype' => 'text/html'
@@ -97,7 +87,7 @@ class Messages extends FHCAPI_Controller
public function getVorlagentext($vorlage_kurzbz)
{
//$this->terminateWithError("vor " . $vorlage_kurzbz, self::ERROR_TYPE_GENERAL);
//$studiengang_kz = 227; //TODO(Manu) check dynamisieren NULL
//$studiengang_kz = 227; //TODO(Manu) dynamisieren NULL
$studiengang_kz = 0;
$this->load->model('system/Vorlagestudiengang_model', 'VorlagestudiengangModel');
$this->VorlagestudiengangModel->addOrder('version', 'DESC');
@@ -127,49 +117,32 @@ class Messages extends FHCAPI_Controller
$this->terminateWithSuccess($data);
}
public function getMsgVarsPrestudent($uid)
public function getMsgVarsPrestudent($id, $typeId)
{
$prestudent_id = $this-> _getPrestudentIdFromUid($uid);
$prestudent_id = ($typeId == 'prestudent_id') ? $id : $this->_getPrestudentIdFromUid($id);
$result = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id);
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getMsgVarsLoggedInUser()
{
$uid = getAuthUID();
$result = $this->MessageModel->getMsgVarsLoggedInUser();
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getNameOfDefaultRecipient($id, $type_id)
{
switch($type_id)
{
case 'uid':
$id = $this->_getPersonIdFromUid($id);
break;
case 'person_id':
$id = $id;
break;
default:
$this->terminateWithError("MESSAGES::getNameOfDefaultRecipient logic for type_id " . $type_id . " not defined yet", self::ERROR_TYPE_GENERAL);
break;
}
$id = $type_id!='person_id)' ? $this->_getPersonId($id, $type_id) : $id;
$this->load->model('person/Person_model', 'PersonModel');
$result = $this->PersonModel->load($id);
//$this->terminateWithSuccess($result);
$data = $this->getDataOrTerminateWithError($result);
$name = current($data);
@@ -178,8 +151,11 @@ class Messages extends FHCAPI_Controller
public function sendMessage($recipient_id)
{
//is always uid in FAS
//TODO(Manu) make dynamic for other ids
//default setting
$receiversPersonId = $this->_getPersonIdFromUid($recipient_id);
$receiversPersonId = $this->_getPersonId($recipient_id, 'uid');
$uid = getAuthUID();
$this->load->model('person/Benutzer_model', 'BenutzerModel');
@@ -216,15 +192,13 @@ class Messages extends FHCAPI_Controller
$subject = $this->input->post('subject');
$body = $this->input->post('body');
$relationmessage_id = $this->input->post('relationmessage_id');
$typeId = $this->input->post('type_id');
$id = $this->input->post('id');
if($typeId == 'uid')
{
//$this->terminateWithError("uid ", self::ERROR_TYPE_GENERAL);
$prestudent_id = $this-> _getPrestudentIdFromUid($id);
//parseMessagetext for variables Prestudent
@@ -240,7 +214,7 @@ class Messages extends FHCAPI_Controller
}
elseif($typeId == 'prestudent_id')
{
$this->terminateWithError("prestudent_id ", self::ERROR_TYPE_GENERAL);
// $this->terminateWithError("prestudent_id ", self::ERROR_TYPE_GENERAL);
$result = $this->MessagesModel->parseMessageTextPrestudent($id, $body);
$bodyParsed = $this->getDataOrTerminateWithError($result);
@@ -250,7 +224,7 @@ class Messages extends FHCAPI_Controller
$this->terminateWithError("type_id " . $typeId . " not valid", self::ERROR_TYPE_GENERAL);
}
$result = $this->messagelib->sendMessageUser($receiversPersonId, $subject, $bodyParsed, $benutzer->person_id);
$result = $this->messagelib->sendMessageUser($receiversPersonId, $subject, $bodyParsed, $benutzer->person_id, null, $relationmessage_id);
$this->terminateWithSuccess($result);
}
@@ -271,17 +245,15 @@ class Messages extends FHCAPI_Controller
case 'uid':
$prestudent_id = $this->_getPrestudentIdFromUid($id);
$result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $data);
break;
case 'person_id':
$id = $id;
case 'prestudent_id':
$result = $this->MessagesModel->parseMessageTextPrestudent($id, $data);
break;
default:
$this->terminateWithError("MESSAGES::getPreviewText logic for type_id " . $type_id . " not defined yet", self::ERROR_TYPE_GENERAL);
break;
}
//$this->terminateWithSuccess($result);
$bodyParsed = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($bodyParsed);
@@ -289,10 +261,8 @@ class Messages extends FHCAPI_Controller
public function getReplyData($messageId)
{
// return $this->terminateWithError("in get ReplyBody" . $messageId, self::ERROR_TYPE_GENERAL);
//TODO(Manu) validation of messageId: if number
$this->MessageModel->addSelect('public.tbl_msg_message.*');
$this->MessageModel->addSelect('r.*');
$this->MessageModel->addSelect('p.nachname');
@@ -304,14 +274,9 @@ class Messages extends FHCAPI_Controller
array('r.message_id' => $messageId)
);
// $this->terminateWithSuccess((getData($result) ?: []));
$dataMessage = $this->getDataOrTerminateWithError($result);
$prefix = "Re: "; // reply subject prefix
/* $body = current($dataMessage->body);
$subject = $dataMessage->subject;*/
$subject = $dataMessage[0]->subject;
$body = $dataMessage[0]->body;
@@ -323,8 +288,6 @@ class Messages extends FHCAPI_Controller
$dataMessage[0]->replySubject = $prefix . $subject;
$this->terminateWithSuccess($dataMessage);
}
public function deleteMessage($messageId)
@@ -353,30 +316,94 @@ class Messages extends FHCAPI_Controller
$this->terminateWithSuccess($result);
}
public function getPersonIdFromUid($uid)
public function getPersonId($id, $typeId)
{
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$result = $this->BenutzerModel->loadWhere(
['uid' => $uid]
);
if ($typeId == 'uid')
{
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$result = $this->BenutzerModel->loadWhere(
['uid' => $id]
);
}
elseif($typeId == 'prestudent_id')
{
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$result = $this->PrestudentModel->loadWhere(
['prestudent_id' => $id]
);
}
$data = $this->getDataOrTerminateWithError($result);
$benutzer = current($data);
$person = current($data);
$this->terminateWithSuccess($benutzer->person_id);
$this->terminateWithSuccess($person->person_id);
}
private function _getPersonIdFromUid($uid)
public function getUid($id, $typeId)
{
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$result = $this->BenutzerModel->loadWhere(
['uid' => $uid]
);
if (!$typeId)
{
$this->terminateWithError($this->p->t('ui', 'error_missingId', ['id'=> 'Type ID']), self::ERROR_TYPE_GENERAL);
}
elseif ($typeId == 'person_id')
{
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$result = $this->BenutzerModel->loadWhere(
['person_id' => $id]
);
}
elseif($typeId == 'prestudent_id')
{
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$result = $this->PrestudentModel->loadWhere(
['prestudent_id' => $id]
);
$data = $this->getDataOrTerminateWithError($result);
$person = current($data);
$person_id = $person->person_id;
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$result = $this->BenutzerModel->loadWhere(
['person_id' => $person_id]
);
}
elseif($typeId == 'uid')
{
$this->terminateWithSuccess($id);
}
else
{
$this->terminateWithError("MESSAGES::getUID logic for type_id " . $typeId . " not defined yet", self::ERROR_TYPE_GENERAL);
}
$data = $this->getDataOrTerminateWithError($result);
$benutzer = current($data);
return $benutzer->person_id;
$this->terminateWithSuccess($benutzer->uid);
}
private function _getPersonId($id, $typeId)
{
if ($typeId == 'uid')
{
$this->load->model('person/Benutzer_model', 'BenutzerModel');
$result = $this->BenutzerModel->loadWhere(
['uid' => $id]
);
}
elseif($typeId == 'prestudent_id')
{
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$result = $this->PrestudentModel->loadWhere(
['prestudent_id' => $id]
);
}
$data = $this->getDataOrTerminateWithError($result);
$person = current($data);
return $person->person_id;
}
private function _getPrestudentIdFromUid($uid)
+7 -5
View File
@@ -11,11 +11,14 @@ export default {
getMessageVarsPerson(){
return this.$fhcApi.get('api/frontend/v1/messages/messages/getMessageVarsPerson/');
},
getMsgVarsPrestudent(uid){
return this.$fhcApi.get('api/frontend/v1/messages/messages/getMsgVarsPrestudent/' + uid);
getMsgVarsPrestudent(params){
return this.$fhcApi.get('api/frontend/v1/messages/messages/getMsgVarsPrestudent/' + params.id + '/' + params.type_id);
},
getPersonIdFromUid(uid){
return this.$fhcApi.get('api/frontend/v1/messages/messages/getPersonIdFromUid/' + uid);
getPersonId(params){
return this.$fhcApi.get('api/frontend/v1/messages/messages/getPersonId/'+ params.id + '/' + params.type_id);
},
getUid(params){
return this.$fhcApi.get('api/frontend/v1/messages/messages/getUid/'+ params.id + '/' + params.type_id);
},
getVorlagentext(vorlage_kurzbz){
return this.$fhcApi.get('api/frontend/v1/messages/messages/getVorlagentext/' + vorlage_kurzbz);
@@ -29,7 +32,6 @@ export default {
},
getReplyData(messageId){
return this.$fhcApi.get('api/frontend/v1/messages/messages/getReplyData/' + messageId);
},
sendMessage(form, id, data) {
return this.$fhcApi.post(form,'api/frontend/v1/messages/messages/sendMessage/' + id,
@@ -44,14 +44,16 @@ export default {
data(){
return {
formData: {
recipient: this.id,
recipient: null,
subject: null,
body: null,
vorlage_kurzbz: null,
selectedValue: '',
relationmessage_id: null
},
statusNew: true,
vorlagen: [],
recipientsArray: [],
defaultRecipient: null,
editor: null,
isVisible: false,
@@ -66,7 +68,9 @@ export default {
itemsUser: [],
previewText: null,
previewBody: "",
replyData: null
replyData: null,
uid: null,
messageSent: false
}
},
methods: {
@@ -105,19 +109,22 @@ export default {
sendMessage() {
//TODO(Manu) check default recipient(s)
const data = new FormData();
const params = {
id: this.id,
type_id: this.typeId
};
const merged = {
...this.formData,
...params
};
data.append('data', JSON.stringify(merged));
//this.uid is important for existing sendFunction
return this.$fhcApi.factory.messages.person.sendMessage(
this.$refs.formMessage,
this.id,
this.uid,
data)
.then(response => {
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSent'));
@@ -129,6 +136,10 @@ export default {
//this.resetForm();
//closeModal
//closewindwo
this.messageSent = true;
//TODO(Manu) hier route definieren? ist kein child sondern mit route aufgerufen
//würde allerdings neues fenster aktualisiert öffnen, altes bleibt ohne reload gleich
//Reload vorheriges tab???
this.$emit('reloadTable');
}
);
@@ -148,13 +159,13 @@ export default {
//closewindwo
});
},
getPreviewText(){
getPreviewText(id, typeId){
const data = new FormData();
data.append('data', JSON.stringify(this.formData.body));
return this.$fhcApi.factory.messages.person.getPreviewText({
id: this.id,
type_id: this.typeId}, data)
id: id,
type_id: typeId}, data)
.then(response => {
this.previewText = response.data;
}).catch(this.$fhcAlert.handleSystemError)
@@ -167,7 +178,8 @@ export default {
insertVariable(selectedItem){
if (this.editor) {
this.editor.insertContent(selectedItem.value + " ");
//TODO(Manu) check: nicht mal mit Punkt adden gehts ohne eintrag nach vars
//TODO(Manu) check: Laden von Variblen geht nicht wenn kein Zeichen danach kommt
// nicht mal mit Punkt adden gehts ohne eintrag nach vars
/* this.editor.focus();
this.editor.setDirty(true);*/
@@ -183,9 +195,6 @@ export default {
console.error("Editor instance is not available.");
}
},
/* replyMessage(message_id){
console.log("auf message " + message_id + " antworten");
},*/
resetForm(){
this.formData = {
vorlage_kurzbz: null,
@@ -219,11 +228,22 @@ export default {
//just for testing:
this.isVisible = true;
},
showPreview(){
this.getPreviewText().then(() => {
showPreview(id, typeId){
this.getPreviewText(id, typeId).then(() => {
this.previewBody = this.previewText;
});
},
getUid(id, typeId){
const params = {
id: id,
type_id: typeId
};
this.$fhcApi.factory.messages.person.getUid(params)
.then(result => {
this.uid = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
}
},
watch: {
'formData.body': {
@@ -238,7 +258,6 @@ export default {
},
'formData.vorlage_kurzbz': {
handler(newVal){
// console.log("Vorlage: " + newVal);
if (newVal && newVal != null) {
this.formData.subject = newVal;
@@ -248,6 +267,9 @@ export default {
},
},
created(){
if(this.typeId != 'uid')
this.getUid(this.id, this.typeId);
if(this.typeId == 'person_id'){
this.$fhcApi.factory.messages.person.getMessageVarsPerson()
.then(result => {
@@ -259,8 +281,13 @@ export default {
})
.catch(this.$fhcAlert.handleSystemError);
}
if(this.typeId == 'uid') {
this.$fhcApi.factory.messages.person.getMsgVarsPrestudent(this.id)
if(this.typeId == 'uid' || this.typeId == 'prestudent_id') {
const params = {
id: this.id,
type_id: this.typeId
};
this.$fhcApi.factory.messages.person.getMsgVarsPrestudent(params)
.then(result => {
this.fieldsPrestudent = result.data;
const prestudent = this.fieldsPrestudent[0];
@@ -294,20 +321,21 @@ export default {
})
.then(result => {
this.defaultRecipient = result.data;
this.recipientsArray.push({'uid': this.uid,
'details': this.defaultRecipient});
})
.catch(this.$fhcAlert.handleSystemError);
//case of reply
if(this.messageId != null) {
//get replayBody.. body receivername, receiverSurname, sentDate of message
this.$fhcApi.factory.messages.person.getReplyData(this.messageId)
.then(result => {
this.replyData = result.data;
this.formData.subject = this.replyData[0].replySubject;
this.formData.body = this.replyData[0].replyBody;
this.formData.relationmessage_id = this.messageId;
})
.catch(this.$fhcAlert.handleSystemError);
}
},
@@ -320,12 +348,11 @@ export default {
template: `
<div class="messages-detail-newmessage">
<!--passt für showdiv-->
<!-- <div class="overflow-auto" style="max-height: 500px; border: 1px solid #ccc;">-->
<!--new page-->
<div class="overflow-auto m-3">
<div v-if="!messageSent" class="overflow-auto m-3">
<h4>New Message</h4>
<div class="row">
@@ -465,19 +492,26 @@ export default {
<div>
<form-form class="row g-3 mt-2" ref="formPreview">
<div class="col-sm-2 mb-3">
<div class="col-sm-3 mb-3">
<form-input
type="select"
name="recipient"
:label="$p.t('messages/recipient')"
v-model="defaultRecipient"
v-model="formData.recipient"
>
<option
v-for="recipient in recipientsArray"
:key="recipient.uid"
:value="recipient.uid"
>{{recipient.details}}
</option>
</form-input>
</div>
<div class="col-md-2 mt-4">
<br>
<button type="button" class="btn bt n-secondary" @click="showPreview()">Aktualisieren</button>
<button type="button" class="btn btn-secondary" @click="showPreview(formData.recipient,'uid')">Aktualisieren</button>
</div>
</form-form>
@@ -492,6 +526,43 @@ export default {
</div>
</div>
<div v-else class="container d-flex justify-content-center align-items-center m-3">
<div class="card" style="width: 80%">
<div class="card-body alert alert-success text-dar p-5 rounded">
<div class="row">
<div class="col-6">
Message sent successfully!
</div>
<div class="col-6">
Nachricht erfolgreich versandt!
</div>
</div>
<div class="row">
<div class="col-6" style="border-right: 1px">
You can safely close this window.
</div>
<div class="col-6">
Sie können dieses Fenster schließen.
</div>
</div>
</div>
<div class="text-center">
<p class="signatureblock">
Fachhochschule Technikum Wien | University of Applied Sciences Technikum Wien
<br>Hoechstaedtplatz 6, 1200 Wien, AUSTRIA
<br><a class="signatureblocklink" href="https://www.technikum-wien.at">www.technikum-wien.at</a>
</p>
</div>
</div>
</div>
</div>
`
@@ -26,7 +26,6 @@ export default {
messageLayout: String,
openMode: String
},
//TODO(Manu) endpoint macht Probleme
data(){
return {
tabulatorOptions: {
@@ -38,7 +37,7 @@ export default {
type: this.typeId
};
},
ajaxResponse: (url, params, response) => response.data,
ajaxResponse: (url, params, response) => this.buildTreemap(response.data),
columns: [
{title: "subject", field: "subject"},
{title: "body", field: "body", visible: false},
@@ -63,6 +62,7 @@ export default {
{title: "recipient", field: "recipient"},
{title: "senderId", field: "sender_id"},
{title: "recipientId", field: "recipient_id"},
{title: "relationmessage_id", field: "relationmessage_id"},
{
title: "status",
field: "status",
@@ -110,7 +110,7 @@ export default {
container.className = "d-flex gap-2";
let button = document.createElement('button');
if (this.personId != cell.getData().recipient_id)
if (this.personId != cell.getData().sender_id)
button.disabled = true;
button.className = 'btn btn-outline-secondary btn-action';
button.title = this.$p.t('global', 'reply');
@@ -136,29 +136,23 @@ export default {
return container;
},
frozen: true
}],
}
],
layout: 'fitDataFill',
layoutColumnsOnNewData: false,
// height: 'auto',
height: '400',
selectable: true,
selectableRangeMode: 'click',
pagination: true,
// paginationSize: 5,
/* layoutColumnsOnNewData: false,
selectableRangeMode: 'click',
selectable: true,
index: 'message_id',
persistenceID: 'core-message'*/
pagination: true,
dataTree: true,
headerSort: true,
dataTreeChildField: "children",
dataTreeCollapseElement:"<i class='fas fa-minus-square'></i>",
dataTreeChildIndent: 15,
dataTreeStartExpanded: false,
persistenceID: 'core-message'
},
tabulatorEvents: [
{
event: 'dataLoaded',
handler: data => this.tabulatorData = data.map(item => {
return item;
}),
},
{
event: 'tableBuilt',
handler: async() => {
@@ -213,7 +207,59 @@ export default {
tabulatorData: [],
previewBody: "",
open: false,
personId: null
personId: null,
//Testdata
/* messages: [
{
message_id: 7,
subject: "Antwort auf 4",
body: "Text 5",
insertamum: "2024-03-05",
relationmessage_id: 6,
},
{
message_id: 1,
subject: "Hauptnachricht",
body: "Text 1",
insertamum: "2024-03-05",
relationmessage_id: null,
},
{
message_id: 2,
subject: "Antwort auf 1",
body: "Text 2",
insertamum: "2024-03-05",
relationmessage_id: 1,
},
{
message_id: 3,
subject: "Antwort auf 2",
body: "Text 3",
insertamum: "2024-03-05",
relationmessage_id: 2,
},
{
message_id: 4,
subject: "Neue Nachricht",
body: "Text 4",
insertamum: "2024-03-05",
relationmessage_id: null,
},
{
message_id: 5,
subject: "Antwort auf 4",
body: "Text 5",
insertamum: "2024-03-05",
relationmessage_id: 4,
},
{
message_id: 6,
subject: "Antwort auf 4",
body: "Text 5",
insertamum: "2024-03-05",
relationmessage_id: 5,
},
],*/
}
},
methods: {
@@ -237,7 +283,11 @@ export default {
});
},
actionNewMessage(){
// this.$emit('newMessage', this.id, this.typeId);
//here already use person_id??
this.$emit('newMessage', this.id, this.typeId);
//console.log("action new message");
},
@@ -247,6 +297,47 @@ export default {
reload() {
this.$refs.table.reloadTable();
},
buildTreemap(messages) {
const messageMap = new Map();
const messageNested = [];
const remainingMessages = new Set(messages);
//save all Data in Map
messages.forEach(msg => messageMap.set(msg.message_id, msg));
let iteration = 0;
let changes = true;
// do until each relationmessage_id finds message_id (not sensitive to order)
while (changes) {
changes = false;
iteration++;
remainingMessages.forEach(msg => {
if (msg.relationmessage_id === null) {
messageNested.push(messageMap.get(msg.message_id));
remainingMessages.delete(msg);
changes = true;
} else if (messageMap.has(msg.relationmessage_id)) {
const parent = messageMap.get(msg.relationmessage_id);
if (!parent.children) {
parent.children = [];
}
parent.children.push(messageMap.get(msg.message_id));
remainingMessages.delete(msg);
changes = true;
}
});
// to avoid endless loop
if (iteration > messages.length) break;
}
return messageNested;
}
},
computed: {
statusText(){
@@ -256,7 +347,7 @@ export default {
2: this.$p.t('messsages', 'archived'),
3: this.$p.t('messsages', 'deleted')
}
}
},
},
mounted() {
// change to target="_blank"
@@ -269,8 +360,12 @@ export default {
});*/
},
created(){
if(this.typeId == 'uid') {
this.$fhcApi.factory.messages.person.getPersonIdFromUid(this.id)
if(this.typeId == 'uid' || this.typeId == 'prestudent_id') {
const params = {
id: this.id,
type_id: this.typeId
};
this.$fhcApi.factory.messages.person.getPersonId(params)
.then(result => {
this.personId = result.data;
})
@@ -279,7 +374,7 @@ export default {
},
template: `
<div class="messages-detail-table">
<!--View Studierendenverwaltung-->
<div v-if="messageLayout=='twoColumnsTableLeft'">
@@ -313,6 +408,7 @@ export default {
</div>
<!--View Infocenter-->
<!--TODO(Manu) update-->
<div v-if="messageLayout=='listTableTop'">
<!--table-->
+2 -1
View File
@@ -58,6 +58,7 @@ export default {
},
methods: {
reloadTable(){
console.log("in parent reload");
this.$refs.templateTableMessage.reload();
},
newMessage(id, typeId){
@@ -121,7 +122,6 @@ export default {
path += "/NeueNachricht/" + id + "/" + typeId;
}
const newTab = window.open(path, "_blank");
},
openInNewWindow(id, typeId){
@@ -160,6 +160,7 @@ export default {
<button class="btn btn-secondary" @click="openInNewWindow(id,typeId)">Open in Page</button>
</div>-->
<!-- <p>endpoint Messages.js: {{endpoint}}</p>-->
<div v-if="showNew">
<new-message
ref="templateNewMessage"
@@ -1,6 +1,8 @@
import CoreMessages from "../../../Messages/Messages.js";
//import CoreMessages from "@/Messages/Messages.js";
//TODO(Manu) refactor props
export default {
components: {
CoreMessages
@@ -10,17 +12,23 @@ export default {
},
template: `
<div class="stv-details-messages h-100 pb-3 overflow-hidden">
<template v-if="modelValue.prestudent_id">
<core-messages
ref="formc"
endpoint="$fhcApi.factory.messages.person"
type-id="uid"
:id="modelValue.uid"
type-id="prestudent_id"
:id="modelValue.prestudent_id"
messageLayout="twoColumnsTableLeft"
show-table
show-new
open-mode="newTab"
>
</core-messages>
</template>
<template v-else>
<h3><strong>No valid prestudent_id!</strong></h3>
<p>{{modelValue.anmerkungen}}</p>
</template>
</div>
`