From 2418284092485dd9ae695a269b50f6763863202c Mon Sep 17 00:00:00 2001 From: kennyboy55 Date: Thu, 22 Jun 2017 14:00:00 +0200 Subject: [PATCH] Store in GIT --- app/app-routing.module.js | 43 ++++++ app/app-routing.module.js.map | 1 + app/app-routing.module.ts | 32 +++++ app/app.component.css | 0 app/app.component.html | 28 ++++ app/app.component.js | 24 ++++ app/app.component.js.map | 1 + app/app.component.spec.js | 27 ++++ app/app.component.spec.js.map | 1 + app/app.component.spec.ts | 33 +++++ app/app.component.spec.ts:Zone.Identifier | Bin 0 -> 25 bytes app/app.component.ts | 9 ++ app/app.module.js | 65 +++++++++ app/app.module.js.map | 1 + app/app.module.ts | 58 ++++++++ app/classes/flight.class.js | 43 ++++++ app/classes/flight.class.js.map | 1 + app/classes/flight.class.ts | 73 ++++++++++ app/classes/plane.class.js | 34 +++++ app/classes/plane.class.js.map | 1 + app/classes/plane.class.ts | 52 +++++++ app/classes/reader.class.js | 36 +++++ app/classes/reader.class.js.map | 1 + app/classes/reader.class.ts | 53 +++++++ app/classes/user.class.js | 33 +++++ app/classes/user.class.js.map | 1 + app/classes/user.class.ts | 49 +++++++ app/config/api.json | 6 + app/pages/dashboard/dashboard.component.css | 0 app/pages/dashboard/dashboard.component.html | 9 ++ app/pages/dashboard/dashboard.component.js | 22 +++ .../dashboard/dashboard.component.js.map | 1 + app/pages/dashboard/dashboard.component.ts | 9 ++ app/pages/flight/flight.component.css | 3 + app/pages/flight/flight.component.html | 52 +++++++ app/pages/flight/flight.component.js | 84 +++++++++++ app/pages/flight/flight.component.js.map | 1 + app/pages/flight/flight.component.ts | 86 ++++++++++++ app/pages/flights/flights.component.css | 11 ++ app/pages/flights/flights.component.html | 30 ++++ app/pages/flights/flights.component.js | 87 ++++++++++++ app/pages/flights/flights.component.js.map | 1 + app/pages/flights/flights.component.ts | 95 +++++++++++++ .../plane/form/edit-plane-form.component.html | 51 +++++++ .../plane/form/edit-plane-form.component.js | 48 +++++++ .../form/edit-plane-form.component.js.map | 1 + .../plane/form/edit-plane-form.component.ts | 40 ++++++ app/pages/plane/plane.component.css | 0 app/pages/plane/plane.component.html | 21 +++ app/pages/plane/plane.component.js | 68 +++++++++ app/pages/plane/plane.component.js.map | 1 + app/pages/plane/plane.component.ts | 69 +++++++++ .../planes/form/plane-form.component.html | 50 +++++++ app/pages/planes/form/plane-form.component.js | 38 +++++ .../planes/form/plane-form.component.js.map | 1 + app/pages/planes/form/plane-form.component.ts | 30 ++++ app/pages/planes/planes.component.css | 3 + app/pages/planes/planes.component.html | 35 +++++ app/pages/planes/planes.component.js | 88 ++++++++++++ app/pages/planes/planes.component.js.map | 1 + app/pages/planes/planes.component.ts | 96 +++++++++++++ .../form/edit-reader-form.component.html | 32 +++++ .../reader/form/edit-reader-form.component.js | 59 ++++++++ .../form/edit-reader-form.component.js.map | 1 + .../reader/form/edit-reader-form.component.ts | 59 ++++++++ app/pages/reader/reader.component.css | 3 + app/pages/reader/reader.component.html | 36 +++++ app/pages/reader/reader.component.js | 72 ++++++++++ app/pages/reader/reader.component.js.map | 1 + app/pages/reader/reader.component.ts | 74 ++++++++++ app/pages/readers/readers.component.css | 7 + app/pages/readers/readers.component.html | 33 +++++ app/pages/readers/readers.component.js | 87 ++++++++++++ app/pages/readers/readers.component.js.map | 1 + app/pages/readers/readers.component.ts | 93 +++++++++++++ .../user/form/edit-user-form.component.html | 39 ++++++ .../user/form/edit-user-form.component.js | 47 +++++++ .../user/form/edit-user-form.component.js.map | 1 + .../user/form/edit-user-form.component.ts | 42 ++++++ app/pages/user/user.component.css | 0 app/pages/user/user.component.html | 21 +++ app/pages/user/user.component.js | 68 +++++++++ app/pages/user/user.component.js.map | 1 + app/pages/user/user.component.ts | 70 ++++++++++ app/pages/users/form/user-form.component.html | 47 +++++++ app/pages/users/form/user-form.component.js | 38 +++++ .../users/form/user-form.component.js.map | 1 + app/pages/users/form/user-form.component.ts | 29 ++++ app/pages/users/users.component.css | 7 + app/pages/users/users.component.html | 35 +++++ app/pages/users/users.component.js | 87 ++++++++++++ app/pages/users/users.component.js.map | 1 + app/pages/users/users.component.ts | 93 +++++++++++++ app/services/data.service.js | 108 +++++++++++++++ app/services/data.service.js.map | 1 + app/services/data.service.ts | 131 ++++++++++++++++++ favicon.ico | Bin 0 -> 5430 bytes favicon.ico:Zone.Identifier | Bin 0 -> 25 bytes forms.css | 6 + index.html | 59 ++++++++ main.js | 5 + main.js.map | 1 + main.ts | 5 + main.ts:Zone.Identifier | Bin 0 -> 25 bytes styles.css | 5 + styles.css:Zone.Identifier | Bin 0 -> 25 bytes systemjs-angular-loader.js | 49 +++++++ systemjs-angular-loader.js:Zone.Identifier | Bin 0 -> 25 bytes systemjs.config.extras.js | 11 ++ systemjs.config.extras.js:Zone.Identifier | Bin 0 -> 25 bytes systemjs.config.js | 45 ++++++ systemjs.config.js:Zone.Identifier | Bin 0 -> 25 bytes tsconfig.json | 13 ++ tsconfig.json:Zone.Identifier | Bin 0 -> 25 bytes typings.d.ts | 4 + 115 files changed, 3466 insertions(+) create mode 100644 app/app-routing.module.js create mode 100644 app/app-routing.module.js.map create mode 100644 app/app-routing.module.ts create mode 100644 app/app.component.css create mode 100644 app/app.component.html create mode 100644 app/app.component.js create mode 100644 app/app.component.js.map create mode 100644 app/app.component.spec.js create mode 100644 app/app.component.spec.js.map create mode 100644 app/app.component.spec.ts create mode 100644 app/app.component.spec.ts:Zone.Identifier create mode 100644 app/app.component.ts create mode 100644 app/app.module.js create mode 100644 app/app.module.js.map create mode 100644 app/app.module.ts create mode 100644 app/classes/flight.class.js create mode 100644 app/classes/flight.class.js.map create mode 100644 app/classes/flight.class.ts create mode 100644 app/classes/plane.class.js create mode 100644 app/classes/plane.class.js.map create mode 100644 app/classes/plane.class.ts create mode 100644 app/classes/reader.class.js create mode 100644 app/classes/reader.class.js.map create mode 100644 app/classes/reader.class.ts create mode 100644 app/classes/user.class.js create mode 100644 app/classes/user.class.js.map create mode 100644 app/classes/user.class.ts create mode 100644 app/config/api.json create mode 100644 app/pages/dashboard/dashboard.component.css create mode 100644 app/pages/dashboard/dashboard.component.html create mode 100644 app/pages/dashboard/dashboard.component.js create mode 100644 app/pages/dashboard/dashboard.component.js.map create mode 100644 app/pages/dashboard/dashboard.component.ts create mode 100644 app/pages/flight/flight.component.css create mode 100644 app/pages/flight/flight.component.html create mode 100644 app/pages/flight/flight.component.js create mode 100644 app/pages/flight/flight.component.js.map create mode 100644 app/pages/flight/flight.component.ts create mode 100644 app/pages/flights/flights.component.css create mode 100644 app/pages/flights/flights.component.html create mode 100644 app/pages/flights/flights.component.js create mode 100644 app/pages/flights/flights.component.js.map create mode 100644 app/pages/flights/flights.component.ts create mode 100644 app/pages/plane/form/edit-plane-form.component.html create mode 100644 app/pages/plane/form/edit-plane-form.component.js create mode 100644 app/pages/plane/form/edit-plane-form.component.js.map create mode 100644 app/pages/plane/form/edit-plane-form.component.ts create mode 100644 app/pages/plane/plane.component.css create mode 100644 app/pages/plane/plane.component.html create mode 100644 app/pages/plane/plane.component.js create mode 100644 app/pages/plane/plane.component.js.map create mode 100644 app/pages/plane/plane.component.ts create mode 100644 app/pages/planes/form/plane-form.component.html create mode 100644 app/pages/planes/form/plane-form.component.js create mode 100644 app/pages/planes/form/plane-form.component.js.map create mode 100644 app/pages/planes/form/plane-form.component.ts create mode 100644 app/pages/planes/planes.component.css create mode 100644 app/pages/planes/planes.component.html create mode 100644 app/pages/planes/planes.component.js create mode 100644 app/pages/planes/planes.component.js.map create mode 100644 app/pages/planes/planes.component.ts create mode 100644 app/pages/reader/form/edit-reader-form.component.html create mode 100644 app/pages/reader/form/edit-reader-form.component.js create mode 100644 app/pages/reader/form/edit-reader-form.component.js.map create mode 100644 app/pages/reader/form/edit-reader-form.component.ts create mode 100644 app/pages/reader/reader.component.css create mode 100644 app/pages/reader/reader.component.html create mode 100644 app/pages/reader/reader.component.js create mode 100644 app/pages/reader/reader.component.js.map create mode 100644 app/pages/reader/reader.component.ts create mode 100644 app/pages/readers/readers.component.css create mode 100644 app/pages/readers/readers.component.html create mode 100644 app/pages/readers/readers.component.js create mode 100644 app/pages/readers/readers.component.js.map create mode 100644 app/pages/readers/readers.component.ts create mode 100644 app/pages/user/form/edit-user-form.component.html create mode 100644 app/pages/user/form/edit-user-form.component.js create mode 100644 app/pages/user/form/edit-user-form.component.js.map create mode 100644 app/pages/user/form/edit-user-form.component.ts create mode 100644 app/pages/user/user.component.css create mode 100644 app/pages/user/user.component.html create mode 100644 app/pages/user/user.component.js create mode 100644 app/pages/user/user.component.js.map create mode 100644 app/pages/user/user.component.ts create mode 100644 app/pages/users/form/user-form.component.html create mode 100644 app/pages/users/form/user-form.component.js create mode 100644 app/pages/users/form/user-form.component.js.map create mode 100644 app/pages/users/form/user-form.component.ts create mode 100644 app/pages/users/users.component.css create mode 100644 app/pages/users/users.component.html create mode 100644 app/pages/users/users.component.js create mode 100644 app/pages/users/users.component.js.map create mode 100644 app/pages/users/users.component.ts create mode 100644 app/services/data.service.js create mode 100644 app/services/data.service.js.map create mode 100644 app/services/data.service.ts create mode 100644 favicon.ico create mode 100644 favicon.ico:Zone.Identifier create mode 100644 forms.css create mode 100644 index.html create mode 100644 main.js create mode 100644 main.js.map create mode 100644 main.ts create mode 100644 main.ts:Zone.Identifier create mode 100644 styles.css create mode 100644 styles.css:Zone.Identifier create mode 100644 systemjs-angular-loader.js create mode 100644 systemjs-angular-loader.js:Zone.Identifier create mode 100644 systemjs.config.extras.js create mode 100644 systemjs.config.extras.js:Zone.Identifier create mode 100644 systemjs.config.js create mode 100644 systemjs.config.js:Zone.Identifier create mode 100644 tsconfig.json create mode 100644 tsconfig.json:Zone.Identifier create mode 100644 typings.d.ts diff --git a/app/app-routing.module.js b/app/app-routing.module.js new file mode 100644 index 0000000..35c84d3 --- /dev/null +++ b/app/app-routing.module.js @@ -0,0 +1,43 @@ +"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 core_1 = require("@angular/core"); +var router_1 = require("@angular/router"); +var dashboard_component_1 = require("./pages/dashboard/dashboard.component"); +var flights_component_1 = require("./pages/flights/flights.component"); +var users_component_1 = require("./pages/users/users.component"); +var readers_component_1 = require("./pages/readers/readers.component"); +var planes_component_1 = require("./pages/planes/planes.component"); +var flight_component_1 = require("./pages/flight/flight.component"); +var user_component_1 = require("./pages/user/user.component"); +var reader_component_1 = require("./pages/reader/reader.component"); +var plane_component_1 = require("./pages/plane/plane.component"); +var routes = [ + { path: '', redirectTo: '/dashboard', pathMatch: 'full' }, + { path: 'dashboard', component: dashboard_component_1.DashboardComponent }, + { path: 'flights', component: flights_component_1.FlightsComponent }, + { path: 'users', component: users_component_1.UsersComponent }, + { path: 'readers', component: readers_component_1.ReadersComponent }, + { path: 'planes', component: planes_component_1.PlanesComponent }, + { path: 'flight/:id', component: flight_component_1.FlightComponent }, + { path: 'user/:id', component: user_component_1.UserComponent }, + { path: 'reader/:id', component: reader_component_1.ReaderComponent }, + { path: 'plane/:id', component: plane_component_1.PlaneComponent } +]; +var AppRoutingModule = (function () { + function AppRoutingModule() { + } + return AppRoutingModule; +}()); +AppRoutingModule = __decorate([ + core_1.NgModule({ + imports: [router_1.RouterModule.forRoot(routes)], + exports: [router_1.RouterModule] + }) +], AppRoutingModule); +exports.AppRoutingModule = AppRoutingModule; +//# sourceMappingURL=app-routing.module.js.map \ No newline at end of file diff --git a/app/app-routing.module.js.map b/app/app-routing.module.js.map new file mode 100644 index 0000000..c66915a --- /dev/null +++ b/app/app-routing.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app-routing.module.js","sourceRoot":"","sources":["app-routing.module.ts"],"names":[],"mappings":";;;;;;;AAAA,sCAAqD;AACrD,0CAAuD;AACvD,6EAA2E;AAE3E,uEAAqE;AACrE,iEAA+D;AAC/D,uEAAqE;AACrE,oEAAkE;AAElE,oEAAkE;AAClE,8DAA4D;AAC5D,oEAAkE;AAClE,iEAA+D;AAG/D,IAAM,MAAM,GAAW;IACrB,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE;IACzD,EAAE,IAAI,EAAE,WAAW,EAAG,SAAS,EAAE,wCAAkB,EAAE;IACrD,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,oCAAgB,EAAE;IAChD,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,gCAAc,EAAC;IAC3C,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,oCAAgB,EAAC;IAC/C,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,kCAAe,EAAC;IAC7C,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,kCAAe,EAAC;IACjD,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,8BAAa,EAAC;IAC7C,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,kCAAe,EAAC;IACjD,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,gCAAc,EAAC;CAChD,CAAC;AAKF,IAAa,gBAAgB;IAA7B;IAA+B,CAAC;IAAD,uBAAC;AAAD,CAAC,AAAhC,IAAgC;AAAnB,gBAAgB;IAJ5B,eAAQ,CAAC;QACR,OAAO,EAAE,CAAE,qBAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAE;QACzC,OAAO,EAAE,CAAE,qBAAY,CAAE;KAC1B,CAAC;GACW,gBAAgB,CAAG;AAAnB,4CAAgB"} \ No newline at end of file diff --git a/app/app-routing.module.ts b/app/app-routing.module.ts new file mode 100644 index 0000000..5382d1b --- /dev/null +++ b/app/app-routing.module.ts @@ -0,0 +1,32 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { DashboardComponent } from './pages/dashboard/dashboard.component'; + +import { FlightsComponent } from './pages/flights/flights.component'; +import { UsersComponent } from './pages/users/users.component'; +import { ReadersComponent } from './pages/readers/readers.component'; +import { PlanesComponent } from './pages/planes/planes.component'; + +import { FlightComponent } from './pages/flight/flight.component'; +import { UserComponent } from './pages/user/user.component'; +import { ReaderComponent } from './pages/reader/reader.component'; +import { PlaneComponent } from './pages/plane/plane.component'; + + +const routes: Routes = [ + { path: '', redirectTo: '/dashboard', pathMatch: 'full' }, + { path: 'dashboard', component: DashboardComponent }, + { path: 'flights', component: FlightsComponent }, + { path: 'users', component: UsersComponent}, + { path: 'readers', component: ReadersComponent}, + { path: 'planes', component: PlanesComponent}, + { path: 'flight/:id', component: FlightComponent}, + { path: 'user/:id', component: UserComponent}, + { path: 'reader/:id', component: ReaderComponent}, + { path: 'plane/:id', component: PlaneComponent} +]; +@NgModule({ + imports: [ RouterModule.forRoot(routes) ], + exports: [ RouterModule ] +}) +export class AppRoutingModule {} \ No newline at end of file diff --git a/app/app.component.css b/app/app.component.css new file mode 100644 index 0000000..e69de29 diff --git a/app/app.component.html b/app/app.component.html new file mode 100644 index 0000000..911bfd1 --- /dev/null +++ b/app/app.component.html @@ -0,0 +1,28 @@ +
+ + + + + +
\ No newline at end of file diff --git a/app/app.component.js b/app/app.component.js new file mode 100644 index 0000000..7e3ff82 --- /dev/null +++ b/app/app.component.js @@ -0,0 +1,24 @@ +"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 core_1 = require("@angular/core"); +var AppComponent = (function () { + function AppComponent() { + this.abbreviation = 'F.R.A.U.D.S.'; + this.name = 'Flight Registration and Automated Unit Detection System'; + } + return AppComponent; +}()); +AppComponent = __decorate([ + core_1.Component({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.css'] + }) +], AppComponent); +exports.AppComponent = AppComponent; +//# sourceMappingURL=app.component.js.map \ No newline at end of file diff --git a/app/app.component.js.map b/app/app.component.js.map new file mode 100644 index 0000000..111dedd --- /dev/null +++ b/app/app.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.component.js","sourceRoot":"","sources":["app.component.ts"],"names":[],"mappings":";;;;;;;AAAA,sCAA0C;AAQ1C,IAAa,YAAY;IANzB;QAM6B,iBAAY,GAAG,cAAc,CAAC;QAAC,SAAI,GAAG,yDAAyD,CAAC;IAAC,CAAC;IAAD,mBAAC;AAAD,CAAC,AAA/H,IAA+H;AAAlH,YAAY;IANxB,gBAAS,CAAC;QACT,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,sBAAsB;QACnC,SAAS,EAAE,CAAC,qBAAqB,CAAC;KACnC,CAAC;GAEW,YAAY,CAAsG;AAAlH,oCAAY"} \ No newline at end of file diff --git a/app/app.component.spec.js b/app/app.component.spec.js new file mode 100644 index 0000000..5226c4f --- /dev/null +++ b/app/app.component.spec.js @@ -0,0 +1,27 @@ +"use strict"; +var app_component_1 = require("./app.component"); +var testing_1 = require("@angular/core/testing"); +var platform_browser_1 = require("@angular/platform-browser"); +describe('AppComponent', function () { + var de; + var comp; + var fixture; + beforeEach(testing_1.async(function () { + testing_1.TestBed.configureTestingModule({ + declarations: [app_component_1.AppComponent] + }) + .compileComponents(); + })); + beforeEach(function () { + fixture = testing_1.TestBed.createComponent(app_component_1.AppComponent); + comp = fixture.componentInstance; + de = fixture.debugElement.query(platform_browser_1.By.css('h1')); + }); + it('should create component', function () { return expect(comp).toBeDefined(); }); + it('should have expected

text', function () { + fixture.detectChanges(); + var h1 = de.nativeElement; + expect(h1.innerText).toMatch(/angular/i, '

should say something about "Angular"'); + }); +}); +//# sourceMappingURL=app.component.spec.js.map \ No newline at end of file diff --git a/app/app.component.spec.js.map b/app/app.component.spec.js.map new file mode 100644 index 0000000..e265cfa --- /dev/null +++ b/app/app.component.spec.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.component.spec.js","sourceRoot":"","sources":["app.component.spec.ts"],"names":[],"mappings":";AAAA,iDAA+C;AAE/C,iDAAyE;AACzE,8DAAyD;AAGzD,QAAQ,CAAC,cAAc,EAAE;IACvB,IAAI,EAAgB,CAAC;IACrB,IAAI,IAAkB,CAAC;IACvB,IAAI,OAAuC,CAAC;IAE5C,UAAU,CAAC,eAAK,CAAC;QACf,iBAAO,CAAC,sBAAsB,CAAC;YAC7B,YAAY,EAAE,CAAE,4BAAY,CAAE;SAC/B,CAAC;aACD,iBAAiB,EAAE,CAAC;IACvB,CAAC,CAAC,CAAC,CAAC;IAEJ,UAAU,CAAC;QACT,OAAO,GAAG,iBAAO,CAAC,eAAe,CAAC,4BAAY,CAAC,CAAC;QAChD,IAAI,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACjC,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,qBAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,cAAM,OAAA,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAA1B,CAA0B,CAAE,CAAC;IAEjE,EAAE,CAAC,gCAAgC,EAAE;QACnC,OAAO,CAAC,aAAa,EAAE,CAAC;QACxB,IAAM,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC;QAC5B,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAU,EACrC,2CAA2C,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/app/app.component.spec.ts b/app/app.component.spec.ts new file mode 100644 index 0000000..7769024 --- /dev/null +++ b/app/app.component.spec.ts @@ -0,0 +1,33 @@ +import { AppComponent } from './app.component'; + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { DebugElement } from '@angular/core'; + +describe('AppComponent', function () { + let de: DebugElement; + let comp: AppComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AppComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AppComponent); + comp = fixture.componentInstance; + de = fixture.debugElement.query(By.css('h1')); + }); + + it('should create component', () => expect(comp).toBeDefined() ); + + it('should have expected

text', () => { + fixture.detectChanges(); + const h1 = de.nativeElement; + expect(h1.innerText).toMatch(/angular/i, + '

should say something about "Angular"'); + }); +}); diff --git a/app/app.component.spec.ts:Zone.Identifier b/app/app.component.spec.ts:Zone.Identifier new file mode 100644 index 0000000000000000000000000000000000000000..d6c1ec682968c796b9f5e9e080cc6f674b57c766 GIT binary patch literal 25 dcma!!%Fjy;DN4*MPD?F{<>dl#JyUFr831@K2x= 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 platform_browser_1 = require("@angular/platform-browser"); +var core_1 = require("@angular/core"); +var forms_1 = require("@angular/forms"); +var http_1 = require("@angular/http"); +var app_routing_module_1 = require("./app-routing.module"); +var app_component_1 = require("./app.component"); +var dashboard_component_1 = require("./pages/dashboard/dashboard.component"); +var flights_component_1 = require("./pages/flights/flights.component"); +var flight_component_1 = require("./pages/flight/flight.component"); +var users_component_1 = require("./pages/users/users.component"); +var user_component_1 = require("./pages/user/user.component"); +var user_form_component_1 = require("./pages/users/form/user-form.component"); +var edit_user_form_component_1 = require("./pages/user/form/edit-user-form.component"); +var readers_component_1 = require("./pages/readers/readers.component"); +var reader_component_1 = require("./pages/reader/reader.component"); +var edit_reader_form_component_1 = require("./pages/reader/form/edit-reader-form.component"); +var planes_component_1 = require("./pages/planes/planes.component"); +var plane_component_1 = require("./pages/plane/plane.component"); +var plane_form_component_1 = require("./pages/planes/form/plane-form.component"); +var edit_plane_form_component_1 = require("./pages/plane/form/edit-plane-form.component"); +var data_service_1 = require("./services/data.service"); +var AppModule = (function () { + function AppModule() { + } + return AppModule; +}()); +AppModule = __decorate([ + core_1.NgModule({ + declarations: [ + app_component_1.AppComponent, + dashboard_component_1.DashboardComponent, + flights_component_1.FlightsComponent, + flight_component_1.FlightComponent, + users_component_1.UsersComponent, + user_component_1.UserComponent, + user_form_component_1.UserFormComponent, + edit_user_form_component_1.EditUserFormComponent, + readers_component_1.ReadersComponent, + reader_component_1.ReaderComponent, + edit_reader_form_component_1.EditReaderFormComponent, + planes_component_1.PlanesComponent, + plane_component_1.PlaneComponent, + plane_form_component_1.PlaneFormComponent, + edit_plane_form_component_1.EditPlaneFormComponent + ], + imports: [ + platform_browser_1.BrowserModule, + forms_1.FormsModule, + http_1.HttpModule, + app_routing_module_1.AppRoutingModule, + forms_1.FormsModule + ], + providers: [data_service_1.DataService], + bootstrap: [app_component_1.AppComponent] + }) +], AppModule); +exports.AppModule = AppModule; +//# sourceMappingURL=app.module.js.map \ No newline at end of file diff --git a/app/app.module.js.map b/app/app.module.js.map new file mode 100644 index 0000000..0adcee9 --- /dev/null +++ b/app/app.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.module.js","sourceRoot":"","sources":["app.module.ts"],"names":[],"mappings":";;;;;;;AAAA,8DAA0D;AAC1D,sCAAyC;AACzC,wCAA6C;AAC7C,sCAA2C;AAE3C,2DAAwD;AAExD,iDAA+C;AAC/C,6EAA2E;AAE3E,uEAAqE;AACrE,oEAAkE;AAElE,iEAA+D;AAC/D,8DAA4D;AAC5D,8EAA2E;AAC3E,uFAAmF;AAEnF,uEAAqE;AACrE,oEAAkE;AAClE,6FAAyF;AAEzF,oEAAkE;AAClE,iEAA+D;AAC/D,iFAA8E;AAC9E,0FAAsF;AAEtF,wDAAsD;AA8BtD,IAAa,SAAS;IAAtB;IAAyB,CAAC;IAAD,gBAAC;AAAD,CAAC,AAA1B,IAA0B;AAAb,SAAS;IA5BrB,eAAQ,CAAC;QACR,YAAY,EAAE;YACZ,4BAAY;YACZ,wCAAkB;YAClB,oCAAgB;YAChB,kCAAe;YACf,gCAAc;YACd,8BAAa;YACb,uCAAiB;YACjB,gDAAqB;YACrB,oCAAgB;YAChB,kCAAe;YACf,oDAAuB;YACvB,kCAAe;YACf,gCAAc;YACd,yCAAkB;YAClB,kDAAsB;SACvB;QACD,OAAO,EAAE;YACP,gCAAa;YACb,mBAAW;YACX,iBAAU;YACV,qCAAgB;YAChB,mBAAW;SACZ;QACD,SAAS,EAAE,CAAC,0BAAW,CAAC;QACxB,SAAS,EAAE,CAAC,4BAAY,CAAC;KAC1B,CAAC;GACW,SAAS,CAAI;AAAb,8BAAS"} \ No newline at end of file diff --git a/app/app.module.ts b/app/app.module.ts new file mode 100644 index 0000000..b578d8d --- /dev/null +++ b/app/app.module.ts @@ -0,0 +1,58 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { HttpModule } from '@angular/http'; + +import { AppRoutingModule } from './app-routing.module'; + +import { AppComponent } from './app.component'; +import { DashboardComponent } from './pages/dashboard/dashboard.component'; + +import { FlightsComponent } from './pages/flights/flights.component'; +import { FlightComponent } from './pages/flight/flight.component'; + +import { UsersComponent } from './pages/users/users.component'; +import { UserComponent } from './pages/user/user.component'; +import { UserFormComponent } from './pages/users/form/user-form.component'; +import { EditUserFormComponent } from './pages/user/form/edit-user-form.component'; + +import { ReadersComponent } from './pages/readers/readers.component'; +import { ReaderComponent } from './pages/reader/reader.component'; +import { EditReaderFormComponent } from './pages/reader/form/edit-reader-form.component'; + +import { PlanesComponent } from './pages/planes/planes.component'; +import { PlaneComponent } from './pages/plane/plane.component'; +import { PlaneFormComponent } from './pages/planes/form/plane-form.component'; +import { EditPlaneFormComponent } from './pages/plane/form/edit-plane-form.component'; + +import { DataService } from './services/data.service'; + +@NgModule({ + declarations: [ + AppComponent, + DashboardComponent, + FlightsComponent, + FlightComponent, + UsersComponent, + UserComponent, + UserFormComponent, + EditUserFormComponent, + ReadersComponent, + ReaderComponent, + EditReaderFormComponent, + PlanesComponent, + PlaneComponent, + PlaneFormComponent, + EditPlaneFormComponent + ], + imports: [ + BrowserModule, + FormsModule, + HttpModule, + AppRoutingModule, + FormsModule + ], + providers: [DataService], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/app/classes/flight.class.js b/app/classes/flight.class.js new file mode 100644 index 0000000..3dc4b98 --- /dev/null +++ b/app/classes/flight.class.js @@ -0,0 +1,43 @@ +"use strict"; +var user_class_1 = require("./user.class"); +var plane_class_1 = require("./plane.class"); +var Flight = (function () { + function Flight(id, flightday_id, starttime, endtime, type, comment, plane, users) { + this.id = id; + this.flightday_id = flightday_id; + this.plane = plane; + this.starttime = starttime; + this.endtime = endtime; + this.type = type; + this.comment = comment; + this.users = users; + } + Flight.prototype.equals = function (other) { + if (other) { + var keySet1 = Object.keys(this); + var keySet2 = Object.keys(other); + var j = 0; + var isTheSame = true; + for (j; j < keySet1.length; j++) { + if (this[keySet1[j]] !== other[keySet2[j]]) { + // Shit is not the same + isTheSame = false; + } + } + return isTheSame; + } + return false; + }; + Flight.toFlight = function (r) { + var users = new Array(); + var plane = plane_class_1.Plane.toPlane(r.PLANE); + for (var i = 0; i < r.USERS.length; i++) { + users.push(user_class_1.User.toUser(r.USERS[i])); + } + var flight = new Flight(r.ID, r.FLIGHTDAY_ID, r.DATETIME_START, r.DATETIME_END, r.TYPE, r.COMMENT, plane, users); + return flight; + }; + return Flight; +}()); +exports.Flight = Flight; +//# sourceMappingURL=flight.class.js.map \ No newline at end of file diff --git a/app/classes/flight.class.js.map b/app/classes/flight.class.js.map new file mode 100644 index 0000000..ba5e73f --- /dev/null +++ b/app/classes/flight.class.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flight.class.js","sourceRoot":"","sources":["flight.class.ts"],"names":[],"mappings":";AAAA,2CAAoC;AACpC,6CAAsC;AAEtC;IAWC,gBAAY,EAAS,EACpB,YAAmB,EACnB,SAAgB,EAChB,OAAc,EACd,IAAW,EACX,OAAc,EACd,KAAW,EACX,KAAiB;QAEjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;IAGM,uBAAM,GAAb,UAAc,KAAY;QAEzB,EAAE,CAAA,CAAC,KAAK,CAAC,CACR,CAAC;YACA,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChC,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAEjC,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,IAAI,SAAS,GAAG,IAAI,CAAC;YAErB,GAAG,CAAA,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAChC,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC5C,uBAAuB;oBACvB,SAAS,GAAG,KAAK,CAAC;gBACnB,CAAC;YACF,CAAC;YAED,MAAM,CAAC,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,CAAC,KAAK,CAAC;IACd,CAAC;IAEa,eAAQ,GAAtB,UAAuB,CAAK;QAE3B,IAAI,KAAK,GAAe,IAAI,KAAK,EAAQ,CAAC;QAE1C,IAAI,KAAK,GAAS,mBAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEvC,GAAG,CAAA,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EACtC,CAAC;YACA,KAAK,CAAC,IAAI,CAAC,iBAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,MAAM,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAEjH,MAAM,CAAC,MAAM,CAAC;IACjB,CAAC;IACF,aAAC;AAAD,CAAC,AArED,IAqEC;AArEY,wBAAM"} \ No newline at end of file diff --git a/app/classes/flight.class.ts b/app/classes/flight.class.ts new file mode 100644 index 0000000..e264480 --- /dev/null +++ b/app/classes/flight.class.ts @@ -0,0 +1,73 @@ +import { User } from './user.class'; +import { Plane } from './plane.class'; + +export class Flight { + id:number; + flightday_id:number; + starttime:string; + endtime:string; + type:string; + comment:string; + + plane:Plane + users:Array; + + constructor(id:number, + flightday_id:number, + starttime:string, + endtime:string, + type:string, + comment:string, + plane:Plane, + users:Array) + { + this.id = id; + this.flightday_id = flightday_id; + this.plane = plane; + this.starttime = starttime; + this.endtime = endtime; + this.type = type; + this.comment = comment; + this.users = users; + } + + + public equals(other:Flight) : boolean + { + if(other) + { + var keySet1 = Object.keys(this); + var keySet2 = Object.keys(other); + + var j = 0; + var isTheSame = true; + + for(j; j < keySet1.length; j++) { + if (this[keySet1[j]] !== other[keySet2[j]]) { + // Shit is not the same + isTheSame = false; + } + } + + return isTheSame; + } + + return false; + } + + public static toFlight(r:any): Flight + { + let users:Array = new Array(); + + let plane:Plane = Plane.toPlane(r.PLANE); + + for(let i = 0; i < r.USERS.length; i++) + { + users.push(User.toUser(r.USERS[i])); + } + + let flight = new Flight(r.ID, r.FLIGHTDAY_ID, r.DATETIME_START, r.DATETIME_END, r.TYPE, r.COMMENT, plane, users); + + return flight; + } +} \ No newline at end of file diff --git a/app/classes/plane.class.js b/app/classes/plane.class.js new file mode 100644 index 0000000..d9f1484 --- /dev/null +++ b/app/classes/plane.class.js @@ -0,0 +1,34 @@ +"use strict"; +var Plane = (function () { + function Plane(id, name, registration, model, comment) { + this.id = id; + this.name = name; + this.registration = registration; + this.model = model; + this.comment = comment; + } + Plane.prototype.equals = function (other) { + if (other) { + var keySet1 = Object.keys(this); + var keySet2 = Object.keys(other); + var j = 0; + var isTheSame = true; + for (j; j < keySet1.length; j++) { + if (this[keySet1[j]] !== other[keySet2[j]]) { + // Shit is not the same + isTheSame = false; + } + } + return isTheSame; + } + return false; + }; + Plane.toPlane = function (r) { + var plane = new Plane(r.ID, r.NAME, r.REGISTRATION, r.MODEL, r.COMMENT); + //console.log('Parsed plane:', plane); + return plane; + }; + return Plane; +}()); +exports.Plane = Plane; +//# sourceMappingURL=plane.class.js.map \ No newline at end of file diff --git a/app/classes/plane.class.js.map b/app/classes/plane.class.js.map new file mode 100644 index 0000000..5282dd9 --- /dev/null +++ b/app/classes/plane.class.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plane.class.js","sourceRoot":"","sources":["plane.class.ts"],"names":[],"mappings":";AAAA;IAQE,eAAY,EAAU,EACV,IAAY,EACZ,YAAmB,EACnB,KAAY,EACZ,OAAc;QAEzB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACZ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,sBAAM,GAAb,UAAc,KAAW;QAEvB,EAAE,CAAA,CAAC,KAAK,CAAC,CACP,CAAC;YACC,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChC,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAEjC,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,IAAI,SAAS,GAAG,IAAI,CAAC;YAErB,GAAG,CAAA,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/B,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC3C,uBAAuB;oBACvB,SAAS,GAAG,KAAK,CAAC;gBACpB,CAAC;YACH,CAAC;YAED,MAAM,CAAC,SAAS,CAAC;QACrB,CAAC;QAED,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;IAEa,aAAO,GAArB,UAAsB,CAAK;QAE3B,IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;QAExE,sCAAsC;QACtC,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;IACD,YAAC;AAAD,CAAC,AAnDD,IAmDC;AAnDY,sBAAK"} \ No newline at end of file diff --git a/app/classes/plane.class.ts b/app/classes/plane.class.ts new file mode 100644 index 0000000..ad7a4f1 --- /dev/null +++ b/app/classes/plane.class.ts @@ -0,0 +1,52 @@ +export class Plane { + + id:number; + name:string; + registration:string; + model:string; + comment:string; + + constructor(id: number, + name: string, + registration:string, + model:string, + comment:string) { + + this.id = id; + this.name = name; + this.registration = registration; + this.model = model; + this.comment = comment; + } + + public equals(other:Plane): boolean + { + if(other) + { + var keySet1 = Object.keys(this); + var keySet2 = Object.keys(other); + + var j = 0; + var isTheSame = true; + + for(j; j < keySet1.length; j++) { + if (this[keySet1[j]] !== other[keySet2[j]]) { + // Shit is not the same + isTheSame = false; + } + } + + return isTheSame; + } + + return false; + } + + public static toPlane(r:any): Plane{ + + let plane = new Plane(r.ID, r.NAME, r.REGISTRATION, r.MODEL, r.COMMENT); + + //console.log('Parsed plane:', plane); + return plane; +} +} diff --git a/app/classes/reader.class.js b/app/classes/reader.class.js new file mode 100644 index 0000000..c8526c4 --- /dev/null +++ b/app/classes/reader.class.js @@ -0,0 +1,36 @@ +"use strict"; +var plane_class_1 = require("./plane.class"); +var Reader = (function () { + function Reader(id, reader_id, plane) { + this.id = id; + this.reader_id = reader_id; + this.plane = plane; + } + Reader.prototype.equals = function (other) { + if (other) { + var keySet1 = Object.keys(this); + var keySet2 = Object.keys(other); + var j = 0; + var isTheSame = true; + for (j; j < keySet1.length; j++) { + if (this[keySet1[j]] !== other[keySet2[j]]) { + // Shit is not the same + isTheSame = false; + } + } + return isTheSame; + } + return false; + }; + Reader.toReader = function (r) { + var plane = null; + if (r.PLANE != null) + plane = plane_class_1.Plane.toPlane(r.PLANE); + var reader = new Reader(r.ID, r.READER_ID, plane); + //console.log('Parsed reader:', reader); + return reader; + }; + return Reader; +}()); +exports.Reader = Reader; +//# sourceMappingURL=reader.class.js.map \ No newline at end of file diff --git a/app/classes/reader.class.js.map b/app/classes/reader.class.js.map new file mode 100644 index 0000000..57ebecd --- /dev/null +++ b/app/classes/reader.class.js.map @@ -0,0 +1 @@ +{"version":3,"file":"reader.class.js","sourceRoot":"","sources":["reader.class.ts"],"names":[],"m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C;IAChB,CAAC;IACH,aAAC;AAAD,CAAC,AAlDD,IAkDC;AAlDY,wBAAM"} \ No newline at end of file diff --git a/app/classes/reader.class.ts b/app/classes/reader.class.ts new file mode 100644 index 0000000..db8beab --- /dev/null +++ b/app/classes/reader.class.ts @@ -0,0 +1,53 @@ +import { Plane } from './plane.class'; + +export class Reader { + + id:number; + reader_id:string; + plane:Plane; + + constructor(id: number, + reader_id: string, + plane:Plane) { + + this.id = id; + this.reader_id = reader_id; + this.plane = plane; + } + + public equals(other:Reader): boolean + { + if(other) + { + var keySet1 = Object.keys(this); + var keySet2 = Object.keys(other); + + var j = 0; + var isTheSame = true; + + for(j; j < keySet1.length; j++) { + if (this[keySet1[j]] !== other[keySet2[j]]) { + // Shit is not the same + isTheSame = false; + } + } + + return isTheSame; + } + + return false; + } + + public static toReader(r:any): Reader{ + + let plane:Plane = null; + + if(r.PLANE != null) + plane = Plane.toPlane(r.PLANE); + + let reader = new Reader(r.ID, r.READER_ID, plane) + + //console.log('Parsed reader:', reader); + return reader; + } +} diff --git a/app/classes/user.class.js b/app/classes/user.class.js new file mode 100644 index 0000000..a42dd3c --- /dev/null +++ b/app/classes/user.class.js @@ -0,0 +1,33 @@ +"use strict"; +var User = (function () { + function User(id, name, cardId, role) { + this.id = id; + this.name = name; + this.card = cardId; + this.role = role; + } + User.prototype.equals = function (other) { + if (other) { + var keySet1 = Object.keys(this); + var keySet2 = Object.keys(other); + var j = 0; + var isTheSame = true; + for (j; j < keySet1.length; j++) { + if (this[keySet1[j]] !== other[keySet2[j]]) { + // Shit is not the same + isTheSame = false; + } + } + return isTheSame; + } + return false; + }; + User.toUser = function (r) { + var user = new User(r.ID, r.NAME, r.CARD_ID, r.ROLE); + //console.log('Parsed user:', user); + return user; + }; + return User; +}()); +exports.User = User; +//# sourceMappingURL=user.class.js.map \ No newline at end of file diff --git a/app/classes/user.class.js.map b/app/classes/user.class.js.map new file mode 100644 index 0000000..59dc508 --- /dev/null +++ b/app/classes/user.class.js.map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AAC,AAhDD,IAgDC;AAhDY,oBAAI"} \ No newline at end of file diff --git a/app/classes/user.class.ts b/app/classes/user.class.ts new file mode 100644 index 0000000..d482cf9 --- /dev/null +++ b/app/classes/user.class.ts @@ -0,0 +1,49 @@ +export class User { + + id:number; + name:string; + card:string; + role:string; + + constructor(id: number, + name: string, + cardId: string, + role: string) { + + this.id = id; + this.name = name; + this.card = cardId; + this.role = role; + } + + public equals(other:User): boolean + { + if(other) + { + var keySet1 = Object.keys(this); + var keySet2 = Object.keys(other); + + var j = 0; + var isTheSame = true; + + for(j; j < keySet1.length; j++) { + if (this[keySet1[j]] !== other[keySet2[j]]) { + // Shit is not the same + isTheSame = false; + } + } + + return isTheSame; + } + + return false; + } + + public static toUser(r:any): User{ + + let user = new User(r.ID, r.NAME, r.CARD_ID, r.ROLE) + + //console.log('Parsed user:', user); + return user; +} +} diff --git a/app/config/api.json b/app/config/api.json new file mode 100644 index 0000000..45d0384 --- /dev/null +++ b/app/config/api.json @@ -0,0 +1,6 @@ +{ + "protocol": "http://", + "hostname": "192.168.1.195", + "port": "8080", + "api": "apiv1" +} diff --git a/app/pages/dashboard/dashboard.component.css b/app/pages/dashboard/dashboard.component.css new file mode 100644 index 0000000..e69de29 diff --git a/app/pages/dashboard/dashboard.component.html b/app/pages/dashboard/dashboard.component.html new file mode 100644 index 0000000..5b0b2b5 --- /dev/null +++ b/app/pages/dashboard/dashboard.component.html @@ -0,0 +1,9 @@ +
+ +
+ +
+ +
\ No newline at end of file diff --git a/app/pages/dashboard/dashboard.component.js b/app/pages/dashboard/dashboard.component.js new file mode 100644 index 0000000..defbfc8 --- /dev/null +++ b/app/pages/dashboard/dashboard.component.js @@ -0,0 +1,22 @@ +"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 core_1 = require("@angular/core"); +var DashboardComponent = (function () { + function DashboardComponent() { + } + return DashboardComponent; +}()); +DashboardComponent = __decorate([ + core_1.Component({ + selector: 'app-dashboard', + templateUrl: './dashboard.component.html', + styleUrls: ['./dashboard.component.css'] + }) +], DashboardComponent); +exports.DashboardComponent = DashboardComponent; +//# sourceMappingURL=dashboard.component.js.map \ No newline at end of file diff --git a/app/pages/dashboard/dashboard.component.js.map b/app/pages/dashboard/dashboard.component.js.map new file mode 100644 index 0000000..374dd9c --- /dev/null +++ b/app/pages/dashboard/dashboard.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dashboard.component.js","sourceRoot":"","sources":["dashboard.component.ts"],"names":[],"mappings":";;;;;;;AAAA,sCAA0C;AAQ1C,IAAa,kBAAkB;IAA/B;IAAoC,CAAC;IAAD,yBAAC;AAAD,CAAC,AAArC,IAAqC;AAAxB,kBAAkB;IAN9B,gBAAS,CAAC;QACT,QAAQ,EAAE,eAAe;QACzB,WAAW,EAAE,4BAA4B;QACzC,SAAS,EAAE,CAAC,2BAA2B,CAAC;KACzC,CAAC;GAEW,kBAAkB,CAAM;AAAxB,gDAAkB"} \ No newline at end of file diff --git a/app/pages/dashboard/dashboard.component.ts b/app/pages/dashboard/dashboard.component.ts new file mode 100644 index 0000000..c27426d --- /dev/null +++ b/app/pages/dashboard/dashboard.component.ts @@ -0,0 +1,9 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-dashboard', + templateUrl: './dashboard.component.html', + styleUrls: ['./dashboard.component.css'] +}) + +export class DashboardComponent { } diff --git a/app/pages/flight/flight.component.css b/app/pages/flight/flight.component.css new file mode 100644 index 0000000..2aec8dc --- /dev/null +++ b/app/pages/flight/flight.component.css @@ -0,0 +1,3 @@ +.user, .plane { + cursor: pointer; +} \ No newline at end of file diff --git a/app/pages/flight/flight.component.html b/app/pages/flight/flight.component.html new file mode 100644 index 0000000..02adf15 --- /dev/null +++ b/app/pages/flight/flight.component.html @@ -0,0 +1,52 @@ +
+ +
+ +
+ +
+ 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,EAAU,KAAqB;QAAvE,SAAI,GAAJ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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,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C;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,CAAC;IAKD,yCAAQ,GAAR;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,mBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClI,CAAC;IAED,yCAAQ,GAAR;QAAA,iBAWC;QAVC,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QACpD,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QACtC,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QAE5C,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,OAAO,CAAC,CAAC,SAAS,CAAC,UAAA,CAAC,IAAI,OAAA,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAA7B,CAA6B,CAAC,CAAC;YAChF,OAAO,CAAC,GAAG,CAAC,KAAI,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAA;IACJ,CAAC;IACH,6BAAC;AAAD,CAAC,AA7BD,IA6BC;AA3BS;IAAP,YAAK,EAAE;8BAAQ,mBAAK;uDAAC;AAFX,sBAAsB;IALlC,gBAAS,CAAC;QACT,QAAQ,EAAE,iBAAiB;QAC3B,WAAW,EAAE,kCAAkC;KAChD,CAAC;qCAQ0B,0BAAW;GAN1B,sBAAsB,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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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"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA6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,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,WAAM,GAAgB,IAAI,KAAK,EAAS,CAAC;QAPvC,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,EAAS,CAAC;IACnC,CAAC;IAQD,0CAAQ,GAAR;QAAA,iBAkBC;QAhBC,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEhF,IAAI,CAAC,IAAI,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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;QACvB,UAAK,GAAW,KAAK,CAAC;QACtB,SAAI,GAAU,SAAS,CAAC;QACxB,OAAE,GAAU,CAAC,CAAC;QAEP,WAAM,GAAU,IAAI,qBAAM,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAI8C,CAAC;IAG9F,mCAAS,GAAT,UAAU,EAAS;QAAnB,iBAsBC;QArBA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YACrB,KAAI,CAAC,IAAI;iBACH,MAAM,CAAC,EAAE,CAAC;iBACV,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;o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/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,QA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AC,CAAC;oBAEH,KAAI,CAAC,OAAO,GAAG,KAAK,CAAC;gBACtB,CAAC;YAEF,CAAC,CAAC,CAAC;QACT,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,mCAAQ,GAAR;QAAA,iBAOC;QANG,IAAI,CAAC,cAAc,EAAE,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,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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W,EAAE,iCAAiC;KAC/C,CAAC;qCAQ0B,0BAAW;GAN1B,qBAAqB,CA+BjC;AA/BY,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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,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,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YACrB,KAAI,CAAC,IAAI;iBACH,KAAK,EAAE;iBACP,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,GAAQ,iBAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,C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AAE,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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KAAK,CAAC,EAAI,EAAE,EAAC,IAAI,EAAC,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,EAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAC,KAAK,CAAC,OAAO,EAAC,EAAE,EAAC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,EAAC,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,EAAE,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 + { + return new Promise((resolve, reject) => { + + if(this.url != "") + { + resolve(); + } + else + { + this.http.get('/app/config/api.json').subscribe((res)=>{ + var data = res.json(); + this.url = data.protocol + data.hostname + ":" + data.port + "/" + data.api; + console.log(this.url); + resolve(); + }); + } + + }); + + } + + + //FLIGHTS + + flight(id:number): Observable { + let flightdata = this.http.get(`${this.url}/flights/${id}`, {headers: this.getHeaders()}).map(r => r.json()); + return flightdata; + } + + flights(): Observable { + let flightdata = this.http.get(`${this.url}/flights`, {headers: this.getHeaders()}).map(r => r.json()); + return flightdata; + } + + endFlight(id:number): Observable { + let flight = this.http.put(`${this.url}/flights/${id}/stop`, {headers: this.getHeaders()}).map(r => r.json()); + return flight + } + + + //USERS + + user(id:number): Observable { + let usersdata = this.http.get(`${this.url}/users/${id}`, {headers: this.getHeaders()}).map(r => r.json()); + return usersdata; + } + + users(): Observable { + let usersdata = this.http.get(`${this.url}/users`, {headers: this.getHeaders()}).map(r => r.json()); + return usersdata; + } + + postUser(user:User): Observable{ + let userData = this.http.post(`${this.url}/users`, {name:user.name, cardId: user.card, role:user.role}, {headers: this.getHeaders()}).map(r => r.json()); + return userData; + } + + editUser(user:User): Observable{ + let userData = this.http.put(`${this.url}/users/${user.id}`, {name:user.name, cardId: user.card, role:user.role}, {headers: this.getHeaders()}).map(r => r.json()); + return userData; + } + + + //READERS + + reader(id:number): Observable { + let readerData = this.http.get(`${this.url}/readers/${id}`, {headers: this.getHeaders()}).map(r => r.json()); + return readerData; + } + + readers(): Observable { + let readersData = this.http.get(`${this.url}/readers`, {headers: this.getHeaders()}).map(r => r.json()); + return readersData; + } + + editReader(reader:Reader): Observable{ + let readerData = this.http.put(`${this.url}/readers/${reader.id}`, {readerId:reader.reader_id, planeId:reader.plane.id}, {headers: this.getHeaders()}).map(r => r.json()); + return readerData; + } + + + //PLANES + + plane(id:number): Observable { + let planeData = this.http.get(`${this.url}/planes/${id}`, {headers: this.getHeaders()}).map(r => r.json()); + return planeData; + } + + planes(): Observable { + let planesData = this.http.get(`${this.url}/planes`, {headers: this.getHeaders()}).map(r => r.json()); + return planesData; + } + + postPlane(plane:Plane): Observable{ + let userData = this.http.post(`${this.url}/planes`, {name:plane.name, registration: plane.registration, model:plane.model, comment:plane.comment}, {headers: this.getHeaders()}).map(r => r.json()); + return userData; + } + + editPlane(plane:Plane): Observable{ + let 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(r => r.json()); + return planeData; + } + + + //OTHER + + private getHeaders(){ + let headers = new Headers(); + headers.append('Accept', 'application/json'); + return headers; + } +} diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..8081c7ceaf2be08bf59010158c586170d9d2d517 GIT binary patch literal 5430 zcmc(je{54#6vvCoAI3i*G5%$U7!sA3wtMZ$fH6V9C`=eXGJb@R1%(I_{vnZtpD{6n z5Pl{DmxzBDbrB>}`90e12m8T*36WoeDLA&SD_hw{H^wM!cl_RWcVA!I+x87ee975; z@4kD^=bYPn&pmG@(+JZ`rqQEKxW<}RzhW}I!|ulN=fmjVi@x{p$cC`)5$a!)X&U+blKNvN5tg=uLvuLnuqRM;Yc*swiexsoh#XPNu{9F#c`G zQLe{yWA(Y6(;>y|-efAy11k<09(@Oo1B2@0`PtZSkqK&${ zgEY}`W@t{%?9u5rF?}Y7OL{338l*JY#P!%MVQY@oqnItpZ}?s z!r?*kwuR{A@jg2Chlf0^{q*>8n5Ir~YWf*wmsh7B5&EpHfd5@xVaj&gqsdui^spyL zB|kUoblGoO7G(MuKTfa9?pGH0@QP^b#!lM1yHWLh*2iq#`C1TdrnO-d#?Oh@XV2HK zKA{`eo{--^K&MW66Lgsktfvn#cCAc*(}qsfhrvOjMGLE?`dHVipu1J3Kgr%g?cNa8 z)pkmC8DGH~fG+dlrp(5^-QBeEvkOvv#q7MBVLtm2oD^$lJZx--_=K&Ttd=-krx(Bb zcEoKJda@S!%%@`P-##$>*u%T*mh+QjV@)Qa=Mk1?#zLk+M4tIt%}wagT{5J%!tXAE;r{@=bb%nNVxvI+C+$t?!VJ@0d@HIyMJTI{vEw0Ul ze(ha!e&qANbTL1ZneNl45t=#Ot??C0MHjjgY8%*mGisN|S6%g3;Hlx#fMNcL<87MW zZ>6moo1YD?P!fJ#Jb(4)_cc50X5n0KoDYfdPoL^iV`k&o{LPyaoqMqk92wVM#_O0l z09$(A-D+gVIlq4TA&{1T@BsUH`Bm=r#l$Z51J-U&F32+hfUP-iLo=jg7Xmy+WLq6_tWv&`wDlz#`&)Jp~iQf zZP)tu>}pIIJKuw+$&t}GQuqMd%Z>0?t%&BM&Wo^4P^Y z)c6h^f2R>X8*}q|bblAF?@;%?2>$y+cMQbN{X$)^R>vtNq_5AB|0N5U*d^T?X9{xQnJYeU{ zoZL#obI;~Pp95f1`%X3D$Mh*4^?O?IT~7HqlWguezmg?Ybq|7>qQ(@pPHbE9V?f|( z+0xo!#m@Np9PljsyxBY-UA*{U*la#8Wz2sO|48_-5t8%_!n?S$zlGe+NA%?vmxjS- zHE5O3ZarU=X}$7>;Okp(UWXJxI%G_J-@IH;%5#Rt$(WUX?6*Ux!IRd$dLP6+SmPn= z8zjm4jGjN772R{FGkXwcNv8GBcZI#@Y2m{RNF_w8(Z%^A*!bS*!}s6sh*NnURytky humW;*g7R+&|Ledvc-dl#JyUFr831@K2x + + + F.R.A.U.D.S. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/main.js b/main.js new file mode 100644 index 0000000..3fb1d67 --- /dev/null +++ b/main.js @@ -0,0 +1,5 @@ +"use strict"; +var platform_browser_dynamic_1 = require("@angular/platform-browser-dynamic"); +var app_module_1 = require("./app/app.module"); +platform_browser_dynamic_1.platformBrowserDynamic().bootstrapModule(app_module_1.AppModule); +//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/main.js.map b/main.js.map new file mode 100644 index 0000000..0326ae4 --- /dev/null +++ b/main.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";AAAA,8EAA2E;AAE3E,+CAA6C;AAE7C,iDAAsB,EAAE,CAAC,eAAe,CAAC,sBAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/main.ts b/main.ts new file mode 100644 index 0000000..311c44b --- /dev/null +++ b/main.ts @@ -0,0 +1,5 @@ +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; + +platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/main.ts:Zone.Identifier b/main.ts:Zone.Identifier new file mode 100644 index 0000000000000000000000000000000000000000..d6c1ec682968c796b9f5e9e080cc6f674b57c766 GIT binary patch literal 25 dcma!!%Fjy;DN4*MPD?F{<>dl#JyUFr831@K2xdl#JyUFr831@K2xdl#JyUFr831@K2xdl#JyUFr831@K2xdl#JyUFr831@K2xdl#JyUFr831@K2x