Label formats v2
authorAidan Saunders <aidan.saunders@squiffle.uk>
Thu, 7 Dec 2023 23:01:36 +0000 (23:01 +0000)
committerAidan Saunders <aidan.saunders@squiffle.uk>
Thu, 7 Dec 2023 23:20:00 +0000 (23:20 +0000)
ext/civicrm_admin_ui/ang/afsearchLabelFormat.aff.html [deleted file]
ext/civicrm_admin_ui/ang/afsearchLabelFormats.aff.html [new file with mode: 0644]
ext/civicrm_admin_ui/ang/afsearchLabelFormats.aff.php [moved from ext/civicrm_admin_ui/ang/afsearchLabelFormat.aff.php with 74% similarity]
ext/civicrm_admin_ui/managed/SavedSearch_Label_Formats.mgd.php [moved from ext/civicrm_admin_ui/managed/SavedSearch_label_format.mgd.php with 62% similarity]

diff --git a/ext/civicrm_admin_ui/ang/afsearchLabelFormat.aff.html b/ext/civicrm_admin_ui/ang/afsearchLabelFormat.aff.html
deleted file mode 100644 (file)
index e66ad29..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<div af-fieldset="">
-  <div class="af-markup">
-    
-    
-    <div class="help">
-    <div>{{:: ts('You can configure one or more Label Formats for your CiviCRM installation. Label Formats are used when creating mailing labels.')}}<br/>
-{{:: ts('You can change which fields are printed on each label in')}} <a href="/civicrm/admin/setting/preferences/address?reset=1">{{:: ts('Address Settings')}}</a>.</div>
-    </div>
-
-  
-  
-  </div>
-  <crm-search-display-table search-name="label_format" display-name="label_format_Table_1"></crm-search-display-table>
-</div>
diff --git a/ext/civicrm_admin_ui/ang/afsearchLabelFormats.aff.html b/ext/civicrm_admin_ui/ang/afsearchLabelFormats.aff.html
new file mode 100644 (file)
index 0000000..ddccba5
--- /dev/null
@@ -0,0 +1,20 @@
+<div class="help">
+  
+  <div>{{:: ts('You can configure one or more Label Formats for your CiviCRM installation. Label Formats are used when creating mailing labels.')}}<br/>
+{{:: ts('You can change which fields are printed on each label in')}} <a href="/civicrm/admin/setting/preferences/address?reset=1">{{:: ts('Address Settings')}}</a>.</div>
+
+</div>
+<div crm-ui-tab-set="">
+  
+  <div af-fieldset="" crm-ui-tab="" crm-title="ts('Mailing Labels')" id="tab-mailinglabels">
+    <div class="af-markup">
+      <crm-search-display-table search-name="Label_Formats" display-name="Label_Formats_Table_1" filters="{'option_group_id:name': 'label_format'}"/>
+    </div> 
+  </div>
+  <div af-fieldset="" crm-ui-tab="" crm-title="ts('Name Badge')" id="tab-namebadge">
+    <div class="af-markup">
+      <crm-search-display-table search-name="Label_Formats" display-name="Label_Formats_Table_1" filters="{'option_group_id:name': 'name_badge'}"/>
+    </div> 
+  </div>
+
+</div>
similarity index 74%
rename from ext/civicrm_admin_ui/ang/afsearchLabelFormat.aff.php
rename to ext/civicrm_admin_ui/ang/afsearchLabelFormats.aff.php
index d0d3f0d4981acf80f51b5912a0071993d7e3afd2..fda5b7c984d93e61f62da44fddd06688e35989b1 100644 (file)
@@ -4,11 +4,10 @@ use CRM_CivicrmAdminUi_ExtensionUtil as E;
 return [
   'type' => 'search',
   'title' => E::ts('Label Formats'),
-  'description' => E::ts('Label Formats'),
   'icon' => 'fa-list-alt',
   'server_route' => 'civicrm/admin/labelFormats',
   'permission' => [
     'administer CiviCRM',
   ],
-  'modified_date' => '2023-12-06 18:52:54',
+  'modified_date' => '2023-12-07 22:54:39',
 ];
