+
+
+
+
+
+
+ Loading....
+ Error....
+
+
+
+
+
Type: {{flight.type}}
+
Comment: {{flight.comment}}
+
+
Time
+
Takeoff: {{flight.starttime | date:'yyyy-MM-dd HH:mm:ss'}}
+
Touchdown: {{flight.endtime | date:'yyyy-MM-dd HH:mm:ss'}}
+
+
+
Plane
+
+
+
+
+
+
{{flight.plane.name}}
+ {{flight.plane.registration}}
+ {{flight.plane.model}}
+
+
+
+
+
+
+
Users
+
+
+
+
+
+
{{user.name}}
+ {{user.role}}
+
+
+
+
+
+
diff --git a/app/pages/flight/flight.component.js b/app/pages/flight/flight.component.js
new file mode 100644
index 0000000..29cb360
--- /dev/null
+++ b/app/pages/flight/flight.component.js
@@ -0,0 +1,84 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var data_service_1 = require("./../../services/data.service");
+var router_1 = require("@angular/router");
+var IntervalObservable_1 = require("rxjs/observable/IntervalObservable");
+var flight_class_1 = require("./../../classes/flight.class");
+var FlightComponent = (function () {
+ function FlightComponent(data, router, route) {
+ this.data = data;
+ this.router = router;
+ this.route = route;
+ this.loading = true;
+ this.error = false;
+ this.id = 0;
+ this.flight = null;
+ this.name = "Loading";
+ }
+ FlightComponent.prototype.getFlight = function (id) {
+ var _this = this;
+ this.data.load().then(function () {
+ _this.data
+ .flight(id)
+ .subscribe(function (b) {
+ var status = b.status_code;
+ if (status != 200 && b.data.length != 1) {
+ _this.loading = false;
+ _this.error = true;
+ }
+ else {
+ _this.flight = flight_class_1.Flight.toFlight(b.data[0]);
+ _this.name = "Flight #" + _this.flight.id;
+ _this.loading = false;
+ }
+ });
+ });
+ };
+ FlightComponent.prototype.endFlight = function () {
+ var _this = this;
+ this.data.load().then(function () {
+ _this.data.endFlight(_this.flight.id).subscribe(function (b) {
+ console.log("flight ended");
+ _this.flight.endtime = Date.now().toString();
+ });
+ });
+ };
+ FlightComponent.prototype.ngOnInit = function () {
+ var _this = this;
+ this.id = this.route.snapshot.params['id'];
+ this.getFlight(this.id);
+ this.subscription = IntervalObservable_1.IntervalObservable.create(5000).subscribe(function () {
+ console.log("Reloading data...");
+ _this.getFlight(_this.id);
+ });
+ };
+ FlightComponent.prototype.ngOnDestroy = function () {
+ this.subscription.unsubscribe();
+ };
+ FlightComponent.prototype.onClick = function (user) {
+ this.router.navigate(['/user', user.id]);
+ };
+ FlightComponent.prototype.onClickPlane = function (plane) {
+ this.router.navigate(['/plane', plane.id]);
+ };
+ return FlightComponent;
+}());
+FlightComponent = __decorate([
+ core_1.Component({
+ selector: 'app-flight',
+ templateUrl: './flight.component.html',
+ styleUrls: ['./flight.component.css']
+ }),
+ __metadata("design:paramtypes", [data_service_1.DataService, router_1.Router, router_1.ActivatedRoute])
+], FlightComponent);
+exports.FlightComponent = FlightComponent;
+//# sourceMappingURL=flight.component.js.map
\ No newline at end of file
diff --git a/app/pages/flight/flight.component.js.map b/app/pages/flight/flight.component.js.map
new file mode 100644
index 0000000..6ae152f
--- /dev/null
+++ b/app/pages/flight/flight.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"flight.component.js","sourceRoot":"","sources":["flight.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA6D;AAC7D,8DAA4D;AAC5D,0CAAmE;AACnE,yEAAwE;AAGxE,6DAAsD;AAUtD,IAAa,eAAe;IAY3B,yBAAoB,IAAgB,EAAU,MAAc,EA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CAqE3B;AArEY,0CAAe"}
\ No newline at end of file
diff --git a/app/pages/flight/flight.component.ts b/app/pages/flight/flight.component.ts
new file mode 100644
index 0000000..80bb466
--- /dev/null
+++ b/app/pages/flight/flight.component.ts
@@ -0,0 +1,86 @@
+import { Component, OnInit, OnDestroy } from '@angular/core';
+import { DataService } from './../../services/data.service';
+import { ActivatedRoute, Params, Router } from '@angular/router';
+import { IntervalObservable } from 'rxjs/observable/IntervalObservable';
+import { Subscription } from 'rxjs/Subscription';
+
+import { Flight } from './../../classes/flight.class';
+import { User } from './../../classes/user.class';
+import { Plane } from './../../classes/plane.class';
+
+@Component({
+ selector: 'app-flight',
+ templateUrl: './flight.component.html',
+ styleUrls: ['./flight.component.css']
+})
+
+export class FlightComponent implements OnInit, OnDestroy {
+
+ loading:boolean = true;
+ error:boolean = false;
+
+ id:number = 0;
+
+ flight:Flight = null;
+ name:string = "Loading";
+
+ public subscription:Subscription;
+
+ constructor(private data:DataService, private router: Router, private route: ActivatedRoute){}
+
+ getFlight(id:number): void {
+ this.data.load().then(()=> {
+ this.data
+ .flight(id)
+ .subscribe(b => {
+
+ var status = b.status_code;
+
+ if(status != 200 && b.data.length != 1)
+ {
+ this.loading = false;
+ this.error = true;
+ }
+ else{
+ this.flight = Flight.toFlight(b.data[0]);
+ this.name = "Flight #" + this.flight.id;
+ this.loading = false;
+ }
+
+ });
+ });
+ }
+
+ endFlight():void {
+ this.data.load().then(()=> {
+ this.data.endFlight(this.flight.id).subscribe(b => {
+ console.log("flight ended");
+ this.flight.endtime = Date.now().toString();
+ });
+ });
+ }
+
+ ngOnInit(): void {
+ this.id = this.route.snapshot.params['id'];
+
+ this.getFlight(this.id);
+
+ this.subscription = IntervalObservable.create(5000).subscribe(() => {
+ console.log("Reloading data...");
+ this.getFlight(this.id);
+ });
+ }
+
+ ngOnDestroy(): void {
+ this.subscription.unsubscribe();
+ }
+
+ onClick(user: User): void {
+ this.router.navigate(['/user', user.id]);
+ }
+
+ onClickPlane(plane: Plane): void {
+ this.router.navigate(['/plane', plane.id]);
+ }
+
+}
\ No newline at end of file
diff --git a/app/pages/flights/flights.component.css b/app/pages/flights/flights.component.css
new file mode 100644
index 0000000..1114d52
--- /dev/null
+++ b/app/pages/flights/flights.component.css
@@ -0,0 +1,11 @@
+.flight {
+ cursor: pointer;
+}
+
+.flight .bit {
+ min-height: 190px;
+}
+
+.inair {
+ background-color: #CCFFCC;
+}
\ No newline at end of file
diff --git a/app/pages/flights/flights.component.html b/app/pages/flights/flights.component.html
new file mode 100644
index 0000000..48f5ae9
--- /dev/null
+++ b/app/pages/flights/flights.component.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+ Loading....
+ Error....
+
+
+
+
+
+
+
+
{{flight.id}}
+ {{flight.plane.model}}, {{flight.plane.registration}}
+ {{user.name}}
+ {{flight.starttime | date:'yyyy-MM-dd HH:mm:ss'}}
+ {{flight.endtime | date:'yyyy-MM-dd HH:mm:ss'}}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/pages/flights/flights.component.js b/app/pages/flights/flights.component.js
new file mode 100644
index 0000000..32d719d
--- /dev/null
+++ b/app/pages/flights/flights.component.js
@@ -0,0 +1,87 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var data_service_1 = require("./../../services/data.service");
+var router_1 = require("@angular/router");
+var IntervalObservable_1 = require("rxjs/observable/IntervalObservable");
+var flight_class_1 = require("./../../classes/flight.class");
+var FlightsComponent = (function () {
+ function FlightsComponent(router, data) {
+ this.router = router;
+ this.data = data;
+ this.loading = true;
+ this.error = false;
+ this.flights = new Array();
+ }
+ FlightsComponent.prototype.getFlightsData = function () {
+ var _this = this;
+ this.data.load().then(function () {
+ _this.data
+ .flights()
+ .subscribe(function (response) {
+ var status = response.status_code;
+ if (status != 200) {
+ _this.loading = false;
+ _this.error = true;
+ }
+ else {
+ for (var i = 0; i < response.data.length; i++) {
+ var temp = flight_class_1.Flight.toFlight(response.data[i]);
+ var flight = _this.getFlightByID(temp.id);
+ if (flight) {
+ if (!flight.equals(temp)) {
+ // push new one, delete old
+ var index = _this.flights.indexOf(flight);
+ _this.flights.splice(index, 1);
+ _this.flights.push(temp);
+ }
+ }
+ else {
+ _this.flights.push(temp);
+ }
+ }
+ _this.flights.sort(function (a, b) {
+ return a.id < b.id ? 1 : -1;
+ });
+ _this.loading = false;
+ }
+ });
+ });
+ };
+ FlightsComponent.prototype.getFlightByID = function (id) {
+ return this.flights.find(function (f) { return f.id === id; });
+ };
+ FlightsComponent.prototype.ngOnInit = function () {
+ var _this = this;
+ this.getFlightsData();
+ this.subscription = IntervalObservable_1.IntervalObservable.create(5000).subscribe(function () {
+ console.log("Reloading data...");
+ _this.getFlightsData();
+ });
+ };
+ FlightsComponent.prototype.ngOnDestroy = function () {
+ this.subscription.unsubscribe();
+ };
+ FlightsComponent.prototype.onClick = function (flight) {
+ this.router.navigate(['/flight', flight.id]);
+ };
+ return FlightsComponent;
+}());
+FlightsComponent = __decorate([
+ core_1.Component({
+ selector: 'app-flights',
+ templateUrl: './flights.component.html',
+ styleUrls: ['./flights.component.css']
+ }),
+ __metadata("design:paramtypes", [router_1.Router, data_service_1.DataService])
+], FlightsComponent);
+exports.FlightsComponent = FlightsComponent;
+//# sourceMappingURL=flights.component.js.map
\ No newline at end of file
diff --git a/app/pages/flights/flights.component.js.map b/app/pages/flights/flights.component.js.map
new file mode 100644
index 0000000..76fecae
--- /dev/null
+++ b/app/pages/flights/flights.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"flights.component.js","sourceRoot":"","sources":["flights.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA8D;AAC9D,8DAA4D;AAC5D,0CAAyC;AACzC,yEAAwE;AAGxE,6DAAsD;AAStD,IAAa,gBAAgB;IAS5B,0BAAoB,MAAc,EAAU,IAAgB;QAAxC,WAAM,GAAN,MAAM,CAAQ;QAAU,SAAI,GAAJ,IAAI,CAAY;QAP5D,YAAO,GAAW,IAAI,CAAC;QACvB,UAAK,GAAW,KAAK,CAAC;QAItB,YAAO,GAAiB,IAAI,KAAK,EAAU,CAAC;IAEkB,CAAC;IAE/D,yCAAc,GAAd;QAAA,iBA6CC;QA3CA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YACrB,KAAI,CAAC,IAAI;iBACH,OAAO,EAAE;iBACT,SAAS,CAAC,UAAA,QAAQ;gBAElB,IAAI,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC;gBAElC,EAAE,CAAA,CAAC,MAAM,IAAI,GAAG,CAAC,CACjB,CAAC;oBACA,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;oBACrB,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;gBACnB,CAAC;gBACD,IAAI,CAAA,CAAC;oBAEJ,GAAG,CAAA,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAC5C,CAAC;wBACA,IAAI,IAAI,GAAU,qBAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBAEpD,IAAI,MAAM,GAAU,KAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;wBAEhD,EAAE,CAAA,CAAC,MAAM,CAAC,CACV,CAAC;4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AW,GAAX;QACI,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAED,kCAAO,GAAP,UAAQ,MAAc;QACjB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;IAEL,uBAAC;AAAD,CAAC,AA/ED,IA+EC;AA/EY,gBAAgB;IAN5B,gBAAS,CAAC;QACT,QAAQ,EAAE,aAAa;QACvB,WAAW,EAAE,0BAA0B;QACvC,SAAS,EAAE,CAAC,yBAAyB,CAAC;KACvC,CAAC;qCAW2B,eAAM,EAAe,0BAAW;GAThD,gBAAgB,CA+E5B;AA/EY,4CAAgB"}
\ No newline at end of file
diff --git a/app/pages/flights/flights.component.ts b/app/pages/flights/flights.component.ts
new file mode 100644
index 0000000..5f4ccdf
--- /dev/null
+++ b/app/pages/flights/flights.component.ts
@@ -0,0 +1,95 @@
+import { Component, OnInit, OnDestroy } from '@angular/core';
+import { DataService } from './../../services/data.service';
+import { Router } from '@angular/router';
+import { IntervalObservable } from 'rxjs/observable/IntervalObservable';
+import { Subscription } from 'rxjs/Subscription';
+
+import { Flight } from './../../classes/flight.class';
+import { User } from './../../classes/user.class';
+
+@Component({
+ selector: 'app-flights',
+ templateUrl: './flights.component.html',
+ styleUrls: ['./flights.component.css']
+})
+
+export class FlightsComponent implements OnInit, OnDestroy {
+
+ loading:boolean = true;
+ error:boolean = false;
+
+ public subscription:Subscription;
+
+ flights:Array
= new Array();
+
+ constructor(private router: Router, private data:DataService){}
+
+ getFlightsData(): void {
+
+ this.data.load().then(()=> {
+ this.data
+ .flights()
+ .subscribe(response => {
+
+ var status = response.status_code;
+
+ if(status != 200)
+ {
+ this.loading = false;
+ this.error = true;
+ }
+ else{
+
+ for(let i = 0; i < response.data.length; i++)
+ {
+ var temp:Flight = Flight.toFlight(response.data[i]);
+
+ var flight:Flight = this.getFlightByID(temp.id);
+
+ if(flight)
+ {
+ if(!flight.equals(temp))
+ {
+ // push new one, delete old
+ var index = this.flights.indexOf(flight);
+ this.flights.splice(index, 1);
+ this.flights.push(temp);
+ }
+ } else {
+ this.flights.push(temp);
+ }
+
+ }
+ this.flights.sort((a, b) => {
+ return a.id < b.id ? 1 : -1;
+ });
+
+ this.loading = false;
+ }
+
+ });
+ });
+ }
+
+ getFlightByID(id:number): Flight {
+ return this.flights.find((f) => {return f.id === id});
+ }
+
+ ngOnInit(): void {
+ this.getFlightsData();
+
+ this.subscription = IntervalObservable.create(5000).subscribe(() => {
+ console.log("Reloading data...");
+ this.getFlightsData();
+ });
+ }
+
+ ngOnDestroy(): void {
+ this.subscription.unsubscribe();
+ }
+
+ onClick(flight: Flight): void {
+ this.router.navigate(['/flight', flight.id]);
+ }
+
+}
\ No newline at end of file
diff --git a/app/pages/plane/form/edit-plane-form.component.html b/app/pages/plane/form/edit-plane-form.component.html
new file mode 100644
index 0000000..0bbc7d9
--- /dev/null
+++ b/app/pages/plane/form/edit-plane-form.component.html
@@ -0,0 +1,51 @@
+
+
+
+
+
diff --git a/app/pages/plane/form/edit-plane-form.component.js b/app/pages/plane/form/edit-plane-form.component.js
new file mode 100644
index 0000000..4bc1e14
--- /dev/null
+++ b/app/pages/plane/form/edit-plane-form.component.js
@@ -0,0 +1,48 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var plane_class_1 = require("../../../classes/plane.class");
+var data_service_1 = require("./../../../services/data.service");
+var EditPlaneFormComponent = (function () {
+ function EditPlaneFormComponent(data) {
+ this.data = data;
+ this.submitted = false;
+ }
+ EditPlaneFormComponent.prototype.ngOnInit = function () {
+ this.plane = new plane_class_1.Plane(this.plmodel.id, this.plmodel.name, this.plmodel.registration, this.plmodel.model, this.plmodel.comment);
+ };
+ EditPlaneFormComponent.prototype.onSubmit = function () {
+ var _this = this;
+ this.plmodel.name = this.plane.name;
+ this.plmodel.registration = this.plane.registration;
+ this.plmodel.model = this.plane.model;
+ this.plmodel.comment = this.plmodel.comment;
+ this.submitted = true;
+ this.data.load().then(function () {
+ _this.data.editPlane(_this.plmodel).subscribe(function (b) { return _this.temp = JSON.stringify(b); });
+ console.log(_this.temp);
+ });
+ };
+ return EditPlaneFormComponent;
+}());
+__decorate([
+ core_1.Input(),
+ __metadata("design:type", plane_class_1.Plane)
+], EditPlaneFormComponent.prototype, "plmodel", void 0);
+EditPlaneFormComponent = __decorate([
+ core_1.Component({
+ selector: 'edit-plane-form',
+ templateUrl: './edit-plane-form.component.html'
+ }),
+ __metadata("design:paramtypes", [data_service_1.DataService])
+], EditPlaneFormComponent);
+exports.EditPlaneFormComponent = EditPlaneFormComponent;
+//# sourceMappingURL=edit-plane-form.component.js.map
\ No newline at end of file
diff --git a/app/pages/plane/form/edit-plane-form.component.js.map b/app/pages/plane/form/edit-plane-form.component.js.map
new file mode 100644
index 0000000..cf703b4
--- /dev/null
+++ b/app/pages/plane/form/edit-plane-form.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"edit-plane-form.component.js","sourceRoot":"","sources":["edit-plane-form.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAAwD;AACxD,4DAAmD;AACnD,iEAA6D;AAQ7D,IAAa,sBAAsB;IAMjC,gCAAoB,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;QAKrC,cAAS,GAAG,KAAK,CAAC;IAHlB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,CA6BlC;AA7BY,wDAAsB"}
\ No newline at end of file
diff --git a/app/pages/plane/form/edit-plane-form.component.ts b/app/pages/plane/form/edit-plane-form.component.ts
new file mode 100644
index 0000000..faae6c4
--- /dev/null
+++ b/app/pages/plane/form/edit-plane-form.component.ts
@@ -0,0 +1,40 @@
+import {Component, Input, OnInit } from '@angular/core';
+import {Plane} from "../../../classes/plane.class";
+import {DataService} from './../../../services/data.service';
+import {NgForm} from '@angular/forms';
+
+@Component({
+ selector: 'edit-plane-form',
+ templateUrl: './edit-plane-form.component.html'
+})
+
+export class EditPlaneFormComponent implements OnInit{
+
+ @Input()plmodel:Plane;
+
+ plane:Plane;
+
+ constructor(private data: DataService) {
+
+ }
+
+ temp: string;
+ submitted = false;
+
+ ngOnInit(){
+ this.plane = new Plane(this.plmodel.id, this.plmodel.name, this.plmodel.registration, this.plmodel.model, this.plmodel.comment);
+ }
+
+ onSubmit() {
+ this.plmodel.name = this.plane.name;
+ this.plmodel.registration = this.plane.registration;
+ this.plmodel.model = this.plane.model;
+ this.plmodel.comment = this.plmodel.comment;
+
+ this.submitted = true;
+ this.data.load().then(() => {
+ this.data.editPlane(this.plmodel).subscribe(b => this.temp = JSON.stringify(b));
+ console.log(this.temp);
+ })
+ }
+}
diff --git a/app/pages/plane/plane.component.css b/app/pages/plane/plane.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/app/pages/plane/plane.component.html b/app/pages/plane/plane.component.html
new file mode 100644
index 0000000..be9acd2
--- /dev/null
+++ b/app/pages/plane/plane.component.html
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+ Loading....
+ Error....
+
+
+
+ Name: {{plane.name}}
+ Registration: {{plane.registration}}
+ Model: {{plane.model}}
+ Comment: {{plane.comment}}
+
+
+
diff --git a/app/pages/plane/plane.component.js b/app/pages/plane/plane.component.js
new file mode 100644
index 0000000..9bcb9fb
--- /dev/null
+++ b/app/pages/plane/plane.component.js
@@ -0,0 +1,68 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var data_service_1 = require("./../../services/data.service");
+var IntervalObservable_1 = require("rxjs/observable/IntervalObservable");
+var plane_class_1 = require("./../../classes/plane.class");
+var router_1 = require("@angular/router");
+var PlaneComponent = (function () {
+ function PlaneComponent(route, data) {
+ this.route = route;
+ this.data = data;
+ this.loading = true;
+ this.error = false;
+ this.name = "Loading";
+ this.id = 0;
+ this.plane = new plane_class_1.Plane(0, "Loading", "Loading", "Loading", "Loading");
+ }
+ PlaneComponent.prototype.getPlane = function (id) {
+ var _this = this;
+ this.data.load().then(function () {
+ _this.data
+ .plane(id)
+ .subscribe(function (b) {
+ var status = b.status_code;
+ if (status != 200 && b.data.length != 1) {
+ _this.loading = false;
+ _this.error = true;
+ }
+ else {
+ _this.plane = plane_class_1.Plane.toPlane(b.data[0]);
+ _this.name = _this.plane.name;
+ _this.loading = false;
+ }
+ });
+ });
+ };
+ PlaneComponent.prototype.ngOnInit = function () {
+ var _this = this;
+ this.id = this.route.snapshot.params['id'];
+ this.getPlane(this.id);
+ this.subscription = IntervalObservable_1.IntervalObservable.create(5000).subscribe(function () {
+ console.log("Reloading data...");
+ _this.getPlane(_this.id);
+ });
+ };
+ PlaneComponent.prototype.ngOnDestroy = function () {
+ this.subscription.unsubscribe();
+ };
+ return PlaneComponent;
+}());
+PlaneComponent = __decorate([
+ core_1.Component({
+ selector: 'app-plane',
+ templateUrl: './plane.component.html',
+ styleUrls: ['./plane.component.css']
+ }),
+ __metadata("design:paramtypes", [router_1.ActivatedRoute, data_service_1.DataService])
+], PlaneComponent);
+exports.PlaneComponent = PlaneComponent;
+//# sourceMappingURL=plane.component.js.map
\ No newline at end of file
diff --git a/app/pages/plane/plane.component.js.map b/app/pages/plane/plane.component.js.map
new file mode 100644
index 0000000..7010ee6
--- /dev/null
+++ b/app/pages/plane/plane.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"plane.component.js","sourceRoot":"","sources":["plane.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA6D;AAC7D,8DAA4D;AAC5D,yEAAwE;AAGxE,2DAAoD;AACpD,0CAAyD;AASzD,IAAa,cAAc;IAW1B,wBAAoB,KAAqB,EAAU,IAAgB;QAA/C,UAAK,GAAL,KAAK,CAAgB;QAAU,SAAI,GAAJ,IAAI,CAAY;QATnE,YAAO,GAAW,IAAI,CAAC;QACvB,UAAK,GAAW,KAAK,CAAC;QACtB,SAAI,GAAU,SAAS,CAAC;QACxB,OAAE,GAAU,CAAC,CAAC;QAEP,UAAK,GAAS,IAAI,mBAAK,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAIT,CAAC;IAGtE,iCAAQ,GAAR,UAAS,EAAS;QAAlB,iBAsBC;QArBA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YACrB,KAAI,CAAC,IAAI;iBACH,KAAK,CAAC,EAAE,CAAC;iBACT,SAAS,CAAC,UAAA,CAAC;gBAEX,IAAI,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC;gBAE3B,EAAE,CAAA,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CACvC,CAAC;oBACA,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;oBACrB,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;gBACnB,CAAC;gBACD,IAAI,CAAA,CAAC;oBAEJ,KAAI,CAAC,KAAK,GAAG,mBAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBACtC,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,KAAK,CAAC,IAAI,CAAC;oBAC5B,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;gBACtB,CAAC;YAEF,CAAC,CAAC,CAAC;QACT,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,iCAAQ,GAAR;QAAA,iBASC;QARA,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEpB,IAAI,CAAC,YAAY,GAAG,uCAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YAC9B,KAAI,CAAC,QAAQ,CAAC,KAAI,CAAC,EAAE,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACV,CAAC;IAED,oCAAW,GAAX;QACI,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAEF,qBAAC;AAAD,CAAC,AArDD,IAqDC;AArDY,cAAc;IAN1B,gBAAS,CAAC;QACT,QAAQ,EAAE,WAAW;QACrB,WAAW,EAAE,wBAAwB;QACrC,SAAS,EAAE,CAAC,uBAAuB,CAAC;KACrC,CAAC;qCAa0B,uBAAc,EAAe,0BAAW;GAXvD,cAAc,CAqD1B;AArDY,wCAAc"}
\ No newline at end of file
diff --git a/app/pages/plane/plane.component.ts b/app/pages/plane/plane.component.ts
new file mode 100644
index 0000000..a769c70
--- /dev/null
+++ b/app/pages/plane/plane.component.ts
@@ -0,0 +1,69 @@
+import { Component, OnInit, OnDestroy } from '@angular/core';
+import { DataService } from './../../services/data.service';
+import { IntervalObservable } from 'rxjs/observable/IntervalObservable';
+import { Subscription } from 'rxjs/Subscription';
+
+import { Plane } from "./../../classes/plane.class";
+import { Params, ActivatedRoute } from '@angular/router';
+
+
+@Component({
+ selector: 'app-plane',
+ templateUrl: './plane.component.html',
+ styleUrls: ['./plane.component.css']
+})
+
+export class PlaneComponent implements OnInit, OnDestroy {
+
+ loading:boolean = true;
+ error:boolean = false;
+ name:string = "Loading";
+ id:number = 0;
+
+ public plane:Plane = new Plane(0, "Loading", "Loading", "Loading", "Loading");
+
+ public subscription:Subscription;
+
+ constructor(private route: ActivatedRoute, private data:DataService){}
+
+
+ getPlane(id:number): void {
+ this.data.load().then(()=> {
+ this.data
+ .plane(id)
+ .subscribe(b => {
+
+ var status = b.status_code;
+
+ if(status != 200 && b.data.length != 1)
+ {
+ this.loading = false;
+ this.error = true;
+ }
+ else{
+
+ this.plane = Plane.toPlane(b.data[0]);
+ this.name = this.plane.name;
+ this.loading = false;
+ }
+
+ });
+ });
+ }
+
+ ngOnInit(): void {
+ this.id = this.route.snapshot.params['id'];
+
+ this.getPlane(this.id);
+
+ this.subscription = IntervalObservable.create(5000).subscribe(() => {
+ console.log("Reloading data...");
+ this.getPlane(this.id);
+ });
+ }
+
+ ngOnDestroy(): void {
+ this.subscription.unsubscribe();
+ }
+
+}
\ No newline at end of file
diff --git a/app/pages/planes/form/plane-form.component.html b/app/pages/planes/form/plane-form.component.html
new file mode 100644
index 0000000..a52d241
--- /dev/null
+++ b/app/pages/planes/form/plane-form.component.html
@@ -0,0 +1,50 @@
+
+
+
+
+
diff --git a/app/pages/planes/form/plane-form.component.js b/app/pages/planes/form/plane-form.component.js
new file mode 100644
index 0000000..82a19d9
--- /dev/null
+++ b/app/pages/planes/form/plane-form.component.js
@@ -0,0 +1,38 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var plane_class_1 = require("../../../classes/plane.class");
+var data_service_1 = require("./../../../services/data.service");
+var PlaneFormComponent = (function () {
+ function PlaneFormComponent(data) {
+ this.data = data;
+ this.roles = ['Pilot', 'Student', 'Instructor'];
+ this.submitted = false;
+ this.plane = new plane_class_1.Plane(0, "", "", "", "");
+ }
+ PlaneFormComponent.prototype.onSubmit = function () {
+ var _this = this;
+ this.submitted = true;
+ this.data.load().then(function () {
+ _this.data.postPlane(_this.plane).subscribe(function (b) { return _this.temp = JSON.stringify(b); });
+ });
+ };
+ return PlaneFormComponent;
+}());
+PlaneFormComponent = __decorate([
+ core_1.Component({
+ selector: 'plane-form',
+ templateUrl: './plane-form.component.html'
+ }),
+ __metadata("design:paramtypes", [data_service_1.DataService])
+], PlaneFormComponent);
+exports.PlaneFormComponent = PlaneFormComponent;
+//# sourceMappingURL=plane-form.component.js.map
\ No newline at end of file
diff --git a/app/pages/planes/form/plane-form.component.js.map b/app/pages/planes/form/plane-form.component.js.map
new file mode 100644
index 0000000..1885ce1
--- /dev/null
+++ b/app/pages/planes/form/plane-form.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"plane-form.component.js","sourceRoot":"","sources":["plane-form.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAAwC;AACxC,4DAAmD;AACnD,iEAA6D;AAO7D,IAAa,kBAAkB;IAE7B,4BAAoB,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;QAM9B,UAAK,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;QAIlD,cAAS,GAAG,KAAK,CAAC;QATf,IAAI,CAAC,KAAK,GAAG,IAAI,mBAAK,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC;IAUD,qCAAQ,GAAR;QAAA,iBAKC;QAJC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YACpB,KAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAA7B,CAA6B,CAAC,CAAC;QAChF,CAAC,CAAC,CAAA;IACJ,CAAC;IACH,yBAAC;AAAD,CAAC,AApBD,IAoBC;AApBY,kBAAkB;IAL9B,gBAAS,CAAC;QACT,QAAQ,EAAE,YAAY;QACtB,WAAW,EAAE,6BAA6B;KAC3C,CAAC;qCAI0B,0BAAW;GAF1B,kBAAkB,CAoB9B;AApBY,gDAAkB"}
\ No newline at end of file
diff --git a/app/pages/planes/form/plane-form.component.ts b/app/pages/planes/form/plane-form.component.ts
new file mode 100644
index 0000000..44ace64
--- /dev/null
+++ b/app/pages/planes/form/plane-form.component.ts
@@ -0,0 +1,30 @@
+import {Component} from '@angular/core';
+import {Plane} from "../../../classes/plane.class";
+import {DataService} from './../../../services/data.service';
+
+@Component({
+ selector: 'plane-form',
+ templateUrl: './plane-form.component.html'
+})
+
+export class PlaneFormComponent {
+
+ constructor(private data: DataService) {
+ this.plane = new Plane(0, "", "", "", "");
+ }
+
+ temp: string;
+
+ public roles = ['Pilot', 'Student', 'Instructor'];
+
+ public plane:Plane;
+
+ submitted = false;
+
+ onSubmit() {
+ this.submitted = true;
+ this.data.load().then(() => {
+ this.data.postPlane(this.plane).subscribe(b => this.temp = JSON.stringify(b));
+ })
+ }
+}
diff --git a/app/pages/planes/planes.component.css b/app/pages/planes/planes.component.css
new file mode 100644
index 0000000..c5bffb5
--- /dev/null
+++ b/app/pages/planes/planes.component.css
@@ -0,0 +1,3 @@
+.plane {
+ cursor: pointer;
+}
\ No newline at end of file
diff --git a/app/pages/planes/planes.component.html b/app/pages/planes/planes.component.html
new file mode 100644
index 0000000..13f82d9
--- /dev/null
+++ b/app/pages/planes/planes.component.html
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Loading....
+ Error....
+
+
+
+
+
+
+
+
{{plane.name}}
+ {{plane.registration}}
+ {{plane.model}}
+
+
+
+
+
+
+
diff --git a/app/pages/planes/planes.component.js b/app/pages/planes/planes.component.js
new file mode 100644
index 0000000..be4188b
--- /dev/null
+++ b/app/pages/planes/planes.component.js
@@ -0,0 +1,88 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var data_service_1 = require("./../../services/data.service");
+var router_1 = require("@angular/router");
+var IntervalObservable_1 = require("rxjs/observable/IntervalObservable");
+var plane_class_1 = require("./../../classes/plane.class");
+var PlanesComponent = (function () {
+ function PlanesComponent(router, data) {
+ this.router = router;
+ this.data = data;
+ this.loading = true;
+ this.error = false;
+ this.planes = new Array();
+ }
+ PlanesComponent.prototype.getPlanesData = function () {
+ var _this = this;
+ this.data.load().then(function () {
+ _this.data
+ .planes()
+ .subscribe(function (response) {
+ var status = response.status_code;
+ if (status != 200) {
+ _this.loading = false;
+ _this.error = true;
+ }
+ else {
+ _this.error = false;
+ for (var i = 0; i < response.data.length; i++) {
+ var temp = plane_class_1.Plane.toPlane(response.data[i]);
+ var plane = _this.getPlaneByID(temp.id);
+ if (plane) {
+ if (!temp.equals(plane)) {
+ // push new one, delete old
+ var index = _this.planes.indexOf(plane);
+ _this.planes.splice(index, 1);
+ _this.planes.push(temp);
+ }
+ }
+ else {
+ _this.planes.push(temp);
+ }
+ }
+ _this.planes.sort(function (a, b) {
+ return a.name > b.name ? 1 : -1;
+ });
+ _this.loading = false;
+ }
+ });
+ });
+ };
+ PlanesComponent.prototype.ngOnInit = function () {
+ var _this = this;
+ this.getPlanesData();
+ this.subscription = IntervalObservable_1.IntervalObservable.create(5000).subscribe(function () {
+ console.log("Reloading data...");
+ _this.getPlanesData();
+ });
+ };
+ PlanesComponent.prototype.ngOnDestroy = function () {
+ this.subscription.unsubscribe();
+ };
+ PlanesComponent.prototype.onClick = function (plane) {
+ this.router.navigate(['/plane', plane.id]);
+ };
+ PlanesComponent.prototype.getPlaneByID = function (id) {
+ return this.planes.find(function (f) { return f.id === id; });
+ };
+ return PlanesComponent;
+}());
+PlanesComponent = __decorate([
+ core_1.Component({
+ selector: 'app-planes',
+ templateUrl: './planes.component.html',
+ styleUrls: ['./planes.component.css']
+ }),
+ __metadata("design:paramtypes", [router_1.Router, data_service_1.DataService])
+], PlanesComponent);
+exports.PlanesComponent = PlanesComponent;
+//# sourceMappingURL=planes.component.js.map
\ No newline at end of file
diff --git a/app/pages/planes/planes.component.js.map b/app/pages/planes/planes.component.js.map
new file mode 100644
index 0000000..0c95544
--- /dev/null
+++ b/app/pages/planes/planes.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"planes.component.js","sourceRoot":"","sources":["planes.component.ts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AM,CAAC,IAAI,CAAC,UAAC,CAAC,IAAM,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAA,CAAA,CAAC,CAAC,CAAC;IACtD,CAAC;IAEF,sBAAC;AAAD,CAAC,AAjFD,IAiFC;AAjFY,eAAe;IAN3B,gBAAS,CAAC;QACT,QAAQ,EAAE,YAAY;QACtB,WAAW,EAAE,yBAAyB;QACtC,SAAS,EAAE,CAAC,wBAAwB,CAAC;KACtC,CAAC;qCAW2B,eAAM,EAAe,0BAAW;GAThD,eAAe,CAiF3B;AAjFY,0CAAe"}
\ No newline at end of file
diff --git a/app/pages/planes/planes.component.ts b/app/pages/planes/planes.component.ts
new file mode 100644
index 0000000..69fc051
--- /dev/null
+++ b/app/pages/planes/planes.component.ts
@@ -0,0 +1,96 @@
+import { Component, OnInit, OnDestroy } from '@angular/core';
+import { DataService } from './../../services/data.service';
+import { Router } from '@angular/router';
+import { IntervalObservable } from 'rxjs/observable/IntervalObservable';
+import { Subscription } from 'rxjs/Subscription';
+
+import { Plane } from "./../../classes/plane.class";
+
+@Component({
+ selector: 'app-planes',
+ templateUrl: './planes.component.html',
+ styleUrls: ['./planes.component.css']
+})
+
+export class PlanesComponent implements OnInit, OnDestroy {
+
+ loading:boolean = true;
+ error:boolean = false;
+
+ planes:Array = new Array();
+
+ public subscription:Subscription;
+
+ constructor(private router: Router, private data:DataService){}
+
+ getPlanesData(): void {
+
+ this.data.load().then(()=> {
+ this.data
+ .planes()
+ .subscribe(response => {
+
+ var status = response.status_code;
+
+ if(status != 200)
+ {
+ this.loading = false;
+ this.error = true;
+ }
+ else{
+
+ this.error = false;
+
+ for(let i = 0; i < response.data.length; i++)
+ {
+ var temp:Plane = Plane.toPlane(response.data[i]);
+ var plane:Plane = this.getPlaneByID(temp.id);
+
+ if(plane)
+ {
+ if(!temp.equals(plane))
+ {
+ // push new one, delete old
+ var index = this.planes.indexOf(plane);
+ this.planes.splice(index, 1);
+ this.planes.push(temp);
+ }
+ } else {
+ this.planes.push(temp);
+ }
+
+ }
+
+ this.planes.sort((a, b) => {
+ return a.name > b.name ? 1 : -1;
+ });
+
+ this.loading = false;
+ }
+
+ });
+ });
+ }
+
+ ngOnInit(): void {
+ this.getPlanesData();
+
+ this.subscription = IntervalObservable.create(5000).subscribe(() => {
+ console.log("Reloading data...");
+ this.getPlanesData();
+ });
+ }
+
+ ngOnDestroy(): void {
+ this.subscription.unsubscribe();
+ }
+
+ onClick(plane: Plane): void {
+ this.router.navigate(['/plane', plane.id]);
+ }
+
+ getPlaneByID(id:number): Plane {
+ return this.planes.find((f) => {return f.id === id});
+ }
+
+}
\ No newline at end of file
diff --git a/app/pages/reader/form/edit-reader-form.component.html b/app/pages/reader/form/edit-reader-form.component.html
new file mode 100644
index 0000000..d7dc0a8
--- /dev/null
+++ b/app/pages/reader/form/edit-reader-form.component.html
@@ -0,0 +1,32 @@
+
+
+
+
+
diff --git a/app/pages/reader/form/edit-reader-form.component.js b/app/pages/reader/form/edit-reader-form.component.js
new file mode 100644
index 0000000..5117e26
--- /dev/null
+++ b/app/pages/reader/form/edit-reader-form.component.js
@@ -0,0 +1,59 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var reader_class_1 = require("../../../classes/reader.class");
+var plane_class_1 = require("../../../classes/plane.class");
+var data_service_1 = require("./../../../services/data.service");
+var EditReaderFormComponent = (function () {
+ function EditReaderFormComponent(data) {
+ this.data = data;
+ this.submitted = false;
+ this.planes = new Array();
+ this.planes = new Array();
+ }
+ EditReaderFormComponent.prototype.ngOnInit = function () {
+ var _this = this;
+ this.reader = new reader_class_1.Reader(this.model.id, this.model.reader_id, this.model.plane);
+ this.data.load().then(function () {
+ _this.data
+ .planes()
+ .subscribe(function (response) {
+ for (var i = 0; i < response.data.length; i++) {
+ var temp = plane_class_1.Plane.toPlane(response.data[i]);
+ _this.planes.push(temp);
+ }
+ });
+ });
+ };
+ EditReaderFormComponent.prototype.onSubmit = function () {
+ var _this = this;
+ this.model.plane = this.reader.plane;
+ this.submitted = true;
+ this.data.load().then(function () {
+ _this.data.editReader(_this.model).subscribe(function (b) { return _this.temp = JSON.stringify(b); });
+ console.log(_this.temp);
+ });
+ };
+ return EditReaderFormComponent;
+}());
+__decorate([
+ core_1.Input(),
+ __metadata("design:type", reader_class_1.Reader)
+], EditReaderFormComponent.prototype, "model", void 0);
+EditReaderFormComponent = __decorate([
+ core_1.Component({
+ selector: 'edit-reader-form',
+ templateUrl: './edit-reader-form.component.html'
+ }),
+ __metadata("design:paramtypes", [data_service_1.DataService])
+], EditReaderFormComponent);
+exports.EditReaderFormComponent = EditReaderFormComponent;
+//# sourceMappingURL=edit-reader-form.component.js.map
\ No newline at end of file
diff --git a/app/pages/reader/form/edit-reader-form.component.js.map b/app/pages/reader/form/edit-reader-form.component.js.map
new file mode 100644
index 0000000..32bc122
--- /dev/null
+++ b/app/pages/reader/form/edit-reader-form.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"edit-reader-form.component.js","sourceRoot":"","sources":["edit-reader-form.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAAuD;AACvD,8DAAqD;AACrD,4DAAmD;AACnD,iEAA6D;AAQ7D,IAAa,uBAAuB;IAMlC,iCAAoB,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;QAOrC,cAAS,GAAG,KAAK,CAAC;QAElB,WAA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CAAC,KAAI,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC;IACH,8BAAC;AAAD,CAAC,AA/CD,IA+CC;AA7CS;IAAP,YAAK,EAAE;8BAAM,qBAAM;sDAAC;AAFV,uBAAuB;IALnC,gBAAS,CAAC;QACT,QAAQ,EAAE,kBAAkB;QAC5B,WAAW,EAAE,mCAAmC;KACjD,CAAC;qCAQ0B,0BAAW;GAN1B,uBAAuB,CA+CnC;AA/CY,0DAAuB"}
\ No newline at end of file
diff --git a/app/pages/reader/form/edit-reader-form.component.ts b/app/pages/reader/form/edit-reader-form.component.ts
new file mode 100644
index 0000000..69f6071
--- /dev/null
+++ b/app/pages/reader/form/edit-reader-form.component.ts
@@ -0,0 +1,59 @@
+import {Component, Input, OnInit} from '@angular/core';
+import {Reader} from "../../../classes/reader.class";
+import {Plane} from "../../../classes/plane.class";
+import {DataService} from './../../../services/data.service';
+import {NgForm} from '@angular/forms';
+
+@Component({
+ selector: 'edit-reader-form',
+ templateUrl: './edit-reader-form.component.html'
+})
+
+export class EditReaderFormComponent implements OnInit {
+
+ @Input()model:Reader;
+
+ reader:Reader;
+
+ constructor(private data: DataService) {
+
+ this.planes = new Array();
+ }
+
+ temp: string;
+
+ submitted = false;
+
+ planes:Array = new Array();
+
+ ngOnInit(): void {
+
+ this.reader = new Reader(this.model.id, this.model.reader_id, this.model.plane);
+
+ this.data.load().then(()=> {
+ this.data
+ .planes()
+ .subscribe(response => {
+
+ for(let i = 0; i < response.data.length; i++)
+ {
+ var temp:Plane = Plane.toPlane(response.data[i]);
+ this.planes.push(temp);
+ }
+
+ });
+
+ });
+ }
+
+ onSubmit() {
+
+ this.model.plane = this.reader.plane;
+
+ this.submitted = true;
+ this.data.load().then(() => {
+ this.data.editReader(this.model).subscribe(b => this.temp = JSON.stringify(b));
+ console.log(this.temp);
+ })
+ }
+}
diff --git a/app/pages/reader/reader.component.css b/app/pages/reader/reader.component.css
new file mode 100644
index 0000000..1fd6d2c
--- /dev/null
+++ b/app/pages/reader/reader.component.css
@@ -0,0 +1,3 @@
+.plane{
+ cursor:pointer;
+}
\ No newline at end of file
diff --git a/app/pages/reader/reader.component.html b/app/pages/reader/reader.component.html
new file mode 100644
index 0000000..74a26ac
--- /dev/null
+++ b/app/pages/reader/reader.component.html
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+ Loading....
+ Error....
+
+
+
+
Reader: {{reader.reader_id}}
+
+
+
+
Plane
+
+
+
+
+
+
{{reader.plane.name}}
+ {{reader.plane.registration}}
+ {{reader.plane.model}}
+
+
+
+
+
+
+
+
+
diff --git a/app/pages/reader/reader.component.js b/app/pages/reader/reader.component.js
new file mode 100644
index 0000000..d80db8a
--- /dev/null
+++ b/app/pages/reader/reader.component.js
@@ -0,0 +1,72 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var data_service_1 = require("./../../services/data.service");
+var IntervalObservable_1 = require("rxjs/observable/IntervalObservable");
+var reader_class_1 = require("./../../classes/reader.class");
+var router_1 = require("@angular/router");
+var ReaderComponent = (function () {
+ function ReaderComponent(route, router, data) {
+ this.route = route;
+ this.router = router;
+ this.data = data;
+ this.loading = true;
+ this.error = false;
+ this.name = "Loading";
+ this.id = 0;
+ this.reader = new reader_class_1.Reader(0, "", null);
+ }
+ ReaderComponent.prototype.getReader = function (id) {
+ var _this = this;
+ this.data.load().then(function () {
+ _this.data
+ .reader(id)
+ .subscribe(function (b) {
+ var status = b.status_code;
+ if (status != 200 && b.data.length != 1) {
+ _this.loading = false;
+ _this.error = true;
+ }
+ else {
+ _this.reader = reader_class_1.Reader.toReader(b.data[0]);
+ _this.name = _this.reader.reader_id;
+ _this.loading = false;
+ }
+ });
+ });
+ };
+ ReaderComponent.prototype.ngOnInit = function () {
+ var _this = this;
+ this.id = this.route.snapshot.params['id'];
+ this.getReader(this.id);
+ this.subscription = IntervalObservable_1.IntervalObservable.create(5000).subscribe(function () {
+ console.log("Reloading data...");
+ _this.getReader(_this.id);
+ });
+ };
+ ReaderComponent.prototype.ngOnDestroy = function () {
+ this.subscription.unsubscribe();
+ };
+ ReaderComponent.prototype.onClick = function (plane) {
+ this.router.navigate(['/plane', plane.id]);
+ };
+ return ReaderComponent;
+}());
+ReaderComponent = __decorate([
+ core_1.Component({
+ selector: 'app-reader',
+ templateUrl: './reader.component.html',
+ styleUrls: ['./reader.component.css']
+ }),
+ __metadata("design:paramtypes", [router_1.ActivatedRoute, router_1.Router, data_service_1.DataService])
+], ReaderComponent);
+exports.ReaderComponent = ReaderComponent;
+//# sourceMappingURL=reader.component.js.map
\ No newline at end of file
diff --git a/app/pages/reader/reader.component.js.map b/app/pages/reader/reader.component.js.map
new file mode 100644
index 0000000..5222fd9
--- /dev/null
+++ b/app/pages/reader/reader.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"reader.component.js","sourceRoot":"","sources":["reader.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA6D;AAC7D,8DAA4D;AAC5D,yEAAwE;AAGxE,6DAAsD;AAEtD,0CAAiE;AASjE,IAAa,eAAe;IAW3B,yBAAoB,KAAqB,EAAU,MAAc,EAAU,IAAgB;QAAvE,UAAK,GAAL,KAAK,CAAgB;QAAU,WAAM,GAAN,MAAM,CAAQ;QAAU,SAAI,GAAJ,IAAI,CAAY;QAT3F,YAAO,GAAW,IAAI,CAAC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AAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YAC9B,KAAI,CAAC,SAAS,CAAC,KAAI,CAAC,EAAE,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACV,CAAC;IAED,qCAAW,GAAX;QACI,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAED,iCAAO,GAAP,UAAQ,KAAY;QACf,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC;IAEL,sBAAC;AAAD,CAAC,AAzDD,IAyDC;AAzDY,eAAe;IAN3B,gBAAS,CAAC;QACT,QAAQ,EAAE,YAAY;QACtB,WAAW,EAAE,yBAAyB;QACtC,SAAS,EAAE,CAAC,wBAAwB,CAAC;KACtC,CAAC;qCAa0B,uBAAc,EAAkB,eAAM,EAAe,0BAAW;GAX/E,eAAe,CAyD3B;AAzDY,0CAAe"}
\ No newline at end of file
diff --git a/app/pages/reader/reader.component.ts b/app/pages/reader/reader.component.ts
new file mode 100644
index 0000000..0b6ff75
--- /dev/null
+++ b/app/pages/reader/reader.component.ts
@@ -0,0 +1,74 @@
+import { Component, OnInit, OnDestroy } from '@angular/core';
+import { DataService } from './../../services/data.service';
+import { IntervalObservable } from 'rxjs/observable/IntervalObservable';
+import { Subscription } from 'rxjs/Subscription';
+
+import { Reader } from "./../../classes/reader.class";
+import { Plane } from "./../../classes/plane.class";
+import { Params, ActivatedRoute, Router } from '@angular/router';
+
+
+@Component({
+ selector: 'app-reader',
+ templateUrl: './reader.component.html',
+ styleUrls: ['./reader.component.css']
+})
+
+export class ReaderComponent implements OnInit, OnDestroy {
+
+ loading:boolean = true;
+ error:boolean = false;
+ name:string = "Loading";
+ id:number = 0;
+
+ public reader:Reader = new Reader(0, "", null);
+
+ public subscription:Subscription;
+
+ constructor(private route: ActivatedRoute, private router: Router, private data:DataService){}
+
+
+ getReader(id:number): void {
+ this.data.load().then(()=> {
+ this.data
+ .reader(id)
+ .subscribe(b => {
+
+ var status = b.status_code;
+
+ if(status != 200 && b.data.length != 1)
+ {
+ this.loading = false;
+ this.error = true;
+ }
+ else{
+
+ this.reader = Reader.toReader(b.data[0]);
+ this.name = this.reader.reader_id;
+ this.loading = false;
+ }
+
+ });
+ });
+ }
+
+ ngOnInit(): void {
+ this.id = this.route.snapshot.params['id'];
+
+ this.getReader(this.id);
+
+ this.subscription = IntervalObservable.create(5000).subscribe(() => {
+ console.log("Reloading data...");
+ this.getReader(this.id);
+ });
+ }
+
+ ngOnDestroy(): void {
+ this.subscription.unsubscribe();
+ }
+
+ onClick(plane: Plane): void {
+ this.router.navigate(['/plane', plane.id]);
+ }
+
+}
\ No newline at end of file
diff --git a/app/pages/readers/readers.component.css b/app/pages/readers/readers.component.css
new file mode 100644
index 0000000..21b2ed0
--- /dev/null
+++ b/app/pages/readers/readers.component.css
@@ -0,0 +1,7 @@
+.reader {
+ cursor: pointer;
+}
+
+.anon {
+ background-color: #EEAAAA;
+}
\ No newline at end of file
diff --git a/app/pages/readers/readers.component.html b/app/pages/readers/readers.component.html
new file mode 100644
index 0000000..73e973a
--- /dev/null
+++ b/app/pages/readers/readers.component.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Loading....
+ Error....
+
+
+
+
+
+
+
+
{{reader.reader_id}}
+
+
+
+
+
+
+
diff --git a/app/pages/readers/readers.component.js b/app/pages/readers/readers.component.js
new file mode 100644
index 0000000..a6caa22
--- /dev/null
+++ b/app/pages/readers/readers.component.js
@@ -0,0 +1,87 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var data_service_1 = require("./../../services/data.service");
+var router_1 = require("@angular/router");
+var IntervalObservable_1 = require("rxjs/observable/IntervalObservable");
+var reader_class_1 = require("./../../classes/reader.class");
+var ReadersComponent = (function () {
+ function ReadersComponent(router, data) {
+ this.router = router;
+ this.data = data;
+ this.loading = true;
+ this.error = false;
+ this.readers = new Array();
+ }
+ ReadersComponent.prototype.getReadersData = function () {
+ var _this = this;
+ this.data.load().then(function () {
+ _this.data
+ .readers()
+ .subscribe(function (response) {
+ var status = response.status_code;
+ if (status != 200) {
+ _this.loading = false;
+ _this.error = true;
+ }
+ else {
+ for (var i = 0; i < response.data.length; i++) {
+ var temp = reader_class_1.Reader.toReader(response.data[i]);
+ var reader = _this.getReaderByID(temp.id);
+ if (reader) {
+ if (!temp.equals(reader)) {
+ // push new one, delete old
+ var index = _this.readers.indexOf(reader);
+ _this.readers.splice(index, 1);
+ _this.readers.push(temp);
+ }
+ }
+ else {
+ _this.readers.push(temp);
+ }
+ }
+ _this.readers.sort(function (a, b) {
+ return a.reader_id > b.reader_id ? 1 : -1;
+ });
+ _this.loading = false;
+ }
+ });
+ });
+ };
+ ReadersComponent.prototype.ngOnInit = function () {
+ var _this = this;
+ this.getReadersData();
+ this.subscription = IntervalObservable_1.IntervalObservable.create(5000).subscribe(function () {
+ console.log("Reloading data...");
+ _this.getReadersData();
+ });
+ };
+ ReadersComponent.prototype.ngOnDestroy = function () {
+ this.subscription.unsubscribe();
+ };
+ ReadersComponent.prototype.onClick = function (reader) {
+ this.router.navigate(['/reader', reader.id]);
+ };
+ ReadersComponent.prototype.getReaderByID = function (id) {
+ return this.readers.find(function (f) { return f.id === id; });
+ };
+ return ReadersComponent;
+}());
+ReadersComponent = __decorate([
+ core_1.Component({
+ selector: 'app-readers',
+ templateUrl: './readers.component.html',
+ styleUrls: ['./readers.component.css']
+ }),
+ __metadata("design:paramtypes", [router_1.Router, data_service_1.DataService])
+], ReadersComponent);
+exports.ReadersComponent = ReadersComponent;
+//# sourceMappingURL=readers.component.js.map
\ No newline at end of file
diff --git a/app/pages/readers/readers.component.js.map b/app/pages/readers/readers.component.js.map
new file mode 100644
index 0000000..bf7c061
--- /dev/null
+++ b/app/pages/readers/readers.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"readers.component.js","sourceRoot":"","sources":["readers.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA6D;AAC7D,8DAA4D;AAC5D,0CAAyC;AACzC,yEAAwE;AAGxE,6DAAsD;AAQtD,IAAa,gBAAgB;IAS5B,0BAAoB,MAAc,EAAU,IAAgB;QAAxC,WAAM,GAAN,MAAM,CAAQ;QAAU,SAAI,GAAJ,IAAI,CAAY;QAP5D,YAAO,GAAW,IAAI,CAAC;QACvB,UAAK,GAAW,KAAK,CAAC;QAEtB,YAAO,GAAiB,IAAI,KAAK,EAAU,CAAC;IAIkB,CAAC;IAE/D,yCAAc,GAAd;QAAA,iBA4CC;QA3CA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YACrB,KAAI,CAAC,IAAI;iBACH,OAAO,EAAE;iBACT,SAAS,CAAC,UAAA,QAAQ;gBAElB,IAAI,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC;gBAElC,EAAE,CAAA,CAAC,MAAM,IAAI,GAAG,CAAC,CACjB,CAAC;oBACA,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;oBACrB,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;gBACnB,CAAC;gBACD,IAAI,CAAA,CAAC;oBAEJ,GAAG,CAAA,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,MAA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B,KAAI,CAAC,cAAc,EAAE,CAAC;QAC1B,CAAC,CAAC,CAAC;IACV,CAAC;IAED,sCAAW,GAAX;QACI,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAED,kCAAO,GAAP,UAAQ,MAAc;QACjB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,wCAAa,GAAb,UAAc,EAAS;QACzB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAC,CAAC,IAAM,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAA,CAAA,CAAC,CAAC,CAAC;IACvD,CAAC;IAEF,uBAAC;AAAD,CAAC,AA9ED,IA8EC;AA9EY,gBAAgB;IAN5B,gBAAS,CAAC;QACT,QAAQ,EAAE,aAAa;QACvB,WAAW,EAAE,0BAA0B;QACvC,SAAS,EAAE,CAAC,yBAAyB,CAAC;KACvC,CAAC;qCAW2B,eAAM,EAAe,0BAAW;GAThD,gBAAgB,CA8E5B;AA9EY,4CAAgB"}
\ No newline at end of file
diff --git a/app/pages/readers/readers.component.ts b/app/pages/readers/readers.component.ts
new file mode 100644
index 0000000..8d53924
--- /dev/null
+++ b/app/pages/readers/readers.component.ts
@@ -0,0 +1,93 @@
+import { Component, OnInit, OnDestroy } from '@angular/core';
+import { DataService } from './../../services/data.service';
+import { Router } from '@angular/router';
+import { IntervalObservable } from 'rxjs/observable/IntervalObservable';
+import { Subscription } from 'rxjs/Subscription';
+
+import { Reader } from "./../../classes/reader.class";
+
+@Component({
+ selector: 'app-readers',
+ templateUrl: './readers.component.html',
+ styleUrls: ['./readers.component.css']
+})
+
+export class ReadersComponent implements OnInit, OnDestroy {
+
+ loading:boolean = true;
+ error:boolean = false;
+
+ readers:Array = new Array();
+
+ public subscription:Subscription;
+
+ constructor(private router: Router, private data:DataService){}
+
+ getReadersData(): void {
+ this.data.load().then(()=> {
+ this.data
+ .readers()
+ .subscribe(response => {
+
+ var status = response.status_code;
+
+ if(status != 200)
+ {
+ this.loading = false;
+ this.error = true;
+ }
+ else{
+
+ for(let i = 0; i < response.data.length; i++)
+ {
+ var temp:Reader = Reader.toReader(response.data[i]);
+ var reader:Reader = this.getReaderByID(temp.id);
+
+ if(reader)
+ {
+ if(!temp.equals(reader))
+ {
+ // push new one, delete old
+ var index = this.readers.indexOf(reader);
+ this.readers.splice(index, 1);
+ this.readers.push(temp);
+ }
+ } else {
+ this.readers.push(temp);
+ }
+
+ }
+
+ this.readers.sort((a, b) => {
+ return a.reader_id > b.reader_id ? 1 : -1;
+ });
+
+ this.loading = false;
+ }
+
+ });
+ });
+ }
+
+ ngOnInit(): void {
+ this.getReadersData();
+
+ this.subscription = IntervalObservable.create(5000).subscribe(() => {
+ console.log("Reloading data...");
+ this.getReadersData();
+ });
+ }
+
+ ngOnDestroy(): void {
+ this.subscription.unsubscribe();
+ }
+
+ onClick(reader: Reader): void {
+ this.router.navigate(['/reader', reader.id]);
+ }
+
+ getReaderByID(id:number): Reader {
+ return this.readers.find((f) => {return f.id === id});
+ }
+
+}
\ No newline at end of file
diff --git a/app/pages/user/form/edit-user-form.component.html b/app/pages/user/form/edit-user-form.component.html
new file mode 100644
index 0000000..e2795b5
--- /dev/null
+++ b/app/pages/user/form/edit-user-form.component.html
@@ -0,0 +1,39 @@
+
+
+
+
+
diff --git a/app/pages/user/form/edit-user-form.component.js b/app/pages/user/form/edit-user-form.component.js
new file mode 100644
index 0000000..4e7fa85
--- /dev/null
+++ b/app/pages/user/form/edit-user-form.component.js
@@ -0,0 +1,47 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var user_class_1 = require("../../../classes/user.class");
+var data_service_1 = require("./../../../services/data.service");
+var EditUserFormComponent = (function () {
+ function EditUserFormComponent(data) {
+ this.data = data;
+ this.roles = ['Pilot', 'Student', 'Instructor'];
+ this.submitted = false;
+ }
+ EditUserFormComponent.prototype.ngOnInit = function () {
+ this.user = new user_class_1.User(this.model.id, this.model.name, this.model.card, this.model.role);
+ };
+ EditUserFormComponent.prototype.onSubmit = function () {
+ var _this = this;
+ this.model.name = this.user.name;
+ this.model.role = this.user.role;
+ this.submitted = true;
+ this.data.load().then(function () {
+ _this.data.editUser(_this.model).subscribe(function (b) { return _this.temp = JSON.stringify(b); });
+ console.log(_this.temp);
+ });
+ };
+ return EditUserFormComponent;
+}());
+__decorate([
+ core_1.Input(),
+ __metadata("design:type", user_class_1.User)
+], EditUserFormComponent.prototype, "model", void 0);
+EditUserFormComponent = __decorate([
+ core_1.Component({
+ selector: 'edit-user-form',
+ templateUrl: './edit-user-form.component.html'
+ }),
+ __metadata("design:paramtypes", [data_service_1.DataService])
+], EditUserFormComponent);
+exports.EditUserFormComponent = EditUserFormComponent;
+//# sourceMappingURL=edit-user-form.component.js.map
\ No newline at end of file
diff --git a/app/pages/user/form/edit-user-form.component.js.map b/app/pages/user/form/edit-user-form.component.js.map
new file mode 100644
index 0000000..8db73c4
--- /dev/null
+++ b/app/pages/user/form/edit-user-form.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"edit-user-form.component.js","sourceRoot":"","sources":["edit-user-form.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAAuD;AACvD,0DAAiD;AACjD,iEAA6D;AAQ7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Y,sDAAqB"}
\ No newline at end of file
diff --git a/app/pages/user/form/edit-user-form.component.ts b/app/pages/user/form/edit-user-form.component.ts
new file mode 100644
index 0000000..b9965df
--- /dev/null
+++ b/app/pages/user/form/edit-user-form.component.ts
@@ -0,0 +1,42 @@
+import {Component, Input, OnInit} from '@angular/core';
+import {User} from "../../../classes/user.class";
+import {DataService} from './../../../services/data.service';
+import {NgForm} from '@angular/forms';
+
+@Component({
+ selector: 'edit-user-form',
+ templateUrl: './edit-user-form.component.html'
+})
+
+export class EditUserFormComponent implements OnInit {
+
+ @Input()model:User;
+
+ user:User;
+
+ constructor(private data: DataService) {
+ }
+
+ temp: string;
+
+ roles = ['Pilot', 'Student', 'Instructor'];
+
+ submitted = false;
+
+ ngOnInit()
+ {
+ this.user = new User(this.model.id, this.model.name, this.model.card, this.model.role);
+ }
+
+ onSubmit() {
+
+ this.model.name = this.user.name;
+ this.model.role = this.user.role;
+
+ this.submitted = true;
+ this.data.load().then(() => {
+ this.data.editUser(this.model).subscribe(b => this.temp = JSON.stringify(b));
+ console.log(this.temp);
+ })
+ }
+}
diff --git a/app/pages/user/user.component.css b/app/pages/user/user.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/app/pages/user/user.component.html b/app/pages/user/user.component.html
new file mode 100644
index 0000000..86fb6c7
--- /dev/null
+++ b/app/pages/user/user.component.html
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+ Loading....
+ Error....
+
+
+
+ Name: {{user.name}}
+ Card: {{user.card}}
+ Role: {{user.role}}
+
+
+
+
diff --git a/app/pages/user/user.component.js b/app/pages/user/user.component.js
new file mode 100644
index 0000000..1370adc
--- /dev/null
+++ b/app/pages/user/user.component.js
@@ -0,0 +1,68 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var data_service_1 = require("./../../services/data.service");
+var IntervalObservable_1 = require("rxjs/observable/IntervalObservable");
+var user_class_1 = require("./../../classes/user.class");
+var router_1 = require("@angular/router");
+var UserComponent = (function () {
+ function UserComponent(route, data) {
+ this.route = route;
+ this.data = data;
+ this.loading = true;
+ this.error = false;
+ this.name = "Loading";
+ this.id = 0;
+ this.user = new user_class_1.User(0, "Loading", "Loading", "Loading");
+ }
+ UserComponent.prototype.getUser = function (id) {
+ var _this = this;
+ this.data.load().then(function () {
+ _this.data
+ .user(id)
+ .subscribe(function (b) {
+ var status = b.status_code;
+ if (status != 200 && b.data.length != 1) {
+ _this.loading = false;
+ _this.error = true;
+ }
+ else {
+ _this.user = user_class_1.User.toUser(b.data[0]);
+ _this.name = _this.user.name;
+ _this.loading = false;
+ }
+ });
+ });
+ };
+ UserComponent.prototype.ngOnInit = function () {
+ var _this = this;
+ this.id = this.route.snapshot.params['id'];
+ this.getUser(this.id);
+ this.subscription = IntervalObservable_1.IntervalObservable.create(5000).subscribe(function () {
+ console.log("Reloading data...");
+ _this.getUser(_this.id);
+ });
+ };
+ UserComponent.prototype.ngOnDestroy = function () {
+ this.subscription.unsubscribe();
+ };
+ return UserComponent;
+}());
+UserComponent = __decorate([
+ core_1.Component({
+ selector: 'app-user',
+ templateUrl: './user.component.html',
+ styleUrls: ['./user.component.css']
+ }),
+ __metadata("design:paramtypes", [router_1.ActivatedRoute, data_service_1.DataService])
+], UserComponent);
+exports.UserComponent = UserComponent;
+//# sourceMappingURL=user.component.js.map
\ No newline at end of file
diff --git a/app/pages/user/user.component.js.map b/app/pages/user/user.component.js.map
new file mode 100644
index 0000000..426515e
--- /dev/null
+++ b/app/pages/user/user.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"user.component.js","sourceRoot":"","sources":["user.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA6D;AAC7D,8DAA4D;AAC5D,yEAAwE;AAIxE,yDAAkD;AAClD,0CAAyD;AASzD,IAAa,aAAa;IAWzB,uBAAoB,KAAqB,EAAU,IAAgB;QAA/C,UAAK,GAAL,KAAK,CAAgB;QAAU,SAAI,GAAJ,IAAI,CAAY;QATnE,YAAO,GAAW,IAAI,CAAC;QACvB,UAAK,GAAW,KAAK,CAAC;QACtB,SAAI,GAAU,SAAS,CAAC;QACxB,OAAE,GAAU,CAAC,CAAC;QAEP,SAAI,GAAQ,IAAI,iBAAI,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAIK,CAAC;IAGtE,+BAAO,GAAP,UAAQ,EAAS;QAAjB,iBAsBC;QArBA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YACrB,KAAI,CAAC,IAAI;iBACH,IAAI,CAAC,EAAE,CAAC;iBACR,SAAS,CAAC,UAAA,CAAC;gBAEX,IAAI,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC;gBAE3B,EAAE,CAAA,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CACvC,CAAC;oBACA,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;oBACrB,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;gBACnB,CAAC;gBACD,IAAI,CAAA,CAAC;oBAEJ,KAAI,CAAC,IAAI,GAAG,iBAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBACnC,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,IAAI,CAAC,IAAI,CAAC;oBAC3B,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;gBACtB,CAAC;YAEF,CAAC,CAAC,CAAC;QACT,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,gCAAQ,GAAR;QAAA,iBASC;QARA,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAExC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEnB,IAAI,CAAC,YAAY,GAAG,uCAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YAC9B,KAAI,CAAC,OAAO,CAAC,KAAI,CAAC,EAAE,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACV,CAAC;IAED,mCAAW,GAAX;QACI,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAEF,oBAAC;AAAD,CAAC,AArDD,IAqDC;AArDY,aAAa;IANzB,gBAAS,CAAC;QACT,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,uBAAuB;QACpC,SAAS,EAAE,CAAC,sBAAsB,CAAC;KACpC,CAAC;qCAa0B,uBAAc,EAAe,0BAAW;GAXvD,aAAa,CAqDzB;AArDY,sCAAa"}
\ No newline at end of file
diff --git a/app/pages/user/user.component.ts b/app/pages/user/user.component.ts
new file mode 100644
index 0000000..caec0b7
--- /dev/null
+++ b/app/pages/user/user.component.ts
@@ -0,0 +1,70 @@
+import { Component, OnInit, OnDestroy } from '@angular/core';
+import { DataService } from './../../services/data.service';
+import { IntervalObservable } from 'rxjs/observable/IntervalObservable';
+import { Subscription } from 'rxjs/Subscription';
+
+
+import { User } from "./../../classes/user.class";
+import { Params, ActivatedRoute } from '@angular/router';
+
+
+@Component({
+ selector: 'app-user',
+ templateUrl: './user.component.html',
+ styleUrls: ['./user.component.css']
+})
+
+export class UserComponent implements OnInit, OnDestroy {
+
+ loading:boolean = true;
+ error:boolean = false;
+ name:string = "Loading";
+ id:number = 0;
+
+ public user:User = new User(0, "Loading", "Loading", "Loading");
+
+ public subscription:Subscription;
+
+ constructor(private route: ActivatedRoute, private data:DataService){}
+
+
+ getUser(id:number): void {
+ this.data.load().then(()=> {
+ this.data
+ .user(id)
+ .subscribe(b => {
+
+ var status = b.status_code;
+
+ if(status != 200 && b.data.length != 1)
+ {
+ this.loading = false;
+ this.error = true;
+ }
+ else{
+
+ this.user = User.toUser(b.data[0]);
+ this.name = this.user.name;
+ this.loading = false;
+ }
+
+ });
+ });
+ }
+
+ ngOnInit(): void {
+ this.id = this.route.snapshot.params['id'];
+
+ this.getUser(this.id);
+
+ this.subscription = IntervalObservable.create(5000).subscribe(() => {
+ console.log("Reloading data...");
+ this.getUser(this.id);
+ });
+ }
+
+ ngOnDestroy(): void {
+ this.subscription.unsubscribe();
+ }
+
+}
\ No newline at end of file
diff --git a/app/pages/users/form/user-form.component.html b/app/pages/users/form/user-form.component.html
new file mode 100644
index 0000000..87936f7
--- /dev/null
+++ b/app/pages/users/form/user-form.component.html
@@ -0,0 +1,47 @@
+
+
+
+
+
diff --git a/app/pages/users/form/user-form.component.js b/app/pages/users/form/user-form.component.js
new file mode 100644
index 0000000..054c1fc
--- /dev/null
+++ b/app/pages/users/form/user-form.component.js
@@ -0,0 +1,38 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var user_class_1 = require("../../../classes/user.class");
+var data_service_1 = require("./../../../services/data.service");
+var UserFormComponent = (function () {
+ function UserFormComponent(data) {
+ this.data = data;
+ this.roles = ['Pilot', 'Student', 'Instructor'];
+ this.model = new user_class_1.User(0, "", "", this.roles[0]);
+ this.submitted = false;
+ }
+ UserFormComponent.prototype.onSubmit = function () {
+ var _this = this;
+ this.submitted = true;
+ this.data.load().then(function () {
+ _this.data.postUser(_this.model).subscribe(function (b) { return _this.temp = JSON.stringify(b); });
+ });
+ };
+ return UserFormComponent;
+}());
+UserFormComponent = __decorate([
+ core_1.Component({
+ selector: 'user-form',
+ templateUrl: './user-form.component.html'
+ }),
+ __metadata("design:paramtypes", [data_service_1.DataService])
+], UserFormComponent);
+exports.UserFormComponent = UserFormComponent;
+//# sourceMappingURL=user-form.component.js.map
\ No newline at end of file
diff --git a/app/pages/users/form/user-form.component.js.map b/app/pages/users/form/user-form.component.js.map
new file mode 100644
index 0000000..07a26d9
--- /dev/null
+++ b/app/pages/users/form/user-form.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"user-form.component.js","sourceRoot":"","sources":["user-form.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAAwC;AACxC,0DAAiD;AACjD,iEAA6D;AAO7D,IAAa,iBAAiB;IAE5B,2BAAoB,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;QAKrC,UAAK,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;QAE3C,UAAK,GAAG,IAAI,iBAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAE3C,cAAS,GAAG,KAAK,CAAC;IARlB,CAAC;IAUD,oCAAQ,GAAR;QAAA,iBAKC;QAJC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YACpB,KAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAA7B,CAA6B,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAA;IACJ,CAAC;IACH,wBAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBY,iBAAiB;IAL7B,gBAAS,CAAC;QACT,QAAQ,EAAE,WAAW;QACrB,WAAW,EAAE,4BAA4B;KAC1C,CAAC;qCAI0B,0BAAW;GAF1B,iBAAiB,CAmB7B;AAnBY,8CAAiB"}
\ No newline at end of file
diff --git a/app/pages/users/form/user-form.component.ts b/app/pages/users/form/user-form.component.ts
new file mode 100644
index 0000000..fbeb29c
--- /dev/null
+++ b/app/pages/users/form/user-form.component.ts
@@ -0,0 +1,29 @@
+import {Component} from '@angular/core';
+import {User} from "../../../classes/user.class";
+import {DataService} from './../../../services/data.service';
+
+@Component({
+ selector: 'user-form',
+ templateUrl: './user-form.component.html'
+})
+
+export class UserFormComponent {
+
+ constructor(private data: DataService) {
+ }
+
+ temp: string;
+
+ roles = ['Pilot', 'Student', 'Instructor'];
+
+ model = new User(0, "", "", this.roles[0]);
+
+ submitted = false;
+
+ onSubmit() {
+ this.submitted = true;
+ this.data.load().then(() => {
+ this.data.postUser(this.model).subscribe(b => this.temp = JSON.stringify(b));
+ })
+ }
+}
diff --git a/app/pages/users/users.component.css b/app/pages/users/users.component.css
new file mode 100644
index 0000000..ee23c1b
--- /dev/null
+++ b/app/pages/users/users.component.css
@@ -0,0 +1,7 @@
+.user {
+ cursor: pointer;
+}
+
+.anon {
+ background-color: #EEAAAA;
+}
\ No newline at end of file
diff --git a/app/pages/users/users.component.html b/app/pages/users/users.component.html
new file mode 100644
index 0000000..7f57f5a
--- /dev/null
+++ b/app/pages/users/users.component.html
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Loading....
+ Error....
+
+
+
+
+
+
+
+
{{user.name}}
+ {{user.card}}
+ {{user.role}}
+
+
+
+
+
+
+
diff --git a/app/pages/users/users.component.js b/app/pages/users/users.component.js
new file mode 100644
index 0000000..54bfa7b
--- /dev/null
+++ b/app/pages/users/users.component.js
@@ -0,0 +1,87 @@
+"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);
+};
+var core_1 = require("@angular/core");
+var data_service_1 = require("./../../services/data.service");
+var router_1 = require("@angular/router");
+var IntervalObservable_1 = require("rxjs/observable/IntervalObservable");
+var user_class_1 = require("./../../classes/user.class");
+var UsersComponent = (function () {
+ function UsersComponent(router, data) {
+ this.router = router;
+ this.data = data;
+ this.loading = true;
+ this.error = false;
+ this.users = new Array();
+ }
+ UsersComponent.prototype.getUsersData = function () {
+ var _this = this;
+ this.data.load().then(function () {
+ _this.data
+ .users()
+ .subscribe(function (response) {
+ var status = response.status_code;
+ if (status != 200) {
+ _this.loading = false;
+ _this.error = true;
+ }
+ else {
+ for (var i = 0; i < response.data.length; i++) {
+ var temp = user_class_1.User.toUser(response.data[i]);
+ var user = _this.getUserByID(temp.id);
+ if (user) {
+ if (!temp.equals(user)) {
+ // push new one, delete old
+ var index = _this.users.indexOf(user);
+ _this.users.splice(index, 1);
+ _this.users.push(temp);
+ }
+ }
+ else {
+ _this.users.push(temp);
+ }
+ }
+ _this.users.sort(function (a, b) {
+ return a.name > b.name ? 1 : -1;
+ });
+ _this.loading = false;
+ }
+ });
+ });
+ };
+ UsersComponent.prototype.ngOnInit = function () {
+ var _this = this;
+ this.getUsersData();
+ this.subscription = IntervalObservable_1.IntervalObservable.create(5000).subscribe(function () {
+ console.log("Reloading data...");
+ _this.getUsersData();
+ });
+ };
+ UsersComponent.prototype.ngOnDestroy = function () {
+ this.subscription.unsubscribe();
+ };
+ UsersComponent.prototype.onClick = function (user) {
+ this.router.navigate(['/user', user.id]);
+ };
+ UsersComponent.prototype.getUserByID = function (id) {
+ return this.users.find(function (f) { return f.id === id; });
+ };
+ return UsersComponent;
+}());
+UsersComponent = __decorate([
+ core_1.Component({
+ selector: 'app-users',
+ templateUrl: './users.component.html',
+ styleUrls: ['./users.component.css']
+ }),
+ __metadata("design:paramtypes", [router_1.Router, data_service_1.DataService])
+], UsersComponent);
+exports.UsersComponent = UsersComponent;
+//# sourceMappingURL=users.component.js.map
\ No newline at end of file
diff --git a/app/pages/users/users.component.js.map b/app/pages/users/users.component.js.map
new file mode 100644
index 0000000..a9ee0d3
--- /dev/null
+++ b/app/pages/users/users.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"users.component.js","sourceRoot":"","sources":["users.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA6D;AAC7D,8DAA4D;AAC5D,0CAAyC;AACzC,yEAAwE;AAGxE,yDAAkD;AAQlD,IAAa,cAAc;IAS1B,wBAAoB,MAAc,EAAU,IAAgB;QAAxC,WAAM,GAAN,MAAM,CAAQ;QAAU,SAAI,GAAJ,IAAI,CAAY;QAP5D,YAAO,GAAW,IAAI,CAAC;QACvB,UAAK,GAAW,KAAK,CAAC;QAEtB,UAAK,GAAe,IAAI,KAAK,EAAQ,CAAC;IAIwB,CAAC;IAE/D,qCAAY,GAAZ;QAAA,iBA4CC;QA3CA,IAAI,CAAC,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BACpB,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;oBACjC,CAAC,CAAC,CAAC;oBAEH,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;gBACtB,CAAC;YAEF,CAAC,CAAC,CAAC;QACT,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,iCAAQ,GAAR;QAAA,iBAOC;QANG,IAAI,CAAC,YAAY,EAAE,CAAC;QAEjB,IAAI,CAAC,YAAY,GAAG,uCAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YAC9B,KAAI,CAAC,YAAY,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;IACV,CAAC;IAED,oCAAW,GAAX;QACI,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAED,gCAAO,GAAP,UAAQ,IAAU;QACb,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,oCAAW,GAAX,UAAY,EAAS;QACvB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAC,CAAC,IAAM,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAA,CAAA,CAAC,CAAC,CAAC;IACrD,CAAC;IAEF,qBAAC;AAAD,CAAC,AA9ED,IA8EC;AA9EY,cAAc;IAN1B,gBAAS,CAAC;QACT,QAAQ,EAAE,WAAW;QACrB,WAAW,EAAE,wBAAwB;QACrC,SAAS,EAAE,CAAC,uBAAuB,CAAC;KACrC,CAAC;qCAW2B,eAAM,EAAe,0BAAW;GAThD,cAAc,CA8E1B;AA9EY,wCAAc"}
\ No newline at end of file
diff --git a/app/pages/users/users.component.ts b/app/pages/users/users.component.ts
new file mode 100644
index 0000000..b8bbcf4
--- /dev/null
+++ b/app/pages/users/users.component.ts
@@ -0,0 +1,93 @@
+import { Component, OnInit, OnDestroy } from '@angular/core';
+import { DataService } from './../../services/data.service';
+import { Router } from '@angular/router';
+import { IntervalObservable } from 'rxjs/observable/IntervalObservable';
+import { Subscription } from 'rxjs/Subscription';
+
+import { User } from "./../../classes/user.class";
+
+@Component({
+ selector: 'app-users',
+ templateUrl: './users.component.html',
+ styleUrls: ['./users.component.css']
+})
+
+export class UsersComponent implements OnInit, OnDestroy {
+
+ loading:boolean = true;
+ error:boolean = false;
+
+ users:Array = new Array();
+
+ public subscription:Subscription;
+
+ constructor(private router: Router, private data:DataService){}
+
+ getUsersData(): void {
+ this.data.load().then(()=> {
+ this.data
+ .users()
+ .subscribe(response => {
+
+ var status = response.status_code;
+
+ if(status != 200)
+ {
+ this.loading = false;
+ this.error = true;
+ }
+ else{
+
+ for(let i = 0; i < response.data.length; i++)
+ {
+ var temp:User = User.toUser(response.data[i]);
+ var user:User = this.getUserByID(temp.id);
+
+ if(user)
+ {
+ if(!temp.equals(user))
+ {
+ // push new one, delete old
+ var index = this.users.indexOf(user);
+ this.users.splice(index, 1);
+ this.users.push(temp);
+ }
+ } else {
+ this.users.push(temp);
+ }
+
+ }
+
+ this.users.sort((a, b) => {
+ return a.name > b.name ? 1 : -1;
+ });
+
+ this.loading = false;
+ }
+
+ });
+ });
+ }
+
+ ngOnInit(): void {
+ this.getUsersData();
+
+ this.subscription = IntervalObservable.create(5000).subscribe(() => {
+ console.log("Reloading data...");
+ this.getUsersData();
+ });
+ }
+
+ ngOnDestroy(): void {
+ this.subscription.unsubscribe();
+ }
+
+ onClick(user: User): void {
+ this.router.navigate(['/user', user.id]);
+ }
+
+ getUserByID(id:number): User {
+ return this.users.find((f) => {return f.id === id});
+ }
+
+}
\ No newline at end of file
diff --git a/app/services/data.service.js b/app/services/data.service.js
new file mode 100644
index 0000000..673c219
--- /dev/null
+++ b/app/services/data.service.js
@@ -0,0 +1,108 @@
+"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);
+};
+var core_1 = require("@angular/core");
+require("rxjs/add/operator/map");
+var http_1 = require("@angular/http");
+var DataService = (function () {
+ function DataService(http) {
+ this.http = http;
+ this.url = "";
+ }
+ DataService.prototype.load = function () {
+ var _this = this;
+ return new Promise(function (resolve, reject) {
+ if (_this.url != "") {
+ resolve();
+ }
+ else {
+ _this.http.get('/app/config/api.json').subscribe(function (res) {
+ var data = res.json();
+ _this.url = data.protocol + data.hostname + ":" + data.port + "/" + data.api;
+ console.log(_this.url);
+ resolve();
+ });
+ }
+ });
+ };
+ //FLIGHTS
+ DataService.prototype.flight = function (id) {
+ var flightdata = this.http.get(this.url + "/flights/" + id, { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return flightdata;
+ };
+ DataService.prototype.flights = function () {
+ var flightdata = this.http.get(this.url + "/flights", { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return flightdata;
+ };
+ DataService.prototype.endFlight = function (id) {
+ var flight = this.http.put(this.url + "/flights/" + id + "/stop", { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return flight;
+ };
+ //USERS
+ DataService.prototype.user = function (id) {
+ var usersdata = this.http.get(this.url + "/users/" + id, { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return usersdata;
+ };
+ DataService.prototype.users = function () {
+ var usersdata = this.http.get(this.url + "/users", { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return usersdata;
+ };
+ DataService.prototype.postUser = function (user) {
+ var userData = this.http.post(this.url + "/users", { name: user.name, cardId: user.card, role: user.role }, { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return userData;
+ };
+ DataService.prototype.editUser = function (user) {
+ var userData = this.http.put(this.url + "/users/" + user.id, { name: user.name, cardId: user.card, role: user.role }, { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return userData;
+ };
+ //READERS
+ DataService.prototype.reader = function (id) {
+ var readerData = this.http.get(this.url + "/readers/" + id, { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return readerData;
+ };
+ DataService.prototype.readers = function () {
+ var readersData = this.http.get(this.url + "/readers", { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return readersData;
+ };
+ DataService.prototype.editReader = function (reader) {
+ var readerData = this.http.put(this.url + "/readers/" + reader.id, { readerId: reader.reader_id, planeId: reader.plane.id }, { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return readerData;
+ };
+ //PLANES
+ DataService.prototype.plane = function (id) {
+ var planeData = this.http.get(this.url + "/planes/" + id, { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return planeData;
+ };
+ DataService.prototype.planes = function () {
+ var planesData = this.http.get(this.url + "/planes", { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return planesData;
+ };
+ DataService.prototype.postPlane = function (plane) {
+ var userData = this.http.post(this.url + "/planes", { name: plane.name, registration: plane.registration, model: plane.model, comment: plane.comment }, { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return userData;
+ };
+ DataService.prototype.editPlane = function (plane) {
+ var planeData = this.http.put(this.url + "/planes/" + plane.id, { name: plane.name, registration: plane.registration, model: plane.model, comment: plane.comment }, { headers: this.getHeaders() }).map(function (r) { return r.json(); });
+ return planeData;
+ };
+ //OTHER
+ DataService.prototype.getHeaders = function () {
+ var headers = new http_1.Headers();
+ headers.append('Accept', 'application/json');
+ return headers;
+ };
+ return DataService;
+}());
+DataService = __decorate([
+ core_1.Injectable(),
+ __metadata("design:paramtypes", [http_1.Http])
+], DataService);
+exports.DataService = DataService;
+//# sourceMappingURL=data.service.js.map
\ No newline at end of file
diff --git a/app/services/data.service.js.map b/app/services/data.service.js.map
new file mode 100644
index 0000000..d4f8f21
--- /dev/null
+++ b/app/services/data.service.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"data.service.js","sourceRoot":"","sources":["data.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA2C;AAE3C,iCAA8B;AAC9B,sCAAwD;AAQxD,IAAa,WAAW;IAItB,qBAAoB,IAAW;QAAX,SAAI,GAAJ,IAAI,CAAO;QAF/B,QAAG,GAAU,EAAE,CAAC;IAGhB,CAAC;IAED,0BAAI,GAAJ;QAAA,iBAoBC;QAlBA,MAAM,CAAC,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YAElC,EAAE,CAAA,CAAC,KAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAClB,CAAC;gBACA,OAAO,EAAE,CAAC;YACX,CAAC;YACD,IAAI,CACJ,CAAC;gBACA,KAAI,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,SAAS,CAAC,UAAC,GAAG;oBAClD,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;oBACrB,KAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;oBAC5E,OAAO,CAAC,GAAG,CAAC,KAAI,CAAC,GAAG,CAAC,CAAC;oBACtB,OAAO,EAAE,CAAC;gBACf,CAAC,CAAC,CAAC;YACF,CAAC;QAEF,CAAC,CAAC,CAAC;IAEJ,CAAC;IAGD,SAAS;IAET,4BAAM,GAAN,UAAO,EAAS;QACd,IAAI,UAAU,GAAG,IAAI,CAAC,I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,EAAR,CAAQ,CAAC,CAAC;QAChN,MAAM,CAAC,SAAS,CAAC;IACnB,CAAC;IAGD,OAAO;IAEC,gCAAU,GAAlB;QACE,IAAI,OAAO,GAAG,IAAI,cAAO,EAAE,CAAC;QAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC;IACjB,CAAC;IACH,kBAAC;AAAD,CAAC,AAvHD,IAuHC;AAvHY,WAAW;IADvB,iBAAU,EAAE;qCAKgB,WAAI;GAJpB,WAAW,CAuHvB;AAvHY,kCAAW"}
\ No newline at end of file
diff --git a/app/services/data.service.ts b/app/services/data.service.ts
new file mode 100644
index 0000000..1a09a28
--- /dev/null
+++ b/app/services/data.service.ts
@@ -0,0 +1,131 @@
+import { Injectable } from '@angular/core';
+import { Observable } from 'rxjs/Rx';
+import 'rxjs/add/operator/map'
+import { Http, Response, Headers } from '@angular/http';
+
+import { Flight } from './../classes/flight.class';
+import { User } from './../classes/user.class';
+import { Reader } from './../classes/reader.class';
+import { Plane } from './../classes/plane.class';
+
+@Injectable()
+export class DataService {
+
+ url:string = "";
+
+ constructor(private http : Http){
+ }
+
+ load() : Promise