31 lines
930 B
JavaScript
31 lines
930 B
JavaScript
'use strict';
|
|
|
|
var BalanceSheetCtrl = ['$scope', '$location', 'dateFilter', 'info', function ($scope, $location, dateFilter, info) {
|
|
$scope.info = info;
|
|
$scope.show = function () {
|
|
if (angular.isDate($scope.info.Date)) {
|
|
$scope.info.Date = dateFilter($scope.info.Date, 'dd-MMM-yyyy');
|
|
}
|
|
$location.path('/BalanceSheet/' + $scope.info.Date);
|
|
};
|
|
$('#txtStartDate').focus();
|
|
}];
|
|
|
|
BalanceSheetCtrl.resolve = {
|
|
info: ['$q', '$route', 'BalanceSheet', function ($q, $route, BalanceSheet) {
|
|
var deferred = $q.defer();
|
|
|
|
var date = $route.current.params.date;
|
|
|
|
var successCb = function (result) {
|
|
deferred.resolve(result);
|
|
};
|
|
|
|
if (typeof date === 'undefined') {
|
|
BalanceSheet.get({}, successCb);
|
|
} else {
|
|
BalanceSheet.get({date:date}, successCb);
|
|
}
|
|
return deferred.promise;
|
|
}]
|
|
}; |