From ac97e603e3e65adf17554bbbf25020fe2fbdfb03 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Mon, 4 Dec 2023 21:02:38 +0000 Subject: [PATCH] Added DatePreference admin UI --- .../afsearchSettingsDatePreferences.aff.html | 7 + .../afsearchSettingsDatePreferences.aff.php | 13 ++ ...edSearch_Settings_Date_Preferences.mgd.php | 130 ++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 ext/civicrm_admin_ui/ang/afsearchSettingsDatePreferences.aff.html create mode 100644 ext/civicrm_admin_ui/ang/afsearchSettingsDatePreferences.aff.php create mode 100644 ext/civicrm_admin_ui/managed/SavedSearch_Settings_Date_Preferences.mgd.php diff --git a/ext/civicrm_admin_ui/ang/afsearchSettingsDatePreferences.aff.html b/ext/civicrm_admin_ui/ang/afsearchSettingsDatePreferences.aff.html new file mode 100644 index 0000000000..56bf9151f0 --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchSettingsDatePreferences.aff.html @@ -0,0 +1,7 @@ +
+
+
{{:: ts('Changing the parameters here affects the input and display for specific fields types. Setting the default date format for the entire site is a Localisation setting.') }} {{:: ts('See Administer > Localization > Date Formats.') }}
+ +
+ +
diff --git a/ext/civicrm_admin_ui/ang/afsearchSettingsDatePreferences.aff.php b/ext/civicrm_admin_ui/ang/afsearchSettingsDatePreferences.aff.php new file mode 100644 index 0000000000..195a02ec7b --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchSettingsDatePreferences.aff.php @@ -0,0 +1,13 @@ + E::ts('Settings - Date Preferences'), + 'permission' => [ + 'administer CiviCRM', + ], + 'type' => 'search', + 'icon' => 'fa-list-alt', + 'server_route' => 'civicrm/admin/setting/preferences/date', + 'permission_operator' => 'AND', +]; diff --git a/ext/civicrm_admin_ui/managed/SavedSearch_Settings_Date_Preferences.mgd.php b/ext/civicrm_admin_ui/managed/SavedSearch_Settings_Date_Preferences.mgd.php new file mode 100644 index 0000000000..5b4bb413b1 --- /dev/null +++ b/ext/civicrm_admin_ui/managed/SavedSearch_Settings_Date_Preferences.mgd.php @@ -0,0 +1,130 @@ + 'SavedSearch_Settings_Date_Preferences', + 'entity' => 'SavedSearch', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Settings_Date_Preferences', + 'label' => E::ts('Settings - Date Preferences'), + 'api_entity' => 'PreferencesDate', + 'api_params' => [ + 'version' => 4, + 'select' => [ + 'name', + 'description', + 'date_format', + 'start', + 'end', + ], + 'orderBy' => [], + 'where' => [], + 'groupBy' => [], + 'join' => [], + 'having' => [], + ], + ], + 'match' => [ + 'name', + ], + ], + ], + [ + 'name' => 'SavedSearch_Settings_Date_Preferences_SearchDisplay_Settings_Date_Preferences', + 'entity' => 'SearchDisplay', + 'cleanup' => 'unused', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'Settings_Date_Preferences', + 'label' => E::ts('Settings - Date Preferences'), + 'saved_search_id.name' => 'Settings_Date_Preferences', + 'type' => 'table', + 'settings' => [ + 'description' => NULL, + 'sort' => [ + [ + 'name', + 'ASC', + ], + ], + 'limit' => 50, + 'pager' => [], + 'placeholder' => 5, + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'name', + 'dataType' => 'String', + 'label' => E::ts('Date Class'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'description', + 'dataType' => 'String', + 'label' => E::ts('Description'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'date_format', + 'dataType' => 'String', + 'label' => E::ts('Date Format'), + 'sortable' => TRUE, + 'rewrite' => '', + 'empty_value' => 'Default', + ], + [ + 'type' => 'field', + 'key' => 'start', + 'dataType' => 'Integer', + 'label' => E::ts('Start Offset'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'end', + 'dataType' => 'Integer', + 'label' => E::ts('End Offset'), + 'sortable' => TRUE, + ], + [ + 'links' => [ + [ + 'entity' => 'PreferencesDate', + 'action' => 'update', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-pencil', + 'text' => '', + 'style' => 'default', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + ], + 'type' => 'links', + 'alignment' => 'text-right', + ], + ], + 'actions' => FALSE, + 'classes' => [ + 'table', + 'table-striped', + ], + ], + ], + 'match' => [ + 'name', + 'saved_search_id', + ], + ], + ], +]; -- 2.25.1