mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
refactor Messaging
- headerFilter for table Messages - multiactions for sendMessages for openmodes modal and inSamePage
This commit is contained in:
@@ -16,7 +16,6 @@ class Messages extends FHCAPI_Controller
|
||||
'getNameOfDefaultRecipient' => ['admin:r', 'assistenz:r'],
|
||||
'getNameOfDefaultRecipients' => ['admin:r', 'assistenz:r'],
|
||||
'sendMessage' => ['admin:r', 'assistenz:r'],
|
||||
'sendMessages' => ['admin:r', 'assistenz:r'],
|
||||
'deleteMessage' => ['admin:r', 'assistenz:r'],
|
||||
'getDataVorlage' => ['admin:r', 'assistenz:r'],
|
||||
'getPreviewText' => ['admin:r', 'assistenz:r'],
|
||||
@@ -104,24 +103,22 @@ class Messages extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess($vorlage);
|
||||
}
|
||||
|
||||
public function getMessageVarsPerson($id, $typeId)
|
||||
public function getMessageVarsPerson($typeId)
|
||||
{
|
||||
$person_id = ($typeId == 'mitarbeiter_uid') ? $this->_getPersonId($id, $typeId) : $id;
|
||||
$result = $this->MessageModel->getMsgVarsDataByPersonId($person_id);
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
$ids = $this->input->post('ids');
|
||||
$messageVarsPerson = [];
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
foreach ($ids as $id)
|
||||
{
|
||||
$person_id = ($typeId == 'mitarbeiter_uid') ? $this->_getPersonId($id, $typeId) : $id;
|
||||
$result = $this->MessageModel->getMsgVarsDataByPersonId($person_id);
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
$messageVarsPerson[] = current($data);
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($messageVarsPerson);
|
||||
}
|
||||
|
||||
/* public function getMsgVarsPrestudent($id, $typeId)
|
||||
{
|
||||
$prestudent_id = ($typeId == 'uid') ? $this->_getPrestudentIdFromUid($id) : $id;
|
||||
$result = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id);
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}*/
|
||||
|
||||
public function getMsgVarsPrestudent($typeId)
|
||||
{
|
||||
$ids = $this->input->post('ids');
|
||||
@@ -201,55 +198,9 @@ class Messages extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess($recipients);
|
||||
}
|
||||
|
||||
public function sendMessages()
|
||||
public function sendMessage($typeId)
|
||||
{
|
||||
/* if (isset($_POST['data']))
|
||||
{
|
||||
$data = json_decode($_POST['data']);
|
||||
unset($_POST['data']);
|
||||
}
|
||||
else
|
||||
$this->terminateWithError("Data missing ", self::ERROR_TYPE_GENERAL);
|
||||
|
||||
if (isset($_POST['ids']))
|
||||
{
|
||||
$ids = json_decode($_POST['ids']);
|
||||
unset($_POST['ids']);
|
||||
}
|
||||
else
|
||||
$this->terminateWithError("IDs missing ", self::ERROR_TYPE_GENERAL);
|
||||
|
||||
|
||||
if (isset($_POST['uids']))
|
||||
{
|
||||
$uids = json_decode($_POST['uids']);
|
||||
unset($_POST['uids']);
|
||||
}
|
||||
else
|
||||
$this->terminateWithError("UIDs missing ", self::ERROR_TYPE_GENERAL);
|
||||
*/
|
||||
|
||||
if (isset($_POST['data']))
|
||||
{
|
||||
$data = json_decode($_POST['data']);
|
||||
unset($_POST['data']);
|
||||
foreach ($data as $k => $v) {
|
||||
$_POST[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
|
||||
}
|
||||
|
||||
public function sendMessage($recipient_id, $return=false)
|
||||
{
|
||||
//has to be uid TODO(Manu) check
|
||||
// $this->terminateWithError("uid", $recipient_id, self::ERROR_TYPE_GENERAL);
|
||||
|
||||
//default setting
|
||||
$receiversPersonId = $this->_getPersonId($recipient_id, 'uid');
|
||||
|
||||
$resultReturn = [];
|
||||
$uid = getAuthUID();
|
||||
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||
$result = $this->BenutzerModel->loadWhere(
|
||||
@@ -287,49 +238,54 @@ class Messages extends FHCAPI_Controller
|
||||
$body = $this->input->post('body');
|
||||
$relationmessage_id = $this->input->post('relationmessage_id');
|
||||
|
||||
$typeId = $this->input->post('type_id');
|
||||
$ids = $this->input->post('id');
|
||||
if (isset($_POST['ids']))
|
||||
{
|
||||
$ids = json_decode($_POST['ids']);
|
||||
unset($_POST['ids']);
|
||||
foreach ($data as $k => $v) {
|
||||
$_POST[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($ids as $id)
|
||||
{
|
||||
$receiversPersonId = $typeId == "person_id" ? $id : $this->_getPersonId($id, $typeId);
|
||||
|
||||
if($typeId == 'uid')
|
||||
{
|
||||
$prestudent_id = $this-> _getPrestudentIdFromUid($id);
|
||||
|
||||
//parseMessagetext for variables Prestudent
|
||||
$result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $body);
|
||||
$bodyParsed[$id] = $this->getDataOrTerminateWithError($result);
|
||||
$bodyParsed = $this->getDataOrTerminateWithError($result);
|
||||
}
|
||||
if($typeId == 'mitarbeiter_uid')
|
||||
{
|
||||
$person_id = $this->_getPersonId($id, $typeId);
|
||||
|
||||
$result = $this->MessagesModel->parseMessageTextPerson($person_id, $body);
|
||||
$bodyParsed[$id] = $this->getDataOrTerminateWithError($result);
|
||||
$this->terminateWithError($bodyParsed[$id], self::ERROR_TYPE_GENERAL);
|
||||
|
||||
$bodyParsed = $this->getDataOrTerminateWithError($result);
|
||||
}
|
||||
elseif($typeId == 'person_id')
|
||||
{
|
||||
$result = $this->MessagesModel->parseMessageTextPerson($id, $body);
|
||||
$bodyParsed[$id] = $this->getDataOrTerminateWithError($result);
|
||||
$bodyParsed = $this->getDataOrTerminateWithError($result);
|
||||
}
|
||||
elseif($typeId == 'prestudent_id')
|
||||
{
|
||||
$result = $this->MessagesModel->parseMessageTextPrestudent($id, $body);
|
||||
$bodyParsed[$id] = $this->getDataOrTerminateWithError($result);
|
||||
$bodyParsed = $this->getDataOrTerminateWithError($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->terminateWithError("type_id " . $typeId . " not valid", self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
$result =$this->messagelib->sendMessageUser($receiversPersonId, $subject, $bodyParsed, $benutzer->person_id, null, $relationmessage_id);
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
$resultReturn[] = current($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$result = $this->messagelib->sendMessageUser($receiversPersonId, $subject, $bodyParsed, $benutzer->person_id, null, $relationmessage_id);
|
||||
|
||||
$this->terminateWithSuccess($result);
|
||||
$this->terminateWithSuccess($resultReturn);
|
||||
}
|
||||
|
||||
public function getPreviewText($type_id)
|
||||
|
||||
@@ -38,19 +38,13 @@ 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}
|
||||
};
|
||||
},
|
||||
//TODO(Manu) enable for id_array
|
||||
/* getMsgVarsPrestudent(userParams){
|
||||
return {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/messages/messages/getMsgVarsPrestudent/' + userParams.id + '/' + userParams.type_id
|
||||
};
|
||||
}, */
|
||||
getMsgVarsPrestudent(ids, type_id){
|
||||
return {
|
||||
method: 'post',
|
||||
@@ -58,41 +52,25 @@ export default {
|
||||
params: {ids}
|
||||
};
|
||||
},
|
||||
//TODO(Manu) enable for id_array
|
||||
getPersonId(params){
|
||||
return {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/messages/messages/getPersonId/' + params.id + '/' + params.type_id
|
||||
};
|
||||
},
|
||||
//TODO(Manu) enable for id_array
|
||||
/* getUid(userParams){
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/messages/messages/getUid/' + userParams.id + '/' + userParams.type_id
|
||||
};
|
||||
}, */
|
||||
getUid(ids, type_id){
|
||||
/* getUid(ids, type_id){
|
||||
return {
|
||||
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){
|
||||
console.log(params.id);
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/messages/messages/getNameOfDefaultRecipient/' + params.id + '/' + params.type_id
|
||||
};
|
||||
},*/
|
||||
//TODO(Manu) enable for id_array
|
||||
getNameOfDefaultRecipients(ids, type_id){
|
||||
return {
|
||||
method: 'post',
|
||||
@@ -120,17 +98,17 @@ export default {
|
||||
params
|
||||
};
|
||||
}, */
|
||||
sendMessageFromModalContext(params) {
|
||||
sendMessageFromModalContext(type_id, params) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/messages/messages/sendMessages/',
|
||||
url: 'api/frontend/v1/messages/messages/sendMessage/' + type_id,
|
||||
params
|
||||
};
|
||||
},
|
||||
sendMessage(id, params) {
|
||||
sendMessage(type_id, params) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/messages/messages/sendMessage/' + id,
|
||||
url: 'api/frontend/v1/messages/messages/sendMessage/' + type_id,
|
||||
params
|
||||
};
|
||||
},
|
||||
|
||||
@@ -58,8 +58,7 @@ export default {
|
||||
previewText: null,
|
||||
previewBody: "",
|
||||
replyData: null,
|
||||
uid: null,
|
||||
uids: null //necessary?
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -116,31 +115,20 @@ export default {
|
||||
const data = new FormData();
|
||||
data.append('data', JSON.stringify(this.formData));
|
||||
data.append('ids', JSON.stringify(this.id));
|
||||
data.append('uids', JSON.stringify(this.uid));
|
||||
|
||||
const params = {
|
||||
id: this.id,
|
||||
type_id: this.typeId
|
||||
};
|
||||
const merged = {
|
||||
...this.formData,
|
||||
...params
|
||||
};
|
||||
data.append('data', JSON.stringify(merged));
|
||||
|
||||
//Modal Context?
|
||||
return this.$refs.formMessage
|
||||
.call(this.endpoint.sendMessageFromModalContext(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');
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
@@ -210,15 +198,6 @@ export default {
|
||||
this.previewBody = this.previewText;
|
||||
});
|
||||
},
|
||||
//TODO(Manu) check if No_UID
|
||||
getUid(id, typeId){
|
||||
this.$api
|
||||
.call(this.endpoint.getUid(this.id, this.typeId))
|
||||
.then(result => {
|
||||
this.uid = result.data;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
show(){
|
||||
this.$refs.modalNewMessage.show();
|
||||
},
|
||||
@@ -266,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];
|
||||
@@ -312,19 +285,6 @@ export default {
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
|
||||
/* this.$api
|
||||
.call(this.endpoint.getNameOfDefaultRecipient({
|
||||
id: this.id,
|
||||
type_id: this.typeId}))
|
||||
.then(result => {
|
||||
this.defaultRecipient = result.data;
|
||||
this.recipientsArray.push({
|
||||
'uid': this.uid,
|
||||
'details': this.defaultRecipient});
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);*/
|
||||
|
||||
//for multiaction too
|
||||
this.$api
|
||||
.call(this.endpoint.getNameOfDefaultRecipients(this.id, this.typeId))
|
||||
.then(result => {
|
||||
@@ -379,8 +339,6 @@ export default {
|
||||
</template>
|
||||
|
||||
<form-form ref="formNewMassage">
|
||||
|
||||
{{defaultRecipients}} | {{defaultRecipient}} || {{uid}}
|
||||
|
||||
<div class="tab-content" id="msg_preview_content">
|
||||
<div class="tab-pane fade show active" id="msg" role="tabpanel" aria-labelledby="msg-tab">
|
||||
|
||||
@@ -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",
|
||||
@@ -19,7 +20,7 @@ export default {
|
||||
openMode: String,
|
||||
tempTypeId: String,
|
||||
tempId: {
|
||||
type: [Number, String],
|
||||
type: Array,
|
||||
required: false
|
||||
},
|
||||
tempMessageId: {
|
||||
@@ -37,7 +38,7 @@ export default {
|
||||
},
|
||||
messageId(){
|
||||
return this.$props.tempMessageId ||this.$route.params.messageId;
|
||||
}
|
||||
},
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
@@ -53,6 +54,8 @@ export default {
|
||||
vorlagen: [],
|
||||
recipientsArray: [],
|
||||
defaultRecipient: null,
|
||||
defaultRecipients: [],
|
||||
defaultRecipientString: null,
|
||||
editor: null,
|
||||
isVisible: false,
|
||||
fieldsUser: [],
|
||||
@@ -67,8 +70,7 @@ export default {
|
||||
previewText: null,
|
||||
previewBody: "",
|
||||
replyData: null,
|
||||
uid: null,
|
||||
messageSent: false
|
||||
messageSent: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -106,19 +108,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 +120,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 +168,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 +195,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 +223,26 @@ export default {
|
||||
},
|
||||
},
|
||||
created(){
|
||||
this.getUid(this.id, this.typeId);
|
||||
|
||||
if (['person_id', 'mitarbeiter_uid'].includes(this.typeId)){
|
||||
const params = {
|
||||
id: this.id,
|
||||
type_id: this.typeId
|
||||
};
|
||||
|
||||
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 (['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 +252,7 @@ export default {
|
||||
}
|
||||
|
||||
this.$api
|
||||
.call(this.endpoint.getMsgVarsLoggedInUser())
|
||||
.call(ApiMessages.getMsgVarsLoggedInUser())
|
||||
.then(result => {
|
||||
this.fieldsUser = result.data;
|
||||
const user = this.fieldsUser;
|
||||
@@ -295,21 +264,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 +309,7 @@ export default {
|
||||
type="text"
|
||||
name="recipient"
|
||||
:label="$p.t('messages/recipient')"
|
||||
v-model="defaultRecipient"
|
||||
v-model="defaultRecipientString"
|
||||
disabled
|
||||
>
|
||||
</form-input>
|
||||
@@ -472,18 +438,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>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -98,6 +98,7 @@ export default {
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -124,7 +125,6 @@ export default {
|
||||
},
|
||||
template: `
|
||||
<div class="core-messages h-100 pb-3">
|
||||
{{typeId}} {{id}}
|
||||
|
||||
<message-modal
|
||||
ref="modalMsg"
|
||||
|
||||
@@ -32,6 +32,7 @@ export default {
|
||||
},
|
||||
template: `
|
||||
<div class="stv-details-messages h-100 pb-3 overflow-hidden">
|
||||
|
||||
<template v-if="prestudent_ids">
|
||||
<core-messages
|
||||
ref="formc"
|
||||
@@ -39,7 +40,7 @@ export default {
|
||||
type-id="prestudent_id"
|
||||
:id="prestudent_ids"
|
||||
messageLayout="twoColumnsTableLeft"
|
||||
open-mode="modal"
|
||||
open-mode="inSamePage"
|
||||
show-table
|
||||
>
|
||||
</core-messages>
|
||||
@@ -51,7 +52,7 @@ export default {
|
||||
type-id="person_id"
|
||||
:id="person_ids"
|
||||
messageLayout="twoColumnsTableLeft"
|
||||
open-mode="modal"
|
||||
open-mode="inSamePage"
|
||||
show-table
|
||||
>
|
||||
</core-messages>
|
||||
|
||||
Reference in New Issue
Block a user