├── .browserslistrc ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── docs └── 5.0 │ └── assets │ └── brand │ └── bootstrap-logo.svg ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── img └── logo.png ├── karma.conf.js ├── package-lock.json ├── package.json ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.css │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── components │ │ ├── brand │ │ │ ├── brand-add │ │ │ │ ├── brand-add.component.css │ │ │ │ ├── brand-add.component.html │ │ │ │ ├── brand-add.component.spec.ts │ │ │ │ └── brand-add.component.ts │ │ │ ├── brand-list │ │ │ │ ├── brand-list.component.css │ │ │ │ ├── brand-list.component.html │ │ │ │ ├── brand-list.component.spec.ts │ │ │ │ └── brand-list.component.ts │ │ │ ├── brand-update │ │ │ │ ├── brand-update.component.css │ │ │ │ ├── brand-update.component.html │ │ │ │ ├── brand-update.component.spec.ts │ │ │ │ └── brand-update.component.ts │ │ │ ├── brand.component.css │ │ │ ├── brand.component.html │ │ │ ├── brand.component.spec.ts │ │ │ └── brand.component.ts │ │ ├── car-add │ │ │ ├── car-add.component.css │ │ │ ├── car-add.component.html │ │ │ ├── car-add.component.spec.ts │ │ │ └── car-add.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 │ │ │ │ ├── car-update.component.css │ │ │ │ ├── car-update.component.html │ │ │ │ ├── car-update.component.spec.ts │ │ │ │ └── car-update.component.ts │ │ ├── car │ │ │ ├── car-detail │ │ │ │ ├── car-detail.component.css │ │ │ │ ├── car-detail.component.html │ │ │ │ ├── car-detail.component.spec.ts │ │ │ │ └── car-detail.component.ts │ │ │ ├── car.component.css │ │ │ ├── car.component.html │ │ │ ├── car.component.spec.ts │ │ │ └── car.component.ts │ │ ├── carimage │ │ │ ├── carimage.component.css │ │ │ ├── carimage.component.html │ │ │ ├── carimage.component.spec.ts │ │ │ └── carimage.component.ts │ │ ├── color │ │ │ ├── color-add │ │ │ │ ├── color-add.component.css │ │ │ │ ├── color-add.component.html │ │ │ │ ├── color-add.component.spec.ts │ │ │ │ └── color-add.component.ts │ │ │ ├── color-list │ │ │ │ ├── color-list.component.css │ │ │ │ ├── color-list.component.html │ │ │ │ ├── color-list.component.spec.ts │ │ │ │ └── color-list.component.ts │ │ │ ├── color-update │ │ │ │ ├── color-update.component.css │ │ │ │ ├── color-update.component.html │ │ │ │ ├── color-update.component.spec.ts │ │ │ │ └── color-update.component.ts │ │ │ ├── color.component.css │ │ │ ├── color.component.html │ │ │ ├── color.component.spec.ts │ │ │ └── color.component.ts │ │ ├── customer │ │ │ ├── customer.component.css │ │ │ ├── customer.component.html │ │ │ ├── customer.component.spec.ts │ │ │ └── customer.component.ts │ │ ├── filter │ │ │ ├── filter.component.css │ │ │ ├── filter.component.html │ │ │ ├── filter.component.spec.ts │ │ │ └── filter.component.ts │ │ ├── footer │ │ │ ├── footer.component.css │ │ │ ├── footer.component.html │ │ │ ├── footer.component.spec.ts │ │ │ └── footer.component.ts │ │ ├── login │ │ │ ├── login.component.css │ │ │ ├── login.component.html │ │ │ ├── login.component.spec.ts │ │ │ └── login.component.ts │ │ ├── navi │ │ │ ├── navi.component.css │ │ │ ├── navi.component.html │ │ │ ├── navi.component.spec.ts │ │ │ └── navi.component.ts │ │ ├── payment │ │ │ ├── payment.component.css │ │ │ ├── payment.component.html │ │ │ ├── payment.component.spec.ts │ │ │ └── payment.component.ts │ │ ├── register │ │ │ ├── register.component.css │ │ │ ├── register.component.html │ │ │ ├── register.component.spec.ts │ │ │ └── register.component.ts │ │ ├── rental-add │ │ │ ├── rental-add.component.css │ │ │ ├── rental-add.component.html │ │ │ ├── rental-add.component.spec.ts │ │ │ └── rental-add.component.ts │ │ ├── rental │ │ │ ├── rental.component.css │ │ │ ├── rental.component.html │ │ │ ├── rental.component.spec.ts │ │ │ └── rental.component.ts │ │ └── user │ │ │ ├── user.component.css │ │ │ ├── user.component.html │ │ │ ├── user.component.spec.ts │ │ │ └── user.component.ts │ ├── guards │ │ ├── login.guard.spec.ts │ │ └── login.guard.ts │ ├── interceptors │ │ ├── auth.interceptor.spec.ts │ │ └── auth.interceptor.ts │ ├── models │ │ ├── ResponseModel.ts │ │ ├── brand.ts │ │ ├── car.ts │ │ ├── carImage.ts │ │ ├── card.ts │ │ ├── color.ts │ │ ├── customer.ts │ │ ├── itemResponseModel.ts │ │ ├── listResponseModel.ts │ │ ├── loginModel.ts │ │ ├── payment.ts │ │ ├── register.ts │ │ ├── rental.ts │ │ ├── singleResponseModel.ts │ │ ├── tokenModel.ts │ │ └── user.ts │ ├── pipes │ │ ├── brand-filter.pipe.ts │ │ ├── color-filter.pipe.ts │ │ ├── filter-pipe.pipe.ts │ │ ├── vat-added.pipe.ts │ │ ├── vat-moon.pipe.ts │ │ └── vat-week.pipe.ts │ └── services │ │ ├── auth.service.ts │ │ ├── brand.service.ts │ │ ├── car.service.ts │ │ ├── carimage.service.ts │ │ ├── color.service.ts │ │ ├── customer.service.ts │ │ ├── local-storage.service.ts │ │ ├── payment.service.ts │ │ ├── rental.service.ts │ │ └── user.service.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Rental Car Project - Samet Akca / @SMTcoder
3 | YouTube Videosu : https://www.youtube.com/watch?v=_xrnKaRDrEA 4 | 5 | Kullanılan Teknolojiler (Front-End) : 6 | Paketler : 7 | • TypScript • Angular 11.2.5 • Angular CLI 11.2.4 • Bootstrap 5.0.0-beta2 • JQuery 3.6.0 • Toastr 2.1.4 • @auth0/angular-jwt (Decode Token) 5.0.2 • bootswatch 4.6.0 • font-awesome 4.7.0 8 | 9 | Teknikler : 10 | • Custom Form Control • Custom Pipe • Custom Directive • QueryParams • Guards • LocalStorage Service 11 | 12 | Görseller 13 | 14 | ![bandicam 2021-04-11 23-40-44-659](https://user-images.githubusercontent.com/74311713/114325781-882d2300-9b3a-11eb-897a-412dc88e3d32.jpg) 15 | ![01](https://user-images.githubusercontent.com/74311713/114325802-99762f80-9b3a-11eb-98be-2536cbd0d47a.png)![bandicam 2021-04-11 23-39-35-397](https://user-images.githubusercontent.com/74311713/114325818-a8f57880-9b3a-11eb-8ba7-9b1bf1652151.jpg) 16 | ![bandicam 2021-04-11 23-39-41-570](https://user-images.githubusercontent.com/74311713/114325821-ae52c300-9b3a-11eb-8b76-11f51cfe891a.jpg) 17 | ![bandicam 2021-04-11 23-39-49-386](https://user-images.githubusercontent.com/74311713/114325823-b01c8680-9b3a-11eb-9c82-0145036e343f.jpg) 18 | ![bandicam 2021-04-11 23-41-05-274](https://user-images.githubusercontent.com/74311713/114325825-b6aafe00-9b3a-11eb-8ec8-d373e1f10861.jpg) 19 | ![bandicam 2021-04-11 23-41-28-548](https://user-images.githubusercontent.com/74311713/114325826-b7dc2b00-9b3a-11eb-9baa-5ea11ad3d546.jpg) 20 | ![bandicam 2021-04-11 23-42-53-658](https://user-images.githubusercontent.com/74311713/114325827-b90d5800-9b3a-11eb-9b1f-e9af274c693a.jpg) 21 | 22 | 23 | ![bandicam 2021-04-11 23-43-09-524](https://user-images.githubusercontent.com/74311713/114325832-be6aa280-9b3a-11eb-93cb-750079a3d9a2.jpg) 24 | ![bandicam 2021-04-11 23-43-13-586](https://user-images.githubusercontent.com/74311713/114325834-c0346600-9b3a-11eb-8934-d3edfe221a0e.jpg) 25 | ![bandicam 2021-04-11 23-43-29-322](https://user-images.githubusercontent.com/74311713/114325838-c1fe2980-9b3a-11eb-86a9-6c9cc6fdbde5.jpg) 26 | ![bandicam 2021-04-11 23-43-30-845](https://user-images.githubusercontent.com/74311713/114325840-c3c7ed00-9b3a-11eb-801a-0d0cfce577e9.jpg) 27 | ![bandicam 2021-04-11 23-43-57-843](https://user-images.githubusercontent.com/74311713/114325842-c4f91a00-9b3a-11eb-8bed-32660505e949.jpg) 28 | ![bandicam 2021-04-11 23-44-00-364](https://user-images.githubusercontent.com/74311713/114325844-c591b080-9b3a-11eb-81c1-b05825b62517.jpg) 29 | ![bandicam 2021-04-11 23-48-25-301](https://user-images.githubusercontent.com/74311713/114325847-c6c2dd80-9b3a-11eb-9362-a4bae0092186.jpg) 30 | ![bandicam 2021-04-11 23-49-40-661](https://user-images.githubusercontent.com/74311713/114325848-c7f40a80-9b3a-11eb-88ff-ca34349a64dc.jpg) 31 | ![bandicam 2021-04-11 23-51-38-067](https://user-images.githubusercontent.com/74311713/114325851-c9253780-9b3a-11eb-8b49-3c86fed4ef79.jpg) 32 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "cli": { 4 | "analytics": "fd79cdc1-eaee-4d57-a25e-94bde90aba50" 5 | }, 6 | "version": 1, 7 | "newProjectRoot": "projects", 8 | "projects": { 9 | "ReCar": { 10 | "projectType": "application", 11 | "schematics": { 12 | "@schematics/angular:application": { 13 | "strict": true 14 | } 15 | }, 16 | "root": "", 17 | "sourceRoot": "src", 18 | "prefix": "app", 19 | "architect": { 20 | "build": { 21 | "builder": "@angular-devkit/build-angular:browser", 22 | "options": { 23 | "outputPath": "dist/ReCar", 24 | "index": "src/index.html", 25 | "main": "src/main.ts", 26 | "polyfills": "src/polyfills.ts", 27 | "tsConfig": "tsconfig.app.json", 28 | "aot": true, 29 | "assets": [ 30 | "src/favicon.ico", 31 | "src/assets" 32 | ], 33 | "styles": [ 34 | "./node_modules/bootstrap/dist/css/bootstrap.min.css", 35 | "./node_modules/ngx-toastr/toastr.css", 36 | "src/styles.css" 37 | 38 | ], 39 | "scripts": [ 40 | "./node_modules/jquery/dist/jquery.min.js", 41 | "./node_modules/bootstrap/dist/js/bootstrap.min.js" 42 | 43 | ] 44 | }, 45 | "configurations": { 46 | "production": { 47 | "fileReplacements": [ 48 | { 49 | "replace": "src/environments/environment.ts", 50 | "with": "src/environments/environment.prod.ts" 51 | } 52 | ], 53 | "optimization": true, 54 | "outputHashing": "all", 55 | "sourceMap": false, 56 | "namedChunks": false, 57 | "extractLicenses": true, 58 | "vendorChunk": false, 59 | "buildOptimizer": true, 60 | "budgets": [ 61 | { 62 | "type": "initial", 63 | "maximumWarning": "500kb", 64 | "maximumError": "1mb" 65 | }, 66 | { 67 | "type": "anyComponentStyle", 68 | "maximumWarning": "2kb", 69 | "maximumError": "4kb" 70 | } 71 | ] 72 | } 73 | } 74 | }, 75 | "serve": { 76 | "builder": "@angular-devkit/build-angular:dev-server", 77 | "options": { 78 | "browserTarget": "ReCar:build" 79 | }, 80 | "configurations": { 81 | "production": { 82 | "browserTarget": "ReCar:build:production" 83 | } 84 | } 85 | }, 86 | "extract-i18n": { 87 | "builder": "@angular-devkit/build-angular:extract-i18n", 88 | "options": { 89 | "browserTarget": "ReCar:build" 90 | } 91 | }, 92 | "test": { 93 | "builder": "@angular-devkit/build-angular:karma", 94 | "options": { 95 | "main": "src/test.ts", 96 | "polyfills": "src/polyfills.ts", 97 | "tsConfig": "tsconfig.spec.json", 98 | "karmaConfig": "karma.conf.js", 99 | "assets": [ 100 | "src/favicon.ico", 101 | "src/assets" 102 | ], 103 | "styles": [ 104 | "src/styles.css" 105 | ], 106 | "scripts": [] 107 | } 108 | }, 109 | "lint": { 110 | "builder": "@angular-devkit/build-angular:tslint", 111 | "options": { 112 | "tsConfig": [ 113 | "tsconfig.app.json", 114 | "tsconfig.spec.json", 115 | "e2e/tsconfig.json" 116 | ], 117 | "exclude": [ 118 | "**/node_modules/**" 119 | ] 120 | } 121 | }, 122 | "e2e": { 123 | "builder": "@angular-devkit/build-angular:protractor", 124 | "options": { 125 | "protractorConfig": "e2e/protractor.conf.js", 126 | "devServerTarget": "ReCar:serve" 127 | }, 128 | "configurations": { 129 | "production": { 130 | "devServerTarget": "ReCar:serve:production" 131 | } 132 | } 133 | } 134 | } 135 | } 136 | }, 137 | "defaultProject": "ReCar" 138 | } 139 | -------------------------------------------------------------------------------- /docs/5.0/assets/brand/bootstrap-logo.svg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/docs/5.0/assets/brand/bootstrap-logo.svg -------------------------------------------------------------------------------- /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('ReCar 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 | -------------------------------------------------------------------------------- /img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/img/logo.png -------------------------------------------------------------------------------- /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/ReCar'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "re-car", 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.8", 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 | "angular-jwt": "^0.1.11", 24 | "bootstrap": "^5.0.0-beta2", 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/brand-add/brand-add.component'; 4 | import { BrandListComponent } from './components/brand/brand-list/brand-list.component'; 5 | import { BrandUpdateComponent } from './components/brand/brand-update/brand-update.component'; 6 | import { BrandComponent } from './components/brand/brand.component'; 7 | import { CarAddComponent } from './components/car-add/car-add.component'; 8 | import { CarListComponent } from './components/car-list/car-list.component'; 9 | import { CarUpdateComponent } from './components/car-update/car-update/car-update.component'; 10 | import { CarDetailComponent } from './components/car/car-detail/car-detail.component'; 11 | import { CarComponent } from './components/car/car.component'; 12 | import { ColorAddComponent } from './components/color/color-add/color-add.component'; 13 | import { ColorListComponent } from './components/color/color-list/color-list.component'; 14 | import { ColorUpdateComponent } from './components/color/color-update/color-update.component'; 15 | import { ColorComponent } from './components/color/color.component'; 16 | import { CustomerComponent } from './components/customer/customer.component'; 17 | import { LoginComponent } from './components/login/login.component'; 18 | import { PaymentComponent } from './components/payment/payment.component'; 19 | import { RegisterComponent } from './components/register/register.component'; 20 | import { RentalAddComponent } from './components/rental-add/rental-add.component'; 21 | import { RentalComponent } from './components/rental/rental.component'; 22 | import { LoginGuard } from './guards/login.guard'; 23 | 24 | const routes: Routes = [ 25 | 26 | {path:"",pathMatch:"full",component:CarComponent}, 27 | {path:"cars",component:CarComponent}, 28 | {path:"cars/brand/:brandId", component:CarComponent}, 29 | {path:"cars/color/:colorId", component:CarComponent}, 30 | {path:"cars/detail/:carId",component:CarDetailComponent}, 31 | {path:"rentals/:carId" ,component:RentalAddComponent, canActivate:[LoginGuard]}, 32 | {path:"payments/:carId" , component:PaymentComponent, canActivate:[LoginGuard]}, 33 | {path:"rentals/add" , component:RentalAddComponent , canActivate:[LoginGuard]}, 34 | {path:"rentals",component:RentalComponent, canActivate:[LoginGuard]}, 35 | 36 | {path:"cars/add" , component:CarAddComponent , canActivate:[LoginGuard]}, 37 | {path:"cars/update" , component:CarUpdateComponent, canActivate:[LoginGuard] }, 38 | {path:"cars/update/:carId" , component:CarUpdateComponent, canActivate:[LoginGuard]}, 39 | {path:"cars/list" , component:CarListComponent, canActivate:[LoginGuard]}, 40 | 41 | {path:"colors/add" , component:ColorAddComponent , canActivate:[LoginGuard]}, 42 | {path:"colors/update" , component:ColorUpdateComponent, canActivate:[LoginGuard] }, 43 | {path:"colors/update/:colorId" , component:ColorUpdateComponent, canActivate:[LoginGuard]}, 44 | {path:"colors/list" , component:ColorListComponent, canActivate:[LoginGuard]}, 45 | 46 | {path:"brands/add" , component:BrandAddComponent , canActivate:[LoginGuard]}, 47 | {path:"brands/update" , component:BrandUpdateComponent, canActivate:[LoginGuard] }, 48 | {path:"brands/update/:colorId" , component:BrandUpdateComponent, canActivate:[LoginGuard]}, 49 | {path:"brands/list" , component:BrandListComponent, canActivate:[LoginGuard]}, 50 | 51 | {path:"login" , component:LoginComponent}, 52 | {path:"register" , component:RegisterComponent}, 53 | {path:"payment/:rental" , component:PaymentComponent}, 54 | {path:"brands",component:BrandComponent}, 55 | {path:"colors",component:ColorComponent}, 56 | {path:"customers",component:CustomerComponent}, 57 | 58 | 59 | {path:"cars/filter/:brandId/:colorId",component:CarComponent} 60 | 61 | 62 | ]; 63 | 64 | @NgModule({ 65 | imports: [RouterModule.forRoot(routes)], 66 | exports: [RouterModule] 67 | }) 68 | 69 | export class AppRoutingModule { } 70 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/app.component.css -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 | 7 | 8 |
9 | 10 | 11 | 12 |
13 | 14 | 15 | 19 | 20 |
21 | 22 | 23 |
24 | 25 | 26 |
27 | 28 | 29 |
30 |
31 |
32 |
-------------------------------------------------------------------------------- /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 'ReCar'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('ReCar'); 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('ReCar 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 = 'ReCar'; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { HttpClient, HttpClientModule, HTTP_INTERCEPTORS} from '@angular/common/http' 4 | import { FormsModule , ReactiveFormsModule } from "@angular/forms" 5 | import { BrowserAnimationsModule} from "@angular/platform-browser/animations" 6 | 7 | 8 | import { AppRoutingModule } from './app-routing.module'; 9 | import { AppComponent } from './app.component'; 10 | import { CarComponent } from './components/car/car.component'; 11 | import { BrandComponent } from './components/brand/brand.component'; 12 | import { ColorComponent } from './components/color/color.component'; 13 | import { NaviComponent } from './components/navi/navi.component'; 14 | import { UserComponent } from './components/user/user.component'; 15 | import { CustomerComponent } from './components/customer/customer.component'; 16 | import { RentalComponent } from './components/rental/rental.component'; 17 | import { CarimageComponent } from './components/carimage/carimage.component'; 18 | import { VatAddedPipe } from './pipes/vat-added.pipe'; 19 | import { from } from 'rxjs'; 20 | import { FilterPipePipe } from './pipes/filter-pipe.pipe'; 21 | import { CarDetailComponent } from './components/car/car-detail/car-detail.component'; 22 | import { VatWeekPipe } from './pipes/vat-week.pipe'; 23 | import { VatMoonPipe } from './pipes/vat-moon.pipe'; 24 | 25 | import {ToastrModule, ToastrService} from "ngx-toastr"; 26 | import { FooterComponent } from './components/footer/footer.component'; 27 | import { PaymentComponent } from './components/payment/payment.component'; 28 | import { CarAddComponent } from './components/car-add/car-add.component'; 29 | import { RentalAddComponent } from './components/rental-add/rental-add.component'; 30 | import { LoginComponent } from './components/login/login.component'; 31 | import { RegisterComponent } from './components/register/register.component' 32 | import { AuthInterceptor } from './interceptors/auth.interceptor'; 33 | import { CarUpdateComponent } from './components/car-update/car-update/car-update.component'; 34 | import { CarListComponent } from './components/car-list/car-list.component'; 35 | import { ColorAddComponent } from './components/color/color-add/color-add.component'; 36 | import { ColorListComponent } from './components/color/color-list/color-list.component'; 37 | import { ColorUpdateComponent } from './components/color/color-update/color-update.component'; 38 | import { BrandAddComponent } from './components/brand/brand-add/brand-add.component'; 39 | import { BrandUpdateComponent } from './components/brand/brand-update/brand-update.component'; 40 | import { BrandListComponent } from './components/brand/brand-list/brand-list.component'; 41 | import { FilterComponent } from './components/filter/filter.component'; 42 | 43 | 44 | @NgModule({ 45 | declarations: [ 46 | AppComponent, 47 | CarComponent, 48 | BrandComponent, 49 | ColorComponent, 50 | NaviComponent, 51 | UserComponent, 52 | CustomerComponent, 53 | RentalComponent, 54 | CarimageComponent, 55 | VatAddedPipe, 56 | FilterPipePipe, 57 | CarDetailComponent, 58 | VatWeekPipe, 59 | VatMoonPipe, 60 | FooterComponent, 61 | PaymentComponent, 62 | CarAddComponent, 63 | RentalAddComponent, 64 | LoginComponent, 65 | RegisterComponent, 66 | CarUpdateComponent, 67 | CarListComponent, 68 | ColorAddComponent, 69 | ColorListComponent, 70 | ColorUpdateComponent, 71 | BrandAddComponent, 72 | BrandUpdateComponent, 73 | BrandListComponent, 74 | FilterComponent, 75 | 76 | 77 | ], 78 | imports: [ 79 | BrowserModule, 80 | AppRoutingModule, 81 | HttpClientModule, 82 | FormsModule, 83 | BrowserAnimationsModule, 84 | ReactiveFormsModule, 85 | ToastrModule.forRoot({ 86 | positionClass:"toast-top-right" 87 | }) 88 | 89 | ], 90 | providers: [ 91 | {provide:HTTP_INTERCEPTORS, useClass:AuthInterceptor, multi:true} 92 | ], 93 | bootstrap: [AppComponent] 94 | }) 95 | export class AppModule { } 96 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-add/brand-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/brand/brand-add/brand-add.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand-add/brand-add.component.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |
5 |


6 | 7 |
8 |
9 |
10 |
11 |
12 | Marka Ekle 13 |
14 |
15 |
16 |
17 |
18 | 19 |
20 | 23 |
24 |
25 |
26 |
27 | 30 |
31 |
32 | 33 |
-------------------------------------------------------------------------------- /src/app/components/brand/brand-add/brand-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandAddComponent } from './brand-add.component'; 4 | 5 | describe('BrandAddComponent', () => { 6 | let component: BrandAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-add/brand-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { brandService } from 'src/app/services/brand.service'; 5 | 6 | @Component({ 7 | selector: 'app-brand-add', 8 | templateUrl: './brand-add.component.html', 9 | styleUrls: ['./brand-add.component.css'] 10 | }) 11 | export class BrandAddComponent implements OnInit { 12 | 13 | brandAddForm : FormGroup; 14 | 15 | constructor(private formBuilder : FormBuilder, 16 | private brandService : brandService, 17 | private toastrService : ToastrService 18 | ) { } 19 | 20 | ngOnInit(): void { 21 | this.createBrandAddForm(); 22 | } 23 | createBrandAddForm(){ 24 | this.brandAddForm = this.formBuilder.group({ 25 | brandName : ["",Validators.required] 26 | }) 27 | } 28 | 29 | add(){ 30 | if(this.brandAddForm.valid){ 31 | let brandModel = Object.assign({},this.brandAddForm.value) 32 | this.brandService.add(brandModel).subscribe(response => { 33 | this.toastrService.success("Başarılı" , "Eklendi") 34 | },responseError => { 35 | if(responseError.error.Errors.length > 0){ 36 | for(let i =0; i
4 | 5 |
6 |


7 | 8 | 9 |

Marka Listesi Listesi

10 |

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 28 | 29 | 32 | 33 | 34 |

Markalar

Güncelle

Sil

{{ brand.brandName }}

25 | 26 | 27 | 30 | 31 |
-------------------------------------------------------------------------------- /src/app/components/brand/brand-list/brand-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandListComponent } from './brand-list.component'; 4 | 5 | describe('BrandListComponent', () => { 6 | let component: BrandListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-list/brand-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ToastrService } from 'ngx-toastr'; 3 | import { Brand } from 'src/app/models/brand'; 4 | import { brandService } from 'src/app/services/brand.service'; 5 | @Component({ 6 | selector: 'app-brand-list', 7 | templateUrl: './brand-list.component.html', 8 | styleUrls: ['./brand-list.component.css'] 9 | }) 10 | export class BrandListComponent implements OnInit { 11 | 12 | brands : Brand[] = []; 13 | constructor( 14 | private brandService : brandService, 15 | private toastrService:ToastrService 16 | ){ } 17 | 18 | ngOnInit(): void { 19 | this.getBrands(); 20 | } 21 | getBrands(){ 22 | this.brandService.getCars().subscribe((response) =>{ 23 | this.brands = response.data 24 | this.toastrService.success("Markalar Başarılı listelendi") 25 | }); 26 | } 27 | deleteBrand(brand : Brand){ 28 | this.brandService.delete(brand).subscribe(); 29 | this.toastrService.success("Markalar Başarılı Silindi") 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /src/app/components/brand/brand-update/brand-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/brand/brand-update/brand-update.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand-update/brand-update.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | 5 |
6 |


7 | 8 |
9 |
Marka Güncelle
10 | 11 |
12 |
13 |
14 |
15 | 16 |
17 | 18 |
19 |
20 |
21 | 22 |
23 | 24 |
25 | 26 | 29 | 30 |
-------------------------------------------------------------------------------- /src/app/components/brand/brand-update/brand-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandUpdateComponent } from './brand-update.component'; 4 | 5 | describe('BrandUpdateComponent', () => { 6 | let component: BrandUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-update/brand-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { 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'; 6 | import { brandService } from 'src/app/services/brand.service'; 7 | 8 | 9 | @Component({ 10 | selector: 'app-brand-update', 11 | templateUrl: './brand-update.component.html', 12 | styleUrls: ['./brand-update.component.css'] 13 | }) 14 | export class BrandUpdateComponent implements OnInit { 15 | 16 | brand : Brand; 17 | brandUpdateForm : FormGroup; 18 | 19 | constructor( 20 | private formBuilder : FormBuilder, 21 | private brandService : brandService, 22 | private toastrService : ToastrService, 23 | private activatedRoute : ActivatedRoute 24 | ) { } 25 | 26 | ngOnInit(): void { 27 | this.createBrandUpdateForm() 28 | this.activatedRoute.params.subscribe(params=>{ 29 | if(params["brandId"]){ 30 | this.getBrandById(params["brandId"]) 31 | } 32 | }) 33 | } 34 | createBrandUpdateForm(){ 35 | this.brandUpdateForm = this.formBuilder.group({ 36 | brandName : ["",Validators.required] 37 | }) 38 | } 39 | getBrandById(brandId:number){ 40 | this.brandService.getById(brandId).subscribe(response =>{ 41 | this.brand = response.data; 42 | }) 43 | } 44 | 45 | updateBrand(){ 46 | if(this.brandUpdateForm.valid){ 47 | let brandModel = Object.assign({},this.brandUpdateForm.value) 48 | brandModel.brandId = this.brand.brandId 49 | this.brandService.update(brandModel).subscribe(response =>{ 50 | this.toastrService.success("Marka Başarılı Güncellendi") 51 | },responseError => { 52 | this.toastrService.error(responseError.messaage , "Hata") 53 | }) 54 | }else{ 55 | this.toastrService.error("Form eksik","Hata") 56 | } 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/brand/brand.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 |

Tüm Modeller

{{brand.brandName}}
22 |
23 |
{{currentBrand.brandName}} Seçtiniz :)
24 | 25 | 26 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BrandComponent } from './brand.component'; 4 | 5 | describe('BrandComponent', () => { 6 | let component: BrandComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ BrandComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BrandComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Brand } from 'src/app/models/brand'; 3 | import { brandService } from 'src/app/services/brand.service'; 4 | 5 | @Component({ 6 | selector: 'app-brand', 7 | templateUrl: './brand.component.html', 8 | styleUrls: ['./brand.component.css'] 9 | }) 10 | export class BrandComponent implements OnInit { 11 | 12 | 13 | brand :Brand[] = []; 14 | currentBrand : Brand; 15 | emptyBrand:Brand; 16 | constructor(private brandService:brandService) { } 17 | 18 | ngOnInit(): void { 19 | this.getBrands(); 20 | } 21 | 22 | 23 | getBrands(){ 24 | this.brandService.getCars().subscribe(response => { 25 | this.brand = response.data 26 | 27 | } ) 28 | } 29 | 30 | setCurrentBrand(brand:Brand){ 31 | 32 | this.currentBrand = brand; 33 | } 34 | 35 | clearCurrentBrand() { 36 | this.currentBrand = this.emptyBrand; 37 | } 38 | 39 | 40 | getCurrentBrandClass(brand:Brand){ 41 | if(brand == this.currentBrand){ 42 | return "list-group-item active" 43 | }else{ 44 | return "list-group-item" 45 | } 46 | } 47 | 48 | 49 | getAllBrandClass(){ 50 | if(!this.currentBrand){ 51 | return "list-group-item active" 52 | }else{ 53 | return "list-group-item" 54 | } 55 | } 56 | 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/car-add/car-add.component.css -------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |
5 | 6 |
7 |

8 |
9 |
10 |
Araç ekle
11 |
12 |
13 |
14 | 15 |
16 | 20 |
21 |
22 | 23 |
24 | 25 |
26 | 30 |
31 |
32 | 33 |
34 | 35 |
36 | 40 |
41 |
42 | 43 |
44 | 45 |
46 | 50 |
51 |
52 | 53 |
54 | 55 |
56 | 60 |
61 |
62 | 63 |
64 | 65 |
66 | 70 |
71 |
72 | 73 | 74 | 75 | 76 |
77 |
78 | 79 | 82 | 83 | 84 | 85 |
86 | 87 |
88 | 89 |
-------------------------------------------------------------------------------- /src/app/components/car-add/car-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | 4 | import { CarAddComponent } from './car-add.component'; 5 | 6 | describe('CarAddComponent', () => { 7 | let component: CarAddComponent; 8 | let fixture: ComponentFixture; 9 | 10 | 11 | 12 | beforeEach(async () => { 13 | await TestBed.configureTestingModule({ 14 | declarations: [ CarAddComponent ] 15 | }) 16 | .compileComponents(); 17 | }); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(CarAddComponent); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /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 { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { CarService } from 'src/app/services/car.service'; 6 | 7 | @Component({ 8 | selector: 'app-car-add', 9 | templateUrl: './car-add.component.html', 10 | styleUrls: ['./car-add.component.css'] 11 | }) 12 | export class CarAddComponent implements OnInit { 13 | 14 | carAddForm : FormGroup 15 | 16 | constructor( 17 | private formBuilder:FormBuilder, 18 | private carServive:CarService, 19 | private toastrService:ToastrService, 20 | private router:Router 21 | ) { } 22 | 23 | ngOnInit(): void { 24 | this.createCarAddForm(); 25 | } 26 | 27 | createCarAddForm(){ 28 | this.carAddForm = this.formBuilder.group({ 29 | modelName:["" ,Validators.required], 30 | brandId:["" ,Validators.required], 31 | colorId:["" ,Validators.required], 32 | modelYear:["" ,Validators.required], 33 | dailyPrice:["" ,Validators.required], 34 | description:["" ,Validators.required] 35 | }) 36 | } 37 | 38 | add(){ 39 | if(this.carAddForm.valid){ 40 | let carModel = Object.assign({},this.carAddForm.value) 41 | this.carServive.add(carModel).subscribe(response =>{ 42 | this.toastrService.success(response.message,"Başarılı") 43 | this.router 44 | },responseError=>{ 45 | if(responseError.error.Errors.length>0){ 46 | for (let i = 0; i
2 | 3 |
4 |

Araba Listesi

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 | 34 | 37 | 38 | 39 | 40 |

Marka Adı

Model ismi

Renk Adı

Model Yılı

Günlük Fiyat

Açıklama

Güncelle

Sil

{{car.brandName}}

{{car.modelName}}

{{car.colorName}}

{{car.modelYear}}

{{car.dailyPrice}}

{{car.description}}

31 | 32 | 33 | 35 | 36 |
-------------------------------------------------------------------------------- /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 { ToastrService } from 'ngx-toastr'; 3 | import { Car } from 'src/app/models/car'; 4 | import { CarService } from 'src/app/services/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 | cars : Car[] = []; 14 | constructor( 15 | private carService : CarService, 16 | private toastrService:ToastrService 17 | ) { } 18 | 19 | ngOnInit(): void { 20 | this.getCars(); 21 | } 22 | getCars(){ 23 | this.carService.getCars().subscribe((response)=>{ 24 | this.cars = response.data 25 | this.toastrService.success("Arabalar Başarılı listelendi") 26 | }); 27 | } 28 | 29 | deleteCar(car : Car){ 30 | this.carService.delete(car).subscribe(); 31 | this.toastrService.success("Araba Silindi", "Başarılı :)") 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/app/components/car-update/car-update/car-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/car-update/car-update/car-update.component.css -------------------------------------------------------------------------------- /src/app/components/car-update/car-update/car-update.component.html: -------------------------------------------------------------------------------- 1 | 2 |



3 | 4 |
5 |
Araba
6 | 7 |
8 |
9 | 10 |
11 | 12 |
13 | 15 |
16 |
17 | 18 |
19 | 20 |
21 | 23 |
24 |
25 | 26 |
27 | 28 |
29 | 31 |
32 |
33 | 34 |
35 | 36 |
37 | 39 |
40 |
41 | 42 |
43 | 44 |
45 | 47 |
48 |
49 |
50 | 51 |
52 | 54 |
55 |
56 | 57 |
58 |
59 | 60 |
61 |
62 |
63 |
64 | -------------------------------------------------------------------------------- /src/app/components/car-update/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/car-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Brand } from 'src/app/models/brand'; 6 | import { Car } from 'src/app/models/car'; 7 | import { Color } from 'src/app/models/color'; 8 | import { brandService } from 'src/app/services/brand.service'; 9 | import { CarService } from 'src/app/services/car.service'; 10 | import { ColorService } from 'src/app/services/color.service'; 11 | import { CarDetailComponent } from '../../car/car-detail/car-detail.component'; 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 | brands : Brand[]; 21 | colors : Color[]; 22 | car : Car; 23 | carUpdateForm : FormGroup; 24 | 25 | constructor( 26 | private formBuilder : FormBuilder, 27 | private carService : CarService, 28 | private colorService : ColorService, 29 | private brandService : brandService, 30 | private toastrService : ToastrService, 31 | private activatedRoute : ActivatedRoute 32 | ) { } 33 | 34 | ngOnInit(): void { 35 | this.createCarUpdateForm(); 36 | this.getBrands(); 37 | this.getColors(); 38 | this.activatedRoute.params.subscribe(params =>{ 39 | if(params["carId"]){ 40 | this.getCarById(params["carId"]) 41 | } 42 | }) 43 | } 44 | 45 | createCarUpdateForm(){ 46 | this.carUpdateForm = this.formBuilder.group({ 47 | description : ["",Validators.required], 48 | colorId: ["",Validators.required], 49 | brandId : ["",Validators.required], 50 | modelName: ["",Validators.required], 51 | modelYear : ["",Validators.required], 52 | dailyPrice : ["",Validators.required] 53 | 54 | 55 | }) 56 | } 57 | getCarById(carId:number){ 58 | this.carService.getCarDetailsByCarId(carId).subscribe(response =>{ 59 | this.car = response.data[0]; 60 | }) 61 | } 62 | 63 | updateCar(){ 64 | if(this.carUpdateForm.valid){ 65 | let carModel = Object.assign({},this.carUpdateForm.value) 66 | carModel.carId = this.car.carId 67 | this.carService.update(carModel).subscribe(response =>{ 68 | this.toastrService.success(" Başarılı" , " Araba Güncellendi") 69 | },responseError =>{ 70 | this.toastrService.error("Hata") 71 | }) 72 | }else{ 73 | this.toastrService.error("Form eksik","Hata") 74 | } 75 | } 76 | getColors(){ 77 | this.colorService.getColors().subscribe(response=>{ 78 | this.colors = response.data; 79 | }) 80 | } 81 | getBrands(){ 82 | this.brandService.getCars().subscribe(response=>{ 83 | this.brands = response.data; 84 | }) 85 | } 86 | 87 | } -------------------------------------------------------------------------------- /src/app/components/car/car-detail/car-detail.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/car/car-detail/car-detail.component.css -------------------------------------------------------------------------------- /src/app/components/car/car-detail/car-detail.component.html: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 |

Detaylar

5 |
6 | 7 | 8 |
9 | 27 |
28 | 29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 58 | 59 | 60 | 61 | 62 |

#

Modeli
Marka
Renk
Model Yılı

Günlük Fiyatı

+KDV

Haftalık Fiyatı (7)

+KDV

Aylık Fiyatı (30)

+KDV

{{car?.carId}}

{{car?.modelName}}

{{car?.brandName}}

{{car?.colorName}}

{{car?.modelYear}}

{{car?.dailyPrice | vatAdded:18 | currency : "TRY":"" }} ₺

{{car?.dailyPrice | vatWeek:18 | currency : "TRY":"" }} ₺

{{car?.dailyPrice | vatMoon:18 | currency : "TRY":"" }} ₺

63 | 66 |
67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 109 | 110 | 111 | 112 | 113 |

Açıklama


{{car.description}}

79 |
80 | Haftalık kiralama'da 1 gün bizden 81 |
82 | Aylık kiralama'da 3 gün bizden 83 |
84 |

Kiralama Koşulları

92 |
93 | Ekonomik araç filosundan herhangi bir araç kiralamak için minimum 21 yaşında olmak gerekir.
Eğer 21 yaşından küçükseniz, Genç Sürücü ücreti ödemeniz gerekmektedir. 94 |
En az 1 senedir ehliyet sahibi olmak, 95 |
1 adet kredi kartına sahip olmak gerekir.

Neden Bizi Tercih Etmelisiniz?

103 |
104 | Kiralık araç filosunda her segmentte araç bulabileceğiniz SMTcoder ,aynı zamanda
105 | en geniş filoya sahip olan araç kiralama şirketidir.
106 | Her zaman eşsiz bir müşteri deneyimi sunmayı amaçlayan SMTcoder,
107 | filosunu Ekonomik, Konfor, Prestij, Premium, Lüks ve Van olarak
108 | 6 farklı araç grubu altında müşterilerine sunar.
114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /src/app/components/car/car-detail/car-detail.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarDetailComponent } from './car-detail.component'; 4 | 5 | describe('CarDetailComponent', () => { 6 | let component: CarDetailComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarDetailComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarDetailComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car/car-detail/car-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute, Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Car } from 'src/app/models/car'; 5 | import { CarImage } from 'src/app/models/carImage'; 6 | import { User } from 'src/app/models/user'; 7 | import { CarService } from 'src/app/services/car.service'; 8 | import { CarimageService } from 'src/app/services/carimage.service'; 9 | import { UserService } from 'src/app/services/user.service'; 10 | 11 | 12 | @Component({ 13 | selector: 'app-car-detail', 14 | templateUrl: './car-detail.component.html', 15 | styleUrls: ['./car-detail.component.css'] 16 | }) 17 | export class CarDetailComponent implements OnInit { 18 | 19 | 20 | car:Car; 21 | carImages : CarImage[] = []; 22 | apiUrl="https://localhost:44379/" 23 | currentImage : CarImage; 24 | 25 | 26 | 27 | user:User 28 | 29 | constructor( 30 | private carService: CarService, 31 | private carImageService : CarimageService, 32 | private activatedRoute :ActivatedRoute, 33 | private toastrService:ToastrService, 34 | private router:Router, 35 | private userService:UserService 36 | ) { } 37 | 38 | ngOnInit(): void { 39 | this.getUserByEmail(); 40 | this.activatedRoute.params.subscribe(params=>{ 41 | if(params["carId"]){ 42 | this.getCarDetailsByCarId(params["carId"]); 43 | this.getCarImages(params["carId"]); 44 | } 45 | }) 46 | 47 | } 48 | getUserByEmail(){ 49 | this.userService.getByMail(localStorage.getItem("email")).subscribe((response)=>{this.user=response.data}) 50 | } 51 | getCarDetailsByCarId(carId: number) { 52 | this.carService.getCarDetailsByCarId(carId).subscribe((response) => { 53 | this.car = response.data[0]; 54 | console.log(response.data) 55 | }); 56 | } 57 | 58 | getCarImages(carId:number){ 59 | this.carImageService.getCarImages(carId).subscribe((response)=>{ 60 | this.carImages = response.data; 61 | console.log(response.data) 62 | }) 63 | } 64 | 65 | 66 | 67 | getCurrentImageClass(image:CarImage ){ 68 | if(image==this.carImages[0]){ 69 | return "carousel-item active" 70 | } else { 71 | return "carousel-item" 72 | } 73 | } 74 | 75 | addRental(id:number){ 76 | this.toastrService.info( "Kiralama sayfasına yönlendiriliyorsunuz " , " SMTcoder" ) 77 | } 78 | 79 | addRental2(id:number){ 80 | 81 | this.toastrService.info("Kiralama Sayfasına Yönlendiriliyorsunuz" , "SMTcoder") 82 | this.router.navigate(["rentals/",id]); 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /src/app/components/car/car.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/car/car.component.css -------------------------------------------------------------------------------- /src/app/components/car/car.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 | 6 | 7 | 8 |
9 | 10 |
11 |
12 | Loading... 13 |
14 |
15 | 16 | 17 | 18 | 19 |
20 |
21 |

22 | 23 |
24 | 26 |
27 |
28 |
29 |
{{ filterText }} aradınız :)
30 |
31 | 32 |
33 | 34 |
37 |

Gereken Findex Puanı : {{car?.minFindex}}

38 | 39 |

Kiralık Araç

40 |
41 | 47 |
48 |
SMTcoder
49 |
50 |
    51 |
  • Marka : {{car.brandName}}
  • 52 |
  • Renk : {{car.colorName}}
  • 53 |
  • {{car.dailyPrice | currency : "TRY":"" }} ₺ / Günlük

  • 54 |
55 | 56 |
{{car.description}}
57 | 60 |
61 |
62 |
63 |
64 |
65 | 112 | 113 | 124 | 125 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CarComponent } from './car.component'; 4 | 5 | describe('CarComponent', () => { 6 | let component: CarComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CarComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CarComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | 4 | import { Car } from 'src/app/models/car'; 5 | import { CarImage } from 'src/app/models/carImage'; 6 | import { CarService } from 'src/app/services/car.service'; 7 | import { CarimageService } from 'src/app/services/carimage.service'; 8 | //import { ToastrService } from 'ngx-toastr'; 9 | 10 | 11 | @Component({ 12 | selector: 'app-car', 13 | templateUrl: './car.component.html', 14 | styleUrls: ['./car.component.css'] 15 | }) 16 | export class CarComponent implements OnInit { 17 | 18 | cars:Car[]=[]; 19 | dataLoaded =false; 20 | 21 | apiUrl="https://localhost:44379/" 22 | 23 | carImages : CarImage[] = []; 24 | currentImage : CarImage; 25 | filterText=""; 26 | 27 | 28 | constructor( 29 | 30 | private carService:CarService , 31 | private activateRoute : ActivatedRoute , 32 | private carImageService : CarimageService , 33 | 34 | 35 | ) { } 36 | 37 | ngOnInit(): void { 38 | this.activateRoute.params.subscribe(params =>{ 39 | if(params["brandId"]){ 40 | this.getCarsByBrand(params["brandId"]) 41 | }else if(params["colorId"]){ 42 | this.getCarsByColor(params["colorId"]); 43 | }else{ 44 | this.getCars() 45 | 46 | } 47 | }) 48 | 49 | } 50 | getCars(){ 51 | this.carService.getCars().subscribe(response =>{ 52 | this.cars = response.data 53 | this.dataLoaded = true; 54 | 55 | }) 56 | } 57 | getCarsByBrand(brandId : number){ 58 | this.carService.getCarsByBrand(brandId).subscribe(response =>{ 59 | this.cars = response.data 60 | this.dataLoaded = true; 61 | }) 62 | } 63 | getCarsByColor(colorId : number){ 64 | 65 | this.carService.getCarsByColor(colorId).subscribe(response =>{ 66 | this.cars = response.data 67 | this.dataLoaded = true; 68 | }) 69 | } 70 | 71 | 72 | } -------------------------------------------------------------------------------- /src/app/components/carimage/carimage.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/carimage/carimage.component.css -------------------------------------------------------------------------------- /src/app/components/carimage/carimage.component.html: -------------------------------------------------------------------------------- 1 |

carimage works!

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

2 | 3 |
4 |


5 |
6 |
7 |
8 |
9 |
Renk Ekle
10 |
11 |
12 |
13 |
14 | 15 |
16 | 19 |
20 |
21 |
22 |
23 | 26 |
27 |
28 |
-------------------------------------------------------------------------------- /src/app/components/color/color-add/color-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorAddComponent } from './color-add.component'; 4 | 5 | describe('ColorAddComponent', () => { 6 | let component: ColorAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color/color-add/color-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { ColorService } from 'src/app/services/color.service'; 5 | 6 | @Component({ 7 | selector: 'app-color-add', 8 | templateUrl: './color-add.component.html', 9 | styleUrls: ['./color-add.component.css'] 10 | }) 11 | export class ColorAddComponent implements OnInit { 12 | 13 | colorAddForm : FormGroup; 14 | 15 | constructor(private formBuilder : FormBuilder, 16 | private colorService : ColorService, 17 | private toastrService : ToastrService) { } 18 | 19 | ngOnInit(): void { 20 | this.createColorAddForm(); 21 | } 22 | createColorAddForm(){ 23 | this.colorAddForm = this.formBuilder.group({ 24 | colorName : ["",Validators.required] 25 | }) 26 | } 27 | add(){ 28 | if(this.colorAddForm.valid){ 29 | let colorModel = Object.assign({},this.colorAddForm.value) 30 | this.colorService.add(colorModel).subscribe(response => { 31 | this.toastrService.success("Başarılı") 32 | },responseError => { 33 | if(responseError.error.Errors.length > 0){ 34 | for(let i=0;i
3 | 4 |
5 |


6 | 7 | 8 |

Renk Listesi Listesi

9 | 10 |

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 30 | 31 | 32 |

Renkler

Güncelle

Sil

{{color.colorName}}

24 | 25 | 26 | 28 | 29 |
-------------------------------------------------------------------------------- /src/app/components/color/color-list/color-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorListComponent } from './color-list.component'; 4 | 5 | describe('ColorListComponent', () => { 6 | let component: ColorListComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorListComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorListComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color/color-list/color-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ToastrService } from 'ngx-toastr'; 3 | import { Color } from 'src/app/models/color'; 4 | import { ColorService } from 'src/app/services/color.service'; 5 | 6 | @Component({ 7 | selector: 'app-color-list', 8 | templateUrl: './color-list.component.html', 9 | styleUrls: ['./color-list.component.css'] 10 | }) 11 | export class ColorListComponent implements OnInit { 12 | 13 | colors : Color[] = [] 14 | constructor( 15 | private colorService : ColorService, 16 | private toastrService:ToastrService 17 | ) { } 18 | 19 | ngOnInit(): void { 20 | this.getColors(); 21 | } 22 | getColors(){ 23 | this.colorService.getColors().subscribe((response) =>{ 24 | this.colors = response.data 25 | this.toastrService.success("Renkler Başarılı listelendi") 26 | }) 27 | } 28 | deleteColor(color : Color){ 29 | this.colorService.delete(color).subscribe(); 30 | this.toastrService.success("Renk Başarılı silindi :)") 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /src/app/components/color/color-update/color-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/color/color-update/color-update.component.css -------------------------------------------------------------------------------- /src/app/components/color/color-update/color-update.component.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |
5 |


6 | 7 | 8 |
9 |
Renk Güncelle
10 | 11 |
12 |
13 |
14 |
15 | 16 |
17 | 18 | 19 |
20 |
21 |
22 |
23 |
24 | 27 |
-------------------------------------------------------------------------------- /src/app/components/color/color-update/color-update.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorUpdateComponent } from './color-update.component'; 4 | 5 | describe('ColorUpdateComponent', () => { 6 | let component: ColorUpdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorUpdateComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorUpdateComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color/color-update/color-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ActivatedRoute } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Color } from 'src/app/models/color'; 6 | import { ColorService } from 'src/app/services/color.service'; 7 | 8 | @Component({ 9 | selector: 'app-color-update', 10 | templateUrl: './color-update.component.html', 11 | styleUrls: ['./color-update.component.css'] 12 | }) 13 | export class ColorUpdateComponent implements OnInit { 14 | 15 | color : Color; 16 | colorUpdateForm : FormGroup; 17 | 18 | constructor( 19 | private formBuilder : FormBuilder, 20 | private colorService : ColorService, 21 | private toastrService : ToastrService, 22 | private activatedRoute : ActivatedRoute 23 | ) { } 24 | 25 | ngOnInit(): void { 26 | this.createColorUpdateForm() 27 | this.activatedRoute.params.subscribe(params =>{ 28 | if(params["colorId"]){ 29 | this.getColorById(params["colorId"]) 30 | } 31 | }) 32 | } 33 | createColorUpdateForm(){ 34 | this.colorUpdateForm = this.formBuilder.group({ 35 | colorName : ["",Validators.required] 36 | }) 37 | } 38 | getColorById(colorId : number){ 39 | this.colorService.getbyId(colorId).subscribe(response =>{ 40 | this.color = response.data 41 | }) 42 | } 43 | updateColor(){ 44 | if(this.colorUpdateForm.valid){ 45 | let colorModel = Object.assign({},this.colorUpdateForm.value) 46 | colorModel.colorId = this.color.colorId 47 | this.colorService.update(colorModel).subscribe(response =>{ 48 | this.toastrService.success("Başarılı " , " Renk Güncellendi :)") 49 | },responseError =>{ 50 | this.toastrService.error(responseError.messaage , "Hata") 51 | }) 52 | } 53 | else{ 54 | this.toastrService.error("Form Eksik","Hata") 55 | } 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /src/app/components/color/color.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/color/color.component.css -------------------------------------------------------------------------------- /src/app/components/color/color.component.html: -------------------------------------------------------------------------------- 1 |

2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 |

Tüm Renkler

{{color.colorName}}
22 |
23 |
{{currentColor.colorName}} Seçtiniz :)
24 | 25 | 26 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ColorComponent } from './color.component'; 4 | 5 | describe('ColorComponent', () => { 6 | let component: ColorComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ColorComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ColorComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Color } from 'src/app/models/color'; 3 | import { ColorService } from 'src/app/services/color.service'; 4 | 5 | @Component({ 6 | selector: 'app-color', 7 | templateUrl: './color.component.html', 8 | styleUrls: ['./color.component.css'] 9 | }) 10 | export class ColorComponent implements OnInit { 11 | 12 | color:Color[] =[]; 13 | currentColor :Color; 14 | emptyColor:Color; 15 | constructor(private colorService:ColorService) { } 16 | 17 | ngOnInit(): void { 18 | this.getColor(); 19 | } 20 | 21 | getColor(){ 22 | this.colorService.getColors().subscribe(response => { 23 | this.color = response.data; 24 | }) 25 | } 26 | 27 | setCurrentColor(color:Color){ 28 | 29 | this.currentColor = color; 30 | } 31 | 32 | getCurrentColorClass(color:Color){ 33 | if(color == this.currentColor){ 34 | return "list-group-item active" 35 | }else{ 36 | return "list-group-item" 37 | } 38 | } 39 | 40 | 41 | getAllColorClass(){ 42 | if(!this.currentColor){ 43 | return "list-group-item active" 44 | }else{ 45 | return "list-group-item" 46 | } 47 | } 48 | 49 | clearCurrentColor() { 50 | this.currentColor = this.emptyColor; 51 | } 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/customer/customer.component.css -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.html: -------------------------------------------------------------------------------- 1 |

Müşteriler (Customers)

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
# Id# Kullanıcı IdMüşteri ismi
{{customer.customerId}}{{customer.userId}}{{customer.customerName}}
-------------------------------------------------------------------------------- /src/app/components/customer/customer.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { CustomerComponent } from './customer.component'; 4 | 5 | describe('CustomerComponent', () => { 6 | let component: CustomerComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ CustomerComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(CustomerComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Customer } from 'src/app/models/customer'; 3 | import { CustomerService } from 'src/app/services/customer.service'; 4 | 5 | @Component({ 6 | selector: 'app-customer', 7 | templateUrl: './customer.component.html', 8 | styleUrls: ['./customer.component.css'] 9 | }) 10 | export class CustomerComponent implements OnInit { 11 | 12 | customer :Customer[] = []; 13 | constructor(private customerService :CustomerService ) { } 14 | 15 | ngOnInit(): void { 16 | 17 | this.getCustomers(); 18 | } 19 | 20 | getCustomers(){ 21 | this.customerService.getCustomer().subscribe(response => { 22 | 23 | this.customer = response.data; 24 | }) 25 | 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/app/components/filter/filter.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/filter/filter.component.css -------------------------------------------------------------------------------- /src/app/components/filter/filter.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 | 19 |
20 |
21 |
22 |
23 |
24 | 39 |
40 |
41 |
42 |
43 |
44 | 49 |
50 | 51 |
52 | 56 |
57 |
58 |
-------------------------------------------------------------------------------- /src/app/components/filter/filter.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { FilterComponent } from './filter.component'; 4 | 5 | describe('FilterComponent', () => { 6 | let component: FilterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ FilterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(FilterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/filter/filter.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Brand } from 'src/app/models/brand'; 3 | import { Color } from 'src/app/models/color'; 4 | import { brandService } from 'src/app/services/brand.service'; 5 | import { ColorService } from 'src/app/services/color.service'; 6 | 7 | @Component({ 8 | selector: 'app-filter', 9 | templateUrl: './filter.component.html', 10 | styleUrls: ['./filter.component.css'] 11 | }) 12 | export class FilterComponent implements OnInit { 13 | 14 | colors:Color[] 15 | brands:Brand[] 16 | currentBrandId:number; 17 | currentColorId:number; 18 | 19 | 20 | constructor( 21 | private brandService:brandService, 22 | private colorService:ColorService 23 | ) { } 24 | 25 | ngOnInit(): void { 26 | this.getBrands(); 27 | this.getColors(); 28 | } 29 | getBrands(){ 30 | this.brandService.getCars().subscribe((response)=>{ 31 | this.brands=response.data 32 | }) 33 | } 34 | getColors(){ 35 | this.colorService.getColors().subscribe((response)=>{ 36 | this.colors=response.data 37 | }) 38 | } 39 | setCurrentBrand(brandId:number){ 40 | return(brandId===this.currentBrandId?true:false) 41 | } 42 | setCurrentColor(colorId:number){ 43 | return(colorId===this.currentColorId?true:false) 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /src/app/components/footer/footer.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/footer/footer.component.css -------------------------------------------------------------------------------- /src/app/components/footer/footer.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 | 7 |
8 |

9 |

Simdi ücretsiz Kayıt Ol

10 | 13 |

14 |
15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 |
Instagram
25 | 26 | 27 |
Linkedin
30 | 31 | 32 |
Github
35 |
36 | 37 |
38 | 39 |
40 | 41 |
42 |
Uygulamayı indir
45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 |
53 |
©2021 Web Sitem : sametakca.com
54 |

SMTcoder

55 |
56 | 57 | 58 |
-------------------------------------------------------------------------------- /src/app/components/footer/footer.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { FooterComponent } from './footer.component'; 4 | 5 | describe('FooterComponent', () => { 6 | let component: FooterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ FooterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(FooterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/footer/footer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-footer', 5 | templateUrl: './footer.component.html', 6 | styleUrls: ['./footer.component.css'] 7 | }) 8 | export class FooterComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | color: #5d5f6b; 4 | background: #c8c8c8; 5 | font: 600 16px/18px 'Open Sans', sans-serif 6 | } 7 | 8 | .login-box { 9 | width: 100%; 10 | margin: auto; 11 | max-width: 600px; 12 | min-height: 800px; 13 | position: relative; 14 | background: url(https://image.freepik.com/free-photo/black-sport-car-with-two-yellow-stripes-driving-road_114579-4070.jpg) no-repeat center; 15 | box-shadow: 0 12px 15px 0 rgba(0, 110, 255, 0.712), 0 17px 50px 0 rgba(0, 0, 0, .19) 16 | } 17 | 18 | .login-snip { 19 | width: 100%; 20 | height: 100%; 21 | position: absolute; 22 | padding: 90px 80px 50px 70px; 23 | background: rgba(14, 1, 85, 0.808) 24 | } 25 | 26 | .login-snip .login, 27 | .login-snip .sign-up-form { 28 | top: 0; 29 | left: 0; 30 | right: 0; 31 | bottom: 0; 32 | position: absolute; 33 | transform: rotateY(180deg); 34 | backface-visibility: hidden; 35 | transition: all .4s linear 36 | } 37 | 38 | .login-snip .sign-in, 39 | .login-snip .sign-up, 40 | .login-space .group .check { 41 | display: none 42 | } 43 | 44 | .login-snip .tab, 45 | .login-space .group .label, 46 | .login-space .group .button { 47 | text-transform: uppercase 48 | } 49 | 50 | .login-snip .tab { 51 | font-size: 22px; 52 | margin-right: 15px; 53 | padding-bottom: 5px; 54 | margin: 0 15px 10px 0; 55 | display: inline-block; 56 | border-bottom: 2px solid transparent 57 | } 58 | 59 | .login-snip .sign-in:checked+.tab, 60 | .login-snip .sign-up:checked+.tab { 61 | color: #fff; 62 | border-color: #1161ee 63 | } 64 | 65 | .login-space { 66 | min-height: 345px; 67 | position: relative; 68 | perspective: 1000px; 69 | transform-style: preserve-3d 70 | } 71 | 72 | .login-space .group { 73 | margin-bottom: 15px 74 | } 75 | 76 | .login-space .group .label, 77 | .login-space .group .input, 78 | .login-space .group .button { 79 | width: 100%; 80 | color: #fff; 81 | display: block 82 | } 83 | 84 | .login-space .group .input, 85 | .login-space .group .button { 86 | border: none; 87 | padding: 15px 20px; 88 | border-radius: 25px; 89 | background: rgba(255, 255, 255, .1) 90 | } 91 | 92 | .login-space .group input[data-type="password"] { 93 | text-security: circle; 94 | -webkit-text-security: circle 95 | } 96 | 97 | .login-space .group .label { 98 | color: #aaa; 99 | font-size: 12px 100 | } 101 | 102 | .login-space .group .button { 103 | background: #1161ee 104 | } 105 | 106 | .login-space .group label .icon { 107 | width: 15px; 108 | height: 15px; 109 | border-radius: 2px; 110 | position: relative; 111 | display: inline-block; 112 | background: rgba(255, 255, 255, .1) 113 | } 114 | 115 | .login-space .group label .icon:before, 116 | .login-space .group label .icon:after { 117 | content: ''; 118 | width: 10px; 119 | height: 2px; 120 | background: #fff; 121 | position: absolute; 122 | transition: all .2s ease-in-out 0s 123 | } 124 | 125 | .login-space .group label .icon:before { 126 | left: 3px; 127 | width: 5px; 128 | bottom: 6px; 129 | transform: scale(0) rotate(0) 130 | } 131 | 132 | .login-space .group label .icon:after { 133 | top: 6px; 134 | right: 0; 135 | transform: scale(0) rotate(0) 136 | } 137 | 138 | .login-space .group .check:checked+label { 139 | color: #fff 140 | } 141 | 142 | .login-space .group .check:checked+label .icon { 143 | background: #1161ee 144 | } 145 | 146 | .login-space .group .check:checked+label .icon:before { 147 | transform: scale(1) rotate(45deg) 148 | } 149 | 150 | .login-space .group .check:checked+label .icon:after { 151 | transform: scale(1) rotate(-45deg) 152 | } 153 | 154 | .login-snip .sign-in:checked+.tab+.sign-up+.tab+.login-space .login { 155 | transform: rotate(0) 156 | } 157 | 158 | .login-snip .sign-up:checked+.tab+.login-space .sign-up-form { 159 | transform: rotate(0) 160 | } 161 | 162 | *, 163 | :after, 164 | :before { 165 | box-sizing: border-box 166 | } 167 | 168 | .clearfix:after, 169 | .clearfix:before { 170 | content: ''; 171 | display: table 172 | } 173 | 174 | .clearfix:after { 175 | clear: both; 176 | display: block 177 | } 178 | 179 | a { 180 | color: inherit; 181 | text-decoration: none 182 | } 183 | 184 | .hr { 185 | height: 2px; 186 | margin: 60px 0 50px 0; 187 | background: rgba(255, 255, 255, .2) 188 | } 189 | 190 | .foot { 191 | text-align: center 192 | } 193 | 194 | .card { 195 | width: 550px; 196 | left: 200px 197 | } 198 | 199 | ::placeholder { 200 | color: #b3b3b3 201 | } -------------------------------------------------------------------------------- /src/app/components/login/login.component.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 | 7 |
8 | 9 |
10 |
11 | 71 |
72 |
73 |
-------------------------------------------------------------------------------- /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 { THIS_EXPR } from '@angular/compiler/src/output/output_ast'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { FormGroup , FormBuilder , Validators, FormControl } from "@angular/forms"; 4 | import { Router } from '@angular/router'; 5 | import { ToastrService } from 'ngx-toastr'; 6 | import { AuthService } from 'src/app/services/auth.service'; 7 | 8 | @Component({ 9 | selector: 'app-login', 10 | templateUrl: './login.component.html', 11 | styleUrls: ['./login.component.css'] 12 | }) 13 | export class LoginComponent implements OnInit { 14 | 15 | loginForm:FormGroup; 16 | registerForm:FormGroup; 17 | 18 | constructor( 19 | private formBuilder:FormBuilder, 20 | private authService:AuthService, 21 | private toastrService:ToastrService, 22 | private router:Router 23 | 24 | ) { } 25 | 26 | ngOnInit(): void { 27 | this.createLoginForm(); 28 | this.createRegisterForm(); 29 | } 30 | 31 | createLoginForm(){ 32 | 33 | this.loginForm = this.formBuilder.group({ 34 | email:["", Validators.required], 35 | password:["", Validators.required] 36 | }) 37 | } 38 | 39 | login(){ 40 | if(this.loginForm.valid){ 41 | console.log(this.loginForm.value); 42 | let loginModel = Object.assign({},this.loginForm.value) 43 | 44 | this.authService.login(loginModel).subscribe(response=>{ 45 | console.log(response) 46 | this.toastrService.success(response.message,"Başarılı giriş") 47 | this.router.navigate(["cars"]) 48 | localStorage.setItem("token",response.data.token) 49 | localStorage.setItem("email",loginModel.email) 50 | 51 | },responseError=>{ 52 | console.log(responseError) 53 | this.toastrService.error(responseError.error) 54 | }) 55 | } 56 | } 57 | 58 | createRegisterForm() { 59 | this.registerForm = this.formBuilder.group({ 60 | firstName: ['', Validators.required], 61 | lastName: ['', Validators.required], 62 | email: ['', Validators.required], 63 | password: ['', Validators.required], 64 | }); 65 | } 66 | 67 | register(){ 68 | if (this.registerForm.valid) { 69 | let registerModel = Object.assign({}, this.registerForm.value); 70 | this.authService.register(registerModel).subscribe( 71 | (response) => { 72 | this.toastrService.success("Başarılı " , "Kayıt Olundu"); 73 | 74 | 75 | this.router.navigate(['login']); 76 | }, 77 | (responseError) => { 78 | console.log(responseError.error.messages); 79 | this.toastrService.error(" Mevcut Kullanıcı "); 80 | } 81 | ); 82 | } 83 | 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.css: -------------------------------------------------------------------------------- 1 | .topnav a:hover { 2 | border-bottom: 3px solid rgb(255, 255, 255); 3 | } 4 | 5 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 |
9 | 10 | 11 | 12 |
13 | 14 |
15 | 16 |
17 |
18 |
19 |
20 |
@
21 |
22 | 24 | 26 |
27 |
28 |
29 |
30 | 31 |
32 |
33 |
34 | 35 | 168 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { NaviComponent } from './navi.component'; 4 | 5 | describe('NaviComponent', () => { 6 | let component: NaviComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ NaviComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(NaviComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { User } from 'src/app/models/user'; 5 | import { AuthService } from 'src/app/services/auth.service'; 6 | import { UserService } from 'src/app/services/user.service'; 7 | 8 | @Component({ 9 | selector: 'app-navi', 10 | templateUrl: './navi.component.html', 11 | styleUrls: ['./navi.component.css'] 12 | }) 13 | export class NaviComponent implements OnInit { 14 | 15 | 16 | user:User 17 | userId:number; 18 | isAuthenticated:boolean 19 | 20 | constructor( 21 | private authService:AuthService, 22 | private toastrService:ToastrService, 23 | private router:Router, 24 | private userService:UserService 25 | ) { } 26 | 27 | ngOnInit(): void { 28 | 29 | 30 | if (this.checkIfLogin()) { 31 | this.getUserByEmail(); 32 | console.log("True") 33 | this.getUserId(); 34 | 35 | } 36 | } 37 | 38 | 39 | checkIfLogin(){ 40 | if (this.authService.isAuthenticated()) { 41 | return true 42 | }else{ 43 | return false 44 | } 45 | } 46 | 47 | getUserId(){ 48 | this.userId = this.userService.getUserId() 49 | } 50 | 51 | getUserByEmail() { 52 | console.log("Çalıştı ") 53 | this.userService.getByMail(localStorage.getItem("email")).subscribe((response) => { 54 | this.user = response.data; 55 | console.log(this.user) 56 | }); 57 | } 58 | 59 | 60 | logOut(){ 61 | this.authService.logOut(); 62 | this.toastrService.info("Başarılı Çıkış Yapıldı") 63 | this.router.navigate([""]) 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.css: -------------------------------------------------------------------------------- 1 | .md-outline.select-wrapper+label { 2 | top: .5em !important; 3 | z-index: 2 !important; 4 | } -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.html: -------------------------------------------------------------------------------- 1 | 2 |


3 | 4 |
5 | 6 |
7 | 8 | 9 | 12 |
13 |
14 | 15 |
16 |
17 |
18 |
19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 | 32 | 33 |
34 | 35 | 36 |
37 | 38 | 41 | 44 |
45 | 46 |
47 | 48 | 49 |
50 |
51 | 52 | 58 | 59 | 60 |
61 |
62 |
63 | 64 |
65 |


66 |
67 |
68 |

İşlem Özeti

69 |
70 |
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 |

Alış Tarihi

Teslim Tarihi

Marka

Renk

Günlük

Toplam

{{rental.rentDate}}

{{rental.returnDate}}

{{car.brandName}}

{{car.colorName}}

{{car.dailyPrice | currency:"₺"}}

{{car.dailyPrice * amountPayment | currency:"₺"}}

95 |
96 | 97 |
98 |
99 | 100 | 101 |
102 |
103 | 104 | 105 | 106 |
107 | 108 |
109 | 110 |
111 | 112 |
113 |
114 |

Banka Bilgilerinizi Eksiksiz doldurun

115 |
116 |
117 | 118 | 119 |
120 | 121 |
122 | 126 |
127 |
128 | 129 |
130 | 131 |
132 | 136 |
137 |
138 | 139 |
140 | 141 |
142 | 146 |
147 |
148 | 149 |
150 | 151 |
152 | 156 |
157 |
158 | 159 |
160 | 161 |
162 | 166 |
167 | 168 |
169 | 170 | 171 |
172 | 173 |
174 | 177 |
178 | 179 |
180 | 181 | 182 |
183 | 184 |
185 | 186 |
187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 |
195 |
196 | 197 | 198 |

199 | 200 |
201 |
202 |
203 |
204 |
-------------------------------------------------------------------------------- /src/app/components/payment/payment.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PaymentComponent } from './payment.component'; 4 | 5 | describe('PaymentComponent', () => { 6 | let component: PaymentComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ PaymentComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PaymentComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ActivatedRoute, Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Car } from 'src/app/models/car'; 6 | import { CarImage } from 'src/app/models/carImage'; 7 | import { Rental } from 'src/app/models/rental'; 8 | import { CarService } from 'src/app/services/car.service'; 9 | import { PaymentService } from 'src/app/services/payment.service'; 10 | import { RentalService } from 'src/app/services/rental.service'; 11 | 12 | @Component({ 13 | selector: 'app-payment', 14 | templateUrl: './payment.component.html', 15 | styleUrls: ['./payment.component.css'] 16 | }) 17 | export class PaymentComponent implements OnInit { 18 | 19 | 20 | 21 | car:Car; 22 | carDetails:Car[]; 23 | rental:Rental; 24 | rental2 : Rental[] = []; 25 | carImages : CarImage[] = []; 26 | apiUrl="https://localhost:44379/" 27 | currentImage : CarImage; 28 | rentDate:Date; 29 | returnDate:Date; 30 | amountPayment:number=0; 31 | 32 | cardAddForm : FormGroup 33 | 34 | constructor( 35 | 36 | private activatedRoute:ActivatedRoute, 37 | private carService:CarService, 38 | private router:Router, 39 | private toastrService:ToastrService, 40 | private paymentService:PaymentService, 41 | private formBuilder:FormBuilder, 42 | private rentalService:RentalService 43 | 44 | ) { } 45 | 46 | 47 | 48 | ngOnInit(): void { 49 | 50 | this.activatedRoute.params.subscribe(params=> 51 | { 52 | this.createPaymentAddForm(); 53 | 54 | if(params["rental"]) 55 | { 56 | this.rental = JSON.parse(params['rental']); 57 | this.getRental(); 58 | this.getrentaldetailbycarId(this.rental); 59 | this.getCarDetail(); 60 | } 61 | }) 62 | 63 | } 64 | 65 | 66 | createPaymentAddForm(){ 67 | this.cardAddForm = this.formBuilder.group({ 68 | customerId:["" ,Validators.required], 69 | cardOwnerName:["" ,Validators.required], 70 | cardNumber:["" ,Validators.required], 71 | cardExpirationDate:["" ,Validators.required], 72 | cardCvv:["" ,Validators.required] 73 | }) 74 | } 75 | 76 | creditPayment() 77 | { 78 | if(this.cardAddForm.valid ){ 79 | let PaymentModel = Object.assign({},this.cardAddForm.value) 80 | this.paymentService.add(PaymentModel).subscribe(response =>{ 81 | 82 | this.toastrService.success(" Ödeme Başarılı ") 83 | 84 | 85 | } 86 | ); 87 | } 88 | else { 89 | this.toastrService.error(' Eksik Bilgiler var', 'Dikkat'); 90 | } 91 | } 92 | 93 | 94 | 95 | 96 | getRental(){ 97 | console.log(this.rental); 98 | } 99 | 100 | getCarDetail(){ 101 | this.carService.getCarDetailsByCarId(this.rental.carId).subscribe(reponse=> 102 | { 103 | this.carDetails=reponse.data; 104 | this.paymentCalculator(); 105 | }) 106 | } 107 | 108 | paymentCalculator() 109 | { 110 | 111 | if(this.rental.returnDate!=null) 112 | { 113 | var date1=new Date(this.rental.returnDate.toString()); 114 | var date2=new Date(this.rental.rentDate.toString()); 115 | var difference = date1.getTime() - date2.getTime(); 116 | 117 | var numberOfDays = Math.ceil(difference / (1000 * 3600 * 24)); 118 | 119 | this.amountPayment = numberOfDays; 120 | if(this.amountPayment <= 0){ 121 | this.router.navigate(['/cars']); 122 | this.toastrService.error("Araç listesine yönlendiriliyorsunuz", "Hatalı işlem"); 123 | } 124 | } 125 | 126 | } 127 | 128 | 129 | 130 | 131 | getrentaldetailbycarId(rental:Rental){ 132 | this.paymentService.getrentaldetailbycarId(rental).subscribe((response) => { 133 | this.rental2 = response.data; 134 | console.log(response.data) 135 | }); 136 | } 137 | } 138 | 139 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/register/register.component.css -------------------------------------------------------------------------------- /src/app/components/register/register.component.html: -------------------------------------------------------------------------------- 1 |

register works!

2 | -------------------------------------------------------------------------------- /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 { AuthService } from 'src/app/services/auth.service'; 3 | 4 | @Component({ 5 | selector: 'app-register', 6 | templateUrl: './register.component.html', 7 | styleUrls: ['./register.component.css'] 8 | }) 9 | export class RegisterComponent implements OnInit { 10 | 11 | constructor() { } 12 | 13 | ngOnInit(): void { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/app/components/rental-add/rental-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/rental-add/rental-add.component.css -------------------------------------------------------------------------------- /src/app/components/rental-add/rental-add.component.html: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

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

Aracınızın Konumu

24 |
25 | 26 | 27 | 28 |
29 | 30 | 31 |
32 | 33 |
34 | 35 | 36 |
37 | 38 | 39 |
40 | 41 | 42 |
43 |
44 | 45 |

Dikkat !

46 | 47 |
48 |

Google Play'den Uygulamayı indirin ve size gödericemiz kod ile
aracınızın kapılarını acabilirsiniz.

49 | @SMTcoder iyi seyirler diler. :)

50 | 52 |

53 | 54 | 55 |
56 |
57 | 58 |
59 |

60 |
61 |
62 |

Kiralamak için Bilgileri doldurun

63 |
64 |
65 | 66 |
67 | 68 |
69 | 73 |
74 |
75 | 76 |
77 | 78 |
79 | 83 |
84 |
85 | 86 |
87 | 88 |
89 | 93 |
94 | 95 |
96 | 97 |
98 | 99 |
100 | 104 |
105 |
106 |
107 | 108 |
109 | 112 |
113 | 114 |
115 | 116 |
117 | 118 |


119 | 120 | -------------------------------------------------------------------------------- /src/app/components/rental-add/rental-add.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RentalAddComponent } from './rental-add.component'; 4 | 5 | describe('RentalAddComponent', () => { 6 | let component: RentalAddComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ RentalAddComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RentalAddComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/rental-add/rental-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { User } from 'src/app/models/user'; 6 | import { RentalService } from 'src/app/services/rental.service'; 7 | import { UserService } from 'src/app/services/user.service'; 8 | 9 | @Component({ 10 | selector: 'app-rental-add', 11 | templateUrl: './rental-add.component.html', 12 | styleUrls: ['./rental-add.component.css'] 13 | }) 14 | export class RentalAddComponent implements OnInit { 15 | 16 | 17 | user:User 18 | rentalAddForm : FormGroup 19 | 20 | constructor( 21 | private formBuilder:FormBuilder, 22 | private rentalService:RentalService, 23 | private toastrService:ToastrService, 24 | private router:Router, 25 | private userService:UserService 26 | ) { } 27 | 28 | ngOnInit(): void { 29 | 30 | this.createRentalAddForm(); 31 | 32 | } 33 | 34 | createRentalAddForm(){ 35 | this.rentalAddForm = this.formBuilder.group({ 36 | carId:["" ,Validators.required], 37 | customerId:["" ,Validators.required], 38 | rentDate:["" ,Validators.required], 39 | returnDate:["" ,Validators.required] 40 | 41 | }) 42 | } 43 | 44 | addFindexPoint(){ 45 | this.userService.addFindexPoint(this.userService.getUserId()).subscribe((response)=>{ 46 | this.toastrService.info(response.message,"Bilgi") 47 | }) 48 | } 49 | add(){ 50 | if(this.rentalAddForm.valid){ 51 | let rentalModel = Object.assign({},this.rentalAddForm.value) 52 | this.rentalService.add(rentalModel).subscribe(response =>{ 53 | this.router.navigate(['/payment/', JSON.stringify(rentalModel)]); 54 | this.toastrService.success(response.message,"Başarılı Eklendi") 55 | this.addFindexPoint(); 56 | 57 | 58 | },responseError=>{ 59 | if(responseError.error.Errors.length>0){ 60 | for (let i = 0; i
3 | 4 |

5 | 6 |

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

Aracınızın Konumu

23 |
24 | 25 | 26 | 27 |
28 | 29 | 30 |
31 | 32 |
33 | 34 | 35 |
36 | 37 | 38 |
39 | 40 | 41 |
42 |
43 | 44 |

Dikkat !

45 | 46 |
47 |
Google Play'den uygulamızı indirin ve size gödericemiz kod ile
aracınızın kapılarını acabilirsiniz.

48 | @SMTcoder iyi seyirler diler. :)

49 | 51 |
52 | 53 | 54 |
55 |
56 | 57 |

58 |
59 |
60 |
61 |

isim soyisim

62 |
63 | 64 |
65 | 66 |
67 | 68 | 69 |
70 | 71 | 72 |
73 | 74 | 86 |
87 | 88 |
89 |

Tarih Girin
Alış Tarihi / Teslim Tarihi

90 |
91 |
92 |
93 | 94 |
95 | 96 | 104 | 105 | 112 | 113 | 120 | 121 |

122 |
123 |
124 |
125 | 126 |
127 | 128 |


129 | 130 |
131 | 132 |

133 | 134 | 135 | 136 | 137 |
138 | 139 |
140 | 141 |
142 | 143 | 144 | 145 | 146 | 147 |


-------------------------------------------------------------------------------- /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 { DatePipe } from '@angular/common'; 2 | import { Component, OnInit } from '@angular/core'; 3 | import { FormControl, FormGroup } from '@angular/forms'; 4 | import { ActivatedRoute, Router } from '@angular/router'; 5 | import { ToastrService } from 'ngx-toastr'; 6 | import { Car } from 'src/app/models/car'; 7 | import { CarImage } from 'src/app/models/carImage'; 8 | import { Customer } from 'src/app/models/customer'; 9 | import { Rental } from 'src/app/models/rental'; 10 | import { CarService } from 'src/app/services/car.service'; 11 | import { CarimageService } from 'src/app/services/carimage.service'; 12 | import { CustomerService } from 'src/app/services/customer.service'; 13 | import { RentalService } from 'src/app/services/rental.service'; 14 | 15 | @Component({ 16 | selector: 'app-rental', 17 | templateUrl: './rental.component.html', 18 | styleUrls: ['./rental.component.css'] 19 | }) 20 | export class RentalComponent implements OnInit { 21 | 22 | rental : Rental[] = []; 23 | car:Car; 24 | carImages : CarImage[] = []; 25 | apiUrl="https://localhost:44379/" 26 | currentImage : CarImage; 27 | rentDate:Date; 28 | returnDate:Date; 29 | 30 | 31 | constructor( 32 | private rentalService:RentalService, 33 | private router: Router, 34 | private carService :CarService, 35 | private carImageService:CarimageService, 36 | private toastrService:ToastrService, 37 | private customerService:CustomerService 38 | ) { } 39 | 40 | 41 | ngOnInit(): void { 42 | 43 | this.getRentals(); 44 | } 45 | 46 | getRentals(){ 47 | this.rentalService.getRental().subscribe(response => { 48 | this.rental = response.data 49 | }) 50 | } 51 | 52 | getCurrentImageClass(image:CarImage ){ 53 | if(image==this.carImages[0]){ 54 | return "carousel-item active" 55 | } else { 56 | return "carousel-item" 57 | } 58 | } 59 | 60 | 61 | getCarDetailsByCarId(carId: number) { 62 | this.carService.getCarDetailsByCarId(carId).subscribe((response) => { 63 | this.car = response.data[0]; 64 | console.log(response.data) 65 | }); 66 | } 67 | 68 | getCarImages(carId:number){ 69 | this.carImageService.getCarImages(carId).subscribe((response)=>{ 70 | this.carImages = response.data; 71 | console.log(response.data) 72 | }) 73 | } 74 | 75 | getMinDate(){ 76 | var today = new Date(); 77 | 78 | today.setDate(today.getDate() ); 79 | return today.toISOString().slice(0,10) 80 | } 81 | 82 | 83 | 84 | 85 | } 86 | 87 | /* 88 | 89 | getCustomers() 90 | { 91 | this.customerService.getCustomer().subscribe(response=> 92 | { 93 | this.customers=response.data 94 | }) 95 | } 96 | 97 | getMinDate(){ 98 | var today = new Date(); 99 | //min="1980-01-01" 100 | today.setDate(today.getDate() + 1); 101 | return today.toISOString().slice(0,10) 102 | } 103 | 104 | addRentals() 105 | { 106 | let rental:Rental = 107 | { 108 | rentDate :this.rentDate, 109 | returnDate:this.returnDate, 110 | carId:this.car.carId, 111 | customerId: parseInt(this.customerId.toString()) 112 | } 113 | this.route.navigate(['/payment/', JSON.stringify(rental)]); 114 | this.toastrService.info("Ödeme sayfasına yönlendiriliyorsunuz...", "Ödeme İşlemleri"); 115 | } 116 | 117 | */ -------------------------------------------------------------------------------- /src/app/components/user/user.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/app/components/user/user.component.css -------------------------------------------------------------------------------- /src/app/components/user/user.component.html: -------------------------------------------------------------------------------- 1 |

user works!

2 | -------------------------------------------------------------------------------- /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 | 3 | @Component({ 4 | selector: 'app-user', 5 | templateUrl: './user.component.html', 6 | styleUrls: ['./user.component.css'] 7 | }) 8 | export class UserComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /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.service'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class LoginGuard implements CanActivate { 11 | 12 | constructor(private authService:AuthService, 13 | private toastrService:ToastrService, 14 | private router:Router){ 15 | 16 | } 17 | 18 | canActivate( 19 | route: ActivatedRouteSnapshot, 20 | state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { 21 | 22 | if(this.authService.isAuthenticated()){ 23 | return true; 24 | }else{ 25 | this.router.navigate(["login"]) 26 | this.toastrService.info("Sisteme giriş yapmalısınız") 27 | return false; 28 | } 29 | 30 | 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /src/app/interceptors/auth.interceptor.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthInterceptor } from './auth.interceptor'; 4 | 5 | describe('AuthInterceptor', () => { 6 | beforeEach(() => TestBed.configureTestingModule({ 7 | providers: [ 8 | AuthInterceptor 9 | ] 10 | })); 11 | 12 | it('should be created', () => { 13 | const interceptor: AuthInterceptor = TestBed.inject(AuthInterceptor); 14 | expect(interceptor).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/interceptors/auth.interceptor.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { 3 | HttpRequest, 4 | HttpHandler, 5 | HttpEvent, 6 | HttpInterceptor 7 | } from '@angular/common/http'; 8 | import { Observable } from 'rxjs'; 9 | 10 | @Injectable() 11 | export class AuthInterceptor implements HttpInterceptor { 12 | 13 | constructor() {} 14 | 15 | intercept(request: HttpRequest, next: HttpHandler): Observable> { 16 | let token = localStorage.getItem("token"); 17 | let newRequest : HttpRequest; 18 | newRequest = request.clone({ 19 | headers: request.headers.set("Authorization","Bearer " + token) 20 | }) 21 | return next.handle(newRequest); 22 | } 23 | } 24 | 25 | //Error -------------------------------------------------------------------------------- /src/app/models/ResponseModel.ts: -------------------------------------------------------------------------------- 1 | export interface ResponseModel{ 2 | success:boolean, 3 | message:string 4 | } -------------------------------------------------------------------------------- /src/app/models/brand.ts: -------------------------------------------------------------------------------- 1 | export interface Brand{ 2 | brandId:number 3 | brandName:string 4 | } -------------------------------------------------------------------------------- /src/app/models/car.ts: -------------------------------------------------------------------------------- 1 | export interface Car{ 2 | carId:number 3 | modelName:string 4 | brandName:string 5 | brandId:number 6 | colorId:number 7 | colorName:string 8 | modelYear:number 9 | dailyPrice:number 10 | description:string 11 | imagePath:string 12 | carImageDate:Date 13 | minFindex:number 14 | } -------------------------------------------------------------------------------- /src/app/models/carImage.ts: -------------------------------------------------------------------------------- 1 | export interface CarImage{ 2 | id:number; 3 | carId:number; 4 | imagePath:string; 5 | date:string; 6 | } -------------------------------------------------------------------------------- /src/app/models/card.ts: -------------------------------------------------------------------------------- 1 | export interface Card{ 2 | id: number; 3 | customerId:number; 4 | cardOwnerName:string; 5 | cardNumber:string; 6 | cardExpirationDate:string; 7 | cardCvv:number; 8 | } 9 | 10 | export class CartTotal{ 11 | customerId:number; 12 | cartTotal:number; 13 | } -------------------------------------------------------------------------------- /src/app/models/color.ts: -------------------------------------------------------------------------------- 1 | export interface Color{ 2 | colorId:number 3 | colorName:string 4 | } -------------------------------------------------------------------------------- /src/app/models/customer.ts: -------------------------------------------------------------------------------- 1 | export interface Customer{ 2 | customerId:number 3 | userId:number 4 | customerName:string 5 | } -------------------------------------------------------------------------------- /src/app/models/itemResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./ResponseModel"; 2 | 3 | export interface ItemResponseModel extends ResponseModel { 4 | data:T 5 | } -------------------------------------------------------------------------------- /src/app/models/listResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./ResponseModel"; 2 | 3 | export interface ListResponseModel extends ResponseModel{ 4 | data:T[]; 5 | } -------------------------------------------------------------------------------- /src/app/models/loginModel.ts: -------------------------------------------------------------------------------- 1 | export interface LoginModel{ 2 | email:string; 3 | password:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/payment.ts: -------------------------------------------------------------------------------- 1 | export interface Payment{ 2 | cartOwnerName:string; 3 | cardNumber:string; 4 | expirationDate:string; 5 | cardCvv:number; 6 | customerId:number; 7 | paymentDate:Date; 8 | } -------------------------------------------------------------------------------- /src/app/models/register.ts: -------------------------------------------------------------------------------- 1 | export interface RegisterModel { 2 | firstName: string; 3 | lastName: string; 4 | email: string; 5 | password: string; 6 | } -------------------------------------------------------------------------------- /src/app/models/rental.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface Rental{ 4 | carDailyPrice : number; 5 | carDescription : string; 6 | rentalId:number 7 | name:string 8 | brandName:string 9 | carId:number 10 | customerId:number 11 | firstName:string 12 | lastName:string 13 | rentDate:Date 14 | returnDate:Date 15 | 16 | imagePath:string; 17 | } -------------------------------------------------------------------------------- /src/app/models/singleResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./ResponseModel"; 2 | 3 | export interface SingleResponseModel extends ResponseModel{ 4 | data:T 5 | } -------------------------------------------------------------------------------- /src/app/models/tokenModel.ts: -------------------------------------------------------------------------------- 1 | export interface TokenModel{ 2 | token:string; 3 | expiration:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/user.ts: -------------------------------------------------------------------------------- 1 | import { Byte } from "@angular/compiler/src/util"; 2 | 3 | export interface User{ 4 | id:number, 5 | firstName:string, 6 | lastName:string, 7 | email:string, 8 | passwordHash: Byte[]; 9 | passwordSalt: Byte[]; 10 | status?:boolean 11 | findexPoint:number; 12 | } -------------------------------------------------------------------------------- /src/app/pipes/brand-filter.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { Brand } from '../models/brand'; 3 | 4 | @Pipe({ 5 | name: 'brandFilterPipe' 6 | }) 7 | export class BrandFilterPipePipe implements PipeTransform { 8 | 9 | transform(value: Brand[], filterBrandText: string): Brand[] { 10 | filterBrandText = filterBrandText ? filterBrandText.toLocaleLowerCase():"" 11 | return filterBrandText ? value.filter((b:Brand)=> 12 | b.brandName.toLocaleLowerCase().indexOf(filterBrandText) !== -1):value; 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/app/pipes/color-filter.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { Color } from '../models/color'; 3 | 4 | @Pipe({ 5 | name: 'colorFilterPipe' 6 | }) 7 | export class ColorFilterPipePipe implements PipeTransform { 8 | 9 | transform(value: Color[], filterColorText: string): Color[] { 10 | filterColorText = filterColorText ? filterColorText.toLocaleLowerCase():"" 11 | return filterColorText ? value.filter((c:Color)=> 12 | c.colorName.toLocaleLowerCase().indexOf(filterColorText) !== -1):value; 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/app/pipes/filter-pipe.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { Car } from '../models/car'; 3 | 4 | @Pipe({ 5 | name: 'filterPipe' 6 | }) 7 | export class FilterPipePipe implements PipeTransform { 8 | 9 | transform(value: Car[] , filterText:string): Car[] { 10 | filterText = filterText?filterText.toLocaleLowerCase():"" 11 | return filterText?value.filter((c:Car)=>c.modelName.toLocaleLowerCase().indexOf(filterText)!==-1):value; 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /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 | 10 | return value + (value*rate/100); 11 | } 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/app/pipes/vat-moon.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({ 4 | name: 'vatMoon' 5 | }) 6 | export class VatMoonPipe implements PipeTransform { 7 | 8 | transform(value: number, rate:number ): number { 9 | return value * 27 +(value*rate)/100; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/app/pipes/vat-week.pipe.ts: -------------------------------------------------------------------------------- 1 | import { createViewChild } from '@angular/compiler/src/core'; 2 | import { Pipe, PipeTransform } from '@angular/core'; 3 | 4 | @Pipe({ 5 | name: 'vatWeek' 6 | }) 7 | export class VatWeekPipe implements PipeTransform { 8 | 9 | transform(value: number, rate:number): number { 10 | return value * 6 +(value*rate)/100; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/app/services/auth.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { JwtHelperService } from '@auth0/angular-jwt'; 4 | import { LoginComponent } from '../components/login/login.component'; 5 | import { SingleResponseModel } from '../models/singleResponseModel'; 6 | import { TokenModel } from '../models/tokenModel'; 7 | import { LocalStorageService } from './local-storage.service'; 8 | 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class AuthService { 14 | 15 | userName:string; 16 | email:string 17 | userId:number 18 | roles:string 19 | expiration:Date 20 | 21 | jwtHelper:JwtHelperService = new JwtHelperService(); 22 | 23 | 24 | apiUrl = 'https://localhost:44379/api/auth/'; 25 | constructor( 26 | private httpClient:HttpClient, 27 | private localStorageService:LocalStorageService 28 | ) { 29 | // this.setUserInfo(); 30 | this.getUserId(); 31 | } 32 | 33 | login(loginModel:LoginComponent){ 34 | 35 | return this.httpClient.post>(this.apiUrl+"login",loginModel) 36 | } 37 | 38 | register(registerModel:LoginComponent){ 39 | 40 | return this.httpClient.post>(this.apiUrl+"register",registerModel) 41 | } 42 | 43 | isAuthenticated(){ 44 | if(localStorage.getItem("token")){ 45 | return true; 46 | } 47 | else{ 48 | return false; 49 | } 50 | } 51 | 52 | setUserName(){ 53 | var decoded = this.decodeToken(); 54 | var userName = Object.keys(decoded).filter(x=>x.endsWith("/name"))[0]; 55 | this.userName = decoded[userName]; 56 | } 57 | setEmail(){ 58 | var decoded = this.decodeToken(); 59 | var email = Object.keys(decoded).filter(x=>x.endsWith("email"))[0]; 60 | this.email = decoded[email]; 61 | } 62 | setUserId(){ 63 | var decoded = this.decodeToken(); 64 | var id = Object.keys(decoded).filter(x=>x.endsWith("/nameidentifier"))[0]; 65 | this.userId = Number(decoded[id]); 66 | } 67 | setUserRole(){ 68 | var decoded = this.decodeToken(); 69 | var role = Object.keys(decoded).filter(x=>x.endsWith("role"))[0]; 70 | this.roles = decoded[role]; 71 | } 72 | setExpration(){ 73 | var decoded = this.decodeToken(); 74 | var expiration = Object.keys(decoded).filter(x=>x.startsWith("exp"))[0] 75 | this.expiration = decoded[expiration] 76 | } 77 | setUserInfo(){ 78 | if (this.isAuthenticated()) { 79 | this.setUserName() 80 | this.setEmail(); 81 | this.setUserId(); 82 | this.setUserRole(); 83 | this.setExpration(); 84 | } 85 | } 86 | 87 | getUserName(){ 88 | return this.userName 89 | } 90 | getUserId(){ 91 | return this.userId 92 | } 93 | getEmail(){ 94 | return this.email 95 | } 96 | getRoles(){ 97 | return this.roles 98 | } 99 | getExpiration(){ 100 | return this.expiration 101 | } 102 | 103 | logOut(){ 104 | this.localStorageService.clear() 105 | } 106 | 107 | decodeToken(){ 108 | try{ 109 | return this.jwtHelper.decodeToken(this.localStorageService.get("Token")); 110 | } 111 | catch(Error){ 112 | return null; 113 | } 114 | } 115 | 116 | } 117 | -------------------------------------------------------------------------------- /src/app/services/brand.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import {HttpClient} from '@angular/common/http' 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from '../models/listResponseModel'; 5 | import { Brand } from '../models/brand'; 6 | import { ResponseModel } from '../models/ResponseModel'; 7 | import { ItemResponseModel } from '../models/itemResponseModel'; 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class brandService { 12 | 13 | apiUrl = "https://localhost:44379/api/brands/" 14 | constructor(private httpClient:HttpClient) { } 15 | 16 | 17 | getCars():Observable>{ 18 | return this.httpClient.get>(this.apiUrl + "getall" ); 19 | 20 | } 21 | 22 | 23 | add(brand : Brand):Observable{ 24 | return this.httpClient.post(this.apiUrl +"add",brand) 25 | } 26 | 27 | getById(brandId : number):Observable>{ 28 | let newPath = this.apiUrl + "brandid?id=" + brandId; 29 | return this.httpClient.get>(newPath); 30 | } 31 | update(brand : Brand) : Observable>{ 32 | let newPath = this.apiUrl + "update"; 33 | return this.httpClient.post>(newPath,brand); 34 | } 35 | delete(brand : Brand):Observable>{ 36 | let newPath = this.apiUrl + "delete"; 37 | return this.httpClient.post>(newPath,brand); 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/app/services/car.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import {HttpClient} from '@angular/common/http' 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from '../models/listResponseModel'; 5 | import { Car } from '../models/car'; 6 | import { ResponseModel } from '../models/ResponseModel'; 7 | import { ItemResponseModel } from '../models/itemResponseModel'; 8 | 9 | 10 | 11 | @Injectable({ 12 | providedIn: 'root' 13 | }) 14 | export class CarService { 15 | 16 | apiUrl = "https://localhost:44379/api/" 17 | 18 | 19 | constructor(private httpClient:HttpClient) { } 20 | 21 | //buradamı gelmiyordu evet markaya tıklayınca ilgili ıd gelmiyor service kısmında sanırsam yanlıs var sen hatayı al bakalım nereden tamnam 22 | //goole chrome da hatayı almamız lazım tamam hata Id nin null gelmesi tamam nasıl cözeceyiz bakalım tamam 23 | getCars():Observable>{ 24 | let newPath = this.apiUrl + "cars/getcardetails"; 25 | return this.httpClient.get>(newPath); 26 | } 27 | 28 | getCarsByBrand(brandId:number):Observable>{ 29 | let newPath = this.apiUrl + "cars/getbybrand?brandId="+brandId 30 | return this.httpClient.get>(newPath); 31 | } 32 | 33 | getCarsByColor(colorId:number):Observable>{ 34 | let newPath = this.apiUrl + "cars/getbycolor?colorId="+colorId 35 | return this.httpClient.get>(newPath); 36 | } 37 | 38 | getCarByBrandAndColor(brandId:Number,colorId:Number):Observable>{ 39 | let newPath = this.apiUrl +`cars/getbybrandandcolor?brandId=${brandId}&colorid=${colorId}`; 40 | return this.httpClient.get>(newPath); 41 | } 42 | 43 | getCarDetailsByCarId(carId:number):Observable>{ 44 | let newPath = this.apiUrl + "cars/getcardetail?carId="+carId; 45 | return this.httpClient.get>(newPath); 46 | } 47 | 48 | add(car:Car):Observable{ 49 | return this.httpClient.post(this.apiUrl+"cars/add",car) 50 | } 51 | 52 | update(car:Car):Observable>{ 53 | let newPath = this.apiUrl + "cars/update"; 54 | return this.httpClient.post>(newPath,car); 55 | } 56 | 57 | delete(car:Car):Observable>{ 58 | let newPath = this.apiUrl + "cars/delete"; 59 | return this.httpClient.post>(newPath,car); 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/app/services/carimage.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | 4 | import { Observable } from 'rxjs'; 5 | import { CarImage } from '../models/carImage'; 6 | import { ListResponseModel } from '../models/listResponseModel'; 7 | 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class CarimageService { 13 | 14 | apiUrl ='https://localhost:44379/api/' 15 | constructor( 16 | private httpClient:HttpClient, 17 | 18 | ) { } 19 | 20 | getCar():Observable>{ 21 | return this.httpClient.get>(this.apiUrl) 22 | } 23 | 24 | 25 | getCarImages(carId:number):Observable>{ 26 | let newPath = this.apiUrl + "carimages/getimagesbycarid?carId=" + carId 27 | return this.httpClient.get>(newPath) 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /src/app/services/color.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Color } from '../models/color'; 5 | import { ItemResponseModel } from '../models/itemResponseModel'; 6 | import { ListResponseModel } from '../models/listResponseModel'; 7 | import { ResponseModel } from '../models/ResponseModel'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class ColorService { 13 | 14 | apiUrl ='https://localhost:44379/api/colors/' 15 | constructor(private httpClient:HttpClient ) { } 16 | 17 | getColors():Observable>{ 18 | return this.httpClient.get>(this.apiUrl + "getall") 19 | } 20 | 21 | add(color : Color):Observable{ 22 | return this.httpClient.post(this.apiUrl + "add",color) 23 | } 24 | 25 | update(color:Color) : Observable>{ 26 | let newPath = this.apiUrl + "update"; 27 | return this.httpClient.post>(newPath,color); 28 | } 29 | 30 | delete(color:Color) : Observable>{ 31 | let newPath = this.apiUrl + "delete"; 32 | return this.httpClient.post>(newPath,color); 33 | } 34 | 35 | getbyId(colorId:number):Observable>{ 36 | let newPath = this.apiUrl + "colorıd?id=" + colorId; 37 | return this.httpClient.get>(newPath); 38 | } 39 | 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/app/services/customer.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Customer } from '../models/customer'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class CustomerService { 11 | 12 | apiUrl = "https://localhost:44379/api/"; 13 | 14 | constructor(private httpClient:HttpClient) { } 15 | getCustomer():Observable>{ 16 | return this.httpClient.get>(this.apiUrl) 17 | } 18 | 19 | 20 | getCustomerById(customerId : number) : Observable>{ 21 | let newPath = this.apiUrl + 'customers/getcustomerdetailbyid?customerId=' + customerId; 22 | return this.httpClient.get>(newPath); 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/app/services/local-storage.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable({ 4 | providedIn: 'root' 5 | }) 6 | export class LocalStorageService { 7 | 8 | constructor() { } 9 | 10 | 11 | set(key:string,data:string){ 12 | localStorage.setItem(key,data); 13 | } 14 | 15 | get(key:string){ 16 | return localStorage.getItem(key) 17 | } 18 | 19 | delete(key:string){ 20 | localStorage.removeItem(key) 21 | } 22 | 23 | 24 | clear(){ 25 | localStorage.clear(); 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/app/services/payment.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from '../models/listResponseModel'; 5 | import { Rental } from '../models/rental'; 6 | import { ResponseModel } from '../models/ResponseModel'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class PaymentService { 12 | 13 | apiUrl="https://localhost:44379/api"; 14 | constructor(private httpClient:HttpClient) { } 15 | 16 | 17 | creditPayment(rental:Rental,amount:number):Observable 18 | { 19 | let newPath=this.apiUrl+"/rentals/paymentadd"; 20 | // rental.returnDate= undefined; 21 | return this.httpClient.post(newPath,{payment:{amount:amount},rental:rental}) 22 | } 23 | 24 | getrentaldetailbycarId(rental:Rental):Observable>{ 25 | let newPath = this.apiUrl + "/rentals/getrentaldetailbycarId?carId="+rental; 26 | return this.httpClient.get>(newPath); 27 | } 28 | 29 | add(rental:Rental):Observable{ 30 | return this.httpClient.post(this.apiUrl+"/cards/add",rental) 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/app/services/rental.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Car } from '../models/car'; 5 | import { Customer } from '../models/customer'; 6 | import { ListResponseModel } from '../models/listResponseModel'; 7 | import { Rental } from '../models/rental'; 8 | import { ResponseModel } from '../models/ResponseModel'; 9 | 10 | 11 | @Injectable({ 12 | providedIn: 'root' 13 | }) 14 | export class RentalService { 15 | 16 | 17 | apiUrl='https://localhost:44379/api/' 18 | 19 | constructor(private httpClient:HttpClient) { } 20 | 21 | getRental():Observable>{ 22 | return this.httpClient.get>(this.apiUrl) 23 | } 24 | 25 | 26 | getRentalByCarId(carId : number):Observable>{ 27 | let newPath = this.apiUrl + 'rentals/getrentaldetailbycarId?carId=' + carId; 28 | return this.httpClient.get>(newPath); 29 | } 30 | 31 | addRental(rental:Rental){ 32 | let newPath = this.apiUrl + 'rentals/add' 33 | this.httpClient.post(newPath,rental).subscribe() 34 | } 35 | 36 | 37 | getCustomer():Observable>{ 38 | let apiUrl="https://localhost:44315/api/customers/getall" 39 | return this.httpClient.get>(apiUrl); 40 | } 41 | 42 | getCarDetailsByCarId(carId:number):Observable>{ 43 | let newPath = this.apiUrl + "cars/getcardetail?carId="+carId; 44 | return this.httpClient.get>(newPath); 45 | } 46 | 47 | add(rental:Rental):Observable{ 48 | return this.httpClient.post(this.apiUrl+"rentals/add",rental) 49 | } 50 | 51 | 52 | //payRental(rental:Rental, amount:number){ 53 | // let newPath = this.apiUrl + 'rentals/add'; 54 | // return this.httpClient.post(newPath,{payment:{amount:amount},rental:{rental}}) 55 | // } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/app/services/user.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { JwtHelperService } from '@auth0/angular-jwt'; 4 | import { Observable } from 'rxjs'; 5 | import { ItemResponseModel } from '../models/itemResponseModel'; 6 | import { ResponseModel } from '../models/ResponseModel'; 7 | import { User } from '../models/user'; 8 | import { LocalStorageService } from './local-storage.service'; 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class UserService { 14 | 15 | jwtHelper: JwtHelperService = new JwtHelperService(); 16 | token = this.localStorageService.get("Token"); 17 | 18 | apiUrl = 'https://localhost:44379/api/'; 19 | constructor( 20 | private httpClient:HttpClient, 21 | private localStorageService:LocalStorageService 22 | 23 | ) { } 24 | 25 | getByMail(email:string):Observable>{ 26 | return this.httpClient.get>(this.apiUrl+"users/getbymail?mail="+email); 27 | } 28 | 29 | getById(id:number):Observable>{ 30 | let newPath = this.apiUrl+ "users/getbyıd?userId=" + id; 31 | return this.httpClient.get>(newPath); 32 | } 33 | 34 | getUserId(){ 35 | let userId:number = parseInt(this.jwtHelper.decodeToken(this.token?.toString())["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"]); 36 | return userId; 37 | } 38 | 39 | addFindexPoint(userId: number): Observable { 40 | return this.httpClient.post( 41 | this.apiUrl + 'users/addfindexpoint', 42 | userId 43 | ); 44 | } 45 | 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/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/smtdeveloper/RentalCarProjectFrontend/60aecbf846f83ec9570e8f8ef00fad31b53b2912/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ReCar 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 | "strictNullChecks": false, 9 | "strict": true, 10 | "strictPropertyInitialization": false, 11 | "noImplicitReturns": true, 12 | "noFallthroughCasesInSwitch": true, 13 | "sourceMap": true, 14 | "declaration": false, 15 | "downlevelIteration": true, 16 | "experimentalDecorators": true, 17 | "moduleResolution": "node", 18 | "importHelpers": true, 19 | "target": "es2015", 20 | "module": "es2020", 21 | "lib": [ 22 | "es2018", 23 | "dom" 24 | ] 25 | }, 26 | "angularCompilerOptions": { 27 | "enableI18nLegacyMessageIdFormat": false, 28 | "strictInjectionParameters": true, 29 | "strictInputAccessModifiers": true, 30 | "strictTemplates": true 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": [ 4 | "codelyzer" 5 | ], 6 | "rules": { 7 | "align": { 8 | "options": [ 9 | "parameters", 10 | "statements" 11 | ] 12 | }, 13 | "array-type": false, 14 | "arrow-return-shorthand": true, 15 | "curly": true, 16 | "deprecation": { 17 | "severity": "warning" 18 | }, 19 | "eofline": true, 20 | "import-blacklist": [ 21 | true, 22 | "rxjs/Rx" 23 | ], 24 | "import-spacing": true, 25 | "indent": { 26 | "options": [ 27 | "spaces" 28 | ] 29 | }, 30 | "max-classes-per-file": false, 31 | "max-line-length": [ 32 | true, 33 | 140 34 | ], 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-console": [ 47 | true, 48 | "debug", 49 | "info", 50 | "time", 51 | "timeEnd", 52 | "trace" 53 | ], 54 | "no-empty": false, 55 | "no-inferrable-types": [ 56 | true, 57 | "ignore-params" 58 | ], 59 | "no-non-null-assertion": true, 60 | "no-redundant-jsdoc": true, 61 | "no-switch-case-fall-through": true, 62 | "no-var-requires": false, 63 | "object-literal-key-quotes": [ 64 | true, 65 | "as-needed" 66 | ], 67 | "quotemark": [ 68 | true, 69 | "single" 70 | ], 71 | "semicolon": { 72 | "options": [ 73 | "always" 74 | ] 75 | }, 76 | "space-before-function-paren": { 77 | "options": { 78 | "anonymous": "never", 79 | "asyncArrow": "always", 80 | "constructor": "never", 81 | "method": "never", 82 | "named": "never" 83 | } 84 | }, 85 | "typedef": [ 86 | true, 87 | "call-signature" 88 | ], 89 | "typedef-whitespace": { 90 | "options": [ 91 | { 92 | "call-signature": "nospace", 93 | "index-signature": "nospace", 94 | "parameter": "nospace", 95 | "property-declaration": "nospace", 96 | "variable-declaration": "nospace" 97 | }, 98 | { 99 | "call-signature": "onespace", 100 | "index-signature": "onespace", 101 | "parameter": "onespace", 102 | "property-declaration": "onespace", 103 | "variable-declaration": "onespace" 104 | } 105 | ] 106 | }, 107 | "variable-name": { 108 | "options": [ 109 | "ban-keywords", 110 | "check-format", 111 | "allow-pascal-case" 112 | ] 113 | }, 114 | "whitespace": { 115 | "options": [ 116 | "check-branch", 117 | "check-decl", 118 | "check-operator", 119 | "check-separator", 120 | "check-type", 121 | "check-typecast" 122 | ] 123 | }, 124 | "component-class-suffix": true, 125 | "contextual-lifecycle": true, 126 | "directive-class-suffix": true, 127 | "no-conflicting-lifecycle": true, 128 | "no-host-metadata-property": true, 129 | "no-input-rename": true, 130 | "no-inputs-metadata-property": true, 131 | "no-output-native": true, 132 | "no-output-on-prefix": true, 133 | "no-output-rename": true, 134 | "no-outputs-metadata-property": true, 135 | "template-banana-in-box": true, 136 | "template-no-negated-async": true, 137 | "use-lifecycle-interface": true, 138 | "use-pipe-transform-interface": true, 139 | "directive-selector": [ 140 | true, 141 | "attribute", 142 | "app", 143 | "camelCase" 144 | ], 145 | "component-selector": [ 146 | true, 147 | "element", 148 | "app", 149 | "kebab-case" 150 | ] 151 | } 152 | } 153 | --------------------------------------------------------------------------------