<div>[% l('Selected Paid:') %]</div>
<div>{{totals.selected_paid() | currency}}</div>
<div class="flex-cell"></div>
+ <div><button class="btn btn-default" ng-click="actions.apply_date_range()">[% l('Apply') %]</button></div>
<div>[% l('Start Date:') %]</div>
<div><input eg-date-input class="form-control" ng-model="dates.xact_start"/></div>
<div>[% l('End Date:') %]</div>
$scope.bill_tab = $routeParams.history_tab;
$scope.totals = {};
+ // link page controller actions defined by sub-controllers here
+ $scope.actions = {};
+
var start = new Date(); // now - 1 year
start.setFullYear(start.getFullYear() - 1),
$scope.dates = {
['$scope','$q','egCore','patronSvc','billSvc','egPromptDialog','$location','egBilling',
function($scope, $q , egCore , patronSvc , billSvc , egPromptDialog , $location , egBilling) {
+ // generate a grid query with the current date widget values.
+ function current_grid_query() {
+ return {
+ '-or' : [
+ {'summary.balance_owed' : {'<>' : 0}},
+ {'summary.last_payment_ts' : {'<>' : null}}
+ ],
+ xact_start : {between : $scope.date_range()},
+ usr : billSvc.userId
+ }
+ }
+
$scope.gridControls = {
selectedItems : function(){return []},
activateItem : function(item) {
$scope.showFullDetails([item]);
},
- setQuery : function() {
- // open-ils.actor.user.transactions.history.have_bill_or_payment
- return {
- '-or' : [
- {'summary.balance_owed' : {'<>' : 0}},
- {'summary.last_payment_ts' : {'<>' : null}}
- ],
- xact_start : {between : $scope.date_range()},
- usr : billSvc.userId
- }
- }
+ // this sets the query on page load
+ setQuery : current_grid_query
}
+ $scope.actions.apply_date_range = function() {
+ // tells the grid to re-draw itself with the new query
+ $scope.gridControls.setQuery(current_grid_query());
+ }
// TODO; move me to service
function selected_payment_info() {