Replace load arguments by controller variables, in order to link them to input controls later.
This commit is contained in:
parent
a32b344b2c
commit
66a19034dd
@ -60,6 +60,9 @@ var operationModule = angular.module('accountant.operations', [
|
||||
|
||||
var vm = this;
|
||||
|
||||
vm.minDate = moment().date(1).month(11).year(2016);
|
||||
vm.maxDate = moment();
|
||||
|
||||
/*
|
||||
* Add an empty operation.
|
||||
*/
|
||||
@ -75,12 +78,12 @@ var operationModule = angular.module('accountant.operations', [
|
||||
/*
|
||||
* Load operations.
|
||||
*/
|
||||
vm.load = function(begin, end) {
|
||||
vm.load = function() {
|
||||
return Operation.query({
|
||||
// eslint-disable-next-line camelcase
|
||||
account_id: $routeParams.accountId,
|
||||
begin: begin.format('YYYY-MM-DD'),
|
||||
end: end.format('YYYY-MM-DD')
|
||||
begin: vm.minDate.format('YYYY-MM-DD'),
|
||||
end: vm.maxDate.format('YYYY-MM-DD')
|
||||
});
|
||||
};
|
||||
|
||||
@ -111,7 +114,7 @@ var operationModule = angular.module('accountant.operations', [
|
||||
return operation.$save().then(function(operation) {
|
||||
Notification.success('Operation #' + operation.id + ' saved.');
|
||||
|
||||
vm.operations = vm.load(moment().date(1).year(2000), moment());
|
||||
vm.operations = vm.load();
|
||||
|
||||
return operation;
|
||||
}, function(result){
|
||||
@ -142,7 +145,7 @@ var operationModule = angular.module('accountant.operations', [
|
||||
return operation.$delete().then(function() {
|
||||
Notification.success('Operation #' + id + ' deleted.');
|
||||
|
||||
vm.operations = vm.load(moment().date(1).year(2000), moment());
|
||||
vm.operations = vm.load();
|
||||
|
||||
return operation;
|
||||
}, function(result) {
|
||||
@ -188,7 +191,7 @@ var operationModule = angular.module('accountant.operations', [
|
||||
vm.onRangeSelected = angular.noop;
|
||||
});
|
||||
|
||||
vm.operations = vm.load(moment().date(1).year(2000), moment());
|
||||
vm.operations = vm.load();
|
||||
})
|
||||
|
||||
.component('operationModifyModalComponent', {
|
||||
|
Loading…
Reference in New Issue
Block a user