13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
34 |
35 |
36 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | Ödeme Yöntemi seç
54 | Banka Kartı
55 | Kredi Kartı
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
70 |
71 |
72 |
73 |
74 | Alış Tarihi
75 | Teslim Tarihi
76 | Marka
77 | Renk
78 |
79 | Günlük
80 | Toplam
81 |
82 |
83 |
84 |
85 | {{rental.rentDate}}
86 | {{rental.returnDate}}
87 | {{car.brandName}}
88 | {{car.colorName}}
89 |
90 | {{car.dailyPrice | currency:"₺"}}
91 | {{car.dailyPrice * amountPayment | currency:"₺"}}
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
--------------------------------------------------------------------------------
/src/app/components/payment/payment.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { PaymentComponent } from './payment.component';
4 |
5 | describe('PaymentComponent', () => {
6 | let component: PaymentComponent;
7 | let fixture: ComponentFixture
;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ PaymentComponent ]
12 | })
13 | .compileComponents();
14 | });
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(PaymentComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/payment/payment.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, Input, OnInit } from '@angular/core';
2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms';
3 | import { ActivatedRoute, Router } from '@angular/router';
4 | import { ToastrService } from 'ngx-toastr';
5 | import { Car } from 'src/app/models/car';
6 | import { CarImage } from 'src/app/models/carImage';
7 | import { Rental } from 'src/app/models/rental';
8 | import { CarService } from 'src/app/services/car.service';
9 | import { PaymentService } from 'src/app/services/payment.service';
10 | import { RentalService } from 'src/app/services/rental.service';
11 |
12 | @Component({
13 | selector: 'app-payment',
14 | templateUrl: './payment.component.html',
15 | styleUrls: ['./payment.component.css']
16 | })
17 | export class PaymentComponent implements OnInit {
18 |
19 |
20 |
21 | car:Car;
22 | carDetails:Car[];
23 | rental:Rental;
24 | rental2 : Rental[] = [];
25 | carImages : CarImage[] = [];
26 | apiUrl="https://localhost:44379/"
27 | currentImage : CarImage;
28 | rentDate:Date;
29 | returnDate:Date;
30 | amountPayment:number=0;
31 |
32 | cardAddForm : FormGroup
33 |
34 | constructor(
35 |
36 | private activatedRoute:ActivatedRoute,
37 | private carService:CarService,
38 | private router:Router,
39 | private toastrService:ToastrService,
40 | private paymentService:PaymentService,
41 | private formBuilder:FormBuilder,
42 | private rentalService:RentalService
43 |
44 | ) { }
45 |
46 |
47 |
48 | ngOnInit(): void {
49 |
50 | this.activatedRoute.params.subscribe(params=>
51 | {
52 | this.createPaymentAddForm();
53 |
54 | if(params["rental"])
55 | {
56 | this.rental = JSON.parse(params['rental']);
57 | this.getRental();
58 | this.getrentaldetailbycarId(this.rental);
59 | this.getCarDetail();
60 | }
61 | })
62 |
63 | }
64 |
65 |
66 | createPaymentAddForm(){
67 | this.cardAddForm = this.formBuilder.group({
68 | customerId:["" ,Validators.required],
69 | cardOwnerName:["" ,Validators.required],
70 | cardNumber:["" ,Validators.required],
71 | cardExpirationDate:["" ,Validators.required],
72 | cardCvv:["" ,Validators.required]
73 | })
74 | }
75 |
76 | creditPayment()
77 | {
78 | if(this.cardAddForm.valid ){
79 | let PaymentModel = Object.assign({},this.cardAddForm.value)
80 | this.paymentService.add(PaymentModel).subscribe(response =>{
81 |
82 | this.toastrService.success(" Ödeme Başarılı ")
83 |
84 |
85 | }
86 | );
87 | }
88 | else {
89 | this.toastrService.error(' Eksik Bilgiler var', 'Dikkat');
90 | }
91 | }
92 |
93 |
94 |
95 |
96 | getRental(){
97 | console.log(this.rental);
98 | }
99 |
100 | getCarDetail(){
101 | this.carService.getCarDetailsByCarId(this.rental.carId).subscribe(reponse=>
102 | {
103 | this.carDetails=reponse.data;
104 | this.paymentCalculator();
105 | })
106 | }
107 |
108 | paymentCalculator()
109 | {
110 |
111 | if(this.rental.returnDate!=null)
112 | {
113 | var date1=new Date(this.rental.returnDate.toString());
114 | var date2=new Date(this.rental.rentDate.toString());
115 | var difference = date1.getTime() - date2.getTime();
116 |
117 | var numberOfDays = Math.ceil(difference / (1000 * 3600 * 24));
118 |
119 | this.amountPayment = numberOfDays;
120 | if(this.amountPayment <= 0){
121 | this.router.navigate(['/cars']);
122 | this.toastrService.error("Araç listesine yönlendiriliyorsunuz", "Hatalı işlem");
123 | }
124 | }
125 |
126 | }
127 |
128 |
129 |
130 |
131 | getrentaldetailbycarId(rental:Rental){
132 | this.paymentService.getrentaldetailbycarId(rental).subscribe((response) => {
133 | this.rental2 = response.data;
134 | console.log(response.data)
135 | });
136 | }
137 | }
138 |
139 |
--------------------------------------------------------------------------------
/src/app/components/register/register.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/register/register.component.css
--------------------------------------------------------------------------------
/src/app/components/register/register.component.html:
--------------------------------------------------------------------------------
1 | register works!
2 |
--------------------------------------------------------------------------------
/src/app/components/register/register.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { RegisterComponent } from './register.component';
4 |
5 | describe('RegisterComponent', () => {
6 | let component: RegisterComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ RegisterComponent ]
12 | })
13 | .compileComponents();
14 | });
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(RegisterComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/register/register.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { AuthService } from 'src/app/services/auth.service';
3 |
4 | @Component({
5 | selector: 'app-register',
6 | templateUrl: './register.component.html',
7 | styleUrls: ['./register.component.css']
8 | })
9 | export class RegisterComponent implements OnInit {
10 |
11 | constructor() { }
12 |
13 | ngOnInit(): void {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/app/components/rental-add/rental-add.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/rental-add/rental-add.component.css
--------------------------------------------------------------------------------
/src/app/components/rental-add/rental-add.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Kapat
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
Dikkat !
46 |
47 |
48 |
Google Play'den Uygulamayı indirin ve size gödericemiz kod ile aracınızın kapılarını acabilirsiniz.
49 | @SMTcoder iyi seyirler diler. :)
50 |
51 | Uygulamayı indir
52 |
53 |
54 |
55 |
56 |
57 |
58 |
117 |
118 |
119 |
120 |
--------------------------------------------------------------------------------
/src/app/components/rental-add/rental-add.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { RentalAddComponent } from './rental-add.component';
4 |
5 | describe('RentalAddComponent', () => {
6 | let component: RentalAddComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ RentalAddComponent ]
12 | })
13 | .compileComponents();
14 | });
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(RentalAddComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/rental-add/rental-add.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms';
3 | import { Router } from '@angular/router';
4 | import { ToastrService } from 'ngx-toastr';
5 | import { User } from 'src/app/models/user';
6 | import { RentalService } from 'src/app/services/rental.service';
7 | import { UserService } from 'src/app/services/user.service';
8 |
9 | @Component({
10 | selector: 'app-rental-add',
11 | templateUrl: './rental-add.component.html',
12 | styleUrls: ['./rental-add.component.css']
13 | })
14 | export class RentalAddComponent implements OnInit {
15 |
16 |
17 | user:User
18 | rentalAddForm : FormGroup
19 |
20 | constructor(
21 | private formBuilder:FormBuilder,
22 | private rentalService:RentalService,
23 | private toastrService:ToastrService,
24 | private router:Router,
25 | private userService:UserService
26 | ) { }
27 |
28 | ngOnInit(): void {
29 |
30 | this.createRentalAddForm();
31 |
32 | }
33 |
34 | createRentalAddForm(){
35 | this.rentalAddForm = this.formBuilder.group({
36 | carId:["" ,Validators.required],
37 | customerId:["" ,Validators.required],
38 | rentDate:["" ,Validators.required],
39 | returnDate:["" ,Validators.required]
40 |
41 | })
42 | }
43 |
44 | addFindexPoint(){
45 | this.userService.addFindexPoint(this.userService.getUserId()).subscribe((response)=>{
46 | this.toastrService.info(response.message,"Bilgi")
47 | })
48 | }
49 | add(){
50 | if(this.rentalAddForm.valid){
51 | let rentalModel = Object.assign({},this.rentalAddForm.value)
52 | this.rentalService.add(rentalModel).subscribe(response =>{
53 | this.router.navigate(['/payment/', JSON.stringify(rentalModel)]);
54 | this.toastrService.success(response.message,"Başarılı Eklendi")
55 | this.addFindexPoint();
56 |
57 |
58 | },responseError=>{
59 | if(responseError.error.Errors.length>0){
60 | for (let i = 0; i
3 | Kapat
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
Dikkat !
45 |
46 |
47 |
Google Play'den uygulamızı indirin ve size gödericemiz kod ile aracınızın kapılarını acabilirsiniz.
48 | @SMTcoder iyi seyirler diler. :)
49 |
50 | Uygulamayı indir
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
--------------------------------------------------------------------------------
/src/app/components/rental/rental.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { RentalComponent } from './rental.component';
4 |
5 | describe('RentalComponent', () => {
6 | let component: RentalComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ RentalComponent ]
12 | })
13 | .compileComponents();
14 | });
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(RentalComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/rental/rental.component.ts:
--------------------------------------------------------------------------------
1 | import { DatePipe } from '@angular/common';
2 | import { Component, OnInit } from '@angular/core';
3 | import { FormControl, FormGroup } from '@angular/forms';
4 | import { ActivatedRoute, Router } from '@angular/router';
5 | import { ToastrService } from 'ngx-toastr';
6 | import { Car } from 'src/app/models/car';
7 | import { CarImage } from 'src/app/models/carImage';
8 | import { Customer } from 'src/app/models/customer';
9 | import { Rental } from 'src/app/models/rental';
10 | import { CarService } from 'src/app/services/car.service';
11 | import { CarimageService } from 'src/app/services/carimage.service';
12 | import { CustomerService } from 'src/app/services/customer.service';
13 | import { RentalService } from 'src/app/services/rental.service';
14 |
15 | @Component({
16 | selector: 'app-rental',
17 | templateUrl: './rental.component.html',
18 | styleUrls: ['./rental.component.css']
19 | })
20 | export class RentalComponent implements OnInit {
21 |
22 | rental : Rental[] = [];
23 | car:Car;
24 | carImages : CarImage[] = [];
25 | apiUrl="https://localhost:44379/"
26 | currentImage : CarImage;
27 | rentDate:Date;
28 | returnDate:Date;
29 |
30 |
31 | constructor(
32 | private rentalService:RentalService,
33 | private router: Router,
34 | private carService :CarService,
35 | private carImageService:CarimageService,
36 | private toastrService:ToastrService,
37 | private customerService:CustomerService
38 | ) { }
39 |
40 |
41 | ngOnInit(): void {
42 |
43 | this.getRentals();
44 | }
45 |
46 | getRentals(){
47 | this.rentalService.getRental().subscribe(response => {
48 | this.rental = response.data
49 | })
50 | }
51 |
52 | getCurrentImageClass(image:CarImage ){
53 | if(image==this.carImages[0]){
54 | return "carousel-item active"
55 | } else {
56 | return "carousel-item"
57 | }
58 | }
59 |
60 |
61 | getCarDetailsByCarId(carId: number) {
62 | this.carService.getCarDetailsByCarId(carId).subscribe((response) => {
63 | this.car = response.data[0];
64 | console.log(response.data)
65 | });
66 | }
67 |
68 | getCarImages(carId:number){
69 | this.carImageService.getCarImages(carId).subscribe((response)=>{
70 | this.carImages = response.data;
71 | console.log(response.data)
72 | })
73 | }
74 |
75 | getMinDate(){
76 | var today = new Date();
77 |
78 | today.setDate(today.getDate() );
79 | return today.toISOString().slice(0,10)
80 | }
81 |
82 |
83 |
84 |
85 | }
86 |
87 | /*
88 |
89 | getCustomers()
90 | {
91 | this.customerService.getCustomer().subscribe(response=>
92 | {
93 | this.customers=response.data
94 | })
95 | }
96 |
97 | getMinDate(){
98 | var today = new Date();
99 | //min="1980-01-01"
100 | today.setDate(today.getDate() + 1);
101 | return today.toISOString().slice(0,10)
102 | }
103 |
104 | addRentals()
105 | {
106 | let rental:Rental =
107 | {
108 | rentDate :this.rentDate,
109 | returnDate:this.returnDate,
110 | carId:this.car.carId,
111 | customerId: parseInt(this.customerId.toString())
112 | }
113 | this.route.navigate(['/payment/', JSON.stringify(rental)]);
114 | this.toastrService.info("Ödeme sayfasına yönlendiriliyorsunuz...", "Ödeme İşlemleri");
115 | }
116 |
117 | */
--------------------------------------------------------------------------------
/src/app/components/user/user.component.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/user/user.component.css
--------------------------------------------------------------------------------
/src/app/components/user/user.component.html:
--------------------------------------------------------------------------------
1 | user works!
2 |
--------------------------------------------------------------------------------
/src/app/components/user/user.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { UserComponent } from './user.component';
4 |
5 | describe('UserComponent', () => {
6 | let component: UserComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async () => {
10 | await TestBed.configureTestingModule({
11 | declarations: [ UserComponent ]
12 | })
13 | .compileComponents();
14 | });
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(UserComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/app/components/user/user.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-user',
5 | templateUrl: './user.component.html',
6 | styleUrls: ['./user.component.css']
7 | })
8 | export class UserComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit(): void {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/app/guards/login.guard.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { LoginGuard } from './login.guard';
4 |
5 | describe('LoginGuard', () => {
6 | let guard: LoginGuard;
7 |
8 | beforeEach(() => {
9 | TestBed.configureTestingModule({});
10 | guard = TestBed.inject(LoginGuard);
11 | });
12 |
13 | it('should be created', () => {
14 | expect(guard).toBeTruthy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/src/app/guards/login.guard.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router';
3 | import { ToastrService } from 'ngx-toastr';
4 | import { Observable } from 'rxjs';
5 | import { AuthService } from '../services/auth.service';
6 |
7 | @Injectable({
8 | providedIn: 'root'
9 | })
10 | export class LoginGuard implements CanActivate {
11 |
12 | constructor(private authService:AuthService,
13 | private toastrService:ToastrService,
14 | private router:Router){
15 |
16 | }
17 |
18 | canActivate(
19 | route: ActivatedRouteSnapshot,
20 | state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree {
21 |
22 | if(this.authService.isAuthenticated()){
23 | return true;
24 | }else{
25 | this.router.navigate(["login"])
26 | this.toastrService.info("Sisteme giriş yapmalısınız")
27 | return false;
28 | }
29 |
30 |
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/src/app/interceptors/auth.interceptor.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { AuthInterceptor } from './auth.interceptor';
4 |
5 | describe('AuthInterceptor', () => {
6 | beforeEach(() => TestBed.configureTestingModule({
7 | providers: [
8 | AuthInterceptor
9 | ]
10 | }));
11 |
12 | it('should be created', () => {
13 | const interceptor: AuthInterceptor = TestBed.inject(AuthInterceptor);
14 | expect(interceptor).toBeTruthy();
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/src/app/interceptors/auth.interceptor.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import {
3 | HttpRequest,
4 | HttpHandler,
5 | HttpEvent,
6 | HttpInterceptor
7 | } from '@angular/common/http';
8 | import { Observable } from 'rxjs';
9 |
10 | @Injectable()
11 | export class AuthInterceptor implements HttpInterceptor {
12 |
13 | constructor() {}
14 |
15 | intercept(request: HttpRequest, next: HttpHandler): Observable> {
16 | let token = localStorage.getItem("token");
17 | let newRequest : HttpRequest;
18 | newRequest = request.clone({
19 | headers: request.headers.set("Authorization","Bearer " + token)
20 | })
21 | return next.handle(newRequest);
22 | }
23 | }
24 |
25 | //Error
--------------------------------------------------------------------------------
/src/app/models/ResponseModel.ts:
--------------------------------------------------------------------------------
1 | export interface ResponseModel{
2 | success:boolean,
3 | message:string
4 | }
--------------------------------------------------------------------------------
/src/app/models/brand.ts:
--------------------------------------------------------------------------------
1 | export interface Brand{
2 | brandId:number
3 | brandName:string
4 | }
--------------------------------------------------------------------------------
/src/app/models/car.ts:
--------------------------------------------------------------------------------
1 | export interface Car{
2 | carId:number
3 | modelName:string
4 | brandName:string
5 | brandId:number
6 | colorId:number
7 | colorName:string
8 | modelYear:number
9 | dailyPrice:number
10 | description:string
11 | imagePath:string
12 | carImageDate:Date
13 | minFindex:number
14 | }
--------------------------------------------------------------------------------
/src/app/models/carImage.ts:
--------------------------------------------------------------------------------
1 | export interface CarImage{
2 | id:number;
3 | carId:number;
4 | imagePath:string;
5 | date:string;
6 | }
--------------------------------------------------------------------------------
/src/app/models/card.ts:
--------------------------------------------------------------------------------
1 | export interface Card{
2 | id: number;
3 | customerId:number;
4 | cardOwnerName:string;
5 | cardNumber:string;
6 | cardExpirationDate:string;
7 | cardCvv:number;
8 | }
9 |
10 | export class CartTotal{
11 | customerId:number;
12 | cartTotal:number;
13 | }
--------------------------------------------------------------------------------
/src/app/models/color.ts:
--------------------------------------------------------------------------------
1 | export interface Color{
2 | colorId:number
3 | colorName:string
4 | }
--------------------------------------------------------------------------------
/src/app/models/customer.ts:
--------------------------------------------------------------------------------
1 | export interface Customer{
2 | customerId:number
3 | userId:number
4 | customerName:string
5 | }
--------------------------------------------------------------------------------
/src/app/models/itemResponseModel.ts:
--------------------------------------------------------------------------------
1 | import { ResponseModel } from "./ResponseModel";
2 |
3 | export interface ItemResponseModel extends ResponseModel {
4 | data:T
5 | }
--------------------------------------------------------------------------------
/src/app/models/listResponseModel.ts:
--------------------------------------------------------------------------------
1 | import { ResponseModel } from "./ResponseModel";
2 |
3 | export interface ListResponseModel extends ResponseModel{
4 | data:T[];
5 | }
--------------------------------------------------------------------------------
/src/app/models/loginModel.ts:
--------------------------------------------------------------------------------
1 | export interface LoginModel{
2 | email:string;
3 | password:string;
4 | }
--------------------------------------------------------------------------------
/src/app/models/payment.ts:
--------------------------------------------------------------------------------
1 | export interface Payment{
2 | cartOwnerName:string;
3 | cardNumber:string;
4 | expirationDate:string;
5 | cardCvv:number;
6 | customerId:number;
7 | paymentDate:Date;
8 | }
--------------------------------------------------------------------------------
/src/app/models/register.ts:
--------------------------------------------------------------------------------
1 | export interface RegisterModel {
2 | firstName: string;
3 | lastName: string;
4 | email: string;
5 | password: string;
6 | }
--------------------------------------------------------------------------------
/src/app/models/rental.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 | export interface Rental{
4 | carDailyPrice : number;
5 | carDescription : string;
6 | rentalId:number
7 | name:string
8 | brandName:string
9 | carId:number
10 | customerId:number
11 | firstName:string
12 | lastName:string
13 | rentDate:Date
14 | returnDate:Date
15 |
16 | imagePath:string;
17 | }
--------------------------------------------------------------------------------
/src/app/models/singleResponseModel.ts:
--------------------------------------------------------------------------------
1 | import { ResponseModel } from "./ResponseModel";
2 |
3 | export interface SingleResponseModel extends ResponseModel{
4 | data:T
5 | }
--------------------------------------------------------------------------------
/src/app/models/tokenModel.ts:
--------------------------------------------------------------------------------
1 | export interface TokenModel{
2 | token:string;
3 | expiration:string;
4 | }
--------------------------------------------------------------------------------
/src/app/models/user.ts:
--------------------------------------------------------------------------------
1 | import { Byte } from "@angular/compiler/src/util";
2 |
3 | export interface User{
4 | id:number,
5 | firstName:string,
6 | lastName:string,
7 | email:string,
8 | passwordHash: Byte[];
9 | passwordSalt: Byte[];
10 | status?:boolean
11 | findexPoint:number;
12 | }
--------------------------------------------------------------------------------
/src/app/pipes/brand-filter.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Brand } from '../models/brand';
3 |
4 | @Pipe({
5 | name: 'brandFilterPipe'
6 | })
7 | export class BrandFilterPipePipe implements PipeTransform {
8 |
9 | transform(value: Brand[], filterBrandText: string): Brand[] {
10 | filterBrandText = filterBrandText ? filterBrandText.toLocaleLowerCase():""
11 | return filterBrandText ? value.filter((b:Brand)=>
12 | b.brandName.toLocaleLowerCase().indexOf(filterBrandText) !== -1):value;
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/src/app/pipes/color-filter.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Color } from '../models/color';
3 |
4 | @Pipe({
5 | name: 'colorFilterPipe'
6 | })
7 | export class ColorFilterPipePipe implements PipeTransform {
8 |
9 | transform(value: Color[], filterColorText: string): Color[] {
10 | filterColorText = filterColorText ? filterColorText.toLocaleLowerCase():""
11 | return filterColorText ? value.filter((c:Color)=>
12 | c.colorName.toLocaleLowerCase().indexOf(filterColorText) !== -1):value;
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/src/app/pipes/filter-pipe.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 | import { Car } from '../models/car';
3 |
4 | @Pipe({
5 | name: 'filterPipe'
6 | })
7 | export class FilterPipePipe implements PipeTransform {
8 |
9 | transform(value: Car[] , filterText:string): Car[] {
10 | filterText = filterText?filterText.toLocaleLowerCase():""
11 | return filterText?value.filter((c:Car)=>c.modelName.toLocaleLowerCase().indexOf(filterText)!==-1):value;
12 |
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/app/pipes/vat-added.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'vatAdded'
5 | })
6 | export class VatAddedPipe implements PipeTransform {
7 |
8 | transform(value: number, rate :number): number {
9 |
10 | return value + (value*rate/100);
11 | }
12 |
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/app/pipes/vat-moon.pipe.ts:
--------------------------------------------------------------------------------
1 | import { Pipe, PipeTransform } from '@angular/core';
2 |
3 | @Pipe({
4 | name: 'vatMoon'
5 | })
6 | export class VatMoonPipe implements PipeTransform {
7 |
8 | transform(value: number, rate:number ): number {
9 | return value * 27 +(value*rate)/100;
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/src/app/pipes/vat-week.pipe.ts:
--------------------------------------------------------------------------------
1 | import { createViewChild } from '@angular/compiler/src/core';
2 | import { Pipe, PipeTransform } from '@angular/core';
3 |
4 | @Pipe({
5 | name: 'vatWeek'
6 | })
7 | export class VatWeekPipe implements PipeTransform {
8 |
9 | transform(value: number, rate:number): number {
10 | return value * 6 +(value*rate)/100;
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/app/services/auth.service.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from '@angular/common/http';
2 | import { Injectable } from '@angular/core';
3 | import { JwtHelperService } from '@auth0/angular-jwt';
4 | import { LoginComponent } from '../components/login/login.component';
5 | import { SingleResponseModel } from '../models/singleResponseModel';
6 | import { TokenModel } from '../models/tokenModel';
7 | import { LocalStorageService } from './local-storage.service';
8 |
9 |
10 | @Injectable({
11 | providedIn: 'root'
12 | })
13 | export class AuthService {
14 |
15 | userName:string;
16 | email:string
17 | userId:number
18 | roles:string
19 | expiration:Date
20 |
21 | jwtHelper:JwtHelperService = new JwtHelperService();
22 |
23 |
24 | apiUrl = 'https://localhost:44379/api/auth/';
25 | constructor(
26 | private httpClient:HttpClient,
27 | private localStorageService:LocalStorageService
28 | ) {
29 | // this.setUserInfo();
30 | this.getUserId();
31 | }
32 |
33 | login(loginModel:LoginComponent){
34 |
35 | return this.httpClient.post>(this.apiUrl+"login",loginModel)
36 | }
37 |
38 | register(registerModel:LoginComponent){
39 |
40 | return this.httpClient.post>(this.apiUrl+"register",registerModel)
41 | }
42 |
43 | isAuthenticated(){
44 | if(localStorage.getItem("token")){
45 | return true;
46 | }
47 | else{
48 | return false;
49 | }
50 | }
51 |
52 | setUserName(){
53 | var decoded = this.decodeToken();
54 | var userName = Object.keys(decoded).filter(x=>x.endsWith("/name"))[0];
55 | this.userName = decoded[userName];
56 | }
57 | setEmail(){
58 | var decoded = this.decodeToken();
59 | var email = Object.keys(decoded).filter(x=>x.endsWith("email"))[0];
60 | this.email = decoded[email];
61 | }
62 | setUserId(){
63 | var decoded = this.decodeToken();
64 | var id = Object.keys(decoded).filter(x=>x.endsWith("/nameidentifier"))[0];
65 | this.userId = Number(decoded[id]);
66 | }
67 | setUserRole(){
68 | var decoded = this.decodeToken();
69 | var role = Object.keys(decoded).filter(x=>x.endsWith("role"))[0];
70 | this.roles = decoded[role];
71 | }
72 | setExpration(){
73 | var decoded = this.decodeToken();
74 | var expiration = Object.keys(decoded).filter(x=>x.startsWith("exp"))[0]
75 | this.expiration = decoded[expiration]
76 | }
77 | setUserInfo(){
78 | if (this.isAuthenticated()) {
79 | this.setUserName()
80 | this.setEmail();
81 | this.setUserId();
82 | this.setUserRole();
83 | this.setExpration();
84 | }
85 | }
86 |
87 | getUserName(){
88 | return this.userName
89 | }
90 | getUserId(){
91 | return this.userId
92 | }
93 | getEmail(){
94 | return this.email
95 | }
96 | getRoles(){
97 | return this.roles
98 | }
99 | getExpiration(){
100 | return this.expiration
101 | }
102 |
103 | logOut(){
104 | this.localStorageService.clear()
105 | }
106 |
107 | decodeToken(){
108 | try{
109 | return this.jwtHelper.decodeToken(this.localStorageService.get("Token"));
110 | }
111 | catch(Error){
112 | return null;
113 | }
114 | }
115 |
116 | }
117 |
--------------------------------------------------------------------------------
/src/app/services/brand.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import {HttpClient} from '@angular/common/http'
3 | import { Observable } from 'rxjs';
4 | import { ListResponseModel } from '../models/listResponseModel';
5 | import { Brand } from '../models/brand';
6 | import { ResponseModel } from '../models/ResponseModel';
7 | import { ItemResponseModel } from '../models/itemResponseModel';
8 | @Injectable({
9 | providedIn: 'root'
10 | })
11 | export class brandService {
12 |
13 | apiUrl = "https://localhost:44379/api/brands/"
14 | constructor(private httpClient:HttpClient) { }
15 |
16 |
17 | getCars():Observable>{
18 | return this.httpClient.get>(this.apiUrl + "getall" );
19 |
20 | }
21 |
22 |
23 | add(brand : Brand):Observable{
24 | return this.httpClient.post(this.apiUrl +"add",brand)
25 | }
26 |
27 | getById(brandId : number):Observable>{
28 | let newPath = this.apiUrl + "brandid?id=" + brandId;
29 | return this.httpClient.get>(newPath);
30 | }
31 | update(brand : Brand) : Observable>{
32 | let newPath = this.apiUrl + "update";
33 | return this.httpClient.post>(newPath,brand);
34 | }
35 | delete(brand : Brand):Observable>{
36 | let newPath = this.apiUrl + "delete";
37 | return this.httpClient.post>(newPath,brand);
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/app/services/car.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import {HttpClient} from '@angular/common/http'
3 | import { Observable } from 'rxjs';
4 | import { ListResponseModel } from '../models/listResponseModel';
5 | import { Car } from '../models/car';
6 | import { ResponseModel } from '../models/ResponseModel';
7 | import { ItemResponseModel } from '../models/itemResponseModel';
8 |
9 |
10 |
11 | @Injectable({
12 | providedIn: 'root'
13 | })
14 | export class CarService {
15 |
16 | apiUrl = "https://localhost:44379/api/"
17 |
18 |
19 | constructor(private httpClient:HttpClient) { }
20 |
21 | //buradamı gelmiyordu evet markaya tıklayınca ilgili ıd gelmiyor service kısmında sanırsam yanlıs var sen hatayı al bakalım nereden tamnam
22 | //goole chrome da hatayı almamız lazım tamam hata Id nin null gelmesi tamam nasıl cözeceyiz bakalım tamam
23 | getCars():Observable>{
24 | let newPath = this.apiUrl + "cars/getcardetails";
25 | return this.httpClient.get>(newPath);
26 | }
27 |
28 | getCarsByBrand(brandId:number):Observable>{
29 | let newPath = this.apiUrl + "cars/getbybrand?brandId="+brandId
30 | return this.httpClient.get>(newPath);
31 | }
32 |
33 | getCarsByColor(colorId:number):Observable>{
34 | let newPath = this.apiUrl + "cars/getbycolor?colorId="+colorId
35 | return this.httpClient.get>(newPath);
36 | }
37 |
38 | getCarByBrandAndColor(brandId:Number,colorId:Number):Observable>{
39 | let newPath = this.apiUrl +`cars/getbybrandandcolor?brandId=${brandId}&colorid=${colorId}`;
40 | return this.httpClient.get>(newPath);
41 | }
42 |
43 | getCarDetailsByCarId(carId:number):Observable>{
44 | let newPath = this.apiUrl + "cars/getcardetail?carId="+carId;
45 | return this.httpClient.get>(newPath);
46 | }
47 |
48 | add(car:Car):Observable{
49 | return this.httpClient.post(this.apiUrl+"cars/add",car)
50 | }
51 |
52 | update(car:Car):Observable>{
53 | let newPath = this.apiUrl + "cars/update";
54 | return this.httpClient.post>(newPath,car);
55 | }
56 |
57 | delete(car:Car):Observable>{
58 | let newPath = this.apiUrl + "cars/delete";
59 | return this.httpClient.post>(newPath,car);
60 | }
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/src/app/services/carimage.service.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from '@angular/common/http';
2 | import { Injectable } from '@angular/core';
3 |
4 | import { Observable } from 'rxjs';
5 | import { CarImage } from '../models/carImage';
6 | import { ListResponseModel } from '../models/listResponseModel';
7 |
8 |
9 | @Injectable({
10 | providedIn: 'root'
11 | })
12 | export class CarimageService {
13 |
14 | apiUrl ='https://localhost:44379/api/'
15 | constructor(
16 | private httpClient:HttpClient,
17 |
18 | ) { }
19 |
20 | getCar():Observable>{
21 | return this.httpClient.get>(this.apiUrl)
22 | }
23 |
24 |
25 | getCarImages(carId:number):Observable>{
26 | let newPath = this.apiUrl + "carimages/getimagesbycarid?carId=" + carId
27 | return this.httpClient.get>(newPath)
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/src/app/services/color.service.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from '@angular/common/http';
2 | import { Injectable } from '@angular/core';
3 | import { Observable } from 'rxjs';
4 | import { Color } from '../models/color';
5 | import { ItemResponseModel } from '../models/itemResponseModel';
6 | import { ListResponseModel } from '../models/listResponseModel';
7 | import { ResponseModel } from '../models/ResponseModel';
8 |
9 | @Injectable({
10 | providedIn: 'root'
11 | })
12 | export class ColorService {
13 |
14 | apiUrl ='https://localhost:44379/api/colors/'
15 | constructor(private httpClient:HttpClient ) { }
16 |
17 | getColors():Observable>{
18 | return this.httpClient.get>(this.apiUrl + "getall")
19 | }
20 |
21 | add(color : Color):Observable{
22 | return this.httpClient.post(this.apiUrl + "add",color)
23 | }
24 |
25 | update(color:Color) : Observable>{
26 | let newPath = this.apiUrl + "update";
27 | return this.httpClient.post>(newPath,color);
28 | }
29 |
30 | delete(color:Color) : Observable>{
31 | let newPath = this.apiUrl + "delete";
32 | return this.httpClient.post>(newPath,color);
33 | }
34 |
35 | getbyId(colorId:number):Observable>{
36 | let newPath = this.apiUrl + "colorıd?id=" + colorId;
37 | return this.httpClient.get>(newPath);
38 | }
39 |
40 |
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/app/services/customer.service.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from '@angular/common/http';
2 | import { Injectable } from '@angular/core';
3 | import { Observable } from 'rxjs';
4 | import { Customer } from '../models/customer';
5 | import { ListResponseModel } from '../models/listResponseModel';
6 |
7 | @Injectable({
8 | providedIn: 'root'
9 | })
10 | export class CustomerService {
11 |
12 | apiUrl = "https://localhost:44379/api/";
13 |
14 | constructor(private httpClient:HttpClient) { }
15 | getCustomer():Observable>{
16 | return this.httpClient.get>(this.apiUrl)
17 | }
18 |
19 |
20 | getCustomerById(customerId : number) : Observable>{
21 | let newPath = this.apiUrl + 'customers/getcustomerdetailbyid?customerId=' + customerId;
22 | return this.httpClient.get>(newPath);
23 | }
24 |
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/app/services/local-storage.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 |
3 | @Injectable({
4 | providedIn: 'root'
5 | })
6 | export class LocalStorageService {
7 |
8 | constructor() { }
9 |
10 |
11 | set(key:string,data:string){
12 | localStorage.setItem(key,data);
13 | }
14 |
15 | get(key:string){
16 | return localStorage.getItem(key)
17 | }
18 |
19 | delete(key:string){
20 | localStorage.removeItem(key)
21 | }
22 |
23 |
24 | clear(){
25 | localStorage.clear();
26 | }
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/app/services/payment.service.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from '@angular/common/http';
2 | import { Injectable } from '@angular/core';
3 | import { Observable } from 'rxjs';
4 | import { ListResponseModel } from '../models/listResponseModel';
5 | import { Rental } from '../models/rental';
6 | import { ResponseModel } from '../models/ResponseModel';
7 |
8 | @Injectable({
9 | providedIn: 'root'
10 | })
11 | export class PaymentService {
12 |
13 | apiUrl="https://localhost:44379/api";
14 | constructor(private httpClient:HttpClient) { }
15 |
16 |
17 | creditPayment(rental:Rental,amount:number):Observable
18 | {
19 | let newPath=this.apiUrl+"/rentals/paymentadd";
20 | // rental.returnDate= undefined;
21 | return this.httpClient.post(newPath,{payment:{amount:amount},rental:rental})
22 | }
23 |
24 | getrentaldetailbycarId(rental:Rental):Observable>{
25 | let newPath = this.apiUrl + "/rentals/getrentaldetailbycarId?carId="+rental;
26 | return this.httpClient.get>(newPath);
27 | }
28 |
29 | add(rental:Rental):Observable{
30 | return this.httpClient.post(this.apiUrl+"/cards/add",rental)
31 | }
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/app/services/rental.service.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from '@angular/common/http';
2 | import { Injectable } from '@angular/core';
3 | import { Observable } from 'rxjs';
4 | import { Car } from '../models/car';
5 | import { Customer } from '../models/customer';
6 | import { ListResponseModel } from '../models/listResponseModel';
7 | import { Rental } from '../models/rental';
8 | import { ResponseModel } from '../models/ResponseModel';
9 |
10 |
11 | @Injectable({
12 | providedIn: 'root'
13 | })
14 | export class RentalService {
15 |
16 |
17 | apiUrl='https://localhost:44379/api/'
18 |
19 | constructor(private httpClient:HttpClient) { }
20 |
21 | getRental():Observable>{
22 | return this.httpClient.get>(this.apiUrl)
23 | }
24 |
25 |
26 | getRentalByCarId(carId : number):Observable>{
27 | let newPath = this.apiUrl + 'rentals/getrentaldetailbycarId?carId=' + carId;
28 | return this.httpClient.get>(newPath);
29 | }
30 |
31 | addRental(rental:Rental){
32 | let newPath = this.apiUrl + 'rentals/add'
33 | this.httpClient.post(newPath,rental).subscribe()
34 | }
35 |
36 |
37 | getCustomer():Observable>{
38 | let apiUrl="https://localhost:44315/api/customers/getall"
39 | return this.httpClient.get>(apiUrl);
40 | }
41 |
42 | getCarDetailsByCarId(carId:number):Observable>{
43 | let newPath = this.apiUrl + "cars/getcardetail?carId="+carId;
44 | return this.httpClient.get>(newPath);
45 | }
46 |
47 | add(rental:Rental):Observable{
48 | return this.httpClient.post(this.apiUrl+"rentals/add",rental)
49 | }
50 |
51 |
52 | //payRental(rental:Rental, amount:number){
53 | // let newPath = this.apiUrl + 'rentals/add';
54 | // return this.httpClient.post(newPath,{payment:{amount:amount},rental:{rental}})
55 | // }
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/app/services/user.service.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from '@angular/common/http';
2 | import { Injectable } from '@angular/core';
3 | import { JwtHelperService } from '@auth0/angular-jwt';
4 | import { Observable } from 'rxjs';
5 | import { ItemResponseModel } from '../models/itemResponseModel';
6 | import { ResponseModel } from '../models/ResponseModel';
7 | import { User } from '../models/user';
8 | import { LocalStorageService } from './local-storage.service';
9 |
10 | @Injectable({
11 | providedIn: 'root'
12 | })
13 | export class UserService {
14 |
15 | jwtHelper: JwtHelperService = new JwtHelperService();
16 | token = this.localStorageService.get("Token");
17 |
18 | apiUrl = 'https://localhost:44379/api/';
19 | constructor(
20 | private httpClient:HttpClient,
21 | private localStorageService:LocalStorageService
22 |
23 | ) { }
24 |
25 | getByMail(email:string):Observable>{
26 | return this.httpClient.get>(this.apiUrl+"users/getbymail?mail="+email);
27 | }
28 |
29 | getById(id:number):Observable>{
30 | let newPath = this.apiUrl+ "users/getbyıd?userId=" + id;
31 | return this.httpClient.get>(newPath);
32 | }
33 |
34 | getUserId(){
35 | let userId:number = parseInt(this.jwtHelper.decodeToken(this.token?.toString())["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"]);
36 | return userId;
37 | }
38 |
39 | addFindexPoint(userId: number): Observable {
40 | return this.httpClient.post(
41 | this.apiUrl + 'users/addfindexpoint',
42 | userId
43 | );
44 | }
45 |
46 |
47 |
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/assets/.gitkeep
--------------------------------------------------------------------------------
/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/favicon.ico
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ReCar
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.error(err));
13 |
--------------------------------------------------------------------------------
/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/guide/browser-support
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /**
22 | * IE11 requires the following for NgClass support on SVG elements
23 | */
24 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
25 |
26 | /**
27 | * Web Animations `@angular/platform-browser/animations`
28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
30 | */
31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
32 |
33 | /**
34 | * By default, zone.js will patch all possible macroTask and DomEvents
35 | * user can disable parts of macroTask/DomEvents patch by setting following flags
36 | * because those flags need to be set before `zone.js` being loaded, and webpack
37 | * will put import in the top of bundle, so user need to create a separate file
38 | * in this directory (for example: zone-flags.ts), and put the following flags
39 | * into that file, and then add the following code before importing zone.js.
40 | * import './zone-flags';
41 | *
42 | * The flags allowed in zone-flags.ts are listed here.
43 | *
44 | * The following flags will work for all browsers.
45 | *
46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
49 | *
50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
52 | *
53 | * (window as any).__Zone_enable_cross_context_check = true;
54 | *
55 | */
56 |
57 | /***************************************************************************************************
58 | * Zone JS is required by default for Angular itself.
59 | */
60 | import 'zone.js/dist/zone'; // Included with Angular CLI.
61 |
62 |
63 | /***************************************************************************************************
64 | * APPLICATION IMPORTS
65 | */
66 |
--------------------------------------------------------------------------------
/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting()
21 | );
22 | // Then we find all the tests.
23 | const context = require.context('./', true, /\.spec\.ts$/);
24 | // And load the modules.
25 | context.keys().map(context);
26 |
--------------------------------------------------------------------------------
/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/app",
6 | "types": []
7 | },
8 | "files": [
9 | "src/main.ts",
10 | "src/polyfills.ts"
11 | ],
12 | "include": [
13 | "src/**/*.d.ts"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "compileOnSave": false,
4 | "compilerOptions": {
5 | "baseUrl": "./",
6 | "outDir": "./dist/out-tsc",
7 | "forceConsistentCasingInFileNames": true,
8 | "strictNullChecks": false,
9 | "strict": true,
10 | "strictPropertyInitialization": false,
11 | "noImplicitReturns": true,
12 | "noFallthroughCasesInSwitch": true,
13 | "sourceMap": true,
14 | "declaration": false,
15 | "downlevelIteration": true,
16 | "experimentalDecorators": true,
17 | "moduleResolution": "node",
18 | "importHelpers": true,
19 | "target": "es2015",
20 | "module": "es2020",
21 | "lib": [
22 | "es2018",
23 | "dom"
24 | ]
25 | },
26 | "angularCompilerOptions": {
27 | "enableI18nLegacyMessageIdFormat": false,
28 | "strictInjectionParameters": true,
29 | "strictInputAccessModifiers": true,
30 | "strictTemplates": true
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/spec",
6 | "types": [
7 | "jasmine"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "tslint:recommended",
3 | "rulesDirectory": [
4 | "codelyzer"
5 | ],
6 | "rules": {
7 | "align": {
8 | "options": [
9 | "parameters",
10 | "statements"
11 | ]
12 | },
13 | "array-type": false,
14 | "arrow-return-shorthand": true,
15 | "curly": true,
16 | "deprecation": {
17 | "severity": "warning"
18 | },
19 | "eofline": true,
20 | "import-blacklist": [
21 | true,
22 | "rxjs/Rx"
23 | ],
24 | "import-spacing": true,
25 | "indent": {
26 | "options": [
27 | "spaces"
28 | ]
29 | },
30 | "max-classes-per-file": false,
31 | "max-line-length": [
32 | true,
33 | 140
34 | ],
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-console": [
47 | true,
48 | "debug",
49 | "info",
50 | "time",
51 | "timeEnd",
52 | "trace"
53 | ],
54 | "no-empty": false,
55 | "no-inferrable-types": [
56 | true,
57 | "ignore-params"
58 | ],
59 | "no-non-null-assertion": true,
60 | "no-redundant-jsdoc": true,
61 | "no-switch-case-fall-through": true,
62 | "no-var-requires": false,
63 | "object-literal-key-quotes": [
64 | true,
65 | "as-needed"
66 | ],
67 | "quotemark": [
68 | true,
69 | "single"
70 | ],
71 | "semicolon": {
72 | "options": [
73 | "always"
74 | ]
75 | },
76 | "space-before-function-paren": {
77 | "options": {
78 | "anonymous": "never",
79 | "asyncArrow": "always",
80 | "constructor": "never",
81 | "method": "never",
82 | "named": "never"
83 | }
84 | },
85 | "typedef": [
86 | true,
87 | "call-signature"
88 | ],
89 | "typedef-whitespace": {
90 | "options": [
91 | {
92 | "call-signature": "nospace",
93 | "index-signature": "nospace",
94 | "parameter": "nospace",
95 | "property-declaration": "nospace",
96 | "variable-declaration": "nospace"
97 | },
98 | {
99 | "call-signature": "onespace",
100 | "index-signature": "onespace",
101 | "parameter": "onespace",
102 | "property-declaration": "onespace",
103 | "variable-declaration": "onespace"
104 | }
105 | ]
106 | },
107 | "variable-name": {
108 | "options": [
109 | "ban-keywords",
110 | "check-format",
111 | "allow-pascal-case"
112 | ]
113 | },
114 | "whitespace": {
115 | "options": [
116 | "check-branch",
117 | "check-decl",
118 | "check-operator",
119 | "check-separator",
120 | "check-type",
121 | "check-typecast"
122 | ]
123 | },
124 | "component-class-suffix": true,
125 | "contextual-lifecycle": true,
126 | "directive-class-suffix": true,
127 | "no-conflicting-lifecycle": true,
128 | "no-host-metadata-property": true,
129 | "no-input-rename": true,
130 | "no-inputs-metadata-property": true,
131 | "no-output-native": true,
132 | "no-output-on-prefix": true,
133 | "no-output-rename": true,
134 | "no-outputs-metadata-property": true,
135 | "template-banana-in-box": true,
136 | "template-no-negated-async": true,
137 | "use-lifecycle-interface": true,
138 | "use-pipe-transform-interface": true,
139 | "directive-selector": [
140 | true,
141 | "attribute",
142 | "app",
143 | "camelCase"
144 | ],
145 | "component-selector": [
146 | true,
147 | "element",
148 | "app",
149 | "kebab-case"
150 | ]
151 | }
152 | }
153 |
--------------------------------------------------------------------------------