From e8eee5cfaff4a29a13a737ae3503922a7ff95601 Mon Sep 17 00:00:00 2001 From: colemanw Date: Sun, 1 Oct 2023 21:48:59 -0400 Subject: [PATCH] ContactSummary - Add SearchKit display for relationships tab --- ang/afform/afsearchTabRel.aff.html | 9 + ang/afform/afsearchTabRel.aff.php | 13 + ...arch_Contact_Summary_Relationships.mgd.php | 463 ++++++++++++++++++ 3 files changed, 485 insertions(+) create mode 100644 ang/afform/afsearchTabRel.aff.html create mode 100644 ang/afform/afsearchTabRel.aff.php create mode 100644 managed/contactSummary/SavedSearch_Contact_Summary_Relationships.mgd.php diff --git a/ang/afform/afsearchTabRel.aff.html b/ang/afform/afsearchTabRel.aff.html new file mode 100644 index 0000000000..07fb4f4622 --- /dev/null +++ b/ang/afform/afsearchTabRel.aff.html @@ -0,0 +1,9 @@ +
+
+ {{:: ts('Permissioned Relationships:') }} + {{:: ts('This contact can be viewed by the other.') }} + {{:: ts('This contact can be viewed and edited by the other.') }} +
+ + +
diff --git a/ang/afform/afsearchTabRel.aff.php b/ang/afform/afsearchTabRel.aff.php new file mode 100644 index 0000000000..3eb3cb03ae --- /dev/null +++ b/ang/afform/afsearchTabRel.aff.php @@ -0,0 +1,13 @@ + 'search', + 'title' => ts('Relationships'), + 'permission' => [ + 'access CiviCRM', + ], + 'contact_summary' => 'tab', + 'icon' => 'fa-handshake-o', + 'summary_weight' => 80, + 'permission_operator' => 'AND', +]; diff --git a/managed/contactSummary/SavedSearch_Contact_Summary_Relationships.mgd.php b/managed/contactSummary/SavedSearch_Contact_Summary_Relationships.mgd.php new file mode 100644 index 0000000000..52c7d2b648 --- /dev/null +++ b/managed/contactSummary/SavedSearch_Contact_Summary_Relationships.mgd.php @@ -0,0 +1,463 @@ + 'SavedSearch_Contact_Summary_Relationships', + 'entity' => 'SavedSearch', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Contact_Summary_Relationships', + 'label' => ts('Contact Summary Relationships'), + 'api_entity' => 'RelationshipCache', + 'api_params' => [ + 'version' => 4, + 'select' => [ + 'near_relation:label', + 'RelationshipCache_Contact_far_contact_id_01.display_name', + 'start_date', + 'end_date', + 'RelationshipCache_Contact_far_contact_id_01.address_primary.city', + 'RelationshipCache_Contact_far_contact_id_01.address_primary.state_province_id:label', + 'RelationshipCache_Contact_far_contact_id_01.email_primary.email', + 'RelationshipCache_Contact_far_contact_id_01.phone_primary.phone', + 'permission_near_to_far:label', + 'permission_far_to_near:label', + 'is_active', + ], + 'orderBy' => [], + 'where' => [], + 'groupBy' => [], + 'join' => [ + [ + 'Contact AS RelationshipCache_Contact_far_contact_id_01', + 'LEFT', + [ + 'far_contact_id', + '=', + 'RelationshipCache_Contact_far_contact_id_01.id', + ], + ], + ], + 'having' => [], + ], + ], + 'match' => [ + 'name', + ], + ], + ], + [ + 'name' => 'SavedSearch_Contact_Summary_Relationships_SearchDisplay_Contact_Summary_Relationships_Tab', + 'entity' => 'SearchDisplay', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Contact_Summary_Relationships_Active', + 'label' => ts('Contact Summary Relationships Active'), + 'saved_search_id.name' => 'Contact_Summary_Relationships', + 'type' => 'table', + 'settings' => [ + 'description' => NULL, + 'sort' => [], + 'limit' => 50, + 'pager' => [ + 'hide_single' => TRUE, + 'expose_limit' => TRUE, + ], + 'placeholder' => 5, + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'near_relation:label', + 'dataType' => 'String', + 'label' => ts('Relationship'), + 'sortable' => TRUE, + 'icons' => [ + [ + 'field' => 'permission_far_to_near:icon', + 'side' => 'left', + ], + ], + ], + [ + 'type' => 'field', + 'key' => 'RelationshipCache_Contact_far_contact_id_01.display_name', + 'dataType' => 'String', + 'label' => ts('With'), + 'sortable' => TRUE, + 'icons' => [ + [ + 'field' => 'RelationshipCache_Contact_far_contact_id_01.contact_sub_type:icon', + 'side' => 'left', + ], + [ + 'field' => 'RelationshipCache_Contact_far_contact_id_01.contact_type:icon', + 'side' => 'left', + ], + [ + 'field' => 'permission_near_to_far:icon', + 'side' => 'right', + ], + ], + 'link' => [ + 'path' => '', + 'entity' => 'Contact', + 'action' => 'view', + 'join' => 'RelationshipCache_Contact_far_contact_id_01', + 'target' => '_blank', + ], + 'title' => ts('View Related Contact'), + ], + [ + 'type' => 'field', + 'key' => 'start_date', + 'dataType' => 'Date', + 'label' => ts('Dates'), + 'sortable' => TRUE, + 'rewrite' => '[start_date] - [end_date]', + ], + [ + 'type' => 'field', + 'key' => 'RelationshipCache_Contact_far_contact_id_01.address_primary.city', + 'dataType' => 'String', + 'label' => ts('City'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'RelationshipCache_Contact_far_contact_id_01.address_primary.state_province_id:label', + 'dataType' => 'Integer', + 'label' => ts('State/Prov'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'RelationshipCache_Contact_far_contact_id_01.email_primary.email', + 'dataType' => 'String', + 'label' => ts('Email'), + 'sortable' => TRUE, + 'icons' => [ + [ + 'icon' => 'fa-ban', + 'side' => 'left', + 'if' => [ + 'RelationshipCache_Contact_far_contact_id_01.do_not_email', + '=', + TRUE, + ], + ], + ], + ], + [ + 'type' => 'field', + 'key' => 'RelationshipCache_Contact_far_contact_id_01.phone_primary.phone', + 'dataType' => 'String', + 'label' => ts('Phone'), + 'sortable' => TRUE, + 'icons' => [ + [ + 'icon' => 'fa-ban', + 'side' => 'left', + 'if' => [ + 'RelationshipCache_Contact_far_contact_id_01.do_not_phone', + '=', + TRUE, + ], + ], + ], + ], + [ + 'text' => '', + 'style' => 'default', + 'size' => 'btn-xs', + 'icon' => 'fa-bars', + 'links' => [ + [ + 'entity' => 'Relationship', + 'action' => 'view', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-external-link', + 'text' => ts('View Relationship'), + 'style' => 'default', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + [ + 'entity' => 'Relationship', + 'action' => 'update', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-pencil', + 'text' => ts('Update Relationship'), + 'style' => 'default', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + [ + 'task' => 'disable', + 'entity' => 'Relationship', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-toggle-off', + 'text' => ts('Disable Relationship'), + 'style' => 'default', + 'path' => '', + 'action' => '', + 'condition' => [ + 'is_active', + '=', + TRUE, + ], + ], + [ + 'entity' => 'Relationship', + 'action' => 'delete', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-trash', + 'text' => ts('Delete Relationship'), + 'style' => 'danger', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + ], + 'type' => 'menu', + 'alignment' => 'text-right', + ], + ], + 'actions' => FALSE, + 'classes' => [ + 'table', + 'table-striped', + ], + 'toolbar' => [ + [ + 'action' => 'add', + 'entity' => 'Relationship', + 'text' => ts('Add Relationship'), + 'icon' => 'fa-plus', + 'style' => 'primary', + 'target' => 'crm-popup', + 'join' => '', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + ], + ], + ], + 'match' => [ + 'name', + 'saved_search_id', + ], + ], + ], + [ + 'name' => 'SavedSearch_Contact_Summary_Relationships_SearchDisplay_Contact_Summary_Relationships_Inactive', + 'entity' => 'SearchDisplay', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Contact_Summary_Relationships_Inactive', + 'label' => ts('Contact Summary Relationships Inactive'), + 'saved_search_id.name' => 'Contact_Summary_Relationships', + 'type' => 'table', + 'settings' => [ + 'description' => ts('These relationships are Disabled OR have a past End Date.'), + 'sort' => [], + 'limit' => 50, + 'pager' => [ + 'hide_single' => TRUE, + 'expose_limit' => TRUE, + ], + 'placeholder' => 5, + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'near_relation:label', + 'dataType' => 'String', + 'label' => ts('Relationship'), + 'sortable' => TRUE, + 'icons' => [ + [ + 'field' => 'permission_far_to_near:icon', + 'side' => 'left', + ], + ], + ], + [ + 'type' => 'field', + 'key' => 'RelationshipCache_Contact_far_contact_id_01.display_name', + 'dataType' => 'String', + 'label' => ts('With'), + 'sortable' => TRUE, + 'icons' => [ + [ + 'field' => 'RelationshipCache_Contact_far_contact_id_01.contact_sub_type:icon', + 'side' => 'left', + ], + [ + 'field' => 'RelationshipCache_Contact_far_contact_id_01.contact_type:icon', + 'side' => 'left', + ], + [ + 'field' => 'permission_near_to_far:icon', + 'side' => 'right', + ], + ], + 'link' => [ + 'path' => '', + 'entity' => 'Contact', + 'action' => 'view', + 'join' => 'RelationshipCache_Contact_far_contact_id_01', + 'target' => '_blank', + ], + 'title' => ts('View Related Contact'), + ], + [ + 'type' => 'field', + 'key' => 'start_date', + 'dataType' => 'Date', + 'label' => ts('Dates'), + 'sortable' => TRUE, + 'rewrite' => '[start_date] - [end_date]', + ], + [ + 'type' => 'field', + 'key' => 'RelationshipCache_Contact_far_contact_id_01.address_primary.city', + 'dataType' => 'String', + 'label' => ts('City'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'RelationshipCache_Contact_far_contact_id_01.address_primary.state_province_id:label', + 'dataType' => 'Integer', + 'label' => ts('State/Prov'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'RelationshipCache_Contact_far_contact_id_01.email_primary.email', + 'dataType' => 'String', + 'label' => ts('Email'), + 'sortable' => TRUE, + 'icons' => [ + [ + 'icon' => 'fa-ban', + 'side' => 'left', + 'if' => [ + 'RelationshipCache_Contact_far_contact_id_01.do_not_email', + '=', + TRUE, + ], + ], + ], + ], + [ + 'type' => 'field', + 'key' => 'RelationshipCache_Contact_far_contact_id_01.phone_primary.phone', + 'dataType' => 'String', + 'label' => ts('Phone'), + 'sortable' => TRUE, + 'icons' => [ + [ + 'icon' => 'fa-ban', + 'side' => 'left', + 'if' => [ + 'RelationshipCache_Contact_far_contact_id_01.do_not_phone', + '=', + TRUE, + ], + ], + ], + ], + [ + 'text' => '', + 'style' => 'default', + 'size' => 'btn-xs', + 'icon' => 'fa-bars', + 'links' => [ + [ + 'entity' => 'Relationship', + 'action' => 'view', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-external-link', + 'text' => ts('View Relationship'), + 'style' => 'default', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + [ + 'entity' => 'Relationship', + 'action' => 'update', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-pencil', + 'text' => ts('Update Relationship'), + 'style' => 'default', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + [ + 'task' => 'enable', + 'entity' => 'Relationship', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-toggle-on', + 'text' => ts('Enable Relationship'), + 'style' => 'default', + 'path' => '', + 'action' => '', + 'condition' => [ + 'is_active', + '=', + FALSE, + ], + ], + [ + 'entity' => 'Relationship', + 'action' => 'delete', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-trash', + 'text' => ts('Delete Relationship'), + 'style' => 'danger', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + ], + 'type' => 'menu', + 'alignment' => 'text-right', + ], + ], + 'actions' => FALSE, + 'classes' => [ + 'table', + 'table-striped', + 'disabled', + ], + ], + ], + 'match' => [ + 'name', + 'saved_search_id', + ], + ], + ], +]; -- 2.25.1