├── .browserslistrc ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── debug.log ├── 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-add │ │ │ ├── brand-add.component.css │ │ │ ├── brand-add.component.html │ │ │ ├── brand-add.component.spec.ts │ │ │ └── brand-add.component.ts │ │ ├── brand-list │ │ │ ├── brand-list.component.css │ │ │ ├── brand-list.component.html │ │ │ ├── brand-list.component.spec.ts │ │ │ └── brand-list.component.ts │ │ ├── brand-update │ │ │ ├── brand-update.component.css │ │ │ ├── brand-update.component.html │ │ │ ├── brand-update.component.spec.ts │ │ │ └── brand-update.component.ts │ │ ├── brand │ │ │ ├── brand.component.css │ │ │ ├── brand.component.html │ │ │ ├── brand.component.spec.ts │ │ │ └── brand.component.ts │ │ ├── car-add │ │ │ ├── car-add.component.css │ │ │ ├── car-add.component.html │ │ │ ├── car-add.component.spec.ts │ │ │ └── car-add.component.ts │ │ ├── car-detail │ │ │ ├── car-detail.component.css │ │ │ ├── car-detail.component.html │ │ │ ├── car-detail.component.spec.ts │ │ │ └── car-detail.component.ts │ │ ├── car-filter │ │ │ ├── car-filter.component.css │ │ │ ├── car-filter.component.html │ │ │ └── car-filter.component.ts │ │ ├── car-list │ │ │ ├── car-list.component.css │ │ │ ├── car-list.component.html │ │ │ ├── car-list.component.spec.ts │ │ │ └── car-list.component.ts │ │ ├── car-update │ │ │ ├── car-update.component.css │ │ │ ├── car-update.component.html │ │ │ ├── car-update.component.spec.ts │ │ │ └── car-update.component.ts │ │ ├── car │ │ │ ├── car.component.css │ │ │ ├── car.component.html │ │ │ ├── car.component.spec.ts │ │ │ └── car.component.ts │ │ ├── change-password │ │ │ ├── change-password.component.css │ │ │ ├── change-password.component.html │ │ │ ├── change-password.component.spec.ts │ │ │ └── change-password.component.ts │ │ ├── color-add │ │ │ ├── color-add.component.css │ │ │ ├── color-add.component.html │ │ │ ├── color-add.component.spec.ts │ │ │ └── color-add.component.ts │ │ ├── color-list │ │ │ ├── color-list.component.css │ │ │ ├── color-list.component.html │ │ │ ├── color-list.component.spec.ts │ │ │ └── color-list.component.ts │ │ ├── color-update │ │ │ ├── color-update.component.css │ │ │ ├── color-update.component.html │ │ │ ├── color-update.component.spec.ts │ │ │ └── color-update.component.ts │ │ ├── color │ │ │ ├── color.component.css │ │ │ ├── color.component.html │ │ │ ├── color.component.spec.ts │ │ │ └── color.component.ts │ │ ├── customer │ │ │ ├── customer.component.css │ │ │ ├── customer.component.html │ │ │ ├── customer.component.spec.ts │ │ │ └── customer.component.ts │ │ ├── debug.log │ │ ├── footer │ │ │ ├── footer.component.css │ │ │ ├── footer.component.html │ │ │ ├── footer.component.spec.ts │ │ │ └── footer.component.ts │ │ ├── home │ │ │ ├── home.component.css │ │ │ ├── home.component.html │ │ │ ├── home.component.spec.ts │ │ │ └── home.component.ts │ │ ├── login │ │ │ ├── login.component.css │ │ │ ├── login.component.html │ │ │ ├── login.component.spec.ts │ │ │ └── login.component.ts │ │ ├── navi │ │ │ ├── navi.component.css │ │ │ ├── navi.component.html │ │ │ ├── navi.component.spec.ts │ │ │ └── navi.component.ts │ │ ├── payment │ │ │ ├── payment.component.css │ │ │ ├── payment.component.html │ │ │ ├── payment.component.spec.ts │ │ │ └── payment.component.ts │ │ ├── profile │ │ │ ├── profile.component.css │ │ │ ├── profile.component.html │ │ │ ├── profile.component.spec.ts │ │ │ └── profile.component.ts │ │ ├── register │ │ │ ├── register.component.css │ │ │ ├── register.component.html │ │ │ ├── register.component.spec.ts │ │ │ └── register.component.ts │ │ ├── rental-list │ │ │ ├── rental-list.component.css │ │ │ ├── rental-list.component.html │ │ │ ├── rental-list.component.spec.ts │ │ │ └── rental-list.component.ts │ │ ├── rental │ │ │ ├── rental.component.css │ │ │ ├── rental.component.html │ │ │ ├── rental.component.spec.ts │ │ │ └── rental.component.ts │ │ └── user-cards │ │ │ ├── user-cards.component.css │ │ │ ├── user-cards.component.html │ │ │ ├── user-cards.component.spec.ts │ │ │ └── user-cards.component.ts │ ├── guards │ │ └── login.guard.ts │ ├── interceptors │ │ ├── auth.interceptor.spec.ts │ │ └── auth.interceptor.ts │ ├── models │ │ ├── brand.ts │ │ ├── car.ts │ │ ├── carDetail.ts │ │ ├── carImage.ts │ │ ├── carImageAdd.ts │ │ ├── card.ts │ │ ├── color.ts │ │ ├── customer.ts │ │ ├── listResponseModel.ts │ │ ├── loginModel.ts │ │ ├── passwordChangeModel.ts │ │ ├── payment.ts │ │ ├── profile.ts │ │ ├── registerModel.ts │ │ ├── rental.ts │ │ ├── responseModel.ts │ │ ├── singleResponseModel.ts │ │ ├── tokenModel.ts │ │ └── user.ts │ ├── pipes │ │ ├── brand-filter-pipe.pipe.ts │ │ ├── car-filter-pipe.pipe.ts │ │ ├── color-filter-pipe.pipe.ts │ │ └── customer-filter-pipe.pipe.ts │ └── services │ │ ├── auth.service.ts │ │ ├── brand.service.ts │ │ ├── car-detail.service.ts │ │ ├── car-image.service.ts │ │ ├── car.service.ts │ │ ├── card.service.ts │ │ ├── color.service.ts │ │ ├── customer.service.ts │ │ ├── local-storage.service.ts │ │ ├── payment.service.ts │ │ ├── rental.service.ts │ │ └── user.service.ts ├── assets │ └── .gitkeep ├── 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

WELCOME TO DREAM CARS

