Improve date field query triggers

Don't submit the request if the user is part-way through typing something in the date field and the date is (currently) invalid; this results in the date ranges being broken and triggering a query for *all* results (with no date range).
This commit is contained in:
Matt-Yorkley
2020-03-28 11:16:25 +01:00
parent 940423acfc
commit b76a6d15a3

View File

@@ -29,6 +29,8 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
formatted_start_date = moment($scope.startDate).format()
formatted_end_date = moment($scope.endDate).add(1,'day').format()
return unless moment(formatted_start_date).isValid() and moment(formatted_start_date).isValid()
RequestMonitor.load $scope.orders = Orders.index(
"q[state_not_eq]": "canceled",
"q[completed_at_not_null]": "true",