├── .browserslistrc ├── .editorconfig ├── .gitignore ├── .vscode └── launch.json ├── README.md ├── angular.json ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── readmeImages ├── 1.PNG ├── 2.PNG ├── 3.PNG ├── 4.PNG ├── 5.PNG ├── 6.png ├── 7.PNG ├── 8.PNG └── 9.PNG ├── 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-details │ │ │ ├── brand-details.component.css │ │ │ ├── brand-details.component.html │ │ │ ├── brand-details.component.spec.ts │ │ │ └── brand-details.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.spec.ts │ │ │ └── car-filter.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-details │ │ │ ├── color-details.component.css │ │ │ ├── color-details.component.html │ │ │ ├── color-details.component.spec.ts │ │ │ └── color-details.component.ts │ │ ├── color │ │ │ ├── color.component.css │ │ │ ├── color.component.html │ │ │ ├── color.component.spec.ts │ │ │ └── color.component.ts │ │ ├── customer-rental │ │ │ ├── customer-rental.component.css │ │ │ ├── customer-rental.component.html │ │ │ ├── customer-rental.component.spec.ts │ │ │ └── customer-rental.component.ts │ │ ├── customer │ │ │ ├── customer.component.css │ │ │ ├── customer.component.html │ │ │ ├── customer.component.spec.ts │ │ │ └── customer.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 │ │ ├── register │ │ │ ├── register.component.css │ │ │ ├── register.component.html │ │ │ ├── register.component.spec.ts │ │ │ └── register.component.ts │ │ ├── rental-detail │ │ │ ├── rental-detail.component.css │ │ │ ├── rental-detail.component.html │ │ │ ├── rental-detail.component.spec.ts │ │ │ └── rental-detail.component.ts │ │ ├── rental │ │ │ ├── rental.component.css │ │ │ ├── rental.component.html │ │ │ └── rental.component.ts │ │ ├── reset-password │ │ │ ├── reset-password.component.css │ │ │ ├── reset-password.component.html │ │ │ ├── reset-password.component.spec.ts │ │ │ └── reset-password.component.ts │ │ ├── update-password │ │ │ ├── update-password.component.css │ │ │ ├── update-password.component.html │ │ │ ├── update-password.component.spec.ts │ │ │ └── update-password.component.ts │ │ └── user-profile │ │ │ ├── user-profile.component.css │ │ │ ├── user-profile.component.html │ │ │ ├── user-profile.component.spec.ts │ │ │ └── user-profile.component.ts │ ├── directives │ │ └── text-style.directive.ts │ ├── guards │ │ └── login.guard.ts │ ├── interceptor │ │ └── auth.interceptor.ts │ ├── models │ │ ├── brand │ │ │ └── brand.ts │ │ ├── car │ │ │ └── car.ts │ │ ├── carDetail │ │ │ └── carDetail.ts │ │ ├── carImage │ │ │ └── carImage.ts │ │ ├── card.ts │ │ ├── color │ │ │ └── color.ts │ │ ├── confirm-password-reset-dto.ts │ │ ├── customer │ │ │ └── customer.ts │ │ ├── customerDetails │ │ │ └── customerDetails.ts │ │ ├── email.ts │ │ ├── listResponseModel.ts │ │ ├── loginModel.ts │ │ ├── password-reset-dto.ts │ │ ├── passwordChange.ts │ │ ├── registerModel.ts │ │ ├── rental │ │ │ └── rental.ts │ │ ├── rentalDetail │ │ │ └── rentalDetail.ts │ │ ├── responseModel.ts │ │ ├── singleResponseModel.ts │ │ ├── tokenModel.ts │ │ └── user.ts │ ├── pipes │ │ ├── brand-pipe.pipe.ts │ │ ├── color-pipe.pipe.ts │ │ ├── filter-text.pipe.ts │ │ └── vat-added.pipe.ts │ └── services │ │ ├── auth.service.ts │ │ ├── brand.service.ts │ │ ├── car-image.service.ts │ │ ├── car.service.ts │ │ ├── card.service.ts │ │ ├── color.service.ts │ │ ├── customer.service.ts │ │ ├── local-stroage.service.ts │ │ ├── rental-detail.service.ts │ │ ├── rental.service.ts │ │ └── user.service.ts ├── assets │ ├── .gitkeep │ └── defaultImage.jpg ├── custom-theme.scss ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "pwa-node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}\\src\\app\\components\\car\\car.component.html", 15 | "outFiles": [ 16 | "${workspaceFolder}/**/*.js" 17 | ] 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CarRentalFrontEnd 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.3. 4 | 5 | ## Development server 6 | 7 | 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. 8 | 9 | ## Images 10 | 11 | ![alt text](https://github.com/FatihBaycu/RentACarProjectAngularAPI/blob/master/readmeImages/1.PNG?raw=true) 12 | ![alt text](https://github.com/FatihBaycu/RentACarProjectAngularAPI/blob/master/readmeImages/2.PNG?raw=true) 13 | ![alt text](https://github.com/FatihBaycu/RentACarProjectAngularAPI/blob/master/readmeImages/3.PNG?raw=true) 14 | ![alt text](https://github.com/FatihBaycu/RentACarProjectAngularAPI/blob/master/readmeImages/4.PNG?raw=true) 15 | ![alt text](https://github.com/FatihBaycu/RentACarProjectAngularAPI/blob/master/readmeImages/5.PNG?raw=true) 16 | ![alt text](https://github.com/FatihBaycu/RentACarProjectAngularAPI/blob/master/readmeImages/6.png?raw=true) 17 | ![alt text](https://github.com/FatihBaycu/RentACarProjectAngularAPI/blob/master/readmeImages/7.PNG?raw=true) 18 | ![alt text](https://github.com/FatihBaycu/RentACarProjectAngularAPI/blob/master/readmeImages/8.PNG?raw=true) 19 | ![alt text](https://github.com/FatihBaycu/RentACarProjectAngularAPI/blob/master/readmeImages/9.PNG?raw=true) 20 | 21 | 22 | 23 | ## Code scaffolding 24 | 25 | 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`. 26 | 27 | ## Build 28 | 29 | 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. 30 | 31 | ## Running unit tests 32 | 33 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 34 | 35 | ## Running end-to-end tests 36 | 37 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 38 | 39 | ## Further help 40 | 41 | 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. 42 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "CarRental-FrontEnd": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:application": { 10 | "strict": true 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/CarRental-FrontEnd", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "assets": [ 26 | "src/favicon.ico", 27 | "src/assets" 28 | ], 29 | "styles": [ 30 | "src/custom-theme.scss", 31 | "node_modules/bootstrap-icons/font/bootstrap-icons.css", 32 | "./node_modules/bootstrap/dist/css/bootstrap.min.css", 33 | "src/styles.css", 34 | "./node_modules/ngx-toastr/toastr.css" 35 | 36 | ], 37 | "scripts": [ 38 | "node_modules/jquery/dist/jquery.min.js", 39 | "node_modules/bootstrap/dist/js/bootstrap.min.js" 40 | ], 41 | "vendorChunk": true, 42 | "extractLicenses": false, 43 | "buildOptimizer": false, 44 | "sourceMap": true, 45 | "optimization": false, 46 | "namedChunks": true 47 | }, 48 | "configurations": { 49 | "production": { 50 | "fileReplacements": [ 51 | { 52 | "replace": "src/environments/environment.ts", 53 | "with": "src/environments/environment.prod.ts" 54 | } 55 | ], 56 | "optimization": true, 57 | "outputHashing": "all", 58 | "sourceMap": false, 59 | "namedChunks": false, 60 | "extractLicenses": true, 61 | "vendorChunk": false, 62 | "buildOptimizer": true, 63 | "budgets": [ 64 | { 65 | "type": "initial", 66 | "maximumWarning": "500kb", 67 | "maximumError": "1mb" 68 | }, 69 | { 70 | "type": "anyComponentStyle", 71 | "maximumWarning": "2kb", 72 | "maximumError": "4kb" 73 | } 74 | ] 75 | } 76 | } 77 | }, 78 | "serve": { 79 | "builder": "@angular-devkit/build-angular:dev-server", 80 | "options": { 81 | "browserTarget": "CarRental-FrontEnd:build" 82 | }, 83 | "configurations": { 84 | "production": { 85 | "browserTarget": "CarRental-FrontEnd:build:production" 86 | } 87 | } 88 | }, 89 | "extract-i18n": { 90 | "builder": "@angular-devkit/build-angular:extract-i18n", 91 | "options": { 92 | "browserTarget": "CarRental-FrontEnd:build" 93 | } 94 | }, 95 | "test": { 96 | "builder": "@angular-devkit/build-angular:karma", 97 | "options": { 98 | "main": "src/test.ts", 99 | "polyfills": "src/polyfills.ts", 100 | "tsConfig": "tsconfig.spec.json", 101 | "karmaConfig": "karma.conf.js", 102 | "assets": [ 103 | "src/favicon.ico", 104 | "src/assets" 105 | ], 106 | "styles": [ 107 | "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", 108 | "src/styles.css" 109 | ], 110 | "scripts": [] 111 | } 112 | }, 113 | "lint": { 114 | "builder": "@angular-devkit/build-angular:tslint", 115 | "options": { 116 | "tsConfig": [ 117 | "tsconfig.app.json", 118 | "tsconfig.spec.json", 119 | "e2e/tsconfig.json" 120 | ], 121 | "exclude": [ 122 | "**/node_modules/**" 123 | ] 124 | } 125 | }, 126 | "e2e": { 127 | "builder": "@angular-devkit/build-angular:protractor", 128 | "options": { 129 | "protractorConfig": "e2e/protractor.conf.js", 130 | "devServerTarget": "CarRental-FrontEnd:serve" 131 | }, 132 | "configurations": { 133 | "production": { 134 | "devServerTarget": "CarRental-FrontEnd:serve:production" 135 | } 136 | } 137 | } 138 | } 139 | } 140 | }, 141 | "defaultProject": "CarRental-FrontEnd" 142 | } 143 | -------------------------------------------------------------------------------- /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 | }; 38 | 39 | -------------------------------------------------------------------------------- /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('CarRental-FrontEnd app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | async navigateTo(): Promise { 5 | return browser.get(browser.baseUrl); 6 | } 7 | 8 | async getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../out-tsc/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/CarRental-FrontEnd'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "car-rental-front-end", 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": "^12.0.2", 15 | "@angular/cdk": "^11.2.6", 16 | "@angular/common": "~12.0.2", 17 | "@angular/compiler": "~12.0.2", 18 | "@angular/core": "~12.0.2", 19 | "@angular/forms": "~12.0.2", 20 | "@angular/material": "^11.2.6", 21 | "@angular/platform-browser": "~12.0.2", 22 | "@angular/platform-browser-dynamic": "~12.0.2", 23 | "@angular/router": "~12.0.2", 24 | "angular-material": "^1.2.2", 25 | "bootstrap": "^5.0.0-beta2", 26 | "bootstrap-icons": "^1.4.1", 27 | "datatables.net": "^1.10.24", 28 | "datatables.net-dt": "^1.10.24", 29 | "jquery": "^3.6.0", 30 | "ngx-bootstrap": "^6.2.0", 31 | "ngx-mat-select-search": "^3.2.0", 32 | "ngx-toastr": "^13.2.1", 33 | "rxjs": "~6.6.0", 34 | "tslib": "^2.0.0", 35 | "zone.js": "~0.11.4" 36 | }, 37 | "devDependencies": { 38 | "@angular-devkit/build-angular": "~12.0.2", 39 | "@angular/cli": "~12.0.2", 40 | "@angular/compiler-cli": "~12.0.2", 41 | "@types/jasmine": "~3.6.0", 42 | "@types/node": "^12.11.1", 43 | "codelyzer": "^6.0.0", 44 | "jasmine-core": "~3.6.0", 45 | "jasmine-spec-reporter": "~5.0.0", 46 | "karma": "~6.3.2", 47 | "karma-chrome-launcher": "~3.1.0", 48 | "karma-coverage": "~2.0.3", 49 | "karma-jasmine": "~4.0.0", 50 | "karma-jasmine-html-reporter": "^1.5.0", 51 | "protractor": "~7.0.0", 52 | "ts-node": "~8.3.0", 53 | "tslint": "~6.1.0", 54 | "typescript": "~4.2.4" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /readmeImages/1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/readmeImages/1.PNG -------------------------------------------------------------------------------- /readmeImages/2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/readmeImages/2.PNG -------------------------------------------------------------------------------- /readmeImages/3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/readmeImages/3.PNG -------------------------------------------------------------------------------- /readmeImages/4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/readmeImages/4.PNG -------------------------------------------------------------------------------- /readmeImages/5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/readmeImages/5.PNG -------------------------------------------------------------------------------- /readmeImages/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/readmeImages/6.png -------------------------------------------------------------------------------- /readmeImages/7.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/readmeImages/7.PNG -------------------------------------------------------------------------------- /readmeImages/8.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/readmeImages/8.PNG -------------------------------------------------------------------------------- /readmeImages/9.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/readmeImages/9.PNG -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | 2 | import { NgModule } from '@angular/core'; 3 | import { RouterModule, Routes } from '@angular/router'; 4 | import { CarUpdateComponent } from './components/car-update/car-update.component'; 5 | import { BrandAddComponent } from './components/brand-add/brand-add.component'; 6 | import { BrandDetailsComponent } from './components/brand-details/brand-details.component'; 7 | import { CarAddComponent } from './components/car-add/car-add.component'; 8 | import { CarDetailComponent } from './components/car-detail/car-detail.component'; 9 | import { CarComponent } from './components/car/car.component'; 10 | import { ColorAddComponent } from './components/color-add/color-add.component'; 11 | import { ColorDetailsComponent } from './components/color-details/color-details.component'; 12 | import { CustomerComponent } from './components/customer/customer.component'; 13 | import { RentalComponent } from './components/rental/rental.component'; 14 | import { PaymentComponent } from './components/payment/payment.component'; 15 | import { LoginComponent } from './components/login/login.component'; 16 | import { RegisterComponent } from './components/register/register.component'; 17 | import {LoginGuard} from './guards/login.guard'; 18 | import {UserProfileComponent} from './components/user-profile/user-profile.component'; 19 | import { ChangePasswordComponent } from './components/change-password/change-password.component'; 20 | import { CustomerRentalComponent } from './components/customer-rental/customer-rental.component'; 21 | import { MatSliderModule } from '@angular/material/slider'; 22 | import { ResetPasswordComponent } from './components/reset-password/reset-password.component'; 23 | import { UpdatePasswordComponent } from './components/update-password/update-password.component'; 24 | 25 | // const routes: Routes = [ 26 | // { path: 'rentals', component: RentalComponent }, 27 | // { path: 'customers', component: CustomerComponent }, 28 | // { path: 'cars', component: CarComponent }, 29 | // { path: 'cars/detail/:carId', component: CarDetailComponent }, 30 | // { path: 'brands', component: BrandComponent }, 31 | // { path: 'brands/:brandId', component: BrandComponent }, 32 | // { path: 'colors', component: ColorComponent }, 33 | // { path: 'colors/:colorId', component: ColorComponent }, 34 | // { path: '**', redirectTo: 'cars', pathMatch: 'full' } 35 | // ]; 36 | 37 | 38 | 39 | const routes: Routes = [ 40 | { path:'rentals', component: RentalComponent ,canActivate:[LoginGuard]}, 41 | { path:'customers', component: CustomerComponent,canActivate:[LoginGuard]}, 42 | { path:"cars", component: CarComponent }, 43 | { path:'cars/detail/:carId', component: CarDetailComponent }, 44 | { path:"cars/filter/:brandId/:colorId",component:CarComponent}, 45 | { path:'rentals/:carId',component:RentalComponent}, 46 | {path:'brands/add',component:BrandAddComponent,canActivate:[LoginGuard]}, 47 | {path:'colors/add',component:ColorAddComponent,canActivate:[LoginGuard]}, 48 | {path:'cars/add',component:CarAddComponent,canActivate:[LoginGuard]}, 49 | {path:'colors/:colorId',component:ColorDetailsComponent}, 50 | {path:'brands/:brandId',component:BrandDetailsComponent}, 51 | {path:'cars/update/:carId',component:CarUpdateComponent,canActivate:[LoginGuard]}, 52 | {path:'payments',component:PaymentComponent,canActivate:[LoginGuard]}, 53 | {path:'login',component:LoginComponent}, 54 | {path:'register',component:RegisterComponent}, 55 | {path:'user-profile',component:UserProfileComponent,canActivate:[LoginGuard]}, 56 | {path:"password-change",component:ChangePasswordComponent,canActivate:[LoginGuard]}, 57 | {path:"customer-rentals",component:CustomerRentalComponent,canActivate:[LoginGuard]}, 58 | {path:"password-reset",component:ResetPasswordComponent}, 59 | {path:"update-password",component:UpdatePasswordComponent}, 60 | {path:"update-password/filter/:userId/:code",component:UpdatePasswordComponent}, 61 | 62 | 63 | 64 | 65 | 66 | 67 | // { path: "cars/filter/:colorId",component:CarComponent}, 68 | // { path: "cars/filter/:brandId",component:CarComponent}, 69 | // { path: 'brands/:brandId', component: CarComponent }, 70 | // { path: 'colors/:colorId', component: CarComponent }, 71 | 72 | 73 | { path: '**', pathMatch: 'full',component:CarComponent} 74 | 75 | ]; 76 | 77 | @NgModule({ 78 | imports: [RouterModule.forRoot(routes)], 79 | exports: [RouterModule], 80 | 81 | 82 | }) 83 | export class AppRoutingModule { } 84 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/app.component.css -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 | 15 |
16 |
17 |
    18 |
  • 19 |
  • 20 |
