Skip to content

Commit

Permalink
security with front
Browse files Browse the repository at this point in the history
  • Loading branch information
Papabdou12 committed Nov 7, 2022
1 parent c426299 commit 9d31392
Show file tree
Hide file tree
Showing 321 changed files with 33,237 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@



<!-- Navbar Start -->
<div class="container-fluid position-relative nav-bar p-0">
<div class="container-lg position-relative p-0 px-lg-3" style="z-index: 9;">
<nav class="navbar navbar-expand-lg bg-light navbar-light shadow-lg py-3 py-lg-0 pl-3 pl-lg-5">
<a href="" class="navbar-brand">
<h1 class="m-0 text-primary">SARA<span class="text-dark">YA-TRAV</span>ELER</h1>
</a>
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">

</button>
<div class="collapse navbar-collapse justify-content-between px-3" id="navbarCollapse">
<div class="navbar-nav ml-auto py-0">
<a href="index.html" class="nav-item nav-link active">Home</a>
<a routerLink="/add-airport" class="nav-item nav-link">Add Airport</a>
<a routerLink="/add-flight" class="nav-item nav-link">Add Flight</a>
<a routerLink="/add-booking/:bookingId" class="nav-item nav-link">Add Booking</a>
<a routerLink="/add-scheduleF-flight" class="nav-item nav-link">Add ScheduleFlight</a>

<a href="about.html" class="nav-item nav-link" >About Us</a>
<a href="" class="nav-item nav-link">Login </a>
<a href="" class="nav-item nav-link" >Sign-Up </a>
</div>
</div>
</nav>
</div>
</div >
<!-- Navbar End -->
<div class="container" style="margin: 5%;" >

<div [hidden]="submitted" style="width: 500px; margin-left: auto;margin-right: auto;">
<form (ngSubmit)="onSubmit()" class="mb-3 row">
<div class="form-group">
<label for="name" class="col-sm col-form-label">Airport Code:</label>
<input type="text" class="form-control" placeholder="Airport Code" required #airportCode="ngModel" pattern="^[A-Z]{1,5}$" [class.is-invalid]="airportCode.invalid && airportCode.touched" class="form-control" id="airportCode" required [(ngModel)]="airport.airportCode" name="airportCode">
<small class="text-danger" [class.d-none]="airportCode.valid || airportCode.untouched">Code should contain max 5 letters</small>
</div>

<div class="form-group">
<label for="name" class="col-sm col-form-label">Airport Name:</label>
<input type="text" placeholder="Airport Name" class="form-control" required #airportName="ngModel" [class.is-invalid]="airportName.invalid && airportName.touched" class="form-control" id="airportName" required [(ngModel)]="airport.airportName" name="airportName">
<small class="text-danger" [class.d-none]="airportName.valid || airportName.untouched">Name is required</small>
</div>

<div class="form-group">
<label for="name" class="col-sm col-form-label">Airport Location:</label>
<input type="text" class="form-control" placeholder="Airport Location" required #airportLocation="ngModel" [class.is-invalid]="airportLocation.invalid && airportLocation.touched" class="form-control" id="airportLocation" required [(ngModel)]="airport.airportLocation" name="airportLocation">
<small class="text-danger" [class.d-none]="airportLocation.valid || airportLocation.untouched">Location is required</small>
</div>

<div>
<button type="submit" class="btn btn-success " >Submit</button>
</div>
</form>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AddAirportComponent } from './add-airport.component';