2 | 3 | ![Logo1 yatay white](https://user-images.githubusercontent.com/51466724/113584660-d66e8d80-9633-11eb-9e96-9fcabaad9d14.png) 4 | 5 | --- 6 |

HOME PAGE

7 | 8 | ![HomePage](https://user-images.githubusercontent.com/51466724/113709665-72a79b80-96eb-11eb-962d-4deb4c5c0241.jpg) 9 | 10 | --- 11 |

CARS

12 | 13 | ![Cars](https://user-images.githubusercontent.com/51466724/113709648-6c192400-96eb-11eb-8c37-51f5d351b04e.jpg) 14 | 15 | --- 16 |

USER PROFILE

17 | 18 | ![UserProfile](https://user-images.githubusercontent.com/51466724/113709107-c82f7880-96ea-11eb-8cf6-9e00e1435ee0.png) 19 | 20 | --- 21 |

CAR LIST

22 |
NOTE: You can't make any operations when you aren't log-in
23 | 24 | ![CarList](https://user-images.githubusercontent.com/51466724/113709111-c8c80f00-96ea-11eb-8285-cefe59bd1073.png) 25 | 26 |

RENTAL LIST

27 | 28 | ![RentalList](https://user-images.githubusercontent.com/51466724/113709112-c960a580-96ea-11eb-8148-cb8ee0b25294.png) 29 | 30 | --- 31 |

RENT A CAR

32 | 33 | ![Renting](https://user-images.githubusercontent.com/51466724/113709080-c1a10100-96ea-11eb-99c9-0a143ae10c82.png) 34 | 35 | --- 36 |

FINDEX

37 | 38 | ![FindexProtect](https://user-images.githubusercontent.com/51466724/113709061-bc43b680-96ea-11eb-8da6-97503d3cc0f6.png) 39 | 40 | --- 41 |

RENT CONTROL

42 | 43 | ![RentProtect](https://user-images.githubusercontent.com/51466724/113709064-bf3ea700-96ea-11eb-98b5-1e5afdaf33e4.png) 44 | 45 | --- 46 |

NOT AVAILABLE CAR

47 | 48 | ![NotAvailable](https://user-images.githubusercontent.com/51466724/113709050-b8b02f80-96ea-11eb-96d3-303a038615fe.png) 49 | 50 | --- 51 | # Rentacarproject 52 | 53 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.3. 54 | 55 | ## Development server 56 | 57 | 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. 58 | 59 | ## Code scaffolding 60 | 61 | 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`. 62 | 63 | ## Build 64 | 65 | 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. 66 | 67 | ## Running unit tests 68 | 69 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 70 | 71 | ## Running end-to-end tests 72 | 73 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 74 | 75 | ## Further help 76 | 77 | 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. 78 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "rentacarproject": { 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/rentacarproject", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "aot": true, 26 | "assets": [ 27 | "src/favicon.ico", 28 | "src/assets" 29 | ], 30 | "styles": [ 31 | "./node_modules/bootstrap/dist/css/bootstrap.min.css", 32 | "./node_modules/ngx-toastr/toastr.css", 33 | "./node_modules/@fortawesome/fontawesome-free/css/all.css", 34 | "src/styles.css" 35 | ], 36 | "scripts": [ 37 | "./node_modules/jquery/dist/jquery.min.js", 38 | "./node_modules/@fortawesome/fontawesome-free/js/all.js", 39 | "./node_modules/bootstrap/dist/js/bootstrap.min.js" 40 | ] 41 | }, 42 | "configurations": { 43 | "production": { 44 | "fileReplacements": [ 45 | { 46 | "replace": "src/environments/environment.ts", 47 | "with": "src/environments/environment.prod.ts" 48 | } 49 | ], 50 | "optimization": true, 51 | "outputHashing": "all", 52 | "sourceMap": false, 53 | "namedChunks": false, 54 | "extractLicenses": true, 55 | "vendorChunk": false, 56 | "buildOptimizer": true, 57 | "budgets": [ 58 | { 59 | "type": "initial", 60 | "maximumWarning": "500kb", 61 | "maximumError": "1mb" 62 | }, 63 | { 64 | "type": "anyComponentStyle", 65 | "maximumWarning": "2kb", 66 | "maximumError": "4kb" 67 | } 68 | ] 69 | } 70 | } 71 | }, 72 | "serve": { 73 | "builder": "@angular-devkit/build-angular:dev-server", 74 | "options": { 75 | "browserTarget": "rentacarproject:build" 76 | }, 77 | "configurations": { 78 | "production": { 79 | "browserTarget": "rentacarproject:build:production" 80 | } 81 | } 82 | }, 83 | "extract-i18n": { 84 | "builder": "@angular-devkit/build-angular:extract-i18n", 85 | "options": { 86 | "browserTarget": "rentacarproject:build" 87 | } 88 | }, 89 | "test": { 90 | "builder": "@angular-devkit/build-angular:karma", 91 | "options": { 92 | "main": "src/test.ts", 93 | "polyfills": "src/polyfills.ts", 94 | "tsConfig": "tsconfig.spec.json", 95 | "karmaConfig": "karma.conf.js", 96 | "assets": [ 97 | "src/favicon.ico", 98 | "src/assets" 99 | ], 100 | "styles": [ 101 | "src/styles.css" 102 | ], 103 | "scripts": [] 104 | } 105 | }, 106 | "lint": { 107 | "builder": "@angular-devkit/build-angular:tslint", 108 | "options": { 109 | "tsConfig": [ 110 | "tsconfig.app.json", 111 | "tsconfig.spec.json", 112 | "e2e/tsconfig.json" 113 | ], 114 | "exclude": [ 115 | "**/node_modules/**" 116 | ] 117 | } 118 | }, 119 | "e2e": { 120 | "builder": "@angular-devkit/build-angular:protractor", 121 | "options": { 122 | "protractorConfig": "e2e/protractor.conf.js", 123 | "devServerTarget": "rentacarproject:serve" 124 | }, 125 | "configurations": { 126 | "production": { 127 | "devServerTarget": "rentacarproject:serve:production" 128 | } 129 | } 130 | } 131 | } 132 | } 133 | }, 134 | "defaultProject": "rentacarproject" 135 | } 136 | -------------------------------------------------------------------------------- /debug.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/debug.log -------------------------------------------------------------------------------- /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('rentacarproject 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/rentacarproject'), 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": "rentacarproject", 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.6", 15 | "@angular/common": "~11.2.4", 16 | "@angular/compiler": "~11.2.4", 17 | "@angular/core": "~11.2.4", 18 | "@angular/forms": "~11.2.4", 19 | "@angular/localize": "~11.2.4", 20 | "@angular/platform-browser": "~11.2.4", 21 | "@angular/platform-browser-dynamic": "~11.2.4", 22 | "@angular/router": "~11.2.4", 23 | "@auth0/angular-jwt": "^5.0.2", 24 | "@fortawesome/fontawesome-free": "^5.15.3", 25 | "@ng-bootstrap/ng-bootstrap": "^9.0.2", 26 | "bootstrap": "^5.0.0-beta2", 27 | "jquery": "^3.6.0", 28 | "ngx-toastr": "^13.2.1", 29 | "rxjs": "~6.6.0", 30 | "tslib": "^2.0.0", 31 | "zone.js": "~0.11.3" 32 | }, 33 | "devDependencies": { 34 | "@angular-devkit/build-angular": "~0.1102.3", 35 | "@angular/cli": "~11.2.3", 36 | "@angular/compiler-cli": "~11.2.4", 37 | "@types/jasmine": "~3.6.0", 38 | "@types/node": "^12.11.1", 39 | "codelyzer": "^6.0.0", 40 | "jasmine-core": "~3.6.0", 41 | "jasmine-spec-reporter": "~5.0.0", 42 | "karma": "~6.1.0", 43 | "karma-chrome-launcher": "~3.1.0", 44 | "karma-coverage": "~2.0.3", 45 | "karma-jasmine": "~4.0.0", 46 | "karma-jasmine-html-reporter": "^1.5.0", 47 | "protractor": "~7.0.0", 48 | "ts-node": "~8.3.0", 49 | "tslint": "~6.1.0", 50 | "typescript": "~4.1.5" 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { BrandAddComponent } from './components/brand-add/brand-add.component'; 4 | import { BrandListComponent } from './components/brand-list/brand-list.component'; 5 | import { BrandUpdateComponent } from './components/brand-update/brand-update.component'; 6 | import { BrandComponent } from './components/brand/brand.component'; 7 | import { CarAddComponent } from './components/car-add/car-add.component'; 8 | import { CarDetailComponent } from './components/car-detail/car-detail.component'; 9 | import { CarListComponent } from './components/car-list/car-list.component'; 10 | import { CarUpdateComponent } from './components/car-update/car-update.component'; 11 | import { CarComponent } from './components/car/car.component'; 12 | import { ColorAddComponent } from './components/color-add/color-add.component'; 13 | import { ColorListComponent } from './components/color-list/color-list.component'; 14 | import { ColorUpdateComponent } from './components/color-update/color-update.component'; 15 | import { ColorComponent } from './components/color/color.component'; 16 | import { CustomerComponent } from './components/customer/customer.component'; 17 | import { HomeComponent } from './components/home/home.component'; 18 | import { LoginComponent } from './components/login/login.component'; 19 | import { PaymentComponent } from './components/payment/payment.component'; 20 | import { ProfileComponent } from './components/profile/profile.component'; 21 | import { RegisterComponent } from './components/register/register.component'; 22 | import { RentalListComponent } from './components/rental-list/rental-list.component'; 23 | import { RentalComponent } from './components/rental/rental.component'; 24 | import { UserCardsComponent } from './components/user-cards/user-cards.component'; 25 | import { LoginGuard } from './guards/login.guard'; 26 | 27 | const routes: Routes = [ 28 | {path:"home",component:HomeComponent}, //ana sayfa 29 | {path:"",pathMatch:"full",component:HomeComponent}, 30 | //CARS 31 | {path:"cars", component:CarComponent}, 32 | {path:"cars/add", component:CarAddComponent, canActivate:[LoginGuard]}, 33 | {path:"cars/update/:carId", component:CarUpdateComponent, canActivate:[LoginGuard]}, 34 | {path:"cars/list", component:CarListComponent}, 35 | {path:"cars/brand/:brandId", component:CarComponent}, 36 | {path:"cars/color/:colorId", component:CarComponent}, 37 | {path:"cars/detail/:carId", component:CarDetailComponent}, 38 | {path:"cars/filter/:brandId/:colorId", component:CarComponent}, 39 | {path:"cars/filter/brand/:brandId/color/:colorId", component:CarComponent}, 40 | {path:"cars/filter/brand/:brandId",component:CarComponent}, 41 | {path:"cars/filter/color/:colorId",component:CarComponent}, 42 | {path:"cars/rental/payment/:rental",component:PaymentComponent}, 43 | //RENTALS 44 | {path:"rentals", component:RentalComponent}, 45 | {path:"rentals/list", component:RentalListComponent}, 46 | {path:"rental/:carId", component:RentalComponent}, 47 | //COLORS 48 | {path:"colors", component:ColorComponent}, 49 | {path:"colors/list", component:ColorListComponent}, 50 | {path:"colors/add", component:ColorAddComponent, canActivate:[LoginGuard]}, 51 | {path:"colors/update", component:ColorUpdateComponent, canActivate:[LoginGuard]}, 52 | //CUSTOMERS 53 | {path:"customers", component:CustomerComponent}, 54 | //BRANDS 55 | {path:"brands", component:BrandComponent}, 56 | {path:"brands/add", component:BrandAddComponent, canActivate:[LoginGuard]}, 57 | {path:"brands/update", component:BrandUpdateComponent, canActivate:[LoginGuard]}, 58 | {path:"brands/list", component:BrandListComponent}, 59 | //USER AUTH 60 | {path:"login",component:LoginComponent}, 61 | {path:"register",component:RegisterComponent}, 62 | {path:"profile",component:ProfileComponent,canActivate:[LoginGuard]}, 63 | {path:"cards",component:UserCardsComponent,canActivate:[LoginGuard]}, 64 | //{path:"admin",component:AdminPanelComponent,canActivate:[LoginGuard]} 65 | 66 | ]; 67 | 68 | @NgModule({ 69 | imports: [RouterModule.forRoot(routes)], 70 | exports: [RouterModule] 71 | }) 72 | export class AppRoutingModule { } 73 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/app.component.css -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 | 6 |
7 |
8 | 9 | 10 | 20 | 21 | 22 | 39 | 40 | -------------------------------------------------------------------------------- /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 'rentacarproject'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('rentacarproject'); 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('rentacarproject 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:string = "Rent A Car | Find The Right Car"; 10 | user:string ="Erkan Akkoç"; 11 | } 12 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; 4 | import { FormsModule, ReactiveFormsModule} from '@angular/forms'; 5 | 6 | import { AppRoutingModule } from './app-routing.module'; 7 | import { AppComponent } from './app.component'; 8 | import { CarComponent } from './components/car/car.component'; 9 | import { ColorComponent } from './components/color/color.component'; 10 | import { NaviComponent } from './components/navi/navi.component'; 11 | import { BrandComponent } from './components/brand/brand.component'; 12 | import { CustomerComponent } from './components/customer/customer.component'; 13 | import { RentalComponent } from './components/rental/rental.component'; 14 | import { CarDetailComponent } from './components/car-detail/car-detail.component'; 15 | import { ColorFilterPipePipe } from './pipes/color-filter-pipe.pipe'; 16 | import { BrandFilterPipePipe } from './pipes/brand-filter-pipe.pipe'; 17 | import { CarFilterPipePipe } from './pipes/car-filter-pipe.pipe'; 18 | import { CustomerFilterPipePipe } from './pipes/customer-filter-pipe.pipe'; 19 | import { CarFilterComponent } from './components/car-filter/car-filter.component'; 20 | 21 | import { ToastrModule } from 'ngx-toastr'; 22 | //import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; 23 | import { PaymentComponent } from './components/payment/payment.component'; 24 | import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; 25 | import { ColorAddComponent } from './components/color-add/color-add.component'; 26 | import { BrandAddComponent } from './components/brand-add/brand-add.component'; 27 | import { CarAddComponent } from './components/car-add/car-add.component'; 28 | import { ColorListComponent } from './components/color-list/color-list.component'; 29 | import { BrandListComponent } from './components/brand-list/brand-list.component'; 30 | import { CarListComponent } from './components/car-list/car-list.component'; 31 | import { CarUpdateComponent } from './components/car-update/car-update.component'; 32 | import { ColorUpdateComponent } from './components/color-update/color-update.component'; 33 | import { BrandUpdateComponent } from './components/brand-update/brand-update.component'; 34 | import { LoginComponent } from './components/login/login.component'; 35 | import { RegisterComponent } from './components/register/register.component'; 36 | import { AuthInterceptor } from './interceptors/auth.interceptor'; 37 | import { RentalListComponent } from './components/rental-list/rental-list.component'; 38 | import { ChangePasswordComponent } from './components/change-password/change-password.component'; 39 | import { ProfileComponent } from './components/profile/profile.component'; 40 | import { UserCardsComponent } from './components/user-cards/user-cards.component'; 41 | import { HomeComponent } from './components/home/home.component'; 42 | import { FooterComponent } from './components/footer/footer.component'; 43 | 44 | 45 | 46 | 47 | @NgModule({ 48 | declarations: [ 49 | AppComponent, 50 | CarComponent, 51 | ColorComponent, 52 | NaviComponent, 53 | BrandComponent, 54 | CustomerComponent, 55 | RentalComponent, 56 | CarDetailComponent, 57 | ColorFilterPipePipe, 58 | BrandFilterPipePipe, 59 | CarFilterPipePipe, 60 | CustomerFilterPipePipe, 61 | CarFilterComponent, 62 | PaymentComponent, 63 | ColorAddComponent, 64 | BrandAddComponent, 65 | CarAddComponent, 66 | ColorListComponent, 67 | BrandListComponent, 68 | CarListComponent, 69 | CarUpdateComponent, 70 | ColorUpdateComponent, 71 | BrandUpdateComponent, 72 | LoginComponent, 73 | RegisterComponent, 74 | RentalListComponent, 75 | ChangePasswordComponent, 76 | ProfileComponent, 77 | UserCardsComponent, 78 | HomeComponent, 79 | FooterComponent 80 | ], 81 | imports: [ 82 | BrowserModule, 83 | AppRoutingModule, 84 | HttpClientModule, 85 | FormsModule, 86 | ReactiveFormsModule, 87 | ToastrModule.forRoot({ 88 | positionClass:"toast-bottom-right" 89 | }), 90 | BrowserAnimationsModule 91 | //NgbModule 92 | ], 93 | providers: [{ 94 | provide: HTTP_INTERCEPTORS, useClass:AuthInterceptor, multi:true}], 95 | bootstrap: [AppComponent] 96 | }) 97 | export class AppModule { } 98 | -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/brand-add/brand-add.component.css -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
Add Brand
6 |
7 |
8 |
9 |
10 | 11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 | 21 |
22 |
23 |
-------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandAddComponent } from './brand-add.component'; 4 | 5 | describe('BrandAddComponent', () => { 6 | let component: BrandAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup, FormBuilder, FormControl, Validators} from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { BrandService } from 'src/app/services/brand.service'; 5 | 6 | @Component({ 7 | selector: 'app-brand-add', 8 | templateUrl: './brand-add.component.html', 9 | styleUrls: ['./brand-add.component.css'] 10 | }) 11 | export class BrandAddComponent implements OnInit { 12 | 13 | brandAddForm: FormGroup; 14 | constructor(private formBuilder:FormBuilder, private brandService:BrandService, private toastrService:ToastrService) { } 15 | 16 | ngOnInit(): void { 17 | this.createBrandAddForm(); 18 | } 19 | 20 | createBrandAddForm(){ 21 | this.brandAddForm = this.formBuilder.group({ 22 | brandName:["",Validators.required] 23 | }) 24 | } 25 | add(){ 26 | if (this.brandAddForm.valid) { 27 | let brandModel = Object.assign({},this.brandAddForm.value) 28 | this.brandService.add(brandModel).subscribe(response=>{ 29 | this.toastrService.success(response.message, "Successfully") 30 | }, responseError=>{ 31 | if(responseError.error.ValidationErrors.length>0) 32 | { 33 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) 34 | { 35 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Validation Error") 36 | } 37 | } 38 | }) 39 | }else{ 40 | this.toastrService.error("Fill the Form Completly","Attention") 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/app/components/brand-list/brand-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/brand-list/brand-list.component.css -------------------------------------------------------------------------------- /src/app/components/brand-list/brand-list.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 28 | 29 | 30 |
Brand IdBrand NameOperations
{{brand.brandId}}{{brand.brandName}} 24 | 25 | 26 |
-------------------------------------------------------------------------------- /src/app/components/brand-list/brand-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandListComponent } from './brand-list.component'; 4 | 5 | describe('BrandListComponent', () => { 6 | let component: BrandListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand-list/brand-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Brand } from 'src/app/models/brand'; 3 | import { BrandService } from 'src/app/services/brand.service'; 4 | 5 | @Component({ 6 | selector: 'app-brand-list', 7 | templateUrl: './brand-list.component.html', 8 | styleUrls: ['./brand-list.component.css'] 9 | }) 10 | export class BrandListComponent implements OnInit { 11 | 12 | brands:Brand[] = []; 13 | currentBrand : Brand; 14 | dataLoaded = false; 15 | filterText =""; 16 | 17 | 18 | constructor(private brandService:BrandService) { } 19 | 20 | ngOnInit(): void { 21 | this.getBrands(); 22 | } 23 | 24 | getBrands(){ 25 | this.brandService.getBrands().subscribe(response=>{ 26 | this.brands=response.data 27 | this.dataLoaded=true; 28 | }) 29 | } 30 | 31 | // setCurrentBrand(brand:Brand){ 32 | // this.currentBrand = brand; 33 | // } 34 | 35 | // getCurrentBrandClass(brand:Brand){ 36 | // if(brand==this.currentBrand){ 37 | // return "list-group-item active" 38 | // } else { 39 | // return "list-group-item" 40 | // } 41 | // } 42 | 43 | // getAllBrandClass(){ 44 | // if(!this.currentBrand){ 45 | // return "list-group-item active" 46 | // }else{ 47 | // return "list-group-item" 48 | // } 49 | // } 50 | 51 | } -------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/brand-update/brand-update.component.css -------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.html: -------------------------------------------------------------------------------- 1 |

brand-update works!

2 | -------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandUpdateComponent } from './brand-update.component'; 4 | 5 | describe('BrandUpdateComponent', () => { 6 | let component: BrandUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-brand-update', 5 | templateUrl: './brand-update.component.html', 6 | styleUrls: ['./brand-update.component.css'] 7 | }) 8 | export class BrandUpdateComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/brand/brand.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 | 6 |
7 | 8 | 9 |
10 | 11 |

    Brands

    12 |
  • All Brands
  • 13 |
  • {{brand.brandName}}
  • 17 |
18 | 19 |
-------------------------------------------------------------------------------- /src/app/components/brand/brand.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandComponent } from './brand.component'; 4 | 5 | describe('BrandComponent', () => { 6 | let component: BrandComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Brand } from 'src/app/models/brand'; 3 | import { BrandService } from 'src/app/services/brand.service'; 4 | 5 | @Component({ 6 | selector: 'app-brand', 7 | templateUrl: './brand.component.html', 8 | styleUrls: ['./brand.component.css'] 9 | }) 10 | export class BrandComponent implements OnInit { 11 | 12 | brands:Brand[] = []; 13 | currentBrand : Brand; 14 | dataLoaded = false; 15 | filterText =""; 16 | 17 | 18 | constructor(private brandService:BrandService) { } 19 | 20 | ngOnInit(): void { 21 | this.getBrands(); 22 | } 23 | 24 | getBrands(){ 25 | this.brandService.getBrands().subscribe(response=>{ 26 | this.brands=response.data 27 | this.dataLoaded=true; 28 | }) 29 | } 30 | 31 | setCurrentBrand(brand:Brand){ 32 | this.currentBrand = brand; 33 | } 34 | 35 | getCurrentBrandClass(brand:Brand){ 36 | if(brand==this.currentBrand){ 37 | return "list-group-item active" 38 | } else { 39 | return "list-group-item" 40 | } 41 | } 42 | 43 | getAllBrandClass(){ 44 | if(!this.currentBrand){ 45 | return "list-group-item active" 46 | }else{ 47 | return "list-group-item" 48 | } 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/car-add/car-add.component.css -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
Add Car
6 |
7 |
8 |
9 |
10 | 11 |
12 | 13 |
14 |
15 |
16 | 17 |
18 | 22 |
23 |
24 |
25 | 26 |
27 | 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 |
56 |
57 | 63 |
64 |
65 |
66 | 67 |
68 |
69 |
70 | 73 |
74 |
75 |
-------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarAddComponent } from './car-add.component'; 4 | 5 | describe('CarAddComponent', () => { 6 | let component: CarAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup, FormBuilder, FormControl, Validators} from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Brand } from 'src/app/models/brand'; 5 | import { Color } from 'src/app/models/color'; 6 | import { BrandService } from 'src/app/services/brand.service'; 7 | import { CarImageService } from 'src/app/services/car-image.service'; 8 | import { CarService } from 'src/app/services/car.service'; 9 | import { ColorService } from 'src/app/services/color.service'; 10 | 11 | @Component({ 12 | selector: 'app-car-add', 13 | templateUrl: './car-add.component.html', 14 | styleUrls: ['./car-add.component.css'] 15 | }) 16 | export class CarAddComponent implements OnInit { 17 | 18 | carAddForm: FormGroup; 19 | brands:Brand[]; 20 | colors:Color[]; 21 | imageAddForm:FormGroup; 22 | imageFiles:File[]; 23 | savedCarId:number; 24 | 25 | 26 | constructor(private formBuilder:FormBuilder, 27 | private carService:CarService, 28 | private brandService:BrandService, 29 | private colorService:ColorService, 30 | private toastrService:ToastrService, 31 | private carImageService:CarImageService) { } 32 | 33 | ngOnInit(): void { 34 | this.getBrands(); 35 | this.getColors(); 36 | this.createCarAddForm(); 37 | this.createCarImageAddForm(); 38 | } 39 | 40 | createCarAddForm(){ 41 | this.carAddForm = this.formBuilder.group({ 42 | carName: ["",Validators.required], 43 | brandId: ["",Validators.required], 44 | colorId: ["",Validators.required], 45 | modelYear: ["",Validators.required], 46 | dailyPrice: ["",Validators.required], 47 | description: ["",Validators.required], 48 | findexPoint:["",Validators.required] 49 | // imagePath: ["",Validators.required] 50 | }) 51 | } 52 | 53 | add(){ 54 | if (this.carAddForm.valid) { 55 | let carModel = Object.assign({},this.carAddForm.value) 56 | this.carService.add(carModel).subscribe(response => { 57 | this.toastrService.success(response.message,"Successfully") 58 | this.savedCarId = response.data.carId; 59 | this.addImage() 60 | this.toastrService.success("Image(s) added.","Successfully") 61 | },responseError => { 62 | if (responseError.error.ValidationErrors.length>0) { 63 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 64 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Doğrulama hatası"); 65 | } 66 | } 67 | }) 68 | }else{ 69 | this.toastrService.error("Formunuz eksik","Hata"); 70 | } 71 | } 72 | getBrands(){ 73 | this.brandService.getBrands().subscribe(response => { 74 | this.brands=response.data; 75 | }) 76 | } 77 | 78 | getColors(){ 79 | this.colorService.getColors().subscribe(response => { 80 | this.colors=response.data; 81 | }) 82 | } 83 | 84 | createCarImageAddForm(){ 85 | this.imageAddForm = this.formBuilder.group({ 86 | carId:[this.savedCarId], 87 | file:["",Validators.required] 88 | }) 89 | } 90 | 91 | uploadFile(event:any){ 92 | this.imageFiles = event.target.files; 93 | } 94 | 95 | addImage(){ 96 | if (this.imageAddForm.valid) { 97 | for (let i = 0; i < this.imageFiles.length; i++) { 98 | this.carImageService.add(this.savedCarId,this.imageFiles[i]).subscribe(response => { 99 | }) 100 | } 101 | } 102 | } 103 | } -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/car-detail/car-detail.component.css -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 30 | 31 |
BrandColorModel YearDaily PriceDescriptionFindexFunction
{{car.brandName}}{{car.colorName}}{{car.modelYear}}{{car.dailyPrice}}{{car.description}}{{car.findexPoint}}You need log-in
32 |
33 |
34 |
35 | 36 |
37 |

CAR DETAILS

38 | 39 | 61 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 82 | 94 | 95 | 96 | 97 | 108 | 109 | -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarDetailComponent } from './car-detail.component'; 4 | 5 | describe('CarDetailComponent', () => { 6 | let component: CarDetailComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarDetailComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarDetailComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { Car } from 'src/app/models/car'; 4 | import { CarImage } from 'src/app/models/carImage'; 5 | import { Rental } from 'src/app/models/rental'; 6 | import { CarDetailService } from 'src/app/services/car-detail.service'; 7 | import { CarImageService } from 'src/app/services/car-image.service'; 8 | import { CarService } from 'src/app/services/car.service'; 9 | import { RentalService } from 'src/app/services/rental.service'; 10 | import { UserService } from 'src/app/services/user.service'; 11 | import { environment } from 'src/environments/environment'; 12 | import { AuthService } from 'src/app/services/auth.service'; 13 | 14 | 15 | @Component({ 16 | selector: 'app-car-detail', 17 | templateUrl: './car-detail.component.html', 18 | styleUrls: ['./car-detail.component.css'] 19 | }) 20 | export class CarDetailComponent implements OnInit { 21 | cars:Car[]=[]; 22 | rentals:Rental[]=[]; 23 | carImages:CarImage[]=[]; 24 | currentImage : CarImage; 25 | carId:number; 26 | dataLoaded = false; 27 | imageBasePath = environment.baseUrl; 28 | carImageDefault= environment.baseUrl+"/default.jpg" 29 | 30 | constructor( 31 | private carService:CarService, 32 | private carDetailService:CarDetailService, 33 | private activatedRoute:ActivatedRoute, 34 | private imageService:CarImageService, 35 | private rentalService:RentalService, 36 | private authService:AuthService, 37 | private userService:UserService 38 | ) { } 39 | 40 | ngOnInit(): void { 41 | this.activatedRoute.params.subscribe(params => { 42 | if(params["carId"]){ 43 | this.getCarDetail(params["carId"]); 44 | this.getImagesByCarId(params["carId"]) 45 | } 46 | //this.getImagesByCarId(); 47 | 48 | }); 49 | } 50 | 51 | getCarDetail(carId:number) { 52 | this.carService.getCarDetail(carId).subscribe((response) => { 53 | this.cars = response.data; 54 | this.dataLoaded = true; 55 | }); 56 | } 57 | getImagesByCarId(carId:number){ 58 | 59 | // this.imageService.getCarImages(this.activatedRoute.snapshot.params["carId"]).subscribe((response)=>{ 60 | // this.carImages=response.data; 61 | // }); 62 | 63 | this.imageService.getCarImages(carId).subscribe(response => { 64 | this.carImages=response.data; 65 | this.dataLoaded=true; 66 | }) 67 | } 68 | 69 | getCurrentImageClass(image:CarImage){ 70 | if(image==this.carImages[0]){ 71 | return "carousel-item active" 72 | } else { 73 | return "carousel-item" 74 | } 75 | } 76 | 77 | getButtonClass(image:CarImage){ 78 | if(image==this.carImages[0]){ 79 | return "active" 80 | } else { 81 | return "" 82 | } 83 | } 84 | 85 | isAuthenticated(){ 86 | return this.authService.isAuthenticated(); 87 | } 88 | 89 | isAdmin(){ 90 | return this.authService.isAdmin(); 91 | } 92 | 93 | } -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/car-filter/car-filter.component.css -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.html: -------------------------------------------------------------------------------- 1 | 19 | 20 | 42 | 43 |
44 |
45 |
    46 |
  • FILTER THE CARS
  • 47 |
48 | 49 | 53 | 54 | 58 |
59 | 66 |
-------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { Brand } from 'src/app/models/brand'; 4 | import { Color } from 'src/app/models/color'; 5 | import { BrandService } from 'src/app/services/brand.service'; 6 | import { CarService } from 'src/app/services/car.service'; 7 | import { ColorService } from 'src/app/services/color.service'; 8 | 9 | @Component({ 10 | selector: 'app-car-filter', 11 | templateUrl: './car-filter.component.html', 12 | styleUrls: ['./car-filter.component.css'] 13 | }) 14 | export class CarFilterComponent implements OnInit { 15 | 16 | constructor( 17 | private brandService:BrandService, 18 | private colorService:ColorService, 19 | private activatedRoute:ActivatedRoute, 20 | private carService:CarService 21 | ) { } 22 | 23 | brands: Brand[] = []; 24 | colors: Color[] = []; 25 | brandFilter: Number; 26 | colorFilter: Number; 27 | 28 | ngOnInit(): void { 29 | this.getBrands(); 30 | this.getColors(); 31 | } 32 | 33 | getBrands() { 34 | this.brandService.getBrands().subscribe((response) => { 35 | this.brands = response.data; 36 | //this.dataLoaded = true; 37 | }); 38 | } 39 | getColors() { 40 | this.colorService.getColors().subscribe((response) => { 41 | this.colors = response.data; 42 | // this.dataLoaded = true; 43 | }); 44 | } 45 | getSelectedBrand(brand: Brand) { 46 | if (brand.brandId == this.brandFilter) 47 | return true; 48 | else 49 | return false; 50 | } 51 | getSelectedColor(color: Color) { 52 | if (color.colorId == this.colorFilter) 53 | return true; 54 | else 55 | return false; 56 | } 57 | 58 | IsCurrentColorNull(){ 59 | if(this.colorFilter){ 60 | return true; 61 | }else{ 62 | return false; 63 | } 64 | } 65 | 66 | IsCurrentBrandNull(){ 67 | if(this.brandFilter){ 68 | return true; 69 | }else{ 70 | return false; 71 | } 72 | } 73 | 74 | GetRouterLink(){ 75 | if(this.colorFilter && this.brandFilter){ 76 | return "/cars/filter/brand/"+this.brandFilter +"/color/" +this.colorFilter; 77 | }else if(this.brandFilter){ 78 | return "/cars/filter/brand/" +this.brandFilter; 79 | }else if(this.colorFilter){ 80 | return "/cars/filter/color/" +this.colorFilter; 81 | }else{ 82 | return "/cars"; 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/app/components/car-list/car-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/car-list/car-list.component.css -------------------------------------------------------------------------------- /src/app/components/car-list/car-list.component.html: -------------------------------------------------------------------------------- 1 |
2 |

CAR LİST

3 |
4 | 5 |
6 | 7 | 8 |
9 | 10 |
11 | Loading... 12 |
13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 55 | 56 | 57 | 58 |
Car IdBrandCar ModelColorModel YearDaily PriceDescriptionOperations
{{car.carId}}{{car.brandName}}{{car.carName}}{{car.colorName}}{{car.modelYear}}{{car.dailyPrice}}{{car.description}} 40 |
    41 |
  • 42 | 43 |
  • 44 |
  • 45 | 46 |
  • 47 |
48 |
    49 |
  • You need log-in
  • 50 |
51 | 52 | 53 | 54 |
59 |
-------------------------------------------------------------------------------- /src/app/components/car-list/car-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarListComponent } from './car-list.component'; 4 | 5 | describe('CarListComponent', () => { 6 | let component: CarListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-list/car-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { Car } from 'src/app/models/car'; 4 | import { CarImage } from 'src/app/models/carImage'; 5 | import { 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 { ToastrService } from 'ngx-toastr'; 9 | import { AuthService } from 'src/app/services/auth.service'; 10 | 11 | @Component({ 12 | selector: 'app-car-list', 13 | templateUrl: './car-list.component.html', 14 | styleUrls: ['./car-list.component.css'] 15 | }) 16 | export class CarListComponent implements OnInit { 17 | 18 | cars:Car[] = []; 19 | carId:number; 20 | 21 | dataLoaded = false; 22 | 23 | 24 | constructor(private carService:CarService, private authService:AuthService, private activatedRoute:ActivatedRoute, private toastr: ToastrService) { } 25 | 26 | ngOnInit(): void { 27 | 28 | this.activatedRoute.params.subscribe(params=>{ 29 | if(params["brandId"] && params["colorId"]){ 30 | this.getCarsBySelect(params["brandId"],params["colorId"]) 31 | } else if(params["brandId"]){ 32 | this.getCarsByBrand(params["brandId"]) 33 | } else if(params["colorId"]){ 34 | this.getCarsByColor(params["colorId"]) 35 | } else{ 36 | this.getCars() 37 | } 38 | 39 | }) 40 | 41 | } 42 | 43 | isAuthenticated(){ 44 | return this.authService.isAuthenticated(); 45 | } 46 | 47 | getCars(){ 48 | this.carService.getCars().subscribe(response=>{ 49 | this.cars=response.data 50 | this.dataLoaded=true; 51 | }) 52 | } 53 | 54 | getCarsByBrand(brandId:number){ 55 | this.carService.getCarsByBrand(brandId).subscribe(response=>{ 56 | this.cars=response.data 57 | this.dataLoaded=true; 58 | }) 59 | } 60 | 61 | getCarsByColor(colorId:number){ 62 | this.carService.getCarsByColor(colorId).subscribe(response=>{ 63 | this.cars=response.data 64 | this.dataLoaded=true; 65 | }) 66 | } 67 | 68 | getCarsBySelect(brandId:number, colorId:number){ 69 | this.carService.getCarsBySelect(brandId,colorId).subscribe(response=>{ 70 | this.cars=response.data 71 | this.dataLoaded=true; 72 | if(this.cars.length == 0){ 73 | this.toastr.info('Arama sonuçunuza ait bir araç bulunmamaktadır.', 'Arama Sonucu'); 74 | } 75 | }) 76 | } 77 | } -------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/car-update/car-update.component.css -------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarUpdateComponent } from './car-update.component'; 4 | 5 | describe('CarUpdateComponent', () => { 6 | let component: CarUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormBuilder,FormControl,FormGroup, Validators} from '@angular/forms'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Brand } from 'src/app/models/brand'; 6 | import { Car } from 'src/app/models/car'; 7 | import { CarImage } from 'src/app/models/carImage'; 8 | import { Color } from 'src/app/models/color'; 9 | import { BrandService } from 'src/app/services/brand.service'; 10 | import { CarImageService } from 'src/app/services/car-image.service'; 11 | import { CarService } from 'src/app/services/car.service'; 12 | import { ColorService } from 'src/app/services/color.service'; 13 | import { environment } from 'src/environments/environment'; 14 | 15 | @Component({ 16 | selector: 'app-car-update', 17 | templateUrl: './car-update.component.html', 18 | styleUrls: ['./car-update.component.css'] 19 | }) 20 | export class CarUpdateComponent implements OnInit { 21 | 22 | // carUpdateForm:FormGroup; 23 | // errorMessages:string[] 24 | // cars:Car[] 25 | // carId:number 26 | // colors:Color[] 27 | // brands:Brand[] 28 | 29 | 30 | carUpdateForm:FormGroup; 31 | imageUpdateForm:FormGroup; 32 | images:CarImage[]; 33 | car:Car 34 | brands:Brand[]; 35 | colors:Color[]; 36 | carId:number; 37 | carImages:CarImage[]; 38 | imageBasePath = environment.baseUrl 39 | carImageDefault= environment.baseUrl+"/default.jpg" 40 | imageFile:File; 41 | currentCarImageId:number; 42 | 43 | 44 | 45 | 46 | constructor(private formBuilder:FormBuilder, 47 | private carService:CarService, 48 | private toastrService:ToastrService, 49 | private colorService:ColorService, 50 | private brandService:BrandService, 51 | private carImageService:CarImageService, 52 | private activatedRoute:ActivatedRoute) { } 53 | 54 | ngOnInit(): void { 55 | this.activatedRoute.params.subscribe(params=>{ 56 | if (params["carId"]) { 57 | this.carId =parseInt(params["carId"]) 58 | this.getBrands(); 59 | this.getColors(); 60 | this.getCarDetail(this.carId) 61 | this.createCarUpdateForm(); 62 | this.createImageUpdateForm(); 63 | this.getCarImagesByCarId(); 64 | } 65 | }) 66 | 67 | } 68 | 69 | 70 | createCarUpdateForm(){ 71 | this.carUpdateForm = this.formBuilder.group({ 72 | carId:this.carId, 73 | brandId:["",Validators.required], 74 | carName:["",Validators.required], 75 | colorId:["",Validators.required], 76 | modelYear:["",Validators.required], 77 | dailyPrice:["",Validators.required], 78 | description:["",Validators.required], 79 | findexPoint:["",Validators.required] 80 | }); 81 | } 82 | 83 | getCarDetail(carId:number){ 84 | this.carService.getCarDetail(carId).subscribe(response => { 85 | this.car = response.data[0]; 86 | this.carUpdateForm.patchValue({ 87 | description:this.car.description, 88 | carName:this.car.carName, 89 | modelYear:this.car.modelYear, 90 | dailyPrice:this.car.dailyPrice, 91 | findexPoint:this.car.findexPoint 92 | }) 93 | }) 94 | } 95 | getColors(){ 96 | this.colorService.getColors().subscribe(response=>{ 97 | this.colors = response.data 98 | }) 99 | } 100 | getBrands(){ 101 | this.brandService.getBrands().subscribe(response=>{ 102 | this.brands = response.data 103 | }) 104 | } 105 | 106 | update(){ 107 | console.log(this.carUpdateForm) 108 | if (this.carUpdateForm.valid) { 109 | let carModel = Object.assign({},this.carUpdateForm.value); 110 | console.log(carModel) 111 | this.carService.update(carModel).subscribe(response=>{ 112 | this.toastrService.success("Car updated","Success") 113 | },responseError=>{ 114 | console.log(responseError) 115 | if (responseError.error.ValidationErrors.length>0) { 116 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 117 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Validation Error"); 118 | } 119 | } 120 | }) 121 | }else{ 122 | this.toastrService.error("Form is invalid","Invalid") 123 | } 124 | } 125 | createImageUpdateForm(){ 126 | this.imageUpdateForm = this.formBuilder.group({ 127 | carId:[this.carId], 128 | file:["",Validators.required] 129 | }) 130 | } 131 | 132 | uploadFile(event:any){ 133 | this.imageFile = event.target.files[0] 134 | } 135 | 136 | getCarImagesByCarId(){ 137 | this.carImageService.getCarImages(this.carId).subscribe(response => { 138 | this.carImages = response.data; 139 | }) 140 | } 141 | 142 | updateImage(){ 143 | if (this.imageUpdateForm.valid) { 144 | this.carImageService.update(this.carId,this.imageFile,this.currentCarImageId).subscribe(response => { 145 | this.toastrService.success(response.message,"Successfully") 146 | }) 147 | } 148 | } 149 | 150 | setCurrentCarImageId(image:CarImage){ 151 | this.currentCarImageId = image.id; 152 | console.log(this.currentCarImageId) 153 | } 154 | 155 | getCurrentImageClass(image:CarImage){ 156 | if (this.currentCarImageId === image.id) { 157 | return "border border-danger"; 158 | } 159 | return ""; 160 | } 161 | } -------------------------------------------------------------------------------- /src/app/components/car/car.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/car/car.component.css -------------------------------------------------------------------------------- /src/app/components/car/car.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | Loading... 5 |
6 | 7 |
8 |
9 |
10 |
11 | 12 | Image 13 | Image 14 | 15 |
16 |
17 |

{{car.brandName}} - {{car.carName}}

18 |
19 | 20 | 21 | 22 | 23 | 24 |
25 |
${{car.dailyPrice}}/day
26 |
27 |
    28 |
  • 29 | Color 30 | {{car.colorName}} 31 |
  • 32 |
  • 33 | Model Year 34 | {{car.modelYear}} 35 |
  • 36 | 37 |
  • 38 | Findex Point 39 | {{car.findexPoint}} 40 |
  • 41 |
  • 42 | Minium age 43 | 18 years 44 |
  • 45 |
46 |
47 | Rent Now 48 |
49 |
50 |
51 |
52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarComponent } from './car.component'; 4 | 5 | describe('CarComponent', () => { 6 | let component: CarComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { Car } from 'src/app/models/car'; 4 | import { CarImage } from 'src/app/models/carImage'; 5 | import { 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 { ToastrService } from 'ngx-toastr'; 9 | 10 | @Component({ 11 | selector: 'app-car', 12 | templateUrl: './car.component.html', 13 | styleUrls: ['./car.component.css'] 14 | }) 15 | export class CarComponent implements OnInit { 16 | 17 | cars:Car[] = []; 18 | 19 | dataLoaded = false; 20 | imageBasePath = environment.baseUrl 21 | carImageDefault= environment.baseUrl+"/default.jpg" 22 | 23 | 24 | constructor(private carService:CarService, 25 | private activatedRoute:ActivatedRoute, 26 | private toastr: ToastrService) { } 27 | 28 | ngOnInit(): void { 29 | this.activatedRoute.params.subscribe(params=>{ 30 | if(params["brandId"] && params["colorId"]){ 31 | this.getCarsBySelect(params["brandId"],params["colorId"]) 32 | } else if(params["brandId"]){ 33 | this.getCarsByBrand(params["brandId"]) 34 | } else if(params["colorId"]){ 35 | this.getCarsByColor(params["colorId"]) 36 | } else{ 37 | this.getCars() 38 | } 39 | 40 | }) 41 | } 42 | 43 | getCars(){ 44 | this.carService.getCars().subscribe(response=>{ 45 | this.cars=response.data 46 | this.dataLoaded=true; 47 | }) 48 | } 49 | 50 | getCarsByBrand(brandId:number){ 51 | this.carService.getCarsByBrand(brandId).subscribe(response=>{ 52 | this.cars=response.data 53 | this.dataLoaded=true; 54 | }) 55 | } 56 | 57 | getCarsByColor(colorId:number){ 58 | this.carService.getCarsByColor(colorId).subscribe(response=>{ 59 | this.cars=response.data 60 | this.dataLoaded=true; 61 | }) 62 | } 63 | 64 | getCarsBySelect(brandId:number, colorId:number){ 65 | this.carService.getCarsBySelect(brandId,colorId).subscribe(response=>{ 66 | this.cars=response.data 67 | this.dataLoaded=true; 68 | if(this.cars.length == 0){ 69 | this.toastr.info('There is no car as you searched.', 'Search Result'); 70 | } 71 | }) 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/app/components/change-password/change-password.component.css: -------------------------------------------------------------------------------- 1 | .mybtn{ 2 | border-radius: 6px; 3 | color: whitesmoke; 4 | height: 100%; 5 | background-color: #046e8f; 6 | border: none; 7 | } 8 | .mybtn:hover{ 9 | border-radius: 6px; 10 | background-color: #0090c1; 11 | } -------------------------------------------------------------------------------- /src/app/components/change-password/change-password.component.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/app/components/change-password/change-password.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ChangePasswordComponent } from './change-password.component'; 4 | 5 | describe('ChangePasswordComponent', () => { 6 | let component: ChangePasswordComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ChangePasswordComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ChangePasswordComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/change-password/change-password.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { AuthService } from 'src/app/services/auth.service'; 5 | 6 | @Component({ 7 | selector: 'app-change-password', 8 | templateUrl: './change-password.component.html', 9 | styleUrls: ['./change-password.component.css'] 10 | }) 11 | export class ChangePasswordComponent implements OnInit { 12 | 13 | passwordUpdateForm:FormGroup; 14 | currentUserId:number; 15 | 16 | constructor( private formBuilder:FormBuilder, 17 | private authService:AuthService, 18 | private toastrService:ToastrService 19 | ) { } 20 | 21 | ngOnInit(): void { 22 | this.createPasswordUpdateForm(); 23 | this.currentUserId = this.authService.getUserId(); 24 | } 25 | 26 | createPasswordUpdateForm(){ 27 | this.passwordUpdateForm = this.formBuilder.group({ 28 | oldPassword:["",Validators.required], 29 | newPassword:["",Validators.required] 30 | }) 31 | } 32 | 33 | changePassword(){ 34 | if (this.passwordUpdateForm.valid){ 35 | let passwordModel = Object.assign({userId:this.currentUserId},this.passwordUpdateForm.value); 36 | this.authService.changePassword(passwordModel).subscribe(response => { 37 | this.toastrService.success(response.message,"Successfully"); 38 | },responseError => { 39 | this.toastrService.error(responseError.error,"Error"); 40 | }) 41 | }else{ 42 | this.toastrService.error("Please Fill The Form Completely","Error") 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/color-add/color-add.component.css -------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
Add Color
6 |
7 |
8 |
9 |
10 | 11 |
12 | 13 |
14 |
15 | 16 |
17 |
18 | 21 |
22 |
23 | 24 |
-------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorAddComponent } from './color-add.component'; 4 | 5 | describe('ColorAddComponent', () => { 6 | let component: ColorAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup, FormBuilder, FormControl, Validators} from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { ColorService } from 'src/app/services/color.service'; 5 | 6 | @Component({ 7 | selector: 'app-color-add', 8 | templateUrl: './color-add.component.html', 9 | styleUrls: ['./color-add.component.css'] 10 | }) 11 | export class ColorAddComponent implements OnInit { 12 | 13 | colorAddForm: FormGroup; 14 | constructor(private formBuilder:FormBuilder, private colorService:ColorService, private toastrService:ToastrService) { } 15 | 16 | ngOnInit(): void { 17 | this.createColorAddForm(); 18 | } 19 | 20 | createColorAddForm(){ 21 | this.colorAddForm = this.formBuilder.group({ 22 | colorName:["",Validators.required] 23 | }) 24 | } 25 | add(){ 26 | if (this.colorAddForm.valid) { 27 | let colorModel = Object.assign({},this.colorAddForm.value) 28 | this.colorService.add(colorModel).subscribe(response=>{ 29 | this.toastrService.success(response.message, "Successfully") 30 | }, responseError=>{ 31 | if(responseError.error.ValidationErrors.length>0) 32 | { 33 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) 34 | { 35 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Validation Error") 36 | } 37 | } 38 | }) 39 | }else{ 40 | this.toastrService.error("Fill the Form Completly","Attention") 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/app/components/color-list/color-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/color-list/color-list.component.css -------------------------------------------------------------------------------- /src/app/components/color-list/color-list.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 28 | 29 | 30 |
Color IdColor NameOperations
{{color.colorId}}{{color.colorName}} 24 | 25 | 26 |
-------------------------------------------------------------------------------- /src/app/components/color-list/color-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorListComponent } from './color-list.component'; 4 | 5 | describe('ColorListComponent', () => { 6 | let component: ColorListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color-list/color-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Color } from 'src/app/models/color'; 3 | import { ColorService } from 'src/app/services/color.service'; 4 | 5 | @Component({ 6 | selector: 'app-color-list', 7 | templateUrl: './color-list.component.html', 8 | styleUrls: ['./color-list.component.css'] 9 | }) 10 | export class ColorListComponent implements OnInit { 11 | 12 | colors:Color[] = []; 13 | currentColor : Color; 14 | dataLoaded = false; 15 | filterText =""; 16 | 17 | 18 | constructor(private colorService:ColorService) { } 19 | 20 | ngOnInit(): void { 21 | this.getColors(); 22 | } 23 | getColors(){ 24 | this.colorService.getColors().subscribe(response=>{ 25 | this.colors=response.data 26 | this.dataLoaded=true; 27 | }) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/color-update/color-update.component.css -------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.html: -------------------------------------------------------------------------------- 1 |

color-update works!

2 | -------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorUpdateComponent } from './color-update.component'; 4 | 5 | describe('ColorUpdateComponent', () => { 6 | let component: ColorUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-color-update', 5 | templateUrl: './color-update.component.html', 6 | styleUrls: ['./color-update.component.css'] 7 | }) 8 | export class ColorUpdateComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/color/color.component.css -------------------------------------------------------------------------------- /src/app/components/color/color.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 | 22 | 23 |
24 | 25 | 26 |
27 | 36 | 37 | 45 | 46 | 47 |
{{filterText}}
48 |

    Colors

    49 |
  • All Colors
  • 50 |
  • {{color.colorName}}
  • 54 |
55 | 56 |
-------------------------------------------------------------------------------- /src/app/components/color/color.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorComponent } from './color.component'; 4 | 5 | describe('ColorComponent', () => { 6 | let component: ColorComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Color } from 'src/app/models/color'; 3 | import { ColorService } from 'src/app/services/color.service'; 4 | 5 | @Component({ 6 | selector: 'app-color', 7 | templateUrl: './color.component.html', 8 | styleUrls: ['./color.component.css'] 9 | }) 10 | export class ColorComponent implements OnInit { 11 | 12 | colors:Color[] = []; 13 | currentColor : Color; 14 | dataLoaded = false; 15 | filterText =""; 16 | 17 | 18 | constructor(private colorService:ColorService) { } 19 | 20 | 21 | 22 | ngOnInit(): void { 23 | this.getColors(); 24 | } 25 | 26 | getColors(){ 27 | this.colorService.getColors().subscribe(response=>{ 28 | this.colors=response.data 29 | this.dataLoaded=true; 30 | }) 31 | } 32 | setCurrentColor(color:Color){ 33 | this.currentColor = color; 34 | } 35 | 36 | getCurrentColorClass(color:Color){ 37 | if(color==this.currentColor){ 38 | return "list-group-item active" 39 | } else { 40 | return "list-group-item" 41 | } 42 | } 43 | 44 | getAllColorClass(){ 45 | if(!this.currentColor){ 46 | return "list-group-item active" 47 | }else{ 48 | return "list-group-item" 49 | } 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/customer/customer.component.css -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
Customer IdFirst NameLast NameCompany Name
{{customer.customerId}}{{customer.firstName}}{{customer.lastName}}{{customer.companyName}}
26 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CustomerComponent } from './customer.component'; 4 | 5 | describe('CustomerComponent', () => { 6 | let component: CustomerComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CustomerComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CustomerComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Customer } from 'src/app/models/customer'; 3 | import { CustomerService } from 'src/app/services/customer.service'; 4 | 5 | @Component({ 6 | selector: 'app-customer', 7 | templateUrl: './customer.component.html', 8 | styleUrls: ['./customer.component.css'] 9 | }) 10 | export class CustomerComponent implements OnInit { 11 | 12 | customers:Customer[] = []; 13 | dataLoaded = false; 14 | 15 | 16 | constructor(private customerService:CustomerService) { } 17 | 18 | ngOnInit(): void { 19 | this.getCustomers(); 20 | } 21 | 22 | getCustomers(){ 23 | this.customerService.getCustomers().subscribe(response=>{ 24 | this.customers=response.data 25 | this.dataLoaded=true; 26 | }) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/app/components/debug.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/debug.log -------------------------------------------------------------------------------- /src/app/components/footer/footer.component.css: -------------------------------------------------------------------------------- 1 | /* Main Footer */ 2 | footer .main-footer{ padding: 20px 0; background: #252525;} 3 | footer ul{ padding-left: 0; list-style: none;} 4 | 5 | /* Copy Right Footer */ 6 | .footer-copyright { background: #222; padding: 5px 0;} 7 | .footer-copyright .logo { display: inherit;} 8 | .footer-copyright nav { float: right; margin-top: 5px;} 9 | .footer-copyright nav ul { list-style: none; margin: 0; padding: 0;} 10 | .footer-copyright nav ul li { border-left: 1px solid #505050; display: inline-block; line-height: 12px; margin: 0; padding: 0 8px;} 11 | .footer-copyright nav ul li a{ color: #969696;} 12 | .footer-copyright nav ul li:first-child { border: medium none; padding-left: 0;} 13 | .footer-copyright p { color: #969696; margin: 2px 0 0;} 14 | 15 | /* Footer Top */ 16 | .footer-top{ background: #252525; padding-bottom: 30px; margin-bottom: 30px; border-bottom: 3px solid #222;} 17 | 18 | /* Footer transparent */ 19 | footer.transparent .footer-top, footer.transparent .main-footer{ background: transparent;} 20 | footer.transparent .footer-copyright{ background: none repeat scroll 0 0 rgba(0, 0, 0, 0.3) ;} 21 | 22 | /* Footer light */ 23 | footer.light .footer-top{ background: #f9f9f9;} 24 | footer.light .main-footer{ background: #f9f9f9;} 25 | footer.light .footer-copyright{ background: none repeat scroll 0 0 rgba(255, 255, 255, 0.3) ;} 26 | 27 | /* Footer 4 */ 28 | .footer- .logo { display: inline-block;} 29 | 30 | /*==================== 31 | Widgets 32 | ====================== */ 33 | .widget{ padding: 20px; margin-bottom: 40px;} 34 | .widget.widget-last{ margin-bottom: 0px;} 35 | .widget.no-box{ padding: 0; background-color: transparent; margin-bottom: 40px; 36 | box-shadow: none; -webkit-box-shadow: none; -moz-box-shadow: none; -ms-box-shadow: none; -o-box-shadow: none;} 37 | .widget.subscribe p{ margin-bottom: 18px;} 38 | .widget li a{ color: #ffffff;} 39 | .widget li a:hover{ color: #4b92dc;} 40 | .widget-title {margin-bottom: 20px;} 41 | .widget-title span {background: #839FAD none repeat scroll 0 0;display: block; height: 1px;margin-top: 25px;position: relative;width: 20%;} 42 | .widget-title span::after {background: inherit;content: "";height: inherit; position: absolute;top: -4px;width: 50%;} 43 | .widget-title.text-center span,.widget-title.text-center span::after {margin-left: auto;margin-right:auto;left: 0;right: 0;} 44 | .widget .badge{ float: right; background: #7f7f7f;} 45 | 46 | .typo-light h1, 47 | .typo-light h2, 48 | .typo-light h3, 49 | .typo-light h4, 50 | .typo-light h5, 51 | .typo-light h6, 52 | .typo-light p, 53 | .typo-light div, 54 | .typo-light span, 55 | .typo-light small{ color: #fff;} 56 | 57 | ul.social-footer2 { margin: 0;padding: 0; width: auto;} 58 | ul.social-footer2 li {display: inline-block;padding: 0;} 59 | ul.social-footer2 li a:hover {background-color:#ff8d1e;} 60 | ul.social-footer2 li a {display: block; height:30px;width: 30px;text-align: center;} 61 | .btn{background-color: #ff8d1e; color:#fff;} 62 | .btn:hover, .btn:focus, .btn.active {background: #4b92dc;color: #fff; 63 | -webkit-box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1); 64 | -moz-box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1); 65 | -ms-box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1); 66 | -o-box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1); 67 | box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1); 68 | -webkit-transition: all 250ms ease-in-out 0s; 69 | -moz-transition: all 250ms ease-in-out 0s; 70 | -ms-transition: all 250ms ease-in-out 0s; 71 | -o-transition: all 250ms ease-in-out 0s; 72 | transition: all 250ms ease-in-out 0s; 73 | 74 | } -------------------------------------------------------------------------------- /src/app/components/footer/footer.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { FooterComponent } from './footer.component'; 4 | 5 | describe('FooterComponent', () => { 6 | let component: FooterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ FooterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(FooterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/footer/footer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-footer', 5 | templateUrl: './footer.component.html', 6 | styleUrls: ['./footer.component.css'] 7 | }) 8 | export class FooterComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/components/home/home.component.css: -------------------------------------------------------------------------------- 1 | 2 | /*--------------------------------------------------------------------*/ 3 | 4 | .how-it-works .step { 5 | width: 20%; 6 | display: inline-block; 7 | text-align: center; 8 | position: relative; } 9 | .how-it-works .step:after { 10 | width: 100%; 11 | height: 4px; 12 | content: ""; 13 | position: absolute; 14 | z-index: -1; 15 | top: 25px; 16 | background: #007bff; } 17 | .how-it-works .step:last-child:after { 18 | display: none; } 19 | .how-it-works .step .number { 20 | z-index: 1; 21 | width: 50px; 22 | height: 50px; 23 | border: 4px solid #007bff; 24 | background: #fff; 25 | border-radius: 50%; 26 | color: #007bff; 27 | display: block; 28 | position: relative; 29 | margin: 0 auto 10px auto; } 30 | .how-it-works .step .number > span { 31 | position: absolute; 32 | top: 50%; 33 | left: 50%; 34 | -webkit-transform: translate(-50%, -50%); 35 | -ms-transform: translate(-50%, -50%); 36 | transform: translate(-50%, -50%); 37 | font-size: 1.3rem; 38 | color: #007bff; } 39 | .how-it-works .step .caption { 40 | display: block; } 41 | 42 | 43 | 44 | .block-counter-1 { 45 | text-align: center; } 46 | .block-counter-1 .number, 47 | .block-counter-1 .caption { 48 | display: block; 49 | line-height: 1; } 50 | .block-counter-1 .number { 51 | color: #007bff; 52 | font-size: 4rem; 53 | position: relative; 54 | padding-bottom: 20px; 55 | margin-bottom: 20px; } 56 | @media (max-width: 991.98px) { 57 | .block-counter-1 .number { 58 | font-size: 2rem; } } 59 | .block-counter-1 .number:after { 60 | position: absolute; 61 | content: ""; 62 | width: 50px; 63 | height: 3px; 64 | left: 50%; 65 | bottom: 0; 66 | -webkit-transform: translateX(-50%); 67 | -ms-transform: translateX(-50%); 68 | transform: translateX(-50%); 69 | background: rgba(52, 58, 64, 0.3); } 70 | .block-counter-1 .caption { 71 | font-size: 14px; 72 | letter-spacing: .05em; } 73 | 74 | 75 | 76 | /*-------------------------------------------------------------- 77 | # Featured Services 78 | --------------------------------------------------------------*/ 79 | .featured-services .icon-box { 80 | padding: 30px; 81 | position: relative; 82 | overflow: hidden; 83 | background: #fff; 84 | box-shadow: 0 0 29px 0 rgba(68, 88, 144, 0.12); 85 | transition: all 0.3s ease-in-out; 86 | border-radius: 8px; 87 | z-index: 1; 88 | } 89 | 90 | .featured-services .icon-box::before { 91 | content: ''; 92 | position: absolute; 93 | background: #cbe0fb; 94 | right: 0; 95 | left: 0; 96 | bottom: 0; 97 | top: 100%; 98 | transition: all 0.3s; 99 | z-index: -1; 100 | } 101 | 102 | .featured-services .icon-box:hover::before { 103 | background: #106eea; 104 | top: 0; 105 | border-radius: 0px; 106 | } 107 | 108 | .featured-services .icon { 109 | margin-bottom: 15px; 110 | } 111 | 112 | .featured-services .icon i { 113 | font-size: 48px; 114 | line-height: 1; 115 | color: #106eea; 116 | transition: all 0.3s ease-in-out; 117 | } 118 | 119 | .featured-services .title { 120 | font-weight: 700; 121 | margin-bottom: 15px; 122 | font-size: 18px; 123 | } 124 | 125 | .featured-services .title a { 126 | color: #111; 127 | } 128 | 129 | .featured-services .description { 130 | font-size: 15px; 131 | line-height: 28px; 132 | margin-bottom: 0; 133 | } 134 | 135 | .featured-services .icon-box:hover .title a, .featured-services .icon-box:hover .description { 136 | color: #fff; 137 | } 138 | 139 | .featured-services .icon-box:hover .icon i { 140 | color: #fff; 141 | } 142 | -------------------------------------------------------------------------------- /src/app/components/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HomeComponent } from './home.component'; 4 | 5 | describe('HomeComponent', () => { 6 | let component: HomeComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ HomeComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(HomeComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | 4 | @Component({ 5 | selector: 'app-home', 6 | templateUrl: './home.component.html', 7 | styleUrls: ['./home.component.css'] 8 | }) 9 | export class HomeComponent implements OnInit { 10 | 11 | constructor() { } 12 | 13 | ngOnInit(): void { 14 | } 15 | 16 | 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /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 | 40 | .bd-placeholder-img { 41 | font-size: 1.125rem; 42 | text-anchor: middle; 43 | -webkit-user-select: none; 44 | -moz-user-select: none; 45 | user-select: none; 46 | } 47 | 48 | @media (min-width: 768px) { 49 | .bd-placeholder-img-lg { 50 | font-size: 3.5rem; 51 | } 52 | } -------------------------------------------------------------------------------- /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 |

© 2017–2021

23 |
24 |
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginComponent } from './login.component'; 4 | 5 | describe('LoginComponent', () => { 6 | let component: LoginComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ LoginComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoginComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormControl, Validators, FormBuilder } from "@angular/forms"; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { AuthService } from 'src/app/services/auth.service'; 6 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 7 | 8 | @Component({ 9 | selector: 'app-login', 10 | templateUrl: './login.component.html', 11 | styleUrls: ['./login.component.css'] 12 | }) 13 | export class LoginComponent implements OnInit { 14 | 15 | loginForm:FormGroup; 16 | constructor(private formBuilder:FormBuilder, 17 | private authService:AuthService, 18 | private localStorageService:LocalStorageService, 19 | private toastrService:ToastrService, 20 | private router:Router 21 | ) { } 22 | 23 | ngOnInit(): void { 24 | this.createLoginForm(); 25 | } 26 | 27 | createLoginForm(){ 28 | this.loginForm =this.formBuilder.group({ 29 | email: ["", Validators.required], 30 | password: ["", Validators.required] 31 | }) 32 | } 33 | 34 | login(){ 35 | if (this.loginForm.valid) { 36 | let loginModel = Object.assign({}, this.loginForm.value) 37 | 38 | this.authService.login(loginModel).subscribe(response=>{ 39 | this.toastrService.info(response.message) 40 | this.localStorageService.set("token",response.data.token); 41 | this.toastrService.success(response.message,"Successfully"); 42 | this.router.navigate([""]) 43 | setTimeout(function () { 44 | location.reload(); 45 | }); 46 | 47 | }, responseError=>{ 48 | if (responseError.error.length>0 && responseError.error) { 49 | this.toastrService.error(responseError.error,"Error") 50 | } 51 | }) 52 | }else{ 53 | this.toastrService.error("Please Fill The Form","Error") 54 | } 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/navi/navi.component.css -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.html: -------------------------------------------------------------------------------- 1 | 79 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { NaviComponent } from './navi.component'; 4 | 5 | describe('NaviComponent', () => { 6 | let component: NaviComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ NaviComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(NaviComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { User } from 'src/app/models/user'; 5 | import { AuthService } from 'src/app/services/auth.service'; 6 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 7 | import { UserService } from 'src/app/services/user.service'; 8 | import { environment } from 'src/environments/environment'; 9 | 10 | @Component({ 11 | selector: 'app-navi', 12 | templateUrl: './navi.component.html', 13 | styleUrls: ['./navi.component.css'] 14 | }) 15 | export class NaviComponent implements OnInit { 16 | 17 | 18 | 19 | homePage = environment.baseUrl 20 | currentUserId:number; 21 | user:User; 22 | 23 | constructor(private authService:AuthService, 24 | private userService:UserService, 25 | private localStorageService:LocalStorageService, 26 | private router:Router) { } 27 | 28 | ngOnInit(): void { 29 | this.currentUserId = this.authService.getUserId(); 30 | this.getUserDetail(); 31 | 32 | } 33 | 34 | isAuthenticated(){ 35 | return this.authService.isAuthenticated(); 36 | } 37 | logOut(){ 38 | this.localStorageService.clean(); 39 | this.router.navigate([""]) 40 | } 41 | getUserDetail(){ 42 | this.userService.getByUserId(this.currentUserId).subscribe(response => { 43 | this.user = response.data; 44 | }); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/payment/payment.component.css -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | Ödeme İşlemleri 5 | 6 |
7 | 8 | 11 | 12 |
13 | 14 |
15 |

My Cards

16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
Card IdCard NumberFirst NameLast NameExpiration DateCVV
{{card.cardId}}{{card.cardNumber}}{{card.firstName}}{{card.lastName}}{{card.expirationDate}}{{card.cvv}}
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | 46 |
47 |
48 | 49 |
50 |
51 |
52 |
53 | 54 |
55 |
56 | 57 |
58 |
59 |
60 |
61 | 62 |
63 |
64 | 65 |
66 |
67 |
68 |
69 |
70 | 71 | 72 |
73 |
74 |
75 |
76 | 77 | 78 |
79 |
80 |
81 |
82 |
83 |
84 | 85 | 86 |
87 |
88 |
89 | 90 |
91 |
92 |
-------------------------------------------------------------------------------- /src/app/components/payment/payment.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PaymentComponent } from './payment.component'; 4 | 5 | describe('PaymentComponent', () => { 6 | let component: PaymentComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ PaymentComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PaymentComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormBuilder, FormControl, Validators } from '@angular/forms'; 3 | import { ActivatedRoute, Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Card } from 'src/app/models/card'; 6 | import { Payment } from 'src/app/models/payment'; 7 | import { Rental } from 'src/app/models/rental'; 8 | import { AuthService } from 'src/app/services/auth.service'; 9 | import { CardService } from 'src/app/services/card.service'; 10 | import { PaymentService } from 'src/app/services/payment.service'; 11 | import { RentalService } from 'src/app/services/rental.service'; 12 | import { UserService } from 'src/app/services/user.service'; 13 | 14 | @Component({ 15 | selector: 'app-payment', 16 | templateUrl: './payment.component.html', 17 | styleUrls: ['./payment.component.css'] 18 | }) 19 | export class PaymentComponent implements OnInit { 20 | rentalAddForm:FormGroup 21 | cards:Card[]; 22 | rental:Rental; 23 | isChecked =false; 24 | 25 | constructor( 26 | private rentalService:RentalService, 27 | private paymentService:PaymentService, 28 | private activatedRoute:ActivatedRoute, 29 | private router:Router, 30 | private authService:AuthService, 31 | private toastrService:ToastrService, 32 | private formBuilder:FormBuilder, 33 | private cardService:CardService, 34 | private userService:UserService 35 | ) { } 36 | 37 | ngOnInit(): void { 38 | this.getCardsByUserId() 39 | this.activatedRoute.params.subscribe(params =>{ 40 | if (params["rental"]) { 41 | this.rental = JSON.parse(params["rental"]); 42 | this.createRentalAddForm(); 43 | } 44 | }) 45 | } 46 | 47 | createRentalAddForm(){ 48 | this.rentalAddForm = this.formBuilder.group({ 49 | cardNumber:["",Validators.required], 50 | expirationDate:["",Validators.required], 51 | cVV:["",Validators.required], 52 | firstName:["",Validators.required], 53 | lastName:["",Validators.required] 54 | }) 55 | } 56 | 57 | CardSave(){ 58 | if (this.isChecked == true) { 59 | let cardModel = Object.assign({userId:this.authService.getUserId()},this.rentalAddForm.value) 60 | this.cardService.saveCard(cardModel).subscribe(response => { 61 | this.toastrService.success(response.message,"Başarılı") 62 | }); 63 | } 64 | } 65 | 66 | addRental(){ 67 | if (this.rentalAddForm.valid) { 68 | let addRentalModel = Object.assign({},this.rentalAddForm.value) 69 | this.rentalService.addRental(this.rental).subscribe(response => { 70 | this.toastrService.success(response.message,"Successfully") 71 | this.CardSave(); 72 | this.router.navigate(["cars/"]) 73 | },responseError => { 74 | this.toastrService.error(responseError.error,"Error") 75 | }); 76 | }else{ 77 | this.toastrService.error("Please Fill The Form Completely.","Error") 78 | } 79 | } 80 | 81 | checkPayment(){ 82 | let checkPaymentModel = Object.assign({},this.rentalAddForm.value) 83 | this.paymentService.checkPayment(checkPaymentModel).subscribe(response => { 84 | this.toastrService.success(response.message,"Successfully") 85 | this.addRental(); 86 | this.updateUserFindex(); 87 | },responseError => { 88 | this.toastrService.error(responseError.error,"Error"); 89 | }) 90 | } 91 | 92 | updateUserFindex(){ 93 | this.userService.updateUserFindex(this.authService.getUserId()).subscribe(response => { 94 | this.toastrService.info(response.message,"Information") 95 | }) 96 | } 97 | 98 | getCardsByUserId(){ 99 | this.cardService.getCardsByUserId(this.authService.getUserId()).subscribe(response => { 100 | this.cards = response.data; 101 | }) 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/app/components/profile/profile.component.css: -------------------------------------------------------------------------------- 1 | .card-header{ 2 | background-color: #045f7a; 3 | color: whitesmoke; 4 | text-align: center; 5 | } 6 | 7 | .mybtn{ 8 | border-radius: 6px; 9 | color: whitesmoke; 10 | height: 100%; 11 | background-color: #046e8f; 12 | border: none; 13 | } 14 | .mybtn:hover{ 15 | border-radius: 6px; 16 | background-color: #0090c1; 17 | } 18 | 19 | input{ 20 | border-left-color: #0090c1; 21 | border-left-width: 7px; 22 | border-top: none; 23 | border-right: none; 24 | border-bottom: none; 25 | } -------------------------------------------------------------------------------- /src/app/components/profile/profile.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
User Profile
5 |
6 |
7 |
8 | 9 | 10 |
11 |
12 | 13 | 14 |
15 |
16 | 17 | 18 |
19 |
20 |
21 |
22 | 23 |
24 | 27 |
28 |
29 |
30 |
31 |
Customer Profile
32 |
33 |
34 |
35 | 36 | 37 |
38 |
39 | 42 |
43 | 46 |
47 |
48 |
49 |
50 | Findex Point 51 |
52 |
53 | 54 |
55 |
56 |
57 |
58 |
-------------------------------------------------------------------------------- /src/app/components/profile/profile.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ProfileComponent } from './profile.component'; 4 | 5 | describe('ProfileComponent', () => { 6 | let component: ProfileComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ProfileComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ProfileComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/profile/profile.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { AuthService } from 'src/app/services/auth.service'; 3 | import { FormGroup, FormBuilder, FormControl, Validators } from "@angular/forms" 4 | import { UserService } from 'src/app/services/user.service'; 5 | import { ToastrService } from 'ngx-toastr'; 6 | import { User } from 'src/app/models/user'; 7 | import { CustomerService } from 'src/app/services/customer.service'; 8 | import { Customer } from 'src/app/models/customer'; 9 | 10 | @Component({ 11 | selector: 'app-profile', 12 | templateUrl: './profile.component.html', 13 | styleUrls: ['./profile.component.css'] 14 | }) 15 | export class ProfileComponent implements OnInit { 16 | userUpdateForm:FormGroup; 17 | customerUpdateForm:FormGroup; 18 | user:User; 19 | customer:Customer; 20 | findex:number; 21 | 22 | constructor( 23 | private authService:AuthService, 24 | private formBuilder:FormBuilder, 25 | private userService:UserService, 26 | private toastrService:ToastrService, 27 | private customerService:CustomerService 28 | ) { } 29 | 30 | ngOnInit(): void { 31 | this.createUserUpdateForm(); 32 | this.createCustomerUpdateForm(); 33 | this.getUser(); 34 | this.getCustomer(); 35 | this.getUserFindex(); 36 | } 37 | 38 | createUserUpdateForm(){ 39 | this.userUpdateForm = this.formBuilder.group({ 40 | firstName:["",Validators.required], 41 | lastName:["",Validators.required], 42 | email:["",Validators.required] 43 | }) 44 | } 45 | 46 | createCustomerUpdateForm(){ 47 | this.customerUpdateForm = this.formBuilder.group({ 48 | companyName:["",Validators.required] 49 | }) 50 | } 51 | 52 | userUpdate(){ 53 | if (this.userUpdateForm.valid) { 54 | let user = Object.assign({id:this.user.userId}, this.userUpdateForm.value) 55 | this.userService.update(user).subscribe(response => { 56 | this.toastrService.success(response.message,"Successfully"); 57 | },responseError => { 58 | this.toastrService.error(responseError.error,"Error") 59 | }) 60 | }else{ 61 | this.toastrService.error("Please fill the form completely","Error") 62 | } 63 | } 64 | 65 | getUser(){ 66 | this.userService.getByUserId(this.authService.getUserId()).subscribe(response => { 67 | this.user = response.data; 68 | this.userUpdateForm.patchValue(response.data) 69 | }) 70 | } 71 | 72 | getCustomer(){ 73 | this.customerService.getCustomerByUserId(this.authService.getUserId()).subscribe(response => { 74 | this.customer = response.data; 75 | this.customerUpdateForm.patchValue(response.data) 76 | }) 77 | } 78 | 79 | customerUpdate(){ 80 | if (this.customerUpdateForm.valid) { 81 | let customerModel = Object.assign({id:this.customer.customerId,userId:this.customer.userId},this.customerUpdateForm.value) 82 | this.customerService.update(customerModel).subscribe(response => { 83 | this.toastrService.success(response.message,"Successfully"); 84 | },responseError => { 85 | this.toastrService.error(responseError.error,"Error") 86 | }) 87 | }else{ 88 | this.toastrService.error("Please fill the form completely","Error") 89 | } 90 | } 91 | 92 | getUserFindex(){ 93 | this.userService.getUserFindexByUserId(this.authService.getUserId()).subscribe(response => { 94 | this.findex = response.data.findexPoint; 95 | console.log(response.data.findexPoint) 96 | }) 97 | } 98 | 99 | } -------------------------------------------------------------------------------- /src/app/components/register/register.component.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | } 5 | 6 | body { 7 | display: flex; 8 | align-items: center; 9 | padding-top: 40px; 10 | padding-bottom: 40px; 11 | } 12 | 13 | .form-signin { 14 | width: 100%; 15 | max-width: 330px; 16 | padding: 15px; 17 | margin: auto; 18 | } 19 | 20 | .form-signin .checkbox { 21 | font-weight: 400; 22 | } 23 | 24 | .form-signin .form-floating:focus-within { 25 | z-index: 2; 26 | } 27 | 28 | .form-signin input[type="email"] { 29 | margin-bottom: -1px; 30 | border-bottom-right-radius: 0; 31 | border-bottom-left-radius: 0; 32 | } 33 | 34 | .form-signin input[type="password"] { 35 | margin-bottom: 10px; 36 | border-top-left-radius: 0; 37 | border-top-right-radius: 0; 38 | } 39 | 40 | .bd-placeholder-img { 41 | font-size: 1.125rem; 42 | text-anchor: middle; 43 | -webkit-user-select: none; 44 | -moz-user-select: none; 45 | user-select: none; 46 | } 47 | 48 | @media (min-width: 768px) { 49 | .bd-placeholder-img-lg { 50 | font-size: 3.5rem; 51 | } 52 | } -------------------------------------------------------------------------------- /src/app/components/register/register.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |
5 |

Please Fill The Form

6 | 7 |
8 | 9 | 10 |
11 |
12 | 13 | 14 |
15 |
16 | 17 | 18 |
19 |
20 | 21 | 22 |
23 | 24 |
25 | 28 |
29 | 30 |

© 2017–2021

31 |
32 |
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RegisterComponent } from './register.component'; 4 | 5 | describe('RegisterComponent', () => { 6 | let component: RegisterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ RegisterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RegisterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormControl, Validators, FormBuilder } from "@angular/forms"; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { AuthService } from 'src/app/services/auth.service'; 6 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 7 | 8 | @Component({ 9 | selector: 'app-register', 10 | templateUrl: './register.component.html', 11 | styleUrls: ['./register.component.css'] 12 | }) 13 | export class RegisterComponent implements OnInit { 14 | 15 | registerForm:FormGroup; 16 | constructor(private formBuilder:FormBuilder, 17 | private authService:AuthService, 18 | private localStorageService:LocalStorageService, 19 | private toastrService:ToastrService, 20 | private router:Router 21 | ) { } 22 | 23 | ngOnInit(): void { 24 | this.createRegisterForm(); 25 | } 26 | createRegisterForm(){ 27 | this.registerForm =this.formBuilder.group({ 28 | firstName: ["", Validators.required], 29 | lastName: ["", Validators.required], 30 | email: ["", Validators.required], 31 | password: ["", Validators.required] 32 | }) 33 | } 34 | 35 | register(){ 36 | if (this.registerForm.valid) { 37 | let registerModel = Object.assign({}, this.registerForm.value) 38 | this.authService.register(registerModel).subscribe(response=>{ 39 | this.toastrService.info(response.message) 40 | this.localStorageService.set("token",response.data.token); 41 | this.toastrService.success(response.message,"Successfully"); 42 | this.router.navigate([""]) 43 | setTimeout(function () { 44 | location.reload(); 45 | }); 46 | 47 | }, responseError=>{ 48 | if (responseError.error.length>0 && responseError.error) { 49 | this.toastrService.error(responseError.error,"Error") 50 | } 51 | }) 52 | }else{ 53 | this.toastrService.error("Please Fill The Form","Error") 54 | } 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/app/components/rental-list/rental-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkanakkoc/ReCapProject-Frontend/4b60229426fa70112ce2a7f15458a7ac67145264/src/app/components/rental-list/rental-list.component.css -------------------------------------------------------------------------------- /src/app/components/rental-list/rental-list.component.html: -------------------------------------------------------------------------------- 1 |
2 |

RENTAL LİST

3 |
4 | 5 |
6 | Loading... 7 |
8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 45 | 46 | 47 | 48 |
Rental IdFirst NameLast NameCompanyRent DateReturn Date
{{rental.rentalId}}{{rental.firstName}}{{rental.lastName}}{{rental.companyName}}{{rental.rentDate}}{{rental.returnDate}} 33 |
    34 |
  • 35 | 36 |
  • 37 |
  • 38 | 39 |
  • 40 |
41 | 42 | 43 | 44 |
49 |
-------------------------------------------------------------------------------- /src/app/components/rental-list/rental-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RentalListComponent } from './rental-list.component'; 4 | 5 | describe('RentalListComponent', () => { 6 | let component: RentalListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ RentalListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RentalListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/rental-list/rental-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { Rental } from 'src/app/models/rental'; 4 | import { RentalService } from 'src/app/services/rental.service'; 5 | 6 | @Component({ 7 | selector: 'app-rental-list', 8 | templateUrl: './rental-list.component.html', 9 | styleUrls: ['./rental-list.component.css'] 10 | }) 11 | export class RentalListComponent implements OnInit { 12 | rentals:Rental[] = []; 13 | rentalId:number; 14 | 15 | dataLoaded = false; 16 | 17 | constructor(private rentalService:RentalService, private activatedRoute:ActivatedRoute) { } 18 | 19 | ngOnInit(): void { 20 | 21 | this.activatedRoute.params.subscribe(params=>{ 22 | this.getRentals() 23 | 24 | 25 | }) 26 | 27 | } 28 | getRentals(){ 29 | this.rentalService.getRentals().subscribe(response=>{ 30 | this.rentals=response.data 31 | this.dataLoaded=true; 32 | }) 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.css: -------------------------------------------------------------------------------- 1 | caption{ 2 | background-color: #0D4BFD; 3 | color: white; 4 | display: block; 5 | text-align: center; 6 | border-top-left-radius: 4px; 7 | border-top-right-radius: 4px; 8 | } 9 | button{ 10 | display: inline-block; 11 | } 12 | 13 | .customers{ 14 | margin-bottom: 20px; 15 | } 16 | 17 | .mybutton{ 18 | display: inline-block; 19 | padding: 10px auto; 20 | } 21 | 22 | .mybtn{ 23 | border-radius: 6px; 24 | color: whitesmoke; 25 | height: 100%; 26 | background-color: #046e8f; 27 | border: none; 28 | } 29 | .mybtn:hover{ 30 | border-radius: 6px; 31 | background-color: #0090c1; 32 | } -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 | This car isn't available 6 |
7 |
8 |
9 | Your Findex point isn't enough to rent this car. 10 |
11 |