Files
brewman/brewman/static/scripts/net-transactions.js
T
Amritanshu f667481d71 Chore: Major variable renaming from python style underscores to camel case.
Chore: Replace undefined checks with angular.isUndefined
2014-06-06 16:09:32 +05:30

24 lines
989 B
JavaScript

'use strict';
var NetTransactionsCtrl = ['$scope', '$location', 'asDateFilter', 'net_transactions', function ($scope, $location, asDate, net_transactions) {
$scope.info = net_transactions;
$scope.show = function () {
var startDate = asDate($scope.info.StartDate),
finishDate = asDate($scope.info.FinishDate);
$location.path('/NetTransactions').search({StartDate: startDate, FinishDate: finishDate});
};
$('#txtStartDate').focus();
}];
NetTransactionsCtrl.resolve = {
net_transactions: ['$route', 'NetTransactions', function ($route, NetTransactions) {
var startDate = $route.current.params.StartDate,
finishDate = $route.current.params.FinishDate;
if (angular.isUndefined(startDate) || angular.isUndefined(finishDate)) {
return NetTransactions.get({}).$promise;
} else {
return NetTransactions.get({StartDate: startDate, FinishDate: finishDate}).$promise;
}
}]
};