├── .browserslistrc ├── .editorconfig ├── .gitignore ├── .vscode └── settings.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-add │ │ │ ├── brand-add.component.css │ │ │ ├── brand-add.component.html │ │ │ ├── brand-add.component.spec.ts │ │ │ └── brand-add.component.ts │ │ ├── brand-list │ │ │ ├── brand-list.component.css │ │ │ ├── brand-list.component.html │ │ │ ├── brand-list.component.spec.ts │ │ │ └── brand-list.component.ts │ │ ├── brand-update │ │ │ ├── brand-update.component.css │ │ │ ├── brand-update.component.html │ │ │ ├── brand-update.component.spec.ts │ │ │ └── brand-update.component.ts │ │ ├── brand │ │ │ ├── brand.component.css │ │ │ ├── brand.component.html │ │ │ ├── brand.component.spec.ts │ │ │ └── brand.component.ts │ │ ├── car-add │ │ │ ├── car-add.component.css │ │ │ ├── car-add.component.html │ │ │ ├── car-add.component.spec.ts │ │ │ └── car-add.component.ts │ │ ├── car-detail │ │ │ ├── car-detail.component.css │ │ │ ├── car-detail.component.html │ │ │ ├── car-detail.component.spec.ts │ │ │ └── car-detail.component.ts │ │ ├── car-filter │ │ │ ├── car-filter.component.css │ │ │ ├── car-filter.component.html │ │ │ ├── car-filter.component.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 │ │ │ ├── car.component.css │ │ │ ├── car.component.html │ │ │ ├── car.component.spec.ts │ │ │ └── car.component.ts │ │ ├── color-add │ │ │ ├── color-add.component.css │ │ │ ├── color-add.component.html │ │ │ ├── color-add.component.spec.ts │ │ │ └── color-add.component.ts │ │ ├── color-list │ │ │ ├── color-list.component.css │ │ │ ├── color-list.component.html │ │ │ ├── color-list.component.spec.ts │ │ │ └── color-list.component.ts │ │ ├── color-update │ │ │ ├── color-update.component.css │ │ │ ├── color-update.component.html │ │ │ ├── color-update.component.spec.ts │ │ │ └── color-update.component.ts │ │ ├── color │ │ │ ├── color.component.css │ │ │ ├── color.component.html │ │ │ ├── color.component.spec.ts │ │ │ └── color.component.ts │ │ ├── customer-add │ │ │ ├── customer-add.component.css │ │ │ ├── customer-add.component.html │ │ │ ├── customer-add.component.spec.ts │ │ │ └── customer-add.component.ts │ │ ├── customer-update │ │ │ ├── customer-update.component.css │ │ │ ├── customer-update.component.html │ │ │ ├── customer-update.component.spec.ts │ │ │ └── customer-update.component.ts │ │ ├── customer │ │ │ ├── customer.component.css │ │ │ ├── customer.component.html │ │ │ ├── customer.component.spec.ts │ │ │ └── customer.component.ts │ │ ├── interceptors │ │ │ ├── auth.interceptor.spec.ts │ │ │ └── auth.interceptor.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 │ │ ├── sidebar │ │ │ ├── sidebar.component.css │ │ │ ├── sidebar.component.html │ │ │ ├── sidebar.component.spec.ts │ │ │ └── sidebar.component.ts │ │ └── user │ │ │ ├── user.component.css │ │ │ ├── user.component.html │ │ │ ├── user.component.spec.ts │ │ │ └── user.component.ts │ ├── guards │ │ ├── login.guard.spec.ts │ │ └── login.guard.ts │ ├── models │ │ ├── Auth │ │ │ ├── loginModel.ts │ │ │ ├── registerModel.ts │ │ │ └── tokenModel.ts │ │ ├── Brand │ │ │ └── brand.ts │ │ ├── Car │ │ │ ├── car.ts │ │ │ └── carDto.ts │ │ ├── CarImage │ │ │ └── carImage.ts │ │ ├── Claim │ │ │ └── claim.ts │ │ ├── Color │ │ │ └── color.ts │ │ ├── Customer │ │ │ ├── customer.ts │ │ │ └── customerDto.ts │ │ ├── Payment │ │ │ └── payment.ts │ │ ├── Rental │ │ │ ├── rental.ts │ │ │ └── rentalDto.ts │ │ ├── User │ │ │ └── user.ts │ │ ├── listResponseModel.ts │ │ ├── responseModel.ts │ │ └── singleResponseModel.ts │ ├── pipes │ │ ├── filter-pipe.pipe.ts │ │ └── vat-added.pipe.ts │ └── services │ │ ├── Auth │ │ ├── auth.service.spec.ts │ │ └── auth.service.ts │ │ ├── Brand │ │ ├── brand.service.spec.ts │ │ └── brand.service.ts │ │ ├── Car │ │ ├── car.service.spec.ts │ │ └── car.service.ts │ │ ├── CarDetail │ │ ├── car-detail-by-id.service.spec.ts │ │ └── car-detail-by-id.service.ts │ │ ├── CarImage │ │ ├── car-images-by-id.service.spec.ts │ │ └── car-images-by-id.service.ts │ │ ├── Color │ │ ├── color.service.spec.ts │ │ └── color.service.ts │ │ ├── Customer │ │ ├── customer.service.spec.ts │ │ └── customer.service.ts │ │ ├── LocalStorage │ │ ├── localstorage.service.spec.ts │ │ └── localstorage.service.ts │ │ ├── Payment │ │ ├── payment.service.spec.ts │ │ └── payment.service.ts │ │ ├── Rental │ │ ├── rental.service.spec.ts │ │ └── rental.service.ts │ │ └── User │ │ ├── user.service.spec.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/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Recapproject 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.3. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | 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`. 12 | 13 | ## Build 14 | 15 | 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. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | 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. 28 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "recapproject": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:application": { 10 | "strict": true 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/recapproject", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "aot": true, 26 | "assets": [ 27 | "src/favicon.ico", 28 | "src/assets" 29 | ], 30 | "styles": [ 31 | "./node_modules/bootstrap/dist/css/bootstrap.min.css", 32 | "./node_modules/ngx-toastr/toastr.css", 33 | "src/styles.css" 34 | ], 35 | "scripts": [ 36 | "./node_modules/jquery/dist/jquery.min.js", 37 | "./node_modules/bootstrap/dist/js/bootstrap.min.js" 38 | ] 39 | }, 40 | "configurations": { 41 | "production": { 42 | "fileReplacements": [ 43 | { 44 | "replace": "src/environments/environment.ts", 45 | "with": "src/environments/environment.prod.ts" 46 | } 47 | ], 48 | "optimization": true, 49 | "outputHashing": "all", 50 | "sourceMap": false, 51 | "namedChunks": false, 52 | "extractLicenses": true, 53 | "vendorChunk": false, 54 | "buildOptimizer": true, 55 | "budgets": [ 56 | { 57 | "type": "initial", 58 | "maximumWarning": "500kb", 59 | "maximumError": "1mb" 60 | }, 61 | { 62 | "type": "anyComponentStyle", 63 | "maximumWarning": "2kb", 64 | "maximumError": "4kb" 65 | } 66 | ] 67 | } 68 | } 69 | }, 70 | "serve": { 71 | "builder": "@angular-devkit/build-angular:dev-server", 72 | "options": { 73 | "browserTarget": "recapproject:build" 74 | }, 75 | "configurations": { 76 | "production": { 77 | "browserTarget": "recapproject:build:production" 78 | } 79 | } 80 | }, 81 | "extract-i18n": { 82 | "builder": "@angular-devkit/build-angular:extract-i18n", 83 | "options": { 84 | "browserTarget": "recapproject:build" 85 | } 86 | }, 87 | "test": { 88 | "builder": "@angular-devkit/build-angular:karma", 89 | "options": { 90 | "main": "src/test.ts", 91 | "polyfills": "src/polyfills.ts", 92 | "tsConfig": "tsconfig.spec.json", 93 | "karmaConfig": "karma.conf.js", 94 | "assets": [ 95 | "src/favicon.ico", 96 | "src/assets" 97 | ], 98 | "styles": [ 99 | "src/styles.css" 100 | ], 101 | "scripts": [] 102 | } 103 | }, 104 | "lint": { 105 | "builder": "@angular-devkit/build-angular:tslint", 106 | "options": { 107 | "tsConfig": [ 108 | "tsconfig.app.json", 109 | "tsconfig.spec.json", 110 | "e2e/tsconfig.json" 111 | ], 112 | "exclude": [ 113 | "**/node_modules/**" 114 | ] 115 | } 116 | }, 117 | "e2e": { 118 | "builder": "@angular-devkit/build-angular:protractor", 119 | "options": { 120 | "protractorConfig": "e2e/protractor.conf.js", 121 | "devServerTarget": "recapproject:serve" 122 | }, 123 | "configurations": { 124 | "production": { 125 | "devServerTarget": "recapproject:serve:production" 126 | } 127 | } 128 | } 129 | } 130 | } 131 | }, 132 | "defaultProject": "recapproject" 133 | } 134 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | SELENIUM_PROMISE_MANAGER: false, 20 | baseUrl: 'http://localhost:4200/', 21 | framework: 'jasmine', 22 | jasmineNodeOpts: { 23 | showColors: true, 24 | defaultTimeoutInterval: 30000, 25 | print: function() {} 26 | }, 27 | onPrepare() { 28 | require('ts-node').register({ 29 | project: require('path').join(__dirname, './tsconfig.json') 30 | }); 31 | jasmine.getEnv().addReporter(new SpecReporter({ 32 | spec: { 33 | displayStacktrace: StacktraceOption.PRETTY 34 | } 35 | })); 36 | } 37 | }; -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { browser, logging } from 'protractor'; 2 | import { AppPage } from './app.po'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', async () => { 12 | await page.navigateTo(); 13 | expect(await page.getTitleText()).toEqual('recapproject app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | async navigateTo(): Promise { 5 | return browser.get(browser.baseUrl); 6 | } 7 | 8 | async getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../out-tsc/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/recapproject'), 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": "recapproject", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "^11.2.5", 15 | "@angular/common": "~11.2.4", 16 | "@angular/compiler": "~11.2.4", 17 | "@angular/core": "~11.2.4", 18 | "@angular/forms": "~11.2.4", 19 | "@angular/platform-browser": "~11.2.4", 20 | "@angular/platform-browser-dynamic": "~11.2.4", 21 | "@angular/router": "~11.2.4", 22 | "@auth0/angular-jwt": "^5.0.2", 23 | "bootstrap": "^5.0.0-beta2", 24 | "dateformat": "^4.5.1", 25 | "jquery": "^3.6.0", 26 | "ngx-toastr": "^13.2.1", 27 | "rxjs": "~6.6.0", 28 | "tslib": "^2.0.0", 29 | "zone.js": "~0.11.3" 30 | }, 31 | "devDependencies": { 32 | "@angular-devkit/build-angular": "~0.1102.3", 33 | "@angular/cli": "~11.2.3", 34 | "@angular/compiler-cli": "~11.2.4", 35 | "@types/jasmine": "~3.6.0", 36 | "@types/node": "^12.11.1", 37 | "codelyzer": "^6.0.0", 38 | "jasmine-core": "~3.6.0", 39 | "jasmine-spec-reporter": "~5.0.0", 40 | "karma": "~6.1.0", 41 | "karma-chrome-launcher": "~3.1.0", 42 | "karma-coverage": "~2.0.3", 43 | "karma-jasmine": "~4.0.0", 44 | "karma-jasmine-html-reporter": "^1.5.0", 45 | "protractor": "~7.0.0", 46 | "ts-node": "~8.3.0", 47 | "tslint": "~6.1.0", 48 | "typescript": "~4.1.5" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { BrandAddComponent } from './components/brand-add/brand-add.component'; 4 | import { BrandListComponent } from './components/brand-list/brand-list.component'; 5 | import { BrandUpdateComponent } from './components/brand-update/brand-update.component'; 6 | import { BrandComponent } from './components/brand/brand.component'; 7 | import { CarAddComponent } from './components/car-add/car-add.component'; 8 | import { CarDetailComponent } from './components/car-detail/car-detail.component'; 9 | import { CarListComponent } from './components/car-list/car-list.component'; 10 | import { CarUpdateComponent } from './components/car-update/car-update.component'; 11 | import { CarComponent } from './components/car/car.component'; 12 | import { ColorAddComponent } from './components/color-add/color-add.component'; 13 | import { ColorListComponent } from './components/color-list/color-list.component'; 14 | import { ColorUpdateComponent } from './components/color-update/color-update.component'; 15 | import { ColorComponent } from './components/color/color.component'; 16 | import { CustomerAddComponent } from './components/customer-add/customer-add.component'; 17 | import { CustomerUpdateComponent } from './components/customer-update/customer-update.component'; 18 | import { CustomerComponent } from './components/customer/customer.component'; 19 | import { LoginComponent } from './components/login/login.component'; 20 | import { PaymentComponent } from './components/payment/payment.component'; 21 | import { RegisterComponent } from './components/register/register.component'; 22 | import { RentalListComponent } from './components/rental-list/rental-list.component'; 23 | import { RentalComponent } from './components/rental/rental.component'; 24 | import { UserComponent } from './components/user/user.component'; 25 | import { LoginGuard } from './guards/login.guard'; 26 | 27 | 28 | const routes: Routes = [ 29 | { path: 'rentals', component: RentalComponent }, 30 | { path: 'rentalslist', component: RentalListComponent}, 31 | { path: 'customers', component: CustomerComponent }, 32 | { path: 'customers/add', component: CustomerAddComponent }, 33 | { path: 'customers/update/:id', component: CustomerUpdateComponent, canActivate:[LoginGuard] }, 34 | { path: 'cars', component: CarComponent }, 35 | {path:"cars/brand/:brandId", component:CarComponent}, 36 | {path:"cars/color/:colorId", component:CarComponent}, 37 | {path:"cars/car-detail/:id", component:CarDetailComponent}, 38 | {path:"cars/filter/:brandId/:colorId",component:CarComponent}, 39 | {path:"cars/rental/:id",component:RentalComponent, canActivate:[LoginGuard] }, 40 | { path: 'brands', component: BrandComponent }, 41 | { path: 'colors', component: ColorComponent }, 42 | { path: 'payments', component: PaymentComponent }, 43 | { path: 'carslist', component: CarListComponent }, 44 | { path: 'cars/add', component: CarAddComponent, canActivate:[LoginGuard] }, 45 | { path: 'cars/update/:id', component: CarUpdateComponent, canActivate:[LoginGuard] }, 46 | { path: 'brandslist', component: BrandListComponent }, 47 | { path: 'brands/add', component: BrandAddComponent, canActivate:[LoginGuard] }, 48 | { path: 'brands/update/:brandId', component: BrandUpdateComponent }, 49 | { path: 'colorslist', component: ColorListComponent }, 50 | { path: 'colors/add', component: ColorAddComponent, canActivate:[LoginGuard] }, 51 | { path: 'colors/update/:colorId', component: ColorUpdateComponent, canActivate:[LoginGuard] }, 52 | 53 | { path: 'login', component: LoginComponent }, 54 | { path: 'register', component: RegisterComponent }, 55 | { path: 'profile', component: UserComponent }, 56 | 57 | { path: '**', redirectTo: 'cars', pathMatch: 'full' } 58 | ]; 59 | 60 | @NgModule({ 61 | imports: [RouterModule.forRoot(routes)], 62 | exports: [RouterModule] 63 | }) 64 | export class AppRoutingModule { } 65 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/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 'recapproject'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('recapproject'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement; 33 | expect(compiled.querySelector('.content span').textContent).toContain('recapproject app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'], 7 | }) 8 | export class AppComponent { 9 | title = 'recapproject'; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import {HttpClientModule, HTTP_INTERCEPTORS} from '@angular/common/http' 4 | import {FormsModule, ReactiveFormsModule} from '@angular/forms'; 5 | 6 | import { AppRoutingModule } from './app-routing.module'; 7 | import { AppComponent } from './app.component'; 8 | import { CarComponent } from './components/car/car.component'; 9 | import { BrandComponent } from './components/brand/brand.component'; 10 | import { ColorComponent } from './components/color/color.component'; 11 | import { CustomerComponent } from './components/customer/customer.component'; 12 | import { RentalComponent } from './components/rental/rental.component'; 13 | import { NaviComponent } from './components/navi/navi.component'; 14 | import { SidebarComponent } from './components/sidebar/sidebar.component'; 15 | import { CarDetailComponent } from './components/car-detail/car-detail.component'; 16 | import { CarFilterComponent } from './components/car-filter/car-filter.component'; 17 | import { PaymentComponent } from './components/payment/payment.component'; 18 | import { RentalListComponent } from './components/rental-list/rental-list.component'; 19 | import { VatAddedPipe } from './pipes/vat-added.pipe'; 20 | import { FilterPipePipe } from './pipes/filter-pipe.pipe'; 21 | 22 | import {ToastrModule} from "ngx-toastr"; 23 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 24 | import { CarAddComponent } from './components/car-add/car-add.component'; 25 | import { BrandAddComponent } from './components/brand-add/brand-add.component'; 26 | import { ColorAddComponent } from './components/color-add/color-add.component'; 27 | import { CarListComponent } from './components/car-list/car-list.component'; 28 | import { BrandListComponent } from './components/brand-list/brand-list.component'; 29 | import { ColorListComponent } from './components/color-list/color-list.component'; 30 | import { CarUpdateComponent } from './components/car-update/car-update.component'; 31 | import { ColorUpdateComponent } from './components/color-update/color-update.component'; 32 | import { BrandUpdateComponent } from './components/brand-update/brand-update.component'; 33 | import { CustomerUpdateComponent } from './components/customer-update/customer-update.component'; 34 | import { LoginComponent } from './components/login/login.component'; 35 | import { RegisterComponent } from './components/register/register.component'; 36 | import { AuthInterceptor } from './components/interceptors/auth.interceptor'; 37 | import { UserComponent } from './components/user/user.component'; 38 | import { CustomerAddComponent } from './components/customer-add/customer-add.component'; 39 | 40 | @NgModule({ 41 | declarations: [ 42 | AppComponent, 43 | CarComponent, 44 | BrandComponent, 45 | ColorComponent, 46 | CustomerComponent, 47 | RentalComponent, 48 | NaviComponent, 49 | SidebarComponent, 50 | CarDetailComponent, 51 | CarFilterComponent, 52 | PaymentComponent, 53 | RentalListComponent, 54 | VatAddedPipe, 55 | FilterPipePipe, 56 | CarAddComponent, 57 | BrandAddComponent, 58 | ColorAddComponent, 59 | CarListComponent, 60 | BrandListComponent, 61 | ColorListComponent, 62 | CarUpdateComponent, 63 | ColorUpdateComponent, 64 | BrandUpdateComponent, 65 | CustomerUpdateComponent, 66 | LoginComponent, 67 | RegisterComponent, 68 | UserComponent, 69 | CustomerAddComponent, 70 | ], 71 | imports: [ 72 | BrowserModule, 73 | BrowserAnimationsModule, 74 | ReactiveFormsModule, 75 | AppRoutingModule, 76 | HttpClientModule, 77 | FormsModule, 78 | ToastrModule.forRoot({ 79 | positionClass:"toast-bottom-right" 80 | }) 81 | ], 82 | providers: [{ 83 | provide:HTTP_INTERCEPTORS, useClass:AuthInterceptor,multi:true 84 | }], 85 | bootstrap: [AppComponent] 86 | }) 87 | export class AppModule { } 88 | -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/brand-add/brand-add.component.css -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Marka Ekle
4 |
5 |
6 |
7 |
8 | 9 | 10 |
11 | 16 |
17 |
18 |
19 |
20 |
-------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandAddComponent } from './brand-add.component'; 4 | 5 | describe('BrandAddComponent', () => { 6 | let component: BrandAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand-add/brand-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Brand } from 'src/app/models/Brand/brand'; 5 | import { BrandService } from 'src/app/services/Brand/brand.service'; 6 | 7 | @Component({ 8 | selector: 'app-brand-add', 9 | templateUrl: './brand-add.component.html', 10 | styleUrls: ['./brand-add.component.css'] 11 | }) 12 | export class BrandAddComponent implements OnInit { 13 | 14 | brandAddForm:FormGroup; 15 | addBrand:Brand; 16 | 17 | constructor(private formBuilder:FormBuilder, 18 | private toastrService:ToastrService, 19 | private brandService:BrandService) { } 20 | 21 | ngOnInit(): void { 22 | this.createBrandAddForm(); 23 | } 24 | 25 | createBrandAddForm(){ 26 | this.brandAddForm = this.formBuilder.group({ 27 | brandName:["", Validators.required] 28 | }); 29 | } 30 | 31 | add(){ 32 | if(this.brandAddForm.valid){ 33 | let brandModel=Object.assign({}, this.brandAddForm.value) 34 | 35 | this.addBrand = { 36 | brandName: brandModel.brandName 37 | }; 38 | console.log(this.addBrand); 39 | 40 | this.brandService.add(this.addBrand).subscribe( 41 | (response) =>{ 42 | this.toastrService.success(response.message, "Başarılı"); 43 | setTimeout(() => { 44 | window.location.reload(); 45 | }, 2000); 46 | }, 47 | (responseError)=>{ 48 | console.log(responseError); 49 | if(responseError.error.ValidationErrors.length>0){ 50 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 51 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Doğrulama Hatası"); 52 | } 53 | } 54 | }); 55 | } 56 | else { 57 | this.toastrService.error("Formunuz eksiktir. Kontrol ediniz.","Dikkat"); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/app/components/brand-list/brand-list.component.css: -------------------------------------------------------------------------------- 1 | table{ 2 | margin-right: auto; 3 | 4 | margin-left: auto; 5 | } -------------------------------------------------------------------------------- /src/app/components/brand-list/brand-list.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 | 8 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
IdMarkaGüncelle
{{ brand.brandId }}{{ brand.brandName }}
31 |
32 | -------------------------------------------------------------------------------- /src/app/components/brand-list/brand-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandListComponent } from './brand-list.component'; 4 | 5 | describe('BrandListComponent', () => { 6 | let component: BrandListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand-list/brand-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Brand } from 'src/app/models/Brand/brand'; 3 | import { BrandService } from 'src/app/services/Brand/brand.service'; 4 | 5 | @Component({ 6 | selector: 'app-brand-list', 7 | templateUrl: './brand-list.component.html', 8 | styleUrls: ['./brand-list.component.css'] 9 | }) 10 | export class BrandListComponent implements OnInit { 11 | 12 | dataLoaded=false; 13 | brands:Brand[]; 14 | constructor(private brandService:BrandService) { } 15 | 16 | ngOnInit(): void { 17 | this.getBrands(); 18 | } 19 | 20 | getBrands(){ 21 | this.brandService.getBrands().subscribe(response=>{ 22 | this.brands=response.data; 23 | this.dataLoaded=response.success; 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/brand-update/brand-update.component.css -------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
Marka Güncelle
5 |
6 |
7 |
8 |
9 | 10 | 11 |
12 |
13 | 14 | 17 |
18 | 23 |
24 |
25 |
26 |
27 |
28 |
-------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandUpdateComponent } from './brand-update.component'; 4 | 5 | describe('BrandUpdateComponent', () => { 6 | let component: BrandUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand-update/brand-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Brand } from 'src/app/models/Brand/brand'; 6 | import { BrandService } from 'src/app/services/Brand/brand.service'; 7 | 8 | @Component({ 9 | selector: 'app-brand-update', 10 | templateUrl: './brand-update.component.html', 11 | styleUrls: ['./brand-update.component.css'] 12 | }) 13 | export class BrandUpdateComponent implements OnInit { 14 | 15 | brandUpdateForm: FormGroup; 16 | updateBrand:Brand; 17 | brands:Brand[]; 18 | 19 | constructor(private formBuilder:FormBuilder, 20 | private toastrService:ToastrService, 21 | private brandService:BrandService, 22 | private activatedRoute:ActivatedRoute) { } 23 | 24 | ngOnInit(): void { 25 | this.activatedRoute.params.subscribe((response)=>{ 26 | if(response["brandId"]) 27 | { 28 | this.getBrandById(response["brandId"]); 29 | this.createBrandUpdateForm(); 30 | this.getBrands(); 31 | } 32 | }) 33 | } 34 | 35 | getBrands(){ 36 | this.brandService.getBrands().subscribe(response=>{ 37 | this.brands=response.data; 38 | }) 39 | } 40 | 41 | getBrandById(brandId:number){ 42 | this.brandService.getBrandById(brandId).subscribe(response=>{ 43 | this.updateBrand=response.data; 44 | 45 | console.log(this.updateBrand) 46 | console.log(this.updateBrand.brandId) 47 | 48 | this.brandUpdateForm.get("brandId")?.setValue(this.updateBrand.brandId); 49 | this.brandUpdateForm.get("brandName")?.setValue(this.updateBrand.brandName); 50 | 51 | console.log(this.brandUpdateForm) 52 | }) 53 | } 54 | 55 | createBrandUpdateForm(){ 56 | this.brandUpdateForm=this.formBuilder.group({ 57 | brandId:["",Validators.required], 58 | brandName:["", Validators.required] 59 | }) 60 | } 61 | 62 | update(){ 63 | if(this.brandUpdateForm.valid){ 64 | let updateBrandModel=Object.assign({},this.brandUpdateForm.value); 65 | 66 | console.log(updateBrandModel); 67 | 68 | this.brandService.update(updateBrandModel).subscribe( 69 | (response)=>{ 70 | this.toastrService.success(response.message,"Başarılı") 71 | setTimeout(() => { 72 | window.location.reload(); 73 | }, 2000); 74 | }, 75 | (responseError)=>{ 76 | console.log(responseError); 77 | if(responseError.error.ValidationErrors.lengh>0){ 78 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 79 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Doğrulama Hatası"); 80 | } 81 | } 82 | } 83 | ); 84 | } 85 | else{ 86 | this.toastrService.error("Formunuz eksiktir. Kontrol ediniz.","Dikkat"); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.css: -------------------------------------------------------------------------------- 1 | 2 | .sidebar-title { 3 | background-color:#FFC107; 4 | color:white; 5 | text-align: center; 6 | letter-spacing: 1px; 7 | } 8 | 9 | ul 10 | { 11 | background-color: transparent; 12 | list-style-type: none; 13 | padding-left: 0; 14 | border-color: transparent; 15 | } 16 | .active{ 17 | background-color:rgba(156, 154, 154, 0.247); 18 | color:black; 19 | border-color: transparent; 20 | } 21 | 22 | .list-group-item{ 23 | background-color: transparent; 24 | border-color: transparent; 25 | } 26 | 27 | .fs-5{ 28 | text-align:center; 29 | } 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
    5 | 6 |
    7 |
    8 | 9 |
  • 14 | Tüm Markalar 15 |
  • 16 |
  • 22 | {{ brand.brandName }} 23 |
  • 24 |
    25 |
26 | 27 |
28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /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 { ThrowStmt } from '@angular/compiler'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { Brand } from 'src/app/models/Brand/brand'; 4 | import { BrandService } from 'src/app/services/Brand/brand.service'; 5 | 6 | @Component({ 7 | selector: 'app-brand', 8 | templateUrl: './brand.component.html', 9 | styleUrls: ['./brand.component.css'] 10 | }) 11 | export class BrandComponent implements OnInit { 12 | 13 | brands : Brand[] = []; 14 | currentBrand: Brand; 15 | 16 | constructor(private brandService:BrandService) { 17 | 18 | } 19 | 20 | ngOnInit(): void { 21 | this.getBrands(); 22 | } 23 | 24 | getBrands(){ 25 | this.brandService.getBrands().subscribe(response=>{ 26 | this.brands=response.data; 27 | }) 28 | } 29 | 30 | setCurrentBrand(brand:Brand){ 31 | this.currentBrand=brand; 32 | } 33 | 34 | getCurrentBrandClass(brand:Brand){ 35 | if(brand==this.currentBrand) 36 | {return "list-group-item active"} 37 | else 38 | {return "list-group-item"} 39 | } 40 | 41 | getAllBrandClass(){ 42 | if(!this.currentBrand){ 43 | return "list-group-item active" 44 | }else{ 45 | return "list-group-item" 46 | } 47 | } 48 | 49 | setAllBrand(){ 50 | return this.currentBrand={brandId:0, brandName:""}; 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/car-add/car-add.component.css -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
Araç Ekle
5 |
6 |
7 |
8 |
9 | 10 | 13 |
14 |
15 | 16 | 19 |
20 |
21 | 22 | 23 |
24 |
25 | 26 | 27 |
28 |
29 | 30 | 31 |
32 |
33 | 34 | 35 |
36 | 37 | 44 | 45 | 50 |
51 |
52 |
53 |
54 |
55 |
-------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarAddComponent } from './car-add.component'; 4 | 5 | describe('CarAddComponent', () => { 6 | let component: CarAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import{FormGroup, FormBuilder, FormControl, Validators} from "@angular/forms" 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Brand } from 'src/app/models/Brand/brand'; 5 | import { Car } from 'src/app/models/Car/car'; 6 | import { CarImage } from 'src/app/models/CarImage/carImage'; 7 | import { Color } from 'src/app/models/Color/color'; 8 | import { BrandService } from 'src/app/services/Brand/brand.service'; 9 | import { CarService } from 'src/app/services/Car/car.service'; 10 | import { ColorService } from 'src/app/services/Color/color.service'; 11 | 12 | 13 | @Component({ 14 | selector: 'app-car-add', 15 | templateUrl: './car-add.component.html', 16 | styleUrls: ['./car-add.component.css'] 17 | }) 18 | export class CarAddComponent implements OnInit { 19 | 20 | carAddForm: FormGroup; 21 | addCar:Car; 22 | brands: Brand[]; 23 | colors: Color[]; 24 | 25 | constructor( 26 | private formBuilder: FormBuilder, 27 | private toastrService:ToastrService, 28 | private carService:CarService, 29 | private brandService:BrandService, 30 | private colorService:ColorService) { } 31 | 32 | ngOnInit(): void { 33 | this.createCarAddForm(); 34 | this.getBrands(); 35 | this.getColors(); 36 | } 37 | 38 | getBrands(){ 39 | this.brandService.getBrands().subscribe(response=>{ 40 | this.brands=response.data; 41 | }) 42 | } 43 | 44 | getColors(){ 45 | this.colorService.getColors().subscribe(response=>{ 46 | this.colors=response.data; 47 | }) 48 | } 49 | 50 | 51 | createCarAddForm(){ 52 | this.carAddForm = this.formBuilder.group({ 53 | brandId:["",Validators.required], 54 | colorId:["",Validators.required], 55 | modelYear:["",Validators.required], 56 | dailyPrice:["",Validators.required], 57 | description:["",Validators.required], 58 | findeks:["",Validators.required], 59 | carImage:[null] 60 | }) 61 | } 62 | 63 | add(){ 64 | if(this.carAddForm.valid){ 65 | let carModel = Object.assign({},this.carAddForm.value); 66 | 67 | this.addCar = { 68 | brandId: carModel.brandId, 69 | colorId: carModel.colorId, 70 | modelYear: carModel.modelYear, 71 | dailyPrice: carModel.dailyPrice, 72 | description: carModel.description, 73 | findeks: carModel.findeks, 74 | }; 75 | console.log(carModel); 76 | console.log(this.addCar) 77 | 78 | this.carService.add(carModel).subscribe( 79 | (response) => { 80 | this.toastrService.success(response.message, "Başarılı"); 81 | setTimeout(() => { 82 | window.location.reload(); 83 | }, 2000); 84 | }, 85 | (responseError)=>{ 86 | console.log(responseError); 87 | if(responseError.error.ValidationErrors.length>0){ 88 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 89 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Doğrulama Hatası"); 90 | } 91 | } 92 | } 93 | ); 94 | } 95 | else{this.toastrService.error("Formunuz eksiktir. Kontrol ediniz.","Dikkat"); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/car-detail/car-detail.component.css -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 35 | 36 |
37 |
38 |
39 |

40 | {{carDetails.brandName}} -- {{carDetails.description}} 41 |

42 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
IdMarkaRenkModel YılıFiyatAçıklamaFindeks PuanıKirala
{{carDetails.id}} {{carDetails.brandName}}{{carDetails.colorName}}{{carDetails.modelYear}}{{carDetails.dailyPrice | vatAdded:18}}{{carDetails.description}}{{carDetails.findeks}}
-------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarDetailComponent } from './car-detail.component'; 4 | 5 | describe('CarDetailComponent', () => { 6 | let component: CarDetailComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarDetailComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarDetailComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute, Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { CarDto } from 'src/app/models/Car/carDto'; 5 | import { CarImage } from 'src/app/models/CarImage/carImage'; 6 | import { RentalDto } from 'src/app/models/Rental/rentalDto'; 7 | import { CarDetailByIdService } from 'src/app/services/CarDetail/car-detail-by-id.service'; 8 | import { CarImagesByIdService } from 'src/app/services/CarImage/car-images-by-id.service'; 9 | import { CustomerService } from 'src/app/services/Customer/customer.service'; 10 | import { LocalStorageService } from 'src/app/services/LocalStorage/localstorage.service'; 11 | import { RentalService } from 'src/app/services/Rental/rental.service'; 12 | 13 | @Component({ 14 | selector: 'app-car-detail', 15 | templateUrl: './car-detail.component.html', 16 | styleUrls: ['./car-detail.component.css'] 17 | }) 18 | 19 | export class CarDetailComponent implements OnInit { 20 | 21 | carDetails:CarDto; 22 | carImages:CarImage[]=[]; 23 | rentalsByCarId:RentalDto[]; 24 | rentals:RentalDto[]; 25 | 26 | constructor( 27 | private carDetailByIdService:CarDetailByIdService, 28 | private carImagesByIdService:CarImagesByIdService, 29 | private activatedRoute:ActivatedRoute, 30 | private rentalService:RentalService, 31 | private customerService:CustomerService, 32 | private localStorageService:LocalStorageService, 33 | private toastrService:ToastrService, 34 | private router:Router, 35 | 36 | 37 | ) { } 38 | 39 | ngOnInit(): void { 40 | this.activatedRoute.params.subscribe(params=>{ 41 | if(params["id"]){ 42 | this.getCarsById(params["id"]) 43 | this.getImagesById(params["id"]) 44 | this.getRentalsByCarId(params["id"]) 45 | 46 | } 47 | this.getRentals() 48 | }) 49 | } 50 | 51 | getCarsById(id:number){ 52 | this.carDetailByIdService.getCarDetailById(id).subscribe(response=>{ 53 | this.carDetails=response.data[0]; 54 | }) 55 | } 56 | getImagesById(id:number){ 57 | this.carImagesByIdService.getCarImagesById(id).subscribe(response=>{ 58 | this.carImages=response.data; 59 | 60 | }) 61 | } 62 | getRentals(){ 63 | this.rentalService.getRentals().subscribe(response=>{ 64 | this.rentals=response.data; 65 | }) 66 | } 67 | 68 | getRentalsByCarId(id:number){ 69 | this.rentalService.getRentalsByCarId(id).subscribe(response=>{ 70 | this.rentalsByCarId=response.data; 71 | }) 72 | } 73 | 74 | check(id:number){ //service yaz ve backend yaz ve html kısmını ekle 75 | this.rentals.find(function(element){ 76 | if(element.carId===id && element.returnDate===null){ 77 | return false //arac kiralanamaz 78 | } 79 | else{ 80 | return true //kiralanabilir 81 | } 82 | 83 | }) 84 | } 85 | 86 | getCustomerByUserId(){ 87 | this.customerService.getCustomerDetailByUserId(this.localStorageService.getItem("id")).subscribe(response=>{ 88 | if(response.data == null){ 89 | this.localStorageService.setItem("deneme",false); 90 | } 91 | else{ 92 | this.localStorageService.setItem("deneme",true); 93 | } 94 | }) 95 | 96 | } 97 | 98 | isCustomer(){ 99 | if(this.localStorageService.getItem("deneme")==false){ 100 | this.toastrService.info("Müşteri kayıt işlemleri tamamlanmamış görünüyor.", "Yönlendirme"); 101 | this.router.navigate(['/customers/add']); 102 | } 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/car-filter/car-filter.component.css -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 8 |
9 |
10 | 15 |
16 |
17 | Filtrele 20 |
21 |
22 | Temizle 24 |
25 |
-------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarFilterComponent } from './car-filter.component'; 4 | 5 | describe('CarFilterComponent', () => { 6 | let component: CarFilterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarFilterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarFilterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-filter/car-filter.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Brand } from 'src/app/models/Brand/brand'; 3 | import { Color } from 'src/app/models/Color/color'; 4 | import { BrandService } from 'src/app/services/Brand/brand.service'; 5 | import { ColorService } from 'src/app/services/Color/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 | constructor(private brandService: BrandService, 15 | private colorService: ColorService) { } 16 | 17 | colors:Color[]=[]; 18 | brands:Brand[]=[]; 19 | brandIdFilter:number; 20 | colorIdFilter:number; 21 | 22 | ngOnInit(): void { 23 | this.getBrands(); 24 | this.getColors(); 25 | } 26 | 27 | getColors(){ 28 | this.colorService.getColors().subscribe(response=>{ 29 | this.colors=response.data; 30 | }) 31 | } 32 | 33 | selectedColor(colorId:any){ 34 | if(this.colorIdFilter==colorId){ 35 | return true; 36 | } 37 | else{ 38 | return false; 39 | } 40 | } 41 | 42 | getBrands(){ 43 | this.brandService.getBrands().subscribe(response=>{ 44 | this.brands=response.data; 45 | }) 46 | } 47 | 48 | selectedBrand(brandId:any){ 49 | if(this.brandIdFilter==brandId){ 50 | return true; 51 | } 52 | else{ 53 | return false; 54 | } 55 | } 56 | 57 | deneme(){ 58 | if(this.brandIdFilter){} 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/app/components/car-list/car-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/car-list/car-list.component.css -------------------------------------------------------------------------------- /src/app/components/car-list/car-list.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 | 8 | 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 |
IdMarkaRenkModel YılıFiyatAçıklamaFindeks PuanıGüncelle
{{ car.id }}{{ car.brandName }}{{car.colorName}}{{car.modelYear}}{{car.dailyPrice | vatAdded:18}}{{car.description}}{{car.findeks}}
41 |
42 | -------------------------------------------------------------------------------- /src/app/components/car-list/car-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarListComponent } from './car-list.component'; 4 | 5 | describe('CarListComponent', () => { 6 | let component: CarListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-list/car-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Car } from 'src/app/models/Car/car'; 3 | import { CarDto } from 'src/app/models/Car/carDto'; 4 | import { CarService } from 'src/app/services/Car/car.service'; 5 | 6 | @Component({ 7 | selector: 'app-car-list', 8 | templateUrl: './car-list.component.html', 9 | styleUrls: ['./car-list.component.css'] 10 | }) 11 | export class CarListComponent implements OnInit { 12 | 13 | dataLoaded=false; 14 | cars:CarDto[]; 15 | 16 | constructor( private carService:CarService) {} 17 | 18 | ngOnInit(): void { 19 | this.getCars(); 20 | } 21 | 22 | getCars(){ 23 | this.carService.getCars().subscribe(response=>{ 24 | this.cars=response.data; 25 | this.dataLoaded=response.success; 26 | }) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/car-update/car-update.component.css -------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
Araç Güncelle
5 |
6 |
7 |
8 |
9 | 10 | 13 |
14 |
15 | 16 | 19 |
20 |
21 | 22 | 23 |
24 |
25 | 26 | 27 |
28 |
29 | 30 | 31 |
32 | 33 | 40 | 41 | 46 |
47 |
48 |
49 |
50 |
51 |
-------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarUpdateComponent } from './car-update.component'; 4 | 5 | describe('CarUpdateComponent', () => { 6 | let component: CarUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car-update/car-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ActivatedRoute, Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Brand } from 'src/app/models/Brand/brand'; 6 | import { Car } from 'src/app/models/Car/car'; 7 | import { CarDto } from 'src/app/models/Car/carDto'; 8 | import { Color } from 'src/app/models/Color/color'; 9 | import { BrandService } from 'src/app/services/Brand/brand.service'; 10 | import { CarService } from 'src/app/services/Car/car.service'; 11 | import { ColorService } from 'src/app/services/Color/color.service'; 12 | 13 | @Component({ 14 | selector: 'app-car-update', 15 | templateUrl: './car-update.component.html', 16 | styleUrls: ['./car-update.component.css'] 17 | }) 18 | export class CarUpdateComponent implements OnInit { 19 | 20 | carUpdateForm: FormGroup; 21 | updateCar:Car; 22 | brands: Brand[]; 23 | colors: Color[]; 24 | 25 | constructor( private formBuilder: FormBuilder, 26 | private toastrService:ToastrService, 27 | private carService:CarService, 28 | private brandService:BrandService, 29 | private colorService:ColorService, 30 | private activatedRoute:ActivatedRoute, 31 | private router:Router) { } 32 | 33 | ngOnInit(): void { 34 | this.activatedRoute.params.subscribe((response)=>{ 35 | if(response["id"]) 36 | { 37 | this.getCarDetailById(response["id"]); 38 | this.createCarUpdateForm(); 39 | this.getBrands(); 40 | this.getColors(); 41 | } 42 | }) 43 | } 44 | 45 | getCarDetailById(id:number){ 46 | this.carService.getCarsById(id).subscribe(response=>{ 47 | this.updateCar = response.data; 48 | 49 | this.carUpdateForm.get("id")?.setValue(this.updateCar.id); 50 | this.carUpdateForm.get("brandId")?.setValue(this.updateCar.brandId); 51 | this.carUpdateForm.get("colorId")?.setValue(this.updateCar.colorId); 52 | this.carUpdateForm.get("modelYear")?.setValue(this.updateCar.modelYear); 53 | this.carUpdateForm.get("dailyPrice")?.setValue(this.updateCar.dailyPrice); 54 | this.carUpdateForm.get("description")?.setValue(this.updateCar.description); 55 | }) 56 | } 57 | 58 | getBrands(){ 59 | this.brandService.getBrands().subscribe(response=>{ 60 | this.brands=response.data; 61 | }) 62 | } 63 | 64 | getColors(){ 65 | this.colorService.getColors().subscribe(response=>{ 66 | this.colors=response.data; 67 | }) 68 | } 69 | 70 | 71 | createCarUpdateForm(){ 72 | this.carUpdateForm = this.formBuilder.group({ 73 | id:["",Validators.required], 74 | brandId:["",Validators.required], 75 | colorId:["",Validators.required], 76 | modelYear:["",Validators.required], 77 | dailyPrice:["",Validators.required], 78 | description:["",Validators.required], 79 | }) 80 | } 81 | 82 | update(){ 83 | if(this.carUpdateForm.valid){ 84 | let updateCarModel= Object.assign({},this.carUpdateForm.value); 85 | 86 | console.log(updateCarModel); 87 | 88 | this.carService.update(updateCarModel).subscribe( 89 | (response)=>{ 90 | this.toastrService.success(response.message, "Başarılı"); 91 | setTimeout(() => { 92 | window.location.reload(); 93 | }, 2000); 94 | }, 95 | (responseError)=>{ 96 | console.log(responseError); 97 | if(responseError.error.ValidationErrors.length>0){ 98 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 99 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Doğrulama Hatası"); 100 | } 101 | } 102 | } 103 | ); 104 | } 105 | else{ 106 | this.toastrService.error("Formunuz eksiktir. Kontrol ediniz.","Dikkat"); 107 | } 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --jumbotron-padding-y: 3rem; 3 | } 4 | 5 | .jumbotron { 6 | padding-top: var(--jumbotron-padding-y); 7 | padding-bottom: var(--jumbotron-padding-y); 8 | margin-bottom: 0; 9 | background-color: #fff; 10 | } 11 | @media (min-width: 768px) { 12 | .jumbotron { 13 | padding-top: calc(var(--jumbotron-padding-y) * 2); 14 | padding-bottom: calc(var(--jumbotron-padding-y) * 2); 15 | } 16 | } 17 | 18 | .jumbotron p:last-child { 19 | margin-bottom: 0; 20 | } 21 | 22 | .jumbotron-heading { 23 | font-weight: 300; 24 | } 25 | 26 | .jumbotron .container { 27 | max-width: 40rem; 28 | } 29 | 30 | footer { 31 | padding-top: 3rem; 32 | padding-bottom: 3rem; 33 | } 34 | 35 | footer p { 36 | margin-bottom: .25rem; 37 | } 38 | 39 | .box-shadow { box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); } -------------------------------------------------------------------------------- /src/app/components/car/car.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 |
6 | 7 | 9 |
10 | 11 |
12 | 13 |
14 | 15 |
16 |
17 | 18 |
19 | ... 21 |
22 |
{{ car.description }}
23 |
24 |
    25 |
  • Id: {{ car.id }}
  • 26 |
  • Marka: {{ car.brandName }}
  • 27 | 28 |
  • Fiyat: {{ car.dailyPrice | vatAdded:18 | currency:"₺"}}
  • 29 |
  • Findeks Puanı: {{ car.findeks }}
  • 30 |
31 |
32 |
33 | 36 | 39 |
40 |

41 |
42 |
43 |
44 |
45 |
46 |
47 | -------------------------------------------------------------------------------- /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, Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Brand } from 'src/app/models/Brand/brand'; 5 | import { CarDto } from 'src/app/models/Car/carDto'; 6 | import { CarImage } from 'src/app/models/CarImage/carImage'; 7 | import { BrandService } from 'src/app/services/Brand/brand.service'; 8 | import { CarService } from 'src/app/services/Car/car.service'; 9 | import { CustomerService } from 'src/app/services/Customer/customer.service'; 10 | import { LocalStorageService } from 'src/app/services/LocalStorage/localstorage.service'; 11 | 12 | @Component({ 13 | selector: 'app-car', 14 | templateUrl: './car.component.html', 15 | styleUrls: ['./car.component.css'], 16 | }) 17 | 18 | export class CarComponent implements OnInit { 19 | 20 | cars: CarDto[] = []; 21 | filterText=""; 22 | carId:number; 23 | 24 | constructor( 25 | private carService:CarService, 26 | private activatedRoute:ActivatedRoute, 27 | private localStorageService:LocalStorageService, 28 | private toastrService:ToastrService, 29 | private customerService:CustomerService, 30 | private router:Router) {} 31 | 32 | ngOnInit(): void { 33 | this.activatedRoute.params.subscribe(params=>{ 34 | if(params["brandId"]){ 35 | this.getCarsByBrand(params["brandId"]) 36 | } 37 | if(params["colorId"]) 38 | { 39 | this.getCarsByColor(params["colorId"]) 40 | } 41 | if(params["brandId"] && params["colorId"]) 42 | { 43 | this.getCarsByBrandAndColor(params["brandId"],params["colorId"]) 44 | } 45 | else{ 46 | this.getCars(); 47 | } 48 | }) 49 | this.getCustomerByUserId(); 50 | } 51 | 52 | getCars() { 53 | this.carService.getCars().subscribe(response=>{ 54 | this.cars=response.data; 55 | }); 56 | } 57 | 58 | getCarsByBrand(brandId:number) { 59 | this.carService.getCarsByBrandId(brandId).subscribe(response=>{ 60 | this.cars=response.data; 61 | }); 62 | } 63 | 64 | getCarsByColor(colorId:number) { 65 | this.carService.getCarsByColorId(colorId).subscribe(response=>{ 66 | this.cars=response.data; 67 | }); 68 | } 69 | 70 | getCarsByBrandAndColor(brandId:number,colorId:number) { 71 | this.carService.getCarsByBrandIdandColorId(brandId,colorId).subscribe(response=>{ 72 | this.cars=response.data; 73 | }); 74 | } 75 | 76 | getCustomerByUserId(){ 77 | this.customerService.getCustomerDetailByUserId(this.localStorageService.getItem("id")).subscribe(response=>{ 78 | if(response.data == null){ 79 | this.localStorageService.setItem("deneme",false); 80 | } 81 | else{ 82 | this.localStorageService.setItem("deneme",true); 83 | } 84 | }) 85 | 86 | } 87 | 88 | isCustomer(){ 89 | if(this.localStorageService.getItem("deneme")==false){ 90 | this.toastrService.info("Müşteri kayıt işlemleri tamamlanmamış görünüyor.", "Yönlendirme"); 91 | this.router.navigate(['/customers/add']); 92 | } 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/color-add/color-add.component.css -------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Renk Ekle
4 |
5 |
6 |
7 |
8 | 9 | 10 |
11 | 16 |
17 |
18 |
19 |
20 |
-------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorAddComponent } from './color-add.component'; 4 | 5 | describe('ColorAddComponent', () => { 6 | let component: ColorAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color-add/color-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Color } from 'src/app/models/Color/color'; 5 | import { ColorService } from 'src/app/services/Color/color.service'; 6 | 7 | @Component({ 8 | selector: 'app-color-add', 9 | templateUrl: './color-add.component.html', 10 | styleUrls: ['./color-add.component.css'] 11 | }) 12 | export class ColorAddComponent implements OnInit { 13 | 14 | colorAddForm:FormGroup; 15 | addColor:Color; 16 | 17 | constructor(private formBuilder:FormBuilder, 18 | private toastrService:ToastrService, 19 | private colorService:ColorService) { } 20 | 21 | ngOnInit(): void { 22 | this.createColorAddForm(); 23 | } 24 | 25 | createColorAddForm(){ 26 | this.colorAddForm = this.formBuilder.group({ 27 | colorName:["", Validators.required] 28 | }); 29 | } 30 | 31 | add(){ 32 | if(this.colorAddForm.valid){ 33 | let colorModel=Object.assign({}, this.colorAddForm.value) 34 | 35 | this.addColor = { 36 | colorName: colorModel.colorName 37 | }; 38 | console.log(this.addColor); 39 | 40 | this.colorService.add(this.addColor).subscribe( 41 | (response) =>{ 42 | this.toastrService.success(response.message, "Başarılı"); 43 | setTimeout(() => { 44 | window.location.reload(); 45 | }, 2000); 46 | }, 47 | (responseError)=>{ 48 | console.log(responseError); 49 | if(responseError.error.ValidationErrors.length>0){ 50 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 51 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Doğrulama Hatası"); 52 | } 53 | } 54 | }); 55 | } 56 | else { 57 | this.toastrService.error("Formunuz eksiktir. Kontrol ediniz.","Dikkat"); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/app/components/color-list/color-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/color-list/color-list.component.css -------------------------------------------------------------------------------- /src/app/components/color-list/color-list.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 | 8 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
IdRenkGüncelle
{{ color.colorId }}{{ color.colorName }}
31 |
32 | -------------------------------------------------------------------------------- /src/app/components/color-list/color-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorListComponent } from './color-list.component'; 4 | 5 | describe('ColorListComponent', () => { 6 | let component: ColorListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color-list/color-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Color } from 'src/app/models/Color/color'; 3 | import { ColorService } from 'src/app/services/Color/color.service'; 4 | 5 | @Component({ 6 | selector: 'app-color-list', 7 | templateUrl: './color-list.component.html', 8 | styleUrls: ['./color-list.component.css'] 9 | }) 10 | export class ColorListComponent implements OnInit { 11 | 12 | dataLoaded=false; 13 | colors:Color[]; 14 | constructor(private colorService:ColorService) { } 15 | 16 | ngOnInit(): void { 17 | this.getColors(); 18 | } 19 | 20 | getColors(){ 21 | this.colorService.getColors().subscribe(response=>{ 22 | this.colors=response.data; 23 | this.dataLoaded=response.success; 24 | }) 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/color-update/color-update.component.css -------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
Renk Güncelle
5 |
6 |
7 |
8 |
9 | 10 | 11 |
12 |
13 | 14 | 17 |
18 | 23 |
24 |
25 |
26 |
27 |
28 |
-------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorUpdateComponent } from './color-update.component'; 4 | 5 | describe('ColorUpdateComponent', () => { 6 | let component: ColorUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color-update/color-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Color } from 'src/app/models/Color/color'; 6 | import { ColorService } from 'src/app/services/Color/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 | 15 | colorUpdateForm: FormGroup; 16 | updateColor:Color; 17 | colors:Color[]; 18 | 19 | constructor(private formBuilder:FormBuilder, 20 | private toastrService:ToastrService, 21 | private colorService:ColorService, 22 | private activatedRoute:ActivatedRoute) { } 23 | 24 | ngOnInit(): void { 25 | this.activatedRoute.params.subscribe((response)=>{ 26 | if(response["colorId"]) 27 | { 28 | this.getColorById(response["colorId"]); 29 | this.createColorUpdateForm(); 30 | this.getColors(); 31 | } 32 | }) 33 | } 34 | 35 | getColors(){ 36 | this.colorService.getColors().subscribe(response=>{ 37 | this.colors=response.data; 38 | }) 39 | } 40 | 41 | getColorById(colorId:number){ 42 | this.colorService.getColorById(colorId).subscribe(response=>{ 43 | this.updateColor=response.data; 44 | 45 | this.colorUpdateForm.get("colorId")?.setValue(this.updateColor.colorId); 46 | this.colorUpdateForm.get("colorName")?.setValue(this.updateColor.colorName); 47 | }) 48 | } 49 | 50 | createColorUpdateForm(){ 51 | this.colorUpdateForm=this.formBuilder.group({ 52 | colorId:["",Validators.required], 53 | colorName:["", Validators.required] 54 | }) 55 | } 56 | 57 | update(){ 58 | if(this. colorUpdateForm.valid){ 59 | let updateColorModel=Object.assign({},this.colorUpdateForm.value); 60 | 61 | console.log(updateColorModel); 62 | 63 | this.colorService.update(updateColorModel).subscribe( 64 | (response)=>{ 65 | this.toastrService.success(response.message,"Başarılı") 66 | setTimeout(() => { 67 | window.location.reload(); 68 | }, 2000); 69 | }, 70 | (responseError)=>{ 71 | console.log(responseError); 72 | if(responseError.error.ValidationErrors.lengh>0){ 73 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 74 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Doğrulama Hatası"); 75 | } 76 | } 77 | } 78 | ); 79 | } 80 | else{ 81 | this.toastrService.error("Formunuz eksiktir. Kontrol ediniz.","Dikkat"); 82 | } 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.css: -------------------------------------------------------------------------------- 1 | 2 | .sidebar-title { 3 | background-color:#FFC107; 4 | color:white; 5 | text-align: center; 6 | letter-spacing: 1px; 7 | } 8 | 9 | ul 10 | { 11 | background-color: transparent; 12 | list-style-type: none; 13 | padding-left: 0; 14 | border-color: transparent; 15 | } 16 | .active{ 17 | background-color:rgba(156, 154, 154, 0.247); 18 | color:black; 19 | border-color: transparent; 20 | } 21 | 22 | .list-group-item{ 23 | background-color: transparent; 24 | border-color: transparent; 25 | } 26 | 27 | .fs-5{ 28 | text-align:center; 29 | } 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
    4 | 5 |
    6 |
    7 | 8 |
  • 13 | Tüm Renkler 14 |
  • 15 |
  • 21 | {{ color.colorName }} 22 |
  • 23 |
    24 |
25 | 26 |
27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorComponent } from './color.component'; 4 | 5 | describe('ColorComponent', () => { 6 | let component: ColorComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Color } from 'src/app/models/Color/color'; 3 | import { ColorService } from 'src/app/services/Color/color.service'; 4 | 5 | @Component({ 6 | selector: 'app-color', 7 | templateUrl: './color.component.html', 8 | styleUrls: ['./color.component.css'], 9 | }) 10 | export class ColorComponent implements OnInit { 11 | colors: Color[] = []; 12 | currentColor: Color; 13 | 14 | constructor(private colorService: ColorService) {} 15 | 16 | ngOnInit(): void { 17 | this.getColors(); 18 | } 19 | 20 | getColors() { 21 | this.colorService.getColors().subscribe((response) => { 22 | this.colors = response.data; 23 | }); 24 | } 25 | setCurrentColor(color: Color) { 26 | this.currentColor = color; 27 | } 28 | 29 | getCurrentColorClass(color: Color) { 30 | if (color == this.currentColor) { 31 | return 'list-group-item active'; 32 | } else { 33 | return 'list-group-item'; 34 | } 35 | } 36 | 37 | getAllColorClass() { 38 | if (!this.currentColor) { 39 | return 'list-group-item active'; 40 | } else { 41 | return 'list-group-item'; 42 | } 43 | } 44 | 45 | setAllColor() { 46 | return (this.currentColor = { colorId: 0, colorName: ' ' }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/app/components/customer-add/customer-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/customer-add/customer-add.component.css -------------------------------------------------------------------------------- /src/app/components/customer-add/customer-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
Şirket Bilgileri
5 |
6 |
7 |
8 |
9 | 10 | 11 |
12 |
13 | 14 | 15 |
16 |
17 | 18 | 19 |
20 | 25 |
26 |
27 |
28 |
29 |
30 |
-------------------------------------------------------------------------------- /src/app/components/customer-add/customer-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CustomerAddComponent } from './customer-add.component'; 4 | 5 | describe('CustomerAddComponent', () => { 6 | let component: CustomerAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CustomerAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CustomerAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/customer-add/customer-add.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 { Customer } from 'src/app/models/Customer/customer'; 6 | import { User } from 'src/app/models/User/user'; 7 | import { CustomerService } from 'src/app/services/Customer/customer.service'; 8 | import { LocalStorageService } from 'src/app/services/LocalStorage/localstorage.service'; 9 | import { UserService } from 'src/app/services/User/user.service'; 10 | 11 | @Component({ 12 | selector: 'app-customer-add', 13 | templateUrl: './customer-add.component.html', 14 | styleUrls: ['./customer-add.component.css'] 15 | }) 16 | export class CustomerAddComponent implements OnInit { 17 | 18 | addCustomer:Customer; 19 | customerAddForm: FormGroup; 20 | users:User; 21 | 22 | companyName:string; 23 | 24 | constructor(private formBuilder:FormBuilder, 25 | private toastrService:ToastrService, 26 | private userService:UserService, 27 | private customerService:CustomerService, 28 | private localStorageService:LocalStorageService) { } 29 | 30 | ngOnInit(): void { 31 | this.createCustomerAddForm(); 32 | this.getUserById(this.localStorageService.getItem("id")); 33 | } 34 | 35 | getUserById(userId:number){ 36 | this.userService.getUserById(userId).subscribe(response=>{ 37 | this.users=response.data; 38 | console.log(this.users); 39 | 40 | this.customerAddForm.get("userId")?.setValue(this.users.id); 41 | this.customerAddForm.get("companyName")?.setValue(this.companyName); 42 | this.customerAddForm.get("findeks")?.setValue(0); 43 | 44 | console.log(this.customerAddForm) 45 | }) 46 | } 47 | 48 | createCustomerAddForm(){ 49 | this.customerAddForm=this.formBuilder.group({ 50 | userId:["",Validators.required], 51 | companyName:[""], 52 | findeks:["", Validators.required], 53 | }) 54 | } 55 | 56 | add(){ 57 | if(this.customerAddForm.valid){ 58 | let customerModel=Object.assign({}, this.customerAddForm.value) 59 | 60 | this.addCustomer = { 61 | userId:customerModel.userId, 62 | companyName:customerModel.companyName, 63 | findeks:customerModel.findeks, 64 | }; 65 | 66 | this.customerService.add(this.addCustomer).subscribe( 67 | (response) =>{ 68 | this.toastrService.success(response.message, "Başarılı"); 69 | setTimeout(() => { 70 | window.location.replace("http://localhost:4200/cars"); 71 | }, 2000); 72 | }, 73 | (responseError)=>{ 74 | console.log(responseError); 75 | if(responseError.error.ValidationErrors.length>0){ 76 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 77 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Doğrulama Hatası"); 78 | } 79 | } 80 | }); 81 | } 82 | else { 83 | this.toastrService.error("Formunuz eksiktir. Kontrol ediniz.","Dikkat"); 84 | } 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/app/components/customer-update/customer-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/customer-update/customer-update.component.css -------------------------------------------------------------------------------- /src/app/components/customer-update/customer-update.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
Müşteri Güncelle
5 |
6 |
7 |
8 |
9 | 10 | 11 |
12 |
13 | 14 | 15 |
16 |
17 | 18 | 19 |
20 |
21 | 22 | 23 |
24 | 29 |
30 |
31 |
32 |
33 |
34 |
-------------------------------------------------------------------------------- /src/app/components/customer-update/customer-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CustomerUpdateComponent } from './customer-update.component'; 4 | 5 | describe('CustomerUpdateComponent', () => { 6 | let component: CustomerUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CustomerUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CustomerUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/customer-update/customer-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 { CustomerDto } from 'src/app/models/Customer/customerDto'; 6 | import { CustomerService } from 'src/app/services/Customer/customer.service'; 7 | 8 | @Component({ 9 | selector: 'app-customer-update', 10 | templateUrl: './customer-update.component.html', 11 | styleUrls: ['./customer-update.component.css'] 12 | }) 13 | export class CustomerUpdateComponent implements OnInit { 14 | 15 | customerUpdateForm: FormGroup; 16 | updateCustomer:CustomerDto; 17 | customers:CustomerDto[]; 18 | 19 | constructor(private formBuilder:FormBuilder, 20 | private toastrService:ToastrService, 21 | private customerService:CustomerService, 22 | private activatedRoute:ActivatedRoute) { } 23 | 24 | ngOnInit(): void { 25 | this.activatedRoute.params.subscribe((response)=>{ 26 | if(response["id"]) 27 | { 28 | this.getCustomerById(response["id"]); 29 | this.createCustomerUpdateForm(); 30 | } 31 | }) 32 | } 33 | 34 | getCustomerById(id:number){ 35 | this.customerService.getCustomerById(id).subscribe(response=>{ 36 | this.updateCustomer=response.data; 37 | console.log(this.updateCustomer); 38 | 39 | console.log(this.updateCustomer.id); 40 | 41 | this.customerUpdateForm.get("id")?.setValue(this.updateCustomer.id); 42 | this.customerUpdateForm.get("firstName")?.setValue(this.updateCustomer.firstName); 43 | this.customerUpdateForm.get("lastName")?.setValue(this.updateCustomer.lastName); 44 | this.customerUpdateForm.get("companyName")?.setValue(this.updateCustomer.companyName); 45 | 46 | console.log(this.customerUpdateForm) 47 | }) 48 | } 49 | 50 | createCustomerUpdateForm(){ 51 | this.customerUpdateForm=this.formBuilder.group({ 52 | id:["",Validators.required], 53 | firstName:["", Validators.required], 54 | lastName:["", Validators.required], 55 | companyName:["", Validators.required] 56 | }) 57 | } 58 | 59 | update(){ 60 | if(this.customerUpdateForm.valid){ 61 | let updateCustomerModel=Object.assign({},this.customerUpdateForm.value); 62 | 63 | console.log(updateCustomerModel); 64 | 65 | this.customerService.update(updateCustomerModel).subscribe( 66 | (response)=>{ 67 | this.toastrService.success(response.message,"Başarılı") 68 | setTimeout(() => { 69 | window.location.reload(); 70 | }, 2000); 71 | }, 72 | (responseError)=>{ 73 | console.log(responseError); 74 | if(responseError.error.ValidationErrors.lengh>0){ 75 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 76 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Doğrulama Hatası"); 77 | } 78 | } 79 | } 80 | ); 81 | } 82 | else{ 83 | this.toastrService.error("Formunuz eksiktir. Kontrol ediniz.","Dikkat"); 84 | } 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/customer/customer.component.css -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
IdAdSoyadŞirket AdıFindeks PuanıGüncelle
{{ customer.id }}{{ customer.firstName }}{{ customer.lastName }}{{ customer.companyName }}{{ customer.findeks }}
34 |
35 | -------------------------------------------------------------------------------- /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 { CustomerDto } from 'src/app/models/Customer/customerDto'; 3 | import { CustomerService } from 'src/app/services/Customer/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:CustomerDto[]=[]; 13 | constructor(private customerServise:CustomerService) { } 14 | 15 | ngOnInit(): void { 16 | this.getCustomers(); 17 | } 18 | 19 | getCustomers(){ 20 | this.customerServise.getCustomers().subscribe(response=>{ 21 | this.customers=response.data; 22 | }) 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/app/components/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/components/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"); 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 | -------------------------------------------------------------------------------- /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 | background-color: #f5f5f5; 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 | } -------------------------------------------------------------------------------- /src/app/components/login/login.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |

Giriş Yap

5 | 6 |
7 | 8 | 9 |
10 |
11 | 12 | 13 |
14 | 15 |
16 | 19 |
20 | 21 | 22 | 23 | 24 | 29 |
30 |
31 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginComponent } from './login.component'; 4 | 5 | describe('LoginComponent', () => { 6 | let component: LoginComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ LoginComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoginComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { 3 | FormGroup, 4 | FormControl, 5 | Validators, 6 | FormBuilder, 7 | } from '@angular/forms'; 8 | import { Router } from '@angular/router'; 9 | import { ToastrService } from 'ngx-toastr'; 10 | import { throwError } from 'rxjs'; 11 | import { User } from 'src/app/models/User/user'; 12 | import { AuthService } from 'src/app/services/Auth/auth.service'; 13 | import { CustomerService } from 'src/app/services/Customer/customer.service'; 14 | import { LocalStorageService } from 'src/app/services/LocalStorage/localstorage.service'; 15 | import { UserService } from 'src/app/services/User/user.service'; 16 | 17 | @Component({ 18 | selector: 'app-login', 19 | templateUrl: './login.component.html', 20 | styleUrls: ['./login.component.css'], 21 | }) 22 | export class LoginComponent implements OnInit { 23 | loginForm: FormGroup; 24 | user: User; 25 | 26 | constructor( 27 | private formBuilder: FormBuilder, 28 | private authService: AuthService, 29 | private toastrService: ToastrService, 30 | private router:Router, 31 | private userService:UserService, 32 | private localStorageService:LocalStorageService, 33 | private customerService:CustomerService 34 | ) {} 35 | 36 | ngOnInit(): void { 37 | this.createLoginForm(); 38 | } 39 | 40 | createLoginForm() { 41 | this.loginForm = this.formBuilder.group({ 42 | email: ['', Validators.required], 43 | password: ['', Validators.required], 44 | }); 45 | } 46 | 47 | 48 | login() { 49 | if (this.loginForm.valid) { 50 | let loginModel = Object.assign({}, this.loginForm.value); 51 | 52 | this.authService.login(loginModel).subscribe( 53 | (response) => { 54 | console.log(response); 55 | this.toastrService.info(response.message, 'Bilgi'); 56 | localStorage.setItem('token', response.data.token); 57 | this.getUserByEmail(loginModel.email); 58 | 59 | setTimeout(() => { 60 | this.toastrService.info("Müşteri işlemlerini tamamlamak için yönlendiriliyorsunuz.", "Bilgi"); 61 | window.location.replace("http://localhost:4200/customers/add"); 62 | }, 2000) 63 | 64 | }, 65 | (responseError) => { 66 | console.log(responseError); 67 | this.toastrService.error(responseError.error,"Bilgi"); 68 | } 69 | ); 70 | } 71 | } 72 | 73 | getUserByEmail(email: string) { 74 | this.userService.getByEmail(email).subscribe(response => { 75 | this.user = response.data; 76 | this.localStorageService.setItem("user",this.user); 77 | this.localStorageService.setItem("id",this.user.id); 78 | this.localStorageService.setItem("email",this.user.email); 79 | }); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.css: -------------------------------------------------------------------------------- 1 | .navbar-brand{ 2 | color: white; 3 | } 4 | .text-end{ 5 | align-items:baseline; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 97 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { NaviComponent } from './navi.component'; 4 | 5 | describe('NaviComponent', () => { 6 | let component: NaviComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ NaviComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(NaviComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { CarDto } from 'src/app/models/Car/carDto'; 5 | import { User } from 'src/app/models/User/user'; 6 | import { AuthService } from 'src/app/services/Auth/auth.service'; 7 | import { CarService } from 'src/app/services/Car/car.service'; 8 | import { LocalStorageService } from 'src/app/services/LocalStorage/localstorage.service'; 9 | import { UserService } from 'src/app/services/User/user.service'; 10 | 11 | @Component({ 12 | selector: 'app-navi', 13 | templateUrl: './navi.component.html', 14 | styleUrls: ['./navi.component.css'] 15 | }) 16 | export class NaviComponent implements OnInit { 17 | 18 | 19 | title:string = 'Rent A Car'; 20 | email = this.localStorageService.getItem('email'); 21 | user:User; 22 | userName:string; 23 | claim:string; 24 | 25 | 26 | constructor(private carService:CarService, 27 | private authService:AuthService, 28 | private localStorageService:LocalStorageService, 29 | private toastrService:ToastrService, 30 | private userService:UserService, 31 | private router:Router) { } 32 | 33 | ngOnInit(): void { 34 | this.isLogin(); 35 | this.checkToEmail(); 36 | this.getClaim(this.localStorageService.getItem("user").id); 37 | } 38 | 39 | 40 | 41 | isLogin(){ 42 | if(this.authService.isAuthenticated()){ 43 | return "gizle"; 44 | } 45 | else{ 46 | return ""; 47 | } 48 | } 49 | 50 | checkToLogin(){ 51 | if(this.authService.isAuthenticated()){ 52 | return true; 53 | } 54 | else{ 55 | return false; 56 | } 57 | } 58 | 59 | checkToEmail(){ 60 | if(this.localStorageService.getItem('email')){ 61 | return true; 62 | }else{ 63 | return false; 64 | } 65 | } 66 | 67 | logOut(){ 68 | this.localStorageService.clean() 69 | this.toastrService.success("Başarıyla Çıkış Yapıldı"); 70 | this.router.navigate(["cars"]); 71 | window.location.replace("http://localhost:4200/cars"); 72 | 73 | } 74 | 75 | getEmail(){ 76 | if(this.email){ 77 | this.userService.getByEmail(this.email).subscribe(response=>{ 78 | this.user = response.data; 79 | }) 80 | } 81 | } 82 | 83 | getUser(){ 84 | return this.localStorageService.getItem('user'); 85 | } 86 | 87 | getClaim(userId:number){ 88 | this.userService.getClaimById(userId).subscribe(response=>{ 89 | this.claim=response.data.name; 90 | }); 91 | } 92 | 93 | isAdmin(){ 94 | if(this.claim=="admin"){ 95 | return ""; 96 | } 97 | else{ 98 | return "gizle" 99 | } 100 | } 101 | } 102 | 103 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.css: -------------------------------------------------------------------------------- 1 | body { 2 | min-height: 100vh; 3 | display: flex; 4 | align-items: center; 5 | justify-content: center; 6 | background-color: rgb(0, 0, 34); 7 | font-size: 0.8rem 8 | } 9 | 10 | .card { 11 | max-width: 1000px; 12 | margin: 0 auto; 13 | float: none; 14 | margin-bottom: 10px; 15 | } 16 | 17 | .card-top { 18 | padding: 0.7rem 5rem 19 | } 20 | 21 | .card-top a { 22 | float: left; 23 | margin-top: 0.7rem 24 | } 25 | 26 | #logo { 27 | font-family: 'Dancing Script'; 28 | font-weight: bold; 29 | font-size: 1.6rem 30 | } 31 | 32 | .card-body { 33 | /*padding: 0 5rem 5rem 5rem;*/ 34 | background-size: cover; 35 | background-repeat: no-repeat 36 | } 37 | 38 | @media(max-width:768px) { 39 | .card-body { 40 | padding: 0 1rem 1rem 1rem; 41 | background-size: cover; 42 | background-repeat: no-repeat 43 | } 44 | 45 | .card-top { 46 | padding: 0.7rem 1rem 47 | } 48 | } 49 | 50 | .row { 51 | margin: 0 52 | } 53 | 54 | .upper { 55 | padding: 1rem 0; 56 | justify-content: space-evenly 57 | } 58 | 59 | #three { 60 | border-radius: 1rem; 61 | width: 22px; 62 | height: 22px; 63 | margin-right: 3px; 64 | border: 1px solid blue; 65 | text-align: center; 66 | display: inline-block 67 | } 68 | 69 | #payment { 70 | margin: 0; 71 | color: blue 72 | } 73 | 74 | .icons { 75 | margin-left: auto 76 | } 77 | 78 | form span { 79 | color: rgb(179, 179, 179) 80 | } 81 | 82 | form { 83 | padding: 2vh 0 84 | } 85 | 86 | input { 87 | border: 1px solid rgba(0, 0, 0, 0.137); 88 | padding: 1vh; 89 | margin-bottom: 4vh; 90 | outline: none; 91 | width: 100%; 92 | background-color: rgb(247, 247, 247) 93 | } 94 | 95 | input:focus::-webkit-input-placeholder { 96 | color: transparent 97 | } 98 | 99 | .header { 100 | font-size: 1.5rem 101 | } 102 | 103 | .left { 104 | background-color: #ffffff; 105 | padding: 2vh 106 | } 107 | 108 | .left img { 109 | width: 2rem 110 | } 111 | 112 | .left .col-4 { 113 | padding-left: 0 114 | } 115 | 116 | .right .item { 117 | padding: 0.3rem 0 118 | } 119 | 120 | .right { 121 | background-color: #ffffff; 122 | padding: 2vh 123 | } 124 | 125 | .col-8 { 126 | padding: 0 0vh 127 | } 128 | 129 | .lower { 130 | line-height: 2 131 | } 132 | 133 | .btn { 134 | background-color: rgb(23, 4, 189); 135 | border-color: rgb(23, 4, 189); 136 | color: white; 137 | width: 100%; 138 | font-size: 0.7rem; 139 | margin: 4vh 0 1.5vh 0; 140 | padding: 1.5vh; 141 | border-radius: 0 142 | } 143 | 144 | .btn:focus { 145 | box-shadow: none; 146 | outline: none; 147 | box-shadow: none; 148 | color: white; 149 | -webkit-box-shadow: none; 150 | -webkit-user-select: none; 151 | transition: none 152 | } 153 | 154 | .btn:hover { 155 | color: white 156 | } 157 | 158 | a { 159 | color: black 160 | } 161 | 162 | a:hover { 163 | color: black; 164 | text-decoration: none 165 | } 166 | 167 | input[type=checkbox] { 168 | width: unset; 169 | margin-bottom: unset 170 | } 171 | 172 | #cvv { 173 | background-image: linear-gradient(to left, rgba(255, 255, 255, 0.575), rgba(255, 255, 255, 0.541)), url("https://img.icons8.com/material-outlined/24/000000/help.png"); 174 | background-repeat: no-repeat; 175 | background-position-x: 95%; 176 | background-position-y: center 177 | } 178 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | 13 | 16 | 17 |
18 |
19 |
20 | Kart Üzerindeki İsim: 21 | 22 | Kart Numarası: 23 | 24 |
25 |
26 | Son Kullanma Tarihi: 27 | 28 |
29 |
30 |
31 | 32 |
33 |
34 | CVV: 35 | 36 |
37 |
38 | 44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
Kiralama Detayı
52 |
53 |
54 |
Marka:
55 |
{{ carBrandName }}
56 |
57 |
58 |
Yıl:
59 |
{{ carModelYear }}
60 |
61 |
62 |
Kiralama Tarihi:
63 |
{{ rentalCarDetail.rentDate | date: 'dd/MM/yyyy HH:mm' }}
64 |
65 |
66 |
Teslim Tarihi:
67 |
{{ rentalCarDetail.estReturnDate | date: 'dd/MM/yyyy HH:mm' }}
68 |
69 |
70 |
Ödenecek Tutar:
71 |
{{ totalPaye | currency:"₺" }}
72 |
73 |
74 | 75 |
76 |
77 |
78 |
79 |
80 |
81 | 82 | -------------------------------------------------------------------------------- /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 { BinaryOperatorExpr } from '@angular/compiler'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 4 | import { ActivatedRoute, Router } from '@angular/router'; 5 | import { ToastrService } from 'ngx-toastr'; 6 | import { CarDto } from 'src/app/models/Car/carDto'; 7 | import { Payment } from 'src/app/models/Payment/payment'; 8 | import { Rental } from 'src/app/models/Rental/rental'; 9 | import { CarService } from 'src/app/services/Car/car.service'; 10 | import { CarDetailByIdService } from 'src/app/services/CarDetail/car-detail-by-id.service'; 11 | import { PaymentService } from 'src/app/services/Payment/payment.service'; 12 | import { RentalService } from 'src/app/services/Rental/rental.service'; 13 | 14 | @Component({ 15 | selector: 'app-payment', 16 | templateUrl: './payment.component.html', 17 | styleUrls: ['./payment.component.css'] 18 | }) 19 | export class PaymentComponent implements OnInit { 20 | 21 | payments: Payment[]; 22 | carDetail: CarDto[]; 23 | addPayment: Payment; 24 | addRental: Rental; 25 | rentalCarDetail: Rental; 26 | 27 | carBrandName: string; 28 | carModelYear: number; 29 | cardDate: string; 30 | 31 | paymentAddForm: FormGroup; 32 | 33 | totalPaye: number; 34 | check: boolean; 35 | checked: boolean; 36 | 37 | returnPayAddMessage: string; 38 | 39 | constructor(private paymentService: PaymentService, 40 | private formBuilder: FormBuilder, 41 | private router: Router, 42 | private rentalService: RentalService, 43 | private carDetailService: CarDetailByIdService, 44 | private toastrService: ToastrService) { } 45 | 46 | ngOnInit(): void { 47 | this.rentalCarDetail = this.paymentService.getRental(); 48 | this.totalPaye = this.paymentService.getRentalTotalPaye(); 49 | this.createPaymentAddForm(); 50 | if ((this.rentalCarDetail === undefined) || (this.totalPaye <= 0)) { 51 | this.router.navigate(['/cars']); 52 | //this.toastrService.error("Araç listesine yönlendiriliyorsunuz", "Hatalı işlem"); 53 | } 54 | console.log(this.rentalCarDetail); 55 | console.log(this.totalPaye); 56 | this.getCarDetailById(this.rentalCarDetail.carId); 57 | } 58 | 59 | getCarDetailById(carId: number) { 60 | this.carDetailService.getCarDetailById(carId).subscribe((response) => { 61 | this.carDetail = response.data; 62 | this.carBrandName = this.carDetail[0].brandName; 63 | this.carModelYear = this.carDetail[0].modelYear; 64 | }); 65 | } 66 | 67 | createPaymentAddForm() { 68 | this.paymentAddForm = this.formBuilder.group({ 69 | cardNameSurname: ["", Validators.required], 70 | cardNumber: ["", Validators.required], 71 | cardDateMonth: ["", Validators.required], 72 | cardDateYear: ["", Validators.required], 73 | cardCvv: ["", Validators.required], 74 | }) 75 | } 76 | 77 | add() { 78 | if (this.paymentAddForm.valid) { 79 | let paymentModel = Object.assign({}, this.paymentAddForm.value); 80 | this.cardDate = paymentModel.cardDateMonth.toString() + "/" + paymentModel.cardDateYear.toString(); 81 | 82 | if ((paymentModel.cardNameSurname === undefined) || (!paymentModel.cardNameSurname)) { 83 | this.toastrService.warning('Kart Sahibi bilgisini kontrol ediniz.'); 84 | } 85 | else if ((paymentModel.cardNumber === undefined) || (!paymentModel.cardNumber)) { 86 | this.toastrService.warning('Kart Numarası bilgisini kontrol ediniz.'); 87 | } 88 | else if ((paymentModel.cardDateMonth === undefined) || (!paymentModel.cardDateMonth)) { 89 | this.toastrService.warning('Tarih Ay bilgisini kontrol ediniz.'); 90 | } 91 | else if ((paymentModel.cardDateYear === undefined) || (!paymentModel.cardDateYear)) { 92 | this.toastrService.warning('Tarih Yıl bilgisini kontrol ediniz.'); 93 | } 94 | else if ((paymentModel.cardCvv === undefined) || (!paymentModel.cardCvv)) { 95 | this.toastrService.warning('CVV bilgisini kontrol ediniz.'); 96 | } 97 | else { 98 | this.addPayment = { 99 | carId:this.rentalCarDetail.carId, 100 | cardNameSurname: paymentModel.cardNameSurname, 101 | cardNumber: paymentModel.cardNumber, 102 | cardExpiryDate: this.cardDate, 103 | cardCvv: paymentModel.cardCvv, 104 | totalPaye: this.totalPaye 105 | }; 106 | 107 | console.log(paymentModel); 108 | console.log(this.addPayment) 109 | 110 | this.paymentService.addPayment(this.addPayment).subscribe( 111 | (response) => { 112 | this.toastrService.success(response.message, "Başarılı"); 113 | console.log(this.rentalCarDetail); 114 | 115 | this.addRental ={ 116 | carId:this.rentalCarDetail.carId, 117 | customerId:this.rentalCarDetail.customerId, 118 | rentDate:this.rentalCarDetail.rentDate, 119 | estReturnDate:this.rentalCarDetail.estReturnDate, 120 | } 121 | 122 | this.rentalService.addRental(this.addRental).subscribe( 123 | (response2)=> 124 | { 125 | this.toastrService.success(response2.message.toString(), "Kiralama Başarılı"); 126 | this.router.navigate(['/rentalslist']); 127 | }, 128 | (responseError2)=> 129 | { 130 | this.toastrService.error('Kiralama İşlemi Yapılamadı.', 'Kiralama Başarısız'); 131 | console.log(responseError2); 132 | } 133 | ); 134 | // setTimeout(() => { 135 | // window.location.reload(); 136 | // }, 2000); 137 | }, 138 | (responseError) => { 139 | console.log(responseError); 140 | if (responseError.error.ValidationErrors.length > 0) { 141 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 142 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage, "Doğrulama Hatası"); 143 | } 144 | } 145 | 146 | } 147 | ); 148 | 149 | } 150 | 151 | } 152 | } 153 | 154 | // setCheck(){ 155 | // this.bayrak+=1; 156 | // if(this.bayrak==1) 157 | // { 158 | // this.bayrak=1; 159 | // } 160 | // else{ 161 | // this.bayrak=0; 162 | // } 163 | // } 164 | 165 | // controlCheck(check:boolean){ 166 | 167 | // if(this.bayrak==1){ 168 | // this.checked=true; 169 | // } 170 | // else{ 171 | // this.checked=false; 172 | // } 173 | // } 174 | } 175 | 176 | -------------------------------------------------------------------------------- /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 | background-color: #f5f5f5; 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 | } -------------------------------------------------------------------------------- /src/app/components/register/register.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |

Kayıt Ol

5 | 6 |
7 | 8 | 9 |
10 | 11 |
12 | 13 | 14 |
15 | 16 |
17 | 18 | 19 |
20 |
21 | 22 | 23 |
24 | 25 |
26 | 27 |
28 |
29 |
30 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RegisterComponent } from './register.component'; 4 | 5 | describe('RegisterComponent', () => { 6 | let component: RegisterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ RegisterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RegisterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormControl, Validators, FormBuilder } from "@angular/forms"; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { AuthService } from 'src/app/services/Auth/auth.service'; 6 | 7 | @Component({ 8 | selector: 'app-register', 9 | templateUrl: './register.component.html', 10 | styleUrls: ['./register.component.css'] 11 | }) 12 | export class RegisterComponent implements OnInit { 13 | 14 | registerForm:FormGroup; 15 | 16 | constructor(private formBuilder:FormBuilder, 17 | private toastrService:ToastrService, 18 | private authService:AuthService, 19 | private router:Router) { } 20 | 21 | ngOnInit(): void { 22 | this.createRegisterForm(); 23 | } 24 | 25 | createRegisterForm(){ 26 | this.registerForm= this.formBuilder.group({ 27 | firstName:["",Validators.required], 28 | lastName:["",Validators.required], 29 | email:["",Validators.required], 30 | password:["",Validators.required], 31 | }) 32 | } 33 | 34 | register(){ 35 | if (this.registerForm.valid) { 36 | let registerModel = Object.assign({}, this.registerForm.value); 37 | this.authService.register(registerModel).subscribe( 38 | (response) => { 39 | console.log(response); 40 | this.toastrService.info("Sisteme başarıyla kaydedildiniz.", "Bilgi"); 41 | setTimeout(() => { 42 | this.toastrService.info("Giriş sayfasına yönlendiriliyorsunuz", "Bilgi"); 43 | this.router.navigate(['/login']); 44 | }, 300) 45 | }, 46 | (responseError) => { 47 | console.log(responseError); 48 | this.toastrService.error(responseError.error,"Bilgi"); 49 | } 50 | ); 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/app/components/rental-list/rental-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/rental-list/rental-list.component.css -------------------------------------------------------------------------------- /src/app/components/rental-list/rental-list.component.html: -------------------------------------------------------------------------------- 1 |
2 | 7 | 8 | 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 |
IdMarkaModel YılıGünlük ÜcretMüşteri Adı SoyadıŞirket AdıKiralama TarihiTeslim TarihiÖdenen Ücret
{{ rental.id }}{{ rental.brandName }}{{ rental.modelYear }}{{ rental.dailyPrice | vatAdded:18 | currency:"₺" }}{{ rental.firstName }} {{ rental.lastName }}{{ rental.companyName }}{{ rental.rentDate | date: 'dd/MM/yyyy HH:mm' }}{{ rental.estReturnDate | date: 'dd/MM/yyyy HH:mm' }}{{ rental.totalPaye | currency:"₺" }}
42 |
43 | -------------------------------------------------------------------------------- /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/Rental/rentalDto'; 3 | import { RentalService } from 'src/app/services/Rental/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 | dataLoaded=false; 13 | rentals:RentalDto[]; 14 | constructor(private rentalService:RentalService) { } 15 | 16 | ngOnInit(): void { 17 | this.getRentals(); 18 | } 19 | 20 | getRentals(){ 21 | this.rentalService.getRentals().subscribe(response=>{ 22 | this.rentals=response.data; 23 | this.dataLoaded=response.success; 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/rental/rental.component.css -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.html: -------------------------------------------------------------------------------- 1 |
2 | {{carDetails.brandName}} - {{ carDetails.description }} 3 |
4 |
5 |
6 |
7 | ... 9 |
10 |
11 |
12 |
13 |
{{ carDetails.brandName }}
14 |
15 |
    16 |
  • Yıl: {{ carDetails.modelYear }}
  • 17 |
  • Marka: {{ carDetails.brandName }}
  • 18 |
  • Açıklama: {{ carDetails.description }}
  • 19 |
  • Renk: {{ carDetails.colorName }}
  • 20 |
  • 21 | Günlük Fiyat : {{ carDetails.dailyPrice | vatAdded:18 | currency: "₺" }} 22 |
  • 23 |
24 | 25 |
26 |
27 |
28 | 29 |
30 |
31 | 32 |
33 |
34 | 35 |
36 |
37 |
38 | 44 |
45 | 47 |
48 | 50 | 58 |
59 |
60 |
61 | 62 | -------------------------------------------------------------------------------- /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 { ActivatedRoute, Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { CarDto } from 'src/app/models/Car/carDto'; 5 | import { CustomerDto } from 'src/app/models/Customer/customerDto'; 6 | import { Rental } from 'src/app/models/Rental/rental'; 7 | import { RentalDto } from 'src/app/models/Rental/rentalDto'; 8 | import { CarDetailByIdService } from 'src/app/services/CarDetail/car-detail-by-id.service'; 9 | import { CustomerService } from 'src/app/services/Customer/customer.service'; 10 | import { LocalStorageService } from 'src/app/services/LocalStorage/localstorage.service'; 11 | import { PaymentService } from 'src/app/services/Payment/payment.service'; 12 | import { RentalService } from 'src/app/services/Rental/rental.service'; 13 | import { UserService } from 'src/app/services/User/user.service'; 14 | 15 | @Component({ 16 | selector: 'app-rental', 17 | templateUrl: './rental.component.html', 18 | styleUrls: ['./rental.component.css'] 19 | }) 20 | export class RentalComponent implements OnInit { 21 | 22 | rentals: RentalDto[] = []; 23 | rentalsByCarId: RentalDto[] = []; 24 | carDetails: CarDto; 25 | customers: CustomerDto[]; 26 | customerDetail: CustomerDto; 27 | 28 | customerId: number; 29 | rentDate: Date; 30 | estReturnDate: Date; 31 | totalPaye: number; 32 | 33 | constructor(private rentalService: RentalService, 34 | private activatedRoute: ActivatedRoute, 35 | private carDetailByIdService: CarDetailByIdService, 36 | private customerService: CustomerService, 37 | private router: Router, 38 | private paymentService: PaymentService, 39 | private toastrService: ToastrService, 40 | ) { } 41 | 42 | 43 | ngOnInit(): void { 44 | this.activatedRoute.params.subscribe(params => { 45 | if (params["id"]) { 46 | this.getCarsById(params["id"]) 47 | } 48 | this.getRentals(); 49 | this.getCustomer(); 50 | }) 51 | } 52 | 53 | getRentals() { 54 | this.rentalService.getRentals().subscribe(response => { 55 | this.rentals = response.data; 56 | }) 57 | } 58 | 59 | getCustomer() { 60 | this.customerService.getCustomers().subscribe(response => { 61 | this.customers = response.data; 62 | console.log(this.customers) 63 | }) 64 | } 65 | getRentDate() { 66 | var today = new Date(); 67 | today.setDate(today.getDate() + 1); 68 | return today.toISOString().slice(0, 10) 69 | } 70 | getReturnDate() { 71 | var today = new Date(); 72 | today.setDate(today.getDate() + 2); 73 | return today.toISOString().slice(0, 10) 74 | } 75 | 76 | 77 | getCarsById(id: number) { 78 | this.carDetailByIdService.getCarDetailById(id).subscribe(response => { 79 | this.carDetails = response.data[0]; 80 | }) 81 | } 82 | 83 | createRental() { 84 | let MyRental: Rental = { 85 | carId: this.carDetails.id, 86 | rentDate: this.rentDate, 87 | estReturnDate: this.estReturnDate, 88 | customerId: parseInt(this.customerId.toString()) 89 | } 90 | 91 | console.log(this.customerId); 92 | this.customerService.getCustomerById(this.customerId).subscribe(response=>{ 93 | 94 | if(response.data.findeks>=this.carDetails.findeks){ 95 | this.toastrService.success("Findeks puanınız kiralama işlemi için uygundur.","Başarılı"); 96 | 97 | this.rentalService.checkCarStatus(MyRental).subscribe( 98 | (response) => { 99 | this.toastrService.success(response.message.toString(), 'Tarihler Uygun'); 100 | var date1 = new Date(this.estReturnDate.toString()); 101 | var date2 = new Date(this.rentDate.toString()); 102 | var difference = date1.getTime() - date2.getTime(); 103 | var numberOfDays = Math.ceil(difference / (1000 * 3600 * 24)); 104 | this.totalPaye = numberOfDays * (this.carDetails.dailyPrice + (this.carDetails.dailyPrice * 18 / 100)); 105 | 106 | this.paymentService.setRentalCar(MyRental, this.totalPaye); 107 | 108 | console.log(MyRental); 109 | console.log(this.totalPaye); 110 | setTimeout(() => { 111 | this.toastrService.info("Ödeme sayfasına yönlendiriliyorsunuz...", "Ödeme İşlemleri"); 112 | this.router.navigate(['/payments']); 113 | }, 2000) 114 | }, 115 | (responseError)=> 116 | { 117 | this.toastrService.error(responseError.error.message,"Hata"); 118 | } 119 | ); 120 | } 121 | else{ 122 | this.toastrService.error("Findeks puanınız kiralama işlemi için uygun değildir, uygun bir araç seçiniz.","Hata"); 123 | } 124 | }); 125 | 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/app/components/sidebar/sidebar.component.css: -------------------------------------------------------------------------------- 1 | thead { 2 | background-color: bg-light; 3 | color:white; 4 | font-weight: bold; 5 | letter-spacing: 1px; 6 | } 7 | .sidebar-title { 8 | background-color:#FFC107; 9 | color:black; 10 | letter-spacing: 1px; 11 | } 12 | 13 | ul 14 | { 15 | list-style-type: none; 16 | padding-left: 0; 17 | } 18 | .active{ 19 | background-color:rgba(156, 154, 154, 0.247); 20 | color: black; 21 | } 22 | -------------------------------------------------------------------------------- /src/app/components/sidebar/sidebar.component.html: -------------------------------------------------------------------------------- 1 |
2 |
    3 | 4 |
  • 9 | All Brands 10 |
  • 11 |
  • 16 | {{ brand.brandName }} 17 |
  • 18 |
19 |
20 | 21 |
22 |
    23 |
    24 |
  • 25 |
  • All Colors
  • 29 | 30 |
  • {{color.colorName}}
  • 33 |
    34 |
35 |
-------------------------------------------------------------------------------- /src/app/components/sidebar/sidebar.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SidebarComponent } from './sidebar.component'; 4 | 5 | describe('SidebarComponent', () => { 6 | let component: SidebarComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ SidebarComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(SidebarComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/sidebar/sidebar.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute, Router } from '@angular/router'; 3 | import { Brand } from 'src/app/models/Brand/brand'; 4 | import { Color } from 'src/app/models/Color/color'; 5 | import { BrandService } from 'src/app/services/Brand/brand.service'; 6 | import { ColorService } from 'src/app/services/Color/color.service'; 7 | 8 | @Component({ 9 | selector: 'app-sidebar', 10 | templateUrl: './sidebar.component.html', 11 | styleUrls: ['./sidebar.component.css'] 12 | }) 13 | export class SidebarComponent implements OnInit { 14 | 15 | brands : Brand[] = []; 16 | currentBrand: Brand; 17 | 18 | colors: Color[] = []; 19 | currentColor: Color; 20 | 21 | constructor(private brandService:BrandService, 22 | private colorService:ColorService, 23 | private router: Router, 24 | ) { } 25 | 26 | 27 | ngOnInit(): void { 28 | this.getBrands(); 29 | this.getColors(); 30 | } 31 | 32 | 33 | //Brand 34 | getBrands(){ 35 | this.brandService.getBrands().subscribe(response=>{ 36 | this.brands=response.data; 37 | }) 38 | } 39 | 40 | setCurrentBrand(brand:Brand){ 41 | this.currentBrand=brand; 42 | let brandId = this.currentBrand.brandId; 43 | this.router.navigate(["cars/brand/"+brandId]); 44 | } 45 | 46 | getCurrentBrandClass(brand:Brand){ 47 | if(brand==this.currentBrand) 48 | {return "list-group-item active"} 49 | else 50 | {return "list-group-item"} 51 | } 52 | 53 | getAllBrandClass(){ 54 | if(!this.currentBrand){ 55 | return "list-group-item active" 56 | }else{ 57 | return "list-group-item" 58 | } 59 | } 60 | 61 | setAllBrand(){ 62 | return this.currentBrand={brandId:0, brandName:""}; 63 | } 64 | 65 | //Color 66 | getColors() { 67 | this.colorService.getColors().subscribe((response) => { 68 | this.colors = response.data; 69 | }); 70 | } 71 | setCurrentColor(color: Color) { 72 | this.currentColor = color; 73 | let colorId = this.currentColor.colorId; 74 | this.router.navigate(["cars/color/"+colorId]); 75 | } 76 | 77 | getCurrentColorClass(color: Color) { 78 | if (color == this.currentColor) { 79 | return 'list-group-item active'; 80 | } else { 81 | return 'list-group-item'; 82 | } 83 | } 84 | 85 | getAllColorClass() { 86 | if (!this.currentColor) { 87 | return 'list-group-item active'; 88 | } else { 89 | return 'list-group-item'; 90 | } 91 | } 92 | 93 | setAllColor() { 94 | return (this.currentColor = { colorId: 0, colorName:""}); 95 | } 96 | 97 | 98 | } 99 | 100 | -------------------------------------------------------------------------------- /src/app/components/user/user.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/app/components/user/user.component.css -------------------------------------------------------------------------------- /src/app/components/user/user.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Merhaba, {{ user.firstName }} {{ user.lastName }} 9 |
10 |
11 |
12 |
13 |
14 | 17 |
18 | 26 |
27 |
28 | 29 |
30 | 33 |
34 | 42 |
43 |
44 | 45 |
46 | 49 |
50 | 58 |
59 |
60 | 61 |
62 | 65 |
66 | 73 |
74 |
75 |
76 |
77 | 78 | 87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
Şirket Hesabı Bilgileriniz
97 |
98 |
99 |
100 |
101 | 104 |
105 | 112 |
113 |
114 |
115 |
116 | 119 |
120 | 127 | 128 |
129 |
130 |
131 |
132 | 133 | 142 |
143 |
144 |
145 |
146 | 147 |
148 |
149 |
150 |
151 |
152 |
Şirket Hesabı Bilgileriniz
153 |
154 |
155 | Şirket hesabınız henüz yok hemen oluşturun. 156 | 157 | 158 | 167 |
168 |
169 |
170 |
171 |
-------------------------------------------------------------------------------- /src/app/components/user/user.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { UserComponent } from './user.component'; 4 | 5 | describe('UserComponent', () => { 6 | let component: UserComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ UserComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(UserComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/user/user.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { 3 | FormBuilder, 4 | FormControl, 5 | FormGroup, 6 | Validators, 7 | } from '@angular/forms'; 8 | import { Router } from '@angular/router'; 9 | import { ToastrService } from 'ngx-toastr'; 10 | import { Customer } from 'src/app/models/Customer/customer'; 11 | import { CustomerDto } from 'src/app/models/Customer/customerDto'; 12 | import { User } from 'src/app/models/User/user'; 13 | import { CustomerService } from 'src/app/services/Customer/customer.service'; 14 | import { LocalStorageService } from 'src/app/services/LocalStorage/localstorage.service'; 15 | import { UserService } from 'src/app/services/User/user.service'; 16 | 17 | @Component({ 18 | selector: 'app-user', 19 | templateUrl: './user.component.html', 20 | styleUrls: ['./user.component.css'], 21 | }) 22 | export class UserComponent implements OnInit { 23 | editProfileForm: FormGroup; 24 | editCustomerForm: FormGroup; 25 | password: FormControl; 26 | email: string; 27 | user: User; 28 | customer: Customer; 29 | 30 | constructor( 31 | private userService: UserService, 32 | private customerService: CustomerService, 33 | private formBuilder: FormBuilder, 34 | private toastrService: ToastrService, 35 | private localStorageService: LocalStorageService, 36 | private router: Router 37 | ) {} 38 | 39 | ngOnInit(): void { 40 | this.createProfileAddForm(); 41 | this.createCustomerAddForm(); 42 | this.user = this.localStorageService.getItem('user'); 43 | this.email = this.localStorageService.getItem('email'); 44 | this.getUser(); 45 | this.getCustomer(); 46 | } 47 | 48 | createProfileAddForm() { 49 | this.editProfileForm = this.formBuilder.group({ 50 | firstName: ['', Validators.required], 51 | lastName: ['', Validators.required], 52 | email: ['', Validators.required], 53 | password: ['', Validators.required], 54 | }); 55 | } 56 | createCustomerAddForm() { 57 | this.editCustomerForm = this.formBuilder.group({ 58 | companyName: [''], 59 | findeks:["",Validators.required] 60 | }); 61 | } 62 | 63 | getUser() { 64 | if (this.user) { 65 | this.userService.getUserById(this.user.id).subscribe( 66 | (response) => { 67 | 68 | this.user = response.data; 69 | this.editProfileForm.setValue({ 70 | firstName: this.user.firstName, 71 | lastName: this.user.lastName, 72 | email: this.user.email, 73 | password: '', 74 | }); 75 | }, 76 | (responseError) => { 77 | this.toastrService.error(responseError.error); 78 | } 79 | ); 80 | } 81 | } 82 | 83 | 84 | updateProfil() { 85 | if (this.editProfileForm.valid) { 86 | let profileModel = Object.assign({}, this.editProfileForm.value); 87 | profileModel.id = this.user.id; 88 | this.userService.update(profileModel).subscribe( 89 | (response) => { 90 | this.toastrService.success(response.message); 91 | this.router.navigate(['/cars']); 92 | }, 93 | (responseError) => { 94 | this.toastrService.error(responseError.error); 95 | } 96 | ); 97 | } else { 98 | this.toastrService.error('Hata'); 99 | } 100 | } 101 | logOut() { 102 | this.localStorageService.clean(); 103 | this.router.navigate(['/cars']); 104 | } 105 | 106 | getCustomer() { 107 | this.customerService.getCustomerByUserId(this.user.id).subscribe( 108 | (response) => { 109 | console.log(response) 110 | this.customer = response.data; 111 | 112 | this.editCustomerForm.get("companyName")?.setValue(response.data.companyName) 113 | this.editCustomerForm.get("findeks")?.setValue(response.data.findeks) 114 | 115 | }, 116 | (responseError) => { 117 | //this.toastrService.error(responseError.error); 118 | } 119 | ); 120 | } 121 | userCustomerCheck(){ 122 | if (this.customer==null) { 123 | return false 124 | } else { 125 | return true 126 | } 127 | } 128 | 129 | 130 | updateCustomer() { 131 | if (this.editCustomerForm.valid) { 132 | let customerModel = Object.assign({}, this.editCustomerForm.value); 133 | 134 | customerModel.findeks=this.customer.findeks; 135 | customerModel.companyName=this.customer.companyName; 136 | this.customerService.update(customerModel).subscribe( 137 | (response) => { 138 | this.toastrService.success(response.message); 139 | this.router.navigate(['/cars']); 140 | }, 141 | (responseError) => { 142 | this.toastrService.error(responseError.error); 143 | } 144 | ); 145 | } else { 146 | this.toastrService.error('Hata'); 147 | } 148 | } 149 | refresh(){ 150 | window.location.reload(); 151 | } 152 | 153 | 154 | } 155 | -------------------------------------------------------------------------------- /src/app/guards/login.guard.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginGuard } from './login.guard'; 4 | 5 | describe('LoginGuard', () => { 6 | let guard: LoginGuard; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | guard = TestBed.inject(LoginGuard); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(guard).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /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/auth.service'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class LoginGuard implements CanActivate { 11 | 12 | constructor( 13 | private authService:AuthService, 14 | private toastrService:ToastrService, 15 | private router:Router 16 | ){ 17 | 18 | } 19 | canActivate( 20 | route: ActivatedRouteSnapshot, 21 | state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { 22 | if(this.authService.isAuthenticated()){ 23 | return true; 24 | } 25 | else{ 26 | this.router.navigate(["login"]) 27 | this.toastrService.info("Sisteme giriş yapmalısınız.") 28 | return false; 29 | } 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/app/models/Auth/loginModel.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface LoginModel{ 3 | email:string; 4 | password:string; 5 | } -------------------------------------------------------------------------------- /src/app/models/Auth/registerModel.ts: -------------------------------------------------------------------------------- 1 | export interface RegisterModel{ 2 | email:string; 3 | password:string; 4 | firstName:string; 5 | lastName:string; 6 | } -------------------------------------------------------------------------------- /src/app/models/Auth/tokenModel.ts: -------------------------------------------------------------------------------- 1 | export interface TokenModel{ 2 | token:string; 3 | expiration:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/Brand/brand.ts: -------------------------------------------------------------------------------- 1 | export interface Brand{ 2 | brandId?:number; 3 | brandName:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/Car/car.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface Car{ 3 | id?:number; 4 | brandId:number; 5 | colorId:number; 6 | modelYear:number; 7 | dailyPrice:number; 8 | description:string; 9 | findeks:number; 10 | } -------------------------------------------------------------------------------- /src/app/models/Car/carDto.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface CarDto{ 3 | id:number; 4 | brandName:string; 5 | colorName:string; 6 | modelYear:number; 7 | dailyPrice:number; 8 | description:string; 9 | findeks:number; 10 | imagePath:string; 11 | } -------------------------------------------------------------------------------- /src/app/models/CarImage/carImage.ts: -------------------------------------------------------------------------------- 1 | export interface CarImage{ 2 | id?:number; 3 | carId:number; 4 | imagePath:string; 5 | dateTime:Date; 6 | } -------------------------------------------------------------------------------- /src/app/models/Claim/claim.ts: -------------------------------------------------------------------------------- 1 | export interface Claim{ 2 | id:number, 3 | name:string 4 | } -------------------------------------------------------------------------------- /src/app/models/Color/color.ts: -------------------------------------------------------------------------------- 1 | export interface Color{ 2 | colorId?:number; 3 | colorName:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/Customer/customer.ts: -------------------------------------------------------------------------------- 1 | export interface Customer { 2 | customerId?: number; 3 | userId: number; 4 | companyName: string; 5 | findeks:number; 6 | } -------------------------------------------------------------------------------- /src/app/models/Customer/customerDto.ts: -------------------------------------------------------------------------------- 1 | export interface CustomerDto{ 2 | id?:number; 3 | firstName:string; 4 | lastName:string; 5 | companyName:string; 6 | findeks:number; 7 | } -------------------------------------------------------------------------------- /src/app/models/Payment/payment.ts: -------------------------------------------------------------------------------- 1 | export interface Payment{ 2 | id?:number; 3 | carId:number; 4 | cardNameSurname?:string; 5 | cardNumber?:string; 6 | cardExpiryDate?:string; 7 | cardCvv?: string; 8 | totalPaye:number; 9 | } -------------------------------------------------------------------------------- /src/app/models/Rental/rental.ts: -------------------------------------------------------------------------------- 1 | export interface Rental{ 2 | id?:number; 3 | carId:number; 4 | customerId:number; 5 | rentDate:Date; 6 | estReturnDate?:Date; 7 | returnDate?:Date; 8 | } -------------------------------------------------------------------------------- /src/app/models/Rental/rentalDto.ts: -------------------------------------------------------------------------------- 1 | export interface RentalDto{ 2 | id:number; 3 | carId:number; 4 | modelYear:number; 5 | brandName:string; 6 | description:string; 7 | dailyPrice:number; 8 | firstName:string; 9 | lastName:string; 10 | companyName:string; 11 | rentDate:Date; 12 | estReturnDate?:Date; 13 | returnDate?:Date; 14 | totalPaye:number; 15 | cardNameSurname:string; 16 | cardNumber:string; 17 | cardExpiryDate:string; 18 | cardCvv:string; 19 | } -------------------------------------------------------------------------------- /src/app/models/User/user.ts: -------------------------------------------------------------------------------- 1 | export interface User{ 2 | id:number; 3 | firstName:string; 4 | lastName:string; 5 | email:string; 6 | password:string; 7 | status:boolean; 8 | } -------------------------------------------------------------------------------- /src/app/models/listResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./responseModel"; 2 | 3 | export interface ListResponseModel extends ResponseModel{ 4 | data:T[]; 5 | } -------------------------------------------------------------------------------- /src/app/models/responseModel.ts: -------------------------------------------------------------------------------- 1 | export interface ResponseModel{ 2 | success:boolean, 3 | message:string 4 | } -------------------------------------------------------------------------------- /src/app/models/singleResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./responseModel"; 2 | 3 | export interface SingleResponseModel extends ResponseModel{ 4 | data:T; 5 | } -------------------------------------------------------------------------------- /src/app/pipes/filter-pipe.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { CarDto } from '../models/Car/carDto'; 3 | 4 | @Pipe({ 5 | name: 'filterPipe' 6 | }) 7 | export class FilterPipePipe implements PipeTransform { 8 | 9 | transform(value: CarDto[], filterText:string): CarDto[] { 10 | filterText = filterText? filterText.toLocaleLowerCase() : ""; 11 | 12 | return filterText? value.filter((c:CarDto)=> 13 | c.brandName.toLocaleLowerCase().indexOf(filterText)!==-1 || 14 | c.description.toLocaleLowerCase().indexOf(filterText)!==-1 || 15 | c.colorName.toLocaleLowerCase().indexOf(filterText)!==-1 ):value; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/app/pipes/vat-added.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({ 4 | name: 'vatAdded' 5 | }) 6 | export class VatAddedPipe implements PipeTransform { 7 | 8 | transform(value: number, rate:number): number { 9 | return value+(value*rate/100); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/app/services/Auth/auth.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthService } from './auth.service'; 4 | 5 | describe('AuthService', () => { 6 | let service: AuthService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(AuthService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/Auth/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { LoginModel } from 'src/app/models/Auth/loginModel'; 5 | import { RegisterModel } from 'src/app/models/Auth/registerModel'; 6 | import { TokenModel } from 'src/app/models/Auth/tokenModel'; 7 | import { JwtHelperService } from '@auth0/angular-jwt'; 8 | import { SingleResponseModel } from 'src/app/models/singleResponseModel'; 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class AuthService { 14 | 15 | jwtHelper: JwtHelperService =new JwtHelperService(); 16 | apiUrl = "https://localhost:44316/api/" 17 | 18 | constructor(private httpClient:HttpClient) { } 19 | 20 | login(loginModel:LoginModel){ 21 | return this.httpClient.post>(this.apiUrl+"auth/login",loginModel); 22 | } 23 | 24 | isAuthenticated(){ 25 | if(localStorage.getItem("token")){ 26 | return true; 27 | } 28 | else{ 29 | return false; 30 | } 31 | } 32 | 33 | register(registerModel:RegisterModel){ 34 | return this.httpClient.post>(this.apiUrl+"auth/register",registerModel); 35 | } 36 | 37 | 38 | getUserName(){ 39 | return this.jwtHelper.decodeToken(localStorage.getItem("token")?.toString())["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"]; 40 | } 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/app/services/Brand/brand.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandService } from './brand.service'; 4 | 5 | describe('BrandService', () => { 6 | let service: BrandService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(BrandService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/Brand/brand.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { from, Observable } from 'rxjs'; 4 | import { Brand } from 'src/app/models/Brand/brand'; 5 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 6 | import { ResponseModel } from 'src/app/models/responseModel'; 7 | import { SingleResponseModel } from 'src/app/models/singleResponseModel'; 8 | 9 | 10 | 11 | 12 | @Injectable({ 13 | providedIn: 'root' 14 | }) 15 | export class BrandService { 16 | 17 | apiUrl = "https://localhost:44316/api/" 18 | constructor(private httpClient:HttpClient) { } 19 | 20 | getBrands():Observable>{ 21 | let newPath:string=this.apiUrl+"brands/getall" 22 | return this.httpClient.get>(newPath); 23 | } 24 | 25 | getBrandById(brandId:number):Observable>{ 26 | let newPath:string=this.apiUrl+"brands/getbybrandid?brandId="+brandId; 27 | return this.httpClient.get>(newPath); 28 | } 29 | 30 | add(brand:Brand):Observable{ 31 | let newPath:string = this.apiUrl+"brands/add" 32 | return this.httpClient.post(newPath,brand); 33 | } 34 | 35 | update(brand:Brand):Observable{ 36 | let newPath:string = this.apiUrl+"brands/update" 37 | return this.httpClient.post(newPath,brand); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/app/services/Car/car.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { CarService } from './car.service'; 4 | 5 | describe('CarService', () => { 6 | let service: CarService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(CarService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/Car/car.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Car } from 'src/app/models/Car/car'; 5 | import { CarDto } from 'src/app/models/Car/carDto'; 6 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 7 | import { ResponseModel } from 'src/app/models/responseModel'; 8 | import { SingleResponseModel } from 'src/app/models/singleResponseModel'; 9 | 10 | 11 | @Injectable({ 12 | providedIn: 'root' 13 | }) 14 | export class CarService { 15 | 16 | apiUrl = 'https://localhost:44316/api/'; 17 | constructor(private httpClient: HttpClient) { } 18 | 19 | getCars() :Observable>{ 20 | let newPath:string=this.apiUrl+"cars/getcardetails" 21 | return this.httpClient.get>(newPath) 22 | } 23 | 24 | getCarsById(id:number):Observable>{ 25 | let newPath:string=this.apiUrl+"cars/get?carId="+id 26 | return this.httpClient.get>(newPath) 27 | } 28 | 29 | getCarsByBrandId(brandId:number):Observable>{ 30 | let newPath:string=this.apiUrl+"cars/getcardetailsbybrandid?brandId="+brandId 31 | return this.httpClient.get>(newPath) 32 | } 33 | 34 | getCarsByColorId(colorId:number):Observable>{ 35 | let newPath:string=this.apiUrl+"cars/getcardetailsbycolorid?colorId="+colorId 36 | return this.httpClient.get>(newPath) 37 | } 38 | 39 | getCarsByBrandIdandColorId(brandId:number, colorId:number):Observable>{ 40 | let newPath=this.apiUrl+"cars/getbybrandidandcolorid?brandId="+brandId+"&colorId="+colorId 41 | return this.httpClient.get>(newPath) 42 | } 43 | 44 | add(car: Car):Observable{ 45 | let newPath = this.apiUrl + "cars/add"; 46 | return this.httpClient.post(newPath,car); 47 | } 48 | 49 | update(car: Car):Observable{ 50 | let newPath = this.apiUrl + "cars/update"; 51 | return this.httpClient.post(newPath,car); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/app/services/CarDetail/car-detail-by-id.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { CarDetailByIdService } from './car-detail-by-id.service'; 4 | 5 | describe('CarDetailByIdService', () => { 6 | let service: CarDetailByIdService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(CarDetailByIdService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/CarDetail/car-detail-by-id.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { CarDto } from 'src/app/models/Car/carDto'; 5 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class CarDetailByIdService { 11 | 12 | 13 | apiUrl="https://localhost:44316/api/" 14 | constructor(private httpClient:HttpClient) { } 15 | 16 | getCarDetailById(carId:number):Observable>{ 17 | let newPath=this.apiUrl+"cars/getcardetailsbyid?carId="+carId 18 | return this.httpClient.get>(newPath) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/app/services/CarImage/car-images-by-id.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { CarImagesByIdService } from './car-images-by-id.service'; 4 | 5 | describe('CarImagesByIdService', () => { 6 | let service: CarImagesByIdService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(CarImagesByIdService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/CarImage/car-images-by-id.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { CarImage } from 'src/app/models/CarImage/carImage'; 5 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class CarImagesByIdService { 11 | 12 | apiUrl="https://localhost:44316/api/" 13 | constructor(private httpClient:HttpClient) { } 14 | 15 | getCarImagesById(id:number):Observable>{ 16 | let newPath=this.apiUrl+"carImages/getallimagebycarid?id="+id 17 | return this.httpClient.get>(newPath) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/app/services/Color/color.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorService } from './color.service'; 4 | 5 | describe('ColorService', () => { 6 | let service: ColorService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(ColorService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/Color/color.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Color } from 'src/app/models/Color/color'; 5 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 6 | import { ResponseModel } from 'src/app/models/responseModel'; 7 | import { SingleResponseModel } from 'src/app/models/singleResponseModel'; 8 | 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class ColorService { 14 | 15 | apiUrl="https://localhost:44316/api/" 16 | constructor(private httpClient:HttpClient) { } 17 | 18 | getColors():Observable>{ 19 | let newPath:string=this.apiUrl+"colors/getall" 20 | return this.httpClient.get>(newPath); 21 | } 22 | 23 | getColorById(colorId:number):Observable>{ 24 | let newPath:string=this.apiUrl+"colors/getbycolorid?colorId="+colorId; 25 | return this.httpClient.get>(newPath); 26 | } 27 | 28 | add(color:Color):Observable{ 29 | let newPath:string = this.apiUrl+"colors/add" 30 | return this.httpClient.post(newPath,color); 31 | } 32 | 33 | update(color:Color):Observable{ 34 | let newPath:string = this.apiUrl+"colors/update" 35 | return this.httpClient.post(newPath,color); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/app/services/Customer/customer.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { CustomerService } from './customer.service'; 4 | 5 | describe('CustomerService', () => { 6 | let service: CustomerService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(CustomerService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/Customer/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 'src/app/models/Customer/customer'; 5 | import { CustomerDto } from 'src/app/models/Customer/customerDto'; 6 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 7 | import { ResponseModel } from 'src/app/models/responseModel'; 8 | import { SingleResponseModel } from 'src/app/models/singleResponseModel'; 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class CustomerService { 14 | 15 | apiUrl="https://localhost:44316/api/" 16 | constructor(private httpClient:HttpClient) { } 17 | 18 | getCustomers():Observable>{ 19 | let newPath:string=this.apiUrl+"customers/getcustomerdetails" 20 | return this.httpClient.get>(newPath); 21 | } 22 | 23 | getCustomerById(id:number):Observable>{ 24 | let newPath:string=this.apiUrl+"customers/getcustomerdetailsbyid?customerId="+id; 25 | return this.httpClient.get>(newPath); 26 | } 27 | 28 | update(customer:CustomerDto):Observable{ 29 | let newPath:string = this.apiUrl+"customers/update" 30 | return this.httpClient.post(newPath,customer); 31 | } 32 | 33 | getCustomerDetailByUserId(userId:number):Observable>{ 34 | let newPath =this.apiUrl+"customers/getcustomerdetailsbyuserid?userId="+userId 35 | return this.httpClient.get>(newPath) 36 | } 37 | 38 | getCustomerByUserId(userId:number):Observable>{ 39 | let newPath =this.apiUrl+"customers/getcustomerbyuserid?userId="+userId 40 | return this.httpClient.get>(newPath) 41 | } 42 | 43 | add(customer:Customer):Observable{ 44 | let newPath= this.apiUrl + "customers/add" 45 | return this.httpClient.post(newPath,customer) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/app/services/LocalStorage/localstorage.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { LocalStorageService } from './localstorage.service'; 3 | 4 | 5 | describe('LocalstorageService', () => { 6 | let service: LocalStorageService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(LocalStorageService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/LocalStorage/localstorage.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { CarDto } from 'src/app/models/Car/carDto'; 3 | import { Customer } from 'src/app/models/Customer/customer'; 4 | import { User } from 'src/app/models/User/user'; 5 | 6 | @Injectable({ 7 | providedIn: 'root', 8 | }) 9 | export class LocalStorageService { 10 | customer: string = 'customer'; 11 | user: string = 'user'; 12 | car:string="car" 13 | 14 | constructor() {} 15 | 16 | setItem(key: string, object: any) { 17 | localStorage.setItem(key, JSON.stringify(object)); 18 | } 19 | getItem(key: string) { 20 | return JSON.parse(localStorage.getItem(key)!); 21 | } 22 | 23 | remove(key: string) { 24 | localStorage.removeItem(key); 25 | } 26 | clean() { 27 | localStorage.clear(); 28 | } 29 | getUser(): User { 30 | return JSON.parse(localStorage.getItem(this.user)!); 31 | } 32 | getCustomer(): Customer { 33 | return JSON.parse(localStorage.getItem(this.customer)!); 34 | } 35 | getCar():CarDto{ 36 | return JSON.parse(localStorage.getItem(this.car)!) 37 | } 38 | } -------------------------------------------------------------------------------- /src/app/services/Payment/payment.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { PaymentService } from './payment.service'; 4 | 5 | describe('PaymentService', () => { 6 | let service: PaymentService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(PaymentService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/Payment/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 'src/app/models/listResponseModel'; 5 | import { Payment } from 'src/app/models/Payment/payment'; 6 | import { Rental } from 'src/app/models/Rental/rental'; 7 | import { ResponseModel } from 'src/app/models/responseModel'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class PaymentService { 13 | 14 | rentalCar:Rental; 15 | totalPaye:number; 16 | 17 | apiUrl="https://localhost:44316/api/" 18 | constructor(private httpClient:HttpClient) { } 19 | 20 | 21 | getPayments():Observable>{ 22 | let newPath= this.apiUrl + "payments/getall" 23 | return this.httpClient.get>(newPath); 24 | } 25 | 26 | getPaymentById(id:number):Observable>{ 27 | let newPath= this.apiUrl + "payments/getbypaymentid?id=" + id; 28 | return this.httpClient.get>(newPath); 29 | } 30 | 31 | addPayment(payment: Payment):Observable{ 32 | let newPath= this.apiUrl + "payments/add" 33 | return this.httpClient.post(newPath,payment); 34 | } 35 | 36 | getRental(){ 37 | return this.rentalCar; 38 | } 39 | 40 | getRentalTotalPaye(){ 41 | return this.totalPaye; 42 | } 43 | 44 | setRentalCar(rental:Rental, totalRentalPaye:number){ 45 | this.rentalCar=rental; 46 | this.totalPaye=totalRentalPaye; 47 | } 48 | } 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/app/services/Rental/rental.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { RentalService } from './rental.service'; 4 | 5 | describe('RentalService', () => { 6 | let service: RentalService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(RentalService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/Rental/rental.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from 'src/app/models/listResponseModel'; 5 | import { Rental } from 'src/app/models/Rental/rental'; 6 | import { RentalDto } from 'src/app/models/Rental/rentalDto'; 7 | import { ResponseModel } from 'src/app/models/responseModel'; 8 | 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class RentalService { 14 | 15 | apiUrl="https://localhost:44316/api/" 16 | constructor(private httpClient:HttpClient) { } 17 | 18 | getRentals():Observable>{ 19 | let newPath:string=this.apiUrl+"rentals/getrentaldetails" 20 | return this.httpClient.get>(newPath); 21 | } 22 | 23 | addRental(rental:Rental):Observable{ 24 | let newPath:string = this.apiUrl+"rentals/rent"; 25 | return this.httpClient.post(newPath,rental); 26 | } 27 | getRentalsByCarId(carId:number):Observable> 28 | { 29 | let newPath=this.apiUrl+"rentals/getrentaldetailsbycarid?carId="+carId; 30 | return this.httpClient.get>(newPath); 31 | } 32 | 33 | checkCarStatus(rental:Rental):Observable { 34 | let newPath = this.apiUrl + "rentals/checkcarstatus"; 35 | return this.httpClient.post(newPath,rental); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/app/services/User/user.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { UserService } from './user.service'; 4 | 5 | describe('UserService', () => { 6 | let service: UserService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(UserService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/services/User/user.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { TokenModel } from 'src/app/models/Auth/tokenModel'; 5 | import { Claim } from 'src/app/models/Claim/claim'; 6 | import { SingleResponseModel } from 'src/app/models/singleResponseModel'; 7 | import { User } from 'src/app/models/User/user'; 8 | 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class UserService { 14 | apiUrl = "https://localhost:44316/api/users/" 15 | 16 | constructor(private httpClient:HttpClient) { } 17 | 18 | 19 | update(userUpdateModel: User): Observable> { 20 | let newPath = this.apiUrl + 'edit'; 21 | return this.httpClient.post>(newPath, userUpdateModel); 22 | } 23 | 24 | getUserById(userId: number): Observable> { 25 | let newPath = this.apiUrl+'getbyuserid?userId='+userId; 26 | return this.httpClient.get>(newPath); 27 | } 28 | 29 | 30 | getByEmail(email:string):Observable>{ 31 | let newPath = this.apiUrl+'getbyemail?email='+email; 32 | return this.httpClient.get>(newPath); 33 | } 34 | 35 | getClaimById(userId:number):Observable>{ 36 | let newPath = this.apiUrl+'getclaimsbyuserid?userId='+userId; 37 | return this.httpClient.get>(newPath); 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/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/GizemErgin/ReCapProject-Frontend/3eb283d54741c5e62f2bc1155ceed47d5c28d7e1/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ReCapProject Car Rental 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 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "sourceMap": true, 13 | "declaration": false, 14 | "downlevelIteration": true, 15 | "experimentalDecorators": true, 16 | "moduleResolution": "node", 17 | "importHelpers": true, 18 | "target": "es2015", 19 | "module": "es2020", 20 | "lib": [ 21 | "es2018", 22 | "dom" 23 | ] 24 | }, 25 | "angularCompilerOptions": { 26 | "enableI18nLegacyMessageIdFormat": false, 27 | "strictInjectionParameters": true, 28 | "strictInputAccessModifiers": true, 29 | "strictTemplates": true 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------