From bb231168ba054c48c26b114ad007d7d8a39c36e0 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 14 Sep 2022 09:23:45 -0400 Subject: [PATCH] AdminUI - Add SearchKit-based screen for Administer Contact Types --- .../ang/afsearchAdminContactTypes.aff.html | 9 ++ .../ang/afsearchAdminContactTypes.aff.json | 8 + .../SavedSearch_Administer_Contact_Types.php | 151 ++++++++++++++++++ 3 files changed, 168 insertions(+) create mode 100644 ext/civicrm_admin_ui/ang/afsearchAdminContactTypes.aff.html create mode 100644 ext/civicrm_admin_ui/ang/afsearchAdminContactTypes.aff.json create mode 100644 ext/civicrm_admin_ui/managed/SavedSearch_Administer_Contact_Types.php diff --git a/ext/civicrm_admin_ui/ang/afsearchAdminContactTypes.aff.html b/ext/civicrm_admin_ui/ang/afsearchAdminContactTypes.aff.html new file mode 100644 index 0000000000..fc89171324 --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchAdminContactTypes.aff.html @@ -0,0 +1,9 @@ +
+
+
+ {{:: ts('CiviCRM comes with 3 basic (built-in) contact types: Individual, Household, and Organization. You can create additional contact types based on these basic types to further differentiate contacts (for example you might create Student, Parent, Staff, and /or Volunteer "subtypes" from the basic Individual type...). You can also re-name the built-in types. Contact subtypes are especially useful when you need to collect and display different sets of custom data for different types of contacts.') }} + {{:: ts('Learn more...') }} +
+
+ +
diff --git a/ext/civicrm_admin_ui/ang/afsearchAdminContactTypes.aff.json b/ext/civicrm_admin_ui/ang/afsearchAdminContactTypes.aff.json new file mode 100644 index 0000000000..902c469d7f --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchAdminContactTypes.aff.json @@ -0,0 +1,8 @@ +{ + "type": "search", + "title": "Contact Types", + "description": "Administer contact types and sub-types", + "icon": "fa-list-alt", + "server_route": "civicrm/admin/options/subtype", + "permission": "access CiviCRM" +} diff --git a/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Contact_Types.php b/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Contact_Types.php new file mode 100644 index 0000000000..bce63cb882 --- /dev/null +++ b/ext/civicrm_admin_ui/managed/SavedSearch_Administer_Contact_Types.php @@ -0,0 +1,151 @@ + 'SavedSearch_Administer_Contact_Types', + 'entity' => 'SavedSearch', + 'cleanup' => 'always', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Administer_Contact_Types', + 'label' => 'Administer Contact Types', + 'form_values' => NULL, + 'mapping_id' => NULL, + 'search_custom_id' => NULL, + 'api_entity' => 'ContactType', + 'api_params' => [ + 'version' => 4, + 'select' => [ + 'label', + 'parent_id:label', + 'description', + ], + 'orderBy' => [], + 'where' => [], + 'groupBy' => [], + 'join' => [], + 'having' => [], + ], + 'expires_date' => NULL, + 'description' => NULL, + ], + ], + ], + [ + 'name' => 'SavedSearch_Administer_Contact_Types_SearchDisplay_Contact_Types_Table', + 'entity' => 'SearchDisplay', + 'cleanup' => 'always', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Contact_Types_Table', + 'label' => 'Contact Types Table', + 'saved_search_id.name' => 'Administer_Contact_Types', + 'type' => 'table', + 'settings' => [ + 'actions' => FALSE, + 'limit' => 50, + 'classes' => [ + 'table', + 'table-striped', + ], + 'pager' => [ + 'show_count' => TRUE, + ], + 'placeholder' => 5, + 'sort' => [ + [ + 'parent_id:label', + 'ASC', + ], + [ + 'label', + 'ASC', + ], + ], + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'label', + 'dataType' => 'String', + 'label' => 'Label', + 'sortable' => TRUE, + 'icons' => [ + [ + 'field' => 'icon', + 'side' => 'left', + ], + ], + 'editable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'parent_id:label', + 'dataType' => 'Integer', + 'label' => 'Parent', + 'sortable' => TRUE, + 'icons' => [ + [ + 'icon' => 'fa-lock', + 'side' => 'left', + 'if' => [ + 'parent_id:label', + 'IS EMPTY', + ], + ], + ], + ], + [ + 'type' => 'field', + 'key' => 'description', + 'dataType' => 'Text', + 'label' => 'Description', + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'size' => 'btn-sm', + 'links' => [ + [ + 'entity' => 'ContactType', + 'action' => 'update', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-pencil', + 'text' => 'Edit', + 'style' => 'default', + 'path' => '', + 'condition' => [], + ], + [ + 'entity' => 'ContactType', + 'action' => 'delete', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-trash', + 'text' => 'Delete', + 'style' => 'danger', + 'path' => '', + 'condition' => [ + 'parent_id:label', + 'IS NOT EMPTY', + ], + ], + ], + 'type' => 'buttons', + 'alignment' => 'text-right', + ], + ], + 'addButton' => [ + 'path' => 'civicrm/admin/options/subtype/edit?action=add&reset=1', + 'text' => 'Add Contact Type', + 'icon' => 'fa-plus', + ], + ], + 'acl_bypass' => FALSE, + ], + ], + ], +]; -- 2.25.1