├── .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 ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.css │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── components │ │ ├── brand │ │ │ ├── brand-add │ │ │ │ ├── brand-add.component.css │ │ │ │ ├── brand-add.component.html │ │ │ │ ├── brand-add.component.spec.ts │ │ │ │ └── brand-add.component.ts │ │ │ ├── brand-list │ │ │ │ ├── brand-list.component.css │ │ │ │ ├── brand-list.component.html │ │ │ │ ├── brand-list.component.spec.ts │ │ │ │ └── brand-list.component.ts │ │ │ ├── brand-update │ │ │ │ ├── brand-update.component.css │ │ │ │ ├── brand-update.component.html │ │ │ │ ├── brand-update.component.spec.ts │ │ │ │ └── brand-update.component.ts │ │ │ ├── brand.component.css │ │ │ ├── brand.component.html │ │ │ ├── brand.component.spec.ts │ │ │ └── brand.component.ts │ │ ├── car │ │ │ ├── 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-list │ │ │ │ ├── car-list.component.css │ │ │ │ ├── car-list.component.html │ │ │ │ ├── car-list.component.spec.ts │ │ │ │ └── car-list.component.ts │ │ │ ├── car-update │ │ │ │ ├── car-update.component.css │ │ │ │ ├── car-update.component.html │ │ │ │ ├── car-update.component.spec.ts │ │ │ │ └── car-update.component.ts │ │ │ ├── car.component.css │ │ │ ├── car.component.html │ │ │ ├── car.component.spec.ts │ │ │ └── car.component.ts │ │ ├── color │ │ │ ├── color-add │ │ │ │ ├── color-add.component.css │ │ │ │ ├── color-add.component.html │ │ │ │ ├── color-add.component.spec.ts │ │ │ │ └── color-add.component.ts │ │ │ ├── color-list │ │ │ │ ├── color-list.component.css │ │ │ │ ├── color-list.component.html │ │ │ │ ├── color-list.component.spec.ts │ │ │ │ └── color-list.component.ts │ │ │ ├── color-update │ │ │ │ ├── color-update.component.css │ │ │ │ ├── color-update.component.html │ │ │ │ ├── color-update.component.spec.ts │ │ │ │ └── color-update.component.ts │ │ │ ├── color.component.css │ │ │ ├── color.component.html │ │ │ ├── color.component.spec.ts │ │ │ └── color.component.ts │ │ ├── customer │ │ │ ├── customer.component.css │ │ │ ├── customer.component.html │ │ │ ├── customer.component.spec.ts │ │ │ └── customer.component.ts │ │ ├── edit-user │ │ │ ├── edit-user.component.css │ │ │ ├── edit-user.component.html │ │ │ ├── edit-user.component.spec.ts │ │ │ └── edit-user.component.ts │ │ ├── home │ │ │ ├── home.component.css │ │ │ ├── home.component.html │ │ │ ├── home.component.spec.ts │ │ │ └── home.component.ts │ │ ├── login │ │ │ ├── login.component.css │ │ │ ├── login.component.html │ │ │ ├── login.component.spec.ts │ │ │ └── login.component.ts │ │ ├── navi │ │ │ ├── navi.component.css │ │ │ ├── navi.component.html │ │ │ ├── navi.component.spec.ts │ │ │ └── navi.component.ts │ │ ├── payment │ │ │ ├── payment.component.css │ │ │ ├── payment.component.html │ │ │ ├── payment.component.spec.ts │ │ │ └── payment.component.ts │ │ ├── register │ │ │ ├── register.component.css │ │ │ ├── register.component.html │ │ │ ├── register.component.spec.ts │ │ │ └── register.component.ts │ │ ├── rental-list │ │ │ ├── rental-list.component.css │ │ │ ├── rental-list.component.html │ │ │ ├── rental-list.component.spec.ts │ │ │ └── rental-list.component.ts │ │ └── rental │ │ │ ├── rental.component.css │ │ │ ├── rental.component.html │ │ │ ├── rental.component.spec.ts │ │ │ └── rental.component.ts │ ├── guards │ │ └── login.guard.ts │ ├── interceptors │ │ ├── auth.interceptor.spec.ts │ │ └── auth.interceptor.ts │ ├── models │ │ ├── brand.ts │ │ ├── car.ts │ │ ├── carDto.ts │ │ ├── carImage.ts │ │ ├── color.ts │ │ ├── creditCard.ts │ │ ├── customer.ts │ │ ├── listResponseModel.ts │ │ ├── loginModel.ts │ │ ├── payment.ts │ │ ├── registerModel.ts │ │ ├── rental.ts │ │ ├── rentalDto.ts │ │ ├── responseModel.ts │ │ ├── singleResponseModel.ts │ │ ├── tokenModel.ts │ │ └── user.ts │ ├── pipes │ │ ├── brand-filter.pipe.ts │ │ ├── car-filter.pipe.ts │ │ └── color-filter.pipe.ts │ └── services │ │ ├── auth.service.ts │ │ ├── brand.service.ts │ │ ├── car-image.service.ts │ │ ├── car.service.ts │ │ ├── color.service.ts │ │ ├── credit-card.service.ts │ │ ├── customer.service.ts │ │ ├── findeks.service.ts │ │ ├── local-storage.service.ts │ │ ├── payment.service.ts │ │ ├── rental.service.ts │ │ └── user.service.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /.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-chrome", 9 | "request": "launch", 10 | "name": "Launch Chrome against localhost", 11 | "url": "http://localhost:4200", 12 | "webRoot": "${workspaceFolder}" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Recap 2 | 3 | # Projenin İçeriği 4 | Kurumsal mimari yapısı kullanılarak *Clean Code* ile *SOLID* kuralları ile oluşturulmuştur.
Angular ile yazılmış, Araba kiralama fikri üzerine oluşmuştur. 5 | - CRUD Operasyonlar 6 | - Add 7 | - Read 8 | - Update 9 | - Delete 10 | - Filtreleme 11 | - Auth 12 | - Login 13 | - Register 14 | - Profile Update 15 | - Password Update 16 | - Reactive Forms 17 | - Validasyon işlemleri 18 | - Toastr 19 | - Models 20 | - Services 21 | - Custom pipes 22 | # Projeden Görüntüler 23 | ![Home](https://user-images.githubusercontent.com/73500636/115147613-8399ca80-a064-11eb-8729-01e0e6fd6a6a.png) 24 | ![Ekran Görüntüsü (175)](https://user-images.githubusercontent.com/73500636/115147640-a0360280-a064-11eb-8103-cfb78f53bb06.png) 25 | ![Ekran Görüntüsü (176)](https://user-images.githubusercontent.com/73500636/115147667-c0fe5800-a064-11eb-9519-c71218748a77.png) 26 | ![Ekran Görüntüsü (177)](https://user-images.githubusercontent.com/73500636/115147685-dbd0cc80-a064-11eb-8a97-a2331aa4c39d.png) 27 | ![Ekran Görüntüsü (178)](https://user-images.githubusercontent.com/73500636/115147689-e7bc8e80-a064-11eb-8ac0-7e9aeb9e32bc.png) 28 | ![Ekran Görüntüsü (179)](https://user-images.githubusercontent.com/73500636/115147691-ebe8ac00-a064-11eb-87f3-2ea023b91a9e.png) 29 | ![Ekran Görüntüsü (181)](https://user-images.githubusercontent.com/73500636/115147694-f0ad6000-a064-11eb-9399-16066ccd0295.png) 30 | ![Ekran Görüntüsü (182)](https://user-images.githubusercontent.com/73500636/115147709-fe62e580-a064-11eb-94ff-8e7ba69581fa.png) 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.3. 46 | 47 | ## Development server 48 | 49 | 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. 50 | 51 | ## Code scaffolding 52 | 53 | 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`. 54 | 55 | ## Build 56 | 57 | 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. 58 | 59 | ## Running unit tests 60 | 61 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 62 | 63 | ## Running end-to-end tests 64 | 65 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 66 | 67 | 68 | ## Further help! 69 | 70 | 71 | 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. 72 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "recap": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/recap", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": "src/polyfills.ts", 20 | "tsConfig": "tsconfig.app.json", 21 | "aot": true, 22 | "assets": [ 23 | "src/favicon.ico", 24 | "src/assets" 25 | ], 26 | "styles": [ 27 | "./node_modules/bootstrap/dist/css/bootstrap.min.css", 28 | "./node_modules/ngx-toastr/toastr.css", 29 | "src/styles.css" 30 | ], 31 | "scripts": [ "./node_modules/jquery/dist/jquery.min.js", 32 | "./node_modules/bootstrap/dist/js/bootstrap.min.js"] 33 | }, 34 | "configurations": { 35 | "production": { 36 | "fileReplacements": [ 37 | { 38 | "replace": "src/environments/environment.ts", 39 | "with": "src/environments/environment.prod.ts" 40 | } 41 | ], 42 | "optimization": true, 43 | "outputHashing": "all", 44 | "sourceMap": false, 45 | "namedChunks": false, 46 | "extractLicenses": true, 47 | "vendorChunk": false, 48 | "buildOptimizer": true, 49 | "budgets": [ 50 | { 51 | "type": "initial", 52 | "maximumWarning": "2mb", 53 | "maximumError": "5mb" 54 | }, 55 | { 56 | "type": "anyComponentStyle", 57 | "maximumWarning": "6kb", 58 | "maximumError": "10kb" 59 | } 60 | ] 61 | } 62 | } 63 | }, 64 | "serve": { 65 | "builder": "@angular-devkit/build-angular:dev-server", 66 | "options": { 67 | "browserTarget": "recap:build" 68 | }, 69 | "configurations": { 70 | "production": { 71 | "browserTarget": "recap:build:production" 72 | } 73 | } 74 | }, 75 | "extract-i18n": { 76 | "builder": "@angular-devkit/build-angular:extract-i18n", 77 | "options": { 78 | "browserTarget": "recap:build" 79 | } 80 | }, 81 | "test": { 82 | "builder": "@angular-devkit/build-angular:karma", 83 | "options": { 84 | "main": "src/test.ts", 85 | "polyfills": "src/polyfills.ts", 86 | "tsConfig": "tsconfig.spec.json", 87 | "karmaConfig": "karma.conf.js", 88 | "assets": [ 89 | "src/favicon.ico", 90 | "src/assets" 91 | ], 92 | "styles": [ 93 | "src/styles.css" 94 | ], 95 | "scripts": [] 96 | } 97 | }, 98 | "lint": { 99 | "builder": "@angular-devkit/build-angular:tslint", 100 | "options": { 101 | "tsConfig": [ 102 | "tsconfig.app.json", 103 | "tsconfig.spec.json", 104 | "e2e/tsconfig.json" 105 | ], 106 | "exclude": [ 107 | "**/node_modules/**" 108 | ] 109 | } 110 | }, 111 | "e2e": { 112 | "builder": "@angular-devkit/build-angular:protractor", 113 | "options": { 114 | "protractorConfig": "e2e/protractor.conf.js", 115 | "devServerTarget": "recap:serve" 116 | }, 117 | "configurations": { 118 | "production": { 119 | "devServerTarget": "recap:serve:production" 120 | } 121 | } 122 | } 123 | } 124 | } 125 | }, 126 | "defaultProject": "recap" 127 | } 128 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | SELENIUM_PROMISE_MANAGER: false, 20 | baseUrl: 'http://localhost:4200/', 21 | framework: 'jasmine', 22 | jasmineNodeOpts: { 23 | showColors: true, 24 | defaultTimeoutInterval: 30000, 25 | print: function() {} 26 | }, 27 | onPrepare() { 28 | require('ts-node').register({ 29 | project: require('path').join(__dirname, './tsconfig.json') 30 | }); 31 | jasmine.getEnv().addReporter(new SpecReporter({ 32 | spec: { 33 | displayStacktrace: StacktraceOption.PRETTY 34 | } 35 | })); 36 | } 37 | }; -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { browser, logging } from 'protractor'; 2 | import { AppPage } from './app.po'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', async () => { 12 | await page.navigateTo(); 13 | expect(await page.getTitleText()).toEqual('recap 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/recap'), 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": "recap", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "^11.2.6", 15 | "@angular/common": "~11.2.4", 16 | "@angular/compiler": "~11.2.4", 17 | "@angular/core": "~11.2.4", 18 | "@angular/forms": "~11.2.4", 19 | "@angular/platform-browser": "~11.2.4", 20 | "@angular/platform-browser-dynamic": "~11.2.4", 21 | "@angular/router": "~11.2.4", 22 | "bootstrap": "^4.6.0", 23 | "jquery": "^3.6.0", 24 | "ngx-toastr": "^13.2.1", 25 | "rxjs": "~6.6.0", 26 | "tslib": "^2.0.0", 27 | "zone.js": "~0.11.3" 28 | }, 29 | "devDependencies": { 30 | "@angular-devkit/build-angular": "~0.1102.3", 31 | "@angular/cli": "~11.2.3", 32 | "@angular/compiler-cli": "~11.2.4", 33 | "@types/jasmine": "~3.6.0", 34 | "@types/node": "^12.11.1", 35 | "codelyzer": "^6.0.0", 36 | "jasmine-core": "~3.6.0", 37 | "jasmine-spec-reporter": "~5.0.0", 38 | "karma": "~6.1.0", 39 | "karma-chrome-launcher": "~3.1.0", 40 | "karma-coverage": "~2.0.3", 41 | "karma-jasmine": "~4.0.0", 42 | "karma-jasmine-html-reporter": "^1.5.0", 43 | "protractor": "~7.0.0", 44 | "ts-node": "~8.3.0", 45 | "tslint": "~6.1.0", 46 | "typescript": "~4.1.5" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { BrandAddComponent } from './components/brand/brand-add/brand-add.component'; 4 | import { BrandListComponent } from './components/brand/brand-list/brand-list.component'; 5 | import { BrandUpdateComponent } from './components/brand/brand-update/brand-update.component'; 6 | import { BrandComponent } from './components/brand/brand.component'; 7 | import { CarAddComponent } from './components/car/car-add/car-add.component'; 8 | import { CarDetailComponent } from './components/car/car-detail/car-detail.component'; 9 | import { CarListComponent } from './components/car/car-list/car-list.component'; 10 | import { CarUpdateComponent } from './components/car/car-update/car-update.component'; 11 | import { CarComponent } from './components/car/car.component'; 12 | import { ColorAddComponent } from './components/color/color-add/color-add.component'; 13 | import { ColorListComponent } from './components/color/color-list/color-list.component'; 14 | import { ColorUpdateComponent } from './components/color/color-update/color-update.component'; 15 | import { ColorComponent } from './components/color/color.component'; 16 | import { CustomerComponent } from './components/customer/customer.component'; 17 | import { EditUserComponent } from './components/edit-user/edit-user.component'; 18 | import { HomeComponent } from './components/home/home.component'; 19 | import { LoginComponent } from './components/login/login.component'; 20 | import { RegisterComponent } from './components/register/register.component'; 21 | import { RentalComponent } from './components/rental/rental.component'; 22 | import { LoginGuard } from './guards/login.guard'; 23 | 24 | const routes: Routes = [ 25 | {path:"",component:HomeComponent}, 26 | {path: "cars", component: CarComponent}, 27 | {path:"brands",component: BrandComponent}, 28 | {path:"colors",component: ColorComponent}, 29 | {path:"rentals", component:RentalComponent}, 30 | {path:"cars/brand/:brandId", component: CarComponent}, 31 | {path:"cars/color/:colorId", component:CarComponent}, 32 | {path:"cars/filter/:brandId/:colorId",component:CarComponent}, 33 | {path:"cars/details/:carId",component:CarDetailComponent}, 34 | {path:"rentals/:carId", component:RentalComponent}, 35 | {path: "cars/add", component:CarAddComponent,canActivate:[LoginGuard]}, 36 | {path: "brands/add", component:BrandAddComponent}, 37 | {path: "colors/add", component:ColorAddComponent}, 38 | {path: 'cars/list',component:CarListComponent }, 39 | {path: 'cars/update/:carId',component:CarUpdateComponent }, 40 | {path: 'brands/list',component:BrandListComponent }, 41 | {path: "brands/update/:brandId",component:BrandUpdateComponent}, 42 | {path: 'colors/list',component:ColorListComponent}, 43 | {path: "colors/update/:colorId",component:ColorUpdateComponent}, 44 | {path:"register",component:RegisterComponent}, 45 | {path:"login",component:LoginComponent}, 46 | {path: "brands/update/",component:BrandUpdateComponent}, 47 | // {path:"profil",component:Profil} 48 | {path:"customers",component:CustomerComponent}, 49 | {path:"user/edit",component:EditUserComponent}, 50 | 51 | 52 | 53 | 54 | ]; 55 | 56 | @NgModule({ 57 | imports: [RouterModule.forRoot(routes)], 58 | exports: [RouterModule] 59 | }) 60 | export class AppRoutingModule { } 61 | 62 | 63 | // routing yaptıgımda ben onu backende yazmanmalaım "carcontrollerde " getcarbybrandid" 64 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/app.component.css -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 |
7 |
8 | 9 |
10 | 11 |
12 |
13 | 14 | -------------------------------------------------------------------------------- /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 'recap'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('recap'); 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('recap app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title :string= 'recap'; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import {HttpClientModule, HTTP_INTERCEPTORS} from '@angular/common/http' //hhttp istekleri için apiye istekde bulunmak için 4 | import {FormsModule,ReactiveFormsModule} from "@angular/forms" //[()] caloşabilmesi için 5 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 6 | 7 | 8 | import { AppRoutingModule } from './app-routing.module'; 9 | import { AppComponent } from './app.component'; 10 | import { BrandComponent } from './components/brand/brand.component'; 11 | import { CarComponent } from './components/car/car.component'; 12 | import { ColorComponent } from './components/color/color.component'; 13 | import { CustomerComponent } from './components/customer/customer.component'; 14 | import { NaviComponent } from './components/navi/navi.component'; 15 | import { RentalComponent } from './components/rental/rental.component'; 16 | import { BrandFilterPipe } from './pipes/brand-filter.pipe'; 17 | import { CarFilterPipe } from './pipes/car-filter.pipe'; 18 | import { ColorFilterPipe } from './pipes/color-filter.pipe'; 19 | import { PaymentComponent } from './components/payment/payment.component'; 20 | import {ToastrModule} from "ngx-toastr"; 21 | import { LoginComponent } from './components/login/login.component' 22 | import { CarDetailComponent } from './components/car/car-detail/car-detail.component'; 23 | import { CarFilterComponent } from './components/car/car-filter/car-filter.component'; 24 | import { CarAddComponent } from './components/car/car-add/car-add.component'; 25 | import { BrandAddComponent } from './components/brand/brand-add/brand-add.component'; 26 | import { ColorAddComponent } from './components/color/color-add/color-add.component'; 27 | import { BrandListComponent } from './components/brand/brand-list/brand-list.component'; 28 | import { BrandUpdateComponent } from './components/brand/brand-update/brand-update.component'; 29 | import { CarListComponent } from './components/car/car-list/car-list.component'; 30 | import { CarUpdateComponent } from './components/car/car-update/car-update.component'; 31 | import { ColorListComponent } from './components/color/color-list/color-list.component'; 32 | import { ColorUpdateComponent } from './components/color/color-update/color-update.component'; 33 | import { AuthInterceptor } from './interceptors/auth.interceptor'; 34 | import { RegisterComponent } from './components/register/register.component'; 35 | import { EditUserComponent } from './components/edit-user/edit-user.component'; 36 | import { HomeComponent } from './components/home/home.component'; 37 | import { RentalListComponent } from './components/rental-list/rental-list.component'; 38 | 39 | @NgModule({ 40 | declarations: [ 41 | AppComponent, 42 | BrandComponent, 43 | CarComponent, 44 | ColorComponent, 45 | CustomerComponent, 46 | NaviComponent, 47 | RentalComponent, 48 | CarDetailComponent, 49 | BrandFilterPipe, 50 | CarFilterPipe, 51 | ColorFilterPipe, 52 | CarFilterComponent, 53 | PaymentComponent, 54 | CarAddComponent, 55 | BrandAddComponent, 56 | ColorAddComponent, 57 | BrandListComponent, 58 | BrandUpdateComponent, 59 | CarListComponent, 60 | CarUpdateComponent, 61 | ColorListComponent, 62 | ColorUpdateComponent, 63 | LoginComponent, 64 | RegisterComponent, 65 | EditUserComponent, 66 | HomeComponent, 67 | RentalListComponent 68 | ], 69 | imports: [ //dışardan aldıklarım bundan sonra backendle iletişime geç (cors hatası= backende hata) 70 | BrowserModule, 71 | AppRoutingModule, 72 | HttpClientModule, 73 | FormsModule, 74 | ReactiveFormsModule, 75 | BrowserAnimationsModule, 76 | 77 | ToastrModule.forRoot({ 78 | positionClass:"toast-bottom-right" 79 | }) 80 | ], 81 | providers: [ 82 | {provide:HTTP_INTERCEPTORS,useClass:AuthInterceptor,multi:true} 83 | ], 84 | bootstrap: [AppComponent] 85 | }) 86 | export class AppModule { } 87 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-add/brand-add.component.css: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-add/brand-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
Marka ekle
6 |
7 |
8 |
9 | 10 | 11 |
12 | 19 | 20 |
21 |
22 |
23 |
24 | 27 |
28 |
29 |
30 |
-------------------------------------------------------------------------------- /src/app/components/brand/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/brand-add/brand-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder,FormControl,Validators} from "@angular/forms" 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { BrandService } from 'src/app/services/brand.service'; 5 | @Component({ 6 | selector: 'app-brand-add', 7 | templateUrl: './brand-add.component.html', 8 | styleUrls: ['./brand-add.component.css'] 9 | }) 10 | export class BrandAddComponent implements OnInit { 11 | brandAddForm:FormGroup; 12 | 13 | constructor(private formBuilder:FormBuilder, 14 | private brandService:BrandService, 15 | private toastrService:ToastrService) { } 16 | 17 | ngOnInit(): void { 18 | this.createBrandAddForm(); 19 | } 20 | createBrandAddForm(){ 21 | this.brandAddForm=this.formBuilder.group({ 22 | brandName: ["", Validators.required] 23 | }) 24 | 25 | } 26 | add(){ 27 | if(this.brandAddForm.valid){ 28 | let brandModel=Object.assign({},this.brandAddForm.value) 29 | this.brandService.add(brandModel).subscribe(response=>{ 30 | this.toastrService.success(response.message, "Başarılı") 31 | 32 | },responseError=>{ 33 | if(responseError.error.Errors.length>0){ 34 | for (let i = 0; i < responseError.error.Errors.length; i++) { 35 | 36 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage,"Doğrulama Hatası") 37 | } 38 | 39 | } 40 | 41 | }) 42 | } 43 | else{ 44 | this.toastrService.error("Form Bilgilerini Eksiksiz Doldurunuz...","Dikkat") 45 | 46 | } 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-list/brand-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/brand/brand-list/brand-list.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand-list/brand-list.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 |
Marka NumarasıMarka Adı
{{brand.brandId}}{{brand.brandName}}
26 | 27 |
28 |
29 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-list/brand-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandListComponent } from './brand-list.component'; 4 | 5 | describe('BrandListComponent', () => { 6 | let component: BrandListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-list/brand-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ToastrService } from 'ngx-toastr'; 3 | import { Brand } from 'src/app/models/brand'; 4 | import { BrandService } from 'src/app/services/brand.service'; 5 | 6 | @Component({ 7 | selector: 'app-brand-list', 8 | templateUrl: './brand-list.component.html', 9 | styleUrls: ['./brand-list.component.css'] 10 | }) 11 | export class BrandListComponent implements OnInit { 12 | brands : Brand[] =[]; 13 | brand : Brand 14 | constructor(private brandService: BrandService, 15 | private toastrService: ToastrService) { } 16 | 17 | ngOnInit(): void { 18 | this.getBrands(); 19 | } 20 | 21 | getBrands() { 22 | this.brandService.getBrands().subscribe(response=>{ 23 | this.brands = response.data ; 24 | this.brand=response.data[0] 25 | }); 26 | } 27 | 28 | deleteBrand(brand:Brand){ 29 | this.brandService.delete(brand).subscribe((response=>{ 30 | this.toastrService.success("Araç ismi silindi") 31 | setTimeout(function(){ 32 | location.reload() 33 | },400) 34 | }),errorResponse=>{ 35 | if(errorResponse.error.error.length>0){ 36 | for (let i = 0; i < errorResponse.error.error.length; i++) { 37 | this.toastrService.error(errorResponse.error.error[i].ErrorMessage,"Doğrulama hatası") 38 | 39 | } 40 | } 41 | }) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-update/brand-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/brand/brand-update/brand-update.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand-update/brand-update.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 |
6 |
Marka Güncelle
7 |
8 | 9 |
10 | 11 |
12 | 13 |
14 | 15 |
16 | 17 |
18 |
19 | 20 |
21 | 22 |
23 | 24 | 27 | 28 |
29 |
30 | 31 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-update/brand-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandUpdateComponent } from './brand-update.component'; 4 | 5 | describe('BrandUpdateComponent', () => { 6 | let component: BrandUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-update/brand-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { 3 | FormGroup, 4 | FormControl, 5 | Validators, 6 | FormBuilder, 7 | } from '@angular/forms'; 8 | import { ActivatedRoute } from '@angular/router'; 9 | import { ToastrService } from 'ngx-toastr'; 10 | import { Brand } from 'src/app/models/brand'; 11 | import { BrandService } from 'src/app/services/brand.service'; 12 | 13 | @Component({ 14 | selector: 'app-brand-update', 15 | templateUrl: './brand-update.component.html', 16 | styleUrls: ['./brand-update.component.css'], 17 | }) 18 | export class BrandUpdateComponent implements OnInit { 19 | brandUpdateForm: FormGroup; 20 | brandId: number; 21 | brands: Brand[] = []; 22 | 23 | constructor( 24 | private brandService: BrandService, 25 | private toastrService: ToastrService, 26 | private formBuilder: FormBuilder, 27 | private activatedRoute: ActivatedRoute 28 | ) {} 29 | 30 | ngOnInit(): void { 31 | this.activatedRoute.params.subscribe((params) => { 32 | if ([params['brandId']]) { 33 | this.brandId = parseInt(params['brandId']); 34 | this.getByBrandId, params['brandId']; 35 | } 36 | }); 37 | this.createBrandFrom(); 38 | } 39 | 40 | createBrandFrom() { 41 | this.brandUpdateForm = this.formBuilder.group({ 42 | id: [this.brandId, Validators.required], 43 | brandName: ["", Validators.required], 44 | }); 45 | } 46 | 47 | getByBrandId(brandId: number) { 48 | this.brandService.getByBrandId(brandId).subscribe((response) => { 49 | this.brands = response.data; 50 | }); 51 | } 52 | 53 | updateBrand() { 54 | if (this.brandUpdateForm.valid) { 55 | let brandModel = Object.assign({}, this.brandUpdateForm.value); 56 | brandModel.brandId = Number(brandModel.id); 57 | this.brandService.update(brandModel).subscribe( 58 | (response) => { 59 | this.toastrService.success(response.message, 'Başarılı'); 60 | }, 61 | (responseError) => { 62 | if (responseError.error.Errors.length > 0) { 63 | 64 | for ( 65 | let i = 0; 66 | i < responseError.errorErrors.length; 67 | i++ 68 | ) { 69 | this.toastrService.error( 70 | responseError.error.Errors[i].ErrorMessage, 71 | 'Doğrulama hatası' 72 | ); 73 | } 74 | } 75 | } 76 | ); 77 | } else { 78 | this.toastrService.warning( 79 | 'Lütfen marka bilgilerini eksiksiz doldurunuz.' 80 | ); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/brand/brand.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 | 7 | 8 |
9 | 10 |
11 |
  • Tüm Araçlar
  • 12 |
      13 |
    • {{brand.brandName}}
    • 15 |
    16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandComponent } from './brand.component'; 4 | 5 | describe('BrandComponent', () => { 6 | let component: BrandComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Brand } from 'src/app/models/brand'; 3 | import { BrandService } from 'src/app/services/brand.service'; 4 | 5 | @Component({ 6 | selector: 'app-brand', 7 | templateUrl: './brand.component.html', 8 | styleUrls: ['./brand.component.css'] 9 | }) 10 | export class BrandComponent implements OnInit { 11 | 12 | brands: Brand[] = []; 13 | currentBrand: Brand;//o anki caliştiğim marakyı ,ttutmalk için 14 | filterText:string = ""; 15 | dataLoaded = false; 16 | 17 | 18 | constructor(private brandService: BrandService) { } 19 | 20 | ngOnInit(): void { 21 | this.getBrands(); 22 | } 23 | 24 | getBrands() { 25 | this.brandService.getBrands().subscribe((response)=>{ 26 | this.brands = response.data; 27 | this.dataLoaded = true; 28 | }) 29 | } 30 | 31 | setCurrentBrand(brand: Brand){//branda göre getir marka seç ona göre getireyim üstüne tıklama 32 | this.currentBrand = brand; 33 | } 34 | 35 | removeCurrentBrand(){ 36 | this.filterText = ""; 37 | this.currentBrand = {brandId:-1,brandName:""}; 38 | } 39 | 40 | getCurrentBrandClass(brand: Brand){ //o anki seçtiğim markam mavi olsım dğer türlü olmasın o anki seçtğiğni bana söyle 41 | if(brand == this.currentBrand) { // 42 | return "list-group-item active" 43 | } 44 | else { 45 | return "list-group-item cursorPointer" 46 | } 47 | } 48 | 49 | getAllBrandClass(){ //branda göre filtrele 50 | if(!this.currentBrand){ 51 | return "list-group-item list-group-item-action list-group-item-dark active"; 52 | }else{ 53 | return "list-group-item list-group-item-action list-group-item-dark"; 54 | } 55 | } 56 | } 57 | 58 | 59 | //npm install jquery = navbara lınk vernel için istall yap bunu angular.jsonda belirt -------------------------------------------------------------------------------- /src/app/components/car/car-add/car-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/car/car-add/car-add.component.css -------------------------------------------------------------------------------- /src/app/components/car/car-add/car-add.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 |
    5 |
    Araba Ekle
    6 |
    7 |
    8 |
    9 |
    10 | 11 |
    12 | 14 |
    15 |
    16 |
    17 | 18 |
    19 | 21 |
    22 |
    23 |
    24 | 25 |
    26 | 28 |
    29 |
    30 |
    31 | 32 |
    33 | 35 |
    36 |
    37 |
    38 | 39 |
    40 | 42 |
    43 |
    44 |
    45 |
    46 | 50 |
    51 |
    52 |
    53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/app/components/car/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/car-add/car-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup, FormBuilder,FormControl,Validators} from "@angular/forms" 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Brand } from 'src/app/models/brand'; 5 | import { Color } from 'src/app/models/color'; 6 | import { BrandService } from 'src/app/services/brand.service'; 7 | import { CarService } from 'src/app/services/car.service'; 8 | import { ColorService } from 'src/app/services/color.service'; 9 | 10 | @Component({ 11 | selector: 'app-car-add', 12 | templateUrl: './car-add.component.html', 13 | styleUrls: ['./car-add.component.css'] 14 | }) 15 | export class CarAddComponent implements OnInit { 16 | 17 | carAddForm: FormGroup; 18 | colors:Color[]=[] 19 | brands:Brand[]=[] 20 | 21 | constructor(private formBuilder:FormBuilder, 22 | private carService:CarService, 23 | private toastrService:ToastrService, 24 | private brandService:BrandService, 25 | private colorService:ColorService) { } 26 | 27 | ngOnInit(): void { 28 | this.createCarAddForm(); 29 | } 30 | createCarAddForm(){ 31 | this.carAddForm=this.formBuilder.group({ 32 | brandName: ["", Validators.required], 33 | colorName: ["", Validators.required], 34 | modelYear: ["", Validators.required], 35 | dailyPrice: ["", Validators.required], 36 | description: ["", Validators.required] 37 | }) 38 | } 39 | add(){ 40 | if(this.carAddForm.valid){ 41 | let carModel=Object.assign({},this.carAddForm.value) 42 | this.carService.add(carModel).subscribe(response=>{ 43 | this.toastrService.success(response.message, "Başarılı") 44 | 45 | },responseError=>{ 46 | if(responseError.error.Errors.length>0){ 47 | for (let i = 0; i < responseError.error.Errors.length; i++) { 48 | 49 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage,"Doğrulama Hatası") 50 | } 51 | 52 | } 53 | 54 | }) 55 | } 56 | else{ 57 | this.toastrService.error("Form Bilgilerini Eksiksiz Doldurunuz...","Dikkat") 58 | 59 | } 60 | 61 | } 62 | getBrand(){ 63 | this.brandService.getBrands().subscribe(response=>{ 64 | this.brands = response.data 65 | }) 66 | } 67 | getColor(){ 68 | this.colorService.getColors().subscribe(response=>{ 69 | this.colors = response.data 70 | }) 71 | } 72 | 73 | } 74 | 75 | //car service=add ekle 76 | 77 | 78 | //FormBuilder = HTML DEKİ FORM ile burayı yapılandırmaya yarıyor 79 | -------------------------------------------------------------------------------- /src/app/components/car/car-detail/car-detail.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/car/car-detail/car-detail.component.css -------------------------------------------------------------------------------- /src/app/components/car/car-detail/car-detail.component.html: -------------------------------------------------------------------------------- 1 |
    Araç Bilgisi
    2 |
    3 |
    4 |
    5 | 6 | 22 | 23 |
    24 | 25 | 26 | 27 |
    28 |
    29 |
    30 |
    31 | {{ car.description }} 32 |
    33 |
    34 | 35 |
      36 |
    • Marka : {{ car.brandName }}
    • 37 |
    • Renk : {{ car.colorName }}
    • 38 |
    • Model : {{ car.modelYear }}
    • 39 |
    • 40 | Günlük Kiralama Ücreti : {{ car.dailyPrice | currency: "TRY":"symbol-narrow":"1.2-2"}} 41 |
    • 42 |
    43 | 44 |
    45 | 46 |
    47 |
    48 |
    49 |
    -------------------------------------------------------------------------------- /src/app/components/car/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/car-detail/car-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { Car } from 'src/app/models/car'; 4 | import { CarDto } from 'src/app/models/carDto'; 5 | import { CarImage } from 'src/app/models/carImage'; 6 | import { CarImageService } from 'src/app/services/car-image.service'; 7 | import { CarService } from 'src/app/services/car.service'; 8 | 9 | @Component({ 10 | selector: 'app-car-detail', 11 | templateUrl: './car-detail.component.html', 12 | styleUrls: ['./car-detail.component.css'] 13 | }) 14 | export class CarDetailComponent implements OnInit { 15 | 16 | carImages:CarImage[]=[]; 17 | car:Car; 18 | dataLoaded = false; 19 | imageUrl="https://localhost:44301"; 20 | 21 | constructor(private carService:CarService, 22 | private carImageService:CarImageService, 23 | private activatedRoute:ActivatedRoute) { } 24 | 25 | ngOnInit(): void { 26 | this.activatedRoute.params.subscribe(params=>{ 27 | if(params["carId"]){ 28 | 29 | this.getCarDetailsByCarId(params["carId"]); 30 | this.getCarImagesByCarId(params["carId"]); 31 | } 32 | }) 33 | 34 | } 35 | getCarDetailsByCarId(carId:number){ 36 | this.carService.getCarDetailsByCarId(carId).subscribe(response=>{ 37 | this.car=response.data[0]; 38 | this.dataLoaded=true; 39 | } 40 | ) 41 | 42 | } 43 | getCarImagesByCarId(carId:number) 44 | { 45 | 46 | this.carImageService.getCarImagesByCarId(carId).subscribe(response => { 47 | this.carImages = response.data; 48 | 49 | this.dataLoaded = true; 50 | 51 | }) 52 | } 53 | getSliderClassName(index:Number){ 54 | if(index == 0){ 55 | return "carousel-item active"; 56 | } else { 57 | return "carousel-item"; 58 | } 59 | } 60 | 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/app/components/car/car-filter/car-filter.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/car/car-filter/car-filter.component.css -------------------------------------------------------------------------------- /src/app/components/car/car-filter/car-filter.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 |
    5 | 8 |
    9 |
    10 | 13 |
    14 | 15 |
    16 | 18 | 19 | 21 |
    22 | 23 |
    24 | 25 |
    26 |
    27 | 28 | -------------------------------------------------------------------------------- /src/app/components/car/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/car-filter/car-filter.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Brand } from 'src/app/models/brand'; 3 | import { Color } from 'src/app/models/color'; 4 | import { BrandService } from 'src/app/services/brand.service'; 5 | import { ColorService } from 'src/app/services/color.service'; 6 | 7 | @Component({ 8 | selector: 'app-car-filter', 9 | templateUrl: './car-filter.component.html', 10 | styleUrls: ['./car-filter.component.css'] 11 | }) 12 | export class CarFilterComponent implements OnInit { 13 | 14 | brands : Brand[] = []; 15 | colors: Color[] = []; 16 | brandFilter: number; 17 | colorFilter: number; 18 | selectedBrand: number; 19 | selectedColor: number; 20 | 21 | 22 | 23 | constructor(private brandService: BrandService, 24 | private colorService: ColorService) { } 25 | 26 | ngOnInit(): void { 27 | this.getBrands(); 28 | this.getColors(); 29 | } 30 | 31 | getBrands() { 32 | this.brandService.getBrands().subscribe((response) => { 33 | this.brands = response.data; 34 | 35 | }); 36 | } 37 | getColors() { 38 | this.colorService.getColors().subscribe((response) => { 39 | this.colors = response.data; 40 | 41 | }); 42 | } 43 | getSelectedBrand(brandId: Number) { 44 | if (this.brandFilter == brandId) 45 | return true; 46 | else 47 | return false; 48 | } 49 | getSelectedColor(colorId: Number) { 50 | if (this.colorFilter == colorId) 51 | return true; 52 | else 53 | return false; 54 | } 55 | setSelectedColor(colorId: number){ 56 | this.selectedColor = colorId; 57 | } 58 | 59 | setSelectedBrand(brandId: number){ 60 | this.selectedBrand = brandId; 61 | } 62 | 63 | 64 | } -------------------------------------------------------------------------------- /src/app/components/car/car-list/car-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/car/car-list/car-list.component.css -------------------------------------------------------------------------------- /src/app/components/car/car-list/car-list.component.html: -------------------------------------------------------------------------------- 1 |
    Araba İşlemleri
    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 38 | 39 | 40 |
    Araba IdMarka IdRenk IdModel YılıGünlük FiyatAçıklama
    {{ car.carId }}{{ car.brandId }}{{ car.colorId }}{{ car.modelYear }}{{ car.dailyPrice }}{{ car.description }} 24 |
    25 | 33 | 36 |
    37 |
    -------------------------------------------------------------------------------- /src/app/components/car/car-list/car-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarListComponent } from './car-list.component'; 4 | 5 | describe('CarListComponent', () => { 6 | let component: CarListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car/car-list/car-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ToastrService } from 'ngx-toastr'; 3 | import { Car } from 'src/app/models/car'; 4 | import { CarService } from 'src/app/services/car.service'; 5 | 6 | 7 | @Component({ 8 | selector: 'app-car-list', 9 | templateUrl: './car-list.component.html', 10 | styleUrls: ['./car-list.component.css'] 11 | }) 12 | export class CarListComponent implements OnInit { 13 | cars : Car[] =[]; 14 | 15 | constructor(private carService: CarService, 16 | private toastrService: ToastrService) { } 17 | 18 | ngOnInit(): void { 19 | this.getCars(); 20 | } 21 | 22 | getCars() { 23 | this.carService.getCars().subscribe(response=>{ 24 | this.cars = response.data 25 | }); 26 | } 27 | 28 | delete(car:Car){ 29 | this.carService.delete(car).subscribe(response=>{ 30 | this.toastrService.success(car.description+" isimli araç silindi","Başarılı"); 31 | this.getCars() 32 | }) 33 | } 34 | 35 | 36 | } -------------------------------------------------------------------------------- /src/app/components/car/car-update/car-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/car/car-update/car-update.component.css -------------------------------------------------------------------------------- /src/app/components/car/car-update/car-update.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 |
    Araba Güncelleme
    5 |
    6 |
    7 |
    8 |
    9 | 10 |
    11 |
    12 | 23 |
    24 |
    25 |
    26 |
    27 | 28 |
    29 |
    30 | 41 |
    42 |
    43 | 44 |
    45 |
    46 | 47 |
    48 |
    49 | 56 |
    57 |
    58 | 59 |
    60 |
    61 | 62 |
    63 |
    64 | 71 |
    72 |
    73 |
    74 |
    75 | 76 |
    77 |
    78 | 84 |
    85 |
    86 |
    87 |
    88 | 96 |
    97 |
    98 |
    99 | 100 | -------------------------------------------------------------------------------- /src/app/components/car/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/car-update/car-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { 3 | FormGroup, 4 | FormBuilder, 5 | Validators, 6 | FormControl, 7 | } from '@angular/forms'; 8 | import { ActivatedRoute } from '@angular/router'; 9 | import { ToastrService } from 'ngx-toastr'; 10 | import { Brand } from 'src/app/models/brand'; 11 | import { Color } from 'src/app/models/color'; 12 | import { BrandService } from 'src/app/services/brand.service'; 13 | import { CarService } from 'src/app/services/car.service'; 14 | import { ColorService } from 'src/app/services/color.service'; 15 | 16 | @Component({ 17 | selector: 'app-car-update', 18 | templateUrl: './car-update.component.html', 19 | styleUrls: ['./car-update.component.css'], 20 | }) 21 | export class CarUpdateComponent implements OnInit { 22 | 23 | updateCarForm: FormGroup; 24 | carId: number; 25 | brands: Brand[] = []; 26 | colors: Color[] = []; 27 | 28 | constructor( 29 | private formBuilder: FormBuilder, 30 | private carService: CarService, 31 | private brandService: BrandService, 32 | private colorService: ColorService, 33 | private toastrService: ToastrService, 34 | private activatedRoute: ActivatedRoute 35 | ) {} 36 | 37 | ngOnInit(): void { 38 | this.activatedRoute.params.subscribe((params) => { 39 | if (params['carId']) { 40 | this.carId = params['carId']; 41 | this.createUpdateForm(); 42 | this.getColors(); 43 | this.getBrands(); 44 | } 45 | }); 46 | } 47 | 48 | createUpdateForm() { 49 | this.updateCarForm = this.formBuilder.group({ 50 | id: [this.carId, Validators.required], 51 | brandId: ['', Validators.required], 52 | colorId: ['', Validators.required], 53 | modelYear: ['', Validators.required], 54 | dailyPrice: ['', Validators.required], 55 | description: ['', Validators.required], 56 | }); 57 | } 58 | 59 | update() { 60 | if (this.updateCarForm.valid) { 61 | let carModel = Object.assign({}, this.updateCarForm.value); 62 | carModel.brandId = Number(carModel.brandId); 63 | carModel.colorId = Number(carModel.colorId); 64 | carModel.id = Number(carModel.id); 65 | console.log(carModel); 66 | this.carService.update(carModel).subscribe( 67 | (response) => { 68 | this.toastrService.success(response.message, 'Başarılı'); 69 | }, 70 | (responseError) => { 71 | //console.log(responseError) 72 | if (responseError.error.ValidationErrors.length > 0) { 73 | console.log(responseError.error.ValidationErrors); 74 | for ( 75 | let i = 0; 76 | i < responseError.error.ValidationErrors.length; 77 | i++ 78 | ) { 79 | this.toastrService.error( 80 | responseError.error.ValidationErrors[i].ErrorMessage, 81 | 'Doğrulama hatası' 82 | ); 83 | } 84 | } 85 | } 86 | ); 87 | } else { 88 | this.toastrService.warning( 89 | 'Lütfen araba bilgilerini eksiksiz doldurunuz.' 90 | ); 91 | } 92 | } 93 | 94 | getBrands() { 95 | this.brandService.getBrands().subscribe((response) => { 96 | this.brands = response.data; 97 | }); 98 | } 99 | 100 | getColors() { 101 | this.colorService.getColors().subscribe((response) => { 102 | this.colors = response.data; 103 | }); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/car/car.component.css -------------------------------------------------------------------------------- /src/app/components/car/car.component.html: -------------------------------------------------------------------------------- 1 |
    2 | Loading... 3 |
    4 |
    5 |
    6 |
    7 | 8 | 9 | 10 |
    11 |
    12 | 13 |

    14 | ARABALAR 15 | 16 |

    17 | 18 |
    19 | 20 | 22 | 23 |
    24 |
    25 | {{ filterText }} aradınız. 26 | 27 |
    28 | 29 |
    30 |
    31 | 32 |
    33 | 34 |
    35 |
    {{car.description | uppercase}}
    36 | Detaylar 37 |
    38 |
    39 | 40 | 49 | 50 |
    51 |
    52 | 53 | 54 |
    55 | 56 | 57 |
    58 | 59 |
    60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /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 { ToastrService } from 'ngx-toastr'; 4 | import { Car } from 'src/app/models/car'; 5 | import { CarImage } from 'src/app/models/carImage'; 6 | import { CarImageService } from 'src/app/services/car-image.service'; 7 | import { CarService } from 'src/app/services/car.service'; 8 | 9 | 10 | @Component({ 11 | selector: 'app-car', 12 | templateUrl: './car.component.html', 13 | styleUrls: ['./car.component.css'] 14 | }) 15 | export class CarComponent implements OnInit { 16 | 17 | carImages:CarImage[]=[]; 18 | cars:Car[]=[]; 19 | currentCar:Car; //o anki calıştığım car bunun için "tsconfig.json a strictPropertyInitialization =false yapmalıyım " 20 | filterText:string; //gelen fitreyi okumak için 21 | dataLoaded=false; 22 | imageUrl="https://localhost:44301" 23 | 24 | //constructor= carComponent bellekte olusşturmaK NEW lemek 25 | constructor(private carService:CarService, //servisi kullanabilmek için 26 | private activatedRoute: ActivatedRoute, //roting için 27 | private toastrService:ToastrService, 28 | private carImageService:CarImageService) { } 29 | 30 | ngOnInit(): void { //componenr ilk açıldığnda çalışan kısım 31 | this.activatedRoute.params.subscribe(params=>{ 32 | 33 | if(params['brandId'] && params['colorId']){ 34 | this.getCarByColorAndBrand(params['brandId'],params['colorId']) 35 | 36 | } 37 | else if(params["brandId"]){ 38 | 39 | this.getCarsByBrandId(params["brandId"]); 40 | } 41 | else if(params["colorId"]){ 42 | this.getCarsByColorId(params["colorId"]); 43 | } 44 | 45 | else{ 46 | this.getCars(); 47 | this.getAllCarImage(); 48 | } 49 | }) 50 | } 51 | getCars(){ //arabaları getir 52 | this.carService.getCars().subscribe(response=>{ //gelen yanıt için 53 | this.cars=response.data 54 | this.dataLoaded=true;//yükleniyor 55 | console.log(response.data); 56 | console.log(this.cars); 57 | }) 58 | 59 | } 60 | 61 | setCurrentCar(car: Car) { //cara göre getir 62 | this.currentCar = car; //gelen car benim carım currentCar= o anki calıştıgım carım 63 | } 64 | 65 | getCarsByBrandId(brandId:number){ 66 | this.carService.getCarsByBrandId(brandId).subscribe(response=>{ 67 | this.cars=response.data; 68 | console.log(this.cars,response) 69 | this.dataLoaded=true; 70 | }) 71 | } 72 | getCarsByColorId(colorId:number){ 73 | this.carService.getCarsByColorId(colorId).subscribe(response => { 74 | this.cars = response.data; 75 | this.dataLoaded = true; 76 | }) 77 | } 78 | 79 | getCarByColorAndBrand(colorId: number, brandId: number) { 80 | this.carService.getCarByColorAndBrand(colorId, brandId).subscribe(response => { 81 | this.cars = response.data; 82 | this.dataLoaded = true; 83 | if (this.cars.length == 0) { 84 | this.toastrService.warning("Araç yok.", "Hata"); 85 | } 86 | }) 87 | 88 | } 89 | getAllCarImage() 90 | { 91 | 92 | this.carImageService.getCarImages().subscribe(response => { 93 | this.carImages = response.data; 94 | 95 | this.dataLoaded = true; 96 | 97 | }) 98 | } 99 | 100 | } 101 | //data koy ve yönet nasıl kullanacağını html de söyle 102 | -------------------------------------------------------------------------------- /src/app/components/color/color-add/color-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/color/color-add/color-add.component.css -------------------------------------------------------------------------------- /src/app/components/color/color-add/color-add.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 |
    5 |
    Renk ekle
    6 |
    7 |
    8 |
    9 | 10 | 11 |
    12 | 19 | 20 |
    21 |
    22 |
    23 |
    24 | 27 |
    28 |
    29 |
    30 |
    31 | 32 | -------------------------------------------------------------------------------- /src/app/components/color/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/color-add/color-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder,FormControl,Validators} from "@angular/forms" 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { ColorService } from 'src/app/services/color.service'; 5 | @Component({ 6 | selector: 'app-color-add', 7 | templateUrl: './color-add.component.html', 8 | styleUrls: ['./color-add.component.css'] 9 | }) 10 | export class ColorAddComponent implements OnInit { 11 | colorAddForm:FormGroup; 12 | 13 | constructor(private formBuilder:FormBuilder, 14 | private colorService:ColorService, 15 | private toastrService:ToastrService) { } 16 | 17 | ngOnInit(): void { 18 | this.createColorAddForm(); 19 | } 20 | createColorAddForm(){ 21 | this.colorAddForm=this.formBuilder.group({ 22 | colorName: ["", Validators.required] 23 | }) 24 | 25 | } 26 | add(){ 27 | if(this.colorAddForm.valid){ 28 | let brandModel=Object.assign({},this.colorAddForm.value) 29 | this.colorService.add(brandModel).subscribe(response=>{ 30 | this.toastrService.success(response.message, "Başarılı") 31 | 32 | },responseError=>{ 33 | if(responseError.error.Errors.length>0){ 34 | for (let i = 0; i < responseError.error.Errors.length; i++) { 35 | 36 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage,"Doğrulama Hatası") 37 | } 38 | 39 | } 40 | 41 | }) 42 | } 43 | else{ 44 | this.toastrService.error("Form Bilgilerini Eksiksiz Doldurunuz...","Dikkat") 45 | 46 | } 47 | 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/app/components/color/color-list/color-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/color/color-list/color-list.component.css -------------------------------------------------------------------------------- /src/app/components/color/color-list/color-list.component.html: -------------------------------------------------------------------------------- 1 | 2 |
    3 |
    4 | 5 | 6 |
    7 |
    8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
    Renk NumarasıRenk ismi
    {{color.colorId}}{{color.colorName}}
    27 | 28 |
    29 |
    30 | -------------------------------------------------------------------------------- /src/app/components/color/color-list/color-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorListComponent } from './color-list.component'; 4 | 5 | describe('ColorListComponent', () => { 6 | let component: ColorListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color/color-list/color-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ToastrService } from 'ngx-toastr'; 3 | import { Color } from 'src/app/models/color'; 4 | import { ColorService } from 'src/app/services/color.service'; 5 | 6 | @Component({ 7 | selector: 'app-color-list', 8 | templateUrl: './color-list.component.html', 9 | styleUrls: ['./color-list.component.css'] 10 | }) 11 | export class ColorListComponent implements OnInit { 12 | colors : Color[] ; 13 | constructor( 14 | private colorService: ColorService, 15 | private toastrService: ToastrService) { } 16 | 17 | ngOnInit(): void { 18 | this.getColors(); 19 | } 20 | 21 | 22 | getColors() { 23 | this.colorService.getColors().subscribe(response=>{ 24 | this.colors = response.data 25 | }); 26 | } 27 | 28 | delete(color: Color){ 29 | this.colorService.delete(color).subscribe(response=>{ 30 | this.toastrService.success(color.colorName+" markası silindi","Başarılı"); 31 | this.getColors() 32 | }) 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/app/components/color/color-update/color-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/color/color-update/color-update.component.css -------------------------------------------------------------------------------- /src/app/components/color/color-update/color-update.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 |
    Renk Güncelle
    5 |
    6 |
    7 |
    8 |
    9 | 10 |
    11 | 12 |
    13 |
    14 | 15 |
    16 |
    17 | 20 |
    21 |
    22 | -------------------------------------------------------------------------------- /src/app/components/color/color-update/color-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorUpdateComponent } from './color-update.component'; 4 | 5 | describe('ColorUpdateComponent', () => { 6 | let component: ColorUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color/color-update/color-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 { Color } from 'src/app/models/color'; 6 | import { ColorService } from 'src/app/services/color.service'; 7 | 8 | @Component({ 9 | selector: 'app-color-update', 10 | templateUrl: './color-update.component.html', 11 | styleUrls: ['./color-update.component.css'] 12 | }) 13 | export class ColorUpdateComponent implements OnInit { 14 | color:Color[]; 15 | colorUpdateForm:FormGroup; 16 | 17 | constructor(private colorService:ColorService, 18 | private toastrService:ToastrService, 19 | private activatedRoute:ActivatedRoute, 20 | private formBuilder:FormBuilder ) { } 21 | 22 | ngOnInit(): void { 23 | this.activatedRoute.params.subscribe(params=>{ 24 | if(params["colorId"]){ 25 | this.getByColorId(params["colorId"]); 26 | this.createColorUpdateForm(); 27 | } 28 | }) 29 | } 30 | getByColorId(colorId:number){ 31 | this.colorService.getByColorId(colorId).subscribe((response)=>{ 32 | this.color=response.data 33 | }) 34 | 35 | 36 | } 37 | createColorUpdateForm(){ 38 | this.colorUpdateForm=this.formBuilder.group({ 39 | colorId:["",Validators.required], 40 | colorName:["",Validators.required] 41 | }) 42 | } 43 | 44 | updateColor() { 45 | if (this. colorUpdateForm.valid) { 46 | let colorModel = Object.assign({}, this.colorUpdateForm.value); 47 | colorModel.brandId = Number(colorModel.colorId); 48 | this.colorService.update(colorModel).subscribe( 49 | (response) => { 50 | this.toastrService.success(response.message, 'Başarılı'); 51 | }, 52 | (responseError) => { 53 | if (responseError.error.Errors.length > 0) { 54 | 55 | for ( 56 | let i = 0; 57 | i < responseError.errorErrors.length; 58 | i++ 59 | ) { 60 | this.toastrService.error( 61 | responseError.error.Errors[i].ErrorMessage, 62 | 'Doğrulama hatası' 63 | ); 64 | } 65 | } 66 | } 67 | ); 68 | } else { 69 | this.toastrService.warning( 70 | 'Lütfen marka bilgilerini eksiksiz doldurunuz.' 71 | ); 72 | } 73 | } 74 | 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.css: -------------------------------------------------------------------------------- 1 | 2 | #color{ 3 | background-color: teal; 4 | font-size: bold; 5 | color: white; 6 | } 7 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.html: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 |
    14 | 15 |
    16 |
    17 | 18 |
    19 |
  • Tüm Araçlar
  • 20 |
      21 |
    • {{color.colorName}}
    • 23 |
    24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /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 { ActivatedRoute, Router } from '@angular/router'; 3 | import { Color } from 'src/app/models/color'; 4 | import { ColorService } from 'src/app/services/color.service'; 5 | 6 | @Component({ 7 | selector: 'app-color', 8 | templateUrl: './color.component.html', 9 | styleUrls: ['./color.component.css'] 10 | }) 11 | export class ColorComponent implements OnInit { 12 | currentColor:Color; 13 | filterText: string = ""; 14 | colors:Color[]=[]; 15 | dataLoaded=false; 16 | 17 | constructor(private colorService:ColorService, 18 | private router:Router, 19 | private route:ActivatedRoute 20 | ) { } 21 | 22 | ngOnInit(): void { 23 | this.getColors(); 24 | } 25 | 26 | getColors(){ 27 | this.colorService.getColors().subscribe(response=>{ 28 | this.colors=response.data 29 | this.dataLoaded=true; 30 | }) 31 | 32 | } 33 | setCurrentColor(color: Color){ 34 | this.currentColor = color; 35 | } 36 | 37 | getCurrentColorClass(color: Color) { 38 | if(color == this.currentColor) { 39 | return "list-group-item active" 40 | } 41 | else{ 42 | return "list-group-item" 43 | } 44 | } 45 | 46 | getAllColorClass() { 47 | if (!this.currentColor) { 48 | return "list-group-item list-group-item-action list-group-item-dark active"; 49 | } else { 50 | return "list-group-item list-group-item-action list-group-item-dark"; 51 | } 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/customer/customer.component.css -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
    #ŞirketAdSoyAdE MailFindex Puanı
    {{customer.customerId}}{{customer.companyName}}{{customer.firstName}}{{customer.lastName}}{{customer.email}}{{customer.findexScore}}
    28 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CustomerComponent } from './customer.component'; 4 | 5 | describe('CustomerComponent', () => { 6 | let component: CustomerComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CustomerComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CustomerComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Customer } from 'src/app/models/customer'; 3 | import { CustomerService } from 'src/app/services/customer.service'; 4 | 5 | @Component({ 6 | selector: 'app-customer', 7 | templateUrl: './customer.component.html', 8 | styleUrls: ['./customer.component.css'] 9 | }) 10 | export class CustomerComponent implements OnInit { 11 | 12 | customers:Customer[]=[]; 13 | dataLoaded=false; 14 | constructor(private customerService:CustomerService) { } 15 | 16 | ngOnInit(): void { 17 | this.getCustomer(); 18 | } 19 | getCustomer(){ 20 | this.customerService.getCustomer().subscribe(response=>{ 21 | this.customers=response.data 22 | this.dataLoaded=true; 23 | }) 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/app/components/edit-user/edit-user.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/edit-user/edit-user.component.css -------------------------------------------------------------------------------- /src/app/components/edit-user/edit-user.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    5 |
    Merhaba, {{user.firstName}} {{user.lastName}}
    6 |
    7 | 8 |
    9 | 10 |
    11 | 12 |
    13 | 15 |
    16 |
    17 | 18 |
    19 | 20 |
    21 | 23 |
    24 |
    25 | 26 |
    27 | 28 |
    29 | 31 |
    32 |
    33 | 34 |
    35 | 36 |
    37 | 39 |
    40 |
    41 |
    42 |
    43 | 44 | 47 | 48 |
    49 |
    50 |
    51 | -------------------------------------------------------------------------------- /src/app/components/edit-user/edit-user.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { EditUserComponent } from './edit-user.component'; 4 | 5 | describe('EditUserComponent', () => { 6 | let component: EditUserComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ EditUserComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(EditUserComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/edit-user/edit-user.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { User } from 'src/app/models/user'; 6 | import { AuthService } from 'src/app/services/auth.service'; 7 | import { UserService } from 'src/app/services/user.service'; 8 | 9 | @Component({ 10 | selector: 'app-edit-user', 11 | templateUrl: './edit-user.component.html', 12 | styleUrls: ['./edit-user.component.css'] 13 | }) 14 | export class EditUserComponent implements OnInit { 15 | 16 | editProfileForm:FormGroup; 17 | password:FormControl; 18 | email:string; 19 | user:User; 20 | 21 | constructor( 22 | private userService:UserService, 23 | private formBuilder:FormBuilder, 24 | private toastrService:ToastrService, 25 | private authService:AuthService, 26 | private router:Router 27 | ) { } 28 | 29 | ngOnInit(): void { 30 | } 31 | createProfileAddForm(){ 32 | this.editProfileForm=this.formBuilder.group({ 33 | firstName:["",Validators.required], 34 | lastName:["",Validators.required], 35 | email:["",Validators.required], 36 | password:["",Validators.required] 37 | }) 38 | } 39 | getUser(){ 40 | this.userService.getByEmail(localStorage.getItem('email')!).subscribe(response=>{ 41 | this.user=response.data; 42 | this.editProfileForm.setValue({ 43 | firstName:this.user.firstName, 44 | lastName:this.user.lastName, 45 | email:this.user.email, 46 | password:"" 47 | }) 48 | },responseError=>{ 49 | this.toastrService.error(responseError.console.error); 50 | 51 | }) 52 | } 53 | editProfile(){//düzenle 54 | if(this.editProfileForm.valid){ 55 | let profilModel=Object.assign({},this.editProfileForm.value) 56 | console.log(this.user) 57 | profilModel.userId=this.user.userId; 58 | console.log(profilModel) 59 | this.userService.userUpdate(profilModel).subscribe(response=>{ 60 | this.toastrService.success("Tekrar Giriş Lütfen"); 61 | this.router.navigate(["/home"]); 62 | this.authService.logOut(); 63 | 64 | }, 65 | responseError=>{ 66 | this.toastrService.error(responseError.error); 67 | }); 68 | }else{ 69 | this.toastrService.error("HATA") 70 | } 71 | } 72 | 73 | } 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/app/components/home/home.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/home/home.component.css -------------------------------------------------------------------------------- /src/app/components/home/home.component.html: -------------------------------------------------------------------------------- 1 | 12 | 13 |
    14 |
    15 |
    16 | 17 | 18 |
    19 |
    20 |

    Hakkımzda

    21 |

    Lorem ipsum dolor sit amet consectetur adipisicing elit. Accusantium, cum!

    22 |

    Modi cumque aspernatur facere eaque enim debitis, placeat magnam quidem!

    23 |

    Quod, beatae doloribus aspernatur architecto corporis labore nulla nobis eligendi.

    24 |

    Pariatur, vero? Ad ipsum sequi fugit quia quam, ut nisi?

    25 | 26 |
    27 | 28 | 29 | 30 | 31 | 32 | 33 |
    34 |
    35 |
    36 |

    Arabalar

    37 |
    38 |
    39 |
    40 |
    41 |
    42 |
    43 |
    44 |
    45 |
    46 |
    47 |
    48 |
    49 | 50 |
    51 | 52 | 53 |
    54 | 100 |
    101 | -------------------------------------------------------------------------------- /src/app/components/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HomeComponent } from './home.component'; 4 | 5 | describe('HomeComponent', () => { 6 | let component: HomeComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ HomeComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(HomeComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-home', 5 | templateUrl: './home.component.html', 6 | styleUrls: ['./home.component.css'] 7 | }) 8 | export class HomeComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | } 5 | 6 | body { 7 | display: flex; 8 | align-items: center; 9 | padding-top: 40px; 10 | padding-bottom: 40px; 11 | 12 | } 13 | 14 | .form-signin { 15 | width: 100%; 16 | max-width: 330px; 17 | padding: 15px; 18 | margin: auto; 19 | } 20 | 21 | .form-signin .checkbox { 22 | font-weight: 400; 23 | } 24 | 25 | .form-signin .form-floating:focus-within { 26 | z-index: 2; 27 | } 28 | 29 | .form-signin input[type="email"] { 30 | margin-bottom: -1px; 31 | border-bottom-right-radius: 0; 32 | border-bottom-left-radius: 0; 33 | } 34 | 35 | .form-signin input[type="password"] { 36 | margin-bottom: 10px; 37 | border-top-left-radius: 0; 38 | border-top-right-radius: 0; 39 | } 40 | 41 | 42 | .bd-placeholder-img { 43 | font-size: 1.125rem; 44 | text-anchor: middle; 45 | -webkit-user-select: none; 46 | -moz-user-select: none; 47 | user-select: none; 48 | } 49 | 50 | @media (min-width: 768px) { 51 | .bd-placeholder-img-lg { 52 | font-size: 3.5rem; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
    4 |
    5 | 9 |

    Giriş Yap

    10 | 11 |
    12 | 18 | 19 |
    20 |
    21 | 27 | 28 |
    29 | 30 |
    31 | 34 |
    35 | 38 |

    © 2017–2021

    39 |
    40 |
    41 | 42 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginComponent } from './login.component'; 4 | 5 | describe('LoginComponent', () => { 6 | let component: LoginComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ LoginComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoginComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup,FormControl,Validators,FormBuilder} from "@angular/forms" 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { AuthService } from 'src/app/services/auth.service'; 6 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 7 | @Component({ 8 | selector: 'app-login', 9 | templateUrl: './login.component.html', 10 | styleUrls: ['./login.component.css'] 11 | }) 12 | 13 | export class LoginComponent implements OnInit { 14 | loginForm:FormGroup; 15 | 16 | 17 | constructor(private formBuilder:FormBuilder, 18 | private authService:AuthService, 19 | private toastrService:ToastrService, 20 | private localStorage:LocalStorageService, 21 | private router: Router) { } //servisi kullanabilmem için 22 | 23 | ngOnInit(): void { 24 | this.createLoginForm(); 25 | } 26 | createLoginForm(){ 27 | this.loginForm=this.formBuilder.group({ 28 | email:["",Validators.required], 29 | password:["",Validators.required] 30 | }) 31 | 32 | } 33 | 34 | login(){ //kişi login olduğu zaman 35 | if(this.loginForm.valid){ 36 | console.log(this.loginForm.value); 37 | let loginModel=Object.assign({},this.loginForm.value) 38 | this.authService.login(loginModel).subscribe(response=>{ 39 | this.toastrService.success("Giriş Başarılı","Başarılı") 40 | this.localStorage.setItem("token",response.data.token) 41 | this.router.navigateByUrl("/"); 42 | },responseError=>{ 43 | console.log(responseError) 44 | this.toastrService.error(responseError.error) 45 | }) 46 | } 47 | } 48 | 49 | 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/navi/navi.component.css -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 55 |
    56 | 57 | 58 | -------------------------------------------------------------------------------- /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 { ToastrService } from 'ngx-toastr'; 3 | import { AuthService } from 'src/app/services/auth.service'; 4 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 5 | 6 | @Component({ 7 | selector: 'app-navi', 8 | templateUrl: './navi.component.html', 9 | styleUrls: ['./navi.component.css'] 10 | }) 11 | export class NaviComponent implements OnInit { 12 | 13 | constructor(private authService:AuthService, 14 | private localStorageService:LocalStorageService, 15 | private toastr:ToastrService 16 | ) { } 17 | 18 | loginUser:any=[]; 19 | ngOnInit(): void { 20 | 21 | 22 | } 23 | login(){ 24 | this.authService.login(this.loginUser); 25 | } 26 | logOut(){ 27 | this.authService.logOut(); 28 | this.toastr.info("Çıkış Başarılı "); 29 | 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/payment/payment.component.css -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.html: -------------------------------------------------------------------------------- 1 | 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 |
    MarkaRenkModel YılıKiralama TarihiTeslim TarihiGünlük Kiralama ÜcretiToplam Ödenecek Tutar
    {{car.brandName}}{{car.colorName}}{{car.modelYear}}{{rental.rentDate}}{{rental.returnDate}}{{car.dailyPrice | vatAdded:8 |currency}}{{quantity | currency}}
    46 | 47 | 48 | 49 | No IMG 50 |
    51 | 52 |
    53 | 54 | 55 | 56 | 57 |
    58 | 59 |
    60 |
    61 | 62 | 67 |
    68 | 69 |
    70 | 72 | 73 |
    74 | 75 |
    76 | 77 | 78 |
    79 | 80 |
    81 |
    82 |
    83 | 85 | 86 |
    87 |
    88 |
    89 |
    90 | 91 | 92 |
    93 |
    94 |
    95 | 96 | 97 | 98 | 108 | 109 |
    110 | 111 |
    112 |
    113 |
    -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PaymentComponent } from './payment.component'; 4 | 5 | describe('PaymentComponent', () => { 6 | let component: PaymentComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ PaymentComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PaymentComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Car } from 'src/app/models/car'; 6 | import { CarDto } from 'src/app/models/carDto'; 7 | import { CreditCard } from 'src/app/models/creditCard'; 8 | import { Payment } from 'src/app/models/payment'; 9 | import { Rental } from 'src/app/models/rental'; 10 | import { CarService } from 'src/app/services/car.service'; 11 | import { CreditCardService } from 'src/app/services/credit-card.service'; 12 | import { PaymentService } from 'src/app/services/payment.service'; 13 | import { RentalService } from 'src/app/services/rental.service'; 14 | 15 | @Component({ 16 | selector: 'app-payment', 17 | templateUrl: './payment.component.html', 18 | styleUrls: ['./payment.component.css'] 19 | }) 20 | export class PaymentComponent implements OnInit { 21 | 22 | 23 | rental:Rental; 24 | car:Car; 25 | cars:Car[]=[]; 26 | 27 | quantity:number; 28 | creditCardNumber:string; 29 | nameOnTheCard: string; 30 | expirationDate:string;//son kullanma tarihi 31 | cvv:number; 32 | carId:number; 33 | creditCard:CreditCard[]=[]; 34 | 35 | 36 | 37 | creditCardForm:FormGroup; 38 | imageUrl="https://localhost:44301" 39 | 40 | constructor(private rentalService:RentalService, 41 | private paymentService:PaymentService, 42 | private toastrService: ToastrService, 43 | private formBuilder:FormBuilder, 44 | private creditCardService:CreditCardService, 45 | private carService:CarService, 46 | private activatedRoute:ActivatedRoute) { } 47 | 48 | ngOnInit(): void { 49 | this.activatedRoute.params.subscribe(params=>{ 50 | if(params['rental']){ 51 | this.rental=JSON.parse(params['rental']); 52 | if(params['carId']){ 53 | this.getCar(params['carId']); 54 | } 55 | 56 | this.getCardByCustomer(); 57 | this.createCreditCardForm(); 58 | 59 | } 60 | }) 61 | 62 | } 63 | 64 | createCreditCardForm(){ 65 | this.creditCardForm=this.formBuilder.group({ 66 | customerCards:["",Validators .required], 67 | nameOnTheCard:["",Validators.required], 68 | cardNumber:["",Validators.required,Validators.maxLength(20)], 69 | cvv:["",Validators.required,Validators.maxLength(3)], 70 | expirationDate:["",Validators.required] 71 | 72 | 73 | 74 | }); 75 | } 76 | 77 | record(){ //kayıt 78 | let cardModel:CreditCard={ 79 | creditCardNumber:this.creditCardNumber, 80 | nameOnTheCard: this.nameOnTheCard, 81 | expirationDate: this.expirationDate, 82 | cvv: this.cvv, 83 | customerId:this.rental.customerId, 84 | 85 | }; 86 | this.creditCardService.addCreditCard(cardModel).subscribe((response)=>{ 87 | this.toastrService.success("Kayıt Başarılı"); 88 | this.addPayment(); 89 | },responseError=>{ 90 | this.toastrService.error("Hata",responseError.error); 91 | 92 | } 93 | ); 94 | } 95 | 96 | 97 | addPayment(){ 98 | if(this.quantity> 100){ 99 | let paymentModel:Payment={ 100 | quantity:this.quantity 101 | } 102 | this.paymentService.payment(paymentModel).subscribe(response=>{ 103 | this.toastrService.success("Ödeme İşlemi Başarılı"); 104 | },error =>{ 105 | this.toastrService.error(error.error); 106 | 107 | }) 108 | } 109 | 110 | 111 | } 112 | getCardByCustomer(){ 113 | this.creditCardService.getCustomerIdCreditCard(this.rental.customerId).subscribe(response=>{ 114 | this.creditCard=response.data; 115 | this.creditCard.forEach(response=>{ 116 | this.creditCardNumber=response.creditCardNumber; 117 | this.nameOnTheCard=response.nameOnTheCard; 118 | this.expirationDate=response.expirationDate; 119 | this.cvv=response.cvv; 120 | }); 121 | }); 122 | } 123 | setCardInfos(){ //kart bilgilerini ayarlamakk için 124 | this.creditCardForm.patchValue({ 125 | creditCardNumber:this.creditCardNumber, 126 | nameOnTheCard:this.nameOnTheCard, 127 | expirationDate:this.expirationDate, 128 | cvv:this.cvv, 129 | }); 130 | } 131 | 132 | // getCar(){ 133 | // this.carService.getCarDetailsByCarId(this.rental.carId).subscribe(response=>{ 134 | // this.cars=response.data; 135 | // this.totalPayment(); 136 | // }) 137 | // } 138 | getCar(carId: number){ 139 | this.carService.getCarDetailsByCarId(carId).subscribe(response=>{ 140 | this.car= response.data[0]; 141 | this.totalPayment(); 142 | }) 143 | 144 | } 145 | totalPayment(){ 146 | if(this.rental.returnDate!=null){ 147 | let rentDate=new Date(this.rental.returnDate.toString()); 148 | let returnDate=new Date(this.rental.rentDate.toString()); 149 | let difference =(rentDate.getTime()-returnDate.getTime()); 150 | let differenceOfDays = Math.ceil(difference / (1000 * 3600 * 24)); 151 | if(differenceOfDays==0){ 152 | differenceOfDays=1; 153 | 154 | } 155 | this.quantity=differenceOfDays*(this.car.dailyPrice+(this.car.dailyPrice*8/100)); //kdv hesapla 156 | } 157 | 158 | } 159 | 160 | } 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | } 5 | 6 | body { 7 | display: flex; 8 | align-items: center; 9 | padding-top: 40px; 10 | padding-bottom: 40px; 11 | 12 | } 13 | 14 | .form-signin { 15 | width: 100%; 16 | max-width: 330px; 17 | padding: 15px; 18 | margin: auto; 19 | } 20 | 21 | .form-signin .checkbox { 22 | font-weight: 400; 23 | } 24 | 25 | .form-signin .form-floating:focus-within { 26 | z-index: 2; 27 | } 28 | 29 | .form-signin input[type="firstName"] { 30 | margin-bottom: -1px; 31 | border-bottom-right-radius: 0; 32 | border-bottom-left-radius: 0; 33 | } 34 | .form-signin input[type="lastName"] { 35 | margin-bottom: -1px; 36 | border-bottom-right-radius: 0; 37 | border-bottom-left-radius: 0; 38 | } 39 | 40 | .form-signin input[type="email"] { 41 | margin-bottom: -1px; 42 | border-bottom-right-radius: 0; 43 | border-bottom-left-radius: 0; 44 | } 45 | 46 | .form-signin input[type="password"] { 47 | margin-bottom: 10px; 48 | border-top-left-radius: 0; 49 | border-top-right-radius: 0; 50 | } -------------------------------------------------------------------------------- /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 |

    Zaten bir hesabın var mı?

    25 | 26 | 27 |
    28 |
    29 | 30 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RegisterComponent } from './register.component'; 4 | 5 | describe('RegisterComponent', () => { 6 | let component: RegisterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ RegisterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RegisterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormControl, Validators, FormGroup } from '@angular/forms'; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { AuthService } from 'src/app/services/auth.service'; 6 | 7 | @Component({ 8 | selector: 'app-register', 9 | templateUrl: './register.component.html', 10 | styleUrls: ['./register.component.css'] 11 | }) 12 | 13 | export class RegisterComponent implements OnInit { 14 | 15 | registerForm: FormGroup; 16 | 17 | constructor(private authService: AuthService, 18 | private formBuilder: FormBuilder, 19 | private toastrService: ToastrService, 20 | private router: Router) { } 21 | 22 | ngOnInit(): void { 23 | this.createRegisterForm(); 24 | } 25 | 26 | createRegisterForm() { 27 | this.registerForm = this.formBuilder.group( 28 | { 29 | firstName: ["", Validators.required], 30 | lastName: ["", Validators.required], 31 | password: ["", [Validators.required, Validators.minLength(4), Validators.maxLength(8)]], 32 | //tekrrar gir şifre 33 | email: ["", Validators.required] 34 | } 35 | 36 | ) 37 | } 38 | 39 | register() { //kişi login olduğu zaman 40 | if (this.registerForm.valid) { 41 | console.log(this.registerForm.value); 42 | let registerModel = Object.assign({}, this.registerForm.value) 43 | 44 | this.authService.register(registerModel).subscribe(response => { 45 | this.toastrService.info(response.message) 46 | localStorage.setItem("token", response.data.token) 47 | this.router.navigateByUrl("/"); 48 | }, responseError => { 49 | console.log(responseError) 50 | this.toastrService.error(responseError.error) 51 | }) 52 | } else { 53 | this.toastrService.warning("Bilgileri doldurun", "Dikkat") 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/app/components/rental-list/rental-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/rental-list/rental-list.component.css -------------------------------------------------------------------------------- /src/app/components/rental-list/rental-list.component.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
    #MarkaKullancıŞirketKiralama TarihiTeslim Tarihi
    {{rentalDto.rentalId}}{{rentalDto.brandName}}{{rentalDto.userName}}{{rentalDto.companyName}}{{rentalDto.rentDate}}{{rentalDto.returnDate}}
    27 | -------------------------------------------------------------------------------- /src/app/components/rental-list/rental-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RentalListComponent } from './rental-list.component'; 4 | 5 | describe('RentalListComponent', () => { 6 | let component: RentalListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ RentalListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RentalListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/rental-list/rental-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { RentalDto } from 'src/app/models/rentalDto'; 3 | import { RentalService } from 'src/app/services/rental.service'; 4 | 5 | @Component({ 6 | selector: 'app-rental-list', 7 | templateUrl: './rental-list.component.html', 8 | styleUrls: ['./rental-list.component.css'] 9 | }) 10 | export class RentalListComponent implements OnInit { 11 | 12 | rentals:RentalDto[]; 13 | 14 | constructor(private rentalService:RentalService) { } 15 | 16 | ngOnInit(): void { 17 | this.getRentals(); 18 | } 19 | getRentals(){ 20 | this.rentalService.getRentals().subscribe(response=>{ 21 | this.rentals=response.data; 22 | }) 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/app/components/rental/rental.component.css -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RentalComponent } from './rental.component'; 4 | 5 | describe('RentalComponent', () => { 6 | let component: RentalComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ RentalComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RentalComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Car } from 'src/app/models/car'; 6 | import { CarDto } from 'src/app/models/carDto'; 7 | import { Customer } from 'src/app/models/customer'; 8 | import { Rental } from 'src/app/models/rental'; 9 | import { RentalDto } from 'src/app/models/rentalDto'; 10 | import { AuthService } from 'src/app/services/auth.service'; 11 | import { CarService } from 'src/app/services/car.service'; 12 | import { CustomerService } from 'src/app/services/customer.service'; 13 | import { RentalService } from 'src/app/services/rental.service'; 14 | 15 | @Component({ 16 | selector: 'app-rental', 17 | templateUrl: './rental.component.html', 18 | styleUrls: ['./rental.component.css'] 19 | }) 20 | 21 | export class RentalComponent implements OnInit { 22 | 23 | customers: Customer[] = []; 24 | cars: Car; 25 | rentals: Rental[] = []; 26 | rentaldto: RentalDto[]; 27 | rental: Rental; 28 | customerId: number; 29 | carId: number; 30 | rentDate: Date; 31 | returnDate: Date; 32 | // isRented:boolean = false; //Arabanın o nkş kıralı olup olmamması 33 | 34 | @Input() car: CarDto; 35 | 36 | constructor(private rentalService: RentalService, 37 | private customerService: CustomerService, 38 | private toastrService: ToastrService, 39 | private carService: CarService, 40 | private authService: AuthService, 41 | private router: Router) { } 42 | 43 | ngOnInit(): void { 44 | this.getCustomer(); 45 | this.getDate(2); 46 | } 47 | 48 | isLogOK() { 49 | if (this.authService.isAuthenticated()) { 50 | return true; 51 | } else { 52 | this.toastrService.error("Must be Login or Register") 53 | this.router.navigate(['/']) 54 | return false; 55 | } 56 | } 57 | 58 | getCustomer() { 59 | this.customerService.getCustomer().subscribe(response => { 60 | this.customers = response.data 61 | }); 62 | } 63 | 64 | getDate(day: number) { //tarih al 65 | var today = new Date(); 66 | today.setDate(Number(today.getDay()) + day); 67 | return today.toISOString().slice(0, 10) 68 | } 69 | 70 | 71 | create() { 72 | let rental: Rental = { 73 | carId: this.car.carId, 74 | customerId: this.customerId, 75 | rentDate: this.rentDate, 76 | returnDate: this.returnDate 77 | } 78 | 79 | rental.carId = Number(rental.carId); 80 | rental.customerId = Number(rental.customerId); 81 | 82 | this.rentalService.addRental(rental).subscribe(response => { 83 | this.toastrService.info("Ödeme Sayfasına Git"); 84 | this.toastrService.success("Kiralama İşlemi Başarılı"); 85 | this.router.navigate(['/payment', JSON.stringify(rental)]); 86 | }, error => { 87 | console.info(error) 88 | this.toastrService.error(error.error) 89 | this.toastrService.error(error.error.message) 90 | }) 91 | } 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | // getRentalDetails(){ 102 | // this.rentalService.getRentalDetails().subscribe(response=>{ 103 | // this.rentaldto = response.data 104 | // }) 105 | // } 106 | 107 | // getRentalByCarId(carId: number){ 108 | // this.carService.getCarDetailsByCarId(carId).subscribe(response=>{ 109 | // this.cars= response.data[0]; 110 | // }) 111 | 112 | // } 113 | 114 | 115 | 116 | 117 | } 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /src/app/guards/login.guard.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Observable } from 'rxjs'; 5 | import { AuthService } from '../services/auth.service'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class LoginGuard implements CanActivate { 11 | constructor(private authService:AuthService, //kişi otantikemi 12 | private toastrService:ToastrService,//bilgi vernek için 13 | private router:Router){ //logine yönlendirmek için 14 | 15 | } 16 | 17 | canActivate( 18 | route: ActivatedRouteSnapshot, 19 | state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { 20 | 21 | if(this.authService.isAuthenticated()){ 22 | return true; 23 | } 24 | else{ 25 | this.router.navigate(["login"]) 26 | this.toastrService.info("Sisteme Giriş Yapmalısınız") 27 | return false; 28 | } 29 | } 30 | 31 | } 32 | //işlemi yapacak kişinin izni(token) varmı varsa devam yoksa ...(car add işlemi ..) 33 | //izni yoksa logine yönlendir 34 | //ve app.routing de cars/add senin guarden şu de -------------------------------------------------------------------------------- /src/app/interceptors/auth.interceptor.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthInterceptor } from './auth.interceptor'; 4 | 5 | describe('AuthInterceptor', () => { 6 | beforeEach(() => TestBed.configureTestingModule({ 7 | providers: [ 8 | AuthInterceptor 9 | ] 10 | })); 11 | 12 | it('should be created', () => { 13 | const interceptor: AuthInterceptor = TestBed.inject(AuthInterceptor); 14 | expect(interceptor).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/interceptors/auth.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { 3 | HttpRequest, 4 | HttpHandler, 5 | HttpEvent, 6 | HttpInterceptor 7 | } from '@angular/common/http'; 8 | import { Observable } from 'rxjs'; 9 | 10 | @Injectable() 11 | export class AuthInterceptor implements HttpInterceptor { 12 | 13 | constructor() {} 14 | 15 | intercept(request: HttpRequest, next: HttpHandler): Observable> { 16 | let token =localStorage.getItem("token"); //tokenımızı yakaladık 17 | let newRequest: HttpRequest; 18 | newRequest= request.clone({ 19 | headers:request.headers.set("Authorization","Bearer "+token) 20 | }) 21 | return next.handle(newRequest); 22 | } 23 | } 24 | 25 | 26 | //request = urun eklemek için bilgileri girmek ve başmak 27 | 28 | // next = bir sonraki aşamada uygulanacak olan 29 | 30 | 31 | //token koymak için üye olurken ona vereceğim tokenı (yetkiyi) koyuyoruz. -------------------------------------------------------------------------------- /src/app/models/brand.ts: -------------------------------------------------------------------------------- 1 | export interface Brand{ 2 | brandId:number, 3 | brandName:string 4 | } -------------------------------------------------------------------------------- /src/app/models/car.ts: -------------------------------------------------------------------------------- 1 | export interface Car{ 2 | carId:number, 3 | branId:number, 4 | colorId:number, 5 | brandName:string, 6 | colorName:string, 7 | modelYear:number, 8 | dailyPrice:number, 9 | description:string, 10 | // imagePath:string[]; 11 | //date: Date; 12 | minFindeksScore?:number 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/app/models/carDto.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface CarDto{ 3 | carId:number; 4 | carName:string; 5 | brandName?:string; 6 | colorName:string; 7 | modelYear:number; 8 | dailyPrice:number; 9 | description:string; 10 | isRented:boolean; 11 | brandId?:number, 12 | colorId?:number, 13 | //imagePath:string[]; 14 | minFindeksScore:number, 15 | // date:Date 16 | } -------------------------------------------------------------------------------- /src/app/models/carImage.ts: -------------------------------------------------------------------------------- 1 | export interface CarImage{ 2 | id:number, 3 | carId:number, 4 | imagePath:string, 5 | date:Date, 6 | } -------------------------------------------------------------------------------- /src/app/models/color.ts: -------------------------------------------------------------------------------- 1 | export interface Color{ 2 | colorId:number, 3 | colorName:string, 4 | } -------------------------------------------------------------------------------- /src/app/models/creditCard.ts: -------------------------------------------------------------------------------- 1 | export interface CreditCard{ 2 | cardId?:number; 3 | paymentId?:number, 4 | customerId:number; 5 | nameOnTheCard:string;//kart üzerindeki isim 6 | cvv:number; 7 | creditCardNumber:string; 8 | expirationDate:string; //son kullanma tarihi 9 | //securityCode?:string; güvenlik kodu 10 | } -------------------------------------------------------------------------------- /src/app/models/customer.ts: -------------------------------------------------------------------------------- 1 | export interface Customer{ 2 | customerId :number, 3 | userId:number, 4 | firstName:string, 5 | lastName:string, 6 | email:string, 7 | componyName:string, 8 | findexScore?:number, 9 | 10 | 11 | 12 | } -------------------------------------------------------------------------------- /src/app/models/listResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./responseModel"; 2 | 3 | export interface ListResponseModel extends ResponseModel{ 4 | data:T[]; 5 | } 6 | //dönecek olan liste 7 | -------------------------------------------------------------------------------- /src/app/models/loginModel.ts: -------------------------------------------------------------------------------- 1 | export interface LoginModel{ 2 | email:string, 3 | password:string 4 | } -------------------------------------------------------------------------------- /src/app/models/payment.ts: -------------------------------------------------------------------------------- 1 | export interface Payment { 2 | quantity:number;//miktar 3 | } -------------------------------------------------------------------------------- /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.ts: -------------------------------------------------------------------------------- 1 | export interface Rental{ 2 | rentalId?:number, 3 | carId: number, 4 | customerId: number, 5 | rentDate:Date, 6 | returnDate:Date, 7 | //price? :number 8 | } -------------------------------------------------------------------------------- /src/app/models/rentalDto.ts: -------------------------------------------------------------------------------- 1 | export interface RentalDto{ 2 | 3 | rentalId: number; 4 | userName:number; 5 | // carId: number; 6 | //customerId: number, 7 | 8 | brandName: string; 9 | companyName:string;//şirket adı 10 | // colorName: string; 11 | // dailyPrice: number; 12 | rentDate: Date; 13 | returnDate: Date; 14 | // modelYear : number; 15 | //price: string; 16 | 17 | } -------------------------------------------------------------------------------- /src/app/models/responseModel.ts: -------------------------------------------------------------------------------- 1 | export interface ResponseModel{ 2 | success:boolean, 3 | message:string 4 | 5 | } 6 | //apımden gelecek olanlar 7 | //backendimden gelen kısım 8 | -------------------------------------------------------------------------------- /src/app/models/singleResponseModel.ts: -------------------------------------------------------------------------------- 1 | 2 | import { ResponseModel } from "./responseModel"; 3 | 4 | export interface SingleResponseModel extends ResponseModel{ 5 | data: T; 6 | } 7 | -------------------------------------------------------------------------------- /src/app/models/tokenModel.ts: -------------------------------------------------------------------------------- 1 | export interface TokenModel{ 2 | token:string, 3 | expiration:string 4 | 5 | } -------------------------------------------------------------------------------- /src/app/models/user.ts: -------------------------------------------------------------------------------- 1 | export interface User{ 2 | userId:number; 3 | firstName:string; 4 | lastName:string; 5 | email:string; 6 | password:string; 7 | } -------------------------------------------------------------------------------- /src/app/pipes/brand-filter.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { Brand } from '../models/brand'; 3 | 4 | @Pipe({ 5 | name: 'brandFilter' 6 | }) 7 | export class BrandFilterPipe implements PipeTransform { 8 | 9 | transform(value: Brand[], filterText:string): Brand[]{ 10 | filterText = filterText ? filterText.toLocaleLowerCase() 11 | : "" 12 | return filterText 13 | ? value.filter((b:Brand) => b.brandName.toLocaleLowerCase().indexOf(filterText) !== -1) 14 | :value 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /src/app/pipes/car-filter.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { Car } from '../models/car'; 3 | 4 | @Pipe({ 5 | name: 'carFilter' 6 | }) 7 | export class CarFilterPipe implements PipeTransform { 8 | 9 | transform(value: Car[], filterText: string): Car[] { 10 | filterText = filterText ? filterText.toLocaleLowerCase() 11 | : "" 12 | return filterText 13 | ? value.filter((c:Car)=> c.description.toLocaleLowerCase().indexOf(filterText)!==-1) 14 | :value; 15 | } 16 | 17 | } 18 | 19 | 20 | 21 | 22 | 23 | 24 | //open in ...= ng g pipe car 25 | //pipe=elindeki veriyi görsel olarak daha faklı göstermek için kullanılır geeln veriyi html de daha farklı göstermek 26 | //istersem . 27 | // | bu simge ile yapılır .O veriye pipe uygula 28 | // uppercase =hepsini büyük harfle göster 29 | // lowercase = küçük harafle göster 30 | 31 | 32 | 33 | //value: Car[]=gönderilen veri tipi "değiştirmwkm istediğim değer" 34 | //filterText: string = verilen filtre parametre 35 | //Car[] =dönüş tipi 36 | 37 | 38 | 39 | 40 | //js büyük küçük harf duyarlı o yuzden filret büyük yada küçük yapmmam lazım 41 | //filterText ? = filter text varmı 42 | //filterText.toLocaleLowerCase() =varsa dönüştür küçük harfe 43 | //filterText ? filterText.toLocaleLowerCase() 44 | // : "" = değilse null 45 | 46 | 47 | // return filterText ? = filter text varmı 48 | // value.filter((c:Car) =varsa arabaları fitrele value ile çıkan sonıçları yeni bir [] atıyor 49 | //filter ile tek tek doolanıyor 50 | // description.toLocaleLowerCase =açıklamayı küçük harfe cevir 51 | // ndexOf =varrmı 52 | // filterText)!==- =1 = varsa onu yeni bir [] yap onu döndür 53 | // :value; = yoksa aynnen döndür 54 | 55 | 56 | // vede bunu html de uygula 57 | -------------------------------------------------------------------------------- /src/app/pipes/color-filter.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { Color } from '../models/color'; 3 | 4 | @Pipe({ 5 | name: 'colorFilter' 6 | }) 7 | export class ColorFilterPipe implements PipeTransform { 8 | 9 | transform(value: Color[], filterText:string): Color[] { 10 | filterText = filterText ? filterText.toLocaleLowerCase() 11 | : "" 12 | return filterText 13 | ? value.filter((co: Color) => co.colorName.toLocaleLowerCase().indexOf(filterText) !== -1) 14 | :value 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/app/services/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Router } from '@angular/router'; 4 | import { Observable } from 'rxjs'; 5 | import { LoginModel } from '../models/loginModel'; 6 | import { RegisterModel } from '../models/registerModel'; 7 | import { SingleResponseModel } from '../models/singleResponseModel'; 8 | 9 | import { TokenModel } from '../models/tokenModel'; 10 | import { LocalStorageService } from './local-storage.service'; 11 | 12 | @Injectable({ 13 | providedIn: 'root' 14 | }) 15 | 16 | export class AuthService { 17 | 18 | apiUrl = "https://localhost:44301/api/auth/"; 19 | 20 | constructor(private httpClient: HttpClient, 21 | private localStorageService: LocalStorageService) { } 22 | 23 | login(loginModel: LoginModel): Observable> { 24 | let newPath = this.apiUrl + 'login'; 25 | return this.httpClient.post>(newPath, loginModel); 26 | } 27 | 28 | isAuthenticated() { 29 | return this.localStorageService.isExist("token"); 30 | } 31 | 32 | register(registerModel: RegisterModel): Observable> { 33 | let newPath = this.apiUrl + 'register'; 34 | return this.httpClient.post>(newPath, registerModel); 35 | } 36 | 37 | logOut() { 38 | localStorage.removeItem("token"); //silme 39 | localStorage.removeItem("user"); 40 | localStorage.removeItem("email"); 41 | } 42 | } -------------------------------------------------------------------------------- /src/app/services/brand.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Brand } from '../models/brand'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | 8 | 9 | 10 | 11 | @Injectable({ 12 | providedIn: 'root' 13 | }) 14 | export class BrandService { 15 | apiUrl="https://localhost:44301/api/" 16 | 17 | constructor(private httpClient: HttpClient ) { } 18 | 19 | 20 | getBrands(): Observable>{ 21 | let newPath =this.apiUrl + "brands/getall" 22 | return this.httpClient.get>(newPath); 23 | } 24 | 25 | getByBrandId(brandId : number): Observable>{ 26 | let newPath = this.apiUrl + "brands/getbybrandid?id="+brandId; 27 | return this.httpClient.get>(newPath); 28 | } 29 | 30 | add(brand: Brand) : Observable{ 31 | let newPath =this.apiUrl + "brands/add" 32 | return this.httpClient.post(newPath, brand); 33 | } 34 | 35 | update(brand: Brand) : Observable{ 36 | let newPath =this.apiUrl + "brands/update" 37 | return this.httpClient.post(newPath, brand); 38 | } 39 | 40 | delete(brand:Brand): Observable{ 41 | let newPath = this.apiUrl +"brands/delete"; 42 | return this.httpClient.post(newPath,brand); 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/app/services/car-image.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { CarImage } from '../models/carImage'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class CarImageService { 12 | apiUrl="https://localhost:44301/api/"; 13 | 14 | constructor(private httpClient:HttpClient) { } 15 | 16 | getCarImages():Observable>{ 17 | let newPath= this.apiUrl+"carimages/getall"; 18 | return this.httpClient.get>(newPath); 19 | 20 | } 21 | getCarImagesByCarId(carId:number):Observable>{ 22 | let newPath = this.apiUrl + "carimages/getCarImagesByCarId?carId=" + carId; 23 | return this.httpClient.get>(newPath); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/app/services/car.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { Car } from '../models/car'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | import { CarDto } from '../models/carDto'; 8 | 9 | 10 | @Injectable({ //bu bir servis 11 | providedIn: 'root' 12 | }) 13 | export class CarService { 14 | apiUrl="https://localhost:44301/api/" ; 15 | 16 | constructor(private httpClient:HttpClient ) { } 17 | //appmodule import etmmen lazım 18 | 19 | 20 | 21 | getCars():Observable>{ 22 | let newPath=this.apiUrl+"cars/getall"; 23 | return this.httpClient.get>(newPath); //servisten api isteği için 24 | 25 | 26 | } 27 | 28 | getCarsByBrandId(brandId:number):Observable>{ //bunu kullanacağim componente 29 | let newPath=this.apiUrl+"cars/getcarsbybrandid?brandId="+brandId; // yeni adresim 30 | return this.httpClient.get>(newPath); 31 | } 32 | getCarsByColorId(colorId:number):Observable>{ 33 | let newPath=this.apiUrl+"cars/getcarsbycolorid?colorId="+colorId; 34 | return this.httpClient.get>(newPath); 35 | } 36 | 37 | 38 | getCarDetailsByCarId(carId:number):Observable>{ 39 | let newPath = this.apiUrl + "cars/getcardetailbycarid?carId=" + carId; 40 | return this.httpClient.get>(newPath); 41 | } 42 | getCarByColorAndBrand(colorId:number, brandId:number) : Observable>{ 43 | let newPath = this.apiUrl + "cars/getbycolorandbrandid?colorId="+colorId+"&brandId="+brandId; 44 | return this.httpClient.get>(newPath); 45 | 46 | } 47 | 48 | add(car: Car): Observable{ 49 | let newPath = this.apiUrl +"cars/add"; 50 | return this.httpClient.post(newPath,car); 51 | } 52 | 53 | delete(car: Car): Observable{ 54 | let newPath = this.apiUrl +"cars/delete"; 55 | return this.httpClient.post(newPath,car); 56 | } 57 | 58 | update(car: Car): Observable{ 59 | let newPath = this.apiUrl +"cars/update"; 60 | return this.httpClient.post(newPath,car); 61 | } 62 | 63 | } 64 | 65 | //arayüzle ilgili genel çagrıları api cağrılarını buna yazarız 66 | //open ile ng g service car 67 | //kod yazarken direk serviceden başlayacağız 68 | //controler ile (api) dişarı açtık (getall) 69 | 70 | -------------------------------------------------------------------------------- /src/app/services/color.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Color } from '../models/color'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class ColorService { 13 | apiUrl="https://localhost:44301/api/" 14 | 15 | constructor(private httpClient:HttpClient ) { } 16 | 17 | getColors():Observable> { 18 | let newPath =this.apiUrl + "colors/getall" 19 | return this.httpClient.get>(newPath); 20 | } 21 | 22 | add(color: Color) : Observable{ 23 | let newPath =this.apiUrl + "colors/add" 24 | return this.httpClient.post(newPath, color); 25 | } 26 | 27 | update(color: Color) : Observable{ 28 | let newPath =this.apiUrl + "colors/update" 29 | return this.httpClient.post(newPath, color); 30 | } 31 | 32 | delete(color: Color): Observable{ 33 | let newPath = this.apiUrl +"colors/delete"; 34 | return this.httpClient.post(newPath, color); 35 | } 36 | 37 | getByColorId(colorId : number): Observable>{ 38 | let newPath = this.apiUrl + "colors/getbycolorid?colorid="+colorId; 39 | return this.httpClient.get>(newPath); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/app/services/credit-card.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | //import { CreateTracingOptions } from 'node:trace_events'; 4 | import { Observable } from 'rxjs'; 5 | import { CreditCard } from '../models/creditCard'; 6 | import { ListResponseModel } from '../models/listResponseModel'; 7 | import { ResponseModel } from '../models/responseModel'; 8 | import { AuthService } from './auth.service'; 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class CreditCardService { 14 | 15 | apiUrl="https://localhost:44301/api/"; 16 | 17 | constructor(private httpClient:HttpClient, 18 | private authService:AuthService) { } 19 | 20 | addCreditCard(card:CreditCard):Observable{ 21 | let newPath=this.apiUrl+"creditCards/add"; 22 | return this.httpClient.post(newPath,card); 23 | 24 | } 25 | getCustomerIdCreditCard(customerId:number):Observable>{ 26 | let newPath=this.apiUrl+"creditCards/getbycustomer?id=+id"; 27 | return this.httpClient.get>(newPath); 28 | } 29 | updateCreditCard(card:CreditCard):Observable{ 30 | let newPath=this.apiUrl+"creditCards/update"; 31 | return this.httpClient.post(newPath,card); 32 | 33 | } 34 | deleteCreditCard(card:CreditCard):Observable{ 35 | let newPath=this.apiUrl+"creditCards/delete"; 36 | return this.httpClient.post(newPath,card); 37 | 38 | } 39 | // saveCreditCard(payment:Payment):Observable{ 40 | // let customerCreditCard:CreditCard = {customerId:this.authService.currentUserId,cardId:payment.pa} 41 | // let newPath = this.apiUrl +"customercreditcard/add" 42 | // return this.httpClient.post(newPath,customerCreditCard) 43 | // } 44 | 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/app/services/customer.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Customer } from '../models/customer'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | import { SingleResponseModel } from '../models/singleResponseModel'; 8 | 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class CustomerService { 14 | apiUrl="https://localhost:44301/api/" 15 | 16 | constructor(private httpClient: HttpClient) { } 17 | 18 | getCustomer(): Observable>{ 19 | let newPath = this.apiUrl+'customers/getcustomerdetails'; 20 | return this.httpClient.get>(newPath); 21 | } 22 | getCustomerById(customerId:number):Observable>{ 23 | let newPath =this.apiUrl+'customers/getbyid?id='+customerId; 24 | return this.httpClient.get>(newPath); 25 | } 26 | getCustomerByUserId(userId:number):Observable>{ 27 | let newPath =this.apiUrl+'customers/getcustomerdetailbyuserid?userid='+userId; 28 | return this.httpClient.get>(newPath); 29 | } 30 | addCustomer(customer:Customer):Observable{ 31 | let newPath = this.apiUrl + "customers/add"; 32 | return this.httpClient.post(newPath,customer) 33 | } 34 | 35 | updateCustomer(customer:Customer):Observable{ 36 | let newPath = this.apiUrl + "customers/update"; 37 | return this.httpClient.post(newPath,customer) 38 | } 39 | deleteCustomer(customer:Customer):Observable{ 40 | let newPath = this.apiUrl+ "customers/delete"; 41 | return this.httpClient.post(newPath,customer) 42 | } 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/app/services/findeks.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ResponseModel } from '../models/responseModel'; 5 | 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class FindeksService { 11 | 12 | constructor(private httpClient:HttpClient) { } 13 | apiUrl="https://localhost:44301/api/" 14 | 15 | 16 | 17 | findeks(carId: number,customerId:number): Observable { 18 | return this.httpClient.get(this.apiUrl + 'query?carId=' + carId + '&customerId=' + customerId); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/app/services/local-storage.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable({ 4 | providedIn: 'root' 5 | }) 6 | export class LocalStorageService { 7 | 8 | constructor() { } 9 | 10 | 11 | setItem(key:string,object:T){ 12 | localStorage.setItem(key,JSON.stringify(object)); 13 | } 14 | 15 | getItem(key:string){ 16 | return JSON.parse(localStorage.getItem(key)!); 17 | } 18 | 19 | removeItem(key:string){ 20 | localStorage.removeItem(key); 21 | } 22 | 23 | isExist(key:string):boolean{ 24 | if(JSON.parse(localStorage.getItem(key)!)){ 25 | return true; 26 | }else{ 27 | return false; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/app/services/payment.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from '../models/listResponseModel'; 5 | import { Payment } from '../models/payment'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class PaymentService { 12 | 13 | apiUrl = "https://localhost:44301/api/"; 14 | constructor(private httpClient: HttpClient) { } 15 | 16 | 17 | 18 | payment(payment:Payment):Observable{ 19 | let newPath=this.apiUrl+"rentals/payment"; 20 | return this.httpClient.post(newPath,payment) 21 | } 22 | 23 | 24 | 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/app/services/rental.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from '../models/listResponseModel'; 5 | import { Rental } from '../models/rental'; 6 | import { RentalDto } from '../models/rentalDto'; 7 | import { ResponseModel } from '../models/responseModel'; 8 | 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class RentalService { 14 | apiUrl="https://localhost:44301/api/" 15 | 16 | 17 | constructor(private httpClient:HttpClient) { } 18 | 19 | getRentals(): Observable> { 20 | let newPath = this.apiUrl +"rentals/getall" 21 | 22 | return this.httpClient.get>(newPath); 23 | } 24 | // getRentalDetails(): Observable>{ 25 | // let newPath = this.apiUrl +"rentals/getrentaldetails" 26 | // return this.httpClient.get>(newPath); 27 | // } 28 | // getRentalByCarId(carId: number): Observable> { 29 | // let newPath = this.apiUrl +"rentals/getbycarid?id="+carId; 30 | // return this.httpClient.get> (newPath); 31 | // } 32 | 33 | addRental(rental: Rental) : Observable{ 34 | let newPath = this.apiUrl+ "rentals/add" 35 | return this.httpClient.post(newPath,rental); 36 | } 37 | 38 | // isRentable(rental:Rental):Observable{ 39 | // let newPath = this.apiUrl + "rentals/isrentable" 40 | // return this.httpClient.post(newPath,rental); 41 | // } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/app/services/user.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ResponseModel } from '../models/responseModel'; 5 | import { SingleResponseModel } from '../models/singleResponseModel'; 6 | import { User } from '../models/user'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class UserService { 12 | apiUrl="https://localhost:44301/api/"; 13 | 14 | constructor(private httpClient:HttpClient) { } 15 | 16 | getUserId(userId:number){ 17 | let newPath=this.apiUrl+'getbyid?id='+userId; 18 | return this.httpClient.get>(newPath); 19 | } 20 | 21 | userUpdate(user:User):Observable{ 22 | let newPath=this.apiUrl+"user/edit"; 23 | return this.httpClient.post(newPath,user); 24 | 25 | } 26 | getByEmail(email:string):Observable>{ 27 | let newPath=this.apiUrl+"getbyemail?email="+email; 28 | return this.httpClient.get>(newPath); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aysebayrak/ReCapProject_frontend/cc1c9eb5f2a810abf0368c1c3326688e689945be/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Recap 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** 22 | * IE11 requires the following for NgClass support on SVG elements 23 | */ 24 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 25 | 26 | /** 27 | * Web Animations `@angular/platform-browser/animations` 28 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 29 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 30 | */ 31 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 32 | 33 | /** 34 | * By default, zone.js will patch all possible macroTask and DomEvents 35 | * user can disable parts of macroTask/DomEvents patch by setting following flags 36 | * because those flags need to be set before `zone.js` being loaded, and webpack 37 | * will put import in the top of bundle, so user need to create a separate file 38 | * in this directory (for example: zone-flags.ts), and put the following flags 39 | * into that file, and then add the following code before importing zone.js. 40 | * import './zone-flags'; 41 | * 42 | * The flags allowed in zone-flags.ts are listed here. 43 | * 44 | * The following flags will work for all browsers. 45 | * 46 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 47 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 48 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 49 | * 50 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 51 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 52 | * 53 | * (window as any).__Zone_enable_cross_context_check = true; 54 | * 55 | */ 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js/dist/zone'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "strictPropertyInitialization": false, 10 | "sourceMap": true, 11 | "declaration": false, 12 | "downlevelIteration": true, 13 | "experimentalDecorators": true, 14 | "moduleResolution": "node", 15 | "importHelpers": true, 16 | "target": "es2015", 17 | "module": "es2020", 18 | "lib": [ 19 | "es2018", 20 | "dom" 21 | ] 22 | }, 23 | "angularCompilerOptions": { 24 | "enableI18nLegacyMessageIdFormat": false 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------