[12761] | 1 | (function () {
|
---|
| 2 | var module = appMaintenancePlugin.getAngularModule();
|
---|
| 3 | module.controller('app.maintenance.factclientinfoCtrl',
|
---|
| 4 | ['$scope', '$interval', 'app.maintenance.factclientinfoService', function ($scope, $interval, factclientinfoService) {
|
---|
| 5 | $scope.interval = defaultPageUpdateInterval;
|
---|
| 6 | $scope.entries = 2;
|
---|
| 7 |
|
---|
| 8 | $scope.fromDate = new Date();
|
---|
| 9 | $scope.toDate = new Date();
|
---|
| 10 |
|
---|
| 11 | $scope.fromIsOpen = false;
|
---|
| 12 | $scope.toIsOpen = false;
|
---|
| 13 |
|
---|
| 14 | $scope.openFromDateSelection = function ($event) {
|
---|
| 15 | $event.preventDefault();
|
---|
| 16 | $event.stopPropagation();
|
---|
| 17 | $scope.toIsOpen = false;
|
---|
| 18 | $scope.fromIsOpen = true;
|
---|
| 19 | };
|
---|
| 20 |
|
---|
| 21 | $scope.openToDateSelection = function ($event) {
|
---|
| 22 | $event.preventDefault();
|
---|
| 23 | $event.stopPropagation();
|
---|
| 24 | $scope.fromIsOpen = false;
|
---|
| 25 | $scope.toIsOpen = true;
|
---|
| 26 | };
|
---|
| 27 |
|
---|
| 28 | $scope.dateOptions = {
|
---|
| 29 | formatYear: 'yy',
|
---|
| 30 | startingDay: 1
|
---|
| 31 | };
|
---|
| 32 |
|
---|
| 33 | $scope.getFactClientInfo = function () {
|
---|
| 34 | factclientinfoService.getFactClientInfo({
|
---|
| 35 | start: ConvertFromDate($scope.fromDate),
|
---|
| 36 | end: ConvertToDate($scope.toDate)
|
---|
| 37 | },
|
---|
| 38 | function (factClientInfo) {
|
---|
| 39 | $scope.factClientInfo = factClientInfo;
|
---|
| 40 | $scope.aggregateStartDate = ConvertFromDate($scope.fromDate);
|
---|
| 41 | $scope.aggregateEndDate = ConvertToDate($scope.toDate);
|
---|
| 42 | });
|
---|
| 43 | };
|
---|
| 44 |
|
---|
| 45 | $scope.aggregate = function () {
|
---|
| 46 | factclientinfoService.aggregate({
|
---|
| 47 | start: $scope.aggregateStartDate,
|
---|
| 48 | end: $scope.aggregateEndDate,
|
---|
| 49 | entries: $scope.entries
|
---|
| 50 | }, function () {
|
---|
| 51 | $scope.getFactClientInfo();
|
---|
| 52 | });
|
---|
| 53 | };
|
---|
| 54 |
|
---|
| 55 | $scope.getFactClientInfo(); // init page
|
---|
| 56 | }]
|
---|
| 57 | );
|
---|
| 58 | })(); |
---|