"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
// Angular-Typen
var core_1 = require("@angular/core");
var platform_browser_1 = require("@angular/platform-browser");
var router_1 = require("@angular/router");
var core_2 = require("@angular/core");
var FlugService_1 = require("../Services/FlugService");
var FlugEdit = /** @class */ (function () {
    function FlugEdit(flugService, route, titleService) {
        this.flugService = flugService;
        this.route = route;
        this.titleService = titleService;
        this.orte = ['Rom', 'Paris', 'Berlin', 'Oslo'];
        console.log("Konstruktor!!!");
    }
    FlugEdit.prototype.ngOnInit = function () {
        var _this = this;
        this.route.params.forEach(function (params) {
            var id = +params['id'];
            if (!id)
                id = 101; // nur zum Test
            _this.flug = _this.flugService.getByID(id);
            _this.titleService.setTitle("Edit " + id);
        });
    };
    FlugEdit.prototype.ngOnChanges = function (changes) {
        console.log(changes);
    };
    FlugEdit.prototype.tasteGedrueckt = function (event) {
        console.log(event, event.keyCode, event.keyIdentifier);
    };
    FlugEdit.prototype.reset = function () {
        this.flug.Abflugort = "Rom";
        this.flug.Zielort = "Berlin";
        this.status = "zurückgesetzt";
        // alert("Werte zurückgesetzt");
    };
    FlugEdit.prototype.save = function () {
        this.status = "gespeichert";
        console.log(this.flug);
        console.log(this.flugService.getByID(this.flug.FlugNr));
        // alert("gespeichert!");
        // alert("Werte zurückgesetzt!");
    };
    Object.defineProperty(FlugEdit.prototype, "getstring", {
        get: function () { return this.status; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(FlugEdit.prototype, "getJson", {
        get: function () { return JSON.stringify(this.flug); },
        enumerable: true,
        configurable: true
    });
    FlugEdit = __decorate([
        core_1.Component({
            selector: 'FlugEdit',
            templateUrl: '/app/FlugEdit/FlugEdit.html',
            styleUrls: ['app/FlugEdit/FlugEdit.css'],
            providers: [FlugService_1.FlugService],
            host: {
                '[@routeAnimation]': "true"
            },
            animations: [
                core_2.trigger('routeAnimation', [
                    core_2.state('*', core_2.style({ transform: 'translateX(0)', opacity: 100 })),
                    core_2.transition('void => *', [
                        core_2.style({ transform: 'translateX(-100%)', opacity: 0 }),
                        core_2.animate('4.5s cubic-bezier(0.215, 0.610, 0.355, 1.000)')
                    ]),
                    core_2.transition('* => void', core_2.animate('4.5s cubic-bezier(0.215, 0.610, 0.355, 1.000)', core_2.style({
                        transform: 'translateX(100%)',
                        opacity: 0
                    })))
                ])
            ]
        }),
        __metadata("design:paramtypes", [FlugService_1.FlugService,
            router_1.ActivatedRoute, platform_browser_1.Title])
    ], FlugEdit);
    return FlugEdit;
}());
exports.FlugEdit = FlugEdit;
//# sourceMappingURL=FlugEdit.js.map