accountant-ui/src/scheduler/index.ts

82 lines
2.3 KiB
TypeScript
Raw Normal View History

2016-10-09 20:17:11 +02:00
// vim: set tw=80 ts=4 sw=4 sts=4:
2016-04-12 10:55:08 +02:00
/*
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/>.
*/
2017-06-10 18:02:19 +02:00
/* jshint node: true */
2016-04-12 10:55:08 +02:00
'use strict';
2017-06-10 18:02:19 +02:00
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';
2017-07-23 07:44:31 +02:00
var ngStrap = require('angular-strap');
import uiRouter from '@uirouter/angularjs';
2017-06-10 18:02:19 +02:00
var schedulerTmpl = require('./scheduler.html');
2017-07-23 07:44:03 +02:00
import { ScheduleComponent } from './schedule.component';
import { ScheduleService } from './schedule.service';
2017-07-11 18:51:01 +02:00
export default angular.module('accountant.scheduler', [
uiRouter,
2017-06-10 18:02:19 +02:00
ngStrap
2016-04-12 10:55:08 +02:00
])
.factory('toastrService', downgradeInjectable(ToastrService))
.factory('ngbModal', downgradeInjectable(NgbModal))
.factory('logger', downgradeInjectable(Logger))
2016-04-12 10:55:08 +02:00
.factory('accountIdService', function() {
var accountId: null;
return {
get: () => {
return accountId;
},
set: (value) => {
accountId = value;
}
}
})
.factory('scheduleService', downgradeInjectable(ScheduleService))
.component('scheduleComponent', {
bindings: {
2017-07-23 07:58:41 +02:00
accountId: '<',
$modal: '<'
},
templateUrl: schedulerTmpl,
2017-07-23 07:44:03 +02:00
controller: ScheduleComponent,
controllerAs: 'schedulerCtrl'
})
2017-07-05 21:48:20 +02:00
.run(function($transitions, accountIdService) {
$transitions.onSuccess({}, (transition) => {
accountIdService.set(transition.params().accountId);
});
})
.name;