SearchKit - Expose expires_date field to UI
authorcolemanw <coleman@civicrm.org>
Fri, 9 Jun 2023 02:26:02 +0000 (22:26 -0400)
committercolemanw <coleman@civicrm.org>
Fri, 9 Jun 2023 02:26:02 +0000 (22:26 -0400)
ext/search_kit/ang/crmSearchAdmin/searchListing/crmSearchAdminSearchListing.component.js
ext/search_kit/ang/crmSearchAdmin/tabs.html
ext/search_kit/css/crmSearchAdmin.css

index c9b75271f1dc10777b5220eb706a12aca268e635..11d7e0873e4f2557a7e9914829d4c4729a23e6b2 100644 (file)
             'modified_id.display_name',
             'created_date',
             'modified_date',
+            'expires_date',
             'has_base',
             'base_module:label',
             'local_modified_date',
             'DATE(created_date) AS date_created',
             'DATE(modified_date) AS date_modified',
+            'DATE(expires_date) AS expires',
             'GROUP_CONCAT(display.name ORDER BY display.id) AS display_name',
             'GROUP_CONCAT(display.label ORDER BY display.id) AS display_label',
             'GROUP_CONCAT(display.type:icon ORDER BY display.id) AS display_icon',
             })
           );
         }
+        ctrl.display.settings.columns.push(
+          searchMeta.fieldToColumn('expires_date', {
+            label: ts('Expires'),
+            title: '[expires_date]',
+            rewrite: '[expires]'
+          })
+        );
         ctrl.display.settings.columns.push({
           type: 'include',
           alignment: 'text-right',
index 99b12d9f38dd3b710f08a8e70ad8a5db0396ad02..7592b5001e5fdbfec51659c9b5021b1b330e4440 100644 (file)
@@ -1,6 +1,17 @@
 <li>
   <textarea class="form-control" placeholder="{{:: ts('Description (shown above default display)') }}" ng-model="$ctrl.savedSearch.description"></textarea>
 </li>
+<li>
+  <div class="form-inline" title="{{:: ts('Search Expiry Date') }}">
+    <div class="form-group">
+      <label class="sr-only" for="expires_date">{{:: ts('Search Expiry Date') }}</label>
+      <div class="input-group">
+        <div class="input-group-addon"><i class="crm-i fa-calendar-times-o"></i></div>
+        <input id="expires_date" class="form-control" crm-ui-datepicker="{time: true}" ng-model="$ctrl.savedSearch.expires_date" placeholder="Expires">
+      </div>
+    </div>
+  </div>
+</li>
 <li>
   <crm-search-admin-tags tag-ids="$ctrl.savedSearch.tag_id" class="btn-group btn-group-sm"></crm-search-admin-tags>
 </li>
index 89c5391b74bf841503ebf4c29681df679d3ad716..35d439d0b25bc34d67d295c5734798bba23f6943 100644 (file)
   width: 275px;
 }
 
+/* Style expires_date date/time width */
+#bootstrap-theme.crm-search #expires_date + input,
+#bootstrap-theme.crm-search #expires_date + input + input {
+  width: calc(100% - 30px);
+}
+/* Hide time field if date & time are both empty */
+#bootstrap-theme.crm-search #expires_date + input:placeholder-shown + input:placeholder-shown {
+  display: none;
+}
+
 #bootstrap-theme.crm-search div.form-control.disabled,
 #bootstrap-theme.crm-search div.form-control.disabled * {
   cursor: not-allowed;