describe('AddAirportComponent', () => {
let component: AddAirportComponent;
let fixture: ComponentFixture<AddAirportComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AddAirportComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(AddAirportComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { Component, OnInit } from '@angular/core';
import { AirportService } from '../../services/airport.service';
import { Router } from '@angular/router';
import { Airport} from '../../model/airport';
@Component({
selector: 'app-add-airport',
templateUrl: './add-airport.component.html',
styleUrls: ['./add-airport.component.css']
})
export class AddAirportComponent implements OnInit {

airport: Airport =new Airport();
submitted=false;
constructor(private airportService: AirportService,private router: Router) { }

ngOnInit(){
this.reloadData();
}
reloadData() {
this.airportService.viewAllAirport();
}
newEmployee(): void {
this.submitted = false;
this.airport = new Airport();
}

// save() {
// this.airportService.addAirport(this.airport)
// .subscribe(data => console.log(data), error => console.log(error));
// this.airport = new Airport();
// this.gotoList();

// }

save()
{
this.airportService.addAirport(this.airport).subscribe({
next:(res)=>{
alert("Airport is added successfully")
this.airport = new Airport();
this.gotoList();
this.reloadData();
},
error:(err)=>{
alert("Error while Adding the Airport")
}
})
}
onSubmit() {
this.submitted = true;
this.save();

}
gotoList() {
this.router.navigate(['/airport-list']);

}

}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@



<!-- Navbar Start -->
<div class="container-fluid position-relative nav-bar p-0">
<div class="container-lg position-relative p-0 px-lg-3" style="z-index: 9;">
<nav class="navbar navbar-expand-lg bg-light navbar-light shadow-lg py-3 py-lg-0 pl-3 pl-lg-5">
<a href="" class="navbar-brand">
<h1 class="m-0 text-primary">SARA<span class="text-dark">YA-TRAV</span>ELER</h1>
</a>
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">

</button>
<div class="collapse navbar-collapse justify-content-between px-3" id="navbarCollapse">
<div class="navbar-nav ml-auto py-0">
<a href="index.html" class="nav-item nav-link active">Home</a>
<a routerLink="/add-airport" class="nav-item nav-link">Add Airport</a>
<a routerLink="/add-flight" class="nav-item nav-link">Add Flight</a>
<a routerLink="/add-booking/:bookingId" class="nav-item nav-link">Add Booking</a>
<a routerLink="/add-scheduleF-flight" class="nav-item nav-link">Add ScheduleFlight</a>

<a href="about.html" class="nav-item nav-link" >About Us</a>
<a href="" class="nav-item nav-link">Login </a>
<a href="" class="nav-item nav-link" >Sign-Up </a>
</div>
</div>
</nav>
</div>
</div >
<!-- Navbar End -->
<div class="container" style="margin: 5%;" >

<div [hidden]="submitted" style="width: 500px; margin-left: auto;margin-right: auto;">
<form (ngSubmit)="onSubmit()" class="mb-3 row">

<!-- <div class="form-group">
<label for="name" class="col-sm col-form-label">Booking Number:</label>
<input type="number" class="form-control" placeholder="Booking Number" required #bookingId="ngModel" [class.is-invalid]="bookingId.invalid && bookingId.touched" class="form-control" id="bookingId" required [(ngModel)]="booking.bookingId" name="bookingId">
<small class="text-danger" [class.d-none]="bookingId.valid || bookingId.untouched"></small>
</div> -->
<div class="form-group">
<label for="bookingDate" class="col-sm col-form-label">Booking Date:</label>
<input type="date" class="form-control" placeholder="Booking Date" required #bookingDate="ngModel" [class.is-invalid]="bookingDate.invalid && bookingDate.touched" class="form-control" id="bookingDate" required [(ngModel)]="booking.bookingDate " name="bookingDate">
<small class="text-danger" [class.d-none]="bookingDate.valid || bookingDate.untouched"></small>
</div>

<div class="form-group">
<label for="noOfPassenger" class="col-sm col-form-label">Numero Passenger:</label>
<input type="number" placeholder="Numero Passenger" class="form-control" required #noOfPassenger="ngModel" [class.is-invalid]="noOfPassenger.invalid && noOfPassenger.touched" class="form-control" id="noOfPassenger" required [(ngModel)]="booking.noOfPassenger" name="noOfPassenger">
<small class="text-danger" [class.d-none]="noOfPassenger.valid || noOfPassenger.untouched">Name is required</small>
</div>
<div class="form-group">
<label for="ticketCost" class="col-sm col-form-label">Tickt Costes</label>
<input type="number" placeholder="Tickt Costes" class="form-control" required #ticketCost="ngModel" [class.is-invalid]="ticketCost.invalid && ticketCost.touched" class="form-control" id="ticketCost" required [(ngModel)]="booking.ticketCost" name="ticketCost">
<small class="text-danger" [class.d-none]="ticketCost.valid || ticketCost.untouched">Name is required</small>
</div>




<div>
<button type="submit" class="btn btn-success " >Submit</button>
</div>
</form>
</div>
</div>

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async,ComponentFixture, TestBed } from '@angular/core/testing';

import { AddBookingComponent } from './add-booking.component';

describe('AddBookingComponent', () => {
let component: AddBookingComponent;
let fixture: ComponentFixture<AddBookingComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AddBookingComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(AddBookingComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { Component, OnInit } from '@angular/core';
import { Booking } from '../../model/booking';
import { BookingService } from '../../services/booking.service';
import { Router } from '@angular/router';
import { Flight } from '../../model/flight';
import { Passenger } from '../../model/passenger';
import { FlightService } from '../../services/flight.service';

@Component({
selector: 'app-add-booking',
templateUrl: './add-booking.component.html',
styleUrls: ['./add-booking.component.css']
})
export class AddBookingComponent implements OnInit {
// PassengerList : Passenger[];
// flights: Flight [];
// booking: Booking = {bookingId:null,bookingDate: null,noOfPassenger:null,ticketCost:null,flights:null};
booking : Booking = new Booking();
submitted=false;
constructor(private bookingService: BookingService,private router: Router) { }

ngOnInit(){
this.reloadData();
}
reloadData() {
this.bookingService. getBookingsList();
}
newEmployee(): void {
this.submitted = false;
this.booking = new Booking();
}


save()
{
this.bookingService.createBooking(this.booking).subscribe({
next:(res)=>{
alert("Booking successfully")
this.booking = new Booking();
this.gotoList();
this.reloadData();
},
error:(err)=>{
alert("Error while Adding the Airport")
this.reloadData();
}
})
}
onSubmit() {
this.submitted = true;
this.save();

}
gotoList() {
this.router.navigate(['/booking-list']);

}

}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@



<!-- Navbar Start -->
<div class="container-fluid position-relative nav-bar p-0">
<div class="container-lg position-relative p-0 px-lg-3" style="z-index: 9;">
<nav class="navbar navbar-expand-lg bg-light navbar-light shadow-lg py-3 py-lg-0 pl-3 pl-lg-5">
<a href="" class="navbar-brand">
<h1 class="m-0 text-primary">SARA<span class="text-dark">YA-TRAV</span>ELER</h1>
</a>
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">

</button>
<div class="collapse navbar-collapse justify-content-between px-3" id="navbarCollapse">
<div class="navbar-nav ml-auto py-0">
<a href="index.html" class="nav-item nav-link active">Home</a>
<a routerLink="/add-airport" class="nav-item nav-link">Add Airport</a>
<a routerLink="/add-flight" class="nav-item nav-link">Add Flight</a>
<a routerLink="/add-booking/:bookingId" class="nav-item nav-link">Add Booking</a> <a routerLink="/add-scheduleF-flight" class="nav-item nav-link">Add ScheduleFlight</a>

<a href="about.html" class="nav-item nav-link" >About Us</a>
<a href="" class="nav-item nav-link">Login </a>
<a href="" class="nav-item nav-link" >Sign-Up </a>
</div>
</div>
</nav>
</div>
</div >
<!-- Navbar End -->

<div class="container" style="margin: 5%;" >

<div [hidden]="submitted" style="width: 500px; margin-left: auto;margin-right: auto;"> <form (ngSubmit)="onSubmit()">

<div class="form-group">
<label for="name"class="col-sm col-form-label">Carrier Name</label>
<input type="text" class="form-control" placeholder="Carrier Name" required #carrierName="ngModel" [class.is-invalid]="carrierName.invalid && carrierName.touched" class="form-control" id="carrierName" required [(ngModel)]="flight.carrierName" name="carrierName">
<small class="text-danger" [class.d-none]="carrierName.valid || carrierName.untouched">CarrierName is required</small>
</div>

<div class="form-group">
<label for="name" class="col-sm col-form-label">Flight Model</label>
<input type="text" class="form-control" placeholder="Flight Model" required #flightModel="ngModel" [class.is-invalid]="flightModel.invalid && flightModel.touched" class="form-control" id="flightModel" required [(ngModel)]="flight.flightModel" name="carrierName">
<small class="text-danger" [class.d-none]="flightModel.valid || flightModel.untouched">Model is required</small>
</div>



<div class="form-group">
<label for="name" class="col-sm col-form-label">Seat Capacity</label>
<input type="number" class="form-control" placeholder="seat Capacity" required #seatCapacity="ngModel" [class.is-invalid]="seatCapacity.invalid && seatCapacity.touched" class="form-control" id="seatCapacity" required [(ngModel)]="flight.seatCapacity" name="seatCapacity">
<small class="text-danger" [class.d-none]="seatCapacity.valid || seatCapacity.untouched">number is required</small>
</div>

<div class="form-group">
<label for="name" class="col-sm col-form-label">From </label>
<input type="text" class="form-control" placeholder="From" required #from="ngModel" [class.is-invalid]="from.invalid && from.touched" class="form-control" id="from" required [(ngModel)]="flight.from" name="from">
<small class="text-danger" [class.d-none]="from.valid || from.untouched">From is required</small>
</div>

<div class="form-group">
<label for="name" class="col-sm col-form-label">To </label>
<input type="text" class="form-control" placeholder="To" required #to="ngModel" [class.is-invalid]="to.invalid && to.touched" class="form-control" id="to" required [(ngModel)]="flight.to" name="to">
<small class="text-danger" [class.d-none]="to.valid || to.untouched">Model is required</small>
</div>
<div>
<button type="submit" class="btn btn-success " >Submit</button>
</div>


</form>
</div>



Loading

0 comments on commit 9d31392

Please sign in to comment.