├── src ├── assets │ ├── .gitkeep │ └── images │ │ ├── filter1.png │ │ ├── filter2.png │ │ ├── filter3.png │ │ ├── homePage.png │ │ ├── filtered1.png │ │ ├── filtered2.png │ │ ├── filtered3.png │ │ ├── loginedPage.png │ │ ├── logoutPage.png │ │ ├── paymentPage.png │ │ ├── rentalPage.png │ │ ├── loginedPage2.png │ │ ├── registeredPage.png │ │ └── invaliddatechoice.png ├── app │ ├── app.component.css │ ├── components │ │ ├── car │ │ │ ├── car.component.css │ │ │ ├── car.component.spec.ts │ │ │ ├── car.component.html │ │ │ └── car.component.ts │ │ ├── navi │ │ │ ├── navi.component.css │ │ │ ├── auth-menu │ │ │ │ ├── auth-menu.component.css │ │ │ │ ├── auth-menu.component.spec.ts │ │ │ │ ├── auth-menu.component.ts │ │ │ │ └── auth-menu.component.html │ │ │ ├── navi.component.ts │ │ │ ├── navi.component.spec.ts │ │ │ └── navi.component.html │ │ ├── brand │ │ │ ├── brand.component.css │ │ │ ├── brand.component.spec.ts │ │ │ ├── brand.component.ts │ │ │ └── brand.component.html │ │ ├── car-add │ │ │ ├── car-add.component.css │ │ │ ├── car-add.component.spec.ts │ │ │ ├── car-add.component.ts │ │ │ └── car-add.component.html │ │ ├── color │ │ │ ├── color.component.css │ │ │ ├── color.component.spec.ts │ │ │ ├── color.component.ts │ │ │ └── color.component.html │ │ ├── payment │ │ │ ├── payment.component.css │ │ │ ├── card-saved │ │ │ │ ├── card-saved.component.css │ │ │ │ ├── card-saved.component.spec.ts │ │ │ │ ├── card-saved.component.html │ │ │ │ └── card-saved.component.ts │ │ │ ├── payment.component.spec.ts │ │ │ ├── payment.component.html │ │ │ └── payment.component.ts │ │ ├── rental │ │ │ ├── rental.component.css │ │ │ ├── rental.component.spec.ts │ │ │ ├── rental.component.html │ │ │ └── rental.component.ts │ │ ├── brand-add │ │ │ ├── brand-add.component.css │ │ │ ├── brand-add.component.spec.ts │ │ │ ├── brand-add.component.html │ │ │ └── brand-add.component.ts │ │ ├── color-add │ │ │ ├── color-add.component.css │ │ │ ├── color-add.component.spec.ts │ │ │ ├── color-add.component.html │ │ │ └── color-add.component.ts │ │ ├── customer │ │ │ ├── customer.component.css │ │ │ ├── customer.component.html │ │ │ ├── customer.component.spec.ts │ │ │ └── customer.component.ts │ │ ├── brand-delete │ │ │ ├── brand-delete.component.css │ │ │ ├── brand-delete.component.spec.ts │ │ │ ├── brand-delete.component.html │ │ │ └── brand-delete.component.ts │ │ ├── brand-update │ │ │ ├── brand-update.component.css │ │ │ ├── brand-update.component.spec.ts │ │ │ ├── brand-update.component.html │ │ │ └── brand-update.component.ts │ │ ├── car-delete │ │ │ ├── car-delete.component.css │ │ │ ├── car-delete.component.spec.ts │ │ │ ├── car-delete.component.html │ │ │ └── car-delete.component.ts │ │ ├── car-detail │ │ │ ├── car-detail.component.css │ │ │ ├── car-detail.component.spec.ts │ │ │ ├── car-detail.component.ts │ │ │ └── car-detail.component.html │ │ ├── car-filter │ │ │ ├── car-filter.component.css │ │ │ ├── car-filter.component.spec.ts │ │ │ ├── car-filter.component.html │ │ │ └── car-filter.component.ts │ │ ├── car-update │ │ │ ├── car-update.component.css │ │ │ ├── car-update.component.spec.ts │ │ │ ├── car-update.component.ts │ │ │ └── car-update.component.html │ │ ├── color-delete │ │ │ ├── color-delete.component.css │ │ │ ├── color-delete.component.spec.ts │ │ │ ├── color-delete.component.html │ │ │ └── color-delete.component.ts │ │ ├── color-update │ │ │ ├── color-update.component.css │ │ │ ├── color-update.component.spec.ts │ │ │ ├── color-update.component.html │ │ │ └── color-update.component.ts │ │ ├── login │ │ │ ├── login.component.spec.ts │ │ │ ├── login.component.html │ │ │ ├── login.component.css │ │ │ └── login.component.ts │ │ ├── profile │ │ │ ├── profile.component.spec.ts │ │ │ ├── profile.component.css │ │ │ ├── profile.component.html │ │ │ └── profile.component.ts │ │ └── register │ │ │ ├── register.component.spec.ts │ │ │ ├── register.component.css │ │ │ ├── register.component.html │ │ │ └── register.component.ts │ ├── models │ │ ├── brand.ts │ │ ├── color.ts │ │ ├── loginModel.ts │ │ ├── tokenModel.ts │ │ ├── responseModel.ts │ │ ├── carImage.ts │ │ ├── registerModel.ts │ │ ├── listResponseModel.ts │ │ ├── singleResponseModel.ts │ │ ├── creditCard.ts │ │ ├── customer.ts │ │ ├── car.ts │ │ └── rental.ts │ ├── app.component.html │ ├── app.component.ts │ ├── pipes │ │ ├── car-filter-pipe.pipe.ts │ │ ├── color-filter-pipe.pipe.ts │ │ └── brand-filter-pipe.pipe.ts │ ├── services │ │ ├── payment.service.ts │ │ ├── car-image.service.ts │ │ ├── rental.service.ts │ │ ├── customer.service.ts │ │ ├── local-storage.service.ts │ │ ├── credit-card.service.ts │ │ ├── color.service.ts │ │ ├── brand.service.ts │ │ ├── auth.service.ts │ │ └── car.service.ts │ ├── interceptors │ │ └── auth.interceptor.ts │ ├── guards │ │ └── login.guard.ts │ ├── app.component.spec.ts │ ├── app-routing.module.ts │ └── app.module.ts ├── styles.css ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── test.ts └── polyfills.ts ├── e2e ├── src │ ├── app.po.ts │ └── app.e2e-spec.ts ├── tsconfig.json └── protractor.conf.js ├── .editorconfig ├── tsconfig.app.json ├── tsconfig.spec.json ├── .browserslistrc ├── .gitignore ├── tsconfig.json ├── package.json ├── karma.conf.js ├── README.md ├── tslint.json └── angular.json /src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/brand-delete/brand-delete.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/car-delete/car-delete.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/color-delete/color-delete.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/navi/auth-menu/auth-menu.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/payment/card-saved/card-saved.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /src/app/models/brand.ts: -------------------------------------------------------------------------------- 1 | export interface Brand{ 2 | brandId:number, 3 | brandName:string 4 | } -------------------------------------------------------------------------------- /src/app/models/color.ts: -------------------------------------------------------------------------------- 1 | export interface Color{ 2 | colorId:number, 3 | colorName:string 4 | } -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/favicon.ico -------------------------------------------------------------------------------- /src/app/models/loginModel.ts: -------------------------------------------------------------------------------- 1 | export interface LoginModel{ 2 | email:string; 3 | password:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/tokenModel.ts: -------------------------------------------------------------------------------- 1 | export interface TokenModel{ 2 | token:string; 3 | expiration:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/responseModel.ts: -------------------------------------------------------------------------------- 1 | export interface ResponseModel{ 2 | success:boolean, 3 | message:string 4 | } -------------------------------------------------------------------------------- /src/assets/images/filter1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/filter1.png -------------------------------------------------------------------------------- /src/assets/images/filter2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/filter2.png -------------------------------------------------------------------------------- /src/assets/images/filter3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/filter3.png -------------------------------------------------------------------------------- /src/assets/images/homePage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/homePage.png -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 |
-------------------------------------------------------------------------------- /src/assets/images/filtered1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/filtered1.png -------------------------------------------------------------------------------- /src/assets/images/filtered2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/filtered2.png -------------------------------------------------------------------------------- /src/assets/images/filtered3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/filtered3.png -------------------------------------------------------------------------------- /src/assets/images/loginedPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/loginedPage.png -------------------------------------------------------------------------------- /src/assets/images/logoutPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/logoutPage.png -------------------------------------------------------------------------------- /src/assets/images/paymentPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/paymentPage.png -------------------------------------------------------------------------------- /src/assets/images/rentalPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/rentalPage.png -------------------------------------------------------------------------------- /src/assets/images/loginedPage2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/loginedPage2.png -------------------------------------------------------------------------------- /src/assets/images/registeredPage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/registeredPage.png -------------------------------------------------------------------------------- /src/app/models/carImage.ts: -------------------------------------------------------------------------------- 1 | export interface CarImage{ 2 | carImageId:number; 3 | carId:number; 4 | imagePath:string; 5 | date:Date; 6 | } -------------------------------------------------------------------------------- /src/assets/images/invaliddatechoice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nursebilcanb/re-cap-project-frontend/HEAD/src/assets/images/invaliddatechoice.png -------------------------------------------------------------------------------- /src/app/models/registerModel.ts: -------------------------------------------------------------------------------- 1 | export interface RegisterModel{ 2 | firstName:string 3 | lastName:string 4 | email:string 5 | password:string 6 | } -------------------------------------------------------------------------------- /src/app/models/listResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./responseModel"; 2 | 3 | export interface ListResponseModel extends ResponseModel{ 4 | data:T[]; 5 | } -------------------------------------------------------------------------------- /src/app/models/singleResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./responseModel"; 2 | 3 | export interface SingleResponseModel extends ResponseModel{ 4 | data:T 5 | } -------------------------------------------------------------------------------- /src/app/models/creditCard.ts: -------------------------------------------------------------------------------- 1 | export interface CreditCard{ 2 | cardId:number; 3 | customerId:number; 4 | cardNumber:string; 5 | cardCvv:string; 6 | expirationDate:string; 7 | nameOnTheCard:string; 8 | moneyInTheCard?:number; 9 | } -------------------------------------------------------------------------------- /src/app/models/customer.ts: -------------------------------------------------------------------------------- 1 | export interface Customer{ 2 | customerId:number, 3 | userId:number, 4 | companyName:string, 5 | firstName:string, 6 | lastName:string, 7 | email:string, 8 | password?:string, 9 | status:boolean, 10 | findexPoint:number 11 | } -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'rentcardatabase'; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/app/models/car.ts: -------------------------------------------------------------------------------- 1 | export interface Car{ 2 | carId:number, 3 | colorId:number, 4 | brandId:number; 5 | brandName:string, 6 | colorName:string, 7 | modelYear:string, 8 | dailyPrice:number, 9 | description:string, 10 | imagePath:string, 11 | status: boolean, 12 | findexPoint:number 13 | } -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | async navigateTo(): Promise { 5 | return browser.get(browser.baseUrl); 6 | } 7 | 8 | async getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.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/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Rentcardatabase 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-navi', 5 | templateUrl: './navi.component.html', 6 | styleUrls: ['./navi.component.css'] 7 | }) 8 | export class NaviComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/models/rental.ts: -------------------------------------------------------------------------------- 1 | export interface Rental{ 2 | rentalId?:number, 3 | carId:number, 4 | customerId?:number, 5 | brandName?:string, 6 | colorName:string, 7 | companyName?:string, 8 | firstName?: string, 9 | lastName?:string, 10 | carDailyPrice:number, 11 | carModelYear:string, 12 | carDescription:string, 13 | rentDate:Date, 14 | returnDate?:Date 15 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/app/pipes/car-filter-pipe.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { Car } from '../models/car'; 3 | 4 | @Pipe({ 5 | name: 'carFilterPipe' 6 | }) 7 | export class CarFilterPipePipe implements PipeTransform { 8 | 9 | transform(value: Car[], filterText: string): Car[] { 10 | filterText= filterText?filterText.toLocaleLowerCase():"" 11 | return filterText?value.filter((c:Car)=>c.description.toLocaleLowerCase().indexOf(filterText)!==-1) 12 | :value; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/pipes/color-filter-pipe.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[], filterText: string): Color[] { 10 | filterText= filterText?filterText.toLocaleLowerCase():"" 11 | return filterText?value.filter((c:Color)=>c.colorName.toLocaleLowerCase().indexOf(filterText)!==-1) 12 | :value; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/app/pipes/brand-filter-pipe.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[], filterText: string): Brand[] { 10 | filterText= filterText?filterText.toLocaleLowerCase():"" 11 | return filterText?value.filter((b:Brand)=>b.brandName.toLocaleLowerCase().indexOf(filterText)!==-1) 12 | :value; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/services/payment.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Rental } from '../models/rental'; 4 | import { ResponseModel } from '../models/responseModel'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class PaymentService { 10 | 11 | apiUrl = "https://localhost:44384/api/"; 12 | 13 | constructor(private httpClient:HttpClient) { } 14 | 15 | pay(rental:Rental,amount:number){ 16 | let path = this.apiUrl + "rentals/paymentadd";//paymentadd yok(Melih'de de yok) 17 | //rental.returnDate = undefined; 18 | this.httpClient.post(path,{payment:{amount:amount},rental:rental}) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarComponent } from './car.component'; 4 | 5 | describe('CarComponent', () => { 6 | let component: CarComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /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/app/components/customer/customer.component.html: -------------------------------------------------------------------------------- 1 |

Müşteri Listesi

2 |
3 | Loading... 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
IdKullanıcı IdŞirket AdıFindex Puanı
{{customer.customerId}}{{customer.userId}}{{customer.companyName}}{{customer.findexPoint}}
21 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { NaviComponent } from './navi.component'; 4 | 5 | describe('NaviComponent', () => { 6 | let component: NaviComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ NaviComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(NaviComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandComponent } from './brand.component'; 4 | 5 | describe('BrandComponent', () => { 6 | let component: BrandComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorComponent } from './color.component'; 4 | 5 | describe('ColorComponent', () => { 6 | let component: ColorComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginComponent } from './login.component'; 4 | 5 | describe('LoginComponent', () => { 6 | let component: LoginComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ LoginComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoginComponent); 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.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 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { browser, logging } from 'protractor'; 2 | import { AppPage } from './app.po'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', async () => { 12 | await page.navigateTo(); 13 | expect(await page.getTitleText()).toEqual('rentcardatabase app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarAddComponent } from './car-add.component'; 4 | 5 | describe('CarAddComponent', () => { 6 | let component: CarAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarAddComponent); 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.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/profile/profile.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ProfileComponent } from './profile.component'; 4 | 5 | describe('ProfileComponent', () => { 6 | let component: ProfileComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ProfileComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ProfileComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandAddComponent } from './brand-add.component'; 4 | 5 | describe('BrandAddComponent', () => { 6 | let component: BrandAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorAddComponent } from './color-add.component'; 4 | 5 | describe('ColorAddComponent', () => { 6 | let component: ColorAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CustomerComponent } from './customer.component'; 4 | 5 | describe('CustomerComponent', () => { 6 | let component: CustomerComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CustomerComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CustomerComponent); 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.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/navi/auth-menu/auth-menu.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthMenuComponent } from './auth-menu.component'; 4 | 5 | describe('AuthMenuComponent', () => { 6 | let component: AuthMenuComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ AuthMenuComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AuthMenuComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-delete/car-delete.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarDeleteComponent } from './car-delete.component'; 4 | 5 | describe('CarDeleteComponent', () => { 6 | let component: CarDeleteComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarDeleteComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarDeleteComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarDetailComponent } from './car-detail.component'; 4 | 5 | describe('CarDetailComponent', () => { 6 | let component: CarDetailComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarDetailComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarDetailComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarFilterComponent } from './car-filter.component'; 4 | 5 | describe('CarFilterComponent', () => { 6 | let component: CarFilterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarFilterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarFilterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarUpdateComponent } from './car-update.component'; 4 | 5 | describe('CarUpdateComponent', () => { 6 | let component: CarUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/payment/card-saved/card-saved.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CardSavedComponent } from './card-saved.component'; 4 | 5 | describe('CardSavedComponent', () => { 6 | let component: CardSavedComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CardSavedComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CardSavedComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand-delete/brand-delete.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandDeleteComponent } from './brand-delete.component'; 4 | 5 | describe('BrandDeleteComponent', () => { 6 | let component: BrandDeleteComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandDeleteComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandDeleteComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandUpdateComponent } from './brand-update.component'; 4 | 5 | describe('BrandUpdateComponent', () => { 6 | let component: BrandUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color-delete/color-delete.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorDeleteComponent } from './color-delete.component'; 4 | 5 | describe('ColorDeleteComponent', () => { 6 | let component: ColorDeleteComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorDeleteComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorDeleteComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorUpdateComponent } from './color-update.component'; 4 | 5 | describe('ColorUpdateComponent', () => { 6 | let component: ColorUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Customer } from 'src/app/models/customer'; 3 | import { CustomerService } from 'src/app/services/customer.service'; 4 | 5 | @Component({ 6 | selector: 'app-customer', 7 | templateUrl: './customer.component.html', 8 | styleUrls: ['./customer.component.css'] 9 | }) 10 | export class CustomerComponent implements OnInit { 11 | 12 | customers:Customer[]=[]; 13 | dataLoaded=false; 14 | 15 | constructor(private customerService:CustomerService) { } 16 | 17 | ngOnInit(): void { 18 | this.getCustomers(); 19 | } 20 | 21 | getCustomers(){ 22 | this.customerService.getCustomers().subscribe(response => { 23 | this.customers = response.data; 24 | this.dataLoaded=true; 25 | }); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/app/components/color-delete/color-delete.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 26 | 27 |
IdRenk Adı 12 |
{{ color.colorId }}{{ color.colorName }} 20 |
21 | 22 | 23 |
24 |
28 | -------------------------------------------------------------------------------- /src/app/components/payment/card-saved/card-saved.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | Kayıtlı kartlarım 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
{{ card.cardNumber }}|{{ card.expirationDate }}|{{ card.cardCvv }}|{{ card.nameOnTheCard }}
22 |
23 |
-------------------------------------------------------------------------------- /src/app/services/car-image.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { CarImage } from '../models/carImage'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class CarImageService { 11 | 12 | apiUrl="https://localhost:44384/api/"; 13 | 14 | constructor(private httpClient:HttpClient) { } 15 | 16 | getCarImages():Observable>{ 17 | let newPath = this.apiUrl+ "carimages/getall"; 18 | return this.httpClient.get>(newPath); 19 | } 20 | 21 | getCarImagesByCarId(carId:number):Observable>{ 22 | let newPath = this.apiUrl+ "carimages/getimagebycarid?carId="+carId; 23 | return this.httpClient.get>(newPath); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /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 | "strict": true, 9 | "strictNullChecks": false, 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 | } -------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
Renk Güncelle
8 |
9 |
10 |
11 |
12 | 13 |
14 | 15 |
16 |
17 |
18 |
19 | 22 |
23 |
24 |
-------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
Marka Güncelle
8 |
9 |
10 |
11 |
12 | 13 |
14 | 15 |
16 |
17 |
18 |
19 | 22 |
23 |
24 |
-------------------------------------------------------------------------------- /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 | import { LocalStorageService } from '../services/local-storage.service'; 10 | 11 | @Injectable() 12 | export class AuthInterceptor implements HttpInterceptor { 13 | 14 | constructor(private localStorageService: LocalStorageService) { } 15 | 16 | intercept(request: HttpRequest, next: HttpHandler): Observable> { 17 | let tokenModel = this.localStorageService.getToken("token"); 18 | 19 | if (!tokenModel) { 20 | 21 | return next.handle(request); 22 | } 23 | 24 | let newRequest: HttpRequest; 25 | 26 | newRequest = request.clone({ 27 | 28 | headers: request.headers.set("Authorization", "Bearer " + tokenModel.token) 29 | 30 | }); 31 | return next.handle(newRequest); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
Marka Ekle
8 |
9 |
10 |
11 |
12 | 13 |
14 | 16 |
17 |
18 |
19 |
20 | 23 |
24 |
25 |
-------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
Renk Ekle
8 |
9 |
10 |
11 |
12 | 13 |
14 | 16 |
17 |
18 |
19 |
20 | 23 |
24 |
25 |
-------------------------------------------------------------------------------- /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 | 13 | constructor(private authService:AuthService,private router:Router, 14 | private toastrService:ToastrService){ 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.navigateByUrl("/login"); 26 | this.toastrService.info("Sisteme giriş yapmalısınız"); 27 | return false; 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | SELENIUM_PROMISE_MANAGER: false, 20 | baseUrl: 'http://localhost:4200/', 21 | framework: 'jasmine', 22 | jasmineNodeOpts: { 23 | showColors: true, 24 | defaultTimeoutInterval: 30000, 25 | print: function() {} 26 | }, 27 | onPrepare() { 28 | require('ts-node').register({ 29 | project: require('path').join(__dirname, './tsconfig.json') 30 | }); 31 | jasmine.getEnv().addReporter(new SpecReporter({ 32 | spec: { 33 | displayStacktrace: StacktraceOption.PRETTY 34 | } 35 | })); 36 | } 37 | }; -------------------------------------------------------------------------------- /src/app/components/profile/profile.component.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | } 5 | 6 | body { 7 | display: flex; 8 | align-items: center; 9 | padding-top: 40px; 10 | padding-bottom: 40px; 11 | } 12 | 13 | .form-signin { 14 | width: 100%; 15 | max-width: 330px; 16 | padding: 15px; 17 | margin: auto; 18 | } 19 | 20 | .form-signin .checkbox { 21 | font-weight: 400; 22 | } 23 | 24 | .form-signin .form-floating:focus-within { 25 | z-index: 2; 26 | } 27 | 28 | .form-signin input[type="email"] { 29 | margin-bottom: -1px; 30 | border-bottom-right-radius: 0; 31 | border-bottom-left-radius: 0; 32 | } 33 | 34 | .form-signin input[type="password"] { 35 | margin-bottom: 10px; 36 | border-top-left-radius: 0; 37 | border-top-right-radius: 0; 38 | 39 | } 40 | .bd-placeholder-img { 41 | font-size: 1.125rem; 42 | text-anchor: middle; 43 | -webkit-user-select: none; 44 | -moz-user-select: none; 45 | user-select: none; 46 | } 47 | 48 | @media (min-width: 768px) { 49 | .bd-placeholder-img-lg { 50 | font-size: 3.5rem; 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | } 5 | 6 | body { 7 | display: flex; 8 | align-items: center; 9 | padding-top: 40px; 10 | padding-bottom: 40px; 11 | } 12 | 13 | .form-signin { 14 | width: 100%; 15 | max-width: 330px; 16 | padding: 15px; 17 | margin: auto; 18 | } 19 | 20 | .form-signin .checkbox { 21 | font-weight: 400; 22 | } 23 | 24 | .form-signin .form-floating:focus-within { 25 | z-index: 2; 26 | } 27 | 28 | .form-signin input[type="email"] { 29 | margin-bottom: -1px; 30 | border-bottom-right-radius: 0; 31 | border-bottom-left-radius: 0; 32 | } 33 | 34 | .form-signin input[type="password"] { 35 | margin-bottom: 10px; 36 | border-top-left-radius: 0; 37 | border-top-right-radius: 0; 38 | 39 | } 40 | .bd-placeholder-img { 41 | font-size: 1.125rem; 42 | text-anchor: middle; 43 | -webkit-user-select: none; 44 | -moz-user-select: none; 45 | user-select: none; 46 | } 47 | 48 | @media (min-width: 768px) { 49 | .bd-placeholder-img-lg { 50 | font-size: 3.5rem; 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Color } from 'src/app/models/color'; 3 | import { ColorService } from 'src/app/services/color.service'; 4 | 5 | @Component({ 6 | selector: 'app-color', 7 | templateUrl: './color.component.html', 8 | styleUrls: ['./color.component.css'] 9 | }) 10 | export class ColorComponent implements OnInit { 11 | 12 | colors:Color[]=[]; 13 | currentColor:Color; 14 | dataLoaded=false; 15 | filterText=""; 16 | 17 | constructor(private colorService:ColorService) { } 18 | 19 | ngOnInit(): void { 20 | this.getColors(); 21 | } 22 | 23 | getColors(){ 24 | this.colorService.getColors().subscribe(response => { 25 | this.colors=response.data; 26 | this.dataLoaded=true; 27 | }) 28 | } 29 | 30 | setCurrentColor(color:Color){ 31 | this.currentColor = color; 32 | } 33 | 34 | getCurrentColorClass(color:Color){ 35 | if(color == this.currentColor){ 36 | return "list-group-item active" 37 | } 38 | else{ 39 | return "list-group-item" 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /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 { 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 RentalService { 12 | 13 | apiUrl="https://localhost:44384/api/"; 14 | 15 | constructor(private httpClient:HttpClient) { } 16 | 17 | getRentals():Observable>{ 18 | let newPath = this.apiUrl+"rentals/getall"; 19 | return this.httpClient.get>(newPath); 20 | } 21 | 22 | addRental(rental:Rental):Observable{ 23 | let newPath = this.apiUrl+"rentals/add"; 24 | return this.httpClient.post(newPath,rental); 25 | } 26 | 27 | getRentalById(carId:number):Observable>{ 28 | let newPath = this.apiUrl+"rentals/getbycarid?carId="+carId; 29 | return this.httpClient.get>(newPath); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/app/components/car-delete/car-delete.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 32 | 33 | 34 |
IdMarkaRenkModel YılıGünlük FiyatAçıklama 15 |
{{ car.carId }}{{ car.brandName }}{{ car.colorName }}{{ car.modelYear }}{{ car.dailyPrice }}{{ car.description }} 27 |
28 | 29 | 30 |
31 |
35 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 | 7 |
8 | 9 |
10 |
11 | 12 | 14 |
15 |
16 | {{filterText}} aradınız 17 |
18 |
    19 | 20 |
    21 |
    22 | Loading... 23 |
    24 |
    25 |
26 | 27 |
28 |
    29 |
  • {{color.colorName}}
  • 33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 | 6 |

Giriş Yap

7 | 8 |
9 | 10 | 11 |
12 |
13 | 14 | 15 |
16 | 17 |
18 | 21 |
22 | 23 |

© 2017–2021

24 |
25 |
26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async () => { 7 | await TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | }); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'rentcardatabase'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('rentcardatabase'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement; 33 | expect(compiled.querySelector('.content span').textContent).toContain('rentcardatabase app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /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 | import { SingleResponseModel } from '../models/singleResponseModel'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class CustomerService { 12 | 13 | apiUrl="https://localhost:44384/api/"; 14 | 15 | constructor(private httpClient:HttpClient) { } 16 | 17 | getCustomers():Observable>{ 18 | let newPath = this.apiUrl+"customers/getall"; 19 | return this.httpClient.get>(newPath); 20 | } 21 | 22 | getCustomerById(customerId:number):Observable>{ 23 | let newPath = this.apiUrl+"customers/getbyid?id="+customerId; 24 | return this.httpClient.get>(newPath); 25 | } 26 | 27 | getCustomerByEmail(email:string):Observable>{ 28 | let newPath = this.apiUrl + "customers/getcustomerbyemail?email="+email; 29 | return this.httpClient.get>(newPath); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/app/services/local-storage.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Customer } from '../models/customer'; 3 | import { TokenModel } from '../models/tokenModel'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class LocalStorageService { 9 | 10 | tokenKey:string = "token"; 11 | currentCustomer:string = "currentCustomer"; 12 | 13 | constructor() { 14 | } 15 | 16 | setToken(key:string, value:any) { 17 | localStorage.setItem(key, value); 18 | } 19 | 20 | getToken(key:string):any { 21 | return localStorage.getItem(key); 22 | } 23 | 24 | removeToken(key:string) { 25 | localStorage.removeItem(key); 26 | } 27 | 28 | setCurrentCustomer(currentCustomerValue:Customer) { 29 | localStorage.setItem(this.currentCustomer, JSON.stringify(currentCustomerValue)); 30 | } 31 | 32 | getCurrentCustomer(): Customer { 33 | var customer = JSON.parse(localStorage.getItem(this.currentCustomer)); 34 | return customer; 35 | } 36 | 37 | removeCurrentCustomer() { 38 | localStorage.removeItem(this.currentCustomer); 39 | } 40 | 41 | // renewCustomer(customer:Customer){ 42 | // this.removeCurrentCustomer(); 43 | // this.setCurrentCustomer(customer); 44 | // } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/app/components/navi/auth-menu/auth-menu.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Customer } from 'src/app/models/customer'; 5 | import { AuthService } from 'src/app/services/auth.service'; 6 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 7 | 8 | @Component({ 9 | selector: 'app-auth-menu', 10 | templateUrl: './auth-menu.component.html', 11 | styleUrls: ['./auth-menu.component.css'] 12 | }) 13 | export class AuthMenuComponent implements OnInit { 14 | 15 | constructor(private authService:AuthService, 16 | private localStorageService:LocalStorageService, 17 | private toastrService:ToastrService, 18 | private router:Router) { } 19 | 20 | ngOnInit(): void { 21 | } 22 | 23 | isAuthenticated(){ 24 | return this.authService.isAuthenticated(); 25 | } 26 | 27 | logOut(){ 28 | this.localStorageService.removeToken("token"); 29 | this.localStorageService.removeCurrentCustomer(); 30 | this.toastrService.success("Çıkış yapıldı","Başarılı"); 31 | return this.router.navigateByUrl("/login"); 32 | } 33 | 34 | getCurrentCustomer():Customer{ 35 | return this.localStorageService.getCurrentCustomer(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/app/components/brand-delete/brand-delete.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 39 | 40 | 41 |
IdMarka Adı 26 |
{{ brand.brandId }}{{ brand.brandName }} 34 |
35 | 36 | 37 |
38 |
42 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Brand } from 'src/app/models/brand'; 3 | import { BrandService } from 'src/app/services/brand.service'; 4 | import { CarImageService } from 'src/app/services/car-image.service'; 5 | 6 | @Component({ 7 | selector: 'app-brand', 8 | templateUrl: './brand.component.html', 9 | styleUrls: ['./brand.component.css'] 10 | }) 11 | export class BrandComponent implements OnInit { 12 | 13 | brands:Brand[]=[]; 14 | currentBrand:Brand; 15 | dataLoaded=false; 16 | filterText=""; 17 | 18 | constructor(private brandService:BrandService,private carImageService:CarImageService) { } 19 | 20 | ngOnInit(): void { 21 | this.getBrands(); 22 | } 23 | 24 | getBrands(){ 25 | this.brandService.getBrands().subscribe(response => { 26 | this.brands = response.data, 27 | this.dataLoaded=true; 28 | }) 29 | } 30 | 31 | setCurrentBrand(brand:Brand){ 32 | this.currentBrand = brand; 33 | } 34 | 35 | getCurrentBrandClass(brand:Brand){ 36 | if(brand == this.currentBrand){ 37 | return "list-group-item active" 38 | } 39 | else{ 40 | return "list-group-item" 41 | } 42 | } 43 | 44 | getSliderClassName(index:number){ 45 | if(index == 0){ 46 | return "carousel-item active"; 47 | } else { 48 | return "carousel-item"; 49 | } 50 | } 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 7 |
8 |
9 | 13 |
14 |
15 | 18 |
19 | 29 |
30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rentcardatabase", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "^11.2.5", 15 | "@angular/common": "~11.2.4", 16 | "@angular/compiler": "~11.2.4", 17 | "@angular/core": "~11.2.4", 18 | "@angular/forms": "~11.2.4", 19 | "@angular/platform-browser": "~11.2.4", 20 | "@angular/platform-browser-dynamic": "~11.2.4", 21 | "@angular/router": "~11.2.4", 22 | "bootstrap": "^5.0.0-beta2", 23 | "ngx-toastr": "^13.2.1", 24 | "rxjs": "~6.6.0", 25 | "tslib": "^2.0.0", 26 | "zone.js": "~0.11.3" 27 | }, 28 | "devDependencies": { 29 | "@angular-devkit/build-angular": "~0.1102.3", 30 | "@angular/cli": "~11.2.3", 31 | "@angular/compiler-cli": "~11.2.4", 32 | "@types/jasmine": "~3.6.0", 33 | "@types/node": "^12.11.1", 34 | "codelyzer": "^6.0.0", 35 | "jasmine-core": "~3.6.0", 36 | "jasmine-spec-reporter": "~5.0.0", 37 | "karma": "~6.1.0", 38 | "karma-chrome-launcher": "~3.1.0", 39 | "karma-coverage": "~2.0.3", 40 | "karma-jasmine": "~4.0.0", 41 | "karma-jasmine-html-reporter": "^1.5.0", 42 | "protractor": "~7.0.0", 43 | "ts-node": "~8.3.0", 44 | "tslint": "~6.1.0", 45 | "typescript": "~4.1.5" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/app/components/navi/auth-menu/auth-menu.component.html: -------------------------------------------------------------------------------- 1 |
2 | 5 | 6 | 9 |
10 | 11 |
12 |
13 | 17 | 18 | 34 |
35 |
36 | -------------------------------------------------------------------------------- /src/app/services/credit-card.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { CreditCard } from '../models/creditCard'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class CreditCardService { 12 | 13 | apiUrl = "https://localhost:44384/api/"; 14 | 15 | constructor(private httpClient:HttpClient) { } 16 | 17 | getByCardNumber(cardNumber:string):Observable>{ 18 | let newPath = this.apiUrl+"creditcards/getbycardnumber?cardNumber="+cardNumber; 19 | return this.httpClient.get>(newPath); 20 | } 21 | 22 | updateCard(creditCard:CreditCard):Observable{ 23 | let newPath = this.apiUrl+"creditcards/update"; 24 | return this.httpClient.put(newPath, creditCard); 25 | } 26 | 27 | getCardsByCustomerId(customerId:number):Observable>{ 28 | let newPath = this.apiUrl + "creditcards/getcardsbycustomerid?customerid="+customerId; 29 | return this.httpClient.get>(newPath); 30 | } 31 | 32 | add(creditCard:CreditCard):Observable{ 33 | let newPath = this.apiUrl+"creditcards/add"; 34 | return this.httpClient.post(newPath,creditCard); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /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 { ListResponseModel } from '../models/listResponseModel'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class ColorService { 12 | 13 | apiUrl = "https://localhost:44384/api/"; 14 | 15 | constructor(private httpClient:HttpClient) { } 16 | 17 | getColors():Observable>{ 18 | let newPath = this.apiUrl+ "colors/getall"; 19 | return this.httpClient.get>(newPath); 20 | } 21 | 22 | getByColorId(colorId:number):Observable>{ 23 | let newPath = this.apiUrl+"colors/getbycolorid?id="+colorId; 24 | return this.httpClient.get>(newPath); 25 | } 26 | 27 | add(color:Color):Observable{ 28 | let newPath = this.apiUrl+ "colors/add"; 29 | return this.httpClient.post(newPath,color); 30 | } 31 | 32 | update(color:Color):Observable{ 33 | let newPath = this.apiUrl+ "colors/update"; 34 | return this.httpClient.post(newPath,color); 35 | } 36 | 37 | delete(color:Color):Observable{ 38 | let newPath = this.apiUrl+ "colors/delete"; 39 | return this.httpClient.post(newPath,color); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | } 5 | 6 | body { 7 | display: flex; 8 | align-items: center; 9 | padding-top: 40px; 10 | padding-bottom: 40px; 11 | } 12 | 13 | .form-signin { 14 | width: 100%; 15 | max-width: 330px; 16 | padding: 15px; 17 | margin: auto; 18 | } 19 | 20 | .form-signin .checkbox { 21 | font-weight: 400; 22 | } 23 | 24 | .form-signin .form-floating:focus-within { 25 | z-index: 2; 26 | } 27 | 28 | .form-signin input[type="firstName"] { 29 | margin-bottom: -1px; 30 | border-bottom-right-radius: 0; 31 | border-bottom-left-radius: 0; 32 | } 33 | 34 | .form-signin input[type="lastName"] { 35 | margin-bottom: 10px; 36 | border-top-left-radius: 0; 37 | border-top-right-radius: 0; 38 | 39 | } 40 | 41 | .form-signin input[type="email"] { 42 | margin-bottom: -1px; 43 | border-bottom-right-radius: 0; 44 | border-bottom-left-radius: 0; 45 | } 46 | 47 | .form-signin input[type="password"] { 48 | margin-bottom: 10px; 49 | border-top-left-radius: 0; 50 | border-top-right-radius: 0; 51 | 52 | } 53 | .form-signin input[type="confirmPassword"] { 54 | margin-bottom: -1px; 55 | border-bottom-right-radius: 0; 56 | border-bottom-left-radius: 0; 57 | } 58 | 59 | 60 | .bd-placeholder-img { 61 | font-size: 1.125rem; 62 | text-anchor: middle; 63 | -webkit-user-select: none; 64 | -moz-user-select: none; 65 | user-select: none; 66 | } 67 | 68 | @media (min-width: 768px) { 69 | .bd-placeholder-img-lg { 70 | font-size: 3.5rem; 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /src/app/components/car-delete/car-delete.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder, FormControl,Validators} from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Car } from 'src/app/models/car'; 5 | import { CarService } from 'src/app/services/car.service'; 6 | 7 | @Component({ 8 | selector: 'app-car-delete', 9 | templateUrl: './car-delete.component.html', 10 | styleUrls: ['./car-delete.component.css'] 11 | }) 12 | export class CarDeleteComponent implements OnInit { 13 | 14 | carDeleteForm:FormGroup; 15 | 16 | cars:Car[]; 17 | car:Car; 18 | dataLoaded = false; 19 | 20 | 21 | constructor(private formBuilder: FormBuilder, private toastrService: ToastrService, 22 | private carService:CarService) { } 23 | 24 | ngOnInit(): void { 25 | this.getCarList(); 26 | } 27 | 28 | getCarList(){ 29 | this.carService.getCars().subscribe(response => { 30 | this.cars = response.data; 31 | this.dataLoaded = true; 32 | }) 33 | } 34 | 35 | 36 | delete(car:Car) { 37 | this.carService.delete(car).subscribe(response => { 38 | this.toastrService.success('Araç silindi', 'Başarılı') 39 | }, responseError => { 40 | if (responseError.error.ValidationErrors.length > 0) { 41 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 42 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage, 'Doğrulama Hatası'); 43 | } 44 | } 45 | } 46 | ) 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/app/services/brand.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Brand } from '../models/brand'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | import { SingleResponseModel } from '../models/singleResponseModel'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class BrandService { 13 | 14 | apiUrl ="https://localhost:44384/api/"; 15 | 16 | constructor(private httpClient:HttpClient) { } 17 | 18 | getBrands():Observable>{ 19 | let newPath = this.apiUrl+"brands/getall"; 20 | return this.httpClient.get>(newPath); 21 | } 22 | 23 | getByBrandId(brandId:number):Observable>{ 24 | let newPath = this.apiUrl+"brands/getbybrandid?id="+brandId; 25 | return this.httpClient.get>(newPath); 26 | } 27 | 28 | add(brand:Brand):Observable{ 29 | let newPath = this.apiUrl+"brands/add"; 30 | return this.httpClient.post(newPath,brand); 31 | } 32 | 33 | update(brand:Brand):Observable{ 34 | let newPath = this.apiUrl+"brands/update"; 35 | return this.httpClient.post(newPath,brand); 36 | } 37 | 38 | delete(brand:Brand):Observable{ 39 | let newPath = this.apiUrl+"brands/delete"; 40 | return this.httpClient.post(newPath,brand); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder, FormControl,Validators} from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { ColorService } from 'src/app/services/color.service'; 5 | 6 | 7 | @Component({ 8 | selector: 'app-color-add', 9 | templateUrl: './color-add.component.html', 10 | styleUrls: ['./color-add.component.css'] 11 | }) 12 | export class ColorAddComponent implements OnInit { 13 | 14 | colorAddForm:FormGroup; 15 | 16 | constructor(private formBuilder:FormBuilder,private colorService:ColorService,private toastrService:ToastrService) { } 17 | 18 | ngOnInit(): void { 19 | this.createColorAddForm(); 20 | } 21 | 22 | 23 | createColorAddForm(){ 24 | this.colorAddForm = this.formBuilder.group({ 25 | colorName:["",Validators.required] 26 | }) 27 | } 28 | 29 | add(){ 30 | if(this.colorAddForm.valid){ 31 | let colorModel = Object.assign({},this.colorAddForm.value) 32 | 33 | this.colorService.add(colorModel).subscribe(response => { 34 | this.toastrService.success('Renk eklendi','Başarılı') 35 | },responseError => { 36 | if(responseError.errors.Errors.length > 0){ 37 | for (let i = 0; i < responseError.errors.Errors.length; i++) { 38 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage,'Doğrulama Hatası'); 39 | } 40 | } 41 | }) 42 | }else{ 43 | this.toastrService.error('Formunuz eksik','Dikkat') 44 | } 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/app/components/color-delete/color-delete.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder, FormControl,Validators} from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Color } from 'src/app/models/color'; 5 | import { ColorService } from 'src/app/services/color.service'; 6 | 7 | 8 | @Component({ 9 | selector: 'app-color-delete', 10 | templateUrl: './color-delete.component.html', 11 | styleUrls: ['./color-delete.component.css'] 12 | }) 13 | export class ColorDeleteComponent implements OnInit { 14 | 15 | 16 | colorDeleteForm:FormGroup; 17 | colors:Color[]; 18 | dataLoaded =false; 19 | 20 | constructor(private formBuilder:FormBuilder,private colorService:ColorService,private toastrService:ToastrService) { } 21 | 22 | ngOnInit(): void { 23 | this.getColorList(); 24 | } 25 | 26 | getColorList(){ 27 | this.colorService.getColors().subscribe(response => { 28 | this.colors = response.data ; 29 | this.dataLoaded = true; 30 | }) 31 | } 32 | 33 | delete(color:Color){ 34 | this.colorService.delete(color).subscribe(response => { 35 | this.toastrService.success('Renk silindi','Başarılı') 36 | } 37 | ,responseError => { 38 | if(responseError.error.ValidationErrors.length > 0){ 39 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 40 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,'Doğrulama Hatası'); 41 | } 42 | } 43 | }) 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/rentcardatabase'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /src/app/services/auth.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 { LoginModel } from '../models/loginModel'; 6 | import { RegisterModel } from '../models/registerModel'; 7 | import { ResponseModel } from '../models/responseModel'; 8 | import { SingleResponseModel } from '../models/singleResponseModel'; 9 | import { TokenModel } from '../models/tokenModel'; 10 | import { LocalStorageService } from './local-storage.service'; 11 | 12 | @Injectable({ 13 | providedIn: 'root' 14 | }) 15 | export class AuthService { 16 | 17 | apiUrl = "https://localhost:44384/api/"; 18 | 19 | constructor(private httpClient:HttpClient,private localStorageService:LocalStorageService) { } 20 | 21 | login(user:LoginModel):Observable>{ 22 | let newPath = this.apiUrl + "auth/login"; 23 | return this.httpClient.post>(newPath,user); 24 | } 25 | 26 | register(user:RegisterModel):Observable>{ 27 | let newPath = this.apiUrl + "auth/register"; 28 | return this.httpClient.post>(newPath,user); 29 | } 30 | 31 | isAuthenticated(){ 32 | if(this.localStorageService.getToken("token")){ 33 | return true; 34 | }else{ 35 | return false; 36 | } 37 | } 38 | 39 | update(customer:Customer):Observable>{ 40 | let newPath = this.apiUrl+"auth/update"; 41 | return this.httpClient.post>(newPath,customer); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder, FormControl,Validators} from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Brand } from 'src/app/models/brand'; 5 | import { BrandService } from 'src/app/services/brand.service'; 6 | 7 | 8 | 9 | @Component({ 10 | selector: 'app-brand-add', 11 | templateUrl: './brand-add.component.html', 12 | styleUrls: ['./brand-add.component.css'] 13 | }) 14 | export class BrandAddComponent implements OnInit { 15 | 16 | brandAddForm: FormGroup; 17 | 18 | constructor(private brandService: BrandService, private formBuilder: FormBuilder, private toastrService: ToastrService) { } 19 | 20 | ngOnInit(): void { 21 | this.createBrandAddForm(); 22 | } 23 | 24 | 25 | createBrandAddForm() { 26 | this.brandAddForm = this.formBuilder.group({ 27 | brandName: ["", Validators.required] 28 | }) 29 | } 30 | 31 | add() { 32 | if (this.brandAddForm.valid) { 33 | let brandModel = Object.assign({}, this.brandAddForm.value) 34 | 35 | this.brandService.add(brandModel).subscribe(response => { 36 | console.log(response); 37 | this.toastrService.success('Marka eklendi', 'Başarılı') 38 | }, responseError => { 39 | if (responseError.error.ValidationErrors.length > 0) { 40 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 41 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage, 'Doğrulama Hatası'); 42 | } 43 | } 44 | }) 45 | } else { 46 | this.toastrService.error('Formunuz eksik', 'Dikkat') 47 | } 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/app/components/brand-delete/brand-delete.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder, FormControl,Validators} from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Brand } from 'src/app/models/brand'; 5 | import { BrandService } from 'src/app/services/brand.service'; 6 | 7 | @Component({ 8 | selector: 'app-brand-delete', 9 | templateUrl: './brand-delete.component.html', 10 | styleUrls: ['./brand-delete.component.css'] 11 | }) 12 | export class BrandDeleteComponent implements OnInit { 13 | 14 | brandDeleteForm: FormGroup; 15 | 16 | // selectedBrand:Brand; 17 | 18 | brands: Brand[]; 19 | brand: Brand; 20 | dataLoaded = false; 21 | 22 | constructor(private brandService: BrandService, private formBuilder: FormBuilder, private toastrService: ToastrService) { } 23 | 24 | ngOnInit(): void { 25 | this.getBrandList(); 26 | } 27 | 28 | getBrandList() { 29 | this.brandService.getBrands().subscribe(response => { 30 | this.brands = response.data 31 | this.dataLoaded = true; 32 | }) 33 | } 34 | 35 | // setSelectedBrandToDelete(brand: Brand){ 36 | // this.selectedBrand = brand; 37 | // this.delete(); 38 | // } 39 | 40 | 41 | delete(brand:Brand) { 42 | this.brandService.delete(brand).subscribe(response => { 43 | this.toastrService.success('Marka silindi', 'Başarılı') 44 | }, responseError => { 45 | if (responseError.error.ValidationErrors.length > 0) { 46 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 47 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage, 'Doğrulama Hatası'); 48 | } 49 | } 50 | } 51 | ) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.html: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 |
15 |
16 |
17 |
18 | 19 |
20 | 21 |
22 | 23 | 24 |
25 | 26 |
27 | {{filterText}} aradınız 28 |
29 | 30 |
    31 | 32 |
    33 |
    34 | Loading... 35 |
    36 |
    37 |
38 | 39 |
    40 | 41 |
    42 |
  • {{brand.brandName}} 44 |
  • 45 | 46 | 48 |
49 | 50 |
51 |
52 | 53 |
54 |
55 | 56 |
-------------------------------------------------------------------------------- /src/app/components/payment/card-saved/card-saved.component.ts: -------------------------------------------------------------------------------- 1 | import { Component,EventEmitter, OnInit, Output } from '@angular/core'; 2 | import { CreditCard } from 'src/app/models/creditCard'; 3 | import { Customer } from 'src/app/models/customer'; 4 | import { CreditCardService } from 'src/app/services/credit-card.service'; 5 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 6 | 7 | @Component({ 8 | selector: 'app-card-saved', 9 | templateUrl: './card-saved.component.html', 10 | styleUrls: ['./card-saved.component.css'] 11 | }) 12 | export class CardSavedComponent implements OnInit { 13 | 14 | cards:CreditCard[]; 15 | currentCustomer:Customer; 16 | @Output() selectedCard : EventEmitter = new EventEmitter(); 17 | 18 | constructor(private creditCardService:CreditCardService, 19 | private localStorageService:LocalStorageService) { } 20 | 21 | ngOnInit(): void { 22 | this.currentCustomer = Object.assign({},this.localStorageService.getCurrentCustomer()); 23 | this.getCardsByCustomerId(this.currentCustomer.customerId); 24 | } 25 | 26 | getCardsByCustomerId(customerId:number){ 27 | this.creditCardService.getCardsByCustomerId(customerId).subscribe(response => { 28 | this.cards = response.data; 29 | }) 30 | } 31 | 32 | getSelectCard(cardId:number){ 33 | let selectedCard = this.cards.find(card => card.cardId == cardId); 34 | 35 | 36 | let newSelectedCard: CreditCard = { 37 | 38 | cardId: selectedCard.cardId, 39 | nameOnTheCard : selectedCard.nameOnTheCard, 40 | cardNumber : selectedCard.cardNumber, 41 | expirationDate : selectedCard.expirationDate, 42 | customerId : selectedCard.customerId, 43 | cardCvv : selectedCard.cardCvv, 44 | moneyInTheCard : selectedCard?.moneyInTheCard 45 | } 46 | this.selectedCard.emit(newSelectedCard); 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 |
7 |
8 |
9 | 10 | 12 |
13 |
14 | {{filterText}} aradınız 15 |
16 | 17 | 18 | 19 |
20 |

{{title}}

21 |
22 |
23 | Loading... 24 |
25 | 26 |
27 |
28 | 29 |
30 |
{{car.description}}
31 |
32 |
    33 |
  • Marka: {{car.brandName}}
  • 34 |
  • Model: {{car.modelYear}}
  • 35 |
  • Günlük Fiyat: {{car.dailyPrice}}
  • 36 |
  • Findex Puanı: {{car.findexPoint}}
  • 37 | 38 |
39 |
40 |
41 | 42 |
43 |
44 | 45 |
46 |
47 |
48 |
49 |
50 |
51 | 52 |
53 |
54 | 55 | 56 | -------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormBuilder, FormControl, Validators } from '@angular/forms'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Color } from 'src/app/models/color'; 6 | import { ColorService } from 'src/app/services/color.service'; 7 | 8 | 9 | @Component({ 10 | selector: 'app-color-update', 11 | templateUrl: './color-update.component.html', 12 | styleUrls: ['./color-update.component.css'] 13 | }) 14 | export class ColorUpdateComponent implements OnInit { 15 | 16 | colorUpdateForm:FormGroup; 17 | color:Color; 18 | 19 | constructor(private formBuilder: FormBuilder, private toastrService: ToastrService,private colorService:ColorService, 20 | private activatedRoute: ActivatedRoute) { } 21 | 22 | ngOnInit(): void { 23 | this.activatedRoute.params.subscribe(params => { 24 | this.getByColorId(params["colorId"]); 25 | }) 26 | } 27 | 28 | getByColorId(colorId:number){ 29 | this.colorService.getByColorId(colorId).subscribe(response => { 30 | this.color = response.data[0]; 31 | this.createColorUpdateForm(); 32 | }) 33 | } 34 | 35 | createColorUpdateForm(){ 36 | this.colorUpdateForm = this.formBuilder.group({ 37 | colorId:[this.color.colorId,Validators.required], 38 | colorName:[this.color.colorName,Validators.required] 39 | }) 40 | } 41 | 42 | 43 | update(){ 44 | if(this.colorUpdateForm.valid){ 45 | let colorModel = Object.assign({},this.colorUpdateForm.value) 46 | 47 | this.colorService.update(colorModel).subscribe(response => { 48 | this.toastrService.success('Renk güncellendi','Başarılı') 49 | },responseError => { 50 | if(responseError.error.ValidationErrors.length > 0){ 51 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 52 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,'Doğrulama Hatası'); 53 | } 54 | } 55 | }) 56 | }else{ 57 | this.toastrService.error('Formunuz eksik','Dikkat') 58 | } 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormBuilder, FormControl, Validators } from '@angular/forms'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Brand } from 'src/app/models/brand'; 6 | import { BrandService } from 'src/app/services/brand.service'; 7 | 8 | @Component({ 9 | selector: 'app-brand-update', 10 | templateUrl: './brand-update.component.html', 11 | styleUrls: ['./brand-update.component.css'] 12 | }) 13 | export class BrandUpdateComponent implements OnInit { 14 | 15 | brandUpdateForm: FormGroup; 16 | brand: Brand; 17 | 18 | constructor(private formBuilder: FormBuilder, private toastrService: ToastrService, private brandService: BrandService, 19 | private activatedRoute: ActivatedRoute) { } 20 | 21 | ngOnInit(): void { 22 | this.activatedRoute.params.subscribe(params => { 23 | this.getByBrandId(params["brandId"]); 24 | }) 25 | } 26 | 27 | 28 | getByBrandId(brandId: number) { 29 | this.brandService.getByBrandId(brandId).subscribe(response => { 30 | this.brand = response.data[0]; 31 | this.createBrandUpdateForm() 32 | }) 33 | } 34 | 35 | 36 | createBrandUpdateForm() { 37 | this.brandUpdateForm = this.formBuilder.group({ 38 | brandId: [this.brand.brandId, Validators.required], 39 | brandName: [this.brand.brandName, Validators.required] 40 | }) 41 | } 42 | 43 | update() { 44 | if (this.brandUpdateForm.valid) { 45 | let brandModel = Object.assign({}, this.brandUpdateForm.value) 46 | 47 | this.brandService.update(brandModel).subscribe(response => { 48 | this.toastrService.success('Marka güncellendi', 'Başarılı') 49 | }, responseError => { 50 | console.log(responseError) 51 | if (responseError.error.errors.length > 0) { 52 | for (let i = 0; i < responseError.error.errors.length; i++) { 53 | this.toastrService.error(responseError.error.errors[i].ErrorMessage, 'Doğrulama Hatası'); 54 | } 55 | } 56 | }) 57 | } else { 58 | this.toastrService.error('Formunuz eksik', 'Dikkat') 59 | } 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /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 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class CarService { 12 | 13 | apiUrl = "https://localhost:44384/api/"; 14 | 15 | constructor(private httpClient:HttpClient) { } 16 | 17 | getCars():Observable>{ 18 | let newPath = this.apiUrl+ "cars/getcardetails"; 19 | return this.httpClient.get>(newPath); 20 | } 21 | 22 | getCarsByBrandId(brandId:number):Observable>{ 23 | let newPath= this.apiUrl +"cars/getbybrandid?brandId="+brandId 24 | return this.httpClient.get>(newPath); 25 | } 26 | 27 | getCarsByColorId(colorId:number):Observable>{ 28 | let newPath= this.apiUrl +"cars/getbycolorid?colorId="+colorId 29 | return this.httpClient.get>(newPath); 30 | } 31 | 32 | getCarDetails(carId:number):Observable>{ 33 | let newPath= this.apiUrl+"cars/getcardetailsbycarid?id="+carId; 34 | return this.httpClient.get>(newPath); 35 | } 36 | 37 | // cars/getcarsbybrandandcolorid?brandId=5&colorId=1 38 | 39 | getCarsByBrandAndColorId(brandId:number,colorId:number):Observable>{ 40 | let newPath= this.apiUrl+"cars/getcarsbybrandandcolorid?brandId="+brandId+"&colorId="+colorId; 41 | return this.httpClient.get>(newPath); 42 | } 43 | 44 | add(car:Car):Observable{ 45 | let newPath = this.apiUrl+"cars/add"; 46 | return this.httpClient.post(newPath,car); 47 | } 48 | 49 | delete(car:Car):Observable{ 50 | let newPath = this.apiUrl+"cars/delete"; 51 | return this.httpClient.post(newPath,car); 52 | } 53 | 54 | update(car:Car):Observable{ 55 | let newPath = this.apiUrl+"cars/update"; 56 | return this.httpClient.post(newPath,car); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/app/components/profile/profile.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 | 6 |

Bilgileri güncelle

7 | 8 |
9 | 11 | 12 |
13 | 14 |
15 | 17 | 18 |
19 | 20 |
21 | 23 | 24 |
25 | 26 |
27 | 29 | 30 |
31 | 32 |
33 | 35 | 36 |
37 | 38 |
39 | 41 | 42 |
43 | 44 |

© 2017–2021

45 |
46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 | 6 |

Kayıt Ol

7 | 8 |
9 | 11 | 12 |
13 | 14 | 15 |
16 | 18 | 19 |
20 | 21 |
22 | 24 | 25 |
26 | 27 |
28 | 30 | 31 |
32 | 33 |
34 | 36 | 37 |
38 | 39 |
40 | 42 | 43 |
44 | 45 |

© 2017–2021

46 |
47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.html: -------------------------------------------------------------------------------- 1 | 2 | 42 | 43 | 44 | 59 | 60 | -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { Car } from 'src/app/models/car'; 4 | import { CarImage } from 'src/app/models/carImage'; 5 | import { AuthService } from 'src/app/services/auth.service'; 6 | import { CarImageService } from 'src/app/services/car-image.service'; 7 | import { CarService } from 'src/app/services/car.service'; 8 | 9 | @Component({ 10 | selector: 'app-car-detail', 11 | templateUrl: './car-detail.component.html', 12 | styleUrls: ['./car-detail.component.css'] 13 | }) 14 | export class CarDetailComponent implements OnInit { 15 | 16 | carImages:CarImage[]; 17 | carId:number; 18 | car:Car; 19 | currentCar:Car; 20 | imageUrl = 'https://localhost:44384/Images/'; 21 | dataLoaded =false; 22 | 23 | 24 | constructor(private carImageService:CarImageService, 25 | private carService:CarService, 26 | private activatedRoute:ActivatedRoute, 27 | private authService:AuthService) { } 28 | 29 | ngOnInit(): void { 30 | this.activatedRoute.params.subscribe(params => { 31 | if(params["carId"]){ 32 | this.carId = params["carId"]; 33 | this.getCarDetails(params["carId"]); 34 | this.getCarImagesByCarId(params["carId"]); 35 | } 36 | }) 37 | 38 | } 39 | 40 | //Bunu fazla yazdım sanırım 41 | getCarImages(){ 42 | this.carImageService.getCarImages().subscribe(response =>{ 43 | this.carImages = response.data; 44 | this.dataLoaded=true; 45 | }) 46 | } 47 | 48 | getCarImagesByCarId(carId:number){ 49 | this.carImageService.getCarImagesByCarId(carId).subscribe(response =>{ 50 | this.carImages = response.data; 51 | this.dataLoaded=true; 52 | }) 53 | } 54 | 55 | 56 | getCarDetails(carId:number){ 57 | this.carService.getCarDetails(carId).subscribe(response =>{ 58 | this.car = response.data[0]; 59 | this.dataLoaded=true; 60 | }) 61 | } 62 | 63 | isAuthenticate():boolean{ 64 | return this.authService.isAuthenticated(); 65 | } 66 | 67 | getSliderClassName(index:number){ 68 | if(index == 0){ 69 | return "carousel-item active"; 70 | } else { 71 | return "carousel-item"; 72 | } 73 | } 74 | 75 | 76 | setCurrentCar(car:Car){ 77 | this.currentCar = car; 78 | } 79 | 80 | getCurrentCarClass(car:Car){ 81 | if(car == this.currentCar){ 82 | return "list-group-item active" 83 | } 84 | else{ 85 | return "list-group-item" 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { Brand } from 'src/app/models/brand'; 4 | import { Car } from 'src/app/models/car'; 5 | import { Color } from 'src/app/models/color'; 6 | import { BrandService } from 'src/app/services/brand.service'; 7 | import { CarService } from 'src/app/services/car.service'; 8 | import { ColorService } from 'src/app/services/color.service'; 9 | 10 | @Component({ 11 | selector: 'app-car-filter', 12 | templateUrl: './car-filter.component.html', 13 | styleUrls: ['./car-filter.component.css'] 14 | }) 15 | export class CarFilterComponent implements OnInit { 16 | 17 | colors:Color[]; 18 | cars:Car[]; 19 | brands:Brand[]; 20 | currentBrand:number; 21 | currentColor:number; 22 | dataLoaded=false; 23 | 24 | constructor(private colorService:ColorService,private brandService:BrandService,private carService:CarService) { } 25 | 26 | ngOnInit(): void { 27 | this.getColors(); 28 | this.getBrands(); 29 | } 30 | 31 | getColors(){ 32 | this.colorService.getColors().subscribe(response => { 33 | this.colors=response.data; 34 | this.dataLoaded=true; 35 | }) 36 | } 37 | 38 | getBrands(){ 39 | this.brandService.getBrands().subscribe(response => { 40 | this.brands=response.data; 41 | this.dataLoaded=true; 42 | }) 43 | } 44 | 45 | IsCurrentBrandNull(){ 46 | if(this.currentBrand){ 47 | return true; 48 | }else{ 49 | return false; 50 | } 51 | } 52 | 53 | IsCurrentColorNull(){ 54 | if(this.currentColor){ 55 | return true; 56 | }else{ 57 | return false; 58 | } 59 | } 60 | 61 | getCurrentBrand(brand:Brand){ 62 | if(this.currentBrand==brand.brandId){ 63 | return true; 64 | }else{ 65 | return false; 66 | } 67 | } 68 | 69 | getCurrentColor(color:Color){ 70 | if(color.colorId==this.currentColor){ 71 | return true; 72 | }else{ 73 | return false; 74 | } 75 | } 76 | 77 | getRouterLink(){ 78 | if(this.currentBrand && this.currentColor){ 79 | return "/cars/filter/brand/"+this.currentBrand+"/color/"+this.currentColor; 80 | // return this.carService.getCarsByBrandAndColorId(this.currentBrand,this.currentColor).subscribe(response => { 81 | // this.cars = response.data; 82 | // this.dataLoaded =true; 83 | // }) 84 | }else if(this.currentBrand){ 85 | return "/cars/filter/brand/"+this.currentBrand; 86 | }else if(this.currentColor){ 87 | return "/cars/filter/color/"+this.currentColor; 88 | }else{ 89 | return "/cars"; 90 | } 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## HOME 2 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/homePage.png) 3 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/loginedPage2.png) 4 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/loginedPage.png) 5 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/registeredPage.png) 6 | 7 | ## LOGOUT 8 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/logoutPage.png) 9 | 10 | ## FILTERS 11 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/filtered3.png) 12 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/filtered1.png) 13 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/filtered2.png) 14 | 15 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/filter3.png) 16 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/filter1.png) 17 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/filter2.png) 18 | 19 | ## PAYMENT and RENTAL 20 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/paymentPage.png) 21 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/rentalPage.png) 22 | ![Home](https://github.com/nursebilcanb/re-cap-project-frontend/blob/master/src/assets/images/invaliddatechoice.png) 23 | 24 | # Rentcardatabase 25 | 26 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.3. 27 | 28 | ## Development server 29 | 30 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 31 | 32 | ## Code scaffolding 33 | 34 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 35 | 36 | ## Build 37 | 38 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 39 | 40 | ## Running unit tests 41 | 42 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 43 | 44 | ## Running end-to-end tests 45 | 46 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 47 | 48 | ## Further help 49 | 50 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 51 | -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.ts: -------------------------------------------------------------------------------- 1 | import { stringify } from '@angular/compiler/src/util'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import {FormGroup,FormBuilder, FormControl,Validators} from '@angular/forms'; 4 | import { ActivatedRoute, Router } from '@angular/router'; 5 | import { ToastrService } from 'ngx-toastr'; 6 | import { Brand } from 'src/app/models/brand'; 7 | import { Car } from 'src/app/models/car'; 8 | import { Color } from 'src/app/models/color'; 9 | import { BrandService } from 'src/app/services/brand.service'; 10 | import { CarService } from 'src/app/services/car.service'; 11 | import { ColorService } from 'src/app/services/color.service'; 12 | 13 | @Component({ 14 | selector: 'app-car-add', 15 | templateUrl: './car-add.component.html', 16 | styleUrls: ['./car-add.component.css'] 17 | }) 18 | export class CarAddComponent implements OnInit { 19 | 20 | 21 | carAddForm:FormGroup; 22 | brands:Brand[]; 23 | colors:Color[]; 24 | 25 | brand:Brand; 26 | color:Color; 27 | 28 | 29 | constructor(private formBuilder:FormBuilder,private carService:CarService, 30 | private toastrService:ToastrService, 31 | private colorService:ColorService, 32 | private brandService:BrandService, 33 | private router:Router ) { } 34 | 35 | ngOnInit(): void { 36 | this.createCarAddForm(); 37 | this.getBrands(); 38 | this.getColors(); 39 | } 40 | 41 | getBrands(){ 42 | this.brandService.getBrands().subscribe(response => { 43 | this.brands = response.data; 44 | // this.brand = response.data[0]; 45 | }) 46 | } 47 | 48 | getColors(){ 49 | this.colorService.getColors().subscribe(response => { 50 | this.colors = response.data; 51 | // this.color = response.data[0]; 52 | }) 53 | } 54 | 55 | 56 | createCarAddForm(){ 57 | this.carAddForm = this.formBuilder.group({ 58 | brandId: ["",Validators.required], 59 | colorId: ["",Validators.required], 60 | modelYear:["",Validators.required], 61 | dailyPrice:["",Validators.required], 62 | description:["",Validators.required] 63 | }); 64 | } 65 | 66 | add(){ 67 | if(this.carAddForm.valid){ 68 | let carModel = Object.assign({},this.carAddForm.value) 69 | 70 | this.carService.add(carModel).subscribe(response => { 71 | 72 | this.toastrService.success('Araç eklendi','Başarılı') 73 | this.router.navigateByUrl('/cars'); 74 | },responseError => { 75 | if(responseError.error.ValidationErrors.length > 0){ 76 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 77 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,'Doğrulama Hatası'); 78 | } 79 | } 80 | }) 81 | }else{ 82 | this.toastrService.error('Formunuz eksik','Dikkat') 83 | } 84 | } 85 | 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Car } from 'src/app/models/car'; 5 | import { CarService } from 'src/app/services/car.service'; 6 | import { CustomerService } from 'src/app/services/customer.service'; 7 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 8 | 9 | @Component({ 10 | selector: 'app-car', 11 | templateUrl: './car.component.html', 12 | styleUrls: ['./car.component.css'] 13 | }) 14 | export class CarComponent implements OnInit { 15 | 16 | title ="Araç Listesi" 17 | cars:Car[]=[]; 18 | imageUrl = "https://localhost:44384/Images/" 19 | dataLoaded = false; 20 | filterText=""; 21 | defaultImage="logo.jpg"; 22 | 23 | constructor(private carService:CarService, 24 | private activatedRoute:ActivatedRoute, 25 | private toastrService:ToastrService, 26 | private localStorageService:LocalStorageService, 27 | private customerService:CustomerService) { } 28 | 29 | ngOnInit(): void { 30 | this.activatedRoute.params.subscribe(params =>{ 31 | if(params["brandId"] && params["colorId"]){ 32 | this.getCarsByFilter(params["brandId"],params["colorId"]) 33 | console.log("if") 34 | } 35 | else if(params["colorId"]){ 36 | this.getCarsByColorId(params["colorId"]) 37 | } 38 | else if(params["brandId"]){ 39 | this.getCarsByBrandId(params["brandId"]) 40 | } 41 | else if(params["carId"]){ 42 | this.getCarDetails(params["carId"]); 43 | } 44 | else{ 45 | this.getCars() 46 | } 47 | }) 48 | 49 | } 50 | 51 | getCars(){ 52 | this.carService.getCars().subscribe(response => { 53 | this.cars = response.data; 54 | this.dataLoaded=true; 55 | }); 56 | } 57 | 58 | getCarsByColorId(colorId:number){ 59 | this.carService.getCarsByColorId(colorId).subscribe(response => { 60 | this.cars = response.data; 61 | this.dataLoaded=true; 62 | }); 63 | } 64 | getCarsByBrandId(brandId:number){ 65 | this.carService.getCarsByBrandId(brandId).subscribe(response => { 66 | this.cars = response.data; 67 | this.dataLoaded=true; 68 | 69 | }); 70 | } 71 | 72 | getCarDetails(carId:number){ 73 | this.carService.getCarDetails(carId).subscribe(response => { 74 | this.cars = response.data; 75 | this.dataLoaded=true; 76 | }); 77 | } 78 | 79 | getCarsByFilter(brandId:number,colorId:number){ 80 | this.carService.getCarsByBrandAndColorId(brandId,colorId).subscribe(response => { 81 | this.cars = response.data; 82 | this.dataLoaded = true; 83 | if(this.cars.length==0){ 84 | this.toastrService.info("Arama sonucunuza ait araç bulunamamaktadır.","Arama sonucu") 85 | } 86 | }) 87 | } 88 | 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /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/app/components/car-update/car-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder, FormControl,Validators} from '@angular/forms'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Brand } from 'src/app/models/brand'; 6 | import { Car } from 'src/app/models/car'; 7 | import { Color } from 'src/app/models/color'; 8 | import { BrandService } from 'src/app/services/brand.service'; 9 | import { CarService } from 'src/app/services/car.service'; 10 | import { ColorService } from 'src/app/services/color.service'; 11 | 12 | @Component({ 13 | selector: 'app-car-update', 14 | templateUrl: './car-update.component.html', 15 | styleUrls: ['./car-update.component.css'] 16 | }) 17 | export class CarUpdateComponent implements OnInit { 18 | 19 | carUpdateForm:FormGroup; 20 | car:Car; 21 | carDetails:Car; 22 | 23 | 24 | brands:Brand []; 25 | colors: Color[]; 26 | 27 | constructor(private formBuilder:FormBuilder, 28 | private toastrService:ToastrService, 29 | private activatedRoute:ActivatedRoute, 30 | private carService:CarService, 31 | private colorService:ColorService, 32 | private brandService:BrandService) { } 33 | 34 | ngOnInit(): void { 35 | this.activatedRoute.params.subscribe(params => { 36 | this.getCarDetails(params["carId"]); 37 | this.getBrands(); 38 | this.getColors(); 39 | }) 40 | 41 | } 42 | getBrands(){ 43 | this.brandService.getBrands().subscribe(response => { 44 | this.brands = response.data; 45 | }) 46 | } 47 | 48 | getColors(){ 49 | this.colorService.getColors().subscribe(response => { 50 | this.colors = response.data; 51 | }) 52 | } 53 | 54 | 55 | getCarDetails(carId:number){ 56 | this.carService.getCarDetails(carId).subscribe(response => { 57 | this.carDetails = response.data[0]; 58 | this.createCarUpdateForm(); 59 | }) 60 | } 61 | 62 | 63 | createCarUpdateForm(){ 64 | this.carUpdateForm = this.formBuilder.group({ 65 | carId:[this.carDetails.carId,Validators.required], 66 | colorId:[this.carDetails.colorId,Validators.required], 67 | brandId:[this.carDetails.brandId,Validators.required], 68 | modelYear:[this.carDetails.modelYear,Validators.required], 69 | dailyPrice:[this.carDetails.dailyPrice,Validators.required], 70 | description:[this.carDetails.description,Validators.required] 71 | }) 72 | } 73 | 74 | 75 | update(){ 76 | if(this.carUpdateForm.valid){ 77 | let carModel = Object.assign({},this.carUpdateForm.value) 78 | 79 | this.carService.update(carModel).subscribe(response => { 80 | this.toastrService.success('Araç güncellendi','Başarılı') 81 | },responseError => { 82 | if(responseError.error.ValidationErrors.length > 0){ 83 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 84 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,'Doğrulama Hatası'); 85 | } 86 | } 87 | }) 88 | }else{ 89 | this.toastrService.error('Formunuz eksik','Dikkat') 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup,FormControl,Validators,FormBuilder } from "@angular/forms"; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Customer } from 'src/app/models/customer'; 6 | import { LoginModel } from 'src/app/models/loginModel'; 7 | import { AuthService } from 'src/app/services/auth.service'; 8 | import { CustomerService } from 'src/app/services/customer.service'; 9 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 10 | 11 | @Component({ 12 | selector: 'app-login', 13 | templateUrl: './login.component.html', 14 | styleUrls: ['./login.component.css'] 15 | }) 16 | export class LoginComponent implements OnInit { 17 | 18 | imageUrl = "https://localhost:44384/Images/" 19 | defaultImage="logo.jpg"; 20 | 21 | loginForm:FormGroup; 22 | customer:Customer; 23 | currentCustomerEmail:string; 24 | 25 | constructor(private formBuilder:FormBuilder, 26 | private authService:AuthService, 27 | private toastrService:ToastrService, 28 | private router:Router, 29 | private customerService:CustomerService, 30 | private localStorageService:LocalStorageService) { } 31 | 32 | ngOnInit(): void { 33 | this.setCurrentCustomerEmail(); 34 | this.createLoginForm(); 35 | } 36 | 37 | createLoginForm(){ 38 | this.loginForm = this.formBuilder.group({ 39 | email: [this.currentCustomerEmail,Validators.required], 40 | password:["",Validators.required] 41 | }) 42 | } 43 | 44 | login(){ 45 | // if(this.loginForm.valid){ 46 | // let loginModel = Object.assign({},this.loginForm.value) 47 | 48 | // this.authService.login(loginModel).subscribe(response => { 49 | // this.toastrService.success(response.message) 50 | // this.router.navigateByUrl("/cars"); 51 | // localStorage.setItem("token",response.data.token); 52 | // },responseError => { 53 | // this.toastrService.error(responseError.error) 54 | // }) 55 | // } 56 | 57 | if(this.loginForm.invalid){ 58 | this.toastrService.error("Bütün alanları doldurunuz","Hata"); 59 | return; 60 | } 61 | 62 | let loginModel : LoginModel = Object.assign({},this.loginForm.value); 63 | 64 | this.authService.login(loginModel).subscribe(response => { 65 | this.toastrService.success(response.message,"Başarılı"); 66 | this.localStorageService.setToken("token",response.data.token); 67 | this.getCustomerByEmail(loginModel.email); 68 | 69 | return this.router.navigateByUrl("/cars"); 70 | },responseError => { 71 | return this.toastrService.error(responseError.error,"Hata"); 72 | }) 73 | } 74 | 75 | getCustomerByEmail(email:string){ 76 | this.customerService.getCustomerByEmail(email).subscribe(response => { 77 | this.customer = response.data; 78 | this.localStorageService.setCurrentCustomer(this.customer); 79 | 80 | }) 81 | } 82 | 83 | setCurrentCustomerEmail(){ 84 | return this.localStorageService.getCurrentCustomer() 85 | ? this.currentCustomerEmail = this.localStorageService.getCurrentCustomer().email 86 | :null; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/app/components/profile/profile.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Customer } from 'src/app/models/customer'; 3 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 4 | import { FormGroup, FormControl, Validators, FormBuilder } from "@angular/forms"; 5 | import { ToastrService } from 'ngx-toastr'; 6 | import { AuthService } from 'src/app/services/auth.service'; 7 | 8 | 9 | @Component({ 10 | selector: 'app-profile', 11 | templateUrl: './profile.component.html', 12 | styleUrls: ['./profile.component.css'] 13 | }) 14 | export class ProfileComponent implements OnInit { 15 | 16 | customer:Customer; 17 | customerUpdateForm:FormGroup; 18 | 19 | imageUrl = "https://localhost:44384/Images/" 20 | defaultImage="logo.jpg"; 21 | 22 | constructor(private localStorageService:LocalStorageService, 23 | private formBuilder:FormBuilder, 24 | private toastrService:ToastrService, 25 | private authService:AuthService) { } 26 | 27 | ngOnInit(): void { 28 | this.getCustomer(); 29 | this.createCustomerUpdateForm(); 30 | } 31 | 32 | getCustomer(){ 33 | this.customer = this.localStorageService.getCurrentCustomer(); 34 | } 35 | 36 | createCustomerUpdateForm(){ 37 | this.customerUpdateForm = this.formBuilder.group({ 38 | customerId:[this.customer.customerId,Validators.required], 39 | userId:[this.customer.userId,Validators.required], 40 | firstName:[this.customer.firstName,Validators.required], 41 | lastName:[this.customer.lastName,Validators.required], 42 | companyName:[this.customer.companyName,Validators.required], 43 | email:[this.customer.email,Validators.required], 44 | findexPoint:[this.customer.findexPoint,Validators.required], 45 | password:[""], 46 | confirmPassword:[""] 47 | }) 48 | } 49 | 50 | update(){ 51 | if(this.customerUpdateForm.invalid){ 52 | this.toastrService.error("Bütün alanları doldurduğunuzdan emin olun","Hata"); 53 | return; 54 | } 55 | 56 | if(this.customerUpdateForm.value["password"] != this.customerUpdateForm.value["confirmPassword"]){ 57 | this.toastrService.error("Şifreler birbiriyle eşleşmiyor","Hata"); 58 | return; 59 | } 60 | 61 | delete this.customerUpdateForm.value["confirmPassword"]; 62 | 63 | let customerModel:Customer = Object.assign({},this.customerUpdateForm.value); 64 | console.log(customerModel); 65 | this.authService.update(customerModel).subscribe(response => { 66 | this.localStorageService.removeCurrentCustomer(); 67 | delete customerModel.password; 68 | this.localStorageService.setCurrentCustomer(customerModel); 69 | 70 | 71 | return this.toastrService.success("Bilgileriniz güncellendi","Başarılı"); 72 | },responseError => { 73 | if(responseError.error.ValidationErrors){ 74 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 75 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Doğrulama Hatası"); 76 | } 77 | return; 78 | } 79 | this.toastrService.error(responseError.error.StatusCode + " " + responseError.error.Message, responseError.name) 80 | }); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormControl, Validators, FormBuilder } from "@angular/forms"; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Customer } from 'src/app/models/customer'; 6 | import { RegisterModel } from 'src/app/models/registerModel'; 7 | import { AuthService } from 'src/app/services/auth.service'; 8 | import { CustomerService } from 'src/app/services/customer.service'; 9 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 10 | 11 | @Component({ 12 | selector: 'app-register', 13 | templateUrl: './register.component.html', 14 | styleUrls: ['./register.component.css'] 15 | }) 16 | export class RegisterComponent implements OnInit { 17 | 18 | imageUrl = "https://localhost:44384/Images/" 19 | defaultImage="logo.jpg"; 20 | 21 | registerForm: FormGroup; 22 | customer: Customer; 23 | 24 | 25 | constructor(private formBuilder: FormBuilder, 26 | private toastrService: ToastrService, 27 | private customerService: CustomerService, 28 | private localStorageService: LocalStorageService, 29 | private authService: AuthService, 30 | private router: Router) { } 31 | 32 | ngOnInit(): void { 33 | this.createRegisterForm(); 34 | } 35 | 36 | createRegisterForm() { 37 | this.registerForm = this.formBuilder.group({ 38 | firstName: ["", Validators.required], 39 | lastName: ["", Validators.required], 40 | companyName: ["",Validators.required], 41 | email: ["", Validators.required], 42 | password: ["", Validators.required], 43 | confirmPassword: ["", Validators.required], 44 | findexPoint: [70,Validators.required] 45 | }) 46 | } 47 | 48 | register() { 49 | if (this.registerForm.invalid) { 50 | this.toastrService.error("Bütün alanları doldurunuz", "Hata"); 51 | return; 52 | } 53 | 54 | if (this.registerForm.value["password"] != this.registerForm.value["confirmPassword"]) { 55 | this.toastrService.error("Şifreler birbiriyle eşleşmiyor", "Hata"); 56 | return; 57 | } 58 | 59 | delete this.registerForm.value["confirmPassword"]; 60 | let registerModel: RegisterModel = Object.assign({}, this.registerForm.value); 61 | 62 | this.authService.register(registerModel).subscribe(response => { 63 | this.localStorageService.setToken("token",response.data.token); 64 | this.getCustomerByEmail(registerModel.email); 65 | this.toastrService.success("Kayıt oldunuz", "Başarılı"); 66 | 67 | return this.router.navigateByUrl('/cars'); 68 | }, responseError => { 69 | if (responseError.error.ValidationErrors) { 70 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 71 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage, 'Doğrulama Hatası'); 72 | } 73 | return; 74 | } 75 | this.toastrService.error(responseError.status + ' ' + responseError.name, responseError.error); 76 | }); 77 | 78 | } 79 | 80 | 81 | getCustomerByEmail(email: string) { 82 | this.customerService.getCustomerByEmail(email).subscribe(response => { 83 | this.customer = response.data; 84 | this.localStorageService.setCurrentCustomer(this.customer); 85 | }); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
Araç Güncelle
8 |
9 |
10 |
11 | 18 | 19 |
20 | 27 | 28 |
29 | 30 |
31 | 38 | 39 |
40 |
41 | 42 |
43 | 45 |
46 |
47 |
48 | 49 |
50 | 52 |
53 |
54 |
55 | 56 |
57 | 59 |
60 |
61 | 62 |
63 |
64 | 67 |
68 |
69 | 70 |
-------------------------------------------------------------------------------- /src/app/components/payment/payment.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | İşlem Özeti 4 |
5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 |
Kiralanan TarihTeslim TarihiMarkaRenkModelGünlük Kiralama FiyatıToplam
{{rental.rentDate}}{{rental.returnDate}}{{rental.brandName}}{{rental.colorName}}{{rental.carModelYear}}{{rental.carDailyPrice | currency: "₺" }} 27 | {{paymentAmount | currency: "₺" }} 28 |
32 |
33 |
34 | 35 |
36 |
37 | Ödeme İşlemi 38 |
39 |
40 |
41 |
42 | Kart Üzerindeki Ad Soyad 43 | 46 |
47 |
48 |
49 |
50 | Kart Numarası 51 | 54 | 55 |
56 |
57 |
58 |
59 |
60 | Son Kullanım Tarihi 61 | 64 |
65 |
66 | Güvenlik Kodu 67 | 70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | 80 |
81 | 89 | 90 |
-------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { BrandAddComponent } from './components/brand-add/brand-add.component'; 4 | import { BrandDeleteComponent } from './components/brand-delete/brand-delete.component'; 5 | import { BrandUpdateComponent } from './components/brand-update/brand-update.component'; 6 | import { CarAddComponent } from './components/car-add/car-add.component'; 7 | import { CarDeleteComponent } from './components/car-delete/car-delete.component'; 8 | import { CarDetailComponent } from './components/car-detail/car-detail.component'; 9 | import { CarUpdateComponent } from './components/car-update/car-update.component'; 10 | import { CarComponent } from './components/car/car.component'; 11 | import { ColorAddComponent } from './components/color-add/color-add.component'; 12 | import { ColorDeleteComponent } from './components/color-delete/color-delete.component'; 13 | import { ColorUpdateComponent } from './components/color-update/color-update.component'; 14 | import { CustomerComponent } from './components/customer/customer.component'; 15 | import { LoginComponent } from './components/login/login.component'; 16 | import { CardSavedComponent } from './components/payment/card-saved/card-saved.component'; 17 | import { PaymentComponent } from './components/payment/payment.component'; 18 | import { ProfileComponent } from './components/profile/profile.component'; 19 | import { RegisterComponent } from './components/register/register.component'; 20 | import { RentalComponent } from './components/rental/rental.component'; 21 | import { LoginGuard } from './guards/login.guard'; 22 | 23 | 24 | const routes: Routes = [ 25 | {path:"", pathMatch:"full", component: CarComponent}, 26 | {path:"cars/filter/brand/:brandId/color/:colorId",component:CarComponent}, 27 | {path:"cars", component: CarComponent}, 28 | {path:"cars/customers", component: CustomerComponent}, 29 | {path:"cars/brand/:brandId", component: CarComponent}, 30 | {path:"cars/color/:colorId", component:CarComponent}, 31 | {path:"cars/cardetail/:carId",component:CarDetailComponent}, 32 | 33 | {path:"cars/filter/brand/:brandId",component:CarComponent}, 34 | {path:"cars/filter/color/:colorId",component:CarComponent}, 35 | 36 | {path:"rental/:carId",component:RentalComponent}, 37 | {path:"cars/rental/:carId",component:RentalComponent}, 38 | {path:"payment/:rental",component:PaymentComponent}, 39 | 40 | {path:"cars/add",component:CarAddComponent, canActivate:[LoginGuard]}, 41 | {path:"cars/update/:carId",component:CarUpdateComponent}, 42 | {path:"cars/delete",component:CarDeleteComponent}, 43 | 44 | {path:"brands/add",component:BrandAddComponent, canActivate:[LoginGuard]}, 45 | {path:"brands/update/:brandId",component:BrandUpdateComponent}, 46 | {path:"brands/delete",component:BrandDeleteComponent}, 47 | 48 | {path:"colors/add",component:ColorAddComponent, canActivate:[LoginGuard]}, 49 | {path:"colors/delete",component:ColorDeleteComponent}, 50 | {path:"colors/update/:colorId",component:ColorUpdateComponent}, 51 | 52 | {path:"login",component:LoginComponent}, 53 | {path:"register",component:RegisterComponent}, 54 | {path:"profile",component:ProfileComponent}, 55 | 56 | {path:"cardSaved",component:CardSavedComponent} 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | // {path:"cars/brand/:brandId/cars/cardetail/:carId",component:CarDetailComponent}, 76 | // {path:"cars/color/:colorId/cars/cardetail/:carId",component:CarDetailComponent} 77 | 78 | ]; 79 | 80 | @NgModule({ 81 | imports: [RouterModule.forRoot(routes)], 82 | exports: [RouterModule] 83 | }) 84 | export class AppRoutingModule { } 85 | -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
Araç Ekle
8 |
9 |
10 |
11 | 25 | 26 | 27 |
28 | 35 | 36 |
37 | 38 |
39 | 46 | 47 |
48 | 49 |
50 | 51 |
52 | 54 |
55 |
56 |
57 | 58 |
59 | 61 |
62 |
63 |
64 | 65 |
66 | 68 |
69 |
70 | 71 |
72 |
73 | 76 |
77 |
78 | 79 |
-------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import {HttpClientModule, HTTP_INTERCEPTORS} from '@angular/common/http'; 4 | import {FormsModule, ReactiveFormsModule} from '@angular/forms'; 5 | import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; 6 | 7 | import { AppRoutingModule } from './app-routing.module'; 8 | import { AppComponent } from './app.component'; 9 | import { CarComponent } from './components/car/car.component'; 10 | import { RentalComponent } from './components/rental/rental.component'; 11 | import { NaviComponent } from './components/navi/navi.component'; 12 | import { BrandComponent } from './components/brand/brand.component'; 13 | import { CustomerComponent } from './components/customer/customer.component'; 14 | import { ColorComponent } from './components/color/color.component'; 15 | import { CarDetailComponent } from './components/car-detail/car-detail.component'; 16 | import { CarFilterPipePipe } from './pipes/car-filter-pipe.pipe'; 17 | import { ColorFilterPipePipe } from './pipes/color-filter-pipe.pipe'; 18 | import { BrandFilterPipePipe } from './pipes/brand-filter-pipe.pipe'; 19 | 20 | import {ToastrModule} from 'ngx-toastr'; 21 | import { CarFilterComponent } from './components/car-filter/car-filter.component'; 22 | import { PaymentComponent } from './components/payment/payment.component'; 23 | import { CarAddComponent } from './components/car-add/car-add.component'; 24 | import { BrandAddComponent } from './components/brand-add/brand-add.component'; 25 | import { ColorAddComponent } from './components/color-add/color-add.component'; 26 | import { CarUpdateComponent } from './components/car-update/car-update.component'; 27 | import { BrandUpdateComponent } from './components/brand-update/brand-update.component'; 28 | import { BrandDeleteComponent } from './components/brand-delete/brand-delete.component'; 29 | import { ColorDeleteComponent } from './components/color-delete/color-delete.component'; 30 | import { ColorUpdateComponent } from './components/color-update/color-update.component'; 31 | import { CarDeleteComponent } from './components/car-delete/car-delete.component'; 32 | import { LoginComponent } from './components/login/login.component'; 33 | import { AuthInterceptor } from './interceptors/auth.interceptor'; 34 | import { RegisterComponent } from './components/register/register.component'; 35 | import { AuthMenuComponent } from './components/navi/auth-menu/auth-menu.component'; 36 | import { ProfileComponent } from './components/profile/profile.component'; 37 | import { CardSavedComponent } from './components/payment/card-saved/card-saved.component'; 38 | 39 | @NgModule({ 40 | declarations: [ 41 | AppComponent, 42 | CarComponent, 43 | RentalComponent, 44 | NaviComponent, 45 | BrandComponent, 46 | CustomerComponent, 47 | ColorComponent, 48 | CarDetailComponent, 49 | CarFilterPipePipe, 50 | ColorFilterPipePipe, 51 | BrandFilterPipePipe, 52 | CarFilterComponent, 53 | PaymentComponent, 54 | CarAddComponent, 55 | BrandAddComponent, 56 | ColorAddComponent, 57 | CarUpdateComponent, 58 | BrandUpdateComponent, 59 | BrandDeleteComponent, 60 | ColorDeleteComponent, 61 | ColorUpdateComponent, 62 | CarDeleteComponent, 63 | LoginComponent, 64 | RegisterComponent, 65 | AuthMenuComponent, 66 | ProfileComponent, 67 | CardSavedComponent 68 | 69 | ], 70 | imports: [ 71 | BrowserModule, 72 | AppRoutingModule, 73 | HttpClientModule, 74 | FormsModule, 75 | ReactiveFormsModule, 76 | BrowserAnimationsModule, 77 | ToastrModule.forRoot({ 78 | positionClass:"toast-bottom-right" 79 | }) 80 | ], 81 | providers: [ 82 | {provide:HTTP_INTERCEPTORS, useClass:AuthInterceptor, multi:true} 83 | ], 84 | bootstrap: [AppComponent] 85 | }) 86 | export class AppModule { } 87 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.html: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 |
7 |
8 |
9 | Loading... 10 |
11 |
12 |
13 | 14 | 19 | 20 |
21 |
22 | 39 |
40 | 41 | 42 | 43 | 44 |
    45 |
  • 47 |
Marka: {{car?.brandName}} 48 | Model: {{car?.modelYear}} 49 | Renk: {{car?.colorName}} 50 | Günlük Kiralama Fiyatı: {{car?.dailyPrice |currency : 51 | 'TRY':'symbol-narrow':'1.2-2'}} 52 | Açıklama: {{car?.description}} 53 | 54 | 55 | 56 |
57 | 58 | 59 |
60 | 64 |
65 | 66 |
67 |
68 |
69 | 72 |
73 |
74 |
75 |
Araç Şu an Kiralanamaz
76 |
77 |
78 |
79 |
80 |
81 | Araba kiralamak için önce giriş yapmalısınız 82 |
83 |
84 |
85 |
86 | 87 |
88 |
89 | 90 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "rentcardatabase": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:application": { 10 | "strict": true 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/rentcardatabase", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "aot": true, 26 | "assets": [ 27 | "src/favicon.ico", 28 | "src/assets" 29 | ], 30 | "styles": [ 31 | "./node_modules/bootstrap/dist/css/bootstrap.min.css", 32 | "./node_modules/ngx-toastr/toastr.css", 33 | "src/styles.css" 34 | ], 35 | "scripts": [ 36 | "./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js" 37 | ] 38 | }, 39 | "configurations": { 40 | "production": { 41 | "fileReplacements": [ 42 | { 43 | "replace": "src/environments/environment.ts", 44 | "with": "src/environments/environment.prod.ts" 45 | } 46 | ], 47 | "optimization": true, 48 | "outputHashing": "all", 49 | "sourceMap": false, 50 | "namedChunks": false, 51 | "extractLicenses": true, 52 | "vendorChunk": false, 53 | "buildOptimizer": true, 54 | "budgets": [ 55 | { 56 | "type": "initial", 57 | "maximumWarning": "500kb", 58 | "maximumError": "1mb" 59 | }, 60 | { 61 | "type": "anyComponentStyle", 62 | "maximumWarning": "2kb", 63 | "maximumError": "4kb" 64 | } 65 | ] 66 | } 67 | } 68 | }, 69 | "serve": { 70 | "builder": "@angular-devkit/build-angular:dev-server", 71 | "options": { 72 | "browserTarget": "rentcardatabase:build" 73 | }, 74 | "configurations": { 75 | "production": { 76 | "browserTarget": "rentcardatabase:build:production" 77 | } 78 | } 79 | }, 80 | "extract-i18n": { 81 | "builder": "@angular-devkit/build-angular:extract-i18n", 82 | "options": { 83 | "browserTarget": "rentcardatabase:build" 84 | } 85 | }, 86 | "test": { 87 | "builder": "@angular-devkit/build-angular:karma", 88 | "options": { 89 | "main": "src/test.ts", 90 | "polyfills": "src/polyfills.ts", 91 | "tsConfig": "tsconfig.spec.json", 92 | "karmaConfig": "karma.conf.js", 93 | "assets": [ 94 | "src/favicon.ico", 95 | "src/assets" 96 | ], 97 | "styles": [ 98 | "src/styles.css" 99 | ], 100 | "scripts": [] 101 | } 102 | }, 103 | "lint": { 104 | "builder": "@angular-devkit/build-angular:tslint", 105 | "options": { 106 | "tsConfig": [ 107 | "tsconfig.app.json", 108 | "tsconfig.spec.json", 109 | "e2e/tsconfig.json" 110 | ], 111 | "exclude": [ 112 | "**/node_modules/**" 113 | ] 114 | } 115 | }, 116 | "e2e": { 117 | "builder": "@angular-devkit/build-angular:protractor", 118 | "options": { 119 | "protractorConfig": "e2e/protractor.conf.js", 120 | "devServerTarget": "rentcardatabase:serve" 121 | }, 122 | "configurations": { 123 | "production": { 124 | "devServerTarget": "rentcardatabase:serve:production" 125 | } 126 | } 127 | } 128 | } 129 | } 130 | }, 131 | "defaultProject": "rentcardatabase" 132 | } 133 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.ts: -------------------------------------------------------------------------------- 1 | import { DatePipe } from '@angular/common'; 2 | import { Component, Input, OnInit } from '@angular/core'; 3 | import { ActivatedRoute, Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Car } from 'src/app/models/car'; 6 | import { Customer } from 'src/app/models/customer'; 7 | import { Rental } from 'src/app/models/rental'; 8 | import { AuthService } from 'src/app/services/auth.service'; 9 | import { CarService } from 'src/app/services/car.service'; 10 | import { CustomerService } from 'src/app/services/customer.service'; 11 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 12 | import { RentalService } from 'src/app/services/rental.service'; 13 | 14 | @Component({ 15 | selector: 'app-rental', 16 | templateUrl: './rental.component.html', 17 | styleUrls: ['./rental.component.css'], 18 | providers:[DatePipe] 19 | }) 20 | export class RentalComponent implements OnInit { 21 | 22 | carId:number; 23 | customers:Customer[]; 24 | cars:Car[] 25 | rentals:Rental[]=[]; 26 | dataLoaded=false; 27 | rentDate:Date; 28 | returnDate:Date; 29 | customerId:number; 30 | @Input() car:Car;//Input()? 31 | 32 | 33 | 34 | minDate:string | any; 35 | maxDate: string | null; 36 | maxMinDate: string | null; 37 | firstDateSelected: boolean = false; 38 | 39 | constructor(private rentalService:RentalService, 40 | private customerService:CustomerService, 41 | private toastrService:ToastrService, 42 | private router:Router, 43 | private datePipe:DatePipe, 44 | private carService:CarService, 45 | private activatedRoute:ActivatedRoute, 46 | private authService:AuthService, 47 | private localStorageService:LocalStorageService) { } 48 | 49 | ngOnInit(): void { 50 | this.activatedRoute.params.subscribe(params => { 51 | if(params["carId"]){ 52 | this.carId = params["carId"]; 53 | this.getCars(params["carId"]); 54 | } 55 | }) 56 | this.getCustomer(); 57 | } 58 | 59 | getRentals(){ 60 | this.rentalService.getRentals().subscribe(response => { 61 | this.rentals = response.data; 62 | this.dataLoaded=true; 63 | }); 64 | } 65 | 66 | getCustomer(){ 67 | this.customerService.getCustomers().subscribe(response => { 68 | this.customers = response.data; 69 | this.dataLoaded=true; 70 | }) 71 | } 72 | 73 | getCars(carId:number){ 74 | this.carService.getCarDetails(carId).subscribe(response => { 75 | this.car= response.data[0] 76 | }) 77 | } 78 | 79 | checkRentableCar(){ 80 | 81 | this.rentalService.getRentalById(this.carId).subscribe(response => { 82 | if(response.data[0]==null){ 83 | this.createRental(); 84 | return true; 85 | } 86 | let lastItem = response.data[response.data.length-1] 87 | if(lastItem.returnDate==null){ 88 | return this.toastrService.error('Bu araç teslim edilmemiş','Teslim Tarihi Geçersiz'); 89 | } 90 | let returnDate = new Date(lastItem.returnDate); 91 | let rentDate = new Date(this.rentDate); 92 | if(rentDate < returnDate){ 93 | return this.toastrService.error('Bu araç bu tarihler arasında kiralanamaz','Geçersiz tarih seçimi') 94 | } 95 | this.createRental(); 96 | return true; 97 | }) 98 | 99 | } 100 | 101 | createRental(){ 102 | let createdRental : Rental ={ 103 | carId: this.car.carId, 104 | brandName: this.car.brandName, 105 | colorName: this.car.colorName, 106 | carModelYear: this.car.modelYear, 107 | carDailyPrice: this.car.dailyPrice, 108 | carDescription: this.car.description, 109 | rentDate: this.rentDate, 110 | returnDate: this.returnDate, 111 | customerId: this.customerId 112 | }; 113 | if(createdRental.customerId == undefined || createdRental.rentDate == undefined){ 114 | this.toastrService.error('Eksik bilgi girdiniz','Bilgilerinizi kontrol ediniz') 115 | } 116 | else{ 117 | this.router.navigate(['/payment/',JSON.stringify(createdRental)]); 118 | this.toastrService.info('Ödeme sayfasına yönlendiriliyorsunuz.','Ödeme İşlemleri') 119 | } 120 | } 121 | 122 | getRentMinDate() { 123 | this.minDate = this.datePipe.transform(new Date(), 'yyyy-MM-dd'); 124 | return this.minDate; 125 | } 126 | 127 | getReturnMinDate() { 128 | if (this.rentDate != undefined) { 129 | let stringToDate = new Date(this.rentDate); 130 | let new_date = new Date(); 131 | new_date.setDate(stringToDate.getDate() + 1); 132 | return new_date.toISOString().slice(0, 10); 133 | } else { 134 | return this.rentDate; 135 | } 136 | } 137 | getReturnMaxDate() { 138 | this.maxDate = this.datePipe.transform( 139 | new Date(new Date().setFullYear(new Date().getFullYear() + 1)), 140 | 'yyyy-MM-dd' 141 | ); 142 | return this.maxDate; 143 | } 144 | 145 | onChangeEvent(event: any) { 146 | this.minDate = event.target.value; 147 | this.firstDateSelected = true; 148 | } 149 | 150 | 151 | isLogin(){ 152 | if(this.authService.isAuthenticated()){ 153 | return true; 154 | } 155 | return false; 156 | } 157 | 158 | checkFindexPoint(){ 159 | this.carService.getCarDetails(this.carId).subscribe(response => { 160 | 161 | let customer = this.localStorageService.getCurrentCustomer(); 162 | 163 | if(customer.findexPoint === 0){ 164 | this.toastrService.warning("Kullanıcının findeks puanı sıfırdır","Dikkat"); 165 | return this.router.navigateByUrl("/cars"); 166 | } 167 | 168 | let car:Car = response.data[0]; 169 | if(customer.findexPoint < car.findexPoint){ 170 | this.toastrService.warning("Findeks puanınız yetersiz","Dikkat"); 171 | return this.router.navigate(["/cars"]); 172 | } 173 | return this.checkRentableCar(); 174 | }) 175 | } 176 | 177 | 178 | } 179 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { tick } from '@angular/core/testing'; 3 | import { ActivatedRoute, Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Car } from 'src/app/models/car'; 6 | import { CreditCard } from 'src/app/models/creditCard'; 7 | import { Customer } from 'src/app/models/customer'; 8 | import { Rental } from 'src/app/models/rental'; 9 | import { AuthService } from 'src/app/services/auth.service'; 10 | import { CarService } from 'src/app/services/car.service'; 11 | import { CreditCardService } from 'src/app/services/credit-card.service'; 12 | import { CustomerService } from 'src/app/services/customer.service'; 13 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 14 | import { RentalService } from 'src/app/services/rental.service'; 15 | 16 | @Component({ 17 | selector: 'app-payment', 18 | templateUrl: './payment.component.html', 19 | styleUrls: ['./payment.component.css'] 20 | }) 21 | export class PaymentComponent implements OnInit { 22 | 23 | save:boolean = true; 24 | selectedCardId: number= 0; 25 | 26 | nameOnTheCard:string; 27 | cardNumber:string; 28 | expirationDate:string; 29 | cardCvv:string; 30 | moneyInTheCard:number; 31 | customerId:number; 32 | 33 | 34 | 35 | customer:Customer; 36 | rental :Rental; 37 | cars:Car;//Car[]? 38 | paymentAmount : number = 0; 39 | creditCard: CreditCard; 40 | cardExist:boolean =false; 41 | getCustomerId:number; 42 | 43 | 44 | 45 | constructor( 46 | private activatedRoute:ActivatedRoute, 47 | private customerService:CustomerService, 48 | private carService:CarService, 49 | private router :Router, 50 | private toastrService:ToastrService, 51 | private creditCardService:CreditCardService, 52 | private rentalService:RentalService, 53 | private localStorageService:LocalStorageService 54 | ) { } 55 | 56 | ngOnInit(): void { 57 | this.activatedRoute.params.subscribe(params => { 58 | if(params['rental']){ 59 | this.rental = JSON.parse(params['rental']); 60 | this.getCustomerId =JSON.parse(params['rental']).customerId; 61 | this.getCustomerDetailById(this.getCustomerId); 62 | this.getCarDetails(); 63 | 64 | } 65 | }); 66 | } 67 | 68 | 69 | getCustomerDetailById(customerId:number){ 70 | this.customerService.getCustomerById(customerId).subscribe((response) => { 71 | this.customer = response.data[0]; 72 | }) 73 | } 74 | 75 | getCarDetails(){ 76 | this.carService.getCarDetails(this.rental.carId).subscribe(response => { 77 | this.cars = response.data[0]; 78 | this.calculatePayment(); 79 | }) 80 | } 81 | 82 | calculatePayment(){ 83 | if(this.rental.returnDate != null){ 84 | var returnDate = new Date(this.rental.returnDate.toString()); 85 | var rentDate = new Date(this.rental.rentDate.toString()); 86 | var difference = returnDate.getTime() - rentDate.getTime(); 87 | 88 | var rentDays = Math.ceil(difference / (1000 * 3600 * 24)); 89 | 90 | this.paymentAmount = rentDays * this.cars.dailyPrice; 91 | if(this.paymentAmount <= 0){ 92 | this.router.navigate(['/cars']); 93 | this.toastrService.error('Ana sayfaya yönlendiriliyorsunuz','Hatalı işlem'); 94 | } 95 | } 96 | } 97 | 98 | rentACar(){ 99 | // @ts-ignore 100 | let verifyCreditCard:CreditCard ={ 101 | nameOnTheCard: this.nameOnTheCard, 102 | cardNumber: this.cardNumber, 103 | expirationDate: this.expirationDate, 104 | cardCvv: this.cardCvv, 105 | customerId:this.localStorageService.getCurrentCustomer().customerId 106 | } 107 | 108 | this.updateMoney() 109 | 110 | if(this.save) 111 | { 112 | this.saveCard(verifyCreditCard) 113 | } 114 | 115 | this.rentalService.addRental(this.rental).subscribe(response => { 116 | this.toastrService.success('Arabayı kiraladınız','İşlem başarılı'); 117 | this.updateFindexPointOfCurrentCustomer(); 118 | this.router.navigateByUrl("/cars"); 119 | }); 120 | 121 | } 122 | 123 | updateMoney(){ 124 | if(this.selectedCard){ 125 | this.creditCardService.getCardsByCustomerId(this.customerId).subscribe(response => { 126 | let cards: CreditCard[] = response.data 127 | 128 | let card = cards.find(card => card.cardId == this.selectedCardId); 129 | 130 | if(card.moneyInTheCard < this.paymentAmount) 131 | return this.toastrService.error("Kartınızda yeterli bakiye yoktur", "Hata") 132 | 133 | card.moneyInTheCard = card.moneyInTheCard - this.paymentAmount; 134 | return this.creditCardService.updateCard(card).subscribe(response => { 135 | this.toastrService.success("Ödeme yapıldı","Başarılı"); 136 | }) 137 | 138 | }) 139 | } 140 | } 141 | 142 | async getCreditCardByCardNumber(cardNumber:string){ 143 | return (await this.creditCardService.getByCardNumber(cardNumber).toPromise()).data[0]; 144 | } 145 | 146 | updateCard(creditCard:CreditCard){ 147 | this.creditCardService.updateCard(creditCard); 148 | } 149 | 150 | updateFindexPointOfCurrentCustomer(){ 151 | let currentCustomer = this.localStorageService.getCurrentCustomer(); 152 | 153 | this.customerService.getCustomerByEmail(currentCustomer.email).subscribe(response => { 154 | this.localStorageService.setCurrentCustomer(response.data); 155 | }) 156 | } 157 | 158 | saveCard(card:CreditCard){ 159 | this.creditCardService.add(card).subscribe(response => { 160 | this.toastrService.success("Kartınız kaydedildi",response.message); 161 | },responseError => { 162 | console.log(responseError); 163 | }) 164 | } 165 | 166 | selectedCard(creditCard:CreditCard){ 167 | this.selectedCardId = creditCard.cardId; 168 | this.nameOnTheCard = creditCard.nameOnTheCard; 169 | this.expirationDate = creditCard.expirationDate; 170 | this.cardCvv = creditCard.cardCvv; 171 | this.cardNumber = creditCard.cardNumber; 172 | this.customerId = creditCard.customerId; 173 | this.save = false 174 | } 175 | 176 | } 177 | --------------------------------------------------------------------------------