mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Add a clear filters button
- This button clear all stored filters and then update results
This commit is contained in:
@@ -30,6 +30,11 @@ angular.module("admin.orders").controller "ordersCtrl", ($scope, $timeout, Reque
|
||||
completed_at_not_null: true
|
||||
}
|
||||
|
||||
$scope.clearFilters = () ->
|
||||
QueryPersistence.clearFilters()
|
||||
$scope.setDefaults()
|
||||
$scope.fetchResults()
|
||||
|
||||
$scope.fetchResults = (page=1) ->
|
||||
startDateWithTime = $scope.appendStringIfNotEmpty($scope.q?.completed_at_gteq, ' 00:00:00')
|
||||
endDateWithTime = $scope.appendStringIfNotEmpty($scope.q?.completed_at_lteq, ' 23:59:59')
|
||||
|
||||
@@ -25,3 +25,6 @@ angular.module("admin.indexUtils").factory 'QueryPersistence', (localStorageServ
|
||||
return true
|
||||
|
||||
false
|
||||
|
||||
clearFilters: () ->
|
||||
localStorageService.remove(@storageKey)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#table-filter {
|
||||
|
||||
.field {
|
||||
input[type="text"], input[type="phone"],
|
||||
input[type="email"], input[type="number"],
|
||||
@@ -9,6 +8,9 @@
|
||||
}
|
||||
|
||||
.actions {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
column-gap: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@
|
||||
{class: "select2 fullwidth", multiple: true, 'ng-model' => 'q.order_cycle_id_in'})
|
||||
.clearfix
|
||||
.actions.filter-actions
|
||||
%div
|
||||
%a.button.icon-search{'ng-click' => 'fetchResults()'}
|
||||
= t(:filter_results)
|
||||
%a.button.icon-search{'ng-click' => 'fetchResults()'}
|
||||
= t(:filter_results)
|
||||
%a.button{'ng-click' => 'clearFilters()', "id": "clear_filters_button"}
|
||||
= t(:clear_filters)
|
||||
|
||||
|
||||
@@ -330,6 +330,7 @@ en:
|
||||
no_pending_payments: "No pending payments"
|
||||
invalid_payment_state: "Invalid payment state: %{state}"
|
||||
filter_results: Filter Results
|
||||
clear_filters: Clear filters
|
||||
quantity: Quantity
|
||||
pick_up: Pick up
|
||||
ok: Ok
|
||||
|
||||
Reference in New Issue
Block a user