[12761] | 1 | (function () {
|
---|
| 2 | var module = appMaintenancePlugin.getAngularModule();
|
---|
| 3 | module.controller('app.maintenance.facttaskCtrl',
|
---|
| 4 | ['$scope', '$interval', 'app.maintenance.facttaskService', function ($scope, $interval, facttaskService) {
|
---|
| 5 | $scope.interval = defaultPageUpdateInterval;
|
---|
| 6 | $scope.curJobsPage = 1;
|
---|
| 7 | $scope.jobsPageSize = 20;
|
---|
| 8 |
|
---|
| 9 | $scope.fromDate = new Date();
|
---|
| 10 | $scope.toDate = new Date();
|
---|
| 11 |
|
---|
| 12 | $scope.fromIsOpen = false;
|
---|
| 13 | $scope.toIsOpen = false;
|
---|
| 14 |
|
---|
| 15 | $scope.openFromDateSelection = function ($event) {
|
---|
| 16 | $event.preventDefault();
|
---|
| 17 | $event.stopPropagation();
|
---|
| 18 | $scope.toIsOpen = false;
|
---|
| 19 | $scope.fromIsOpen = true;
|
---|
| 20 | };
|
---|
| 21 |
|
---|
| 22 | $scope.openToDateSelection = function ($event) {
|
---|
| 23 | $event.preventDefault();
|
---|
| 24 | $event.stopPropagation();
|
---|
| 25 | $scope.fromIsOpen = false;
|
---|
| 26 | $scope.toIsOpen = true;
|
---|
| 27 | };
|
---|
| 28 |
|
---|
| 29 | $scope.dateOptions = {
|
---|
| 30 | formatYear: 'yy',
|
---|
| 31 | startingDay: 1
|
---|
| 32 | };
|
---|
| 33 |
|
---|
| 34 | $scope.getJobs = function () {
|
---|
| 35 | facttaskService.getJobs({
|
---|
| 36 | start: ConvertFromDate($scope.fromDate),
|
---|
| 37 | end: ConvertToDate($scope.toDate),
|
---|
| 38 | page: $scope.curJobsPage,
|
---|
| 39 | size: $scope.jobsPageSize
|
---|
| 40 | },
|
---|
| 41 | function (jobPage) {
|
---|
| 42 | $scope.jobPage = jobPage;
|
---|
| 43 | });
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | $scope.aggregateJob = function (id) {
|
---|
| 47 | facttaskService.aggregateJob({ id: id }, function () {
|
---|
| 48 | $scope.getJobs();
|
---|
| 49 | });
|
---|
| 50 | };
|
---|
| 51 |
|
---|
| 52 | $scope.aggregateAllJobs = function () {
|
---|
| 53 | facttaskService.aggregateAllJobs({
|
---|
| 54 | start: ConvertFromDate($scope.fromDate),
|
---|
| 55 | end: ConvertToDate($scope.toDate)
|
---|
| 56 | },
|
---|
| 57 | function () {
|
---|
| 58 | $scope.getJobs();
|
---|
| 59 | });
|
---|
| 60 | };
|
---|
| 61 |
|
---|
| 62 | $scope.changeJobsPage = function () {
|
---|
| 63 | $scope.getJobs();
|
---|
| 64 | };
|
---|
| 65 |
|
---|
| 66 | $scope.getJobs(); // init page
|
---|
| 67 | }]
|
---|
| 68 | );
|
---|
| 69 | })(); |
---|