From 80b50c5a8d1e346f00a9b7cd6cf64d04717e677f Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Fri, 26 Jan 2024 16:25:09 +0100 Subject: [PATCH] chg: [analyst-note] Added support of opinion on relationships --- app/Model/AnalystData.php | 4 +--- .../genericElements/Analyst_data/generic.ctp | 17 ++++++++--------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/app/Model/AnalystData.php b/app/Model/AnalystData.php index 1dc52e515..48c5ab09f 100644 --- a/app/Model/AnalystData.php +++ b/app/Model/AnalystData.php @@ -114,17 +114,15 @@ class AnalystData extends AppModel 'object_uuid' => $analystData['uuid'], ] ]; - + // recursively fetch and include nested notes and opinions $childNotes = array_map(function ($item) { $expandedNotes = $this->fetchChildNotesAndOpinions($item[$this->Note->current_type]); return $expandedNotes; - // return $item[$this->Note->current_type]; }, $this->Note->find('all', $paramsNote)); $childOpinions = array_map(function ($item) { $expandedNotes = $this->fetchChildNotesAndOpinions($item[$this->Opinion->current_type]); return $expandedNotes; - // return $item[$this->Opinion->current_type]; }, $this->Opinion->find('all', $paramsOpinion)); if (!empty($childNotes)) { diff --git a/app/View/Elements/genericElements/Analyst_data/generic.ctp b/app/View/Elements/genericElements/Analyst_data/generic.ctp index a8ed42f97..59a1f24ad 100644 --- a/app/View/Elements/genericElements/Analyst_data/generic.ctp +++ b/app/View/Elements/genericElements/Analyst_data/generic.ctp @@ -257,6 +257,7 @@ foreach ($relationships as $relationship) { } $notesOpinions = array_merge($notes, $opinions); +$notesOpinionsRelationships = array_merge($notesOpinions, $relationships); if(!function_exists("countNotes")) { function countNotes($notesOpinions) { @@ -290,7 +291,7 @@ $notesOpinionCount = $counts['notesOpinions']; $relationshipsCount = count($relationships); ?> - + @@ -429,7 +430,7 @@ var baseNoteTemplate = doT.template('\ style="display: flex; flex-direction: row; align-items: center; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 1px 5px -2px rgb(0 0 0 / 0.5); border-radius: 0.25rem; padding: 0.25rem; margin-bottom: 0.0rem; background-color: #fff; transition: ease-out opacity 0.5s;" \ data-org-uuid="{{=it.orgc_uuid}}" \ > \ -
\ +
{{=it.note_type_name}}-{{=it.id}}\
\
\ Organisation logo \ @@ -442,10 +443,10 @@ var baseNoteTemplate = doT.template('\ {{=it.distribution_text}} \ \ {{? it._permissions.can_add }} \ - \ + \ {{?}} \ {{? it._permissions.can_add }} \ - \ + \ {{?}} \ {{? it._permissions.can_edit }} \ \ @@ -649,14 +650,12 @@ var shortDist = ; openGenericModal(baseurl + '' + note_type + '/' + object_uuid + '/' + object_type) } - function addNote(clicked, note_uuid) { - object_type = 'Note'; + function addNote(clicked, note_uuid, object_type) { note_type = 'Note'; openGenericModal(baseurl + '' + note_type + '/' + note_uuid + '/' + object_type) } - function addOpinion(clicked, note_uuid) { - object_type = 'Note'; + function addOpinion(clicked, note_uuid, object_type) { note_type = 'Opinion'; openGenericModal(baseurl + '' + note_type + '/' + note_uuid + '/' + object_type) } @@ -797,7 +796,7 @@ if(!function_exists("genStyleForOpinionNote")) { } } -genStyleForOpinionNotes($notesOpinions) +genStyleForOpinionNotes($notesOpinionsRelationships) ?>