similarity index 62%
rename from ext/civicrm_admin_ui/managed/SavedSearch_label_format.mgd.php
rename to ext/civicrm_admin_ui/managed/SavedSearch_Label_Formats.mgd.php
index 406f8750c5c17a468f526cda05f32782beb747c1..755a9b3c9fd7269e2e7a45f93dc6585eba8db124 100644 (file)
@@ -3,30 +3,29 @@ use CRM_CivicrmAdminUi_ExtensionUtil as E;
 
 return [
   [
-    'name' => 'SavedSearch_label_format',
+    'name' => 'SavedSearch_Label_Formats',
     'entity' => 'SavedSearch',
     'cleanup' => 'unused',
     'update' => 'unmodified',
     'params' => [
       'version' => 4,
       'values' => [
-        'name' => 'label_format',
-        'label' => E::ts('Label Format'),
-        'api_entity' => 'OptionGroup',
+        'name' => 'Label_Formats',
+        'label' => E::ts('Label Formats'),
+        'api_entity' => 'OptionValue',
         'api_params' => [
           'version' => 4,
           'select' => [
-            'OptionGroup_OptionValue_option_group_id_01.label',
-            'title',
-            'description',
-            'OptionGroup_OptionValue_option_group_id_01.is_reserved',
-            'OptionGroup_OptionValue_option_group_id_01.grouping',
-            'OptionGroup_OptionValue_option_group_id_01.is_default',
+            'label',
+            'option_group_id:label',
+            'grouping',
+            'is_default',
+            'is_reserved',
           ],
           'orderBy' => [],
           'where' => [
             [
-              'name',
+              'option_group_id:name',
               'IN',
               [
                 'label_format',
@@ -35,17 +34,7 @@ return [
             ],
           ],
           'groupBy' => [],
-          'join' => [
-            [
-              'OptionValue AS OptionGroup_OptionValue_option_group_id_01',
-              'LEFT',
-              [
-                'id',
-                '=',
-                'OptionGroup_OptionValue_option_group_id_01.option_group_id',
-              ],
-            ],
-          ],
+          'join' => [],
           'having' => [],
         ],
       ],
@@ -55,52 +44,43 @@ return [
     ],
   ],
   [
-    'name' => 'SavedSearch_label_format_SearchDisplay_label_format_Table_1',
+    'name' => 'SavedSearch_Label_Formats_SearchDisplay_Label_Formats_Table_1',
     'entity' => 'SearchDisplay',
     'cleanup' => 'unused',
     'update' => 'unmodified',
     'params' => [
       'version' => 4,
       'values' => [
-        'name' => 'label_format_Table_1',
-        'label' => E::ts('Label Format Table 1'),
-        'saved_search_id.name' => 'label_format',
+        'name' => 'Label_Formats_Table_1',
+        'label' => E::ts('Label Formats Table 1'),
+        'saved_search_id.name' => 'Label_Formats',
         'type' => 'table',
         'settings' => [
-          'description' => '',
+          'description' => NULL,
           'sort' => [],
           'limit' => 50,
           'pager' => [
-            'show_count' => FALSE,
-            'expose_limit' => FALSE,
             'hide_single' => TRUE,
           ],
           'placeholder' => 5,
           'columns' => [
             [
               'type' => 'field',
-              'key' => 'OptionGroup_OptionValue_option_group_id_01.label',
+              'key' => 'label',
               'dataType' => 'String',
               'label' => E::ts('Name'),
               'sortable' => TRUE,
             ],
             [
               'type' => 'field',
-              'key' => 'title',
-              'dataType' => 'String',
-              'label' => E::ts('Used for'),
-              'sortable' => TRUE,
-            ],
-            [
-              'type' => 'field',
-              'key' => 'OptionGroup_OptionValue_option_group_id_01.grouping',
+              'key' => 'grouping',
               'dataType' => 'String',
               'label' => E::ts('Grouping'),
               'sortable' => TRUE,
             ],
             [
               'type' => 'field',
-              'key' => 'OptionGroup_OptionValue_option_group_id_01.is_default',
+              'key' => 'is_default',
               'dataType' => 'Boolean',
               'label' => E::ts('Default'),
               'sortable' => TRUE,
@@ -110,7 +90,7 @@ return [
                   'icon' => 'fa-check',
                   'side' => 'left',
                   'if' => [
-                    'OptionGroup_OptionValue_option_group_id_01.is_default',
+                    'is_default',
                     '=',
                     TRUE,
                   ],
@@ -119,9 +99,9 @@ return [
             ],
             [
               'type' => 'field',
-              'key' => 'OptionGroup_OptionValue_option_group_id_01.is_reserved',
+              'key' => 'is_reserved',
               'dataType' => 'Boolean',
-              'label' => E::ts('Reserved'),
+              'label' => E::ts('Reserved?'),
               'sortable' => TRUE,
             ],
             [
@@ -138,37 +118,37 @@ return [
                   'icon' => 'fa-pencil',
                   'text' => E::ts('Edit'),
                   'style' => 'default',
-                  'path' => 'civicrm/admin/labelFormats/edit?action=update&id=[OptionGroup_OptionValue_option_group_id_01.id]&group=[name]&reset=1',
+                  'path' => 'civicrm/admin/labelFormats/edit?action=update&id=[id]&group=[option_group_id:name]&reset=1',
                   'task' => '',
                   'condition' => [],
                 ],
                 [
-                  'path' => 'civicrm/admin/labelFormats/edit?action=copy&id=[OptionGroup_OptionValue_option_group_id_01.id]&group=[name]&reset=1',
-                  'icon' => 'fa-clone',
-                  'text' => E::ts('Copy'),
-                  'style' => 'default',
-                  'condition' => [],
-                  'task' => '',
                   'entity' => '',
                   'action' => '',
                   'join' => '',
                   'target' => 'crm-popup',
+                  'icon' => 'fa-clone',
+                  'text' => E::ts('Copy'),
+                  'style' => 'default',
+                  'path' => 'civicrm/admin/labelFormats/edit?action=copy&id=[id]&group=[option_group_id:name]&reset=1',
+                  'task' => '',
+                  'condition' => [],
                 ],
                 [
-                  'entity' => 'OptionValue',
-                  'action' => 'delete',
-                  'join' => 'OptionGroup_OptionValue_option_group_id_01',
-                  'target' => 'crm-popup',
-                  'icon' => 'fa-trash',
+                  'path' => 'civicrm/admin/labelFormats/edit?action=delete&id=[id]&group=[option_group_id:name]&reset=1',
+                  'icon' => 'fa-trash-o',
                   'text' => E::ts('Delete'),
                   'style' => 'danger',
-                  'path' => '',
-                  'task' => '',
                   'condition' => [
-                    'OptionGroup_OptionValue_option_group_id_01.is_reserved',
+                    'is_reserved',
                     '=',
                     FALSE,
                   ],
+                  'task' => '',
+                  'entity' => '',
+                  'action' => '',
+                  'join' => '',
+                  'target' => 'crm-popup',
                 ],
               ],
               'type' => 'menu',
@@ -180,21 +160,21 @@ return [
             'table',
             'table-striped',
           ],
+          'draggable' => 'weight',
           'toolbar' => [
             [
-              'action' => '',
-              'entity' => '',
-              'text' => E::ts('Add Label Format'),
-              'icon' => '',
+              'path' => 'civicrm/admin/labelFormats/edit?action=add&id=[id]&group=[option_group_id:name]&reset=1',
+              'icon' => 'fa-plus',
+              'text' => E::ts('Add'),
               'style' => 'default',
-              'target' => 'crm-popup',
-              'join' => '',
-              'path' => 'civicrm/admin/labelFormats/edit?action=add&reset=1',
-              'task' => '',
               'condition' => [],
+              'task' => '',
+              'entity' => '',
+              'action' => '',
+              'join' => '',
+              'target' => 'crm-popup',
             ],
           ],
-          'headerCount' => FALSE,
         ],
       ],
       'match' => [