From 191e92331e67d022ff132a7c2a240643524e47ae Mon Sep 17 00:00:00 2001 From: colemanw Date: Sat, 23 Sep 2023 16:36:26 -0400 Subject: [PATCH] ContactSummary - Add SearchKit display for Notes tab --- ang/afform/afsearchNoteComments.aff.html | 3 + ang/afform/afsearchNoteComments.aff.php | 13 + ang/afform/afsearchTabNote.aff.html | 3 + ang/afform/afsearchTabNote.aff.php | 16 + .../SavedSearch_Contact_Summary_Notes.mgd.php | 424 ++++++++++++++++++ 5 files changed, 459 insertions(+) create mode 100644 ang/afform/afsearchNoteComments.aff.html create mode 100644 ang/afform/afsearchNoteComments.aff.php create mode 100644 ang/afform/afsearchTabNote.aff.html create mode 100644 ang/afform/afsearchTabNote.aff.php create mode 100644 managed/contactSummary/SavedSearch_Contact_Summary_Notes.mgd.php diff --git a/ang/afform/afsearchNoteComments.aff.html b/ang/afform/afsearchNoteComments.aff.html new file mode 100644 index 0000000000..69d333efca --- /dev/null +++ b/ang/afform/afsearchNoteComments.aff.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/ang/afform/afsearchNoteComments.aff.php b/ang/afform/afsearchNoteComments.aff.php new file mode 100644 index 0000000000..eb4788c32c --- /dev/null +++ b/ang/afform/afsearchNoteComments.aff.php @@ -0,0 +1,13 @@ + 'search', + 'title' => ts('Comments'), + 'icon' => 'fa-list-alt', + 'server_route' => 'civicrm/contact/view/note/comments', + 'permission' => [ + 'access CiviCRM', + 'view all notes', + ], + 'permission_operator' => 'OR', +]; diff --git a/ang/afform/afsearchTabNote.aff.html b/ang/afform/afsearchTabNote.aff.html new file mode 100644 index 0000000000..626cea7f6b --- /dev/null +++ b/ang/afform/afsearchTabNote.aff.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/ang/afform/afsearchTabNote.aff.php b/ang/afform/afsearchTabNote.aff.php new file mode 100644 index 0000000000..c22bf3a049 --- /dev/null +++ b/ang/afform/afsearchTabNote.aff.php @@ -0,0 +1,16 @@ + 'search', + 'title' => ts('Notes'), + 'description' => '', + 'contact_summary' => 'tab', + 'summary_weight' => 100, + 'icon' => 'fa-sticky-note-o', + 'summary_contact_type' => NULL, + 'permission' => [ + 'access CiviCRM', + ], + 'permission_operator' => 'AND', + 'navigation' => NULL, +]; diff --git a/managed/contactSummary/SavedSearch_Contact_Summary_Notes.mgd.php b/managed/contactSummary/SavedSearch_Contact_Summary_Notes.mgd.php new file mode 100644 index 0000000000..b9a376ab58 --- /dev/null +++ b/managed/contactSummary/SavedSearch_Contact_Summary_Notes.mgd.php @@ -0,0 +1,424 @@ + 'SavedSearch_Contact_Summary_Notes', + 'entity' => 'SavedSearch', + 'cleanup' => 'always', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Contact_Summary_Notes', + 'label' => ts('Contact Summary Notes'), + 'form_values' => NULL, + 'mapping_id' => NULL, + 'search_custom_id' => NULL, + 'api_entity' => 'Note', + 'api_params' => [ + 'version' => 4, + 'select' => [ + 'id', + 'subject', + 'note', + 'note_date', + 'modified_date', + 'contact_id.sort_name', + 'GROUP_CONCAT(UNIQUE Note_EntityFile_File_01.file_name) AS GROUP_CONCAT_Note_EntityFile_File_01_file_name', + 'COUNT(Note_Note_entity_id_01.id) AS COUNT_Note_Note_entity_id_01_id', + ], + 'orderBy' => [], + 'where' => [], + 'groupBy' => [ + 'id', + ], + 'join' => [ + [ + 'File AS Note_EntityFile_File_01', + 'LEFT', + 'EntityFile', + [ + 'id', + '=', + 'Note_EntityFile_File_01.entity_id', + ], + [ + 'Note_EntityFile_File_01.entity_table', + '=', + "'civicrm_note'", + ], + ], + [ + 'Note AS Note_Note_entity_id_01', + 'LEFT', + [ + 'id', + '=', + 'Note_Note_entity_id_01.entity_id', + ], + [ + 'Note_Note_entity_id_01.entity_table', + '=', + "'civicrm_note'", + ], + ], + ], + 'having' => [], + ], + 'expires_date' => NULL, + 'description' => NULL, + ], + 'match' => [ + 'name', + ], + ], + ], + [ + 'name' => 'SavedSearch_Contact_Summary_Notes_SearchDisplay_Contact_Summary_Notes_Tab', + 'entity' => 'SearchDisplay', + 'cleanup' => 'always', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Contact_Summary_Notes_Tab', + 'label' => ts('Contact Summary Notes Tab'), + 'saved_search_id.name' => 'Contact_Summary_Notes', + 'type' => 'table', + 'settings' => [ + 'description' => NULL, + 'sort' => [ + ['note_date', 'DESC'], + ], + 'limit' => 25, + 'pager' => [ + 'hide_single' => TRUE, + 'show_count' => FALSE, + 'expose_limit' => TRUE, + ], + 'placeholder' => 5, + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'subject', + 'dataType' => 'String', + 'label' => ts('Subject'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'note', + 'dataType' => 'Text', + 'label' => ts('Note'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'note_date', + 'dataType' => 'Timestamp', + 'label' => ts('Note Date'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'modified_date', + 'dataType' => 'Timestamp', + 'label' => ts('Modified'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'contact_id.sort_name', + 'dataType' => 'String', + 'label' => ts('Created By'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'GROUP_CONCAT_Note_EntityFile_File_01_file_name', + 'dataType' => 'String', + 'label' => ts('Attachments'), + 'sortable' => TRUE, + 'link' => [ + 'path' => '[GROUP_CONCAT_Note_EntityFile_File_01_url]', + 'entity' => '', + 'action' => '', + 'join' => '', + 'target' => '', + ], + 'icons' => [ + [ + 'field' => 'Note_EntityFile_File_01.icon', + 'side' => 'left', + ], + ], + 'cssRules' => [ + [ + 'crm-image-popup', + 'Note_EntityFile_File_01.is_image', + '=', + TRUE, + ], + ], + ], + [ + 'size' => 'btn-xs', + 'links' => [ + [ + 'path' => 'civicrm/note?action=add&reset=1&entity_table=civicrm_note&entity_id=[id]', + 'icon' => 'fa-comment-o', + 'text' => '0', + 'style' => 'default', + 'condition' => [ + 'COUNT_Note_Note_entity_id_01_id', + 'IS EMPTY', + ], + 'task' => '', + 'entity' => '', + 'action' => '', + 'join' => '', + 'target' => 'crm-popup', + ], + [ + 'path' => 'civicrm/contact/view/note/comments#?parent_id=[id]', + 'icon' => 'fa-comments', + 'text' => '[COUNT_Note_Note_entity_id_01_id]', + 'style' => 'info', + 'condition' => [ + 'COUNT_Note_Note_entity_id_01_id', + 'IS NOT EMPTY', + ], + 'task' => '', + 'entity' => '', + 'action' => '', + 'join' => '', + 'target' => 'crm-popup', + ], + ], + 'type' => 'buttons', + 'alignment' => '', + 'label' => ts('Comments'), + ], + [ + 'size' => 'btn-xs', + 'links' => [ + [ + 'icon' => 'fa-external-link', + 'text' => ts('View'), + 'style' => 'default', + 'condition' => [], + 'task' => '', + 'entity' => 'Note', + 'action' => 'view', + 'join' => '', + 'target' => 'crm-popup', + ], + [ + 'icon' => 'fa-pencil', + 'text' => ts('Edit'), + 'style' => 'default', + 'condition' => [], + 'task' => '', + 'entity' => 'Note', + 'action' => 'update', + 'join' => '', + 'target' => 'crm-popup', + ], + [ + 'icon' => 'fa-trash', + 'text' => ts('Delete'), + 'style' => 'danger', + 'condition' => [], + 'task' => '', + 'entity' => 'Note', + 'action' => 'delete', + 'join' => '', + 'target' => 'crm-popup', + ], + ], + 'type' => 'buttons', + 'alignment' => 'text-right', + ], + ], + 'actions' => FALSE, + 'classes' => [ + 'table', + 'table-striped', + ], + 'headerCount' => FALSE, + 'toolbar' => [ + [ + 'text' => ts('Add Note'), + 'icon' => 'fa-plus', + 'style' => 'primary', + 'entity' => 'Note', + 'action' => 'add', + 'target' => 'crm-popup', + ], + ], + ], + 'acl_bypass' => FALSE, + ], + 'match' => [ + 'name', + 'saved_search_id', + ], + ], + ], + [ + 'name' => 'SavedSearch_Contact_Summary_Notes_SearchDisplay_Note_Comments', + 'entity' => 'SearchDisplay', + 'cleanup' => 'always', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Note_Comments', + 'label' => ts('Note Comments'), + 'saved_search_id.name' => 'Contact_Summary_Notes', + 'type' => 'table', + 'settings' => [ + 'description' => NULL, + 'sort' => [ + ['note_date', 'DESC'], + ], + 'limit' => 25, + 'pager' => [ + 'hide_single' => TRUE, + 'show_count' => TRUE, + 'expose_limit' => TRUE, + ], + 'placeholder' => 5, + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'subject', + 'dataType' => 'String', + 'label' => ts('Subject'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'note', + 'dataType' => 'Text', + 'label' => ts('Note'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'note_date', + 'dataType' => 'Timestamp', + 'label' => ts('Note Date'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'modified_date', + 'dataType' => 'Timestamp', + 'label' => ts('Modified'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'contact_id.sort_name', + 'dataType' => 'String', + 'label' => ts('Created By'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'GROUP_CONCAT_Note_EntityFile_File_01_file_name', + 'dataType' => 'String', + 'label' => ts('Attachments'), + 'sortable' => TRUE, + 'link' => [ + 'path' => '[GROUP_CONCAT_Note_EntityFile_File_01_url]', + 'entity' => '', + 'action' => '', + 'join' => '', + 'target' => '', + ], + 'icons' => [ + [ + 'field' => 'Note_EntityFile_File_01.icon', + 'side' => 'left', + ], + ], + 'cssRules' => [ + [ + 'crm-image-popup', + 'Note_EntityFile_File_01.is_image', + '=', + TRUE, + ], + ], + ], + [ + 'size' => 'btn-xs', + 'links' => [ + [ + 'icon' => 'fa-external-link', + 'text' => ts('View'), + 'style' => 'default', + 'condition' => [], + 'task' => '', + 'entity' => 'Note', + 'action' => 'view', + 'join' => '', + 'target' => 'crm-popup', + ], + [ + 'icon' => 'fa-pencil', + 'text' => ts('Edit'), + 'style' => 'default', + 'condition' => [], + 'task' => '', + 'entity' => 'Note', + 'action' => 'update', + 'join' => '', + 'target' => 'crm-popup', + ], + [ + 'icon' => 'fa-trash', + 'text' => ts('Delete'), + 'style' => 'danger', + 'condition' => [], + 'task' => '', + 'entity' => 'Note', + 'action' => 'delete', + 'join' => '', + 'target' => 'crm-popup', + ], + ], + 'type' => 'buttons', + 'alignment' => 'text-right', + ], + ], + 'actions' => FALSE, + 'classes' => [ + 'table', + 'table-striped', + ], + 'headerCount' => FALSE, + 'toolbar' => [ + [ + 'text' => ts('Add Comment'), + 'icon' => 'fa-plus', + 'style' => 'primary', + 'entity' => 'Note', + 'action' => 'add', + 'target' => 'crm-popup', + ], + ], + ], + 'acl_bypass' => FALSE, + ], + 'match' => [ + 'name', + 'saved_search_id', + ], + ], + ], +]; -- 2.25.1