Store in GIT

This commit is contained in:
2026-06-17 16:11:25 +02:00
parent 9998fbd104
commit 2418284092
115 changed files with 3466 additions and 0 deletions
@@ -0,0 +1,50 @@
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal"><i class="fa fa-plus" aria-hidden="true"></i></button>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">New Plane</h4>
</div>
<div class="modal-body">
<form (ngSubmit)="onSubmit()" #planeForm="ngForm">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" required [(ngModel)]="plane.name" name="name" #name="ngModel" ngModel>
<div [hidden]="name.valid || name.pristine" class="alert alert-danger">
Name is required
</div>
</div>
<div class="form-group">
<label for="registration">Registration</label>
<input type="text" class="form-control" id="registration" required [(ngModel)]="plane.registration" name="registration" #registration="ngModel" ngModel>
<div [hidden]="registration.valid || registration.pristine" class="alert alert-danger">
Registration is required
</div>
<div class="form-group">
<label for="model">Model</label>
<input type="text" class="form-control" id="model" required [(ngModel)]="plane.model" name="model" #model="ngModel" ngModel>
<div [hidden]="model.valid || model.pristine" class="alert alert-danger">
Model is required
</div>
<div class="form-group">
<label for="comment">Comment</label>
<input type="text" class="form-control" id="comment" [(ngModel)]="plane.comment" name="comment" #comment="ngModel" ngModel>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-success" data-dismiss="modal" (click)="onSubmit()" [disabled]="!planeForm.form.valid">Add Plane</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@@ -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
@@ -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"}
@@ -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));
})
}
}
+3
View File
@@ -0,0 +1,3 @@
.plane {
cursor: pointer;
}
+35
View File
@@ -0,0 +1,35 @@
<div class="row">
<div class="col-md-12">
<div class="page-header">
<h1>F.R.A.U.D.S.
<small>Planes</small> <small><div *ngIf=!loading class="pull-right"><plane-form></plane-form></div></small>
</h1>
</div>
</div>
<div class="col-md-12">
</div>
<div *ngIf=loading class="col-md-12">
<span *ngIf=!error><i class="fa fa-circle-o-notch fa-spin fa-fw"></i> Loading....</span>
<span *ngIf=error><i class="fa fa-cross fa-fw"></i> Error....</span>
</div>
<div *ngIf=!loading class="col-md-12">
<div class="row">
<div *ngFor="let plane of planes" class="col-md-4 col-sm-6 col-xs-12 plane">
<div class="well well-sm" (click)="onClick(plane)">
<h4><i class="fa fa-fw fa-plane"></i> {{plane.name}}</h4>
<i class="fa fa-fw fa-file-text"></i> {{plane.registration}}<br>
<i class="fa fa-fw fa-tag"></i> {{plane.model}}
</div>
</div>
</div>
</div>
</div>
+88
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"planes.component.js","sourceRoot":"","sources":["planes.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA6D;AAC7D,8DAA4D;AAC5D,0CAAyC;AACzC,yEAAwE;AAGxE,2DAAoD;AAQpD,IAAa,eAAe;IAS3B,yBAAoB,MAAc,EAAU,IAAgB;QAAxC,WAAM,GAAN,MAAM,CAAQ;QAAU,SAAI,GAAJ,IAAI,CAAY;QAP5D,YAAO,GAAW,IAAI,CAAC;QACvB,UAAK,GAAW,KAAK,CAAC;QAEtB,WAAM,GAAgB,IAAI,KAAK,EAAS,CAAC;IAIqB,CAAC;IAE/D,uCAAa,GAAb;QAAA,iBA+CC;QA7CA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC;YACrB,KAAI,CAAC,IAAI;iBACH,MAAM,EAAE;iBACR,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,KAA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ED,kCAAQ,GAAR;QAAA,iBAOC;QANG,IAAI,CAAC,aAAa,EAAE,CAAC;QAElB,IAAI,CAAC,YAAY,GAAG,uCAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YAC9B,KAAI,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC,CAAC,CAAC;IACV,CAAC;IAED,qCAAW,GAAX;QACI,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IACpC,CAAC;IAED,iCAAO,GAAP,UAAQ,KAAY;QACf,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,sCAAY,GAAZ,UAAa,EAAS;QACxB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAC,CAAC,IAAM,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAA,CAAA,CAAC,CAAC,CAAC;IACtD,CAAC;IAEF,sBAAC;AAAD,CAAC,AAjFD,IAiFC;AAjFY,eAAe;IAN3B,gBAAS,CAAC;QACT,QAAQ,EAAE,YAAY;QACtB,WAAW,EAAE,yBAAyB;QACtC,SAAS,EAAE,CAAC,wBAAwB,CAAC;KACtC,CAAC;qCAW2B,eAAM,EAAe,0BAAW;GAThD,eAAe,CAiF3B;AAjFY,0CAAe"}
+96
View File
@@ -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<Plane> = new Array<Plane>();
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});
}
}