From 04078d359e298a5a02ea274404dcdb8af83225dd Mon Sep 17 00:00:00 2001 From: colemanw Date: Wed, 4 Oct 2023 08:34:06 -0400 Subject: [PATCH] ContactSummary - Add SearchKit display for activities tab to AdminUI --- .../ang/afsearchTabActivity.aff.html | 9 + .../ang/afsearchTabActivity.aff.php | 14 + ...dSearch_Contact_Summary_Activities.mgd.php | 258 ++++++++++++++++++ 3 files changed, 281 insertions(+) create mode 100644 ext/civicrm_admin_ui/ang/afsearchTabActivity.aff.html create mode 100644 ext/civicrm_admin_ui/ang/afsearchTabActivity.aff.php create mode 100644 ext/civicrm_admin_ui/managed/SavedSearch_Contact_Summary_Activities.mgd.php diff --git a/ext/civicrm_admin_ui/ang/afsearchTabActivity.aff.html b/ext/civicrm_admin_ui/ang/afsearchTabActivity.aff.html new file mode 100644 index 0000000000..59087354c7 --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchTabActivity.aff.html @@ -0,0 +1,9 @@ +
+
+ + + + +
+ +
diff --git a/ext/civicrm_admin_ui/ang/afsearchTabActivity.aff.php b/ext/civicrm_admin_ui/ang/afsearchTabActivity.aff.php new file mode 100644 index 0000000000..527c70b86b --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchTabActivity.aff.php @@ -0,0 +1,14 @@ + 'search', + 'title' => ts('Activities'), + 'description' => '', + 'contact_summary' => 'tab', + 'summary_weight' => 70, + 'icon' => 'fa-tasks', + 'permission' => [ + 'access CiviCRM', + ], + 'permission_operator' => 'AND', +]; diff --git a/ext/civicrm_admin_ui/managed/SavedSearch_Contact_Summary_Activities.mgd.php b/ext/civicrm_admin_ui/managed/SavedSearch_Contact_Summary_Activities.mgd.php new file mode 100644 index 0000000000..6d2f0837fe --- /dev/null +++ b/ext/civicrm_admin_ui/managed/SavedSearch_Contact_Summary_Activities.mgd.php @@ -0,0 +1,258 @@ +get('civicaseShowCaseActivities')); +return [ + [ + 'name' => 'SavedSearch_Contact_Summary_Activities', + 'entity' => 'SavedSearch', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Contact_Summary_Activities', + 'label' => ts('Contact Summary Activities'), + 'api_entity' => 'Activity', + 'api_params' => [ + 'version' => 4, + 'select' => [ + 'activity_type_id:label', + 'subject', + 'activity_date_time', + 'status_id:label', + 'GROUP_CONCAT(UNIQUE Activity_ActivityContact_Contact_02.sort_name) AS GROUP_CONCAT_Activity_ActivityContact_Contact_02_sort_name', + 'GROUP_CONCAT(UNIQUE Activity_ActivityContact_Contact_03.sort_name) AS GROUP_CONCAT_Activity_ActivityContact_Contact_03_sort_name', + 'GROUP_CONCAT(UNIQUE Activity_ActivityContact_Contact_04.sort_name) AS GROUP_CONCAT_Activity_ActivityContact_Contact_04_sort_name', + ], + 'orderBy' => [], + 'where' => $excludeCaseActivities ? [['case_id', 'IS EMPTY']] : [], + 'groupBy' => [ + 'id', + ], + 'join' => [ + [ + 'Contact AS Activity_ActivityContact_Contact_01', + 'INNER', + 'ActivityContact', + [ + 'id', + '=', + 'Activity_ActivityContact_Contact_01.activity_id', + ], + ], + [ + 'Contact AS Activity_ActivityContact_Contact_02', + 'LEFT', + 'ActivityContact', + [ + 'id', + '=', + 'Activity_ActivityContact_Contact_02.activity_id', + ], + [ + 'Activity_ActivityContact_Contact_02.record_type_id:name', + '=', + '"Activity Source"', + ], + ], + [ + 'Contact AS Activity_ActivityContact_Contact_03', + 'LEFT', + 'ActivityContact', + [ + 'id', + '=', + 'Activity_ActivityContact_Contact_03.activity_id', + ], + [ + 'Activity_ActivityContact_Contact_03.record_type_id:name', + '=', + '"Activity Targets"', + ], + ], + [ + 'Contact AS Activity_ActivityContact_Contact_04', + 'LEFT', + 'ActivityContact', + [ + 'id', + '=', + 'Activity_ActivityContact_Contact_04.activity_id', + ], + [ + 'Activity_ActivityContact_Contact_04.record_type_id:name', + '=', + '"Activity Assignees"', + ], + ], + ], + 'having' => [], + ], + ], + 'match' => [ + 'name', + ], + ], + ], + [ + 'name' => 'SavedSearch_Contact_Summary_Activities_SearchDisplay_Contact_Summary_Activities_Tab', + 'entity' => 'SearchDisplay', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Contact_Summary_Activities_Tab', + 'label' => ts('Contact Summary Activities Tab'), + 'saved_search_id.name' => 'Contact_Summary_Activities', + 'type' => 'table', + 'settings' => [ + 'description' => NULL, + 'sort' => [ + [ + 'activity_date_time', + 'DESC', + ], + ], + 'limit' => 50, + 'pager' => [ + 'hide_single' => TRUE, + 'show_count' => TRUE, + 'expose_limit' => TRUE, + ], + 'placeholder' => 5, + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'activity_type_id:label', + 'dataType' => 'Integer', + 'label' => ts('Type'), + 'sortable' => TRUE, + 'icons' => [ + [ + 'field' => 'activity_type_id:icon', + 'side' => 'left', + ], + ], + ], + [ + 'type' => 'field', + 'key' => 'subject', + 'dataType' => 'String', + 'label' => ts('Subject'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'activity_date_time', + 'dataType' => 'Timestamp', + 'label' => ts('Date'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'status_id:label', + 'dataType' => 'Integer', + 'label' => ts('Status'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'GROUP_CONCAT_Activity_ActivityContact_Contact_02_sort_name', + 'dataType' => 'String', + 'label' => ts('Added By'), + 'sortable' => TRUE, + 'link' => [ + 'entity' => 'Contact', + 'action' => 'view', + 'join' => 'Activity_ActivityContact_Contact_02', + 'target' => '_blank', + ], + ], + [ + 'type' => 'field', + 'key' => 'GROUP_CONCAT_Activity_ActivityContact_Contact_03_sort_name', + 'dataType' => 'String', + 'label' => ts('With'), + 'sortable' => TRUE, + 'link' => [ + 'entity' => 'Contact', + 'action' => 'view', + 'join' => 'Activity_ActivityContact_Contact_03', + 'target' => '_blank', + ], + ], + [ + 'type' => 'field', + 'key' => 'GROUP_CONCAT_Activity_ActivityContact_Contact_04_sort_name', + 'dataType' => 'String', + 'label' => ts('Assigned'), + 'sortable' => TRUE, + 'link' => [ + 'entity' => 'Contact', + 'action' => 'view', + 'join' => 'Activity_ActivityContact_Contact_04', + 'target' => '_blank', + ], + ], + [ + 'text' => '', + 'style' => 'default', + 'size' => 'btn-xs', + 'icon' => 'fa-bars', + 'links' => [ + [ + 'entity' => 'Activity', + 'action' => 'view', + 'target' => 'crm-popup', + 'icon' => 'fa-external-link', + 'text' => ts('View Activity'), + 'style' => 'default', + ], + [ + 'entity' => 'Activity', + 'action' => 'update', + 'target' => 'crm-popup', + 'icon' => 'fa-pencil', + 'text' => ts('Update Activity'), + 'style' => 'default', + ], + [ + 'entity' => 'Activity', + 'action' => 'delete', + 'target' => 'crm-popup', + 'icon' => 'fa-trash', + 'text' => ts('Delete Activity'), + 'style' => 'danger', + ], + ], + 'type' => 'menu', + 'alignment' => 'text-right', + ], + ], + 'classes' => [ + 'table', + 'table-striped', + ], + 'toolbar' => [ + [ + 'action' => 'add', + 'entity' => 'Activity', + 'text' => ts('Add Activity'), + 'icon' => 'fa-plus', + 'style' => 'primary', + 'target' => 'crm-popup', + ], + ], + ], + ], + 'match' => [ + 'name', + 'saved_search_id', + ], + ], + ], +]; -- 2.25.1