Added Export Mapping search kit UI
authorPradeep Nayak <pradpnayak@gmail.com>
Tue, 5 Dec 2023 14:32:46 +0000 (14:32 +0000)
committerPradeep Nayak <pradpnayak@gmail.com>
Tue, 5 Dec 2023 16:28:03 +0000 (16:28 +0000)
ext/civicrm_admin_ui/ang/afsearchImportExportMappings.aff.html [new file with mode: 0644]
ext/civicrm_admin_ui/ang/afsearchImportExportMappings.aff.php [new file with mode: 0644]
ext/civicrm_admin_ui/managed/SavedSearch_Import_Export_Mappings.mgd.php [new file with mode: 0644]

diff --git a/ext/civicrm_admin_ui/ang/afsearchImportExportMappings.aff.html b/ext/civicrm_admin_ui/ang/afsearchImportExportMappings.aff.html
new file mode 100644 (file)
index 0000000..49829fc
--- /dev/null
@@ -0,0 +1,7 @@
+<div class="af-markup">
+  <div class="help">{{:: ts('Saved mappings allow you to easily run the same import or export job multiple times. Mappings are created and updated as part of an Import or Export task. This screen allows you to rename or delete existing mappings.') }}</div>
+
+</div>
+<div af-fieldset="">
+  <crm-search-display-table search-name="Import_Export_Mappings" display-name="Import_Export_Mappings"></crm-search-display-table>
+</div>
diff --git a/ext/civicrm_admin_ui/ang/afsearchImportExportMappings.aff.php b/ext/civicrm_admin_ui/ang/afsearchImportExportMappings.aff.php
new file mode 100644 (file)
index 0000000..602fb02
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+use CRM_CivicrmAdminUi_ExtensionUtil as E;
+
+return [
+  'title' => E::ts('Import/Export Mappings'),
+  'permission' => [
+    'administer CiviCRM',
+  ],
+  'type' => 'search',
+  'icon' => 'fa-list-alt',
+  'server_route' => 'civicrm/admin/mapping',
+  'permission_operator' => 'AND',
+];
diff --git a/ext/civicrm_admin_ui/managed/SavedSearch_Import_Export_Mappings.mgd.php b/ext/civicrm_admin_ui/managed/SavedSearch_Import_Export_Mappings.mgd.php
new file mode 100644 (file)
index 0000000..df915b5
--- /dev/null
@@ -0,0 +1,149 @@
+<?php
+use CRM_CivicrmAdminUi_ExtensionUtil as E;
+
+return [
+  [
+    'name' => 'SavedSearch_Import_Export_Mappings',
+    'entity' => 'SavedSearch',
+    'cleanup' => 'unused',
+    'update' => 'unmodified',
+    'params' => [
+      'version' => 4,
+      'values' => [
+        'name' => 'Import_Export_Mappings',
+        'label' => E::ts('Import/Export Mappings'),
+        'api_entity' => 'Mapping',
+        'api_params' => [
+          'version' => 4,
+          'select' => [
+            'name',
+            'description',
+            'mapping_type_id:label',
+            'id',
+          ],
+          'orderBy' => [],
+          'where' => [
+            [
+              'mapping_type_id:name',
+              '!=',
+              'Search Builder',
+            ],
+          ],
+          'groupBy' => [],
+          'join' => [],
+          'having' => [],
+        ],
+      ],
+      'match' => [
+        'name',
+      ],
+    ],
+  ],
+  [
+    'name' => 'SavedSearch_Import_Export_Mappings_SearchDisplay_Import_Export_Mappings',
+    'entity' => 'SearchDisplay',
+    'cleanup' => 'unused',
+    'update' => 'unmodified',
+    'params' => [
+      'version' => 4,
+      'values' => [
+        'name' => 'Import_Export_Mappings',
+        'label' => E::ts('Import/Export Mappings'),
+        'saved_search_id.name' => 'Import_Export_Mappings',
+        'type' => 'table',
+        'settings' => [
+          'description' => NULL,
+          'sort' => [
+            [
+              'mapping_type_id:label',
+              'ASC',
+            ],
+            [
+              'name',
+              'ASC',
+            ],
+          ],
+          'limit' => 50,
+          'pager' => [],
+          'placeholder' => 5,
+          'columns' => [
+            [
+              'type' => 'field',
+              'key' => 'id',
+              'dataType' => 'Integer',
+              'label' => E::ts('ID'),
+              'sortable' => TRUE,
+            ],
+            [
+              'type' => 'field',
+              'key' => 'name',
+              'dataType' => 'String',
+              'label' => E::ts('Name'),
+              'sortable' => TRUE,
+            ],
+            [
+              'type' => 'field',
+              'key' => 'mapping_type_id:label',
+              'dataType' => 'Integer',
+              'label' => E::ts('Mapping Type'),
+              'sortable' => TRUE,
+            ],
+            [
+              'type' => 'field',
+              'key' => 'description',
+              'dataType' => 'String',
+              'label' => E::ts('Description'),
+              'sortable' => TRUE,
+            ],
+            [
+              'text' => '',
+              'style' => 'default',
+              'size' => 'btn-xs',
+              'icon' => 'fa-bars',
+              'links' => [
+                [
+                  'path' => 'civicrm/admin/mapping?action=update&reset=1&id=[id]',
+                  'icon' => 'fa-external-link',
+                  'text' => E::ts('Edit'),
+                  'style' => 'default',
+                  'condition' => [],
+                  'task' => '',
+                  'entity' => '',
+                  'action' => '',
+                  'join' => '',
+                  'target' => 'crm-popup',
+                ],
+                [
+                  'task' => 'delete',
+                  'entity' => 'Mapping',
+                  'join' => '',
+                  'target' => 'crm-popup',
+                  'icon' => 'fa-trash',
+                  'text' => E::ts('Delete'),
+                  'style' => 'danger',
+                  'path' => '',
+                  'action' => '',
+                  'condition' => [],
+                ],
+              ],
+              'type' => 'menu',
+              'alignment' => 'text-right',
+            ],
+          ],
+          'actions' => [
+            'delete',
+            'update',
+          ],
+          'classes' => [
+            'table',
+            'table-striped',
+          ],
+        ],
+      ],
+      'match' => [
+        'name',
+        'saved_search_id',
+      ],
+    ],
+  ],
+];