├── .browserslistrc ├── .editorconfig ├── .gitignore ├── .vscode └── extensions.json ├── README.md ├── angular.json ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.css │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── components │ │ ├── brand-management │ │ │ ├── brand-management.component.css │ │ │ ├── brand-management.component.html │ │ │ └── brand-management.component.ts │ │ ├── brand │ │ │ ├── brand.component.css │ │ │ ├── brand.component.html │ │ │ └── brand.component.ts │ │ ├── car-details │ │ │ ├── car-details.component.css │ │ │ ├── car-details.component.html │ │ │ └── car-details.component.ts │ │ ├── car-list │ │ │ ├── car-list.component.css │ │ │ ├── car-list.component.html │ │ │ └── car-list.component.ts │ │ ├── car-management │ │ │ ├── car-management.component.css │ │ │ ├── car-management.component.html │ │ │ └── car-management.component.ts │ │ ├── color-management │ │ │ ├── color-management.component.css │ │ │ ├── color-management.component.html │ │ │ └── color-management.component.ts │ │ ├── color │ │ │ ├── color.component.css │ │ │ ├── color.component.html │ │ │ └── color.component.ts │ │ ├── customer │ │ │ ├── customer.component.css │ │ │ ├── customer.component.html │ │ │ └── customer.component.ts │ │ ├── filter │ │ │ ├── filter.component.css │ │ │ ├── filter.component.html │ │ │ └── filter.component.ts │ │ ├── login │ │ │ ├── login.component.css │ │ │ ├── login.component.html │ │ │ └── login.component.ts │ │ ├── navi │ │ │ ├── navi.component.css │ │ │ ├── navi.component.html │ │ │ └── navi.component.ts │ │ ├── pages │ │ │ └── home │ │ │ │ ├── home.component.css │ │ │ │ ├── home.component.html │ │ │ │ └── home.component.ts │ │ ├── payment │ │ │ ├── payment.component.css │ │ │ ├── payment.component.html │ │ │ └── payment.component.ts │ │ ├── register │ │ │ ├── register.component.css │ │ │ ├── register.component.html │ │ │ └── register.component.ts │ │ ├── rent │ │ │ ├── rent.component.css │ │ │ ├── rent.component.html │ │ │ └── rent.component.ts │ │ ├── rental │ │ │ ├── rental.component.css │ │ │ ├── rental.component.html │ │ │ └── rental.component.ts │ │ ├── user-profile │ │ │ ├── user-profile.component.css │ │ │ ├── user-profile.component.html │ │ │ └── user-profile.component.ts │ │ └── usermenu │ │ │ ├── usermenu.component.css │ │ │ ├── usermenu.component.html │ │ │ └── usermenu.component.ts │ ├── guards │ │ ├── admin.guard.ts │ │ └── login.guard.ts │ ├── interceptors │ │ └── auth.interceptor.ts │ ├── models │ │ ├── SingleResponseModel.ts │ │ ├── brand.ts │ │ ├── car.ts │ │ ├── carDetails.ts │ │ ├── carImages.ts │ │ ├── carInfo.ts │ │ ├── color.ts │ │ ├── creditCard.ts │ │ ├── customer.ts │ │ ├── customerDetails.ts │ │ ├── filter.ts │ │ ├── filters.ts │ │ ├── listResponseModel.ts │ │ ├── loginModel.ts │ │ ├── payment.ts │ │ ├── registerModel.ts │ │ ├── rental.ts │ │ ├── rentalDetails.ts │ │ ├── responseModel.ts │ │ ├── tokenModel.ts │ │ └── user.ts │ ├── pipes │ │ ├── credit-card-number.pipe.ts │ │ └── filter-pipe.pipe.ts │ └── services │ │ ├── auth.service.ts │ │ ├── brand.service.ts │ │ ├── car-image.service.ts │ │ ├── car.service.ts │ │ ├── color.service.ts │ │ ├── credit-card.service.ts │ │ ├── customer.service.ts │ │ ├── error.service.ts │ │ ├── payment.service.ts │ │ ├── rental.service.ts │ │ ├── storage.service.ts │ │ └── user.service.ts ├── assets │ ├── .gitkeep │ ├── ReCapProject-Frontend.JPG │ ├── Rent A Car Project.gif │ ├── car-logo.png │ ├── logo.JPG │ ├── logo.png │ ├── r1.JPG │ ├── r2.JPG │ ├── r3.JPG │ └── r4.JPG ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [] 3 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ReCapProjectFrontend 2 | Rent a Car Backend tarafindan sağlanan API desteği ile kullanıcılara hizmet sunan bu FrontEnd çalışmasında ANGULAR teknolojısı kullanılmaktadır. 3 | 4 | - Kullanıcı Kaydı / Girişi 5 | - Kullanıcı Bilgileri Günceleme 6 | - Araç Kiralama 7 | - Ödeme ve Kredi Kartı Bilgilerinin Yönetimi 8 | - Araçları Marka,Renk, ve Modeline göre Filtreleme 9 | - Araç Ekleme/Silme/Güncelleme 10 | - Marka Ekleme/Silme/Güncelleme 11 | - Renk Ekleme/Silme/Güncelleme 12 | 13 | işlemleri gerçekleştirilmiş ve geliştirilmeye devam edilmektedir.. 14 |
15 | 16 | 17 |
18 | 19 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.3. 20 | 21 | ## Development server 22 | 23 | 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. 24 | 25 | ## Code scaffolding 26 | 27 | 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`. 28 | 29 | ## Build 30 | 31 | 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. 32 | 33 | ## Running unit tests 34 | 35 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 36 | 37 | ## Running end-to-end tests 38 | 39 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 40 | 41 | ## Further help 42 | 43 | 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. 44 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ReCapProject-Frontend": { 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/ReCapProject-Frontend", 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": ["src/favicon.ico", "src/assets"], 27 | "styles": [ 28 | "./node_modules/bootstrap/dist/css/bootstrap.min.css", 29 | "src/styles.css", 30 | "./node_modules/ngx-toastr/toastr.css" 31 | ], 32 | "scripts": [ 33 | "./node_modules/jquery/dist/jquery.min.js", 34 | "./node_modules/bootstrap/dist/js/bootstrap.min.js" 35 | ] 36 | }, 37 | "configurations": { 38 | "production": { 39 | "fileReplacements": [ 40 | { 41 | "replace": "src/environments/environment.ts", 42 | "with": "src/environments/environment.prod.ts" 43 | } 44 | ], 45 | "optimization": true, 46 | "outputHashing": "all", 47 | "sourceMap": false, 48 | "namedChunks": false, 49 | "extractLicenses": true, 50 | "vendorChunk": false, 51 | "buildOptimizer": true, 52 | "budgets": [ 53 | { 54 | "type": "initial", 55 | "maximumWarning": "500kb", 56 | "maximumError": "1mb" 57 | }, 58 | { 59 | "type": "anyComponentStyle", 60 | "maximumWarning": "2kb", 61 | "maximumError": "4kb" 62 | } 63 | ] 64 | } 65 | } 66 | }, 67 | "serve": { 68 | "builder": "@angular-devkit/build-angular:dev-server", 69 | "options": { 70 | "browserTarget": "ReCapProject-Frontend:build" 71 | }, 72 | "configurations": { 73 | "production": { 74 | "browserTarget": "ReCapProject-Frontend:build:production" 75 | } 76 | } 77 | }, 78 | "extract-i18n": { 79 | "builder": "@angular-devkit/build-angular:extract-i18n", 80 | "options": { 81 | "browserTarget": "ReCapProject-Frontend:build" 82 | } 83 | }, 84 | "test": { 85 | "builder": "@angular-devkit/build-angular:karma", 86 | "options": { 87 | "main": "src/test.ts", 88 | "polyfills": "src/polyfills.ts", 89 | "tsConfig": "tsconfig.spec.json", 90 | "karmaConfig": "karma.conf.js", 91 | "assets": ["src/favicon.ico", "src/assets"], 92 | "styles": ["src/styles.css"], 93 | "scripts": [] 94 | } 95 | }, 96 | "lint": { 97 | "builder": "@angular-devkit/build-angular:tslint", 98 | "options": { 99 | "tsConfig": [ 100 | "tsconfig.app.json", 101 | "tsconfig.spec.json", 102 | "e2e/tsconfig.json" 103 | ], 104 | "exclude": ["**/node_modules/**"] 105 | } 106 | }, 107 | "e2e": { 108 | "builder": "@angular-devkit/build-angular:protractor", 109 | "options": { 110 | "protractorConfig": "e2e/protractor.conf.js", 111 | "devServerTarget": "ReCapProject-Frontend:serve" 112 | }, 113 | "configurations": { 114 | "production": { 115 | "devServerTarget": "ReCapProject-Frontend:serve:production" 116 | } 117 | } 118 | } 119 | } 120 | } 121 | }, 122 | "defaultProject": "ReCapProject-Frontend" 123 | } 124 | -------------------------------------------------------------------------------- /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 | }; -------------------------------------------------------------------------------- /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('ReCapProject-Frontend 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/ReCapProject-Frontend'), 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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "re-cap-project-frontend", 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.7", 15 | "@angular/common": "~11.2.4", 16 | "@angular/compiler": "~11.2.4", 17 | "@angular/core": "~11.2.4", 18 | "@angular/forms": "^11.2.6", 19 | "@angular/platform-browser": "~11.2.4", 20 | "@angular/platform-browser-dynamic": "~11.2.4", 21 | "@angular/router": "~11.2.4", 22 | "@fortawesome/angular-fontawesome": "^0.8.2", 23 | "@fortawesome/fontawesome-free": "^5.15.3", 24 | "@fortawesome/fontawesome-svg-core": "^1.2.35", 25 | "@fortawesome/free-solid-svg-icons": "^5.15.3", 26 | "bootstrap": "^5.0.0-beta2", 27 | "font-awesome": "^4.7.0", 28 | "jquery": "^3.6.0", 29 | "ngx-toastr": "^13.2.1", 30 | "rxjs": "~6.6.0", 31 | "tslib": "^2.0.0", 32 | "zone.js": "~0.11.3" 33 | }, 34 | "devDependencies": { 35 | "@angular-devkit/build-angular": "~0.1102.3", 36 | "@angular/cli": "~11.2.3", 37 | "@angular/compiler-cli": "~11.2.4", 38 | "@types/jasmine": "~3.6.0", 39 | "@types/node": "^12.11.1", 40 | "codelyzer": "^6.0.0", 41 | "jasmine-core": "~3.6.0", 42 | "jasmine-spec-reporter": "~5.0.0", 43 | "karma": ">=6.3.16", 44 | "karma-chrome-launcher": "~3.1.0", 45 | "karma-coverage": "~2.0.3", 46 | "karma-jasmine": "~4.0.0", 47 | "karma-jasmine-html-reporter": "^1.5.0", 48 | "protractor": "~7.0.0", 49 | "ts-node": "~8.3.0", 50 | "tslint": "~6.1.0", 51 | "typescript": "~4.1.5" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { BrandManagementComponent } from './components/brand-management/brand-management.component'; 4 | import { CarDetailsComponent } from './components/car-details/car-details.component'; 5 | import { CarManagementComponent } from './components/car-management/car-management.component'; 6 | import { CarListComponent } from './components/car-list/car-list.component'; 7 | import { ColorManagementComponent } from './components/color-management/color-management.component'; 8 | import { LoginComponent } from './components/login/login.component'; 9 | import { PaymentComponent } from './components/payment/payment.component'; 10 | import { RentalComponent } from './components/rental/rental.component'; 11 | import { LoginGuard } from './guards/login.guard'; 12 | import { RegisterComponent } from './components/register/register.component'; 13 | import { CustomerComponent } from './components/customer/customer.component'; 14 | import { AdminGuard } from './guards/admin.guard'; 15 | import { UserProfileComponent } from './components/user-profile/user-profile.component'; 16 | 17 | const routes: Routes = [ 18 | { path: '', pathMatch: 'full', component: CarListComponent }, 19 | { path: 'cars', component: CarListComponent }, 20 | { path: 'cars/brand/:brandId', component: CarListComponent }, 21 | { path: 'cars/color/:colorId', component: CarListComponent }, 22 | { path: 'rentals', component: RentalComponent, canActivate: [AdminGuard] }, 23 | { path: 'cardetails/:carId', component: CarDetailsComponent }, 24 | { path: 'cars/brand/:brandId/color/:colorId', component: CarListComponent }, 25 | { 26 | path: 'customers', 27 | component: CustomerComponent, 28 | canActivate: [LoginGuard, AdminGuard], 29 | }, 30 | { 31 | path: 'payment/:rental', 32 | component: PaymentComponent, 33 | canActivate: [LoginGuard], 34 | }, 35 | { path: 'payment', component: PaymentComponent, canActivate: [LoginGuard] }, 36 | { 37 | path: 'carmanage', 38 | component: CarManagementComponent, 39 | canActivate: [LoginGuard, AdminGuard], 40 | }, 41 | { 42 | path: 'brandmanage', 43 | component: BrandManagementComponent, 44 | canActivate: [LoginGuard, AdminGuard], 45 | }, 46 | { 47 | path: 'colormanage', 48 | component: ColorManagementComponent, 49 | canActivate: [LoginGuard, AdminGuard], 50 | }, 51 | { path: 'login', component: LoginComponent }, 52 | { path: 'register', component: RegisterComponent }, 53 | { 54 | path: 'account', 55 | component: UserProfileComponent, 56 | canActivate: [LoginGuard], 57 | }, 58 | ]; 59 | 60 | @NgModule({ 61 | imports: [RouterModule.forRoot(routes)], 62 | exports: [RouterModule], 63 | }) 64 | export class AppRoutingModule {} 65 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/app/app.component.css -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 | 7 |
8 |
9 | -------------------------------------------------------------------------------- /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 'ReCapProject-Frontend'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('ReCapProject-Frontend'); 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('ReCapProject-Frontend app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /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 = 'ReCapProject-Frontend'; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; 4 | import { AppRoutingModule } from './app-routing.module'; 5 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 6 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 7 | 8 | import { AppComponent } from './app.component'; 9 | import { CarListComponent } from './components/car-list/car-list.component'; 10 | import { ColorComponent } from './components/color/color.component'; 11 | import { CustomerComponent } from './components/customer/customer.component'; 12 | import { BrandComponent } from './components/brand/brand.component'; 13 | import { NaviComponent } from './components/navi/navi.component'; 14 | import { CarDetailsComponent } from './components/car-details/car-details.component'; 15 | import { FilterComponent } from './components/filter/filter.component'; 16 | import { FilterPipePipe } from './pipes/filter-pipe.pipe'; 17 | import { RentComponent } from './components/rent/rent.component'; 18 | import { PaymentComponent } from './components/payment/payment.component'; 19 | import { DatePipe } from '@angular/common'; 20 | import { CreditCardNumberPipe } from './pipes/credit-card-number.pipe'; 21 | import { RentalComponent } from './components/rental/rental.component'; 22 | import { ToastrModule } from 'ngx-toastr'; 23 | import { CarManagementComponent } from './components/car-management/car-management.component'; 24 | import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; 25 | import { BrandManagementComponent } from './components/brand-management/brand-management.component'; 26 | import { ColorManagementComponent } from './components/color-management/color-management.component'; 27 | import { LoginComponent } from './components/login/login.component'; 28 | import { AuthInterceptor } from './interceptors/auth.interceptor'; 29 | import { RegisterComponent } from './components/register/register.component'; 30 | import { HomeComponent } from './components/pages/home/home.component'; 31 | import { UsermenuComponent } from './components/usermenu/usermenu.component'; 32 | import { UserProfileComponent } from './components/user-profile/user-profile.component'; 33 | 34 | @NgModule({ 35 | declarations: [ 36 | AppComponent, 37 | CarListComponent, 38 | ColorComponent, 39 | CustomerComponent, 40 | RentalComponent, 41 | BrandComponent, 42 | NaviComponent, 43 | CarDetailsComponent, 44 | FilterComponent, 45 | FilterPipePipe, 46 | RentComponent, 47 | PaymentComponent, 48 | CreditCardNumberPipe, 49 | CarManagementComponent, 50 | BrandManagementComponent, 51 | ColorManagementComponent, 52 | LoginComponent, 53 | RegisterComponent, 54 | UsermenuComponent, 55 | HomeComponent, 56 | UserProfileComponent, 57 | ], 58 | imports: [ 59 | BrowserModule, 60 | FontAwesomeModule, 61 | AppRoutingModule, 62 | HttpClientModule, 63 | FormsModule, 64 | ReactiveFormsModule, 65 | BrowserAnimationsModule, 66 | ToastrModule.forRoot({ 67 | positionClass: 'toast-bottom-right', 68 | }), 69 | ], 70 | providers: [ 71 | DatePipe, 72 | { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true }, 73 | ], 74 | bootstrap: [AppComponent], 75 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 76 | }) 77 | export class AppModule {} 78 | -------------------------------------------------------------------------------- /src/app/components/brand-management/brand-management.component.css: -------------------------------------------------------------------------------- 1 | td, 2 | th { 3 | text-align: center; 4 | } 5 | span { 6 | cursor: pointer; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/components/brand-management/brand-management.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 |
Brand IdBrand
{{brand.id}}{{brand.brandName}} 16 | 17 | 18 |
22 |
23 |
24 | 25 | 26 | 27 | 49 | 50 | 72 | 73 | 74 | 91 | 92 | -------------------------------------------------------------------------------- /src/app/components/brand-management/brand-management.component.ts: -------------------------------------------------------------------------------- 1 | declare var $: any; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { 4 | FormGroup, 5 | FormControl, 6 | FormBuilder, 7 | Validators, 8 | } from '@angular/forms'; 9 | import { Router } from '@angular/router'; 10 | import { faEdit, faTrash } from '@fortawesome/free-solid-svg-icons'; 11 | import { ToastrService } from 'ngx-toastr'; 12 | import { Brand } from 'src/app/models/brand'; 13 | import { BrandService } from 'src/app/services/brand.service'; 14 | import { ErrorService } from 'src/app/services/error.service'; 15 | 16 | @Component({ 17 | selector: 'app-brand-management', 18 | templateUrl: './brand-management.component.html', 19 | styleUrls: ['./brand-management.component.css'], 20 | }) 21 | export class BrandManagementComponent implements OnInit { 22 | brands: Brand[]; 23 | brandEditForm: FormGroup; 24 | icons = { 25 | faTrash: faTrash, 26 | faEdit: faEdit, 27 | }; 28 | brandToDelete: Brand; 29 | constructor( 30 | private brandService: BrandService, 31 | private fb: FormBuilder, 32 | private toastrService: ToastrService, 33 | private router: Router, 34 | private errorService: ErrorService 35 | ) {} 36 | 37 | ngOnInit(): void { 38 | this.createBrandForm(); 39 | this.getBrands(); 40 | } 41 | getBrands() { 42 | this.brandService.getBrands().subscribe((response) => { 43 | this.brands = response.data; 44 | }); 45 | } 46 | setBrandToDelete(id: number) { 47 | this.brandToDelete = Object.assign({ id: id }); 48 | } 49 | deleteBrand() { 50 | this.brandService.deleteBrand(this.brandToDelete).subscribe( 51 | (response) => { 52 | $('#brandDeleteModal').modal('hide'); 53 | this.router 54 | .navigateByUrl('/', { skipLocationChange: true }) 55 | .then(() => this.router.navigate(['brandmanage'])); 56 | this.toastrService.success(response.message); 57 | }, 58 | (responseError) => { 59 | this.errorService.getError(responseError); 60 | } 61 | ); 62 | } 63 | getUpdateModal(brand: Brand) { 64 | this.brandEditForm.setValue({ 65 | id: brand.id, 66 | brandName: brand.brandName, 67 | }); 68 | } 69 | updateBrand() { 70 | if (this.brandEditForm.valid) { 71 | this.brandEditForm.patchValue({ 72 | id: Number(this.brandEditForm.controls['id'].value), 73 | }); 74 | let brandToUpdate = Object.assign({}, this.brandEditForm.value); 75 | this.brandService.updateBrand(brandToUpdate).subscribe( 76 | (response) => { 77 | this.brandEditForm.reset(); 78 | $('#brandUpdateModal').modal('hide'); 79 | this.router 80 | .navigateByUrl('/', { skipLocationChange: true }) 81 | .then(() => this.router.navigate(['brandmanage'])); 82 | this.toastrService.success(response.message); 83 | }, 84 | (responseError) => { 85 | this.errorService.getError(responseError); 86 | } 87 | ); 88 | } else { 89 | this.toastrService.warning('Please Fill the Form !'); 90 | } 91 | } 92 | addBrand() { 93 | if (this.brandEditForm.valid) { 94 | this.brandEditForm.removeControl('id'); 95 | let brandToAdd = Object.assign({}, this.brandEditForm.value); 96 | this.brandService.addBrand(brandToAdd).subscribe( 97 | (response) => { 98 | this.brandEditForm.reset(); 99 | $('#brandAddModal').modal('hide'); 100 | this.router 101 | .navigateByUrl('/', { skipLocationChange: true }) 102 | .then(() => this.router.navigate(['brandmanage'])); 103 | this.toastrService.success(response.message); 104 | }, 105 | (responseError) => { 106 | this.errorService.getError(responseError); 107 | } 108 | ); 109 | } else { 110 | this.toastrService.warning('Please Fill the Form !'); 111 | } 112 | } 113 | 114 | createBrandForm() { 115 | this.brandEditForm = this.fb.group({ 116 | id: new FormControl(''), 117 | brandName: new FormControl('', Validators.required), 118 | }); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/app/components/brand/brand.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.html: -------------------------------------------------------------------------------- 1 |
2 | 12 |
13 | 14 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { 3 | FormGroup, 4 | FormBuilder, 5 | FormControl, 6 | Validators, 7 | } from '@angular/forms'; 8 | import { ActivatedRoute, Router } from '@angular/router'; 9 | import { Brand } from 'src/app/models/brand'; 10 | import { Filters } from 'src/app/models/filters'; 11 | import { BrandService } from 'src/app/services/brand.service'; 12 | 13 | @Component({ 14 | selector: 'app-brand', 15 | templateUrl: './brand.component.html', 16 | styleUrls: ['./brand.component.css'], 17 | }) 18 | export class BrandComponent implements OnInit { 19 | brands: Brand[] = []; 20 | brandId?: number; 21 | brandForm: FormGroup; 22 | constructor( 23 | private brandService: BrandService, 24 | private fb: FormBuilder, 25 | private activatedRoute: ActivatedRoute 26 | ) {} 27 | 28 | ngOnInit(): void { 29 | this.activatedRoute.params.subscribe((params) => { 30 | if (params['brandId']) { 31 | Filters.brandId = Number(params['brandId']); 32 | } else { 33 | Filters.brandId = 0; 34 | } 35 | this.getBrands(); 36 | this.createBrandForm(Filters.brandId); 37 | }); 38 | } 39 | 40 | createBrandForm(id: number) { 41 | this.brandForm = this.fb.group({ 42 | id: new FormControl(id, Validators.required), 43 | brandName: new FormControl('', Validators.required), 44 | }); 45 | } 46 | getBrands() { 47 | this.brandService.getBrands().subscribe((response) => { 48 | this.brands = response.data; 49 | this.brands.unshift({ id: 0, brandName: 'SELECT A CAR' }); 50 | }); 51 | } 52 | setCurrentBrand() { 53 | Filters.brandId = this.brandForm.controls['id'].value; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/app/components/car-details/car-details.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/app/components/car-details/car-details.component.css -------------------------------------------------------------------------------- /src/app/components/car-details/car-details.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{{ carDetails.carName }}

4 |
5 |
6 |
7 | 26 |
27 |
28 |
29 |
    30 |
  • 31 |
    Car Details
    32 |
  • 33 |
  • 34 | Model{{ carDetails.carName }} 35 |
  • 36 |
  • 37 | Brand{{ carDetails.brandName }} 38 |
  • 39 |
  • 40 | Model Year{{ carDetails.modelYear }} 41 |
  • 42 |
  • 43 | Color{{ carDetails.colorName }} 44 |
  • 45 |
  • 46 | Findex Score{{ carDetails.findexScore }} 47 |
  • 48 |
  • 49 | Daily Price{{ carDetails.dailyPrice }} ₺ 50 |
  • 51 |
52 | 54 | 57 |
58 |
59 |
60 |
61 | -------------------------------------------------------------------------------- /src/app/components/car-details/car-details.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { CarInfo } from 'src/app/models/carInfo'; 4 | import { CarImage } from 'src/app/models/carImages'; 5 | import { CarImageService } from 'src/app/services/car-image.service'; 6 | import { CarService } from 'src/app/services/car.service'; 7 | import { environment } from 'src/environments/environment'; 8 | import { StorageService } from 'src/app/services/storage.service'; 9 | import { Customer } from 'src/app/models/customer'; 10 | import { CustomerDetails } from 'src/app/models/customerDetails'; 11 | import { RentalService } from 'src/app/services/rental.service'; 12 | import { Rental } from 'src/app/models/rental'; 13 | 14 | @Component({ 15 | selector: 'app-car-details', 16 | templateUrl: './car-details.component.html', 17 | styleUrls: ['./car-details.component.css'], 18 | }) 19 | export class CarDetailsComponent implements OnInit { 20 | carDetails: CarInfo; 21 | carImages: CarImage[]; 22 | BaseUrl = environment.apiBaseUrl; 23 | activeUser: CustomerDetails; 24 | isFindexEnough: boolean; 25 | constructor( 26 | private carService: CarService, 27 | private carImageService: CarImageService, 28 | private activatedRoute: ActivatedRoute, 29 | private storageService: StorageService, 30 | private rentalService: RentalService 31 | ) {} 32 | 33 | ngOnInit(): void { 34 | this.storageService.getActiveUser() != undefined 35 | ? (this.activeUser = this.storageService.getActiveUser()) 36 | : (this.activeUser = Object.assign({ customerId: 0 })); 37 | 38 | this.activatedRoute.params.subscribe((params) => { 39 | if (params['carId']) { 40 | this.getCarDetails(Number(params['carId'])); 41 | this.findexScoreCheck( 42 | this.activeUser.customerId, 43 | Number(params['carId']) 44 | ); 45 | } 46 | }); 47 | } 48 | getCarDetails(carId: number) { 49 | this.carService.getCarDetailsById(carId).subscribe((response) => { 50 | this.carDetails = response.data[0]; 51 | }); 52 | this.carImageService.getCarImages(carId).subscribe((response) => { 53 | this.carImages = response.data; 54 | }); 55 | } 56 | findexScoreCheck(customerId: number, carId: number) { 57 | if (customerId) { 58 | this.rentalService 59 | .checkFindexScore(customerId, carId) 60 | .subscribe((response) => { 61 | this.isFindexEnough = response.isSuccess; 62 | }); 63 | } else { 64 | this.isFindexEnough = true; 65 | } 66 | } 67 | // getButton(carImages: CarImage[]) { 68 | // for (let i = 0; i < carImages.length; i++) { 69 | // document 70 | // .getElementById('btn-carousel') 71 | // ?.insertAdjacentHTML( 72 | // 'beforeend', 73 | // `` 76 | // ); 77 | // } 78 | // } 79 | } 80 | -------------------------------------------------------------------------------- /src/app/components/car-list/car-list.component.css: -------------------------------------------------------------------------------- 1 | img { 2 | cursor: pointer; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/components/car-list/car-list.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 |
7 | 15 |
16 |
17 | Searched for "{{ filterText }}" 18 |
19 |
20 |
21 |
22 | 23 | ... 32 |
33 |
{{ car.carName }}
34 | 35 |

Brand : {{ car.brandName }}

36 |

Model Year : {{ car.modelYear }}

37 |

Color : {{ car.colorName }}

38 |

Daily Price : {{ car.dailyPrice }} ₺

39 |
40 | 49 |
50 |
51 |
52 |
53 |
-------------------------------------------------------------------------------- /src/app/components/car-list/car-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { CarInfo } from 'src/app/models/carInfo'; 4 | import { BrandService } from 'src/app/services/brand.service'; 5 | import { CarService } from 'src/app/services/car.service'; 6 | import { environment } from 'src/environments/environment'; 7 | 8 | @Component({ 9 | selector: 'app-car-list', 10 | templateUrl: './car-list.component.html', 11 | styleUrls: ['./car-list.component.css'], 12 | }) 13 | export class CarListComponent implements OnInit { 14 | cars: CarInfo[] = []; 15 | baseURL = environment.apiBaseUrl; 16 | 17 | cardefaultImgPath = environment.cardefaultImgPath; 18 | filterText: string = ''; 19 | 20 | constructor( 21 | private carService: CarService, 22 | private activatedRoute: ActivatedRoute 23 | ) {} 24 | 25 | ngOnInit(): void { 26 | this.activatedRoute.params.subscribe((params) => { 27 | if (params['brandId'] && params['colorId']) 28 | this.getCarByBrandAndColor(params['brandId'], params['colorId']); 29 | else if (params['brandId']) this.getCarsByBrand(params['brandId']); 30 | else if (params['colorId']) this.getCarsByColor(params['colorId']); 31 | else this.getCars(); 32 | }); 33 | } 34 | getCars() { 35 | this.carService.getCarsDetails().subscribe((response) => { 36 | this.cars = response.data; 37 | }); 38 | } 39 | getCarsByBrand(brandId: number) { 40 | this.carService.getCarsDetailsByBrand(brandId).subscribe((response) => { 41 | this.cars = response.data; 42 | }); 43 | } 44 | getCarsByColor(colorId: number) { 45 | this.carService.getCarsDetailsByColor(colorId).subscribe((response) => { 46 | this.cars = response.data; 47 | }); 48 | } 49 | getCarByBrandAndColor(brandId: number, colorId: number) { 50 | this.carService 51 | .getCarsDetailsByBrandAndColor(brandId, colorId) 52 | .subscribe((response) => { 53 | this.cars = response.data; 54 | }); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/app/components/car-management/car-management.component.css: -------------------------------------------------------------------------------- 1 | @media (max-width: 768px) { 2 | } 3 | td { 4 | font-size: 14px; 5 | } 6 | span.badge { 7 | cursor: pointer; 8 | } 9 | -------------------------------------------------------------------------------- /src/app/components/car-management/car-management.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 40 | 41 | 42 |
Car IdModelBrandColorModel YearDaily PriceFindex Score
{{car.carId}}{{car.carName}}{{car.brandName}}{{car.colorName}}{{car.modelYear}}{{car.dailyPrice | currency:'₺'}}{{car.findexScore}} 27 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 |
43 |
44 |
45 | 46 | 47 | 48 | 96 | 97 | 98 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /src/app/components/car-management/car-management.component.ts: -------------------------------------------------------------------------------- 1 | declare var $: any; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { CarService } from 'src/app/services/car.service'; 4 | import { faTrash, faEdit, faImage } from '@fortawesome/free-solid-svg-icons'; 5 | import { CarInfo } from 'src/app/models/carInfo'; 6 | import { 7 | FormGroup, 8 | FormControl, 9 | FormBuilder, 10 | Validators, 11 | } from '@angular/forms'; 12 | import { Brand } from 'src/app/models/brand'; 13 | import { Color } from 'src/app/models/color'; 14 | import { BrandService } from 'src/app/services/brand.service'; 15 | import { ColorService } from 'src/app/services/color.service'; 16 | import { Car } from 'src/app/models/car'; 17 | import { Router } from '@angular/router'; 18 | import { ToastrService } from 'ngx-toastr'; 19 | import { ErrorService } from 'src/app/services/error.service'; 20 | 21 | @Component({ 22 | selector: 'app-car-management', 23 | templateUrl: './car-management.component.html', 24 | styleUrls: ['./car-management.component.css'], 25 | }) 26 | export class CarManagementComponent implements OnInit { 27 | constructor( 28 | private carService: CarService, 29 | private formBuilder: FormBuilder, 30 | private brandService: BrandService, 31 | private colorService: ColorService, 32 | private router: Router, 33 | private toastrService: ToastrService, 34 | private errorService: ErrorService 35 | ) {} 36 | carIdToDelete: Car; 37 | faTrash = faTrash; 38 | faEdit = faEdit; 39 | faImage = faImage; 40 | carToEdit: Car; 41 | cars: CarInfo[] = []; 42 | brands: Brand[] = []; 43 | colors: Color[] = []; 44 | carEditForm: FormGroup; 45 | 46 | ngOnInit(): void { 47 | this.createCarEditForm(); 48 | this.getCars(); 49 | this.getColors(); 50 | this.getBrands(); 51 | } 52 | 53 | getCars() { 54 | this.carService.getCarsDetails().subscribe((response) => { 55 | this.cars = response.data; 56 | }); 57 | } 58 | getBrands() { 59 | this.brandService.getBrands().subscribe((response) => { 60 | this.brands = response.data; 61 | }); 62 | } 63 | getColors() { 64 | this.colorService.getColors().subscribe((response) => { 65 | this.colors = response.data; 66 | }); 67 | } 68 | setCarToDelete(carId: number) { 69 | this.carIdToDelete = Object.assign({ id: carId }); 70 | } 71 | deleteCar() { 72 | this.carService.carDelete(this.carIdToDelete).subscribe( 73 | (response) => { 74 | this.toastrService.success(response.message); 75 | this.router 76 | .navigateByUrl('/', { skipLocationChange: true }) 77 | .then(() => this.router.navigate(['carmanage'])); 78 | }, 79 | (responseError) => { 80 | this.errorService.getError(responseError); 81 | } 82 | ); 83 | } 84 | createCarEditForm() { 85 | this.carEditForm = this.formBuilder.group({ 86 | id: new FormControl(''), 87 | brandId: new FormControl(Validators.required), 88 | colorId: new FormControl(Validators.required), 89 | modelYear: new FormControl('', Validators.required), 90 | description: new FormControl('', Validators.required), 91 | dailyPrice: new FormControl('', Validators.required), 92 | findexScore: new FormControl('', Validators.required), 93 | }); 94 | } 95 | getUpdateModel(car: CarInfo) { 96 | this.carEditForm.setValue({ 97 | id: car.carId, 98 | colorId: car.colorId, 99 | brandId: car.brandId, 100 | modelYear: car.modelYear, 101 | description: car.carName, 102 | dailyPrice: car.dailyPrice, 103 | findexScore: car.findexScore, 104 | }); 105 | } 106 | updateCar() { 107 | if (this.carEditForm.valid) { 108 | this.carToEdit = Object.assign({}, this.carEditForm.value); 109 | this.convertStrToInt(this.carToEdit); 110 | this.carService.carUpdate(this.carToEdit).subscribe( 111 | (response) => { 112 | this.carEditForm.reset(); 113 | $('#carUpdateModal').modal('hide'); 114 | this.router 115 | .navigateByUrl('/', { skipLocationChange: true }) 116 | .then(() => this.router.navigate(['carmanage'])); 117 | this.toastrService.success(response.message); 118 | }, 119 | (responseError) => { 120 | this.errorService.getError(responseError); 121 | } 122 | ); 123 | } else { 124 | this.toastrService.warning('Please fill the Form !'); 125 | } 126 | } 127 | addCar() { 128 | if (this.carEditForm.valid) { 129 | this.carEditForm.removeControl('id'); 130 | this.carToEdit = Object.assign({}, this.carEditForm.value); 131 | this.convertStrToInt(this.carToEdit); 132 | this.carService.carAdd(this.carToEdit).subscribe( 133 | (response) => { 134 | this.carEditForm.reset(); 135 | $('#carAddModal').modal('hide'); 136 | this.router 137 | .navigateByUrl('/', { skipLocationChange: true }) 138 | .then(() => this.router.navigate(['carmanage'])); 139 | this.toastrService.success(response.message); 140 | }, 141 | (responseError) => { 142 | this.errorService.getError(responseError); 143 | } 144 | ); 145 | } else { 146 | this.toastrService.warning('Please Fill the Form !'); 147 | } 148 | } 149 | convertStrToInt(carToEdit: Car) { 150 | carToEdit.brandId = parseInt(this.carEditForm.controls['brandId'].value); 151 | carToEdit.colorId = parseInt(this.carEditForm.controls['colorId'].value); 152 | return carToEdit; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /src/app/components/color-management/color-management.component.css: -------------------------------------------------------------------------------- 1 | td, 2 | th { 3 | text-align: center; 4 | } 5 | span { 6 | cursor: pointer; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/components/color-management/color-management.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 |
Color IdColor
{{color.id}}{{color.colorName}} 16 | 17 | 18 |
22 |
23 |
24 | 25 | 26 | 27 | 49 | 50 | 72 | 73 | 74 | 91 | 92 | -------------------------------------------------------------------------------- /src/app/components/color-management/color-management.component.ts: -------------------------------------------------------------------------------- 1 | declare var $: any; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { 4 | FormGroup, 5 | FormControl, 6 | FormBuilder, 7 | Validators, 8 | } from '@angular/forms'; 9 | import { Router } from '@angular/router'; 10 | import { faEdit, faTrash } from '@fortawesome/free-solid-svg-icons'; 11 | import { ToastrService } from 'ngx-toastr'; 12 | import { Color } from 'src/app/models/color'; 13 | import { ColorService } from 'src/app/services/color.service'; 14 | import { ErrorService } from 'src/app/services/error.service'; 15 | 16 | @Component({ 17 | selector: 'app-color-management', 18 | templateUrl: './color-management.component.html', 19 | styleUrls: ['./color-management.component.css'], 20 | }) 21 | export class ColorManagementComponent implements OnInit { 22 | colors: Color[]; 23 | colorEditForm: FormGroup; 24 | icons = { 25 | faTrash: faTrash, 26 | faEdit: faEdit, 27 | }; 28 | colorToDelete: Color; 29 | constructor( 30 | private colorService: ColorService, 31 | private fb: FormBuilder, 32 | private toastrService: ToastrService, 33 | private router: Router, 34 | private errorService: ErrorService 35 | ) {} 36 | 37 | ngOnInit(): void { 38 | this.createColorForm(); 39 | this.getColors(); 40 | } 41 | 42 | getColors() { 43 | this.colorService.getColors().subscribe((response) => { 44 | this.colors = response.data; 45 | }); 46 | } 47 | 48 | setColorToDelete(id: number) { 49 | this.colorToDelete = Object.assign({ id: id }); 50 | } 51 | 52 | deleteColor() { 53 | this.colorService.deleteColor(this.colorToDelete).subscribe( 54 | (response) => { 55 | $('#colorDeleteModal').modal('hide'); 56 | this.router 57 | .navigateByUrl('/', { skipLocationChange: true }) 58 | .then(() => this.router.navigate(['colormanage'])); 59 | this.toastrService.success(response.message); 60 | }, 61 | (responseError) => { 62 | this.errorService.getError(responseError); 63 | } 64 | ); 65 | } 66 | 67 | getUpdateModal(color: Color) { 68 | this.colorEditForm.setValue({ 69 | id: color.id, 70 | colorName: color.colorName, 71 | }); 72 | } 73 | 74 | updateColor() { 75 | if (this.colorEditForm.valid) { 76 | this.colorEditForm.patchValue({ 77 | id: Number(this.colorEditForm.controls['id'].value), 78 | }); 79 | let colorToUpdate = Object.assign({}, this.colorEditForm.value); 80 | this.colorService.updateColor(colorToUpdate).subscribe( 81 | (response) => { 82 | this.colorEditForm.reset(); 83 | $('#colorUpdateModal').modal('hide'); 84 | this.router 85 | .navigateByUrl('/', { skipLocationChange: true }) 86 | .then(() => this.router.navigate(['colormanage'])); 87 | this.toastrService.success(response.message); 88 | }, 89 | (responseError) => { 90 | this.errorService.getError(responseError); 91 | } 92 | ); 93 | } else { 94 | this.toastrService.warning('Please Fill the Form !'); 95 | } 96 | } 97 | addColor() { 98 | if (this.colorEditForm.valid) { 99 | this.colorEditForm.removeControl('id'); 100 | let colorToAdd = Object.assign({}, this.colorEditForm.value); 101 | this.colorService.addColor(colorToAdd).subscribe( 102 | (response) => { 103 | this.colorEditForm.reset(); 104 | $('#colorAddModal').modal('hide'); 105 | this.router 106 | .navigateByUrl('/', { skipLocationChange: true }) 107 | .then(() => this.router.navigate(['colormanage'])); 108 | this.toastrService.success(response.message); 109 | }, 110 | (responseError) => { 111 | this.errorService.getError(responseError); 112 | } 113 | ); 114 | } else { 115 | this.toastrService.warning('Please Fill the Form !'); 116 | } 117 | } 118 | 119 | createColorForm() { 120 | this.colorEditForm = this.fb.group({ 121 | id: new FormControl(''), 122 | colorName: new FormControl('', Validators.required), 123 | }); 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/app/components/color/color.component.css -------------------------------------------------------------------------------- /src/app/components/color/color.component.html: -------------------------------------------------------------------------------- 1 |
2 | 12 |
13 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { 3 | FormGroup, 4 | FormBuilder, 5 | FormControl, 6 | Validators, 7 | } from '@angular/forms'; 8 | import { ActivatedRoute, Router } from '@angular/router'; 9 | import { Color } from 'src/app/models/color'; 10 | import { Filters } from 'src/app/models/filters'; 11 | import { ColorService } from 'src/app/services/color.service'; 12 | 13 | @Component({ 14 | selector: 'app-color', 15 | templateUrl: './color.component.html', 16 | styleUrls: ['./color.component.css'], 17 | }) 18 | export class ColorComponent implements OnInit { 19 | colors: Color[] = []; 20 | colorId?: number; 21 | colorForm: FormGroup; 22 | constructor( 23 | private activatedRoute: ActivatedRoute, 24 | private colorService: ColorService, 25 | private fb: FormBuilder 26 | ) {} 27 | 28 | ngOnInit(): void { 29 | this.activatedRoute.params.subscribe((params) => { 30 | if (params['colorId']) { 31 | Filters.colorId = Number(params['colorId']); 32 | } else { 33 | Filters.colorId = 0; 34 | } 35 | this.getColor(); 36 | this.createColorForm(Filters.colorId); 37 | }); 38 | } 39 | getColor() { 40 | this.colorService.getColors().subscribe((response) => { 41 | this.colors = response.data; 42 | this.colors.unshift({ id: 0, colorName: 'SELECT A COLOR' }); 43 | }); 44 | } 45 | createColorForm(id: number) { 46 | this.colorForm = this.fb.group({ 47 | id: new FormControl(id, Validators.required), 48 | colorName: new FormControl('', Validators.required), 49 | }); 50 | } 51 | setCurrentColor() { 52 | Filters.colorId = this.colorForm.controls['id'].value; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/app/components/customer/customer.component.css -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
Customer IdCustomer NameEmailCompanyClaimsFindex Value
{{ customer.customerId }}{{ customer.firstName + ' '+ customer.lastName }}{{ customer.email }}{{ customer.companyName }}{{ customer.claims }}{{ customer.findexScore }}
-------------------------------------------------------------------------------- /src/app/components/customer/customer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { CustomerDetails } from 'src/app/models/customerDetails'; 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 | customers: CustomerDetails[] = []; 12 | constructor(private customerService: CustomerService) {} 13 | 14 | ngOnInit(): void { 15 | this.getCustomers(); 16 | } 17 | getCustomers() { 18 | this.customerService.getCustomers().subscribe((response) => { 19 | this.customers = response.data; 20 | }); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/app/components/filter/filter.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/app/components/filter/filter.component.css -------------------------------------------------------------------------------- /src/app/components/filter/filter.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
    4 |
  • CATEGORIES
  • 5 |
6 | 7 | 8 |
9 |
10 | 11 | 12 |
13 |
14 | -------------------------------------------------------------------------------- /src/app/components/filter/filter.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute, Router } from '@angular/router'; 3 | import { Filters } from 'src/app/models/filters'; 4 | @Component({ 5 | selector: 'app-filter', 6 | templateUrl: './filter.component.html', 7 | styleUrls: ['./filter.component.css'], 8 | }) 9 | export class FilterComponent implements OnInit { 10 | constructor(private router: Router, private activatedRoute: ActivatedRoute) {} 11 | 12 | ngOnInit(): void {} 13 | setRoute() { 14 | if (Filters['brandId'] && Filters['colorId']) 15 | this.router.navigate([ 16 | `cars/brand/${Filters.brandId}/color/${Filters.colorId}`, 17 | ]); 18 | else if (Filters['brandId']) 19 | this.router.navigate([`cars/brand/${Filters.brandId}`]); 20 | else if (Filters['colorId']) 21 | this.router.navigate([`cars/color/${Filters.colorId}`]); 22 | else this.router.navigate([`cars/`]); 23 | } 24 | clearRoute() { 25 | this.router.navigate([`cars/`]); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /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="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 | .bd-placeholder-img { 40 | font-size: 1.125rem; 41 | text-anchor: middle; 42 | -webkit-user-select: none; 43 | -moz-user-select: none; 44 | user-select: none; 45 | } 46 | 47 | @media (min-width: 768px) { 48 | .bd-placeholder-img-lg { 49 | font-size: 3.5rem; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 |

Please sign in

6 | 7 |
8 | 9 | 10 |
11 |
12 | 13 | 14 |
15 | 16 |
17 | 20 |
21 | 22 |

©2021

23 |
24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { 3 | FormBuilder, 4 | FormGroup, 5 | FormControl, 6 | Validators, 7 | } from '@angular/forms'; 8 | import { Router } from '@angular/router'; 9 | import { ToastrService } from 'ngx-toastr'; 10 | import { CustomerDetails } from 'src/app/models/customerDetails'; 11 | import { AuthService } from 'src/app/services/auth.service'; 12 | import { CustomerService } from 'src/app/services/customer.service'; 13 | import { StorageService } from 'src/app/services/storage.service'; 14 | import { environment } from 'src/environments/environment.prod'; 15 | @Component({ 16 | selector: 'app-login', 17 | templateUrl: './login.component.html', 18 | styleUrls: ['./login.component.css'], 19 | }) 20 | export class LoginComponent implements OnInit { 21 | loginForm: FormGroup; 22 | activeUser: CustomerDetails; 23 | constructor( 24 | private fb: FormBuilder, 25 | private authService: AuthService, 26 | private toastrService: ToastrService, 27 | private router: Router, 28 | private storageService: StorageService, 29 | private customerService: CustomerService 30 | ) {} 31 | 32 | ngOnInit(): void { 33 | this.createLoginForm(); 34 | } 35 | 36 | createLoginForm() { 37 | this.loginForm = this.fb.group({ 38 | email: ['', Validators.required], 39 | password: ['', Validators.required], 40 | }); 41 | } 42 | login() { 43 | if (this.loginForm.valid) { 44 | let loginModel = Object.assign({}, this.loginForm.value); 45 | this.authService.login(loginModel).subscribe( 46 | (response) => { 47 | this.setActiveUser(this.loginForm.controls['email'].value); 48 | this.toastrService.success(response.message); 49 | this.storageService.setToken(response.data.token); 50 | }, 51 | (responseError) => { 52 | this.toastrService.error(responseError.error); 53 | } 54 | ); 55 | } 56 | } 57 | setActiveUser(email: string) { 58 | this.customerService 59 | .getCustomerDetailsByEmail(email) 60 | .subscribe((response) => { 61 | this.activeUser = Object.assign({ 62 | email: response.data[0].email, 63 | firstName: response.data[0].firstName, 64 | lastName: response.data[0].lastName, 65 | companyName: response.data[0].companyName, 66 | customerId: response.data[0].customerId, 67 | userId: response.data[0].userId, 68 | findexScore: response.data[0].findexScore, 69 | claims: response.data[0].claims, 70 | }); 71 | 72 | this.storageService.setActiveUser(JSON.stringify(this.activeUser)); 73 | this.router.navigate(['']); 74 | }); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.css: -------------------------------------------------------------------------------- 1 | img { 2 | cursor: pointer; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.html: -------------------------------------------------------------------------------- 1 | 29 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { StorageService } from 'src/app/services/storage.service'; 3 | 4 | @Component({ 5 | selector: 'app-navi', 6 | templateUrl: './navi.component.html', 7 | styleUrls: ['./navi.component.css'], 8 | }) 9 | export class NaviComponent implements OnInit { 10 | constructor(private storageService: StorageService) {} 11 | 12 | ngOnInit(): void {} 13 | } 14 | -------------------------------------------------------------------------------- /src/app/components/pages/home/home.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/app/components/pages/home/home.component.css -------------------------------------------------------------------------------- /src/app/components/pages/home/home.component.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/app/components/pages/home/home.component.html -------------------------------------------------------------------------------- /src/app/components/pages/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-home', 5 | templateUrl: './home.component.html', 6 | styleUrls: ['./home.component.css'] 7 | }) 8 | export class HomeComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.css: -------------------------------------------------------------------------------- 1 | td { 2 | font-size: 16px; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

Credit Card Payment

6 |
7 |
8 |
9 |

Card Holder's Name

10 | 12 |
13 |
14 |

Card Number

15 | 17 |
18 |
19 |

Card Exp. Date

20 |
21 | 35 |
36 |
37 | 44 |
45 |
46 | 49 |
50 |
51 |
52 |
53 |
54 |

Amount

55 |
56 | 58 |
59 |
60 | 61 |
62 | 64 | 65 |
66 | 67 |
68 |
69 |
70 |
71 | 73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
Car Details
83 |
84 |
85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 115 | 118 | 119 | 120 |
Car Name{{carToRent.carName}}
Findex Score{{carToRent.findexScore}}
Rent Date{{rental.rentDate | date : 'dd-LL-YYYY'}}
Return Date{{rental.returnDate | date : 'dd-LL-YYYY'}}
Total Day{{totalDay}}
Daily Price{{carToRent.dailyPrice | currency:'₺'}}
113 |
TOTAL PRICE
114 |
116 |
{{totalPrice | currency:'₺'}}
117 |
121 |
122 |
Your Credit Cards
123 | 131 |
132 |
133 |
134 | 135 |
136 |
-------------------------------------------------------------------------------- /src/app/components/payment/payment.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute, Router } from '@angular/router'; 3 | import { Rental } from 'src/app/models/rental'; 4 | 5 | import { 6 | FormGroup, 7 | FormControl, 8 | FormBuilder, 9 | Validators, 10 | } from '@angular/forms'; 11 | import { CreditCardNumberPipe } from 'src/app/pipes/credit-card-number.pipe'; 12 | import { CarDetails } from 'src/app/models/carDetails'; 13 | import { CarService } from 'src/app/services/car.service'; 14 | import { CarInfo } from 'src/app/models/carInfo'; 15 | import { PaymentService } from 'src/app/services/payment.service'; 16 | import { ToastrService } from 'ngx-toastr'; 17 | import { RentalService } from 'src/app/services/rental.service'; 18 | import { CreditCardService } from 'src/app/services/credit-card.service'; 19 | import { CreditCard } from 'src/app/models/creditCard'; 20 | import { CustomerDetails } from 'src/app/models/customerDetails'; 21 | import { StorageService } from 'src/app/services/storage.service'; 22 | @Component({ 23 | selector: 'app-payment', 24 | templateUrl: './payment.component.html', 25 | styleUrls: ['./payment.component.css'], 26 | }) 27 | export class PaymentComponent implements OnInit { 28 | constructor( 29 | private activatedRoute: ActivatedRoute, 30 | private formBuilder: FormBuilder, 31 | private carService: CarService, 32 | private paymentService: PaymentService, 33 | private toastrService: ToastrService, 34 | private rentalService: RentalService, 35 | private creditCardService: CreditCardService, 36 | private storageService: StorageService, 37 | private router: Router 38 | ) {} 39 | 40 | rental: Rental; 41 | carToRent: CarInfo; 42 | totalDay: number; 43 | totalPrice: number; 44 | customerCreditCards: CreditCard[]; 45 | paymentForm: FormGroup; 46 | activeUser: CustomerDetails; 47 | 48 | ngOnInit(): void { 49 | this.activatedRoute.params.subscribe((params) => { 50 | this.rental = JSON.parse(params['rental']); 51 | this.getActiveUser(); 52 | this.getCustomerCreditCards(this.activeUser.customerId); 53 | this.createPaymentForm(); 54 | this.getCarDetails(this.rental.carId); 55 | }); 56 | } 57 | getActiveUser() { 58 | this.activeUser = this.storageService.getActiveUser(); 59 | } 60 | createPaymentForm() { 61 | this.paymentForm = this.formBuilder.group({ 62 | id: new FormControl(''), 63 | saveCardStatus: new FormControl(''), 64 | customerId: new FormControl(this.activeUser.customerId), 65 | holderName: new FormControl('', Validators.required), 66 | cardNumber: new FormControl('', Validators.required), 67 | mounthOfExp: new FormControl('', Validators.required), 68 | yearOfExp: new FormControl('', Validators.required), 69 | cvv: new FormControl('', Validators.required), 70 | }); 71 | } 72 | getCarDetails(carId: number) { 73 | this.carService.getCarDetailsById(carId).subscribe((response) => { 74 | this.carToRent = response.data[0]; 75 | this.getTotalPrice(); 76 | }); 77 | } 78 | getTotalPrice() { 79 | let rentDate = new Date(this.rental.rentDate); 80 | let returnDate = new Date(this.rental.returnDate); 81 | this.totalDay = 82 | (returnDate.getTime() - rentDate.getTime()) / (24 * 3600 * 1000); 83 | this.totalPrice = this.totalDay * this.carToRent.dailyPrice; 84 | } 85 | getCustomerCreditCards(customerId: number) { 86 | this.creditCardService 87 | .getCreditCardByCustomerId(customerId) 88 | .subscribe((response) => { 89 | this.customerCreditCards = response.data; 90 | }); 91 | } 92 | selectCreditCard(creditCard: CreditCard) { 93 | this.paymentForm.setValue( 94 | Object.assign({ ...creditCard, saveCardStatus: false }) 95 | ); 96 | } 97 | Payment() { 98 | if (this.paymentForm.valid) { 99 | let payment = Object.assign( 100 | { amount: this.totalPrice }, 101 | this.paymentForm.value 102 | ); 103 | this.paymentService.payment(payment).subscribe( 104 | (response) => { 105 | this.toastrService.success(response.message); 106 | this.rentalAdd(); 107 | this.saveCustomerCreditCard(); 108 | }, 109 | (responseError) => { 110 | this.toastrService.error(responseError.error.message); 111 | } 112 | ); 113 | } else { 114 | this.toastrService.warning('Please Fill the Required Areas !'); 115 | } 116 | } 117 | rentalAdd() { 118 | this.rental.customerId = this.activeUser.customerId; 119 | this.rentalService.addRental(this.rental).subscribe((response) => { 120 | this.router.navigate(['/']); 121 | }); 122 | } 123 | saveCustomerCreditCard() { 124 | if (this.paymentForm.value['saveCardStatus']) { 125 | this.paymentForm.removeControl('id'); 126 | let creditCard = this.paymentForm.value; 127 | this.creditCardService.addCreditCard(creditCard).subscribe((response) => { 128 | this.toastrService.success(response.message); 129 | }); 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /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 | .bd-placeholder-img { 40 | font-size: 1.125rem; 41 | text-anchor: middle; 42 | -webkit-user-select: none; 43 | -moz-user-select: none; 44 | user-select: none; 45 | } 46 | 47 | @media (min-width: 768px) { 48 | .bd-placeholder-img-lg { 49 | font-size: 3.5rem; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 | 7 | 8 |
9 |
10 | 11 | 12 |
13 |
14 | 15 | 16 |
17 |
18 | 19 | 20 |
21 |
22 | 24 | 25 |
26 | 27 |
28 |
29 |
30 |
31 | 32 | 33 | 34 |
35 |
-------------------------------------------------------------------------------- /src/app/components/register/register.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { 3 | FormBuilder, 4 | FormControl, 5 | FormGroup, 6 | Validators, 7 | } from '@angular/forms'; 8 | import { Router } from '@angular/router'; 9 | import { ToastrService } from 'ngx-toastr'; 10 | import { AuthService } from 'src/app/services/auth.service'; 11 | import { ErrorService } from 'src/app/services/error.service'; 12 | 13 | @Component({ 14 | selector: 'app-register', 15 | templateUrl: './register.component.html', 16 | styleUrls: ['./register.component.css'], 17 | }) 18 | export class RegisterComponent implements OnInit { 19 | registerForm: FormGroup; 20 | constructor( 21 | private fb: FormBuilder, 22 | private authService: AuthService, 23 | private toastrService: ToastrService, 24 | private router: Router, 25 | private errorService: ErrorService 26 | ) {} 27 | 28 | ngOnInit(): void { 29 | this.createRegisterForm(); 30 | } 31 | createRegisterForm() { 32 | this.registerForm = this.fb.group({ 33 | firstname: ['', Validators.required], 34 | lastname: ['', Validators.required], 35 | email: ['', Validators.required], 36 | password: ['', Validators.required], 37 | confirmPassword: ['', Validators.required], 38 | }); 39 | } 40 | register() { 41 | if (this.registerForm.valid) { 42 | if ( 43 | this.registerForm.value['password'] != 44 | this.registerForm.value['confirmPassword'] 45 | ) { 46 | this.toastrService.error('Passwords do not Match !'); 47 | return; 48 | } 49 | let registerForm = Object.assign({}, this.registerForm.value); 50 | this.authService.register(registerForm).subscribe( 51 | (response) => { 52 | this.router.navigate(['login']); 53 | this.toastrService.success('Register Successful !'); 54 | }, 55 | (responseError) => { 56 | this.errorService.getError(responseError); 57 | } 58 | ); 59 | } else { 60 | this.toastrService.info('Please Fill the Form !'); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/app/components/rent/rent.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/app/components/rent/rent.component.css -------------------------------------------------------------------------------- /src/app/components/rent/rent.component.html: -------------------------------------------------------------------------------- 1 | 37 | -------------------------------------------------------------------------------- /src/app/components/rent/rent.component.ts: -------------------------------------------------------------------------------- 1 | declare var $: any; 2 | import { DatePipe } from '@angular/common'; 3 | import { Component, OnInit } from '@angular/core'; 4 | import { ActivatedRoute, Router } from '@angular/router'; 5 | import { CarInfo } from 'src/app/models/carInfo'; 6 | import { CarService } from 'src/app/services/car.service'; 7 | import { 8 | FormGroup, 9 | FormControl, 10 | FormBuilder, 11 | Validators, 12 | } from '@angular/forms'; 13 | import { RentalService } from 'src/app/services/rental.service'; 14 | import { ResponseModel } from 'src/app/models/responseModel'; 15 | import { ToastrService } from 'ngx-toastr'; 16 | import { ErrorService } from 'src/app/services/error.service'; 17 | import { CustomerDetails } from 'src/app/models/customerDetails'; 18 | import { StorageService } from 'src/app/services/storage.service'; 19 | 20 | @Component({ 21 | selector: 'app-rent', 22 | templateUrl: './rent.component.html', 23 | styleUrls: ['./rent.component.css'], 24 | }) 25 | export class RentComponent implements OnInit { 26 | carID: number; 27 | carDetails: CarInfo; 28 | _rentDate = new FormControl(''); 29 | rentAddForm: FormGroup; 30 | IsRentable: ResponseModel = { 31 | isSuccess: true, 32 | message: '', 33 | }; 34 | modelStatus: string = ''; 35 | minRentDate = this.datePipe.transform(new Date(), 'yyyy-MM-dd'); 36 | minReturnDate: string; 37 | activeUser: CustomerDetails; 38 | 39 | constructor( 40 | private activatedRoute: ActivatedRoute, 41 | private carService: CarService, 42 | private formBuilder: FormBuilder, 43 | private rentalService: RentalService, 44 | private router: Router, 45 | private datePipe: DatePipe, 46 | private toastrService: ToastrService, 47 | private errorService: ErrorService, 48 | private storageService: StorageService 49 | ) {} 50 | 51 | ngOnInit(): void { 52 | this.storageService.getToken() 53 | ? (this.activeUser = this.storageService.getActiveUser()) 54 | : (this.activeUser = Object.assign({ customerId: 0 })); 55 | 56 | this.activatedRoute.params.subscribe((params) => { 57 | if (params['carId']) { 58 | this.carID = parseInt(params['carId']); 59 | this.getActiveCarDetail(params['carId']); 60 | } 61 | }); 62 | this.createRentAddForm(); 63 | } 64 | getActiveCarDetail(carId: number) { 65 | this.carService.getCarDetailsById(carId).subscribe((response) => { 66 | this.carDetails = response.data[0]; 67 | }); 68 | } 69 | createRentAddForm() { 70 | this.rentAddForm = this.formBuilder.group({ 71 | carId: [this.carID, Validators.required], 72 | rentDate: ['', Validators.required], 73 | returnDate: ['', Validators.required], 74 | }); 75 | } 76 | 77 | goToPayment() { 78 | if (this.isUserLogin()) { 79 | if (this.rentAddForm.valid) { 80 | let rentToAdd = Object.assign({}, this.rentAddForm.value); 81 | this.rentalService.IsRentable(rentToAdd).subscribe( 82 | (response) => { 83 | this.IsRentable = response; 84 | $('#rentModel').modal('hide'); 85 | this.router.navigate(['payment', JSON.stringify(rentToAdd)]); 86 | }, 87 | (responseError) => { 88 | this.IsRentable = responseError.error; 89 | this.errorService.getError(responseError); 90 | } 91 | ); 92 | } else { 93 | this.IsRentable = { 94 | isSuccess: false, 95 | message: 'Please Enter Required Areas !', 96 | }; 97 | } 98 | } 99 | } 100 | 101 | isUserLogin() { 102 | return this.storageService.getToken() ? true : false; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/app/components/rental/rental.component.css -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 28 | 29 |
RENTALS
CarCustomerCompanyRent DateReturn Date
{{ rental.carName }}{{ rental.customerName }}{{ rental.companyName }}{{ rental.rentDate.toString().split("T")[0] }} 21 | {{ 22 | rental.returnDate == null 23 | ? null 24 | : rental.returnDate.toString().split("T")[0] 25 | }} 26 |
30 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { RentalDetails } from 'src/app/models/rentalDetails'; 3 | import { RentalService } from 'src/app/services/rental.service'; 4 | 5 | @Component({ 6 | selector: 'app-rental', 7 | templateUrl: './rental.component.html', 8 | styleUrls: ['./rental.component.css'], 9 | }) 10 | export class RentalComponent implements OnInit { 11 | rentals: RentalDetails[] = []; 12 | constructor(private rentalService: RentalService) {} 13 | 14 | ngOnInit(): void { 15 | this.getRentals(); 16 | } 17 | getRentals() { 18 | this.rentalService.getRentals().subscribe((response) => { 19 | this.rentals = response.data; 20 | }); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/app/components/user-profile/user-profile.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/app/components/user-profile/user-profile.component.css -------------------------------------------------------------------------------- /src/app/components/user-profile/user-profile.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 |
7 | 8 |
9 |
10 |

{{activeUser.firstName + ' ' + activeUser.lastName}}

11 |
{{activeUser.companyName}}
12 |
13 |
    14 |
  • Email{{activeUser.email}} 15 |
  • 16 |
  • Findex 17 | Score{{activeUser.findexScore}}
  • 18 |
19 | 23 | 27 |
28 |
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 |
My Rentals
Car NameCustomerRent DateReturn DateStatus
{{rental.carName}}{{rental.customerName}}{{rental.rentDate | date}}{{rental.returnDate | date}}{{rentalStatus(rental)}}
56 |
57 | 58 |
59 | 60 | 61 | 62 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /src/app/components/user-profile/user-profile.component.ts: -------------------------------------------------------------------------------- 1 | declare var $: any; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { 4 | FormGroup, 5 | FormBuilder, 6 | FormControl, 7 | Validators, 8 | } from '@angular/forms'; 9 | import { Router } from '@angular/router'; 10 | import { ToastrService } from 'ngx-toastr'; 11 | import { CustomerDetails } from 'src/app/models/customerDetails'; 12 | import { RentalDetails } from 'src/app/models/rentalDetails'; 13 | import { AuthService } from 'src/app/services/auth.service'; 14 | import { ErrorService } from 'src/app/services/error.service'; 15 | import { RentalService } from 'src/app/services/rental.service'; 16 | import { StorageService } from 'src/app/services/storage.service'; 17 | 18 | @Component({ 19 | selector: 'app-user-profile', 20 | templateUrl: './user-profile.component.html', 21 | styleUrls: ['./user-profile.component.css'], 22 | }) 23 | export class UserProfileComponent implements OnInit { 24 | activeUser: CustomerDetails; 25 | rentals: RentalDetails[]; 26 | userUpdateForm: FormGroup; 27 | passwordUpdateForm: FormGroup; 28 | constructor( 29 | private storageService: StorageService, 30 | private rentalService: RentalService, 31 | private formBuilder: FormBuilder, 32 | private authService: AuthService, 33 | private router: Router, 34 | private toastrService: ToastrService, 35 | private errorService: ErrorService 36 | ) {} 37 | ngOnInit(): void { 38 | this.activeUser = this.storageService.getActiveUser(); 39 | this.createUserUpdateForm(); 40 | this.createPasswordForm(); 41 | this.getRentalsOfCustomer(this.activeUser.customerId); 42 | } 43 | getRentalsOfCustomer(customerId: number) { 44 | this.rentalService 45 | .getRentalsByCustomerId(customerId) 46 | .subscribe((response) => { 47 | this.rentals = response.data; 48 | }); 49 | } 50 | 51 | createUserUpdateForm() { 52 | this.userUpdateForm = this.formBuilder.group({ 53 | id: [this.activeUser.userId], 54 | customerId: [this.activeUser.customerId], 55 | firstName: [this.activeUser.firstName, Validators.required], 56 | lastName: [this.activeUser.lastName, Validators.required], 57 | email: [this.activeUser.email, Validators.required], 58 | companyName: [this.activeUser.companyName], 59 | findexScore: this.activeUser.findexScore, 60 | }); 61 | } 62 | createPasswordForm() { 63 | this.passwordUpdateForm = this.formBuilder.group({ 64 | id: [this.activeUser.userId, Validators.required], 65 | Password: ['', Validators.required], 66 | newPassword: ['', Validators.required], 67 | confirmPassword: ['', Validators.required], 68 | }); 69 | } 70 | 71 | rentalStatus(rental: RentalDetails) { 72 | let returnDate = new Date(rental.returnDate); 73 | if (returnDate.valueOf() < Date.now().valueOf()) { 74 | return 'Delivered'; 75 | } else { 76 | return 'In Use'; 77 | } 78 | } 79 | 80 | updateUser() { 81 | if (this.userUpdateForm.valid) { 82 | let userToUpdate = Object.assign({}, this.userUpdateForm.value); 83 | 84 | this.authService.updateUser(userToUpdate).subscribe( 85 | (response) => { 86 | delete userToUpdate['id']; 87 | this.activeUser = Object.assign({ ...this.activeUser }, userToUpdate); 88 | this.storageService.setActiveUser(JSON.stringify(this.activeUser)); 89 | $('#userUpdateModal').modal('hide'); 90 | this.toastrService.success(response.message); 91 | //window.location.replace('/account'); 92 | this.getRentalsOfCustomer(this.activeUser.customerId); 93 | this.router.navigate(['/account']); 94 | }, 95 | (responseError) => { 96 | this.errorService.getError(responseError); 97 | } 98 | ); 99 | } else { 100 | this.toastrService.warning('Please Fill The Form !'); 101 | } 102 | } 103 | changeUserPassword() { 104 | if (this.passwordUpdateForm.valid) { 105 | let passwordToUpdate = Object.assign({}, this.passwordUpdateForm.value); 106 | if ( 107 | this.passwordUpdateForm.controls['newPassword'].value !== 108 | this.passwordUpdateForm.controls['confirmPassword'].value 109 | ) { 110 | this.toastrService.warning('Passwords Do Not Match !'); 111 | return; 112 | } 113 | 114 | this.authService.updateUserPassword(passwordToUpdate).subscribe( 115 | (responseSuccess) => { 116 | $('#passwordUpdateModal').modal('hide'); 117 | this.passwordUpdateForm.reset(); 118 | this.toastrService.success(responseSuccess.message); 119 | }, 120 | (responseError) => { 121 | typeof responseError.error != 'string' 122 | ? this.errorService.getError(responseError) 123 | : this.toastrService.error(responseError.error); 124 | } 125 | ); 126 | } else { 127 | this.toastrService.warning('Please Fill the Form !'); 128 | } 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /src/app/components/usermenu/usermenu.component.css: -------------------------------------------------------------------------------- 1 | a { 2 | cursor: pointer; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/components/usermenu/usermenu.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 |
6 |
7 | 8 |
9 | 13 | 28 |
-------------------------------------------------------------------------------- /src/app/components/usermenu/usermenu.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { faWindowRestore } from '@fortawesome/free-solid-svg-icons'; 4 | import { CustomerDetails } from 'src/app/models/customerDetails'; 5 | import { StorageService } from 'src/app/services/storage.service'; 6 | import { environment } from 'src/environments/environment.prod'; 7 | 8 | @Component({ 9 | selector: 'app-usermenu', 10 | templateUrl: './usermenu.component.html', 11 | styleUrls: ['./usermenu.component.css'], 12 | }) 13 | export class UsermenuComponent implements OnInit { 14 | constructor( 15 | private storageServise: StorageService, 16 | private router: Router, 17 | private storageService: StorageService 18 | ) {} 19 | activeUser: CustomerDetails; 20 | 21 | ngOnInit(): void { 22 | this.getActiveUser(); 23 | } 24 | 25 | userIsLogined() { 26 | if (this.storageServise.getToken()) return true; 27 | else return false; 28 | } 29 | logout() { 30 | this.storageServise.deleteItem('token'); 31 | this.storageServise.deleteActiveUser(); 32 | this.router.navigate(['']); 33 | } 34 | 35 | userIsAdmin(): boolean { 36 | return this.getActiveUser().claims.includes('admin'); 37 | } 38 | getActiveUser(): CustomerDetails { 39 | this.activeUser = this.storageService.getActiveUser(); 40 | return this.activeUser; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/app/guards/admin.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { 3 | CanActivate, 4 | ActivatedRouteSnapshot, 5 | RouterStateSnapshot, 6 | UrlTree, 7 | Router, 8 | } from '@angular/router'; 9 | import { Observable } from 'rxjs'; 10 | import { ToastrService } from 'ngx-toastr'; 11 | import { StorageService } from '../services/storage.service'; 12 | 13 | @Injectable({ 14 | providedIn: 'root', 15 | }) 16 | export class AdminGuard implements CanActivate { 17 | constructor( 18 | private toastrServie: ToastrService, 19 | private router: Router, 20 | private storageService: StorageService 21 | ) {} 22 | canActivate( 23 | route: ActivatedRouteSnapshot, 24 | state: RouterStateSnapshot 25 | ): 26 | | Observable 27 | | Promise 28 | | boolean 29 | | UrlTree { 30 | let claims = this.storageService.getActiveUser().claims; 31 | if (claims.includes('admin')) { 32 | return true; 33 | } else { 34 | this.toastrServie.warning('You Are Not Authorized !'); 35 | this.router.navigate(['']); 36 | return false; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/app/guards/login.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { 3 | CanActivate, 4 | ActivatedRouteSnapshot, 5 | RouterStateSnapshot, 6 | UrlTree, 7 | Router, 8 | } from '@angular/router'; 9 | import { ToastrService } from 'ngx-toastr'; 10 | import { Observable } from 'rxjs'; 11 | import { AuthService } from '../services/auth.service'; 12 | 13 | @Injectable({ 14 | providedIn: 'root', 15 | }) 16 | export class LoginGuard implements CanActivate { 17 | constructor( 18 | private authService: AuthService, 19 | private toastrServie: ToastrService, 20 | private router: Router 21 | ) {} 22 | 23 | canActivate( 24 | route: ActivatedRouteSnapshot, 25 | state: RouterStateSnapshot 26 | ): 27 | | Observable 28 | | Promise 29 | | boolean 30 | | UrlTree { 31 | if (this.authService.isAuthenticated()) return true; 32 | else { 33 | this.router.navigate(['login']); 34 | this.toastrServie.info('You have to login !'); 35 | return false; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/app/interceptors/auth.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { 3 | HttpRequest, 4 | HttpHandler, 5 | HttpEvent, 6 | HttpInterceptor, 7 | } from '@angular/common/http'; 8 | import { Observable } from 'rxjs'; 9 | 10 | @Injectable() 11 | export class AuthInterceptor implements HttpInterceptor { 12 | constructor() {} 13 | 14 | intercept( 15 | request: HttpRequest, 16 | next: HttpHandler 17 | ): Observable> { 18 | let token = localStorage.getItem('token'); 19 | let newRequest: HttpRequest; 20 | newRequest = request.clone({ 21 | headers: request.headers.set('Authorization', 'Bearer ' + token), 22 | }); 23 | return next.handle(newRequest); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/app/models/SingleResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from './responseModel'; 2 | 3 | export interface SingleResponseModel extends ResponseModel { 4 | data: T; 5 | } 6 | -------------------------------------------------------------------------------- /src/app/models/brand.ts: -------------------------------------------------------------------------------- 1 | export interface Brand { 2 | id: number; 3 | brandName: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/app/models/car.ts: -------------------------------------------------------------------------------- 1 | export interface Car { 2 | id: number; 3 | brandId: number; 4 | colorId: number; 5 | modelYear: number; 6 | dailyPrice: number; 7 | description: string; 8 | } 9 | -------------------------------------------------------------------------------- /src/app/models/carDetails.ts: -------------------------------------------------------------------------------- 1 | import { CarInfo } from './carInfo'; 2 | import { CarImage } from './carImages'; 3 | 4 | export interface CarDetails { 5 | car: CarInfo; 6 | carImages: CarImage[]; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/models/carImages.ts: -------------------------------------------------------------------------------- 1 | export interface CarImage { 2 | id: number; 3 | carId: number; 4 | imagePath: string; 5 | uploadDate: Date; 6 | } 7 | -------------------------------------------------------------------------------- /src/app/models/carInfo.ts: -------------------------------------------------------------------------------- 1 | export interface CarInfo { 2 | carId: number; 3 | brandId: number; 4 | colorId: number; 5 | carName: string; 6 | brandName: string; 7 | colorName: string; 8 | dailyPrice: number; 9 | modelYear: number; 10 | imagePath: string; 11 | findexScore: number; 12 | } 13 | -------------------------------------------------------------------------------- /src/app/models/color.ts: -------------------------------------------------------------------------------- 1 | export interface Color { 2 | id: number; 3 | colorName: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/app/models/creditCard.ts: -------------------------------------------------------------------------------- 1 | export interface CreditCard { 2 | id: number; 3 | customerId: number; 4 | holderName: string; 5 | cardNumber: string; 6 | mounthOfExp: string; 7 | yearOfExp: string; 8 | cvv: string; 9 | } 10 | -------------------------------------------------------------------------------- /src/app/models/customer.ts: -------------------------------------------------------------------------------- 1 | export interface Customer { 2 | customerId: number; 3 | userId: number; 4 | companyName: string; 5 | findexScore: number; 6 | } 7 | -------------------------------------------------------------------------------- /src/app/models/customerDetails.ts: -------------------------------------------------------------------------------- 1 | import { Customer } from './customer'; 2 | 3 | export interface CustomerDetails extends Customer { 4 | email: string; 5 | password: string; 6 | firstName: string; 7 | lastName: string; 8 | findexScore: number; 9 | claims: string[]; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/models/filter.ts: -------------------------------------------------------------------------------- 1 | export interface Filter { 2 | brandId?: number; 3 | colorId?: number; 4 | } 5 | -------------------------------------------------------------------------------- /src/app/models/filters.ts: -------------------------------------------------------------------------------- 1 | import { Filter } from './filter'; 2 | 3 | export const Filters: Filter = {}; 4 | -------------------------------------------------------------------------------- /src/app/models/listResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from './responseModel'; 2 | 3 | export interface ListResponseModel extends ResponseModel { 4 | data: T[]; 5 | } 6 | -------------------------------------------------------------------------------- /src/app/models/loginModel.ts: -------------------------------------------------------------------------------- 1 | export interface LoginModel { 2 | email: string; 3 | password: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/app/models/payment.ts: -------------------------------------------------------------------------------- 1 | import { CreditCard } from './creditCard'; 2 | 3 | export interface Payment extends CreditCard { 4 | amount: number; 5 | } 6 | -------------------------------------------------------------------------------- /src/app/models/registerModel.ts: -------------------------------------------------------------------------------- 1 | export interface RegisterModel { 2 | firstname: string; 3 | lastname: string; 4 | email: string; 5 | password: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/app/models/rental.ts: -------------------------------------------------------------------------------- 1 | export interface Rental { 2 | id: number; 3 | carId: number; 4 | customerId: number; 5 | rentDate: Date; 6 | returnDate: Date; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/models/rentalDetails.ts: -------------------------------------------------------------------------------- 1 | export interface RentalDetails { 2 | carName: string; 3 | customerName: string; 4 | companyName: string; 5 | rentDate: Date; 6 | returnDate: Date; 7 | } 8 | -------------------------------------------------------------------------------- /src/app/models/responseModel.ts: -------------------------------------------------------------------------------- 1 | export interface ResponseModel { 2 | isSuccess: boolean; 3 | message: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/app/models/tokenModel.ts: -------------------------------------------------------------------------------- 1 | export interface TokenModel { 2 | token: string; 3 | expiration: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/app/models/user.ts: -------------------------------------------------------------------------------- 1 | export interface User { 2 | id: number; 3 | firstName: string; 4 | lastName: string; 5 | email: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/app/pipes/credit-card-number.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({ 4 | name: 'creditCardNumber', 5 | }) 6 | export class CreditCardNumberPipe implements PipeTransform { 7 | transform(value: string, ...args: unknown[]): string { 8 | return value 9 | .replace(/\s+/g, '') 10 | .replace(/(\d{4})/g, '$1 ') 11 | .trim(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/app/pipes/filter-pipe.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { CarInfo } from '../models/carInfo'; 3 | 4 | @Pipe({ 5 | name: 'filterPipe', 6 | }) 7 | export class FilterPipePipe implements PipeTransform { 8 | transform(value: CarInfo[], filterText: string): CarInfo[] { 9 | filterText ? (filterText = filterText.toLowerCase()) : ''; 10 | return value.filter( 11 | (carInfo) => 12 | carInfo.brandName.toLowerCase().includes(filterText) || 13 | carInfo.colorName.toLowerCase().includes(filterText) || 14 | carInfo.carName.toLowerCase().includes(filterText) 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /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 { CustomerDetails } from '../models/customerDetails'; 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 { User } from '../models/user'; 11 | 12 | @Injectable({ 13 | providedIn: 'root', 14 | }) 15 | export class AuthService { 16 | constructor(private httpClient: HttpClient) {} 17 | apiURL = 'https://localhost:44375/api/auth/'; 18 | 19 | login(loginModel: LoginModel): Observable> { 20 | return this.httpClient.post>( 21 | this.apiURL + 'login', 22 | loginModel 23 | ); 24 | } 25 | 26 | isAuthenticated() { 27 | if (localStorage.getItem('token')) return true; 28 | else return false; 29 | } 30 | register( 31 | registerModel: RegisterModel 32 | ): Observable> { 33 | return this.httpClient.post>( 34 | this.apiURL + 'register', 35 | registerModel 36 | ); 37 | } 38 | updateUser(user: CustomerDetails): Observable { 39 | let newURL = this.apiURL + 'UserUpdate'; 40 | return this.httpClient.post(newURL, user); 41 | } 42 | updateUserPassword(userPassword: any): Observable { 43 | let newURL = this.apiURL + 'changepassword'; 44 | return this.httpClient.post(newURL, userPassword); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /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 | 8 | @Injectable({ 9 | providedIn: 'root', 10 | }) 11 | export class BrandService { 12 | apiURL = 'https://localhost:44375/api/brands/'; 13 | constructor(private httpClient: HttpClient) {} 14 | getBrands(): Observable> { 15 | let newURL = this.apiURL + 'getall'; 16 | return this.httpClient.get>(newURL); 17 | } 18 | updateBrand(brand: Brand): Observable { 19 | let newURL = this.apiURL + 'update'; 20 | return this.httpClient.post(newURL, brand); 21 | } 22 | addBrand(brand: Brand): Observable { 23 | let newURL = this.apiURL + 'add'; 24 | return this.httpClient.post(newURL, brand); 25 | } 26 | deleteBrand(brand: Brand): Observable { 27 | let newURL = this.apiURL + 'delete'; 28 | return this.httpClient.post(newURL, brand); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /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/carImages'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | 7 | @Injectable({ 8 | providedIn: 'root', 9 | }) 10 | export class CarImageService { 11 | apiURL = 'https://localhost:44375/api/carImages/GetByCarId?id='; 12 | constructor(private httpClient: HttpClient) {} 13 | getCarImages(carId: number): Observable> { 14 | let newURL = this.apiURL + carId; 15 | return this.httpClient.get>(newURL); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/app/services/car.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable, Observer } from 'rxjs'; 4 | import { CarInfo } from '../models/carInfo'; 5 | import { SingleResponseModel } from '../models/SingleResponseModel'; 6 | import { ListResponseModel } from '../models/listResponseModel'; 7 | import { Car } from '../models/car'; 8 | import { ResponseModel } from '../models/responseModel'; 9 | 10 | @Injectable({ 11 | providedIn: 'root', 12 | }) 13 | export class CarService { 14 | apiURL = 'https://localhost:44375/api/cars/'; 15 | constructor(private httpClient: HttpClient) {} 16 | 17 | getCarsDetails(): Observable> { 18 | let newPath = this.apiURL + 'cardetails'; 19 | return this.httpClient.get>(newPath); 20 | } 21 | getCarsDetailsByBrand( 22 | brandId: number 23 | ): Observable> { 24 | let newPath = this.apiURL + 'CarDetailsByBrandId?id=' + brandId; 25 | return this.httpClient.get>(newPath); 26 | } 27 | getCarsDetailsByColor( 28 | colorId: number 29 | ): Observable> { 30 | let newPath = this.apiURL + 'CarDetailsByColorId?id=' + colorId; 31 | return this.httpClient.get>(newPath); 32 | } 33 | 34 | getCarDetailsById(carId: number): Observable> { 35 | let newPath = this.apiURL + 'CarDetailsByCarId?id=' + carId; 36 | return this.httpClient.get>(newPath); 37 | } 38 | getCarsDetailsByBrandAndColor( 39 | brandId: number, 40 | colorId: number 41 | ): Observable> { 42 | let newPath = 43 | this.apiURL + 44 | 'CarsByBrandAndColor?brandId=' + 45 | brandId + 46 | '&colorId=' + 47 | colorId; 48 | return this.httpClient.get>(newPath); 49 | } 50 | carUpdate(car: Car): Observable { 51 | let newURL = this.apiURL + 'update'; 52 | return this.httpClient.post(newURL, car); 53 | } 54 | carDelete(car: Car): Observable { 55 | let newURL = this.apiURL + 'delete'; 56 | return this.httpClient.post(newURL, car); 57 | } 58 | carAdd(car: Car): Observable { 59 | let newURL = this.apiURL + 'add'; 60 | return this.httpClient.post(newURL, car); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /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 | apiURL = 'https://localhost:44375/api/colors/'; 13 | constructor(private httpClient: HttpClient) {} 14 | getColors(): Observable> { 15 | let newURL = this.apiURL + 'getall'; 16 | return this.httpClient.get>(newURL); 17 | } 18 | deleteColor(color: Color): Observable { 19 | let newURL = this.apiURL + 'delete'; 20 | return this.httpClient.post(newURL, color); 21 | } 22 | updateColor(color: Color): Observable { 23 | let newURL = this.apiURL + 'update'; 24 | return this.httpClient.post(newURL, color); 25 | } 26 | addColor(color: Color): Observable { 27 | let newURL = this.apiURL + 'add'; 28 | return this.httpClient.post(newURL, color); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /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 | constructor(private httpClient: HttpClient) {} 13 | apiURL = 'https://localhost:44375/api/creditcard/'; 14 | 15 | addCreditCard(creditCard: CreditCard): Observable { 16 | let newURL = `${this.apiURL}add`; 17 | return this.httpClient.post(newURL, creditCard); 18 | } 19 | deleteCreditCard(creditCard: CreditCard): Observable { 20 | let newURL = `${this.apiURL}delete`; 21 | return this.httpClient.post(newURL, creditCard); 22 | } 23 | getCreditCardByCustomerId( 24 | customerId: number 25 | ): Observable> { 26 | let newURL = `${this.apiURL}GetByCustomerId?id=${customerId}`; 27 | return this.httpClient.get>(newURL); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /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 { CustomerDetails } from '../models/customerDetails'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | 7 | @Injectable({ 8 | providedIn: 'root', 9 | }) 10 | export class CustomerService { 11 | apiURL = 'https://localhost:44375/api/customers/'; 12 | constructor(private httpClient: HttpClient) {} 13 | 14 | getCustomers(): Observable> { 15 | let newURL = this.apiURL + 'customerdetails'; 16 | return this.httpClient.get>(newURL); 17 | } 18 | getCustomerDetailsByEmail( 19 | email: string 20 | ): Observable> { 21 | let newURL = this.apiURL + 'customerDetailsByEmail?email=' + email; 22 | return this.httpClient.get>(newURL); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/app/services/error.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { ToastrService } from 'ngx-toastr'; 3 | 4 | @Injectable({ 5 | providedIn: 'root', 6 | }) 7 | export class ErrorService { 8 | constructor(private toastrService: ToastrService) {} 9 | getError(responseError: any) { 10 | if (responseError.error.ValidationErrors.length > 0) { 11 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 12 | this.toastrService.error( 13 | responseError.error.ValidationErrors[i].ErrorMessage, 14 | 'Validation Error' 15 | ); 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/app/services/payment.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Payment } from '../models/payment'; 5 | import { ResponseModel } from '../models/responseModel'; 6 | 7 | @Injectable({ 8 | providedIn: 'root', 9 | }) 10 | export class PaymentService { 11 | apiURl = 'https://localhost:44375/api'; 12 | constructor(private httpClient: HttpClient) {} 13 | 14 | payment(payment: Payment): Observable { 15 | let newURL = this.apiURl + '/payment/payment'; 16 | return this.httpClient.post(newURL, payment); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /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 { RentalDetails } from '../models/rentalDetails'; 7 | import { ResponseModel } from '../models/responseModel'; 8 | 9 | @Injectable({ 10 | providedIn: 'root', 11 | }) 12 | export class RentalService { 13 | apiURL = 'https://localhost:44375/api/rentals/'; 14 | constructor(private httpCLient: HttpClient) {} 15 | getRentals(): Observable> { 16 | let newURL = this.apiURL + 'rentaldetails'; 17 | return this.httpCLient.get>(newURL); 18 | } 19 | addRental(rental: Rental): Observable> { 20 | let newURL = this.apiURL + 'add'; 21 | return this.httpCLient.post>( 22 | newURL, 23 | rental 24 | ); 25 | } 26 | IsRentable(rental: Rental): Observable { 27 | let newURL = this.apiURL + 'isrentable'; 28 | return this.httpCLient.post(newURL, rental); 29 | } 30 | checkFindexScore( 31 | customerId: number, 32 | carId: number 33 | ): Observable { 34 | let newURL = 35 | this.apiURL + `checkfindex?customerId=${customerId}&carId=${carId}`; 36 | return this.httpCLient.get(newURL); 37 | } 38 | getRentalsByCustomerId( 39 | customerId: number 40 | ): Observable> { 41 | let newUrl = this.apiURL + 'RentalDetailsByCustomerId?id=' + customerId; 42 | return this.httpCLient.get>(newUrl); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/app/services/storage.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CustomerDetails } from '../models/customerDetails'; 3 | 4 | @Injectable({ 5 | providedIn: 'root', 6 | }) 7 | export class StorageService { 8 | constructor() {} 9 | 10 | //Token Storage 11 | setToken(value: string) { 12 | localStorage.setItem('token', value); 13 | } 14 | getToken() { 15 | return localStorage.getItem('token'); 16 | } 17 | deleteToken() { 18 | localStorage.removeItem('token'); 19 | } 20 | //----------------------------------- 21 | 22 | //USER STORAGE------------------------ 23 | setActiveUser(value: string) { 24 | localStorage.setItem('User', value); 25 | } 26 | getActiveUser(): CustomerDetails { 27 | return JSON.parse(localStorage.getItem('User') || '{}'); 28 | } 29 | deleteActiveUser() { 30 | localStorage.removeItem('User'); 31 | } 32 | //------------------------------------- 33 | 34 | deleteItem(key: string) { 35 | localStorage.removeItem(key); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/app/services/user.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ResponseModel } from '../models/responseModel'; 5 | import { SingleResponseModel } from '../models/SingleResponseModel'; 6 | import { User } from '../models/user'; 7 | 8 | @Injectable({ 9 | providedIn: 'root', 10 | }) 11 | export class UserService { 12 | apiURl = 'https://localhost:44375/api/users/'; 13 | 14 | constructor(private httpClient: HttpClient) {} 15 | getUserById(id: number): Observable> { 16 | let newURL = this.apiURl + '/GetById?id=' + id; 17 | return this.httpClient.get>(newURL); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/assets/ReCapProject-Frontend.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/assets/ReCapProject-Frontend.JPG -------------------------------------------------------------------------------- /src/assets/Rent A Car Project.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/assets/Rent A Car Project.gif -------------------------------------------------------------------------------- /src/assets/car-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/assets/car-logo.png -------------------------------------------------------------------------------- /src/assets/logo.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/assets/logo.JPG -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/assets/logo.png -------------------------------------------------------------------------------- /src/assets/r1.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/assets/r1.JPG -------------------------------------------------------------------------------- /src/assets/r2.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/assets/r2.JPG -------------------------------------------------------------------------------- /src/assets/r3.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/assets/r3.JPG -------------------------------------------------------------------------------- /src/assets/r4.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/assets/r4.JPG -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | apiBaseUrl: 'https://localhost:44375/', 4 | activeUser: {}, 5 | }; 6 | -------------------------------------------------------------------------------- /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 | apiBaseUrl: 'https://localhost:44375/', 8 | cardefaultImgPath: 'Upload/Images/CarImages/default.jpg', 9 | }; 10 | 11 | /* 12 | * For easier debugging in development mode, you can import the following file 13 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 14 | * 15 | * This import should be commented out in production mode because it will have a negative impact 16 | * on performance if an error is thrown. 17 | */ 18 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 19 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mvolkanaslan/ReCapProject-Frontend/5f37c7981a91462cf95a72be96eec206db9dd950/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ReCapProjectFrontend 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** 22 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js/dist/zone'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | @import "~@fortawesome/fontawesome-free/css/all.css"; 3 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "strictPropertyInitialization": false, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "sourceMap": true, 13 | "declaration": false, 14 | "downlevelIteration": true, 15 | "experimentalDecorators": true, 16 | "moduleResolution": "node", 17 | "importHelpers": true, 18 | "target": "es2015", 19 | "module": "es2020", 20 | "lib": ["es2018", "dom"] 21 | }, 22 | "angularCompilerOptions": { 23 | "enableI18nLegacyMessageIdFormat": false, 24 | "strictInjectionParameters": true, 25 | "strictInputAccessModifiers": true, 26 | "strictTemplates": true 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": [ 4 | "codelyzer" 5 | ], 6 | "rules": { 7 | "align": { 8 | "options": [ 9 | "parameters", 10 | "statements" 11 | ] 12 | }, 13 | "array-type": false, 14 | "arrow-return-shorthand": true, 15 | "curly": true, 16 | "deprecation": { 17 | "severity": "warning" 18 | }, 19 | "eofline": true, 20 | "import-blacklist": [ 21 | true, 22 | "rxjs/Rx" 23 | ], 24 | "import-spacing": true, 25 | "indent": { 26 | "options": [ 27 | "spaces" 28 | ] 29 | }, 30 | "max-classes-per-file": false, 31 | "max-line-length": [ 32 | true, 33 | 140 34 | ], 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-console": [ 47 | true, 48 | "debug", 49 | "info", 50 | "time", 51 | "timeEnd", 52 | "trace" 53 | ], 54 | "no-empty": false, 55 | "no-inferrable-types": [ 56 | true, 57 | "ignore-params" 58 | ], 59 | "no-non-null-assertion": true, 60 | "no-redundant-jsdoc": true, 61 | "no-switch-case-fall-through": true, 62 | "no-var-requires": false, 63 | "object-literal-key-quotes": [ 64 | true, 65 | "as-needed" 66 | ], 67 | "quotemark": [ 68 | true, 69 | "single" 70 | ], 71 | "semicolon": { 72 | "options": [ 73 | "always" 74 | ] 75 | }, 76 | "space-before-function-paren": { 77 | "options": { 78 | "anonymous": "never", 79 | "asyncArrow": "always", 80 | "constructor": "never", 81 | "method": "never", 82 | "named": "never" 83 | } 84 | }, 85 | "typedef": [ 86 | true, 87 | "call-signature" 88 | ], 89 | "typedef-whitespace": { 90 | "options": [ 91 | { 92 | "call-signature": "nospace", 93 | "index-signature": "nospace", 94 | "parameter": "nospace", 95 | "property-declaration": "nospace", 96 | "variable-declaration": "nospace" 97 | }, 98 | { 99 | "call-signature": "onespace", 100 | "index-signature": "onespace", 101 | "parameter": "onespace", 102 | "property-declaration": "onespace", 103 | "variable-declaration": "onespace" 104 | } 105 | ] 106 | }, 107 | "variable-name": { 108 | "options": [ 109 | "ban-keywords", 110 | "check-format", 111 | "allow-pascal-case" 112 | ] 113 | }, 114 | "whitespace": { 115 | "options": [ 116 | "check-branch", 117 | "check-decl", 118 | "check-operator", 119 | "check-separator", 120 | "check-type", 121 | "check-typecast" 122 | ] 123 | }, 124 | "component-class-suffix": true, 125 | "contextual-lifecycle": true, 126 | "directive-class-suffix": true, 127 | "no-conflicting-lifecycle": true, 128 | "no-host-metadata-property": true, 129 | "no-input-rename": true, 130 | "no-inputs-metadata-property": true, 131 | "no-output-native": true, 132 | "no-output-on-prefix": true, 133 | "no-output-rename": true, 134 | "no-outputs-metadata-property": true, 135 | "template-banana-in-box": true, 136 | "template-no-negated-async": true, 137 | "use-lifecycle-interface": true, 138 | "use-pipe-transform-interface": true, 139 | "directive-selector": [ 140 | true, 141 | "attribute", 142 | "app", 143 | "camelCase" 144 | ], 145 | "component-selector": [ 146 | true, 147 | "element", 148 | "app", 149 | "kebab-case" 150 | ] 151 | } 152 | } 153 | --------------------------------------------------------------------------------