accountant-ui/src/scheduler/index.ts
2017-07-25 12:04:45 +02:00

76 lines
2.2 KiB
TypeScript

// vim: set tw=80 ts=4 sw=4 sts=4:
/*
This file is part of Accountant.
Accountant is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Accountant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Accountant. If not, see <http://www.gnu.org/licenses/>.
*/
/* jshint node: true */
'use strict';
var angular = require('angular');
import {
downgradeInjectable,
downgradeComponent
} from '@angular/upgrade/static';
import { Logger } from '@nsalaun/ng-logger';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrService } from 'ngx-toastr';
var ngStrap = require('angular-strap');
import uiRouter from '@uirouter/angularjs';
var schedulerTmpl = require('./scheduler.html');
import { ScheduleComponent } from './schedule.component';
import { ScheduleService } from './schedule.service';
export default angular.module('accountant.scheduler', [
uiRouter,
ngStrap
])
.factory('toastrService', downgradeInjectable(ToastrService))
.factory('ngbModal', downgradeInjectable(NgbModal))
.factory('logger', downgradeInjectable(Logger))
.factory('accountIdService', function() {
var accountId: null;
return {
get: () => {
return accountId;
},
set: (value) => {
accountId = value;
}
}
})
.factory('scheduleService', downgradeInjectable(ScheduleService))
.directive('scheduleComponent', downgradeComponent({
component: ScheduleComponent
}))
.run(function($transitions, accountIdService) {
$transitions.onSuccess({}, (transition) => {
accountIdService.set(transition.params().accountId);
});
})
.name;