21 |
22 |
23 | 24 |
25 |
26 |
27 |
28 |
-------------------------------------------------------------------------------- /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 'CarRental-FrontEnd'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('CarRental-FrontEnd'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement; 33 | expect(compiled.querySelector('.content span').textContent).toContain('CarRental-FrontEnd app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.css'] 8 | }) 9 | export class AppComponent { 10 | title = 'CarRental-FrontEnd'; 11 | } 12 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { BrowserAnimationsModule} from '@angular/platform-browser/animations'; 4 | import { ToastrModule} from 'ngx-toastr'; 5 | import { FormsModule,ReactiveFormsModule} from '@angular/forms' 6 | import { AppRoutingModule } from './app-routing.module'; 7 | import { AppComponent } from './app.component'; 8 | 9 | 10 | import { NaviComponent } from './components/navi/navi.component'; 11 | import { BrandComponent } from './components/brand/brand.component'; 12 | import { HttpClientModule, HTTP_INTERCEPTORS} from '@angular/common/http'; 13 | import { ColorComponent } from './components/color/color.component'; 14 | import { CustomerComponent } from './components/customer/customer.component'; 15 | import { RentalComponent } from './components/rental/rental.component'; 16 | import { CarComponent } from './components/car/car.component'; 17 | import { RentalDetailComponent } from './components/rental-detail/rental-detail.component'; 18 | import { CarDetailComponent } from './components/car-detail/car-detail.component'; 19 | import { FilterTextPipe } from './pipes/filter-text.pipe'; 20 | import { VatAddedPipe } from './pipes/vat-added.pipe'; 21 | import { BrandPipePipe } from './pipes/brand-pipe.pipe'; 22 | import { ColorPipePipe } from './pipes/color-pipe.pipe'; 23 | import { CarFilterComponent } from './components/car-filter/car-filter.component'; 24 | import { PaymentComponent } from './components/payment/payment.component'; 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 { ColorDetailsComponent } from './components/color-details/color-details.component'; 29 | import { BrandDetailsComponent } from './components/brand-details/brand-details.component'; 30 | import { CarUpdateComponent } from './components/car-update/car-update.component'; 31 | import {MatPaginatorModule} from '@angular/material/paginator'; 32 | import { LoginComponent } from './components/login/login.component'; 33 | import { RegisterComponent } from './components/register/register.component'; 34 | import { UserProfileComponent } from './components/user-profile/user-profile.component'; 35 | import { ChangePasswordComponent } from './components/change-password/change-password.component'; 36 | import { CustomerRentalComponent } from './components/customer-rental/customer-rental.component'; 37 | import { TextStyleDirective } from './directives/text-style.directive'; 38 | import { UpdatePasswordComponent } from './components/update-password/update-password.component'; 39 | import { ResetPasswordComponent } from './components/reset-password/reset-password.component'; 40 | @NgModule({ 41 | declarations: [ 42 | AppComponent, 43 | NaviComponent, 44 | BrandComponent, 45 | ColorComponent, 46 | CustomerComponent, 47 | RentalComponent, 48 | CarComponent, 49 | RentalDetailComponent, 50 | CarDetailComponent, 51 | FilterTextPipe, 52 | VatAddedPipe, 53 | BrandPipePipe, 54 | ColorPipePipe, 55 | CarFilterComponent, 56 | PaymentComponent, 57 | ColorAddComponent, 58 | BrandAddComponent, 59 | CarAddComponent, 60 | ColorDetailsComponent, 61 | BrandDetailsComponent, 62 | CarUpdateComponent, 63 | LoginComponent, 64 | RegisterComponent, 65 | UserProfileComponent, 66 | ChangePasswordComponent, 67 | CustomerRentalComponent, 68 | TextStyleDirective, 69 | UpdatePasswordComponent, 70 | ResetPasswordComponent 71 | ], 72 | imports: [ 73 | BrowserModule, 74 | AppRoutingModule, 75 | HttpClientModule, 76 | FormsModule, 77 | 78 | ToastrModule.forRoot({ 79 | positionClass:"toast-bottom-right" 80 | }), 81 | BrowserAnimationsModule, 82 | ReactiveFormsModule, 83 | MatPaginatorModule, 84 | 85 | ], 86 | providers: [], 87 | bootstrap: [AppComponent] 88 | }) 89 | export class AppModule { } 90 | -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/brand-add/brand-add.component.css -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
Marka IdMarka Adı
{{ brand.brandId }}{{ brand.brandName }}
22 |
23 | 24 | 25 | 26 |
27 |
28 |
29 |
30 |
31 |
Marka Ekle
32 |
33 |
34 |
35 |
36 | 37 |
38 | 39 |
40 |
41 |
42 |
43 | 44 |
45 | 46 |
47 |
48 |
49 |
-------------------------------------------------------------------------------- /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, ViewChild } from '@angular/core'; 2 | import {FormGroup,FormBuilder,FormControl,Validators} from '@angular/forms' 3 | import { BrandService } from 'src/app/services/brand.service'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Brand } from 'src/app/models/brand/brand'; 6 | 7 | @Component({ 8 | selector: 'app-brand-add', 9 | templateUrl: './brand-add.component.html', 10 | styleUrls: ['./brand-add.component.css'] 11 | }) 12 | export class BrandAddComponent implements OnInit { 13 | 14 | brandAddForm:FormGroup; 15 | brands:Brand[]; 16 | 17 | constructor( 18 | private formBuilder:FormBuilder, 19 | private brandService:BrandService, 20 | private toastrService:ToastrService 21 | ) { } 22 | 23 | ngOnInit(): void { 24 | this.createBrandAddForm(); 25 | this.getBrands(); 26 | } 27 | 28 | createBrandAddForm(){ 29 | this.brandAddForm=this.formBuilder.group({ 30 | brandName:["",Validators.required] 31 | }) 32 | } 33 | 34 | getBrands(){ 35 | this.brandService.getBrands().subscribe(response=>{ 36 | this.brands=response.data; 37 | }) 38 | } 39 | 40 | BrandAdd(){ 41 | if(this.brandAddForm.valid){ 42 | let brandModel=Object.assign({},this.brandAddForm.value); 43 | this.brandService.addBrand(brandModel).subscribe((response)=>{ 44 | console.log(brandModel); 45 | this.toastrService.success("Marka Eklendi."); 46 | }, 47 | responseError=>{ 48 | if(responseError.error.Errors.length>0){ 49 | console.log(responseError.error.Errors); 50 | 51 | for(let i=0; i 2 |
3 | 4 |
5 |
6 | Marka Güncelle 7 |
8 |
9 |
10 | 11 | 12 | 13 |
14 | 16 | 17 |
18 | 19 | 20 |
21 | 22 |
23 |
24 |
25 |
26 | 27 |
28 |
29 |
30 | 33 |
34 |
35 |
-------------------------------------------------------------------------------- /src/app/components/brand-details/brand-details.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandDetailsComponent } from './brand-details.component'; 4 | 5 | describe('BrandDetailsComponent', () => { 6 | let component: BrandDetailsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandDetailsComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandDetailsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand-details/brand-details.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, 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/brand'; 6 | import { BrandService } from 'src/app/services/brand.service'; 7 | 8 | @Component({ 9 | selector: 'app-brand-details', 10 | templateUrl: './brand-details.component.html', 11 | styleUrls: ['./brand-details.component.css'] 12 | }) 13 | export class BrandDetailsComponent implements OnInit { 14 | 15 | constructor( 16 | private activatedRoute:ActivatedRoute, 17 | private brandService:BrandService, 18 | private toastrService:ToastrService, 19 | private formBuilder:FormBuilder 20 | ) { } 21 | 22 | brand!:Brand; 23 | brandUpdateForm:FormGroup; 24 | 25 | ngOnInit(): void { 26 | this.activatedRoute.params.subscribe(param => { 27 | this.getBrandById(param['brandId']); 28 | }); 29 | } 30 | 31 | getBrandById(brandId: number) { 32 | this.brandService.getBrandById(brandId).subscribe(response => { 33 | this.brand = response.data; 34 | this.createBrandUpdateForm(); 35 | }); 36 | } 37 | 38 | createBrandUpdateForm() { 39 | this.brandUpdateForm = this.formBuilder.group({ 40 | brandId: [this.brand.brandId, Validators.required], 41 | brandName: [this.brand.brandName, Validators.required], 42 | 43 | }); 44 | } 45 | 46 | 47 | 48 | brandUpdate() { 49 | let brand: Brand = this.brandUpdateForm.value 50 | 51 | if (!this.brandUpdateForm.valid) { 52 | this.toastrService.warning('Lütfen boş bilgi bırakmayın', 'Dikkat'); 53 | return; 54 | } 55 | 56 | this.brandService.updateBrand(brand).subscribe(responseSuccess => { 57 | return this.toastrService.success(responseSuccess.message, 'Başarılı'); 58 | }, responseError => { 59 | if (responseError.error.ValidationErrors.length == 0) { 60 | this.toastrService.error(responseError.error.Message, responseError.error.StatusCode); 61 | return; 62 | } 63 | 64 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 65 | this.toastrService.error( 66 | responseError.error.ValidationErrors[i].ErrorMessage, 'Doğrulama Hatası' 67 | ); 68 | } 69 | }); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/brand/brand.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 | 6 |
7 | 8 | 10 |
11 |
12 | {{filterText}} Aradınız 13 |
14 | 15 | 16 | 20 |
21 | 22 | 23 | 24 | 25 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /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 { Router } from '@angular/router'; 3 | import { Brand } from 'src/app/models/brand/brand'; 4 | import { BrandService } from 'src/app/services/brand.service'; 5 | 6 | @Component({ 7 | selector: 'app-brand', 8 | templateUrl: './brand.component.html', 9 | styleUrls: ['./brand.component.css'], 10 | }) 11 | export class BrandComponent implements OnInit { 12 | 13 | dataLoaded=false; 14 | filterText=""; 15 | 16 | 17 | title: string = 'Markalar'; 18 | listAllBrandCss: string = "text-start list-group-item"; 19 | brands: Brand[] = []; 20 | currentBrandId: number = 0; 21 | 22 | constructor(private brandService: BrandService, private _router: Router) { 23 | } 24 | 25 | ngOnInit(): void { 26 | this.getBrands(); 27 | } 28 | 29 | getBrands() { 30 | this.brandService.getBrands().subscribe((response) => { 31 | this.brands = response.data; 32 | this.dataLoaded=true; 33 | }); 34 | } 35 | 36 | setCurrentBrand(brandId: number) { 37 | this.currentBrandId = brandId; 38 | this.getFilter(brandId); 39 | } 40 | 41 | getCurrentBrandClass(brandId: number): string { 42 | if (this.currentBrandId == brandId) { 43 | return 'list-group-item list-group-item-action active'; 44 | } 45 | 46 | return 'list-group-item list-group-item-action'; 47 | } 48 | 49 | resetCurrentBrandId(){ 50 | this.currentBrandId = 0 51 | } 52 | getFilter(brandId:number){ 53 | this._router.navigate(['cars/'], { 54 | queryParams: {brandId: brandId }, 55 | }); 56 | } 57 | // name = 'Angular 4'; 58 | // myDropDown: string; 59 | // items:Brand[]=[]; 60 | // origItems:Brand[]=[]; 61 | // @ViewChild('selectList', { static: false }) selectList: ElementRef; 62 | 63 | // onChangeofOptions(newGov: any) { 64 | // console.log(newGov); 65 | // } 66 | // filterItem(event: string) { 67 | // if (!event) { 68 | // this.brands = this.items; 69 | // } // when nothing has typed*/ 70 | // if (typeof event === 'string') { 71 | // console.log(event); 72 | // this.items = this.origItems.filter((p:Brand) => p.brandName.toLocaleLowerCase().startsWith(event.toLocaleLowerCase())); 73 | // } 74 | // console.log(this.items.length); 75 | // this.selectList.nativeElement.size = this.items.length + 1; 76 | // } 77 | 78 | } 79 | 80 | -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/car-add/car-add.component.css -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
Araba Ekle
7 |
8 |
9 |
10 | 11 |
12 | 13 | 19 | 20 |
21 | 22 |
23 | 28 | 29 |
30 | 31 |
32 | 33 |
34 | 35 |
36 | 37 |
38 | 39 |
40 | 41 |
42 | 43 |
44 | 45 |
46 | 47 |
48 | 49 |
50 | 51 |
52 | 53 |
54 | 55 |
56 | 57 |
58 | 59 |
60 | 61 | 62 | 63 | 64 |
65 |
66 |
67 | 68 |
69 | 70 |
71 |
72 |
73 |
-------------------------------------------------------------------------------- /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 { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Brand } from 'src/app/models/brand/brand'; 5 | import { Car } from 'src/app/models/car/car'; 6 | import { Color } from 'src/app/models/color/color'; 7 | import { BrandService } from 'src/app/services/brand.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 | car:Car[]; 20 | colors: Color[]; 21 | brands: Brand[]; 22 | 23 | constructor( 24 | private carService:CarService, 25 | private toastrService:ToastrService, 26 | private formBuilder:FormBuilder, 27 | private colorService: ColorService, 28 | private brandService: BrandService 29 | ) { } 30 | 31 | ngOnInit(): void { 32 | this.getBrands(); 33 | this.getColors(); 34 | this.createAddCarForm(); 35 | } 36 | 37 | getColors() { 38 | this.colorService.getColors().subscribe((response) => { 39 | this.colors = response.data; 40 | }); 41 | } 42 | getBrands() { 43 | this.brandService.getBrands().subscribe((response) => { 44 | this.brands = response.data; 45 | }); 46 | } 47 | createAddCarForm(){ 48 | this.carAddForm=this.formBuilder.group({ 49 | brandId:["",Validators.required], 50 | colorId:["",Validators.required], 51 | modelYear:["",Validators.required], 52 | dailyPrice:["",Validators.required], 53 | description:["",Validators.required], 54 | carName:["",Validators.required], 55 | carFindexPoint:[""] 56 | }) 57 | } 58 | 59 | carAdd(){ 60 | if(this.carAddForm.valid){ 61 | let carModel=Object.assign({},this.carAddForm.value); 62 | carModel.brandId=Number(carModel.brandId); 63 | carModel.colorId=Number(carModel.colorId); 64 | 65 | this.carService.addCar(carModel).subscribe((response)=>{ 66 | console.log(carModel); 67 | this.toastrService.success("Araç başarıyla eklendi"); 68 | }, 69 | responseError=>{ 70 | console.log(responseError.error); 71 | if(responseError.error.Errors.length>0){ 72 | console.log(responseError.error.Errors); 73 | for(let i=0; i 5 |
6 | 37 |
38 | 39 |
40 |

{{ carDetail.brandName }}

41 |
42 |
    43 |
  • 44 |
    45 | Model Name: {{ carDetail.description }}, 46 | {{ carDetail.brandName }} 47 |
    48 |
  • 49 |
  • 50 |
    Color Name: {{ carDetail.colorName }}
    51 |
  • 52 |
  • 53 |
    Model Year: {{ carDetail.modelYear }}
    54 |
  • 55 |
  • 56 |
    Günlük Ücret: {{ carDetail.dailyPrice }} ₺
    57 |
  • 58 |
  • 59 |
    Aracın Findex Puanı {{ carDetail.carFindexPoint}}
    60 |
  • 61 | 62 |
63 |
64 | 65 | -------------------------------------------------------------------------------- /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 { CarDetail } from 'src/app/models/carDetail/carDetail'; 4 | import { CarImage } from 'src/app/models/carImage/carImage'; 5 | import { CarImageService } from 'src/app/services/car-image.service'; 6 | import { CarService } from 'src/app/services/car.service'; 7 | 8 | 9 | @Component({ 10 | selector: 'app-car-detail', 11 | templateUrl:'./car-detail.component.html', 12 | styleUrls: ['./car-detail.component.css'] 13 | }) 14 | export class CarDetailComponent implements OnInit { 15 | 16 | carDetail: CarDetail; 17 | carImages: CarImage[] = []; 18 | imageBaseUrl = "https://localhost:5001/"; 19 | currentImage:CarImage; 20 | 21 | constructor( 22 | private carService: CarService, 23 | private activatedRoute: ActivatedRoute, 24 | private carImageService: CarImageService) { 25 | } 26 | 27 | ngOnInit(): void { 28 | this.activatedRoute.params.subscribe((params) => { 29 | if (params['carId']) { 30 | this.getPhotosByCarId(params['carId']); 31 | this.getCarById(params['carId']); 32 | } 33 | }); 34 | } 35 | 36 | getCarById(id: number) { 37 | this.carService.getCarById(id).subscribe((response) => { 38 | this.carDetail = response.data; 39 | // console.log(this.carDetail); 40 | 41 | }); 42 | } 43 | 44 | getPhotosByCarId(carId: number) { 45 | this.carImageService.getImagesByCarId(carId).subscribe((response) => { 46 | this.carImages = response.data; 47 | console.log(response.data); 48 | }); 49 | } 50 | 51 | read(url: string){ 52 | console.log(url) 53 | return url; 54 | } 55 | 56 | getCurrentImageClass(carImage:CarImage){ 57 | if(this.carImages[0]==carImage){ 58 | return "carousel-item active"; 59 | } 60 | else {return "carousel-item"; 61 | } 62 | 63 | } 64 | setCurrentImageClass(carImage:CarImage){ 65 | this.currentImage=carImage; 66 | } 67 | 68 | 69 | } -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/car-filter/car-filter.component.css -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.html: -------------------------------------------------------------------------------- 1 | 25 | 26 |
27 |
28 |
29 |

Markalar

30 | 33 |
34 |
35 |

Renkler

36 | 39 |
40 |
41 | 42 |

43 | Filtrele 44 | 45 |
46 |


47 | Temizle 48 |
49 |
50 |
-------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarFilterComponent } from './car-filter.component'; 4 | 5 | describe('CarFilterComponent', () => { 6 | let component: CarFilterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarFilterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarFilterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute, Router } from '@angular/router'; 3 | import { Brand } from 'src/app/models/brand/brand'; 4 | import { Car } from 'src/app/models/car/car'; 5 | import { CarDetail } from 'src/app/models/carDetail/carDetail'; 6 | import { Color } from 'src/app/models/color/color'; 7 | import { BrandService } from 'src/app/services/brand.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-filter', 13 | templateUrl: './car-filter.component.html', 14 | styleUrls: ['./car-filter.component.css'] 15 | }) 16 | export class CarFilterComponent implements OnInit { 17 | cars:Car[]=[]; 18 | carDetails:CarDetail[]=[]; 19 | brands:Brand[]=[]; 20 | colors:Color[]=[]; 21 | 22 | brandFilter: number; 23 | colorFilter: number; 24 | dataLoaded=false; 25 | currentBrandId:number=0; 26 | currentColorId:number=0; 27 | 28 | constructor(private brandService:BrandService 29 | ,private colorService:ColorService 30 | ,private carService:CarService, 31 | private activatedRoute:ActivatedRoute, 32 | private _router: Router) { } 33 | 34 | ngOnInit(): void { 35 | 36 | 37 | // this.activatedRoute.queryParams.subscribe((params) => { 38 | // console.log(params['colorId'],params['brandId']); 39 | // if (params['colorId'] && params['brandId']) { 40 | // this.getCurrentBrandAndColorId( params['brandId'],params['colorId']); 41 | // } else if (params['colorId']) { 42 | // this.getCurrentColor(params['colorId']); 43 | // } else if (params['brandId']) { 44 | // this.getCurrentBrand(params['brandId']); 45 | // } else { 46 | // this.getCars(); 47 | // } 48 | // }); 49 | 50 | this.getBrands(); 51 | this.getColors(); 52 | } 53 | 54 | getFilter(brandId:number,colorId:number){ 55 | this._router.navigate(['cars/'], { 56 | queryParams: { colorId: colorId, brandId: brandId }, 57 | }); 58 | } 59 | 60 | 61 | getCars() { 62 | this.carService.getCars().subscribe((response) => { 63 | this.carDetails = response.data; 64 | this.dataLoaded=true; 65 | }); 66 | } 67 | 68 | 69 | 70 | 71 | getCurrentBrandAndColorId(brandId:number,colorId:number){ 72 | this.carService.getCarsByBrandAndColorId(brandId,colorId).subscribe((response)=>{ 73 | this.carDetails=response.data; 74 | this.dataLoaded=true; 75 | console.log("başladı. colorId:",colorId," brandId:",brandId); 76 | }) 77 | } 78 | 79 | getBrands() { 80 | this.brandService.getBrands().subscribe((response) => { 81 | this.brands = response.data; 82 | this.dataLoaded=true; 83 | }); 84 | } 85 | 86 | getCurrentBrand(brandId: number) { 87 | if(this.brandFilter==brandId) 88 | {return true;} 89 | else {return false;} 90 | } 91 | 92 | 93 | 94 | getColors() { 95 | this.colorService.getColors().subscribe((response) => { 96 | this.colors = response.data; 97 | this.dataLoaded = true; 98 | }); 99 | } 100 | 101 | getCurrentColor(colorId: number) { 102 | if(this.colorFilter==colorId){return true} 103 | else{return false;} 104 | } 105 | 106 | 107 | 108 | 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/car-update/car-update.component.css -------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
Araba Güncelle
6 |
7 |
8 |
9 | 10 | 17 | 18 |
19 | 20 | 21 |
22 | 29 | 30 |
31 | 32 |
33 | 35 | 36 |
37 | 38 |
39 | 41 | 42 |
43 | 44 |
45 | 47 | 48 |
49 | 50 |
51 | 53 | 54 |
55 | 56 |
57 | 58 |
59 | 60 |
61 | 62 | 63 |
64 | 65 |
66 |
67 |
68 |
69 | 70 |
71 |
72 |
73 | 74 |
75 |
76 |
-------------------------------------------------------------------------------- /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, 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/brand'; 6 | import { Car } from 'src/app/models/car/car'; 7 | import { CarDetail } from 'src/app/models/carDetail/carDetail'; 8 | import { Color } from 'src/app/models/color/color'; 9 | import { BrandService } from 'src/app/services/brand.service'; 10 | import { CarService } from 'src/app/services/car.service'; 11 | import { ColorService } from 'src/app/services/color.service'; 12 | 13 | @Component({ 14 | selector: 'app-car-update', 15 | templateUrl: './car-update.component.html', 16 | styleUrls: ['./car-update.component.css'], 17 | }) 18 | export class CarUpdateComponent implements OnInit { 19 | car: Car; 20 | //carDetails: CarDetail; 21 | carUpdateForm: FormGroup; 22 | colors: Color[]; 23 | brands: Brand[]; 24 | constructor( 25 | private carService: CarService, 26 | private activatedRoute: ActivatedRoute, 27 | private formBuilder: FormBuilder, 28 | private toastrService: ToastrService, 29 | private colorService: ColorService, 30 | private brandService: BrandService 31 | ) {} 32 | ngOnInit(): void { 33 | this.activatedRoute.params.subscribe((param) => { 34 | this.getCarById(param['carId']); 35 | 36 | }); 37 | } 38 | 39 | getCarById(carId: number) { 40 | this.carService.getCarById(carId).subscribe((response) => { 41 | // this.carDetails = response.data; 42 | this.car = response.data; 43 | this.getBrands(); 44 | this.getColors(); 45 | this.createCarUpdateForm(); 46 | }); 47 | } 48 | 49 | createCarUpdateForm() { 50 | this.carUpdateForm = this.formBuilder.group({ 51 | id: [this.car.carId, Validators.required], 52 | brandId: [this.car.brandId, Validators.required], 53 | colorId: [this.car.colorId, Validators.required], 54 | modelYear: [this.car.modelYear, Validators.required], 55 | dailyPrice: [this.car.dailyPrice, Validators.required], 56 | description: [this.car.description, Validators.required], 57 | carName: [this.car.carName, Validators.required], 58 | carFindexPoint:[this.car.carFindexPoint], 59 | }); 60 | } 61 | 62 | getColors() { 63 | this.colorService.getColors().subscribe((response) => { 64 | this.colors = response.data; 65 | }); 66 | } 67 | getBrands() { 68 | this.brandService.getBrands().subscribe((response) => { 69 | this.brands = response.data; 70 | }); 71 | } 72 | 73 | carUpdate() { 74 | 75 | let car: Car = this.carUpdateForm.value; 76 | 77 | car.brandId = Number(car.brandId); 78 | car.colorId = Number(car.colorId); 79 | car.modelYear = Number(car.modelYear); 80 | car.dailyPrice = Number(car.dailyPrice); 81 | 82 | console.log(car); 83 | if (!this.carUpdateForm.valid) { 84 | this.toastrService.warning('Lütfen boş bilgi bırakmayın', 'Dikkat'); 85 | return; 86 | } 87 | 88 | this.carService.updateCar(car).subscribe( 89 | (responseSuccess) => { 90 | return this.toastrService.success(responseSuccess.message, 'Başarılı'); 91 | }, 92 | (responseError) => { 93 | console.log(responseError); 94 | // if (responseError.error.ValidationErrors.length == 0) { 95 | // this.toastrService.error(responseError.error.Message, responseError.error.StatusCode); 96 | // return; 97 | // } 98 | 99 | // for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 100 | // this.toastrService.error( 101 | // responseError.error.ValidationErrors[i].ErrorMessage, 'Doğrulama Hatası' 102 | // ); 103 | // } 104 | } 105 | ); 106 | } 107 | } -------------------------------------------------------------------------------- /src/app/components/car/car.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/car/car.component.css -------------------------------------------------------------------------------- /src/app/components/car/car.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | Loading... 4 |
5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 14 |
15 |
16 | {{filterText}} Aradınız 17 |
18 | 19 | 20 |
21 | 22 |
23 | ... 24 | 25 |
26 |
Marka: {{car.brandName}}
27 |

Açıklama: {{ car.description }}

28 |
29 |
    30 |
  • Ad: {{car.carName}}
  • 31 |
  • Renk: {{car.colorName}}
  • 32 |
  • Model Yılı: {{car.modelYear}}
  • 33 |
  • Açıklama: {{car.description}}
  • 34 |
35 |
36 |
    37 |
  • Günlük Fiyat: {{car.dailyPrice | currency:'TL'}}
  • 38 |
  • Kdv'li Fiyat: {{car.dailyPrice | vatAdded:18 | currency:'TL'}}
  • 39 |
  • 40 | 41 |
42 |
43 | 44 |
45 |
-------------------------------------------------------------------------------- /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/car'; 4 | import { CarDetail } from 'src/app/models/carDetail/carDetail'; 5 | import { CarService } from 'src/app/services/car.service'; 6 | 7 | @Component({ 8 | selector: 'app-car', 9 | templateUrl: './car.component.html', 10 | styleUrls: ['./car.component.css'] 11 | }) 12 | 13 | export class CarComponent implements OnInit { 14 | // carDetail: CarDetail | undefined; 15 | // carDetails: CarDetail[] = []; 16 | // constructor(private carService: CarService,private activatedRoute:ActivatedRoute) { } 17 | 18 | 19 | // ngOnInit(): void { 20 | // this.activatedRoute.params.subscribe((params) => { 21 | // if (params['brandId']) { 22 | // return this.getCarsByBrandId(params['brandId']); 23 | // } 24 | // if (params['colorId']) { 25 | // return this.getCarsByColorId(params['colorId']); 26 | // } 27 | 28 | // return this.getCars(); 29 | // }); 30 | // } 31 | 32 | 33 | 34 | // getCars() { 35 | // this.carService.getCars().subscribe((response) => { 36 | // this.carDetails = response.data; 37 | // }); 38 | // } 39 | 40 | // getCarsByColorId(colorId: number) { 41 | // this.carService.getCarsByColorId(colorId).subscribe((response) => { 42 | // this.carDetails = response.data; 43 | // }); 44 | // } 45 | 46 | // getCarsByBrandId(brandId: number) { 47 | // this.carService.getCarsByBrandId(brandId).subscribe((response) => { 48 | // this.carDetails = response.data; 49 | // }); 50 | // } 51 | 52 | // } 53 | carDetail: CarDetail | undefined; 54 | carDetails: CarDetail[] = []; 55 | car:Car[]=[]; 56 | filterText=""; 57 | dataLoaded=false; 58 | colorFilter=""; 59 | 60 | constructor( 61 | private carService: CarService, 62 | private activatedRoute: ActivatedRoute) { 63 | } 64 | 65 | ngOnInit(): void { 66 | // this.activatedRoute.params.subscribe((params) => { 67 | // if (params['brandId']) { 68 | // return this.getCarsByBrandId(params['brandId']); 69 | // } 70 | // if (params['colorId']) { 71 | // return this.getCarsByColorId(params['colorId']); 72 | // } 73 | // return this.getCars(); 74 | // }); 75 | 76 | 77 | 78 | 79 | this.activatedRoute.queryParams.subscribe((params) => { 80 | // console.log(params['colorId'],params['brandId']); 81 | if (params['colorId'] && params['brandId']) { 82 | this.getCurrentBrandAndColorId( params['brandId'],params['colorId']); 83 | } else if (params['colorId']) { 84 | this.getCarsByColorId(params['colorId']); 85 | } else if (params['brandId']) { 86 | this.getCarsByBrandId(params['brandId']); 87 | } else { 88 | this.getCars(); 89 | } 90 | }); 91 | 92 | } 93 | 94 | getCarsByBrandAndColorId(brandId: number,colorId: number){ 95 | this.carService.getCarsByBrandAndColorId(brandId,colorId).subscribe((response)=>{ 96 | this.carDetails=response.data; 97 | this.dataLoaded=true; 98 | }) 99 | } 100 | 101 | 102 | getCurrentBrandAndColorId(brandId:number,colorId:number){ 103 | this.carService.getCarsByBrandAndColorId(brandId,colorId).subscribe((response)=>{ 104 | this.carDetails=response.data; 105 | this.dataLoaded=true; 106 | console.log("başladı. colorId:",colorId," brandId:",brandId); 107 | console.log(response.data); 108 | }) 109 | } 110 | 111 | getCars() { 112 | this.carService.getCars().subscribe((response) => { 113 | this.carDetails = response.data; 114 | this.dataLoaded=true; 115 | }); 116 | } 117 | 118 | getCarsByBrandId(brandId: number) { 119 | this.carService.getCarsByBrandId(brandId).subscribe((response) => { 120 | this.carDetails = response.data; 121 | this.dataLoaded=true; 122 | }); 123 | } 124 | 125 | getCarsByColorId(colorId: number) { 126 | this.carService.getCarsByColorId(colorId).subscribe((response) => { 127 | this.carDetails = response.data; 128 | this.dataLoaded=true; 129 | }); 130 | } 131 | 132 | 133 | 134 | } 135 | -------------------------------------------------------------------------------- /src/app/components/change-password/change-password.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/change-password/change-password.component.css -------------------------------------------------------------------------------- /src/app/components/change-password/change-password.component.html: -------------------------------------------------------------------------------- 1 |

change-password works!

2 | -------------------------------------------------------------------------------- /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 | 3 | @Component({ 4 | selector: 'app-change-password', 5 | templateUrl: './change-password.component.html', 6 | styleUrls: ['./change-password.component.css'] 7 | }) 8 | export class ChangePasswordComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/color-add/color-add.component.css -------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
Color IdColor NameColor Code
{{ color.colorId }}{{ color.colorName }} {{ color.colorCode }}
21 |
22 |
23 |
24 |
25 |
26 |
27 |
Renk Ekle
28 |
29 |
30 |
31 |
32 | 33 |
34 | 35 |
36 |
37 |
38 |
39 |
40 |
41 | 42 |
43 | 44 |
45 |
46 |
47 |
48 | 49 |
50 | 51 |
52 |
53 |
54 |
55 | 56 | -------------------------------------------------------------------------------- /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 { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Color } from 'src/app/models/color/color'; 5 | import { ColorService } from 'src/app/services/color.service'; 6 | 7 | @Component({ 8 | selector: 'app-color-add', 9 | templateUrl: './color-add.component.html', 10 | styleUrls: ['./color-add.component.css'] 11 | }) 12 | export class ColorAddComponent implements OnInit { 13 | 14 | colorAddForm:FormGroup; 15 | colors:Color[]; 16 | constructor(private formBuilder:FormBuilder, 17 | private colorService:ColorService, 18 | private toastrService:ToastrService) { } 19 | 20 | ngOnInit(): void { 21 | this.createColorAddForm(); 22 | this.getColors(); 23 | } 24 | 25 | createColorAddForm(){ 26 | this.colorAddForm=this.formBuilder.group({ 27 | colorName:["",Validators.required], 28 | colorCode:[""] 29 | }) 30 | } 31 | 32 | colorAdd(){ 33 | if(this.colorAddForm.valid){ 34 | let colorModel=Object.assign({},this.colorAddForm.value); 35 | this.colorService.addColor(colorModel).subscribe(response=>{ 36 | console.log(colorModel); 37 | this.toastrService.success("Renk Eklendi"); 38 | }, 39 | responseError=>{ 40 | if (responseError.error.Errors.length>0) { 41 | console.log(responseError.error.Errors); 42 | for (let i = 0; i { 56 | this.colors=response.data; 57 | console.log(response.data); 58 | }) 59 | } 60 | 61 | // colorAdd(){ 62 | // if(this.colorAddForm.valid){ 63 | // let colorModel=Object.assign({},this.colorAddForm.value); 64 | // this.colorService.addColor(colorModel).subscribe(response=>{ 65 | // console.log(colorModel); 66 | // this.toastrService.success(response.message,"Başarılı"); 67 | // }, 68 | // responseError=>{ 69 | // if(responseError.error.Errors.length>0){ 70 | // console.log(responseError.error.Errors) 71 | 72 | // for (let i = 0; i 2 | 3 |
4 | 5 |
6 | 7 |
8 | 9 |
10 | 11 | 12 | --> 13 | 14 | 15 |
16 |
17 | 18 |
19 |
20 | Renk Güncelle 21 |
22 |
23 |
24 | 25 | 26 | 27 |
28 | 30 | 31 |
32 | 33 | 34 |
35 | 37 | 38 |
39 | 40 |
41 | 42 |
43 |
44 |
45 |
46 | 47 |
48 |
49 |
50 | 53 |
54 |
55 |
-------------------------------------------------------------------------------- /src/app/components/color-details/color-details.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorDetailsComponent } from './color-details.component'; 4 | 5 | describe('ColorDetailsComponent', () => { 6 | let component: ColorDetailsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorDetailsComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorDetailsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color-details/color-details.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Color } from 'src/app/models/color/color'; 6 | import { ColorService } from 'src/app/services/color.service'; 7 | 8 | @Component({ 9 | selector: 'app-color-details', 10 | templateUrl: './color-details.component.html', 11 | styleUrls: ['./color-details.component.css'] 12 | }) 13 | export class ColorDetailsComponent implements OnInit { 14 | color!:Color; 15 | colorUpdateForm:FormGroup; 16 | constructor( 17 | private colorService:ColorService, 18 | private activatedRoute:ActivatedRoute, 19 | private formBuilder:FormBuilder, 20 | private toastrService:ToastrService) { } 21 | 22 | // ngOnInit(): void { 23 | 24 | 25 | // this.activatedRoute.params.subscribe((params)=>{ 26 | 27 | // this.getColorById(params['colorId']); 28 | 29 | // }); 30 | // }//değil 31 | 32 | 33 | // createColorUpdateForm(){ 34 | // this.colorUpdateForm=this.formBuilder.group({ 35 | // colorId:[this.activatedRoute.snapshot.paramMap.get('colorId'),Validators.required], 36 | // colorName:[this.color.colorName,Validators.required], 37 | // colorCode:[this.color.colorCode] 38 | // }) 39 | // } 40 | 41 | 42 | ngOnInit(): void { 43 | this.activatedRoute.params.subscribe(param => { 44 | this.getColorById(param['colorId']); 45 | }); 46 | } 47 | 48 | getColorById(colorId: number) { 49 | this.colorService.getColorById(colorId).subscribe(response => { 50 | this.color = response.data; 51 | this.createColorUpdateForm(); 52 | }); 53 | } 54 | 55 | createColorUpdateForm() { 56 | this.colorUpdateForm = this.formBuilder.group({ 57 | colorId: [this.color.colorId, Validators.required], 58 | colorName: [this.color.colorName, Validators.required], 59 | colorCode: [this.color.colorCode] 60 | 61 | }); 62 | } 63 | 64 | 65 | 66 | colorUpdate() { 67 | let color: Color = this.colorUpdateForm.value 68 | 69 | if (!this.colorUpdateForm.valid) { 70 | this.toastrService.warning('Lütfen boş bilgi bırakmayın', 'Dikkat'); 71 | return; 72 | } 73 | 74 | this.colorService.updateColor(color).subscribe(responseSuccess => { 75 | return this.toastrService.success(responseSuccess.message, 'Başarılı'); 76 | }, responseError => { 77 | if (responseError.error.ValidationErrors.length == 0) { 78 | this.toastrService.error(responseError.error.Message, responseError.error.StatusCode); 79 | return; 80 | } 81 | 82 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 83 | this.toastrService.error( 84 | responseError.error.ValidationErrors[i].ErrorMessage, 'Doğrulama Hatası' 85 | ); 86 | } 87 | }); 88 | } 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | // colorUpdate(){ 98 | // if(this.colorUpdateForm.valid){ 99 | 100 | // let colorModel=Object.assign({},this.colorUpdateForm.value); 101 | // colorModel.colorId=parseInt(colorModel.colorId); 102 | 103 | // this.colorService.updateColor(colorModel).subscribe(response=>{ 104 | // //console.log(colorModel); 105 | 106 | // this.toastrService.success("Renk Güncellendi."); 107 | // }, 108 | // responseError=>{ 109 | // if (responseError.error.Errors.length>0) { 110 | // // console.log(responseError.error.Errors); 111 | // for (let i = 0; i { 128 | // this.color=response.data; 129 | // //console.log(this.color); 130 | // this.createColorUpdateForm(); 131 | 132 | // }) 133 | 134 | // } 135 | } 136 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/color/color.component.css -------------------------------------------------------------------------------- /src/app/components/color/color.component.html: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
4 | 5 | 6 | 7 |
8 | 9 | 11 |
12 |
13 | {{filterText}} Aradınız 14 |
15 | 16 |
20 | 21 | 22 | 27 | 28 | -------------------------------------------------------------------------------- /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 { Router } from "@angular/router"; 3 | import { CarDetail } from "src/app/models/carDetail/carDetail"; 4 | import { Color } from "src/app/models/color/color"; 5 | import { ColorService } from "src/app/services/color.service"; 6 | 7 | @Component({ 8 | selector: 'app-color', 9 | templateUrl: './color.component.html', 10 | styleUrls: ['./color.component.css'], 11 | }) 12 | export class ColorComponent implements OnInit { 13 | 14 | 15 | dataLoaded = false; 16 | filterText = ""; 17 | title: string = 'Renkler'; 18 | listAllBrandCss: string = 'text-start list-group-item'; 19 | colors: Color[] = []; 20 | currentColorId: number = 0; 21 | carDetails: CarDetail[] = []; 22 | 23 | constructor(private colorService: ColorService, private _router: Router) {} 24 | 25 | ngOnInit(): void { 26 | this.getColors(); 27 | } 28 | 29 | getColors() { 30 | this.colorService.getColors().subscribe((response) => { 31 | this.colors = response.data; 32 | this.dataLoaded = true; 33 | }); 34 | } 35 | getFilter(colorId:number){ 36 | this._router.navigate(['cars/'], { 37 | queryParams: {colorId: colorId }, 38 | }); 39 | } 40 | 41 | setCurrentColor(colorId: number) { 42 | this.currentColorId = colorId; 43 | this.getFilter(colorId) 44 | } 45 | 46 | getCurrentColorClass(colorId: number): string { 47 | if (this.currentColorId == colorId) { 48 | return 'list-group-item list-group-item-action active'; 49 | } 50 | 51 | return 'list-group-item list-group-item-action'; 52 | } 53 | 54 | resetCurrentColor() { 55 | this.currentColorId = 0; 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/app/components/customer-rental/customer-rental.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/customer-rental/customer-rental.component.css -------------------------------------------------------------------------------- /src/app/components/customer-rental/customer-rental.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 |
#Araba Marka Araba Model Kiralama TarihiDönüş Tarihi
{{rentalDetail.rentalId}}{{rentalDetail.brandName}}{{rentalDetail.carName}}{{rentalDetail.rentDate}}{{rentalDetail.returnDate}}
25 | -------------------------------------------------------------------------------- /src/app/components/customer-rental/customer-rental.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CustomerRentalComponent } from './customer-rental.component'; 4 | 5 | describe('CustomerRentalComponent', () => { 6 | let component: CustomerRentalComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CustomerRentalComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CustomerRentalComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/customer-rental/customer-rental.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { RentalDetail } from 'src/app/models/rentalDetail/rentalDetail'; 3 | import { LocalStroageService } from 'src/app/services/local-stroage.service'; 4 | import { RentalDetailService } from 'src/app/services/rental-detail.service'; 5 | 6 | @Component({ 7 | selector: 'app-customer-rental', 8 | templateUrl: './customer-rental.component.html', 9 | styleUrls: ['./customer-rental.component.css'] 10 | }) 11 | export class CustomerRentalComponent implements OnInit { 12 | 13 | rentalDetails:RentalDetail[]; 14 | customerId:number; 15 | constructor(private rentalDetailService:RentalDetailService,private localStorageService:LocalStroageService) { } 16 | ngOnInit(): void { 17 | this.customerId=this.localStorageService.getCurrentCustomer().customerId; 18 | 19 | this.getRentalDetailsByCustomer(this.customerId); 20 | } 21 | 22 | getRentalDetailsByCustomer(customerId:number){ 23 | this.rentalDetailService.getRentalDetailsByCustomer(customerId).subscribe(response=>{ 24 | this.rentalDetails=response.data; 25 | console.log(response.data); 26 | }) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/customer/customer.component.css -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
Müşteri IdMüsteri Kullanıcı IdMüsteri IdŞirket Adı Id
{{customer.customerId}}{{customer.userId}}{{customer.customerId}}{{customer.companyName}}
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
Müşteri adMüsteri soyadMüsteri IdŞirket AdıKullancı Id
{{customerDetails.firstName}}{{customerDetails.lastName}}{{customerDetails.customerId}}{{customerDetails.companyName}}{{customerDetails.userId}}
-------------------------------------------------------------------------------- /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/customer"; 3 | import { CustomerDetails } from "src/app/models/customerDetails/customerDetails"; 4 | import { CustomerService } from "src/app/services/customer.service"; 5 | 6 | 7 | @Component({ 8 | selector: 'app-customer', 9 | templateUrl: './customer.component.html', 10 | styleUrls: ['./customer.component.css'] 11 | }) 12 | export class CustomerComponent implements OnInit { 13 | customers: Customer[] = []; 14 | customerDetails:CustomerDetails[]=[]; 15 | constructor(private customerService: CustomerService) {} 16 | 17 | ngOnInit(): void { 18 | 19 | this.getCustomers(); 20 | this.getCustomerDetails(); 21 | } 22 | getCustomers() { 23 | this.customerService.getCustomers().subscribe(response=>{ 24 | this.customers=response.data; 25 | }) 26 | } 27 | getCustomerDetails(){ 28 | this.customerService.getCustomerDetails().subscribe(response=>{ 29 | this.customerDetails=response.data; 30 | console.log(response.data); 31 | }) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/login/login.component.css -------------------------------------------------------------------------------- /src/app/components/login/login.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
Giriş Yap
6 |
7 | 8 |
9 |
10 |
11 | 12 |
13 | 14 |
15 | 16 |
17 | 18 |
19 | 20 |
21 |
22 |
23 |
24 |
25 | 26 | Şifremi Unuttum 27 |
28 |
29 |
30 |
31 |
-------------------------------------------------------------------------------- /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 { ThrowStmt } from '@angular/compiler'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 4 | import { Router } from '@angular/router'; 5 | import { ToastrService } from 'ngx-toastr'; 6 | import { Customer } from 'src/app/models/customer/customer'; 7 | import { CustomerDetails } from 'src/app/models/customerDetails/customerDetails'; 8 | import { AuthService } from 'src/app/services/auth.service'; 9 | import { CustomerService } from 'src/app/services/customer.service'; 10 | import { LocalStroageService } from 'src/app/services/local-stroage.service'; 11 | 12 | 13 | @Component({ 14 | selector: 'app-login', 15 | templateUrl: './login.component.html', 16 | styleUrls: ['./login.component.css'] 17 | }) 18 | export class LoginComponent implements OnInit { 19 | 20 | loginForm:FormGroup; 21 | customer:Customer; 22 | customerDetail:CustomerDetails; 23 | isAuth:boolean; 24 | 25 | constructor(private formBuilder:FormBuilder,private toastrService:ToastrService,private customerService:CustomerService,private authService:AuthService,private localStorageService:LocalStroageService,private router:Router) { } 26 | 27 | ngOnInit(): void {this.createLoginForm();} 28 | 29 | createLoginForm(){ 30 | this.loginForm=this.formBuilder.group({ 31 | email:["",Validators.required], 32 | password:["",Validators.required] 33 | }) 34 | } 35 | 36 | forgotPassword(){ 37 | //return this.router.navigate(['/password-reset']) 38 | 39 | } 40 | 41 | login(){ 42 | if(this.loginForm.invalid){ 43 | return this.toastrService.warning("Bilgileri doldurduğunuzdan emin olun", "Dikkat") 44 | } 45 | 46 | let loginModel = Object.assign({}, this.loginForm.value); 47 | 48 | this.authService.login(loginModel).subscribe(responseSuccess => { 49 | this.getCustomerByEmail(loginModel.email); 50 | this.localStorageService.setToken(responseSuccess.data.token) 51 | 52 | this.toastrService.success(responseSuccess.message); 53 | return this.router.navigate(['/cars']) 54 | },responseError=>{ 55 | console.log(responseError); 56 | this.localStorageService.setItem("isauth",false); 57 | this.toastrService.error(responseError.error) 58 | }) 59 | 60 | 61 | 62 | // this.authService.login(loginModel).subscribe(response=>{ 63 | // this.toastrService.success(response.message); 64 | // this.localStorageService.setItem("isauth",true); 65 | // this.localStorageService.setItem("token",response.data.token); 66 | // this.getCustomerByEmail(loginModel.email); 67 | 68 | // console.log(response.data); 69 | // console.log( this.localStorageService.getItem("isauth")); 70 | // this.router.navigate(['cars']) 71 | // .then(() => { 72 | // window.location.reload(); 73 | // }); }, 74 | // responseError=>{ 75 | // console.log(responseError); 76 | // this.localStorageService.setItem("isauth",false); 77 | // this.toastrService.error(responseError.error) 78 | // }) 79 | 80 | return true 81 | } 82 | 83 | getCustomerByEmail(email: string) { 84 | this.customerService.getCustomerByEmail(email).subscribe(response => { 85 | this.customerDetail = response.data; 86 | console.log(response.data.firstName); 87 | 88 | this.localStorageService.setCurrentCustomer(this.customerDetail); 89 | }); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/navi/navi.component.css -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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 { Customer } from 'src/app/models/customer/customer'; 5 | import { AuthService } from 'src/app/services/auth.service'; 6 | import { LocalStroageService } from 'src/app/services/local-stroage.service'; 7 | 8 | @Component({ 9 | selector: 'app-navi', 10 | templateUrl: './navi.component.html', 11 | styleUrls: ['./navi.component.css'] 12 | }) 13 | export class NaviComponent implements OnInit { 14 | kontrol: any; 15 | constructor(private localStorageService: LocalStroageService, 16 | private router: Router, 17 | private authService: AuthService) { } 18 | 19 | ngOnInit(): void { 20 | 21 | this.kontrol = this.localStorageService.getItem("isauth"); 22 | 23 | } 24 | 25 | isAuth(): boolean { 26 | return this.authService.isAuthenticated(); 27 | } 28 | 29 | logout() { 30 | this.localStorageService.removeToken(); 31 | this.localStorageService.removeCurrentCustomer(); 32 | return this.router.navigate(["/login"]); 33 | } 34 | 35 | getCurrentCustomer(): Customer { 36 | return this.localStorageService.getCurrentCustomer(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.css: -------------------------------------------------------------------------------- 1 | input{ 2 | border-radius: 0; 3 | } 4 | 5 | input:focus{ 6 | box-shadow: none; 7 | border-color: #111; 8 | } 9 | 10 | button{ 11 | padding-right: 18px; 12 | padding-left: 18px; 13 | font-weight: bold; 14 | border-radius: 0; 15 | } -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 |
Fatura Bilgileri
6 | 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 | 33 | 34 | 35 | 36 | 37 |
Kullanıcı{{ getCurrentCustomer().firstName }} {{ getCurrentCustomer().lastName }}
Araba Marka/Model{{ carDetail.brandName }} {{carDetail.carName}}
Kiralama Tarihi{{rental.rentDate}}
Teslim Tarihi{{rental.returnDate}}
Total Price{{ calcTotalPrice() | currency:'₺ ' }}
38 |
39 |
40 |
41 | 42 |
43 |
44 |
Kart Bilgileri
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 | 78 | 81 |
82 |
83 | 84 |
85 |
86 |
87 |
88 |
89 | 90 |
91 |
92 | 93 | 94 | Kayıtlı Kartlarım 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 |
Kart IdKart NumarasıKart Üzerindeki AdKart SKTKart CVVKart Tipi
{{card.id}}{{card.cardNumber}}{{card.cardOnName}}{{card.cardValidDate}}{{card.cardCvv}}{{card.cardType}}
116 |
117 |
118 | 119 |
120 | -------------------------------------------------------------------------------- /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 { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import {Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Card } from 'src/app/models/card'; 6 | import { CarDetail } from 'src/app/models/carDetail/carDetail'; 7 | import { Customer } from 'src/app/models/customer/customer'; 8 | import { Rental } from 'src/app/models/rental/rental'; 9 | import { CarService } from 'src/app/services/car.service'; 10 | import { CardService } from 'src/app/services/card.service'; 11 | import { LocalStroageService } from 'src/app/services/local-stroage.service'; 12 | import { RentalService } from 'src/app/services/rental.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 | 21 | carDetail: CarDetail; 22 | paymentAddForm: FormGroup; 23 | cardAddForm:FormGroup; 24 | rental: Rental; 25 | card:Card; 26 | cards:Card[]; 27 | selectedCard:Card; 28 | saveUsername:boolean; 29 | 30 | constructor(private rentalService: RentalService, 31 | private carService: CarService, 32 | private localStorageService: LocalStroageService, 33 | private formBuilder: FormBuilder, 34 | private toastrService: ToastrService, 35 | private router: Router, 36 | private cardService:CardService 37 | ) { } 38 | 39 | ngOnInit(): void { 40 | this.getCurrentRental(); 41 | this.getCarDetailById(this.rentalService.getRentingCar().carId) 42 | this.getCardsByCustomerId(this.localStorageService.getCurrentCustomer().customerId); 43 | this.createPaymentAddForm(); 44 | } 45 | 46 | 47 | onSaveUsernameChanged(value:boolean){this.saveUsername = value;} 48 | 49 | 50 | createPaymentAddForm() { 51 | if(this.selectedCard){ 52 | this.paymentAddForm = this.formBuilder.group({ 53 | cardOnName: [this.selectedCard.cardOnName, Validators.required], 54 | cardNumber: [this.selectedCard.cardNumber, Validators.required], 55 | cardValidDate: [this.selectedCard.cardValidDate, Validators.required], 56 | cardCvv: [this.selectedCard.cardCvv, Validators.required], 57 | customerId:[this.localStorageService.getCurrentCustomer().customerId,Validators.required], 58 | cardType:["Visa"], 59 | }) 60 | } else { 61 | this.paymentAddForm = this.formBuilder.group({ 62 | cardOnName: ["", Validators.required], 63 | cardNumber: ["", Validators.required], 64 | cardValidDate: ["", Validators.required], 65 | cardCvv: [0, Validators.required], 66 | customerId:[this.localStorageService.getCurrentCustomer().customerId,Validators.required], 67 | cardType:["Visa"], 68 | }) 69 | } 70 | 71 | 72 | this.card=this.paymentAddForm.value;} 73 | 74 | cardAdd(){ 75 | if(this.paymentAddForm.valid){ 76 | let cardModel=this.paymentAddForm.value; 77 | this.cardService.addCard(cardModel).subscribe(responseSuccess=>{ 78 | this.toastrService.success("Kart Bilgileri Eklendi."); 79 | }, responseError=>{ 80 | console.log("Card Add Hatalı."); 81 | }) 82 | } 83 | else{this.toastrService.error("Hatalı Giriş Yaptınız!");} 84 | } 85 | 86 | 87 | 88 | 89 | pay() { 90 | debugger 91 | console.log("Merhaba Dünya"); 92 | 93 | this.rentalService.addRental(this.rental).subscribe(responseSuccess => { 94 | if(this.saveUsername==true){this.cardAdd();} 95 | this.toastrService.success(responseSuccess.message, "Kiralama başarılı") 96 | this.router.navigate(['/cars']); 97 | }, responseError => { 98 | console.log(responseError) 99 | this.toastrService.error(responseError.error.message,"Kiralama Başarısız"); 100 | }); 101 | } 102 | 103 | 104 | 105 | 106 | 107 | getCardsByCustomerId(customerId:number){ 108 | this.cardService.getCardsByCustomerId(customerId).subscribe(response=>{ 109 | this.cards=response.data; 110 | }) 111 | 112 | } 113 | 114 | setCurrentCard(id:number){ 115 | this.cardService.getCardById(id).subscribe(response=>{ 116 | this.selectedCard=response.data; 117 | this.localStorageService.setItem("activeCard",response.data.cardOnName); 118 | this.createPaymentAddForm(); 119 | console.log(this.selectedCard); 120 | }) 121 | } 122 | 123 | getCurrentCustomer(): Customer { return this.localStorageService.getCurrentCustomer(); } 124 | 125 | getCurrentRental() { this.rental = this.rentalService.getRentingCar(); } 126 | 127 | calcTotalPrice(): number { 128 | let rentDate = new Date(this.rental.rentDate) 129 | let returnDate = new Date(this.rental.returnDate) 130 | 131 | let rangeDay = this.getDiffBetweenDays(returnDate, rentDate) 132 | 133 | let totalPrice = rangeDay * this.carDetail.dailyPrice 134 | return totalPrice; 135 | } 136 | 137 | getDiffBetweenDays(rentDate: Date, returnDate: Date) { 138 | let MsOneDay = 1000 * 60 * 60 * 24; 139 | 140 | let dateOne = Date.UTC(rentDate.getFullYear(), rentDate.getMonth(), rentDate.getDay()) 141 | let dateTwo = Date.UTC(returnDate.getFullYear(), returnDate.getMonth(), returnDate.getDay()) 142 | 143 | return Math.floor((dateTwo - dateOne) / MsOneDay) 144 | } 145 | 146 | getCarDetailById(carId: number) { 147 | this.carService.getCarById(carId).subscribe(response => { 148 | this.carDetail = response.data; 149 | this.calcTotalPrice(); 150 | }); 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/register/register.component.css -------------------------------------------------------------------------------- /src/app/components/register/register.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
Kayıt Ol
6 |
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 |
33 | 34 |
35 | 36 |
37 |
38 |
39 |
40 | 41 |
42 | 43 |
44 |
45 |
46 |
-------------------------------------------------------------------------------- /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 { UserService } from 'src/app/services/user.service'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { AuthService } from 'src/app/services/auth.service'; 6 | import { CustomerService } from 'src/app/services/customer.service'; 7 | import { LocalStroageService } from 'src/app/services/local-stroage.service'; 8 | 9 | @Component({ 10 | selector: 'app-register', 11 | templateUrl: './register.component.html', 12 | styleUrls: ['./register.component.css'] 13 | }) 14 | export class RegisterComponent implements OnInit { 15 | 16 | registerForm:FormGroup; 17 | constructor( 18 | userService:UserService, 19 | private formBuilder:FormBuilder,private toastrService:ToastrService,private customerService:CustomerService,private authService:AuthService,private localStorageService:LocalStroageService) { } 20 | 21 | ngOnInit(): void {this.createRegisterForm();} 22 | 23 | createRegisterForm(){ 24 | this.registerForm=this.formBuilder.group({ 25 | firstName:["",Validators.required], 26 | lastName:["",Validators.required], 27 | email:["",Validators.required], 28 | password:["",Validators.required] 29 | }) 30 | } 31 | 32 | register(){ 33 | if(this.registerForm.valid){ 34 | let registerModel=Object.assign({},this.registerForm.value); 35 | 36 | this.authService.register(registerModel).subscribe(response=>{ 37 | this.toastrService.success(response.message); 38 | //localStorage.setItem("token",response.data.token); 39 | }, 40 | responseError=>{ 41 | console.log(responseError); 42 | this.toastrService.error(responseError.error); 43 | }) 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/app/components/rental-detail/rental-detail.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/rental-detail/rental-detail.component.css -------------------------------------------------------------------------------- /src/app/components/rental-detail/rental-detail.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
MarkaAdSoyad
{{rentalDetails.brandName}}{{rentalDetails.firstName}}{{rentalDetails.lastName}}
-------------------------------------------------------------------------------- /src/app/components/rental-detail/rental-detail.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RentalDetailComponent } from './rental-detail.component'; 4 | 5 | describe('RentalDetailComponent', () => { 6 | let component: RentalDetailComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ RentalDetailComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RentalDetailComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/rental-detail/rental-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { RentalDetail } from 'src/app/models/rentalDetail/rentalDetail'; 3 | import { RentalDetailService } from 'src/app/services/rental-detail.service'; 4 | 5 | @Component({ 6 | selector: 'app-rental-detail', 7 | templateUrl: './rental-detail.component.html', 8 | styleUrls: ['./rental-detail.component.css'] 9 | }) 10 | export class RentalDetailComponent implements OnInit { 11 | rentalDetails:RentalDetail[]=[]; 12 | constructor(private rentalDetailService:RentalDetailService) { } 13 | 14 | ngOnInit(): void { 15 | this.getRentalDetails(); 16 | } 17 | getRentalDetails(){ 18 | this.rentalDetailService.getRentalDetails().subscribe(response=>{ 19 | this.rentalDetails=response.data; 20 | }) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/rental/rental.component.css -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | 6 | 7 |
8 |
9 | 10 |
11 |
12 | 13 | 14 |
15 |
16 |
17 | 18 |
19 | 20 |
21 |
22 | 23 | 24 | 25 | 121 | 122 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ActivatedRoute, Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Customer } from 'src/app/models/customer/customer'; 6 | import { Rental } from 'src/app/models/rental/rental'; 7 | import { LocalStroageService } from 'src/app/services/local-stroage.service'; 8 | import { RentalService } from 'src/app/services/rental.service'; 9 | 10 | @Component({ 11 | selector: 'app-rental', 12 | templateUrl: './rental.component.html', 13 | styleUrls: ['./rental.component.css'], 14 | }) 15 | export class RentalComponent implements OnInit { 16 | 17 | rental: Rental; 18 | carId: number; 19 | addRentCarForm: FormGroup; 20 | currentDate: Date = new Date(); 21 | 22 | constructor( 23 | private formBuilder: FormBuilder, 24 | private activatedRoute: ActivatedRoute, 25 | private toastrService: ToastrService, 26 | private rentalService: RentalService, 27 | private router: Router, 28 | private localStorageService: LocalStroageService 29 | ) { } 30 | 31 | ngOnInit(): void { 32 | this.carId = Number(this.activatedRoute.snapshot.paramMap.get('carId')); 33 | localStorage.setItem("carId", String(this.activatedRoute.snapshot.paramMap.get('carId'))); 34 | this.createAddRentCarForm(); 35 | } 36 | 37 | createAddRentCarForm() { 38 | this.addRentCarForm = this.formBuilder.group({ 39 | carId: [this.carId, Validators.required], 40 | customerId: [this.localStorageService.getCurrentCustomer().customerId, Validators.required], 41 | rentDate: ['', Validators.required], 42 | returnDate: ['', Validators.required], 43 | }); 44 | } 45 | 46 | setRentingCar() { 47 | if (this.addRentCarForm.invalid) { 48 | this.toastrService.warning('Alanları kontrol ediniz', 'Dikkat'); 49 | return false; 50 | } 51 | 52 | this.rental = this.addRentCarForm.value; 53 | let rentDate = new Date(this.rental.rentDate); 54 | let returnDate = new Date(this.rental.returnDate); 55 | localStorage.setItem("rent", String(this.rental.rentDate)); 56 | 57 | if (rentDate < this.currentDate) { 58 | this.toastrService.warning( 59 | 'Kiralama Tarihi, bu günden sonraki günler olmalıdır', 60 | 'Dikkat' 61 | ); 62 | return false; 63 | } 64 | 65 | if (returnDate < rentDate || returnDate.getDate() == rentDate.getDate()) { 66 | return this.toastrService.warning('Dönüş Tarihi, kiralama tarihinden sonraki günler olmalıdır', 'Dikkat'); 67 | } 68 | 69 | this.rentalService.setRentingCar(this.rental); 70 | return this.router.navigate(['/payments']); 71 | } 72 | 73 | checkCarRentable() { 74 | this.rental = this.addRentCarForm.value; 75 | 76 | this.rentalService.getRentalsByCarId(this.carId).subscribe((responseSuccess) => { 77 | if (responseSuccess.data[0] == null) { 78 | this.setRentingCar(); 79 | return true; 80 | } 81 | 82 | let lastItem = responseSuccess.data[responseSuccess.data.length - 1]; 83 | 84 | if (lastItem.returnDate == null) { 85 | return this.toastrService.error('Bu araç henüz teslim edilmemiş'); 86 | } 87 | 88 | let returnDate = new Date(lastItem.returnDate); 89 | 90 | if (new Date(this.rental.rentDate) < returnDate) { 91 | return this.toastrService.warning('Bu aracı bu tarihler arasında kiralayamazsınız', 'Dikkat'); 92 | } 93 | 94 | return this.setRentingCar(); 95 | }); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/app/components/reset-password/reset-password.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/reset-password/reset-password.component.css -------------------------------------------------------------------------------- /src/app/components/reset-password/reset-password.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |

Şifremi Unuttum

7 | 8 | 9 | 10 |
11 |
12 |
13 |
14 | -------------------------------------------------------------------------------- /src/app/components/reset-password/reset-password.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ResetPasswordComponent } from './reset-password.component'; 4 | 5 | describe('ResetPasswordComponent', () => { 6 | let component: ResetPasswordComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ResetPasswordComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ResetPasswordComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/reset-password/reset-password.component.ts: -------------------------------------------------------------------------------- 1 | import { ToastrService } from 'ngx-toastr'; 2 | import { Email } from './../../models/email'; 3 | import { UserService } from 'src/app/services/user.service'; 4 | import { Component, OnInit } from '@angular/core'; 5 | 6 | @Component({ 7 | selector: 'app-reset-password', 8 | templateUrl: './reset-password.component.html', 9 | styleUrls: ['./reset-password.component.css'] 10 | }) 11 | export class ResetPasswordComponent implements OnInit { 12 | 13 | constructor(private UserService:UserService,private toastrService:ToastrService) { } 14 | 15 | ngOnInit(): void { 16 | } 17 | 18 | passwordReset(value:string){ 19 | if(value.length<=0){return this.toastrService.warning("Lüfen alanı doldurun.")} 20 | return this.UserService.sendPasswordResetMail(value).subscribe((response=>{ 21 | return this.toastrService.success(response.message) 22 | 23 | })); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/app/components/update-password/update-password.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/update-password/update-password.component.css -------------------------------------------------------------------------------- /src/app/components/update-password/update-password.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | 6 |
7 | 8 |
9 | 10 |
11 | 12 |
13 | 14 |
15 | 16 |
17 | 18 | 20 |
21 | 22 |
23 | 24 |
25 | 26 |
27 |
28 |
29 |
30 | 31 | -------------------------------------------------------------------------------- /src/app/components/update-password/update-password.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { UpdatePasswordComponent } from './update-password.component'; 4 | 5 | describe('UpdatePasswordComponent', () => { 6 | let component: UpdatePasswordComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ UpdatePasswordComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(UpdatePasswordComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/update-password/update-password.component.ts: -------------------------------------------------------------------------------- 1 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 2 | import { UserService } from 'src/app/services/user.service'; 3 | import { ConfirmPasswordResetDto } from './../../models/confirm-password-reset-dto'; 4 | import { PasswordChange } from './../../models/passwordChange'; 5 | import { ActivatedRoute, Route, Router } from '@angular/router'; 6 | import { PasswordResetDto } from './../../models/password-reset-dto'; 7 | import { Component, OnInit } from '@angular/core'; 8 | import { identifierModuleUrl } from '@angular/compiler'; 9 | import { AuthService } from 'src/app/services/auth.service'; 10 | import { ToastrService } from 'ngx-toastr'; 11 | 12 | @Component({ 13 | selector: 'app-update-password', 14 | templateUrl: './update-password.component.html', 15 | styleUrls: ['./update-password.component.css'] 16 | }) 17 | export class UpdatePasswordComponent implements OnInit { 18 | 19 | 20 | avaliable: boolean = false; 21 | confirmPasswordResetDto: ConfirmPasswordResetDto = {} as ConfirmPasswordResetDto; 22 | passwordResetDto: PasswordResetDto = {} as PasswordResetDto; 23 | changePasswordForm: FormGroup; 24 | 25 | constructor( 26 | private authService: AuthService, 27 | private formBuilder: FormBuilder, 28 | private toastrService: ToastrService, 29 | private activatedRoute: ActivatedRoute, 30 | private router:Router, 31 | private userService: UserService) { } 32 | 33 | 34 | ngOnInit(): void { 35 | this.activatedRoute.queryParams.subscribe((params) => { 36 | if (params['userId'] && params['code']) { 37 | this.confirmPasswordResetDto.code = params['code']; 38 | this.confirmPasswordResetDto.userId = params['userId']; 39 | this.userService.confirmPasswordResetDto(this.confirmPasswordResetDto).subscribe(response => { 40 | console.log(response.success); 41 | if (response.success == true) { 42 | this.createResetPasswordForm(); 43 | this.avaliable = true; 44 | this.passwordResetDto.code = params['code']; 45 | this.passwordResetDto.userId = params['userId']; 46 | this.passwordResetDto.newPassword = "asd"; 47 | } 48 | }); 49 | } 50 | }); 51 | 52 | } 53 | 54 | 55 | createResetPasswordForm() { 56 | this.changePasswordForm = this.formBuilder.group({ 57 | password: ["", Validators.required], 58 | rePassword: ["", Validators.required], 59 | }) 60 | } 61 | updatePassword() { 62 | let resetModel = Object.assign({}, this.changePasswordForm.value); 63 | if (this.changePasswordForm.valid) { 64 | if (resetModel.password!=resetModel.rePassword) { 65 | this.toastrService.error("Şifreler Uyuşmuyor."); 66 | } 67 | else { 68 | this.passwordResetDto.code = this.confirmPasswordResetDto.code; 69 | this.passwordResetDto.userId = this.confirmPasswordResetDto.userId; 70 | this.passwordResetDto.newPassword = resetModel.password; 71 | 72 | this.authService.passwordReset(this.passwordResetDto).subscribe( 73 | (response) => { 74 | this.toastrService.success(response.message); 75 | return this.router.navigate(['/login']); 76 | 77 | 78 | }, 79 | responseError => { 80 | console.log(responseError.error); 81 | if (responseError.error.Errors.length > 0) { 82 | console.log(responseError.error.Errors); 83 | for (let i = 0; i < responseError.error.Errors.length; i++) { 84 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage, "Doğrulama Başarısız"); 85 | } 86 | } 87 | }) 88 | } 89 | 90 | 91 | 92 | } 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /src/app/components/user-profile/user-profile.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/app/components/user-profile/user-profile.component.css -------------------------------------------------------------------------------- /src/app/components/user-profile/user-profile.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |

Kullanıcı Güncelle

7 |
8 |
9 |
10 | 11 |
12 | 13 |
14 | 16 |
17 |
18 | 19 |
20 | 21 |
22 | 24 |
25 |
26 | 27 | 28 |
29 | 30 |
31 | 33 |
34 |
35 | 36 |
37 | 38 | 39 | 40 |
41 | 42 |
43 | 44 |
45 |
46 |
47 | 48 | 49 |
50 |
51 |
52 |

Müşteri Güncelle

53 |
54 |
55 |
56 | 57 |
58 | 59 |
60 | 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 |

Şifre Güncelle

89 |
90 |
91 |
92 | 93 |
94 | 95 |
96 | 98 |
99 |
100 | 101 |
102 | 103 |
104 | 105 |
106 |
107 | 108 | 109 | 110 | 111 |
112 |
113 |
114 |
115 | 116 | 117 |
-------------------------------------------------------------------------------- /src/app/components/user-profile/user-profile.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { UserProfileComponent } from './user-profile.component'; 4 | 5 | describe('UserProfileComponent', () => { 6 | let component: UserProfileComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ UserProfileComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(UserProfileComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/user-profile/user-profile.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Customer } from 'src/app/models/customer/customer'; 6 | import { CustomerDetails } from 'src/app/models/customerDetails/customerDetails'; 7 | import { AuthService } from 'src/app/services/auth.service'; 8 | import { CustomerService } from 'src/app/services/customer.service'; 9 | import { LocalStroageService } from 'src/app/services/local-stroage.service'; 10 | import { UserService } from 'src/app/services/user.service'; 11 | 12 | @Component({ 13 | selector: 'app-user-profile', 14 | templateUrl: './user-profile.component.html', 15 | styleUrls: ['./user-profile.component.css'] 16 | }) 17 | export class UserProfileComponent implements OnInit { 18 | 19 | userUpdateForm:FormGroup; 20 | customerUpdateForm:FormGroup; 21 | passwordChangeForm:FormGroup; 22 | customerDetail:CustomerDetails; 23 | customer:Customer; 24 | total:number=0; 25 | constructor(private formBuilder:FormBuilder, 26 | private customerService:CustomerService, 27 | private toastrService:ToastrService, 28 | private localStorageService:LocalStroageService, 29 | private userService:UserService, 30 | private router:Router, 31 | private authService:AuthService) { } 32 | 33 | 34 | ngOnInit(): void { 35 | this.customer= this.localStorageService.getCurrentCustomer(); 36 | this.createUserUpdateForm(); 37 | this.createCustomerUpdateForm(); 38 | this.createPasswordChangeForm(); 39 | 40 | } 41 | 42 | getCustomerByEmail(email:string){ 43 | this.customerService.getCustomerByEmail(email).subscribe(response=>{ 44 | this.customerDetail=response.data; 45 | 46 | console.log(response.data); 47 | }) 48 | } 49 | 50 | ///////////////////////////////////////////////////////////// 51 | createUserUpdateForm(){ 52 | this.userUpdateForm=this.formBuilder.group({ 53 | firstName:[ this.customer.firstName,Validators.required], 54 | lastName:[this.customer.lastName,Validators.required], 55 | email:[this.customer.email,Validators.required], 56 | }) 57 | } 58 | 59 | userUpdate(){ 60 | if(this.userUpdateForm.valid){ 61 | let userModel=Object.assign({},this.userUpdateForm.value); 62 | userModel.id=this.customer.userId; 63 | this.userService.updateInfos(userModel).subscribe(response=>{ 64 | return this.toastrService.success("Güncellendi.") 65 | }, 66 | responseError=>{ 67 | console.log(responseError); 68 | this.toastrService.error(responseError); 69 | this.toastrService.error(responseError.error,"Hatalı İşlem"); 70 | } 71 | ) 72 | } 73 | } 74 | ///////////////////////////////////////////////////////////////// 75 | createCustomerUpdateForm(){ 76 | this.customerUpdateForm=this.formBuilder.group({ 77 | companyName:[this.customer.companyName], 78 | customerFindexPoint:[this.customer.customerFindexPoint] 79 | }) 80 | } 81 | 82 | customerUpdate(){ 83 | if(this.customerUpdateForm.valid){ 84 | let customerModel=Object.assign({},this.customerUpdateForm.value); 85 | customerModel.customerId=this.customer.customerId; 86 | customerModel.userId=this.customer.userId; 87 | if(this.total!=0){customerModel.customerFindexPoint=this.total} 88 | 89 | this.customerService.customerUpdate(customerModel).subscribe(responseSuccess=>{ 90 | return this.toastrService.success("Güncellendi."); 91 | },responseError=>{ 92 | this.toastrService.error("Hatalı İşlem"); 93 | }) 94 | } 95 | } 96 | 97 | calcFindexPoint(min:number=1, max:number=1900) { 98 | min = Math.ceil(min); 99 | max = Math.floor(max); 100 | this.total =Math.floor(Math.random() * (max - min + 1) + min); 101 | return this.toastrService.success("Findex Puanım: "+this.total); 102 | } 103 | //////////////////////////////////////// 104 | 105 | 106 | createPasswordChangeForm(){ 107 | this.passwordChangeForm=this.formBuilder.group({ 108 | oldPassword:["",Validators.required], 109 | newPassword:["",Validators.required], 110 | }) 111 | } 112 | 113 | passwordChange(){ 114 | if(this.passwordChangeForm.valid){ 115 | let passwordChangeModel=Object.assign({},this.passwordChangeForm.value); 116 | passwordChangeModel.userId=this.customer.userId; 117 | this.authService.passwordChange(passwordChangeModel).subscribe(responseSuccess=>{ 118 | this.toastrService.success("Parola Değiştirildi."); 119 | },responseError=>{ 120 | console.log(responseError.error); 121 | if(responseError.error.Errors.length>0){ 122 | console.log(responseError.error.Errors); 123 | for(let i=0; i | Promise | boolean | UrlTree { 17 | 18 | if(this.authService.isAuthenticated()){ return true;} 19 | else {this.router.navigate(["login"]); this.toastrService.info("Sisteme giriş yapmalısınız."); return false;} 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/app/interceptor/auth.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { 3 | HttpRequest, 4 | HttpHandler, 5 | HttpEvent, 6 | HttpInterceptor 7 | } from '@angular/common/http'; 8 | import { Observable } from 'rxjs'; 9 | import { ColorService } from '../services/color.service'; 10 | 11 | @Injectable() 12 | export class AuthInterceptor implements HttpInterceptor { 13 | 14 | constructor(private colorService:ColorService) {} 15 | 16 | 17 | intercept(request: HttpRequest, next: HttpHandler): Observable> { 18 | let token=localStorage.getItem("token"); 19 | let newRequest:HttpRequest; 20 | newRequest=request.clone({ 21 | headers:request.headers.set("Authorization","Bearer "+token) 22 | }) 23 | return next.handle(newRequest); 24 | } 25 | } -------------------------------------------------------------------------------- /src/app/models/brand/brand.ts: -------------------------------------------------------------------------------- 1 | export interface Brand{ 2 | brandName:string; 3 | brandId:number; 4 | } -------------------------------------------------------------------------------- /src/app/models/car/car.ts: -------------------------------------------------------------------------------- 1 | export interface Car{ 2 | id:number; 3 | brandId:number; 4 | colorId:number; 5 | carName:string; 6 | modelYear:number; 7 | dailyPrice:number; 8 | description:string; 9 | carId:number; 10 | carFindexPoint:number; 11 | //imagePath:string; 12 | } -------------------------------------------------------------------------------- /src/app/models/carDetail/carDetail.ts: -------------------------------------------------------------------------------- 1 | export interface CarDetail{ 2 | id:number; 3 | carName:string; 4 | brandName:string; 5 | colorName:string; 6 | description: string 7 | dailyPrice:number; 8 | modelYear:number; 9 | carId:number; 10 | colorId:number; 11 | brandId:number; 12 | imagePath:string; 13 | carFindexPoint:number; 14 | 15 | } -------------------------------------------------------------------------------- /src/app/models/carImage/carImage.ts: -------------------------------------------------------------------------------- 1 | export interface CarImage{ 2 | id:number; 3 | carId:number; 4 | imagePath:string; 5 | date:Date; 6 | } -------------------------------------------------------------------------------- /src/app/models/card.ts: -------------------------------------------------------------------------------- 1 | export interface Card{ 2 | id:number; 3 | cardNumber:string; 4 | cardOnName:string; 5 | cardValidDate:string; 6 | cardCvv:number; 7 | customerId:number; 8 | cardType:string; 9 | } -------------------------------------------------------------------------------- /src/app/models/color/color.ts: -------------------------------------------------------------------------------- 1 | export interface Color{ 2 | colorId:number; 3 | colorName:string; 4 | colorCode:string; 5 | } 6 | 7 | -------------------------------------------------------------------------------- /src/app/models/confirm-password-reset-dto.ts: -------------------------------------------------------------------------------- 1 | export interface ConfirmPasswordResetDto{ 2 | userId:number; 3 | code:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/customer/customer.ts: -------------------------------------------------------------------------------- 1 | export interface Customer{ 2 | userId:number; 3 | customerId:number; 4 | companyName:string; 5 | firstName:string; 6 | lastName:string; 7 | email:string; 8 | customerFindexPoint:number; 9 | } -------------------------------------------------------------------------------- /src/app/models/customerDetails/customerDetails.ts: -------------------------------------------------------------------------------- 1 | export interface CustomerDetails { 2 | customerId: number; 3 | userId: number; 4 | companyName: string; 5 | firstName: string; 6 | lastName: string; 7 | email: string; 8 | status:boolean; 9 | passwordHash: string; 10 | passwordSalt: string; 11 | customerFindexPoint:number; 12 | } -------------------------------------------------------------------------------- /src/app/models/email.ts: -------------------------------------------------------------------------------- 1 | export interface Email{ 2 | emailAddress:string; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/models/listResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./responseModel"; 2 | 3 | export interface ListResponseModel extends ResponseModel{ 4 | data:T[]; 5 | 6 | } -------------------------------------------------------------------------------- /src/app/models/loginModel.ts: -------------------------------------------------------------------------------- 1 | export interface LoginModel{ 2 | email:String; 3 | password:String; 4 | } -------------------------------------------------------------------------------- /src/app/models/password-reset-dto.ts: -------------------------------------------------------------------------------- 1 | export interface PasswordResetDto{ 2 | userId:number; 3 | code:string; 4 | newPassword:string; 5 | } -------------------------------------------------------------------------------- /src/app/models/passwordChange.ts: -------------------------------------------------------------------------------- 1 | export interface PasswordChange{ 2 | userId:number; 3 | oldPassword:string; 4 | newPassword:string; 5 | 6 | } -------------------------------------------------------------------------------- /src/app/models/registerModel.ts: -------------------------------------------------------------------------------- 1 | export interface RegisterModel{ 2 | firstName:string; 3 | lastName:string; 4 | email:string; 5 | password:String; 6 | } -------------------------------------------------------------------------------- /src/app/models/rental/rental.ts: -------------------------------------------------------------------------------- 1 | export interface Rental{ 2 | id:number; 3 | carId:number; 4 | customerId:number; 5 | rentDate:Date; 6 | returnDate:Date; 7 | paymentId:number; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /src/app/models/rentalDetail/rentalDetail.ts: -------------------------------------------------------------------------------- 1 | export interface RentalDetail{ 2 | brandName:string; 3 | firstName:string; 4 | lastName:string; 5 | rentalId:number; 6 | rentDate:Date 7 | returnDate:Date 8 | companyName:string; 9 | colorName:string; 10 | carDescription:string; 11 | modelYear:number; 12 | dailyPrice:number; 13 | carFindexPoint:number; 14 | customerFindexPoint:number; 15 | carName:string; 16 | 17 | 18 | } -------------------------------------------------------------------------------- /src/app/models/responseModel.ts: -------------------------------------------------------------------------------- 1 | export interface ResponseModel{ 2 | success:Boolean; 3 | message:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/singleResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from './responseModel'; 2 | 3 | export interface SingleResponseModel extends ResponseModel { 4 | data: T 5 | } -------------------------------------------------------------------------------- /src/app/models/tokenModel.ts: -------------------------------------------------------------------------------- 1 | export interface TokenModel{ 2 | token:string; 3 | expiration:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/user.ts: -------------------------------------------------------------------------------- 1 | export interface User{ 2 | id:number; 3 | firstName:string; 4 | lastName:string; 5 | email:string; 6 | } 7 | -------------------------------------------------------------------------------- /src/app/pipes/brand-pipe.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { Brand } from '../models/brand/brand'; 3 | 4 | @Pipe({ 5 | name: 'brandPipe' 6 | }) 7 | export class BrandPipePipe implements PipeTransform { 8 | 9 | transform(value: Brand[], filterText: string): Brand[] { 10 | 11 | filterText=filterText?filterText.toLocaleLowerCase():"" 12 | return filterText?value 13 | .filter((p:Brand)=>p.brandName 14 | .toLocaleLowerCase().indexOf(filterText)!==-1) 15 | :value; 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/app/pipes/color-pipe.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { Color } from '../models/color/color'; 3 | 4 | @Pipe({ 5 | name: 'colorPipe' 6 | }) 7 | export class ColorPipePipe implements PipeTransform { 8 | 9 | transform(value: Color[], filterText: string): Color[] { 10 | 11 | filterText=filterText?filterText.toLocaleLowerCase():"" 12 | return filterText?value 13 | .filter((p:Color)=>p.colorName.toLocaleLowerCase().indexOf(filterText)!==-1) 14 | :value; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/app/pipes/filter-text.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { CarDetail } from '../models/carDetail/carDetail'; 3 | 4 | @Pipe({ 5 | name: 'filterPipe' 6 | }) 7 | export class FilterTextPipe implements PipeTransform { 8 | 9 | transform(value: CarDetail[], filterText: string): CarDetail[] { 10 | 11 | filterText=filterText?filterText.toLocaleLowerCase():"" 12 | return filterText?value 13 | .filter((p:CarDetail)=>p.carName 14 | .toLocaleLowerCase().indexOf(filterText)!==-1) 15 | :value; 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/app/pipes/vat-added.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({ 4 | name: 'vatAdded' 5 | }) 6 | export class VatAddedPipe implements PipeTransform { 7 | 8 | transform(value: number, rate:number): number { 9 | let newPrice=value+(value*rate/100); 10 | return newPrice; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/app/services/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from 'src/app/models/responseModel'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Injectable } from '@angular/core'; 4 | import { Observable } from 'rxjs'; 5 | import { environment } from 'src/environments/environment'; 6 | import { LoginModel } from '../models/loginModel'; 7 | import { PasswordChange } from '../models/passwordChange'; 8 | import { RegisterModel } from '../models/registerModel'; 9 | import { SingleResponseModel } from '../models/singleResponseModel'; 10 | import { TokenModel } from '../models/tokenModel'; 11 | import { LocalStroageService } from './local-stroage.service'; 12 | import { PasswordResetDto } from '../models/password-reset-dto'; 13 | 14 | @Injectable({ 15 | providedIn: 'root' 16 | }) 17 | export class AuthService { 18 | 19 | constructor(private httpClient:HttpClient, private localStorageService: LocalStroageService) { } 20 | 21 | apiUrl=environment.apiUrl+"Auth/"; 22 | 23 | 24 | 25 | login(user:LoginModel):Observable>{ 26 | let newPath=this.apiUrl+"login"; 27 | return this.httpClient.post>(newPath,user); 28 | } 29 | 30 | isAuthenticated(): boolean{ 31 | if(this.localStorageService.getToken()){return true;} 32 | else{return false;} 33 | } 34 | 35 | register(user:RegisterModel):Observable>{ 36 | let newPath=this.apiUrl+"register"; 37 | return this.httpClient.post>(newPath,user); 38 | } 39 | 40 | passwordChange(userPassword:PasswordChange):Observable>{ 41 | let newPath=this.apiUrl+"changepassword"; 42 | return this.httpClient.put>(newPath,userPassword); 43 | } 44 | 45 | 46 | passwordReset(resetPassword:PasswordResetDto):Observable{ 47 | let newPath=this.apiUrl+"password-reset"; 48 | return this.httpClient.post(newPath,resetPassword); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/app/services/brand.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Brand } from 'src/app/models/brand/brand'; 5 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 6 | import { ResponseModel } from 'src/app/models/responseModel'; 7 | import { SingleResponseModel } from 'src/app/models/singleResponseModel'; 8 | import { environment } from 'src/environments/environment'; 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class BrandService { 14 | apiUrl=environment.apiUrl+"brands/"; 15 | 16 | 17 | constructor(private httpClient:HttpClient) { } 18 | 19 | getBrands():Observable>{ 20 | let newPath=this.apiUrl+"getall"; 21 | return this.httpClient.get>(newPath); 22 | } 23 | 24 | addBrand(brand:Brand):Observable{ 25 | let newPath=this.apiUrl+"addbrand"; 26 | return this.httpClient.post(newPath,brand); 27 | } 28 | 29 | getBrandById(brandId:number):Observable>{ 30 | let newPath=this.apiUrl+"getbrandbyid?brandId="+brandId; 31 | return this.httpClient.get>(newPath); 32 | } 33 | 34 | updateBrand(brand:Brand):Observable{ 35 | let newPath=this.apiUrl+"updatebrand"; 36 | return this.httpClient.put(newPath,brand); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/app/services/car-image.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { environment } from 'src/environments/environment'; 5 | import { CarImage } from '../models/carImage/carImage'; 6 | import { ListResponseModel } from '../models/listResponseModel'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class CarImageService { 12 | apiUrl=environment.apiUrl+""; 13 | 14 | 15 | constructor(private httpClient : HttpClient) { } 16 | 17 | getImagesByCarId(carId:number):Observable>{ 18 | let newPath = this.apiUrl + "carimages/getbycarid?id="+carId; 19 | return this.httpClient.get>(newPath); 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/app/services/car.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Car } from 'src/app/models/car/car'; 5 | import { CarDetail } from 'src/app/models/carDetail/carDetail'; 6 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 7 | import { ResponseModel } from 'src/app/models/responseModel'; 8 | import { SingleResponseModel } from 'src/app/models/singleResponseModel'; 9 | import { environment } from 'src/environments/environment'; 10 | 11 | @Injectable({ 12 | providedIn: 'root' 13 | }) 14 | export class CarService { 15 | apiUrl=environment.apiUrl; 16 | 17 | 18 | 19 | constructor(private httpClient:HttpClient) { } 20 | 21 | getCars():Observable>{ 22 | let newPath=this.apiUrl+"cars/getcardetail"; 23 | return this.httpClient.get>(newPath); 24 | } 25 | 26 | getCarsTwo():Observable>{ 27 | let newPath=this.apiUrl+"cars/getall"; 28 | return this.httpClient.get>(newPath); 29 | } 30 | 31 | getCarById(carId:number):Observable>{ 32 | let newPath=this.apiUrl+"cars/getdetailsbycarid?id="+carId; 33 | return this.httpClient.get>(newPath); 34 | } 35 | 36 | 37 | 38 | getCarsByBrandId(brandId:number):Observable>{ 39 | let newPath=this.apiUrl+"cars/getcardetailsbybrand?brandId="+brandId; 40 | return this.httpClient.get>(newPath); 41 | } 42 | 43 | // getCarDetail(){} 44 | 45 | getCarsByColorId(colorId:number):Observable>{ 46 | let newPath=this.apiUrl+"cars/getcardetailsbycolor?colorId="+colorId; 47 | return this.httpClient.get>(newPath); 48 | } 49 | 50 | getCarsByBrandAndColorId(brandId:number,colorId:number):Observable>{ 51 | let newPath=this.apiUrl+"cars/getcardetailsbybrandandcolor?brandId="+brandId+"&colorId="+colorId; 52 | return this.httpClient.get>(newPath); 53 | } 54 | 55 | getCarsDetail():Observable>{ 56 | let newPath=this.apiUrl+"cars/getcardetail"; 57 | return this.httpClient.get>(newPath); 58 | } 59 | 60 | addCar(car:Car):Observable{ 61 | let newPath=this.apiUrl+"cars/addcar"; 62 | console.log(car); 63 | return this.httpClient.post(newPath,car); 64 | } 65 | 66 | updateCar(car:Car):Observable{ 67 | let newPath=this.apiUrl+"cars/updatecar"; 68 | return this.httpClient.put(newPath,car); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/app/services/card.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable} from 'rxjs'; 4 | import { environment } from 'src/environments/environment'; 5 | import { Card } from '../models/card'; 6 | import { ListResponseModel } from '../models/listResponseModel'; 7 | import { ResponseModel } from '../models/responseModel'; 8 | import { SingleResponseModel } from '../models/singleResponseModel'; 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class CardService { 14 | 15 | apiUrl=environment.apiUrl+"cards/"; 16 | 17 | constructor(private httpClient:HttpClient) { } 18 | 19 | getAllCards():Observable>{let newPath=this.apiUrl+"getall"; return this.httpClient.get>(newPath);} 20 | 21 | addCard(card:Card):Observable {let newPath=this.apiUrl+"addcard"; return this.httpClient.post(newPath,card);} 22 | 23 | updateCard(card:Card):Observable {let newPath=this.apiUrl+"updatecard"; return this.httpClient.post(newPath,card);} 24 | 25 | deleteCard(card:Card):Observable {let newPath=this.apiUrl+"deletecard"; return this.httpClient.post(newPath,card);} 26 | 27 | getCardsByCustomerId(customerId:number):Observable>{let newPath=this.apiUrl+"getcardsbycustomerid?customerid="+customerId; 28 | return this.httpClient.get>(newPath);} 29 | 30 | getCardById(cardId:number):Observable>{let newPath=this.apiUrl+"getcardbyid?cardid="+cardId; return this.httpClient.get>(newPath);} 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/app/services/color.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import {Injectable } from '@angular/core'; 3 | import { Observable} from 'rxjs'; 4 | import { Color } from 'src/app/models/color/color'; 5 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 6 | import { ResponseModel } from 'src/app/models/responseModel'; 7 | import { SingleResponseModel } from 'src/app/models/singleResponseModel'; 8 | import { environment } from 'src/environments/environment'; 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class ColorService { 14 | 15 | apiUrl=environment.apiUrl+"colors/"; 16 | 17 | colors:Color[]; 18 | 19 | constructor(private httpClient:HttpClient) { } 20 | 21 | // "color": [ 22 | // { 23 | // "colorName": "Turuncu" 24 | // }, 25 | // { 26 | // "colorName": "Mavi" 27 | // } 28 | // ] 29 | 30 | 31 | getColors():Observable>{ 32 | let newPath=this.apiUrl+"getall"; 33 | return this.httpClient.get>(newPath); 34 | } 35 | 36 | addColor(color:Color):Observable{ 37 | let newPath=this.apiUrl+"addcolor"; 38 | return this.httpClient.post(newPath,color); 39 | 40 | } 41 | 42 | updateColor(color:Color):Observable{ 43 | let newPath=this.apiUrl+"updatecolor"; 44 | return this.httpClient.put(newPath,color); 45 | } 46 | 47 | getColorById(colorId:number):Observable>{ 48 | let newPath=this.apiUrl+"getcolorbyid?colorId="+colorId; 49 | return this.httpClient.get>(newPath); 50 | } 51 | 52 | // addColor():Observable>{ 53 | // let newPath=this.apiUrl+"addcolor"; 54 | // const color = { 'content-type': 'application/json'} 55 | // const body=JSON.stringify(this.color); 56 | // console.log(body); 57 | // return this.httpClient.post>( 58 | // newPath+"color",body{"color":color }); 59 | // } 60 | } 61 | -------------------------------------------------------------------------------- /src/app/services/customer.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { RecursiveTemplateAstVisitor } from '@angular/compiler'; 3 | import { Injectable } from '@angular/core'; 4 | import { Observable } from 'rxjs'; 5 | import { Customer } from 'src/app/models/customer/customer'; 6 | import { CustomerDetails } from 'src/app/models/customerDetails/customerDetails'; 7 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 8 | import { ResponseModel } from 'src/app/models/responseModel'; 9 | import { SingleResponseModel } from 'src/app/models/singleResponseModel'; 10 | import { environment } from 'src/environments/environment'; 11 | 12 | @Injectable({ 13 | providedIn: 'root' 14 | }) 15 | export class CustomerService { 16 | 17 | apiUrl=environment.apiUrl+"customers/"; 18 | 19 | 20 | currentCustomer:CustomerDetails; 21 | 22 | 23 | constructor(private httpClient:HttpClient) { } 24 | 25 | getCustomers():Observable>{ 26 | let newPath=this.apiUrl+"getall"; 27 | return this.httpClient.get>(newPath); 28 | } 29 | 30 | getCustomerDetails():Observable>{ 31 | let newPath=this.apiUrl+"getcustomerdetails"; 32 | return this.httpClient.get>(newPath); 33 | 34 | } 35 | getCustomerById(customerId:number):Observable>{ 36 | let newPath=this.apiUrl+"getcustomerdetailbyid?customerId="+customerId; 37 | return this.httpClient.get>(newPath); 38 | } 39 | 40 | setCustomer(customer:CustomerDetails){ 41 | this.currentCustomer=customer; 42 | } 43 | 44 | getCustomer():CustomerDetails{ 45 | return this.currentCustomer; 46 | } 47 | getCustomerByEmail(email:string):Observable>{ 48 | let newPath=this.apiUrl+"getcustomerbyemail?email="+email; 49 | return this.httpClient.get>(newPath); 50 | } 51 | 52 | customerUpdate(customer:Customer):Observable{ 53 | let newPath="https://localhost:44342/api/customers/updatecustomer"; 54 | return this.httpClient.put(newPath,customer); 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/app/services/local-stroage.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Customer } from '../models/customer/customer'; 3 | import { TokenModel } from '../models/tokenModel'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class LocalStroageService { 9 | 10 | currentCustomer: string = 'currentCustomer'; 11 | tokenKey = "token" 12 | 13 | //token:string; 14 | 15 | constructor() { 16 | } 17 | 18 | //getItem(key:string):TokenModel{return JSON.parse(localStorage.getItem(key));} 19 | 20 | //setItem(key:string,token:TokenModel){localStorage.setItem(this.token,JSON.stringify(token));} 21 | 22 | //setItem(key:string,tokenModel:TokenModel){localStorage.setItem(key,tokenModel.token);} 23 | 24 | 25 | setItem(key:string,value:any){localStorage.setItem(key,value);} 26 | getItem(key:string){return localStorage.getItem(key);} 27 | deleteItem(key:string){localStorage.removeItem(key);} 28 | clear(){localStorage.clear();} 29 | 30 | get isLocalStorageSupported(): boolean {return !!localStorage} 31 | 32 | getCurrentCustomer():Customer{ 33 | return JSON.parse(localStorage.getItem(this.currentCustomer)); 34 | } 35 | 36 | setCurrentCustomer(customer:Customer){ 37 | localStorage.setItem(this.currentCustomer,JSON.stringify(customer)); 38 | } 39 | 40 | removeCurrentCustomer(){ 41 | localStorage.removeItem(this.currentCustomer); 42 | } 43 | 44 | setToken(token: string){ 45 | localStorage.setItem(this.tokenKey, token); 46 | } 47 | 48 | getToken(){ 49 | return localStorage.getItem(this.tokenKey) 50 | } 51 | 52 | removeToken(){ 53 | localStorage.removeItem(this.tokenKey) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/app/services/rental-detail.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 5 | import { RentalDetail } from 'src/app/models/rentalDetail/rentalDetail'; 6 | import { environment } from 'src/environments/environment'; 7 | @Injectable({ 8 | providedIn: 'root', 9 | }) 10 | export class RentalDetailService { 11 | apiUrl=environment.apiUrl+"Rentals/"; 12 | 13 | constructor(private httpClient: HttpClient) {} 14 | 15 | getRentalDetails(): Observable> { 16 | let newPath=this.apiUrl+"rentalstwo" 17 | return this.httpClient.get>(this.apiUrl); 18 | } 19 | 20 | getRentalDetailsByCustomer(customerId:number): Observable> { 21 | let newPath=this.apiUrl+"getrentalsbycustomer?customerId="+customerId; 22 | return this.httpClient.get>(newPath); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/app/services/rental.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 5 | import { Rental } from 'src/app/models/rental/rental'; 6 | import { ResponseModel } from 'src/app/models/responseModel'; 7 | import { environment } from 'src/environments/environment'; 8 | 9 | @Injectable({ 10 | providedIn: 'root', 11 | }) 12 | 13 | export class RentalService { 14 | 15 | apiUrl=environment.apiUrl+"rentals/"; 16 | 17 | 18 | 19 | rentingCar: Rental; 20 | 21 | constructor(private httpClient: HttpClient) { 22 | this.getRentals(); 23 | } 24 | 25 | getRentals(): Observable> { 26 | let newPath = this.apiUrl + 'getall'; 27 | return this.httpClient.get>(newPath); 28 | } 29 | 30 | addRental(rental: Rental): Observable> { 31 | let newPath = this.apiUrl + 'addrental'; 32 | return this.httpClient.post>(newPath,rental); 33 | } 34 | 35 | checkCarStatus(rental: Rental): Observable { 36 | let newPath = this.apiUrl + 'checkcarstatus'; 37 | return this.httpClient.post(newPath, rental); 38 | } 39 | 40 | add(rental: Rental): Observable { 41 | let newPath = this.apiUrl + 'add'; 42 | return this.httpClient.post(newPath, rental); 43 | } 44 | 45 | getRentalsByCarId(carId: number): Observable> { 46 | let newPath = this.apiUrl + 'getrentalsbycarid?carId=' + carId; 47 | return this.httpClient.get>(newPath); 48 | } 49 | 50 | getRentalById(rentalId: number): Observable> { 51 | let newPath = this.apiUrl + 'getrentalbyid?rentalId=' + rentalId; 52 | return this.httpClient.get>(newPath); 53 | } 54 | 55 | setRentingCar(rental: Rental) { 56 | this.rentingCar = rental; 57 | } 58 | 59 | getRentingCar() { 60 | return this.rentingCar; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/app/services/user.service.ts: -------------------------------------------------------------------------------- 1 | import { ConfirmPasswordResetDto } from './../models/confirm-password-reset-dto'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Injectable } from '@angular/core'; 4 | import { Observable } from 'rxjs'; 5 | import { environment } from 'src/environments/environment'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | import { SingleResponseModel } from '../models/singleResponseModel'; 8 | import { User } from '../models/user'; 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class UserService { 14 | 15 | constructor(private httpClient:HttpClient) { } 16 | 17 | apiUrl = environment.apiUrl; 18 | 19 | 20 | getById(id:number):Observable>{ 21 | let newPath=this.apiUrl+"getbyid?id="+id; 22 | return this.httpClient.get>(newPath); 23 | } 24 | 25 | updateInfos(user:User):Observable{ 26 | let newPath=this.apiUrl+"updateinfos"; 27 | return this.httpClient.put(newPath,user); 28 | } 29 | 30 | sendPasswordResetMail(email:string):Observable{ 31 | let newPath=this.apiUrl+"users/send-password-reset-mail?email="+email; 32 | console.log(newPath); 33 | return this.httpClient.post(newPath,email); 34 | } 35 | 36 | confirmPasswordResetDto(confirmPasswordResetDto:ConfirmPasswordResetDto):Observable{ 37 | let newPath=this.apiUrl+"users/confirm-password-reset-code"; 38 | console.log(newPath); 39 | return this.httpClient.post(newPath,confirmPasswordResetDto); 40 | } 41 | 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/assets/defaultImage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/assets/defaultImage.jpg -------------------------------------------------------------------------------- /src/custom-theme.scss: -------------------------------------------------------------------------------- 1 | 2 | // Custom Theming for Angular Material 3 | // For more information: https://material.angular.io/guide/theming 4 | @import '~@angular/material/theming'; 5 | // Plus imports for other components in your app. 6 | 7 | // Include the common styles for Angular Material. We include this here so that you only 8 | // have to load a single css file for Angular Material in your app. 9 | // Be sure that you only ever include this mixin once! 10 | @include mat-core(); 11 | 12 | // Define the palettes for your theme using the Material Design palettes available in palette.scss 13 | // (imported above). For each palette, you can optionally specify a default, lighter, and darker 14 | // hue. Available color palettes: https://material.io/design/color/ 15 | $CarRental-FrontEnd-primary: mat-palette($mat-indigo); 16 | $CarRental-FrontEnd-accent: mat-palette($mat-pink, A200, A100, A400); 17 | 18 | // The warn palette is optional (defaults to red). 19 | $CarRental-FrontEnd-warn: mat-palette($mat-red); 20 | 21 | // Create the theme object. A theme consists of configurations for individual 22 | // theming systems such as "color" or "typography". 23 | $CarRental-FrontEnd-theme: mat-light-theme(( 24 | color: ( 25 | primary: $CarRental-FrontEnd-primary, 26 | accent: $CarRental-FrontEnd-accent, 27 | warn: $CarRental-FrontEnd-warn, 28 | ) 29 | )); 30 | 31 | // Include theme styles for core and each component used in your app. 32 | // Alternatively, you can import and @include the theme mixins for each component 33 | // that you are using. 34 | @include angular-material-theme($CarRental-FrontEnd-theme); 35 | 36 | -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false, 7 | apiUrl2:"https://localhost:44342/api/", 8 | baseURL2: 'http://localhost:24812/', 9 | 10 | apiUrl:"https://localhost:5001/api/", 11 | baseURL: "https://localhost:5001/", 12 | 13 | 14 | apiUrl3:"https://carrental.yazilimoji.com/api/", 15 | baseURL3: "https://carrental.yazilimoji.com/", 16 | 17 | }; 18 | 19 | /* 20 | * For easier debugging in development mode, you can import the following file 21 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 22 | * 23 | * This import should be commented out in production mode because it will have a negative impact 24 | * on performance if an error is thrown. 25 | */ 26 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 27 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FatihBaycu/RentACarProjectAngularAPI/236794b51ada8dd58e30530aca777f177a60e151/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CarRentalFrontEnd 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** 22 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | html, body { height: 100%; } 4 | body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } 5 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true, 11 | "sourceMap": true, 12 | "strictPropertyInitialization": false, 13 | "strictNullChecks": false, 14 | "declaration": false, 15 | "downlevelIteration": true, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "node", 18 | "importHelpers": true, 19 | "target": "es2015", 20 | "module": "es2020", 21 | "lib": [ 22 | "es2018", 23 | "dom" 24 | ] 25 | }, 26 | "angularCompilerOptions": { 27 | "enableI18nLegacyMessageIdFormat": false, 28 | "strictInjectionParameters": true, 29 | "strictInputAccessModifiers": true, 30 | "strictTemplates": true 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": [ 4 | "codelyzer" 5 | ], 6 | "rules": { 7 | "align": { 8 | "options": [ 9 | "parameters", 10 | "statements" 11 | ] 12 | }, 13 | "array-type": false, 14 | "arrow-return-shorthand": true, 15 | "curly": true, 16 | "deprecation": { 17 | "severity": "warning" 18 | }, 19 | "eofline": true, 20 | "import-blacklist": [ 21 | true, 22 | "rxjs/Rx" 23 | ], 24 | "import-spacing": true, 25 | "indent": { 26 | "options": [ 27 | "spaces" 28 | ] 29 | }, 30 | "max-classes-per-file": false, 31 | "max-line-length": [ 32 | true, 33 | 140 34 | ], 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-console": [ 47 | true, 48 | "debug", 49 | "info", 50 | "time", 51 | "timeEnd", 52 | "trace" 53 | ], 54 | "no-empty": false, 55 | "no-inferrable-types": [ 56 | true, 57 | "ignore-params" 58 | ], 59 | "no-non-null-assertion": true, 60 | "no-redundant-jsdoc": true, 61 | "no-switch-case-fall-through": true, 62 | "no-var-requires": false, 63 | "object-literal-key-quotes": [ 64 | true, 65 | "as-needed" 66 | ], 67 | "quotemark": [ 68 | true, 69 | "single" 70 | ], 71 | "semicolon": { 72 | "options": [ 73 | "always" 74 | ] 75 | }, 76 | "space-before-function-paren": { 77 | "options": { 78 | "anonymous": "never", 79 | "asyncArrow": "always", 80 | "constructor": "never", 81 | "method": "never", 82 | "named": "never" 83 | } 84 | }, 85 | "typedef": [ 86 | true, 87 | "call-signature" 88 | ], 89 | "typedef-whitespace": { 90 | "options": [ 91 | { 92 | "call-signature": "nospace", 93 | "index-signature": "nospace", 94 | "parameter": "nospace", 95 | "property-declaration": "nospace", 96 | "variable-declaration": "nospace" 97 | }, 98 | { 99 | "call-signature": "onespace", 100 | "index-signature": "onespace", 101 | "parameter": "onespace", 102 | "property-declaration": "onespace", 103 | "variable-declaration": "onespace" 104 | } 105 | ] 106 | }, 107 | "variable-name": { 108 | "options": [ 109 | "ban-keywords", 110 | "check-format", 111 | "allow-pascal-case" 112 | ] 113 | }, 114 | "whitespace": { 115 | "options": [ 116 | "check-branch", 117 | "check-decl", 118 | "check-operator", 119 | "check-separator", 120 | "check-type", 121 | "check-typecast" 122 | ] 123 | }, 124 | "component-class-suffix": true, 125 | "contextual-lifecycle": true, 126 | "directive-class-suffix": true, 127 | "no-conflicting-lifecycle": true, 128 | "no-host-metadata-property": true, 129 | "no-input-rename": true, 130 | "no-inputs-metadata-property": true, 131 | "no-output-native": true, 132 | "no-output-on-prefix": true, 133 | "no-output-rename": true, 134 | "no-outputs-metadata-property": true, 135 | "template-banana-in-box": true, 136 | "template-no-negated-async": true, 137 | "use-lifecycle-interface": true, 138 | "use-pipe-transform-interface": true, 139 | "directive-selector": [ 140 | true, 141 | "attribute", 142 | "app", 143 | "camelCase" 144 | ], 145 | "component-selector": [ 146 | true, 147 | "element", 148 | "app", 149 | "kebab-case" 150 | ] 151 | } 152 | } 153 | --------------------------------------------------------------------------------