From aa84bdec1e3dd02e1fb9f8c6fc09161576186cb5 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 27 Nov 2025 14:46:55 +0100 Subject: [PATCH 1/5] ---staging---- --- application/config/stv.php | 1 + .../api/frontend/v1/messages/Messages.php | 292 ++++++++++++++---- .../api/frontend/v1/stv/Config.php | 6 +- public/js/api/factory/messages/messages.js | 47 ++- .../Messages/Details/NewMessage/Modal.js | 62 ++-- .../Messages/Details/TableMessages.js | 4 +- public/js/components/Messages/Messages.js | 8 +- .../Studentenverwaltung/Details/Messages.js | 58 ++-- 8 files changed, 368 insertions(+), 110 deletions(-) diff --git a/application/config/stv.php b/application/config/stv.php index e03c00084..913b1c015 100644 --- a/application/config/stv.php +++ b/application/config/stv.php @@ -115,6 +115,7 @@ $config['student_tab_order'] = [ $config['students_tab_order'] = [ 'banking', 'status', + 'messages', 'groups', 'finalexam', 'archive', diff --git a/application/controllers/api/frontend/v1/messages/Messages.php b/application/controllers/api/frontend/v1/messages/Messages.php index 355fe79a4..f3a40f72f 100644 --- a/application/controllers/api/frontend/v1/messages/Messages.php +++ b/application/controllers/api/frontend/v1/messages/Messages.php @@ -14,13 +14,16 @@ class Messages extends FHCAPI_Controller 'getMsgVarsPrestudent' => ['admin:r', 'assistenz:r'], 'getMsgVarsLoggedInUser' => ['admin:r', 'assistenz:r'], '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'], 'getReplyData' => ['admin:r', 'assistenz:r'], 'getPersonId' => ['admin:r', 'assistenz:r'], 'getUid' => ['admin:r', 'assistenz:r'], + 'getUids' => ['admin:r', 'assistenz:r'], ]); //Load Models @@ -110,13 +113,39 @@ class Messages extends FHCAPI_Controller $this->terminateWithSuccess($data); } - public function getMsgVarsPrestudent($id, $typeId) +/* 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'); + $messageVarsPrestudent = []; + + if($typeId == 'uid') + { + $prestudent_ids = []; + foreach ($ids as $id) + { + $prestudent_ids[] = $this->_getPrestudentIdFromUid($id); + } + } + else + $prestudent_ids = $ids; + + foreach ($prestudent_ids as $prestudent_id) + { + $result = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id); + $data = $this->getDataOrTerminateWithError($result); + $messageVarsPrestudent[] = current($data); + } + + $this->terminateWithSuccess($messageVarsPrestudent); } public function getMsgVarsLoggedInUser() @@ -127,7 +156,7 @@ class Messages extends FHCAPI_Controller $this->terminateWithSuccess($data); } - public function getNameOfDefaultRecipient($id, $type_id) +/* public function getNameOfDefaultRecipient($id, $type_id) { $id = ($type_id != 'person_id') ? $this->_getPersonId($id, $type_id) : $id; @@ -138,11 +167,84 @@ class Messages extends FHCAPI_Controller $name = current($data); $this->terminateWithSuccess($name->vorname . " " . $name->nachname ); + }*/ + + public function getNameOfDefaultRecipients($type_id) + { + $ids = $this->input->post('ids'); + $recipients = []; + + if (empty($ids)) { + throw new InvalidArgumentException("Keine ID(s) übergeben."); + } + + $this->load->model('person/Person_model', 'PersonModel'); + if($type_id != 'person_id'){ + foreach ($ids as $id) + { + $person_id = $this->_getPersonId($id, $type_id); + $result = $this->PersonModel->load($person_id); + $data = $this->getDataOrTerminateWithError($result); + $name = current($data); + $recipients[$id] = $name->vorname . " " . $name->nachname; + } + } + else { + foreach ($ids as $id) { + $result = $this->PersonModel->load($id); + $data = $this->getDataOrTerminateWithError($result); + $name = current($data); + $recipients[$id] = $name->vorname . " " . $name->nachname; + } + } + + $this->terminateWithSuccess($recipients); } - public function sendMessage($recipient_id) + public function sendMessages() { - //has to be uid +/* 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 @@ -186,46 +288,51 @@ class Messages extends FHCAPI_Controller $relationmessage_id = $this->input->post('relationmessage_id'); $typeId = $this->input->post('type_id'); - $id = $this->input->post('id'); + $ids = $this->input->post('id'); - if($typeId == 'uid') + foreach ($ids as $id) { - $prestudent_id = $this-> _getPrestudentIdFromUid($id); + if($typeId == 'uid') + { + $prestudent_id = $this-> _getPrestudentIdFromUid($id); - //parseMessagetext for variables Prestudent - $result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $body); - $bodyParsed = $this->getDataOrTerminateWithError($result); - } - if($typeId == 'mitarbeiter_uid') - { - $person_id = $this->_getPersonId($id, $typeId); + //parseMessagetext for variables Prestudent + $result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $body); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + } + if($typeId == 'mitarbeiter_uid') + { + $person_id = $this->_getPersonId($id, $typeId); - $result = $this->MessagesModel->parseMessageTextPerson($person_id, $body); - $bodyParsed = $this->getDataOrTerminateWithError($result); - $this->terminateWithError($bodyParsed, self::ERROR_TYPE_GENERAL); + $result = $this->MessagesModel->parseMessageTextPerson($person_id, $body); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + $this->terminateWithError($bodyParsed[$id], self::ERROR_TYPE_GENERAL); + } + elseif($typeId == 'person_id') + { + $result = $this->MessagesModel->parseMessageTextPerson($id, $body); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + } + elseif($typeId == 'prestudent_id') + { + $result = $this->MessagesModel->parseMessageTextPrestudent($id, $body); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + } + else + { + $this->terminateWithError("type_id " . $typeId . " not valid", self::ERROR_TYPE_GENERAL); + } } - elseif($typeId == 'person_id') - { - $result = $this->MessagesModel->parseMessageTextPerson($id, $body); - $bodyParsed = $this->getDataOrTerminateWithError($result); - } - elseif($typeId == 'prestudent_id') - { - $result = $this->MessagesModel->parseMessageTextPrestudent($id, $body); - $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); $this->terminateWithSuccess($result); } - public function getPreviewText($id, $type_id) + public function getPreviewText($type_id) { if (isset($_POST['data'])) { @@ -235,30 +342,45 @@ class Messages extends FHCAPI_Controller else $this->terminateWithError("Textbody missing ", self::ERROR_TYPE_GENERAL); - switch($type_id) + if (isset($_POST['ids'])) { - case 'uid': - $prestudent_id = $this->_getPrestudentIdFromUid($id); - $result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $data); - break; - case 'prestudent_id': - $result = $this->MessagesModel->parseMessageTextPrestudent($id, $data); - break; - case 'person_id': - $result = $this->MessagesModel->parseMessageTextPerson($id, $data); - break; - case 'mitarbeiter_uid': - { - $person_id = $this->_getPersonId($id, $type_id); - $result = $this->MessagesModel->parseMessageTextPerson($person_id, $data); - } - break; - default: - $this->terminateWithError("MESSAGES::getPreviewText logic for type_id " . $type_id . " not defined yet", self::ERROR_TYPE_GENERAL); - break; + $ids = json_decode($_POST['ids']); + unset($_POST['ids']); } + else + $this->terminateWithError("IDs missing ", self::ERROR_TYPE_GENERAL); - $bodyParsed = $this->getDataOrTerminateWithError($result); + $bodyParsed = []; + + foreach ($ids as $id) + { + switch($type_id) + { + case 'uid': + $prestudent_id = $this->_getPrestudentIdFromUid($id); + $result = $this->MessagesModel->parseMessageTextPrestudent($prestudent_id, $data); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + break; + case 'prestudent_id': + $result = $this->MessagesModel->parseMessageTextPrestudent($id, $data); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + break; + case 'person_id': + $result = $this->MessagesModel->parseMessageTextPerson($id, $data); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + break; + case 'mitarbeiter_uid': + { + $person_id = $this->_getPersonId($id, $type_id); + $result = $this->MessagesModel->parseMessageTextPerson($person_id, $data); + $bodyParsed[$id] = $this->getDataOrTerminateWithError($result); + } + break; + default: + $this->terminateWithError("MESSAGES::getPreviewText logic for type_id " . $type_id . " not defined yet", self::ERROR_TYPE_GENERAL); + break; + } + } $this->terminateWithSuccess($bodyParsed); } @@ -343,7 +465,7 @@ class Messages extends FHCAPI_Controller $this->terminateWithSuccess($person->person_id); } - public function getUid($id, $typeId) + public function getUid($typeId) { if (!$typeId) { @@ -387,6 +509,68 @@ class Messages extends FHCAPI_Controller $this->terminateWithSuccess($benutzer->uid); } + public function getUids($typeId) + { + $ids = $this->input->post('ids'); + $benutzerIds = []; + + 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'); + foreach ($ids as $id) + { + $result = $this->BenutzerModel->loadWhere( + ['person_id' => $id] + ); + $data = $this->getDataOrTerminateWithError($result); + $benutzer = current($data); + + $benutzerIds[$id] = $benutzer->uid; + } + } + elseif($typeId == 'prestudent_id') + { + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + foreach ($ids as $id) + { + $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] + ); + $data = $this->getDataOrTerminateWithError($result); + $benutzer = current($data); + + $benutzerIds[$id] = $benutzer->uid; + } + } + elseif($typeId == 'uid' || $typeId == 'mitarbeiter_uid') + { + $this->terminateWithSuccess($ids); + } + else + { + $this->terminateWithError("MESSAGES::getUID logic for type_id " . $typeId . " not defined yet", self::ERROR_TYPE_GENERAL); + } + + + //$data = $this->getDataOrTerminateWithError($resultBenutzer); + //$benutzer = current($data); + + $this->terminateWithSuccess($benutzerIds); + } + private function _getPersonId($id, $typeId) { if ($typeId == 'uid' || $typeId == 'mitarbeiter_uid') diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index 97d626246..1dced3911 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -271,7 +271,6 @@ class Config extends FHCAPI_Controller $result['messages'] = [ 'title' => $this->p->t('stv', 'tab_messages'), 'component' => absoluteJsImportUrl('public/js/components/Stv/Studentenverwaltung/Details/Messages.js'), - 'showOnlyWithUid' => true ]; $result['grades'] = [ @@ -412,6 +411,11 @@ class Config extends FHCAPI_Controller 'component' => absoluteJsImportUrl('public/js/components/Stv/Studentenverwaltung/Details/Kontaktieren.js'), ]; + $result['messages'] = [ + 'title' => $this->p->t('stv', 'tab_messages'), + 'component' => absoluteJsImportUrl('public/js/components/Stv/Studentenverwaltung/Details/Messages.js'), + ]; + Events::trigger('stv_conf_students', function & () use (&$result) { return $result; }); diff --git a/public/js/api/factory/messages/messages.js b/public/js/api/factory/messages/messages.js index c6d4b67b6..1c2bbe66e 100644 --- a/public/js/api/factory/messages/messages.js +++ b/public/js/api/factory/messages/messages.js @@ -44,23 +44,40 @@ export default { url: 'api/frontend/v1/messages/messages/getMessageVarsPerson/' + userParams.id + '/' + userParams.type_id }; }, - getMsgVarsPrestudent(userParams){ + //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', + url: 'api/frontend/v1/messages/messages/getMsgVarsPrestudent/' + type_id, + 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 }; }, - getUid(userParams){ + //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){ + return { + method: 'post', + url: 'api/frontend/v1/messages/messages/getUids/' + type_id, + params: {ids} + }; }, getDataVorlage(vorlage_kurzbz){ return { @@ -68,16 +85,25 @@ export default { url: 'api/frontend/v1/messages/messages/getDataVorlage/' + vorlage_kurzbz }; }, - getNameOfDefaultRecipient(params){ +/* getNameOfDefaultRecipient(params){ + console.log(params.id); return { method: 'get', url: 'api/frontend/v1/messages/messages/getNameOfDefaultRecipient/' + params.id + '/' + params.type_id }; - }, - getPreviewText(userParams, params){ + },*/ + //TODO(Manu) enable for id_array + 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,12 +113,19 @@ 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 }; + }, */ + sendMessageFromModalContext(params) { + return { + method: 'post', + url: 'api/frontend/v1/messages/messages/sendMessages/', + params + }; }, sendMessage(id, params) { return { diff --git a/public/js/components/Messages/Details/NewMessage/Modal.js b/public/js/components/Messages/Details/NewMessage/Modal.js index ce9235617..87b8d7c87 100644 --- a/public/js/components/Messages/Details/NewMessage/Modal.js +++ b/public/js/components/Messages/Details/NewMessage/Modal.js @@ -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: [], @@ -57,6 +59,7 @@ export default { previewBody: "", replyData: null, uid: null, + uids: null //necessary? } }, methods: { @@ -111,6 +114,10 @@ export default { }, sendMessage() { 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 @@ -121,8 +128,9 @@ export default { }; data.append('data', JSON.stringify(merged)); + //Modal Context? return this.$refs.formMessage - .call(this.endpoint.sendMessageFromModalContext(this.uid, data)) + .call(this.endpoint.sendMessageFromModalContext(data)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSent')); this.hideModal('modalNewMessage'); @@ -146,14 +154,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,13 +210,10 @@ export default { this.previewBody = this.previewText; }); }, + //TODO(Manu) check if No_UID getUid(id, typeId){ - const params = { - id: id, - type_id: typeId - }; this.$api - .call(this.endpoint.getUid(params)) + .call(this.endpoint.getUid(this.id, this.typeId)) .then(result => { this.uid = result.data; }) @@ -281,12 +287,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]; @@ -310,7 +312,7 @@ export default { }) .catch(this.$fhcAlert.handleSystemError); - this.$api +/* this.$api .call(this.endpoint.getNameOfDefaultRecipient({ id: this.id, type_id: this.typeId})) @@ -320,6 +322,16 @@ export default { '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 => { + this.defaultRecipients = result.data; + this.defaultRecipientString = Object.values(this.defaultRecipients).join("; "); + + }) .catch(this.$fhcAlert.handleSystemError); //case of reply @@ -367,6 +379,8 @@ export default { + + {{defaultRecipients}} | {{defaultRecipient}} || {{uid}}
@@ -381,7 +395,7 @@ export default { type="text" name="recipient" :label="$p.t('messages/recipient')" - v-model="defaultRecipient" + v-model="defaultRecipientString" disabled > @@ -502,17 +516,17 @@ export default { >

- +
diff --git a/public/js/components/Messages/Details/TableMessages.js b/public/js/components/Messages/Details/TableMessages.js index 2a12128eb..172607022 100644 --- a/public/js/components/Messages/Details/TableMessages.js +++ b/public/js/components/Messages/Details/TableMessages.js @@ -19,7 +19,7 @@ export default { }, typeId: String, id: { - type: [Number, String], + type: Array, required: true }, messageLayout: String, @@ -346,7 +346,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 diff --git a/public/js/components/Messages/Messages.js b/public/js/components/Messages/Messages.js index 176c05b6b..53692d6a3 100644 --- a/public/js/components/Messages/Messages.js +++ b/public/js/components/Messages/Messages.js @@ -31,7 +31,7 @@ export default { } }, id: { - type: [Number, String], + type: Array, required: true }, showTable: Boolean, @@ -124,6 +124,7 @@ export default { }, template: `
+ {{typeId}} {{id}}
- - -
+ +
e.prestudent_id); + }, + person_ids() { + if (this.modelValue.person_id) + { + return [this.modelValue.person_id]; + } + return this.modelValue.map(e => e.person_id); + }, + }, template: `
- - - - + +
` }; \ No newline at end of file From 0372853df24de8264944fad41c495529369fc537 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Fri, 28 Nov 2025 14:01:20 +0100 Subject: [PATCH 2/5] Aufnahmetermine: fix error persiting boolean, GS: sortorder studiensemester, Gruppen exclude generated groups from search result --- .../controllers/api/frontend/v1/stv/Aufnahmetermine.php | 2 +- .../controllers/api/frontend/v1/stv/GemeinsameStudien.php | 2 +- application/controllers/api/frontend/v1/stv/Gruppen.php | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php b/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php index 86b739c90..26033908d 100644 --- a/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php +++ b/application/controllers/api/frontend/v1/stv/Aufnahmetermine.php @@ -298,7 +298,7 @@ class Aufnahmetermine extends FHCAPI_Controller $reihungstestangetreten = (isset($formData['reihungstestangetreten']) && !empty($formData['reihungstestangetreten'])) ? $formData['reihungstestangetreten'] - : null; + : false; $aufnahmegruppe_kurzbz = (isset($formData['aufnahmegruppe_kurzbz']) && !empty($formData['aufnahmegruppe_kurzbz'])) ? $formData['aufnahmegruppe_kurzbz'] diff --git a/application/controllers/api/frontend/v1/stv/GemeinsameStudien.php b/application/controllers/api/frontend/v1/stv/GemeinsameStudien.php index 97dad48fd..8f3d6419a 100644 --- a/application/controllers/api/frontend/v1/stv/GemeinsameStudien.php +++ b/application/controllers/api/frontend/v1/stv/GemeinsameStudien.php @@ -83,7 +83,7 @@ class GemeinsameStudien extends FHCAPI_Controller { $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); - $this->StudiensemesterModel->addOrder('studienjahr_kurzbz', 'DESC'); + $this->StudiensemesterModel->addOrder('start', 'DESC'); $result = $this->StudiensemesterModel->load(); $data = $this->getDataOrTerminateWithError($result); $this->terminateWithSuccess($data); diff --git a/application/controllers/api/frontend/v1/stv/Gruppen.php b/application/controllers/api/frontend/v1/stv/Gruppen.php index c45165b41..b10cfb328 100644 --- a/application/controllers/api/frontend/v1/stv/Gruppen.php +++ b/application/controllers/api/frontend/v1/stv/Gruppen.php @@ -147,7 +147,8 @@ class Gruppen extends FHCAPI_Controller 'lehre' => true, 'sichtbar' => true, 'aktiv' => true, - 'direktinskription' => false + 'direktinskription' => false, + 'generiert' => false ]); $data = $this->getDataOrTerminateWithError($result); From 17519eac83f66f0a5303fdbd05f6ca6c58333de7 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Mon, 1 Dec 2025 13:27:42 +0100 Subject: [PATCH 3/5] refactor Messaging - headerFilter for table Messages - multiactions for sendMessages for openmodes modal and inSamePage --- .../api/frontend/v1/messages/Messages.php | 112 +++++--------- public/js/api/factory/messages/messages.js | 40 ++--- .../Messages/Details/NewMessage/Modal.js | 56 +------ .../Messages/Details/NewMessage/NewDiv.js | 140 +++++++----------- .../Messages/Details/TableMessages.js | 43 ++++-- public/js/components/Messages/Messages.js | 2 +- .../Studentenverwaltung/Details/Messages.js | 5 +- 7 files changed, 141 insertions(+), 257 deletions(-) diff --git a/application/controllers/api/frontend/v1/messages/Messages.php b/application/controllers/api/frontend/v1/messages/Messages.php index f3a40f72f..b3cb31bb6 100644 --- a/application/controllers/api/frontend/v1/messages/Messages.php +++ b/application/controllers/api/frontend/v1/messages/Messages.php @@ -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) diff --git a/public/js/api/factory/messages/messages.js b/public/js/api/factory/messages/messages.js index 1c2bbe66e..c3542308a 100644 --- a/public/js/api/factory/messages/messages.js +++ b/public/js/api/factory/messages/messages.js @@ -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 }; }, diff --git a/public/js/components/Messages/Details/NewMessage/Modal.js b/public/js/components/Messages/Details/NewMessage/Modal.js index 87b8d7c87..d173bc7d0 100644 --- a/public/js/components/Messages/Details/NewMessage/Modal.js +++ b/public/js/components/Messages/Details/NewMessage/Modal.js @@ -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 { - - {{defaultRecipients}} | {{defaultRecipient}} || {{uid}}
diff --git a/public/js/components/Messages/Details/NewMessage/NewDiv.js b/public/js/components/Messages/Details/NewMessage/NewDiv.js index 24674fd3f..07fdf569d 100644 --- a/public/js/components/Messages/Details/NewMessage/NewDiv.js +++ b/public/js/components/Messages/Details/NewMessage/NewDiv.js @@ -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 > @@ -472,18 +438,18 @@ export default { v-model="defaultRecipient" > -

- +
diff --git a/public/js/components/Messages/Details/TableMessages.js b/public/js/components/Messages/Details/TableMessages.js index 172607022..dd1725507 100644 --- a/public/js/components/Messages/Details/TableMessages.js +++ b/public/js/components/Messages/Details/TableMessages.js @@ -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); } }, { diff --git a/public/js/components/Messages/Messages.js b/public/js/components/Messages/Messages.js index 53692d6a3..0785877d8 100644 --- a/public/js/components/Messages/Messages.js +++ b/public/js/components/Messages/Messages.js @@ -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: `
- {{typeId}} {{id}} +