diff --git a/application/controllers/api/frontend/v1/messages/Messages.php b/application/controllers/api/frontend/v1/messages/Messages.php index 3035e532d..77b46f97b 100644 --- a/application/controllers/api/frontend/v1/messages/Messages.php +++ b/application/controllers/api/frontend/v1/messages/Messages.php @@ -42,14 +42,22 @@ class Messages extends FHCAPI_Controller ]); } - public function getMessages($id, $type_id, $size, $page) + public function getMessages($id, $type_id, $size=null, $page=null) { if($type_id != 'person_id'){ $id = $this->_getPersonId($id, $type_id); } - $offset = $size * ($page - 1); - $limit = $size; + if(!(is_null($size) && is_null($page))) + { + $offset = $size * ($page - 1); + $limit = $size; + } + else + { + $offset = null; + $limit = null; + } $result = $this->MessageModel->getMessagesForTable($id, $offset, $limit); diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 3e59d7250..ba51e514e 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -242,6 +242,7 @@ class Message_model extends DB_Model */ public function getMessagesForTable($person_id, $offset, $limit) { + $limitoffset = (!is_null($offset) && !is_null($limit)) ? 'limit ? offset ?' : ''; $sql = <<execQuery($sql, $parametersArray); @@ -325,7 +327,7 @@ EOSQL; $data = getData($data); if($data) { - $count = ceil($data[0]->total_msgs / $limit); + $count = is_null($limit) ? 1 : ceil($data[0]->total_msgs / $limit); } return success(['data' => $data, 'count' => $count]); diff --git a/public/js/api/factory/messages/messages.js b/public/js/api/factory/messages/messages.js index b7b21dd8a..fb752cfb4 100644 --- a/public/js/api/factory/messages/messages.js +++ b/public/js/api/factory/messages/messages.js @@ -17,13 +17,16 @@ export default { getMessages(params) { + let url = 'api/frontend/v1/messages/messages/getMessages' + + '/' + params.id + + '/' + params.type; + if(params.size && params.page) { + url += '/' + params.size + + '/' + params.page; + } return { method: 'get', - url: 'api/frontend/v1/messages/messages/getMessages/' - + params.id + '/' - + params.type + '/' - + params.size + '/' - + params.page + url: url }; }, getVorlagen(){ diff --git a/public/js/components/Messages/Details/NewMessage/Modal.js b/public/js/components/Messages/Details/NewMessage/Modal.js index 47187de89..eeda421e6 100644 --- a/public/js/components/Messages/Details/NewMessage/Modal.js +++ b/public/js/components/Messages/Details/NewMessage/Modal.js @@ -133,6 +133,7 @@ export default { return this.$api .call(ApiMessages.getDataVorlage(vorlage_kurzbz)) .then(response => { + this.editor.setContent(response.data.text); this.formData.body = response.data.text; this.formData.subject = response.data.subject; }).catch(this.$fhcAlert.handleSystemError); @@ -203,24 +204,6 @@ export default { }, }, watch: { - 'formData.body': { - handler(newVal) { - const tinymcsVal = this.editor.getContent(); - - if (newVal && tinymcsVal != newVal) { - //Inhalt des Editors aktualisieren - this.editor.setContent(newVal); - } - } - }, - 'formData.vorlage_kurzbz': { - handler(newVal){ - if (newVal && newVal != null) { - this.formData.subject = newVal; - return this.getDataVorlage(newVal); - } - } - }, messageId: { immediate: true, handler: async function (newMessageId) { @@ -231,6 +214,7 @@ export default { this.replyData = result.data; if (this.replyData.length > 0) { + this.editor.setContent(this.replyData[0].replyBody); this.formData.subject = this.replyData[0].replySubject; this.formData.body = this.replyData[0].replyBody; this.formData.relationmessage_id = newMessageId; @@ -290,19 +274,6 @@ export default { }) .catch(this.$fhcAlert.handleSystemError); - - //case of reply - if(this.messageId) { - this.$api - .call(ApiMessages.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); - } }, async mounted() { this.initTinyMCE(); diff --git a/public/js/components/Messages/Details/NewMessage/NewDiv.js b/public/js/components/Messages/Details/NewMessage/NewDiv.js index b0c52f0f7..2e6ef30c5 100644 --- a/public/js/components/Messages/Details/NewMessage/NewDiv.js +++ b/public/js/components/Messages/Details/NewMessage/NewDiv.js @@ -64,7 +64,16 @@ export default { target: this.$refs.editor.$refs.input, //Important: not selector: to enable multiple import of component //height: 800, //plugins: ['lists'], - toolbar: 'styleselect | bold italic underline | alignleft aligncenter alignright alignjustify', + toolbar: 'styleselect | bold italic underline | alignleft aligncenter alignright alignjustify | link', + plugins: 'link', + link_context_toolbar: true, + automatic_uploads: true, + default_link_target: "_blank", + link_title: true, + target_list: [ + { title: 'New tab', value: '_blank' }, + { title: 'Same tab', value: '_self' } + ], style_formats: [ {title: 'Blocks', block: 'div'}, {title: 'Paragraph', block: 'p'}, @@ -98,7 +107,8 @@ export default { return this.$api .call(ApiMessages.sendMessage(this.typeId, data)) .then(response => { - this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSent')); + if(this.openMode == "inSamePage") + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSent')); this.hideTemplate(); this.resetForm(); this.messageSent = true; @@ -114,19 +124,17 @@ export default { return this.$api .call(ApiMessages.getDataVorlage(vorlage_kurzbz)) .then(response => { + this.editor.setContent(response.data.text); this.formData.body = response.data.text; this.formData.subject = response.data.subject; }).catch(this.$fhcAlert.handleSystemError); }, getPreviewText(){ - console.log("subj" + this.formData.subject); const data = new FormData(); data.append('data', JSON.stringify(this.formData.body)); data.append('ids', JSON.stringify(this.id)); - console.log("subj" + this.formData.subject); - return this.$api .call(ApiMessages.getPreviewText( this.typeId, data)) @@ -195,6 +203,7 @@ export default { .call(ApiMessages.getReplyData(messageId)) .then(result => { this.replyData = result.data; + this.editor.setContent(this.replyData[0].replyBody); this.formData.subject = this.replyData[0].replySubject; this.formData.body = this.replyData[0].replyBody; this.formData.relationmessage_id = messageId; @@ -202,27 +211,6 @@ export default { .catch(this.$fhcAlert.handleSystemError); } }, - watch: { - 'formData.body': { - handler(newVal) { - const tinymcsVal = this.editor.getContent(); - - if (newVal && tinymcsVal != newVal) { - //Inhalt des Editors aktualisieren - this.editor.setContent(newVal); - } - } - }, - 'formData.vorlage_kurzbz': { - handler(newVal){ - - if (newVal && newVal != null) { - this.formData.subject = newVal; - return this.getDataVorlage(newVal); - } - } - }, - }, created(){ const missingparamsmsgs = []; if(!this.typeId) @@ -291,17 +279,8 @@ export default { .catch(this.$fhcAlert.handleSystemError); //case of reply - if(this.messageId != null) { + if(this.messageId) { this.loadReplyData(this.messageId); -/* this.$api - .call(ApiMessages.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);*/ } }, @@ -499,10 +478,10 @@ export default {
- You can safely close this window. + You can safely close this window/tab.
- Sie können dieses Fenster schließen. + Fenster/Reiter kann geschlossen werden!
diff --git a/public/js/components/Messages/Details/TableMessages.js b/public/js/components/Messages/Details/TableMessages.js index d2101e2cb..aefa8bb2a 100644 --- a/public/js/components/Messages/Details/TableMessages.js +++ b/public/js/components/Messages/Details/TableMessages.js @@ -65,7 +65,14 @@ export default { buildTreemap(messages) { if (!messages || !messages.data || messages.data.length === 0) { - return {data: [], last_page: 0}; + if(this.tabulatorOptions.pagination) + { + return {data: [], last_page: 0}; + } + else + { + return []; + } } const last_page = messages.meta.count; @@ -106,7 +113,15 @@ export default { // to avoid endless loop if (iteration > messages.length) break; } - return {data: messageNested, last_page: last_page}; + + if(this.tabulatorOptions.pagination) + { + return {data: messageNested, last_page: last_page}; + } + else + { + return messageNested; + } }, loadAjaxCall(url, config, params){ return this.$api.call( @@ -252,7 +267,7 @@ export default { frozen: true } ], - pagination: true, + pagination: false, paginationMode: "remote", paginationSize: 15, paginationInitialPage: 1, diff --git a/public/js/components/Messages/Messages.js b/public/js/components/Messages/Messages.js index e1fb69dc3..bb69d2139 100644 --- a/public/js/components/Messages/Messages.js +++ b/public/js/components/Messages/Messages.js @@ -82,14 +82,16 @@ export default { this.$refs.modalMsg.show(); } else if (this.openMode == "inSamePage"){ - console.log("in same Page"); this.isVisibleDiv = true; - if(messageId) - this.$refs.templateNewDivMessage.loadReplyData(messageId); - else - this.$refs.templateNewDivMessage.resetForm(); - this.$refs.templateNewDivMessage.showTemplate(); + this.$nextTick(() => { + if(messageId) + this.$refs.templateNewDivMessage.loadReplyData(messageId); + else + this.$refs.templateNewDivMessage.resetForm(); + + this.$refs.templateNewDivMessage.showTemplate(); + }); } else console.log("no valid openMode");