├── .browserslistrc ├── .editorconfig ├── .gitignore ├── .vscode └── launch.json ├── LICENSE ├── README.md ├── angular.json ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.css │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── components │ │ ├── brand │ │ │ ├── brand-add │ │ │ │ ├── brand-add.component.css │ │ │ │ ├── brand-add.component.html │ │ │ │ └── brand-add.component.ts │ │ │ ├── brand-list │ │ │ │ ├── brand-list.component.css │ │ │ │ ├── brand-list.component.html │ │ │ │ └── brand-list.component.ts │ │ │ ├── brand-update │ │ │ │ ├── brand-update.component.css │ │ │ │ ├── brand-update.component.html │ │ │ │ └── brand-update.component.ts │ │ │ ├── brand.component.css │ │ │ ├── brand.component.html │ │ │ └── brand.component.ts │ │ ├── car-detail │ │ │ ├── car-detail.component.css │ │ │ ├── car-detail.component.html │ │ │ └── car-detail.component.ts │ │ ├── car │ │ │ ├── car-add │ │ │ │ ├── car-add.component.css │ │ │ │ ├── car-add.component.html │ │ │ │ └── car-add.component.ts │ │ │ ├── car-list │ │ │ │ ├── car-list.component.css │ │ │ │ ├── car-list.component.html │ │ │ │ └── car-list.component.ts │ │ │ ├── car-update │ │ │ │ ├── car-update.component.css │ │ │ │ ├── car-update.component.html │ │ │ │ └── car-update.component.ts │ │ │ ├── car.component.css │ │ │ ├── car.component.html │ │ │ └── car.component.ts │ │ ├── color │ │ │ ├── color-add │ │ │ │ ├── color-add.component.css │ │ │ │ ├── color-add.component.html │ │ │ │ └── color-add.component.ts │ │ │ ├── color-list │ │ │ │ ├── color-list.component.css │ │ │ │ ├── color-list.component.html │ │ │ │ └── color-list.component.ts │ │ │ ├── color-update │ │ │ │ ├── color-update.component.css │ │ │ │ ├── color-update.component.html │ │ │ │ └── color-update.component.ts │ │ │ ├── color.component.css │ │ │ ├── color.component.html │ │ │ └── color.component.ts │ │ ├── customer │ │ │ ├── customer.component.css │ │ │ ├── customer.component.html │ │ │ └── customer.component.ts │ │ ├── footer │ │ │ ├── footer.component.css │ │ │ ├── footer.component.html │ │ │ ├── footer.component.spec.ts │ │ │ └── footer.component.ts │ │ ├── home │ │ │ ├── home.component.css │ │ │ ├── home.component.html │ │ │ └── home.component.ts │ │ ├── login │ │ │ ├── login.component.css │ │ │ ├── login.component.html │ │ │ └── login.component.ts │ │ ├── navi │ │ │ ├── navi.component.css │ │ │ ├── navi.component.html │ │ │ ├── navi.component.ts │ │ │ └── user-menu │ │ │ │ ├── user-menu.component.css │ │ │ │ ├── user-menu.component.html │ │ │ │ └── user-menu.component.ts │ │ ├── payment │ │ │ ├── card-saved │ │ │ │ ├── card-saved.component.css │ │ │ │ ├── card-saved.component.html │ │ │ │ └── card-saved.component.ts │ │ │ ├── payment.component.css │ │ │ ├── payment.component.html │ │ │ └── payment.component.ts │ │ ├── profile │ │ │ ├── profile.component.css │ │ │ ├── profile.component.html │ │ │ └── profile.component.ts │ │ ├── register │ │ │ ├── register.component.css │ │ │ ├── register.component.html │ │ │ └── register.component.ts │ │ └── rental │ │ │ ├── rental.component.css │ │ │ ├── rental.component.html │ │ │ └── rental.component.ts │ ├── guards │ │ └── login.guard.ts │ ├── interceptors │ │ └── auth.interceptor.ts │ ├── models │ │ ├── brand │ │ │ └── brand.ts │ │ ├── car │ │ │ ├── car.ts │ │ │ └── carDetail.ts │ │ ├── carImage │ │ │ └── carImage.ts │ │ ├── color │ │ │ └── color.ts │ │ ├── customer │ │ │ └── customer.ts │ │ ├── listResponseModel.ts │ │ ├── login │ │ │ └── loginModel.ts │ │ ├── payment │ │ │ └── payment.ts │ │ ├── register │ │ │ └── registerModel.ts │ │ ├── rental │ │ │ ├── rental.ts │ │ │ └── rentalDetail.ts │ │ ├── responseModel.ts │ │ ├── singleResponseModel.ts │ │ └── token │ │ │ └── tokenModel.ts │ ├── pipes │ │ ├── filter-brand.pipe.ts │ │ ├── filter-car.pipe.ts │ │ ├── filter-color.pipe.ts │ │ └── vat-added.pipe.ts │ └── services │ │ ├── auth.service.ts │ │ ├── brand.service.ts │ │ ├── car-image.service.ts │ │ ├── car.service.ts │ │ ├── color.service.ts │ │ ├── customer.service.ts │ │ ├── local-storage.service.ts │ │ ├── payment.service.ts │ │ └── rental.service.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "pwa-chrome", 9 | "request": "launch", 10 | "name": "Launch Chrome against localhost", 11 | "url": "http://localhost:4201", 12 | "webRoot": "${workspaceFolder}" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Sahil Rzayev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # *Car Rental Frontend* :oncoming_automobile: :key: 2 | --- 3 | ![p1](https://user-images.githubusercontent.com/58303745/115150450-818e3680-a079-11eb-969d-fe0cc43e996a.jpg) 4 | 5 | ![p2](https://user-images.githubusercontent.com/58303745/115150166-42abb100-a078-11eb-96d2-f885dc4a2180.jpg) 6 | 7 | ![p3 ](https://user-images.githubusercontent.com/58303745/115150170-46d7ce80-a078-11eb-921a-b5d06884ba51.jpg) 8 | --- 9 | --- 10 | ## Contact Me 📫 11 | - [![Gmail Badge](https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white)]() sahilrzayev200d@gmail.com 12 | - [![Linkedin Badge](https://img.shields.io/badge/sahilrzayev-follow%20on%20linkedin-blue?style=for-the-badge&logo=linkedin)](https://www.linkedin.com/in/sahilrzayev) 13 | --- 14 | --- 15 | --- 16 | --- 17 | 18 | ## Ana sayfa - Register ve Login butonları eklendi: 19 | 20 | ![1(ana sayfa register ve login)](https://user-images.githubusercontent.com/58303745/114320726-6034c400-9b28-11eb-8a2d-fc5a5262ea39.jpg) 21 | 22 | --- 23 | --- 24 | 25 | ## Login ve Register: 26 | 27 | ![3 1(register)](https://user-images.githubusercontent.com/58303745/114320779-a853e680-9b28-11eb-95de-f5bcd9908922.jpg) 28 | 29 | ![2(login)](https://user-images.githubusercontent.com/58303745/114320782-a9851380-9b28-11eb-8d12-26caacff4ea9.jpg) 30 | 31 | --- 32 | --- 33 | 34 | ## Kullanıcı kayıt olunca direk siteye giriyor ve default olarak sistem tarafından findeks puanı ekleniyor ve siteye giren kullanıcı mı yönetici mi onu da yazıyor 35 | 36 | ![4(kullanıcı kayıt olunca direk siteye giriyor ve default olarak sistem tarafından findeks puanı atıyor)](https://user-images.githubusercontent.com/58303745/114320815-d46f6780-9b28-11eb-8d24-4e094aaaa38f.jpg) 37 | 38 | --- 39 | --- 40 | 41 | ## Filter 42 | 43 | ![5(filtreleme)](https://user-images.githubusercontent.com/58303745/114320858-11d3f500-9b29-11eb-844b-e8839635cc69.jpg) 44 | 45 | --- 46 | --- 47 | 48 | ## Findeks 49 | 50 | ![6(findeks puanı yetersiz)](https://user-images.githubusercontent.com/58303745/114320888-329c4a80-9b29-11eb-93ab-ad24034241ca.jpg) 51 | 52 | ![7(findeks yeterliyse kiralama butonu oluyor)](https://user-images.githubusercontent.com/58303745/114320890-34660e00-9b29-11eb-894d-f1579e63351a.jpg) 53 | 54 | --- 55 | --- 56 | 57 | ## Kiralama 58 | 59 | ![image](https://user-images.githubusercontent.com/58303745/114320922-624b5280-9b29-11eb-9636-85d6a58b8975.png) 60 | 61 | --- 62 | --- 63 | 64 | ## Ödeme sayfası 65 | 66 | ![9](https://user-images.githubusercontent.com/58303745/114320938-7d1dc700-9b29-11eb-96d2-1346189f61bd.jpg) 67 | 68 | --- 69 | --- 70 | 71 | ## Kullanıcı bilgilerini güncelleme 72 | 73 | ![11(kullanıcı güncelle)](https://user-images.githubusercontent.com/58303745/115144828-d2913100-a05f-11eb-922d-45655a3cdac0.jpg) 74 | 75 | ![12(şifreler eşleşmiyor)](https://user-images.githubusercontent.com/58303745/115144829-d329c780-a05f-11eb-921f-5f8e6ace422d.jpg) 76 | 77 | ![13(bilgiler güncellendi mesajı)](https://user-images.githubusercontent.com/58303745/115144830-d3c25e00-a05f-11eb-9f82-320bfa5c29ea.jpg) 78 | 79 | ![14(çıkış yapıldı mesajı)](https://user-images.githubusercontent.com/58303745/115144824-d0c76d80-a05f-11eb-9b17-3b90253a5c3a.jpg) 80 | 81 | --- 82 | --- 83 | 84 | ## Siteye giriş yaptığımızda 85 | 86 | ![15(giriş yaptığımızda parola yanlış olursa)](https://user-images.githubusercontent.com/58303745/115144921-3a477c00-a060-11eb-86a4-a6f990df4840.jpg) 87 | 88 | ![16(başarıyla giriş yapıldı mesajı)](https://user-images.githubusercontent.com/58303745/115144924-3d426c80-a060-11eb-8dfc-4560ccc428b9.jpg) 89 | 90 | --- 91 | --- 92 | 93 | ## Kişinin kullanıcı yoksa yönetici olduğunu sağ üstde belirtiyor ve eğer giriş yapan yöneticiyse(admin) *İşlemler* butonu üst kısımda gözüküyor ve burada yönetici araba,marka ve renk silme,güncelleme,ekleme işlemleri yapıyor 94 | 95 | ![17(Kişinin kullanıcı yoksa yönetici olduğunu sağ üstde belirtiyor ve admin diye işlmeler butonu da geliyor)](https://user-images.githubusercontent.com/58303745/114320967-a2123a00-9b29-11eb-8a6f-92074c9afc07.jpg) 96 | 97 | ![18(araba crud)](https://user-images.githubusercontent.com/58303745/114320971-a4749400-9b29-11eb-867c-358884923632.jpg) 98 | 99 | ![19(marka crud)](https://user-images.githubusercontent.com/58303745/114320987-b48c7380-9b29-11eb-9b39-6c54a1de3976.jpg) 100 | 101 | ![20(renk crud)](https://user-images.githubusercontent.com/58303745/114321047-e4d41200-9b29-11eb-8f6d-5bf81288ab6b.jpg) 102 | 103 | ![21(araba ekleme marka brand select)](https://user-images.githubusercontent.com/58303745/114321049-e56ca880-9b29-11eb-8ec3-5392b8ac929a.jpg) 104 | 105 | ![22](https://user-images.githubusercontent.com/58303745/114321052-e7cf0280-9b29-11eb-9679-cadca6607b98.jpg) 106 | 107 | ![23](https://user-images.githubusercontent.com/58303745/114321056-e9002f80-9b29-11eb-971b-2200d009daca.jpg) 108 | 109 | ![24 1](https://user-images.githubusercontent.com/58303745/114321021-d4bc3280-9b29-11eb-9a42-dbed72ae2d8b.jpg) 110 | 111 | ![24](https://user-images.githubusercontent.com/58303745/114321023-d5ed5f80-9b29-11eb-9020-fd03269a71e4.jpg) 112 | 113 | ![25](https://user-images.githubusercontent.com/58303745/114321024-d71e8c80-9b29-11eb-8865-6b2dfba67c37.jpg) 114 | 115 | ![26](https://user-images.githubusercontent.com/58303745/114321026-d84fb980-9b29-11eb-99c3-fb31ee434243.jpg) 116 | 117 | ![27](https://user-images.githubusercontent.com/58303745/114321027-d980e680-9b29-11eb-85e5-5fcabdf6de35.jpg) 118 | 119 | ![28](https://user-images.githubusercontent.com/58303745/114321029-da197d00-9b29-11eb-958c-269432b29eb9.jpg) 120 | 121 | ![29](https://user-images.githubusercontent.com/58303745/114321031-db4aaa00-9b29-11eb-9441-948f8e0a6f53.jpg) 122 | 123 | ![30](https://user-images.githubusercontent.com/58303745/114321032-db4aaa00-9b29-11eb-93b9-2aeb440168dd.jpg) 124 | 125 | ![31](https://user-images.githubusercontent.com/58303745/114321034-dc7bd700-9b29-11eb-977b-08808bd15273.jpg) 126 | 127 | ![32](https://user-images.githubusercontent.com/58303745/114321035-dd146d80-9b29-11eb-86bc-383084e7431c.jpg) 128 | 129 | ![33](https://user-images.githubusercontent.com/58303745/114321036-ddad0400-9b29-11eb-8360-82b1ba88a837.jpg) 130 | 131 | ![34](https://user-images.githubusercontent.com/58303745/114321037-de459a80-9b29-11eb-85dc-48375ccaf592.jpg) 132 | 133 | ![35](https://user-images.githubusercontent.com/58303745/114321038-df76c780-9b29-11eb-8aa6-bdf27d35ca9a.jpg) 134 | 135 | ![36](https://user-images.githubusercontent.com/58303745/114321039-e00f5e00-9b29-11eb-8117-77a6e61231da.jpg) 136 | 137 | ![37](https://user-images.githubusercontent.com/58303745/114321041-e1408b00-9b29-11eb-8723-72a8e5bdf77d.jpg) 138 | 139 | ![38](https://user-images.githubusercontent.com/58303745/114321044-e1d92180-9b29-11eb-97ff-1ae6d11cc00f.jpg) 140 | 141 | ![39](https://user-images.githubusercontent.com/58303745/114321045-e30a4e80-9b29-11eb-83fc-74e1951704fb.jpg) 142 | 143 | ![40](https://user-images.githubusercontent.com/58303745/114321046-e3a2e500-9b29-11eb-986c-3148221a070c.jpg) 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | ## License 154 | 155 | Distributed under the MIT License. See `LICENSE` for more information. 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.4. 170 | 171 | ## Development server 172 | 173 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 174 | 175 | ## Code scaffolding 176 | 177 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 178 | 179 | ## Build 180 | 181 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 182 | 183 | ## Running unit tests 184 | 185 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 186 | 187 | ## Running end-to-end tests 188 | 189 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 190 | 191 | ## Further help 192 | 193 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 194 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "cli": { 4 | "analytics": "2d16aef4-8a07-48aa-8858-2787db060609" 5 | }, 6 | "version": 1, 7 | "newProjectRoot": "projects", 8 | "projects": { 9 | "CarRentalFrontend": { 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/CarRentalFrontend", 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/bootstrap-icons/font/bootstrap-icons.css", 36 | "./node_modules/ngx-toastr/toastr.css", 37 | "src/styles.css" 38 | ], 39 | "scripts": [ 40 | "./node_modules/jquery/dist/jquery.min.js", 41 | "./node_modules/bootstrap/dist/js/bootstrap.min.js" 42 | ] 43 | }, 44 | "configurations": { 45 | "production": { 46 | "fileReplacements": [ 47 | { 48 | "replace": "src/environments/environment.ts", 49 | "with": "src/environments/environment.prod.ts" 50 | } 51 | ], 52 | "optimization": true, 53 | "outputHashing": "all", 54 | "sourceMap": false, 55 | "namedChunks": false, 56 | "extractLicenses": true, 57 | "vendorChunk": false, 58 | "buildOptimizer": true, 59 | "budgets": [ 60 | { 61 | "type": "initial", 62 | "maximumWarning": "500kb", 63 | "maximumError": "1mb" 64 | }, 65 | { 66 | "type": "anyComponentStyle", 67 | "maximumWarning": "2kb", 68 | "maximumError": "4kb" 69 | } 70 | ] 71 | } 72 | } 73 | }, 74 | "serve": { 75 | "builder": "@angular-devkit/build-angular:dev-server", 76 | "options": { 77 | "browserTarget": "CarRentalFrontend:build" 78 | }, 79 | "configurations": { 80 | "production": { 81 | "browserTarget": "CarRentalFrontend:build:production" 82 | } 83 | } 84 | }, 85 | "extract-i18n": { 86 | "builder": "@angular-devkit/build-angular:extract-i18n", 87 | "options": { 88 | "browserTarget": "CarRentalFrontend:build" 89 | } 90 | }, 91 | "test": { 92 | "builder": "@angular-devkit/build-angular:karma", 93 | "options": { 94 | "main": "src/test.ts", 95 | "polyfills": "src/polyfills.ts", 96 | "tsConfig": "tsconfig.spec.json", 97 | "karmaConfig": "karma.conf.js", 98 | "assets": [ 99 | "src/favicon.ico", 100 | "src/assets" 101 | ], 102 | "styles": [ 103 | "src/styles.css" 104 | ], 105 | "scripts": [] 106 | } 107 | }, 108 | "lint": { 109 | "builder": "@angular-devkit/build-angular:tslint", 110 | "options": { 111 | "tsConfig": [ 112 | "tsconfig.app.json", 113 | "tsconfig.spec.json", 114 | "e2e/tsconfig.json" 115 | ], 116 | "exclude": [ 117 | "**/node_modules/**" 118 | ] 119 | } 120 | }, 121 | "e2e": { 122 | "builder": "@angular-devkit/build-angular:protractor", 123 | "options": { 124 | "protractorConfig": "e2e/protractor.conf.js", 125 | "devServerTarget": "CarRentalFrontend:serve" 126 | }, 127 | "configurations": { 128 | "production": { 129 | "devServerTarget": "CarRentalFrontend:serve:production" 130 | } 131 | } 132 | } 133 | } 134 | } 135 | }, 136 | "defaultProject": "CarRentalFrontend" 137 | } 138 | -------------------------------------------------------------------------------- /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('CarRentalFrontend app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | async navigateTo(): Promise { 5 | return browser.get(browser.baseUrl); 6 | } 7 | 8 | async getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../out-tsc/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/CarRentalFrontend'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "car-rental-frontend", 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.7", 15 | "@angular/common": "~11.2.5", 16 | "@angular/compiler": "~11.2.5", 17 | "@angular/core": "~11.2.5", 18 | "@angular/forms": "~11.2.5", 19 | "@angular/platform-browser": "~11.2.5", 20 | "@angular/platform-browser-dynamic": "~11.2.5", 21 | "@angular/router": "~11.2.5", 22 | "bootstrap": "^5.0.0-beta3", 23 | "bootstrap-icons": "^1.4.1", 24 | "jquery": "^3.6.0", 25 | "ngx-toastr": "^13.2.1", 26 | "rxjs": "~6.6.0", 27 | "swiper": "^6.5.6", 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.4", 34 | "@angular/compiler-cli": "~11.2.5", 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 { BrandListComponent } from './components/brand/brand-list/brand-list.component'; 4 | import { BrandUpdateComponent } from './components/brand/brand-update/brand-update.component'; 5 | import { CarDetailComponent } from './components/car-detail/car-detail.component'; 6 | import { CarAddComponent } from './components/car/car-add/car-add.component'; 7 | import { CarListComponent } from './components/car/car-list/car-list.component'; 8 | import { CarUpdateComponent } from './components/car/car-update/car-update.component'; 9 | import { CarComponent } from './components/car/car.component'; 10 | import { ColorListComponent } from './components/color/color-list/color-list.component'; 11 | import { ColorUpdateComponent } from './components/color/color-update/color-update.component'; 12 | import { CustomerComponent } from './components/customer/customer.component'; 13 | import { HomeComponent } from './components/home/home.component'; 14 | import { LoginComponent } from './components/login/login.component'; 15 | import { PaymentComponent } from './components/payment/payment.component'; 16 | import { ProfileComponent } from './components/profile/profile.component'; 17 | import { RegisterComponent } from './components/register/register.component'; 18 | import { LoginGuard } from './guards/login.guard'; 19 | 20 | const routes: Routes = [ 21 | {path:"",pathMatch:"full",component:CarComponent}, 22 | {path:"cars",component:CarComponent}, 23 | {path:"cars/color/:colorId",component:CarComponent}, 24 | {path:"cars/brand/:brandId",component:CarComponent}, 25 | {path:"cars/brand/:brandId/color/:colorId",component:CarComponent}, 26 | {path:"cars/cardetail/:carId",component:CarDetailComponent}, 27 | {path:"cars/:brandId/:colorId", component: CarComponent }, 28 | {path:"cars/filter/:brandId/:colorId", component:CarComponent}, 29 | {path:"payment", component:PaymentComponent,canActivate:[LoginGuard]}, 30 | {path:"customer", component:CustomerComponent}, 31 | 32 | {path:"carOperations/update/:carId", component:CarUpdateComponent,canActivate:[LoginGuard]}, 33 | {path:"carOperations", component:CarListComponent,canActivate:[LoginGuard]}, 34 | //{path:"carAdd", component:CarAddComponent}, 35 | {path:"colorOperations/update/:colorId", component:ColorUpdateComponent,canActivate:[LoginGuard]}, 36 | {path:"colorOperations", component:ColorListComponent,canActivate:[LoginGuard]}, 37 | {path:"brandOperations/update/:brandId", component:BrandUpdateComponent,canActivate:[LoginGuard]}, 38 | {path:"brandOperations", component:BrandListComponent}, 39 | {path:"login", component:LoginComponent}, 40 | {path:"register", component:RegisterComponent}, 41 | {path:"profile", component:ProfileComponent}, 42 | 43 | {path:"home", component:HomeComponent} 44 | //{path:"cars/cardetail/:carId/rental",component:RentalComponent} 45 | 46 | //{path:"cars/cardetail/rental/:carId",component:RentalComponent} 47 | ]; 48 | 49 | @NgModule({ 50 | imports: [RouterModule.forRoot(routes)], 51 | exports: [RouterModule] 52 | }) 53 | export class AppRoutingModule { } -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/app.component.css -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 |
6 |
7 | -------------------------------------------------------------------------------- /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 'CarRentalFrontend'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('CarRentalFrontend'); 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('CarRentalFrontend app is running!'); 34 | }); 35 | }); -------------------------------------------------------------------------------- /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 = 'CarRentalFrontend'; 10 | user: string = "Sahil Rzayev"; 11 | } -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import {HttpClientModule, HTTP_INTERCEPTORS} from '@angular/common/http' 4 | import {FormsModule,ReactiveFormsModule} from "@angular/forms"; 5 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 6 | import { SwiperModule } from 'swiper/angular'; 7 | 8 | 9 | import { AppRoutingModule } from './app-routing.module'; 10 | import { AppComponent } from './app.component'; 11 | import { CarComponent } from './components/car/car.component'; 12 | import { BrandComponent } from './components/brand/brand.component'; 13 | import { ColorComponent } from './components/color/color.component'; 14 | import { CustomerComponent } from './components/customer/customer.component'; 15 | import { RentalComponent } from './components/rental/rental.component'; 16 | import { NaviComponent } from './components/navi/navi.component'; 17 | import { CarDetailComponent } from './components/car-detail/car-detail.component'; 18 | import { VatAddedPipe } from './pipes/vat-added.pipe'; 19 | import { FilterBrandPipe } from './pipes/filter-brand.pipe'; 20 | import { FilterColorPipe } from './pipes/filter-color.pipe'; 21 | import { FilterCarPipe } from './pipes/filter-car.pipe'; 22 | import { PaymentComponent } from './components/payment/payment.component'; 23 | 24 | import {ToastrModule} from "ngx-toastr"; 25 | import { CarAddComponent } from './components/car/car-add/car-add.component'; 26 | import { CarUpdateComponent } from './components/car/car-update/car-update.component'; 27 | import { ColorAddComponent } from './components/color/color-add/color-add.component'; 28 | import { ColorUpdateComponent } from './components/color/color-update/color-update.component'; 29 | import { BrandAddComponent } from './components/brand/brand-add/brand-add.component'; 30 | import { BrandUpdateComponent } from './components/brand/brand-update/brand-update.component'; 31 | import { BrandListComponent } from './components/brand/brand-list/brand-list.component'; 32 | import { ColorListComponent } from './components/color/color-list/color-list.component'; 33 | import { CarListComponent } from './components/car/car-list/car-list.component'; 34 | import { LoginComponent } from './components/login/login.component'; 35 | import { RegisterComponent } from './components/register/register.component'; 36 | import { AuthInterceptor } from './interceptors/auth.interceptor'; 37 | import { ProfileComponent } from './components/profile/profile.component'; 38 | import { UserMenuComponent } from './components/navi/user-menu/user-menu.component'; 39 | import { HomeComponent } from './components/home/home.component'; 40 | import { CardSavedComponent } from './components/payment/card-saved/card-saved.component'; 41 | import { FooterComponent } from './components/footer/footer.component'; 42 | 43 | 44 | @NgModule({ 45 | declarations: [ 46 | AppComponent, 47 | CarComponent, 48 | BrandComponent, 49 | ColorComponent, 50 | CustomerComponent, 51 | RentalComponent, 52 | NaviComponent, 53 | CarDetailComponent, 54 | VatAddedPipe, 55 | FilterBrandPipe, 56 | FilterColorPipe, 57 | FilterCarPipe, 58 | PaymentComponent, 59 | CarAddComponent, 60 | CarUpdateComponent, 61 | ColorAddComponent, 62 | ColorUpdateComponent, 63 | BrandAddComponent, 64 | BrandUpdateComponent, 65 | BrandListComponent, 66 | ColorListComponent, 67 | CarListComponent, 68 | LoginComponent, 69 | RegisterComponent, 70 | ProfileComponent, 71 | UserMenuComponent, 72 | HomeComponent, 73 | CardSavedComponent, 74 | FooterComponent 75 | ], 76 | imports: [ 77 | BrowserModule, 78 | AppRoutingModule, 79 | HttpClientModule, 80 | FormsModule, 81 | ReactiveFormsModule, 82 | BrowserAnimationsModule, 83 | SwiperModule, 84 | ToastrModule.forRoot({ 85 | positionClass:"toast-bottom-right" 86 | }) 87 | ], 88 | providers: [ 89 | {provide:HTTP_INTERCEPTORS,useClass:AuthInterceptor,multi:true} 90 | ], 91 | bootstrap: [AppComponent] 92 | }) 93 | export class AppModule { } -------------------------------------------------------------------------------- /src/app/components/brand/brand-add/brand-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/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 |
Marka ekle
6 |
7 |
8 |
9 |
10 |
11 | 18 |
19 |
20 |
21 |
22 | 26 |
27 |
28 |
29 | 30 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-add/brand-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder,FormControl,Validators} from "@angular/forms" 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { BrandService } from 'src/app/services/brand.service'; 6 | 7 | @Component({ 8 | selector: 'app-brand-add', 9 | templateUrl: './brand-add.component.html', 10 | styleUrls: ['./brand-add.component.css'] 11 | }) 12 | export class BrandAddComponent implements OnInit { 13 | 14 | brandAddForm:FormGroup; 15 | constructor(private formBuilder:FormBuilder, 16 | private brandService:BrandService, 17 | private toastrService:ToastrService, 18 | private router:Router 19 | ) { } 20 | 21 | ngOnInit(): void { 22 | this.createBrandAddForm(); 23 | } 24 | 25 | createBrandAddForm(){ 26 | this.brandAddForm=this.formBuilder.group({ 27 | // brandId:["",Validators.required], 28 | brandName:["",Validators.required] 29 | }) 30 | } 31 | 32 | add(){ 33 | if(this.brandAddForm.valid){ 34 | let brandModel=Object.assign({},this.brandAddForm.value) 35 | this.brandService.add(brandModel).subscribe(response=>{ 36 | this.brandService.getBrands(); 37 | this.toastrService.success(response.message,"Başarılı") 38 | // setTimeout(function(){ 39 | // location.reload() 40 | // },3*20000); 41 | this.router.navigate(["brandOperations"]).then(r=>window.location.reload()) 42 | },responseError=>{ 43 | if (responseError.error.Errors.length>0){ 44 | for (let i = 0; i < responseError.error.Errors.length; i++) { 45 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage,"Doğrulama hatası") 46 | } 47 | } 48 | }) 49 | }else{ 50 | this.toastrService.warning("Formunuz eksik","Dikkat!") 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-list/brand-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/brand/brand-list/brand-list.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand-list/brand-list.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 40 | 41 | 42 |
IdMarka
{{ brand.brandId }}{{ brand.brandName }} 27 |   33 | 39 |
43 | 44 | 57 | 68 |
69 |
70 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-list/brand-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute, Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Brand } from 'src/app/models/brand/brand'; 5 | import { BrandService } from 'src/app/services/brand.service'; 6 | 7 | @Component({ 8 | selector: 'app-brand-list', 9 | templateUrl: './brand-list.component.html', 10 | styleUrls: ['./brand-list.component.css'] 11 | }) 12 | export class BrandListComponent implements OnInit { 13 | 14 | brands: Brand[]; 15 | 16 | constructor( 17 | private brandService: BrandService, 18 | private toastrService: ToastrService, 19 | private router: Router 20 | ) { } 21 | 22 | ngOnInit(): void { 23 | this.getBrands() 24 | } 25 | 26 | getBrands() { 27 | this.brandService.getBrands().subscribe(response => { 28 | this.brands = response.data; 29 | }) 30 | } 31 | 32 | delete(brand: Brand) { 33 | this.brandService.delete(brand).subscribe(response => { 34 | this.toastrService.success("Başarıyla silindi", "Başarılı") 35 | this.getBrands() 36 | this.router.navigate(["brandOperations"]) 37 | }, responseError => { 38 | if (responseError.error.Errors.length > 0) { 39 | for (let i = 0; i < responseError.error.Errors.length; i++) { 40 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage, "Doğrulama hatası") 41 | } 42 | } 43 | }) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-update/brand-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/brand/brand-update/brand-update.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand-update/brand-update.component.html: -------------------------------------------------------------------------------- 1 | 38 |
39 |
40 |
41 |
42 |
Marka güncelle
43 |
44 |
45 |
46 |
47 |
48 | 54 |
55 |
56 |
57 |
58 | 62 |
63 |
64 |
65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/app/components/brand/brand-update/brand-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Brand } from 'src/app/models/brand/brand'; 3 | import { BrandService } from 'src/app/services/brand.service'; 4 | import {FormGroup,FormBuilder,FormControl,Validators} from "@angular/forms" 5 | import { ToastrService } from 'ngx-toastr'; 6 | import { ActivatedRoute, Router } from '@angular/router'; 7 | 8 | @Component({ 9 | selector: 'app-brand-update', 10 | templateUrl: './brand-update.component.html', 11 | styleUrls: ['./brand-update.component.css'] 12 | }) 13 | export class BrandUpdateComponent implements OnInit { 14 | 15 | brand:Brand; 16 | brandUpdateForm:FormGroup; 17 | constructor(private brandService:BrandService, 18 | private formBuilder:FormBuilder, 19 | private toastrService:ToastrService, 20 | private router:Router, 21 | private activatedRoute:ActivatedRoute 22 | ) { } 23 | 24 | ngOnInit(): void { 25 | this.activatedRoute.params.subscribe(params=>{ 26 | this.getByBrandId(Number(params["brandId"])) 27 | }) 28 | } 29 | 30 | getByBrandId(brandId:number){ 31 | this.brandService.getByBrandId(brandId).subscribe(response=>{ 32 | this.brand=response.data[0]; 33 | this.createBrandUpdateForm() 34 | }) 35 | } 36 | 37 | createBrandUpdateForm(){ 38 | this.brandUpdateForm=this.formBuilder.group({ 39 | brandId:[this.brand.brandId,Validators.required], 40 | brandName:[this.brand.brandName,Validators.required] 41 | }) 42 | } 43 | 44 | update(){ 45 | if(this.brandUpdateForm.valid){ 46 | let brandModel=Object.assign({},this.brandUpdateForm.value) 47 | this.brandService.update(brandModel).subscribe(response=>{ 48 | this.toastrService.success(response.message,"Başarılı") 49 | this.router.navigate(["brandOperations"]) 50 | },responseError=>{ 51 | if (responseError.error.Errors.length>0){ 52 | for (let i = 0; i < responseError.error.Errors.length; i++) { 53 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage,"Doğrulama hatası") 54 | } 55 | } 56 | }) 57 | }else{ 58 | this.toastrService.warning("Formunuz eksik","Dikkat!") 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/brand/brand.component.css -------------------------------------------------------------------------------- /src/app/components/brand/brand.component.html: -------------------------------------------------------------------------------- 1 |
6 | Loading... 7 |
8 | 9 | 10 | 11 | 12 |
-------------------------------------------------------------------------------- /src/app/components/brand/brand.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Brand } from 'src/app/models/brand/brand'; 3 | import { BrandService } from 'src/app/services/brand.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 | brands:Brand[]=[] 12 | currentBrand:Brand={brandId:0,brandName:""}; 13 | dataLoaded=false; 14 | filterBrand=""; 15 | 16 | constructor(private brandService:BrandService) { } 17 | 18 | ngOnInit(): void { 19 | this.getBrands(); 20 | } 21 | 22 | getBrands(){ 23 | this.brandService.getBrands().subscribe(response=>{ 24 | this.brands=response.data; 25 | this.dataLoaded=true; 26 | }) 27 | } 28 | 29 | setCurrentBrand(brand:Brand){ 30 | this.currentBrand=brand; 31 | } 32 | 33 | getCurrentBrandClass(brand:Brand){ 34 | if(brand==this.currentBrand){ 35 | return "list-group-item active" 36 | }else{ 37 | return "list-group-item" 38 | } 39 | } 40 | 41 | 42 | getCurrentAllBrandClass(){ 43 | if(this.currentBrand.brandId==0){ 44 | return "list-group-item active" 45 | }else{ 46 | return "list-group-item" 47 | } 48 | } 49 | 50 | nullCurrentBrand(){ 51 | this.currentBrand={brandId:0,brandName:""};; 52 | } 53 | } -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/car-detail/car-detail.component.css -------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 |
7 |
8 |
9 |
10 | 29 |
30 | 56 |
57 |
58 |
59 |
60 | {{ carDetails.brandName }} 61 |
62 |

{{ carDetails.description }}

63 |
64 | 65 |
    66 |
  • 67 | Findeks puanı : 68 |
  • 69 |
  • Marka : {{ carDetails.brandName }}
  • 70 |
  • Renk : {{ carDetails.colorName }}
  • 71 |
  • 72 | Model : {{ carDetails.modelYear }} 73 |
  • 74 |
  • 75 | Yeni Günlük Fiyat : {{ 76 | carDetails.dailyPrice | vatAdded: 10 | currency: "₺" 77 | }} 78 |
  • 79 |
  • 80 | Günlük Fiyat : {{ 81 | carDetails.dailyPrice | currency: "₺" 82 | }} 83 |
  • 84 |
85 | 86 | 87 | 88 | 89 |
90 |
91 | Findeks puanınız yeterli olmadığı için arabayı kiralayamazsınız. Findeks puanınız: {{ currentCustopmerOfFindexPoint }} 92 |
93 | 94 | 99 | 100 | 105 |
106 | 107 |
108 | 111 | 112 |
113 |
114 | 115 |
116 |

117 | 118 |
119 |
120 |
121 | 122 |
-------------------------------------------------------------------------------- /src/app/components/car-detail/car-detail.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Car } from 'src/app/models/car/car'; 5 | import { CarDetail } from 'src/app/models/car/carDetail'; 6 | import { CarImage } from 'src/app/models/carImage/carImage'; 7 | import { Customer } from 'src/app/models/customer/customer'; 8 | import { Rental } from 'src/app/models/rental/rental'; 9 | import { AuthService } from 'src/app/services/auth.service'; 10 | import { CarImageService } from 'src/app/services/car-image.service'; 11 | import { CarService } from 'src/app/services/car.service'; 12 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 13 | import { RentalService } from 'src/app/services/rental.service'; 14 | 15 | @Component({ 16 | selector: 'app-car-detail', 17 | templateUrl: './car-detail.component.html', 18 | styleUrls: ['./car-detail.component.css'], 19 | }) 20 | 21 | export class CarDetailComponent implements OnInit { 22 | 23 | carDetails: CarDetail; 24 | cardetails: Car[] = []; 25 | carImages: CarImage[] = []; 26 | currentImage: CarImage; 27 | dataLoaded = false; 28 | filterCar = ""; 29 | appRentalClass: string = "display:none;visibility:hidden;"; 30 | deneme: boolean = true; 31 | currentCustopmerOfFindexPoint: number; 32 | 33 | constructor( 34 | private carService: CarService, 35 | private activatedRoute: ActivatedRoute, 36 | private carImageService: CarImageService, 37 | private rentalService:RentalService, 38 | private localStorageService:LocalStorageService, 39 | private authService:AuthService, 40 | private toastrService:ToastrService 41 | ) { } 42 | 43 | 44 | ngOnInit(): void { 45 | this.activatedRoute.params.subscribe(params => { 46 | this.getCarDetailByCarId(params['carId']); 47 | this.getImageByCarId(params['carId']); 48 | }); 49 | } 50 | 51 | getImageByCarId(carId: number) { 52 | this.carImageService.getImageByCarId(carId).subscribe(response => { 53 | this.carImages = response.data; 54 | this.dataLoaded = true; 55 | this.currentImage = this.carImages[0]; 56 | }); 57 | } 58 | 59 | getCarDetailByCarId(carId: number) { 60 | this.carService.getCarDetailByCarId(carId).subscribe(response => { 61 | this.carDetails = response.data[0]; 62 | this.dataLoaded = true; 63 | }); 64 | } 65 | 66 | getSliderClassName(carImage: CarImage) { 67 | if (this.currentImage === carImage) { 68 | return "carousel-item active" 69 | } else { 70 | return "carousel-item" 71 | } 72 | } 73 | 74 | kirala(){ 75 | if(this.isLogin()){ 76 | if (this.deneme==true) { 77 | this.appRentalClass="visibility:visible;" 78 | this.deneme=false; 79 | }else if(this.deneme==false){ 80 | this.appRentalClass="display:none;visibility:hidden;" 81 | this.deneme=true; 82 | } 83 | }else{ 84 | this.toastrService.warning("Araba kiralamak için önce giriş yapmalısınız","Dikkat"); 85 | } 86 | 87 | } 88 | 89 | findexPoint():boolean{ 90 | let currentCustomer = this.localStorageService.getCurrentCustomer() 91 | 92 | if (currentCustomer) { 93 | this.currentCustopmerOfFindexPoint = currentCustomer.findexPoint 94 | 95 | if(this.currentCustopmerOfFindexPoint < this.carDetails.findexPoint){ 96 | return true; 97 | } 98 | } 99 | 100 | return false; 101 | } 102 | 103 | isLogin(){ 104 | if(this.authService.isAuthenticated()){ 105 | return true; 106 | } 107 | 108 | return false; 109 | } 110 | 111 | method(): boolean { 112 | let isAdmin = this.localStorageService.getCurrentCustomer() 113 | 114 | if (isAdmin) { 115 | if (isAdmin.userId === 3002) { 116 | return true; 117 | } 118 | } 119 | return false; 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /src/app/components/car/car-add/car-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/car/car-add/car-add.component.css -------------------------------------------------------------------------------- /src/app/components/car/car-add/car-add.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
Araba Ekle
6 |
7 |
8 |
9 |
10 | 11 |
12 | 16 |
17 |
18 |
19 | 20 |
21 | 25 |
26 |
27 |
28 | 29 |
30 | 37 |
38 |
39 |
40 | 41 |
42 | 49 |
50 |
51 |
52 | 53 |
54 | 61 |
62 |
63 |
64 | 65 |
66 | 73 |
74 |
75 |
76 |
77 | 81 |
82 |
83 |
84 | -------------------------------------------------------------------------------- /src/app/components/car/car-add/car-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder,FormControl,Validators} from "@angular/forms" 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Brand } from 'src/app/models/brand/brand'; 6 | import { Color } from 'src/app/models/color/color'; 7 | import { BrandService } from 'src/app/services/brand.service'; 8 | import { CarService } from 'src/app/services/car.service'; 9 | import { ColorService } from 'src/app/services/color.service'; 10 | 11 | @Component({ 12 | selector: 'app-car-add', 13 | templateUrl: './car-add.component.html', 14 | styleUrls: ['./car-add.component.css'] 15 | }) 16 | export class CarAddComponent implements OnInit { 17 | 18 | carAddForm:FormGroup; 19 | colors:Color[]=[] 20 | brands:Brand[]=[] 21 | 22 | constructor( 23 | private formBuilder:FormBuilder, 24 | private carService:CarService, 25 | private toastrService:ToastrService, 26 | private router:Router, 27 | private colorService:ColorService, 28 | private brandService:BrandService 29 | ) { } 30 | 31 | ngOnInit(): void { 32 | this.getBrands() 33 | this.getColors() 34 | this.createCarAddForm() 35 | } 36 | 37 | getBrands(){ 38 | this.brandService.getBrands().subscribe(response=>{ 39 | this.brands=response.data; 40 | }) 41 | } 42 | 43 | getColors(){ 44 | this.colorService.getColors().subscribe(response=>{ 45 | this.colors=response.data; 46 | }) 47 | } 48 | 49 | createCarAddForm(){ 50 | this.carAddForm = this.formBuilder.group({ 51 | colorId:["",Validators.required], 52 | brandId:["",Validators.required], 53 | modelYear:["",Validators.required], 54 | dailyPrice:["",Validators.required], 55 | description:["",Validators.required], 56 | findexPoint:["",Validators.required] 57 | }) 58 | } 59 | 60 | add(){ 61 | if(this.carAddForm.valid){ 62 | let carModel=Object.assign({},this.carAddForm.value) 63 | this.carService.add(carModel).subscribe(response=>{ 64 | this.carService.getCars(); 65 | this.toastrService.success(response.message,"Başarılı") 66 | // setTimeout(function(){ 67 | // location.reload() 68 | // },3*20000); 69 | this.router.navigate(["carOperations"]).then(r=>window.location.reload()) 70 | },responseError=>{ 71 | if (responseError.error.Errors.length>0){ 72 | for (let i = 0; i < responseError.error.Errors.length; i++) { 73 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage,"Doğrulama hatası") 74 | } 75 | } 76 | }) 77 | }else{ 78 | this.toastrService.warning("Formunuz eksik","Dikkat!") 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/app/components/car/car-list/car-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/car/car-list/car-list.component.css -------------------------------------------------------------------------------- /src/app/components/car/car-list/car-list.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 50 | 51 | 52 |
IdMarkaRenkModelGünlük FiyatAçıklamaFindeks
{{ car.id }}{{ car.brandName }}{{ car.colorName }}{{ car.modelYear }}{{ car.dailyPrice }}{{ car.description }}{{ car.findexPoint }} 37 |   43 | 49 |
53 | 54 | 67 | 78 |
79 |
80 | -------------------------------------------------------------------------------- /src/app/components/car/car-list/car-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Car } from 'src/app/models/car/car'; 5 | import { CarDetail } from 'src/app/models/car/carDetail'; 6 | import { CarService } from 'src/app/services/car.service'; 7 | 8 | @Component({ 9 | selector: 'app-car-list', 10 | templateUrl: './car-list.component.html', 11 | styleUrls: ['./car-list.component.css'] 12 | }) 13 | export class CarListComponent implements OnInit { 14 | 15 | cars:CarDetail[]=[]; 16 | constructor(private carService:CarService, 17 | private toastrService:ToastrService, 18 | private router:Router 19 | ) { } 20 | 21 | ngOnInit(): void { 22 | this.getCars(); 23 | } 24 | 25 | getCars(){ 26 | this.carService.getCars().subscribe(response=>{ 27 | this.cars=response.data; 28 | }) 29 | } 30 | 31 | delete(car: Car) { 32 | this.carService.delete(car).subscribe(response => { 33 | this.toastrService.success("Başarıyla silindi", "Başarılı") 34 | this.getCars() 35 | this.router.navigate(["/carOperations"]) 36 | }, responseError => { 37 | if (responseError.error.Errors.length > 0) { 38 | for (let i = 0; i < responseError.error.Errors.length; i++) { 39 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage, "Doğrulama hatası") 40 | } 41 | } 42 | 43 | console.log(responseError); 44 | 45 | }) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/app/components/car/car-update/car-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/car/car-update/car-update.component.css -------------------------------------------------------------------------------- /src/app/components/car/car-update/car-update.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
Araba Güncelle
6 |
7 |
8 |
9 |
10 | 11 |
12 | 16 |
17 |
18 |
19 | 20 |
21 | 25 |
26 |
27 |
28 | 29 |
30 | 37 |
38 |
39 |
40 | 41 |
42 | 49 |
50 |
51 |
52 | 53 |
54 | 61 |
62 |
63 |
64 | 65 |
66 | 73 |
74 |
75 |
76 |
77 | 81 |
82 |
83 |
-------------------------------------------------------------------------------- /src/app/components/car/car-update/car-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormBuilder, FormControl, Validators } from "@angular/forms" 3 | import { ActivatedRoute, Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Brand } from 'src/app/models/brand/brand'; 6 | import { Car } from 'src/app/models/car/car'; 7 | import { Color } from 'src/app/models/color/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 | 12 | @Component({ 13 | selector: 'app-car-update', 14 | templateUrl: './car-update.component.html', 15 | styleUrls: ['./car-update.component.css'] 16 | }) 17 | export class CarUpdateComponent implements OnInit { 18 | 19 | carUpdateForm: FormGroup; 20 | colors: Color[] = [] 21 | brands: Brand[] = [] 22 | car: Car 23 | 24 | constructor( 25 | private formBuilder: FormBuilder, 26 | private carService: CarService, 27 | private toastrService: ToastrService, 28 | private router: Router, 29 | private colorService: ColorService, 30 | private brandService: BrandService, 31 | private activatedRoute: ActivatedRoute 32 | ) { } 33 | 34 | ngOnInit(): void { 35 | this.activatedRoute.params.subscribe((param) => { 36 | this.getBrands() 37 | this.getColors() 38 | this.getCarById(param.carId) 39 | }) 40 | } 41 | 42 | getCarById(carId: number){ 43 | this.carService.getCarDetailByCarId(carId).subscribe(responseSucces => { 44 | this.car = responseSucces.data[0] 45 | this.createCarUpdateForm() 46 | }) 47 | } 48 | 49 | getBrands() { 50 | this.brandService.getBrands().subscribe(response => { 51 | this.brands = response.data; 52 | }) 53 | } 54 | 55 | getColors() { 56 | this.colorService.getColors().subscribe(response => { 57 | this.colors = response.data; 58 | }) 59 | } 60 | 61 | createCarUpdateForm() { 62 | this.carUpdateForm = this.formBuilder.group({ 63 | colorId: [this.car.colorId, Validators.required], 64 | brandId: [this.car.brandId, Validators.required], 65 | modelYear: [this.car.modelYear, Validators.required], 66 | dailyPrice: [this.car.dailyPrice, Validators.required], 67 | description: [this.car.description, Validators.required], 68 | findexPoint: [this.car.findexPoint, Validators.required] 69 | }) 70 | } 71 | 72 | update() { 73 | if (this.carUpdateForm.valid) { 74 | let carModel: Car = Object.assign({ id: this.car.id }, this.carUpdateForm.value) 75 | 76 | this.carService.update(carModel).subscribe(response => { 77 | this.carService.getCars(); 78 | this.toastrService.success(response.message, "Başarılı") 79 | this.router.navigate(["carOperations"]).then(r => window.location.reload()) 80 | }, responseError => { 81 | if (responseError.error.Errors.length > 0) { 82 | for (let i = 0; i < responseError.error.Errors.length; i++) { 83 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage, "Doğrulama hatası") 84 | } 85 | } 86 | }) 87 | } else { 88 | this.toastrService.warning("Formunuz eksik", "Dikkat!") 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.css: -------------------------------------------------------------------------------- 1 | /* .hidden-label { 2 | position: absolute; 3 | margin-top: .34rem; 4 | margin-left: .56rem; 5 | font-style: italic; 6 | pointer-events: none; 7 | } */ -------------------------------------------------------------------------------- /src/app/components/car/car.component.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 |
7 |
8 |
9 | Loading... 10 |
11 | 17 | 31 |
  • 33 | Araba Listesi 34 |
  • 35 |
    36 | 37 |
    38 | 39 | 44 |
      45 | 46 | 47 |
    48 | 49 | 54 |
    55 |

    56 |   63 | 64 | 70 |
    71 |
    72 | 73 |
    74 |
    75 |
    76 | Araba bulunamadı  78 | 80 | 82 | 83 |
    84 |
    85 |
    86 | 87 |
    88 |
    89 |
    90 | 92 |
    93 |
    {{car.brandName}} - {{car.modelYear}} 94 | 95 |
    96 |
    97 |
      98 |
    • Findeks puanı:  100 |
    • 101 |
    • Renk: {{car.colorName |uppercase}}
    • 102 |
    • {{car.dailyPrice 103 | | vatAdded:10 |currency:'₺'}} 105 | 106 | 108 |
    • 109 |
    • {{car.dailyPrice | currency:'₺'}}
    • 111 |
    • 118 | 119 |
    120 |
    121 |
    122 |
    123 |
    124 |
    125 | -------------------------------------------------------------------------------- /src/app/components/car/car.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { ActivatedRoute, Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Brand } from 'src/app/models/brand/brand'; 5 | import { Car } from 'src/app/models/car/car'; 6 | import { CarDetail } from 'src/app/models/car/carDetail'; 7 | import { CarImage } from 'src/app/models/carImage/carImage'; 8 | import { Color } from 'src/app/models/color/color'; 9 | import { BrandService } from 'src/app/services/brand.service'; 10 | import { CarImageService } from 'src/app/services/car-image.service'; 11 | import { CarService } from 'src/app/services/car.service'; 12 | import { ColorService } from 'src/app/services/color.service'; 13 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 14 | 15 | @Component({ 16 | selector: 'app-car', 17 | templateUrl: './car.component.html', 18 | styleUrls: ['./car.component.css'], 19 | }) 20 | export class CarComponent implements OnInit { 21 | cars: CarDetail[] = []; 22 | currentCar: Car; 23 | carImages: CarImage[] = []; 24 | default: Car; 25 | dataLoaded = false; 26 | filterCar=""; 27 | colorId:number; 28 | brandId:number; 29 | 30 | brands: Brand[] = []; 31 | colors: Color[] = []; 32 | 33 | constructor( 34 | private carService: CarService, 35 | private activatedRoute: ActivatedRoute, 36 | private carImageService: CarImageService, 37 | private toastrService:ToastrService, 38 | private colorService: ColorService, 39 | private brandService: BrandService, 40 | private router: Router, 41 | private localStorageService:LocalStorageService 42 | ) {} 43 | 44 | ngOnInit(): void { 45 | this.getAllColors(); 46 | this.getAllBrands(); 47 | this.activatedRoute.params.subscribe((param) => { 48 | if (param['brandId'] && param['colorId']) { 49 | this.getCarListBrandIdColorId(param['brandId'],param['colorId']); 50 | this.colorId=param['colorId']; 51 | this.brandId=param['brandId'] 52 | } else if (param['brandId']) { 53 | this.getCarsByBrandId(param['brandId']); 54 | this.brandId=param['brandId']; 55 | this.colorId=0 56 | } else if (param['colorId']) { 57 | this.getCarsByColorId(param['colorId']); 58 | this.colorId=param['colorId']; 59 | this.brandId=0 60 | } else{ 61 | this.colorId=0; 62 | this.brandId=0 63 | this.getCars(); 64 | } 65 | }); 66 | } 67 | 68 | getCars() { 69 | this.carService.getCars().subscribe((response) => { 70 | this.cars = response.data; 71 | this.dataLoaded = true; 72 | }); 73 | } 74 | 75 | getCarsByBrandId(brandId: number) { 76 | this.carService.getCarsByBrandId(brandId).subscribe((response) => { 77 | this.cars = response.data; 78 | this.dataLoaded = true; 79 | }); 80 | } 81 | 82 | getCarsByColorId(colorId: number) { 83 | this.carService.getCarsByColorId(colorId).subscribe((response) => { 84 | this.cars = response.data; 85 | this.dataLoaded = true; 86 | }); 87 | } 88 | 89 | getCarListBrandIdColorId(brandId: number, colorId: number) { 90 | this.carService 91 | .getCarListBrandIdColorId(brandId, colorId) 92 | .subscribe((response) => { 93 | this.cars = response.data; 94 | this.dataLoaded = true; 95 | }); 96 | } 97 | 98 | setCurrentAllCar() { 99 | this.currentCar = this.default; 100 | } 101 | 102 | getCurrentAllCarClass() { 103 | if (this.currentCar == this.default) { 104 | return 'list-group-item active'; 105 | } else { 106 | return 'list-group-item'; 107 | } 108 | } 109 | 110 | setSelectedColorId(colorId:number){ 111 | if(this.colorId== colorId){ 112 | return true; 113 | }else{ 114 | return false; 115 | } 116 | } 117 | 118 | setSelectedBrandId(brandId:number){ 119 | if(this.brandId== brandId){ 120 | return true; 121 | }else{ 122 | return false; 123 | } 124 | } 125 | 126 | getSelectedBrandIdColorId(brandId:number,colorId:number){ 127 | if(this.currentCar.brandId == brandId || this.currentCar.colorId == colorId){ 128 | return "btn active"; 129 | }else{ 130 | return "btn"; 131 | } 132 | } 133 | setSelectedBrandIdColorId(){ 134 | this.currentCar.brandId=0; 135 | this.currentCar.colorId=0; 136 | } 137 | 138 | 139 | getAllBrands() { 140 | this.brandService.getBrands().subscribe((response) => { 141 | this.brands = response.data; 142 | }); 143 | } 144 | 145 | getAllColors() { 146 | this.colorService.getColors().subscribe((response) => { 147 | this.colors = response.data; 148 | }); 149 | } 150 | filterClick(){ 151 | if (this.brandId >0 && this.colorId > 0) { 152 | this.router.navigate(['/cars/brand/' + this.brandId +'/color/' +this.colorId]) 153 | } else if (this.brandId >0) { 154 | this.router.navigate(['/cars/brand/' + this.brandId ]) 155 | }else { 156 | this.router.navigate(['/cars/color/' + this.colorId ]) 157 | } 158 | } 159 | 160 | 161 | 162 | } -------------------------------------------------------------------------------- /src/app/components/color/color-add/color-add.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/color/color-add/color-add.component.css -------------------------------------------------------------------------------- /src/app/components/color/color-add/color-add.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 |
    5 |
    Renk ekle
    6 |
    7 |
    8 |
    9 |
    10 |
    11 | 18 |
    19 |
    20 |
    21 |
    22 | 26 |
    27 |
    28 |
    29 | 30 | -------------------------------------------------------------------------------- /src/app/components/color/color-add/color-add.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder,FormControl,Validators} from "@angular/forms" 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { ColorService } from 'src/app/services/color.service'; 6 | 7 | @Component({ 8 | selector: 'app-color-add', 9 | templateUrl: './color-add.component.html', 10 | styleUrls: ['./color-add.component.css'] 11 | }) 12 | export class ColorAddComponent implements OnInit { 13 | 14 | colorAddForm:FormGroup; 15 | constructor(private formBuilder:FormBuilder, 16 | private colorService:ColorService, 17 | private toastrService:ToastrService, 18 | private router:Router 19 | ) { } 20 | 21 | ngOnInit(): void { 22 | this.createColorAddForm() 23 | } 24 | 25 | createColorAddForm(){ 26 | this.colorAddForm=this.formBuilder.group({ 27 | // colorId:["",Validators.required], 28 | colorName:["",Validators.required] 29 | }) 30 | } 31 | 32 | add(){ 33 | if(this.colorAddForm.valid){ 34 | let colorModel=Object.assign({},this.colorAddForm.value) 35 | this.colorService.add(colorModel).subscribe(response=>{ 36 | this.colorService.getColors() 37 | this.toastrService.success(response.message,"Başarılı") 38 | // setTimeout(function(){ 39 | // location.reload(); 40 | // },3*20000) 41 | this.router.navigate(["colorOperations"]).then(r=>window.location.reload()) 42 | },responseError=>{ 43 | if (responseError.error.Errors.length>0){ 44 | for (let i = 0; i < responseError.error.Errors.length; i++) { 45 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage,"Doğrulama hatası") 46 | } 47 | } 48 | }) 49 | }else{ 50 | this.toastrService.warning("Formunuz eksik","Dikkat!") 51 | } 52 | 53 | // console.log(colorModel) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/app/components/color/color-list/color-list.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/color/color-list/color-list.component.css -------------------------------------------------------------------------------- /src/app/components/color/color-list/color-list.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 | 4 | 5 | 6 | 7 | 8 | 9 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 41 | 42 | 43 |
    IdRenk
    {{ color.colorId }}{{ color.colorName }} 27 |   33 | 40 |
    44 | 45 | 58 | 69 |
    70 |
    71 | -------------------------------------------------------------------------------- /src/app/components/color/color-list/color-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Color } from 'src/app/models/color/color'; 5 | import { ColorService } from 'src/app/services/color.service'; 6 | 7 | @Component({ 8 | selector: 'app-color-list', 9 | templateUrl: './color-list.component.html', 10 | styleUrls: ['./color-list.component.css'] 11 | }) 12 | export class ColorListComponent implements OnInit { 13 | 14 | colors:Color[]=[]; 15 | 16 | constructor( 17 | private colorService:ColorService, 18 | private toastrService: ToastrService, 19 | private router: Router, 20 | ) { } 21 | 22 | ngOnInit(): void { 23 | this.getColors() 24 | } 25 | 26 | getColors(){ 27 | this.colorService.getColors().subscribe(response=>{ 28 | this.colors=response.data; 29 | }) 30 | } 31 | 32 | delete(color: Color) { 33 | this.colorService.delete(color).subscribe(response => { 34 | this.toastrService.success("Başarıyla silindi", "Başarılı") 35 | this.getColors() 36 | this.router.navigate(["colorOperations"]) 37 | }, responseError => { 38 | if (responseError.error.Errors.length > 0) { 39 | for (let i = 0; i < responseError.error.Errors.length; i++) { 40 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage, "Doğrulama hatası") 41 | } 42 | } 43 | }) 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/app/components/color/color-update/color-update.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/color/color-update/color-update.component.css -------------------------------------------------------------------------------- /src/app/components/color/color-update/color-update.component.html: -------------------------------------------------------------------------------- 1 | 25 |
    26 |
    27 |
    28 |
    29 |
    Renk güncelle
    30 |
    31 |
    32 |
    33 |
    34 |
    35 | 41 |
    42 |
    43 |
    44 |
    45 | 49 |
    50 |
    51 |
    52 | -------------------------------------------------------------------------------- /src/app/components/color/color-update/color-update.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import {FormGroup,FormBuilder,FormControl,Validators} from "@angular/forms" 3 | import { ActivatedRoute, Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Color } from 'src/app/models/color/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 | constructor(private colorService:ColorService, 18 | private formBuilder:FormBuilder, 19 | private toastrService:ToastrService, 20 | private router:Router, 21 | private activatedRoute:ActivatedRoute 22 | ) { } 23 | 24 | ngOnInit(): void { 25 | this.activatedRoute.params.subscribe(params=>{ 26 | this.getByColorId(Number(params["colorId"])) 27 | }) 28 | } 29 | 30 | getByColorId(colorId:number){ 31 | this.colorService.getByColorId(colorId).subscribe(response=>{ 32 | this.color=response.data[0]; 33 | this.createColorUpdateForm() 34 | }) 35 | } 36 | 37 | createColorUpdateForm(){ 38 | this.colorUpdateForm=this.formBuilder.group({ 39 | colorId:[this.color.colorId,Validators.required], 40 | colorName:[this.color.colorName,Validators.required] 41 | }) 42 | } 43 | 44 | update(){ 45 | if(this.colorUpdateForm.valid){ 46 | let colorModel=Object.assign({},this.colorUpdateForm.value) 47 | this.colorService.update(colorModel).subscribe(response=>{ 48 | this.toastrService.success(response.message,"Başarılı") 49 | this.router.navigate(["colorOperations"])//.then(r=>window.location.reload()) 50 | },responseError=>{ 51 | if (responseError.error.Errors.length>0){ 52 | for (let i = 0; i < responseError.error.Errors.length; i++) { 53 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage,"Doğrulama hatası") 54 | } 55 | } 56 | }) 57 | }else{ 58 | this.toastrService.warning("Formunuz eksik","Dikkat!") 59 | } 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/color/color.component.css -------------------------------------------------------------------------------- /src/app/components/color/color.component.html: -------------------------------------------------------------------------------- 1 |
    6 | Loading... 7 |
    8 | 9 | -------------------------------------------------------------------------------- /src/app/components/color/color.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Color } from 'src/app/models/color/color'; 3 | import { ColorService } from 'src/app/services/color.service'; 4 | 5 | @Component({ 6 | selector: 'app-color', 7 | templateUrl: './color.component.html', 8 | styleUrls: ['./color.component.css'] 9 | }) 10 | export class ColorComponent implements OnInit { 11 | colors:Color[]=[] 12 | currentColor:Color={colorId:0,colorName:""};; 13 | dataLoaded=false; 14 | filterColor="" 15 | colorId:number; 16 | brandId:number; 17 | 18 | constructor(private colorService:ColorService) { } 19 | 20 | ngOnInit(): void { 21 | this.getColors() 22 | } 23 | 24 | getColors(){ 25 | this.colorService.getColors().subscribe(response=>{ 26 | this.colors=response.data; 27 | this.dataLoaded=true; 28 | }) 29 | } 30 | 31 | setCurrentColor(color:Color){ 32 | this.currentColor=color; 33 | } 34 | 35 | getCurrentColorClass(color:Color){ 36 | if(color==this.currentColor){ 37 | return "list-group-item active" 38 | }else{ 39 | return "list-group-item" 40 | } 41 | } 42 | 43 | getCurrentAllColorClass(){ 44 | if(this.currentColor.colorId==0){ 45 | return "list-group-item active" 46 | }else{ 47 | return "list-group-item" 48 | } 49 | } 50 | 51 | nullCurrentColor(){ 52 | this.currentColor={colorId:0,colorName:""}; 53 | } 54 | 55 | 56 | } -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/customer/customer.component.css -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.html: -------------------------------------------------------------------------------- 1 |
    6 | Loading... 7 |
    8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
      Id  User Id  Company Name  
      {{ customer.userId }}{{ customer.companyName }}
    -------------------------------------------------------------------------------- /src/app/components/customer/customer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Customer } from 'src/app/models/customer/customer'; 3 | import { 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 | customers:Customer[]=[]; 12 | dataLoaded=false; 13 | 14 | constructor(private customerService:CustomerService ) { } 15 | 16 | ngOnInit(): void { 17 | this.getCustomers() 18 | } 19 | 20 | getCustomers(){ 21 | this.customerService.getCustomers().subscribe(response=>{ 22 | this.customers=response.data; 23 | this.dataLoaded=true; 24 | }) 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /src/app/components/footer/footer.component.css: -------------------------------------------------------------------------------- 1 | .social { 2 | margin-top: 15px; 3 | } 4 | 5 | .social > .social-item { 6 | background-color: beige; 7 | padding: 20px; 8 | border-radius: 50%; 9 | color: #555; 10 | font-size: 18px; 11 | transition: all 0.5s; 12 | } 13 | 14 | .social > .social-item:hover { 15 | background-color: #ccc; 16 | cursor: pointer; 17 | border-radius: 0px; 18 | } 19 | -------------------------------------------------------------------------------- /src/app/components/footer/footer.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 | 5 |
    6 |
    Şirket Bilgisi
    7 |
    8 |

    Güvenli bir şirketle güzel bir yolculuğa ne dersiniz? Yıllardan beridir büyümeye devam ediyoruz

    9 |
    10 | 11 |
    12 |
    13 |

    Rent A Car

    14 | 15 | 21 | 22 | 31 |
    32 |
    33 | 34 |
    35 |
    Contact
    36 |
    37 |

    38 | Baku, Azerbaycan 39 |

    40 |

    41 | rentalcar@gmail.com 42 |

    43 |

    44 | + 994 55 777 56 88 45 |

    46 |

    47 | + 994 55 777 56 98 48 |

    49 |
    50 | 51 |
    52 |
    53 | 54 |
    55 | © 2020 Copyright: Rent A Car. Tüm Hakları Saklıdır 56 | | 57 | Bu Site Sahil Rzayev Tarafından Tasarlanıp, Kodlanmıştır. 58 |
    59 | 60 |
    -------------------------------------------------------------------------------- /src/app/components/footer/footer.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { FooterComponent } from './footer.component'; 4 | 5 | describe('FooterComponent', () => { 6 | let component: FooterComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ FooterComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(FooterComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/components/footer/footer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-footer', 5 | templateUrl: './footer.component.html', 6 | styleUrls: ['./footer.component.css'] 7 | }) 8 | export class FooterComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/components/home/home.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/home/home.component.css -------------------------------------------------------------------------------- /src/app/components/home/home.component.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/home/home.component.html -------------------------------------------------------------------------------- /src/app/components/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-home', 5 | templateUrl: './home.component.html', 6 | styleUrls: ['./home.component.css'] 7 | }) 8 | export class HomeComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | } 5 | 6 | body { 7 | display: flex; 8 | align-items: center; 9 | padding-top: 40px; 10 | padding-bottom: 40px; 11 | 12 | } 13 | 14 | .form-signin { 15 | width: 100%; 16 | max-width: 330px; 17 | padding: 15px; 18 | margin: auto; 19 | } 20 | 21 | .form-signin .checkbox { 22 | font-weight: 400; 23 | } 24 | 25 | .form-signin .form-floating:focus-within { 26 | z-index: 2; 27 | } 28 | 29 | .form-signin input[type="email"] { 30 | margin-bottom: -1px; 31 | border-bottom-right-radius: 0; 32 | border-bottom-left-radius: 0; 33 | } 34 | 35 | .form-signin input[type="password"] { 36 | margin-bottom: 10px; 37 | border-top-left-radius: 0; 38 | border-top-right-radius: 0; 39 | } 40 | 41 | .bd-placeholder-img { 42 | font-size: 1.125rem; 43 | text-anchor: middle; 44 | -webkit-user-select: none; 45 | -moz-user-select: none; 46 | user-select: none; 47 | } 48 | 49 | @media (min-width: 768px) { 50 | .bd-placeholder-img-lg { 51 | font-size: 3.5rem; 52 | } 53 | } 54 | 55 | /* .field-icon { 56 | float: right; 57 | margin-right: 10px; 58 | margin-top: -45px; 59 | position: relative; 60 | z-index: 2; 61 | margin-bottom: 50px; 62 | } */ 63 | 64 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.html: -------------------------------------------------------------------------------- 1 | 3 |
    4 |
    5 |

    sign in

    6 |
    7 | 14 | 15 |
    16 |
    17 | 24 | 25 |
    26 | 27 |
    28 | 31 |
    32 |

    35 |
    36 |

    Don't have your account?  37 | Sign up

    38 |
    39 |

    © 2017–2021

    40 |
    41 |
    42 | 43 | -------------------------------------------------------------------------------- /src/app/components/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup,FormControl,Validators,FormBuilder } from "@angular/forms"; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Customer } from 'src/app/models/customer/customer'; 6 | import { LoginModel } from 'src/app/models/login/loginModel'; 7 | import { AuthService } from 'src/app/services/auth.service'; 8 | import { CustomerService } from 'src/app/services/customer.service'; 9 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 10 | 11 | @Component({ 12 | selector: 'app-login', 13 | templateUrl: './login.component.html', 14 | styleUrls: ['./login.component.css'] 15 | }) 16 | export class LoginComponent implements OnInit { 17 | 18 | currentCustomer:Customer; 19 | currentCustomerEmail: string = ''; 20 | loginForm:FormGroup; 21 | 22 | constructor( 23 | private formBuilder:FormBuilder, 24 | private authService:AuthService, 25 | private toastrService:ToastrService, 26 | private localStorageService:LocalStorageService, 27 | private router:Router, 28 | private customerService:CustomerService 29 | ) { } 30 | 31 | ngOnInit(): void { 32 | //this.setCurrentCustomerEmail(); 33 | this.checkUserExists(); 34 | } 35 | 36 | checkUserExists(){ 37 | return this.authService.isAuthenticated() 38 | ? this.router.navigateByUrl("/") 39 | : this.createLoginForm(); 40 | } 41 | 42 | createLoginForm(){ 43 | this.loginForm=this.formBuilder.group({ 44 | email:[this.currentCustomerEmail,Validators.required], 45 | password:["",Validators.required] 46 | }) 47 | } 48 | 49 | 50 | login(){ 51 | if(this.loginForm.invalid){ 52 | this.toastrService.warning("Bütün alanları doldurunuz","Hata"); 53 | return; 54 | } 55 | 56 | let loginModel:LoginModel=Object.assign({},this.loginForm.value) 57 | 58 | this.authService.login(loginModel).subscribe(response=>{ 59 | this.toastrService.success("Başarıyla giriş yapıldı","Başarılı") 60 | this.localStorageService.setToken("token",response.data.token) 61 | 62 | this.setCurrentCustomerByEmail(loginModel.email); 63 | return this.router.navigateByUrl('/cars'); 64 | },responseError=>{ 65 | return this.toastrService.error(responseError.error,"Hata"); 66 | }) 67 | 68 | } 69 | 70 | setCurrentCustomerByEmail(email:string){ 71 | this.customerService.getCustomerByEmail(email).subscribe(response=>{ 72 | this.currentCustomer=response.data 73 | this.localStorageService.setCurrentCustomer(this.currentCustomer) 74 | }) 75 | } 76 | 77 | getCustomerByEmail(email: string) { 78 | this.customerService.getCustomerByEmail(email).subscribe(responseSuccess => { 79 | this.currentCustomer = responseSuccess.data; 80 | this.localStorageService.setCurrentCustomer(this.currentCustomer); 81 | }); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.css: -------------------------------------------------------------------------------- 1 | #fon{ 2 | background-color: rgb(97, 218, 240); 3 | 4 | } 5 | 6 | #fon1{ 7 | background-color: rgb(97, 218, 240); 8 | 9 | } -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.html: -------------------------------------------------------------------------------- 1 | 2 | 102 | -------------------------------------------------------------------------------- /src/app/components/navi/navi.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | import { ToastrService } from 'ngx-toastr'; 4 | import { Customer } from 'src/app/models/customer/customer'; 5 | import { AuthService } from 'src/app/services/auth.service'; 6 | import { CustomerService } from 'src/app/services/customer.service'; 7 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 8 | 9 | @Component({ 10 | selector: 'app-navi', 11 | templateUrl: './navi.component.html', 12 | styleUrls: ['./navi.component.css'] 13 | }) 14 | export class NaviComponent implements OnInit { 15 | 16 | // userNameSurname: string 17 | userOrAdmin:string="" 18 | 19 | constructor( 20 | private toastrService: ToastrService, 21 | private customerService: CustomerService, 22 | private authService: AuthService, 23 | private localStorageService: LocalStorageService, 24 | private router: Router 25 | ) { } 26 | 27 | ngOnInit(): void { 28 | } 29 | 30 | method(): boolean { 31 | let isAdmin = this.localStorageService.getCurrentCustomer() 32 | 33 | if (isAdmin) { 34 | if (isAdmin.userId === 3002) { 35 | this.userOrAdmin="Yönetici"; 36 | return true; 37 | } 38 | } 39 | this.userOrAdmin="Kullanıcı"; 40 | return false; 41 | } 42 | 43 | 44 | 45 | isAuthenticated() { 46 | return this.authService.isAuthenticated(); 47 | } 48 | 49 | signOut() { 50 | this.localStorageService.removeToken("token"); 51 | this.localStorageService.removeCurrentCustomer(); 52 | this.toastrService.success("Çıkış yapıldı", "Başarılı"); 53 | return this.router.navigateByUrl("/login"); 54 | } 55 | 56 | register(){ 57 | return this.router.navigate(["/register"]); 58 | } 59 | 60 | getCurrentCustomer(): Customer { 61 | return this.localStorageService.getCurrentCustomer(); 62 | } 63 | 64 | 65 | 66 | } -------------------------------------------------------------------------------- /src/app/components/navi/user-menu/user-menu.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/navi/user-menu/user-menu.component.css -------------------------------------------------------------------------------- /src/app/components/navi/user-menu/user-menu.component.html: -------------------------------------------------------------------------------- 1 |

    user-menu works!

    2 | -------------------------------------------------------------------------------- /src/app/components/navi/user-menu/user-menu.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-user-menu', 5 | templateUrl: './user-menu.component.html', 6 | styleUrls: ['./user-menu.component.css'] 7 | }) 8 | export class UserMenuComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/components/payment/card-saved/card-saved.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/payment/card-saved/card-saved.component.css -------------------------------------------------------------------------------- /src/app/components/payment/card-saved/card-saved.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 | Kayıtlı kartlarım 4 |
    5 |
    6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
    {{ card.cardNumber }}|{{ card.cardExpiryDate }}|{{ card.cardNameSurname }}
    18 |
    19 |
    20 | -------------------------------------------------------------------------------- /src/app/components/payment/card-saved/card-saved.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Output,EventEmitter } from '@angular/core'; 2 | import { ToastrService } from 'ngx-toastr'; 3 | import { Customer } from 'src/app/models/customer/customer'; 4 | import { Payment } from 'src/app/models/payment/payment'; 5 | import { CustomerService } from 'src/app/services/customer.service'; 6 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 7 | import { PaymentService } from 'src/app/services/payment.service'; 8 | 9 | @Component({ 10 | selector: 'app-card-saved', 11 | templateUrl: './card-saved.component.html', 12 | styleUrls: ['./card-saved.component.css'] 13 | }) 14 | export class CardSavedComponent implements OnInit { 15 | 16 | 17 | cards: Payment[]; 18 | currentCustomer: Customer; 19 | 20 | @Output() selectedCard: EventEmitter = new EventEmitter(); 21 | 22 | constructor( 23 | private localStorageService:LocalStorageService, 24 | private paymentService:PaymentService, 25 | private toastrService:ToastrService, 26 | private customerService:CustomerService 27 | ) { } 28 | 29 | ngOnInit(): void { 30 | this.getCardsByCustomerId(); 31 | } 32 | 33 | getCardsByCustomerId() { 34 | this.paymentService.getByCustomerId(this.localStorageService.getCurrentCustomer().customerId).subscribe(response => { 35 | this.cards = response.data; 36 | }); 37 | } 38 | 39 | selectCard(cardId: number) { 40 | let selectedCard = this.cards.find(card => card.paymentId == cardId); 41 | 42 | // @ts-ignore 43 | let newSelectedCard: Card = { 44 | cardNameSurname: selectedCard.cardNameSurname, 45 | cardNumber: selectedCard.cardNumber, 46 | cardExpiryDate: selectedCard.cardExpiryDate, 47 | customerId: selectedCard.customerId, 48 | cardCvv: selectedCard.cardCvv 49 | }; 50 | 51 | this.selectedCard.emit(newSelectedCard); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.css: -------------------------------------------------------------------------------- 1 | 2 | 3 | .card0 { 4 | margin: 40px 12px 15px 12px; 5 | border: 0 6 | } 7 | 8 | .card1 { 9 | margin: 0; 10 | padding: 15px; 11 | padding-top: 25px; 12 | padding-bottom: 0px; 13 | background: #263238; 14 | height: 100% 15 | } 16 | 17 | .bill-head { 18 | color: #ffffff; 19 | font-weight: bold; 20 | margin-bottom: 0px; 21 | margin-top: 0px; 22 | font-size: 30px 23 | } 24 | 25 | .line { 26 | border-right: 1px grey solid 27 | } 28 | 29 | .bill-date { 30 | color: #BDBDBD 31 | } 32 | 33 | .red-bg { 34 | margin-top: 25px; 35 | margin-left: 0px; 36 | margin-right: 0px; 37 | margin-bottom: 20px; 38 | background-color: #0dbd1b; 39 | padding-left: 20px !important; 40 | padding: 21px 50px 50px 50px; 41 | } 42 | 43 | #total { 44 | margin-top: 10px; 45 | padding-left: 180px; 46 | color: rgb(255, 255, 255); 47 | height:70px; 48 | } 49 | 50 | #total-label { 51 | color: #000000; 52 | padding-left: 200px; 53 | font-weight: bolder; 54 | } 55 | 56 | #total-label2 { 57 | color: #000000; 58 | padding-left: 168px; 59 | font-weight: bolder; 60 | } 61 | 62 | #heading1 { 63 | color: #00d9ff; 64 | font-size: 24px; 65 | padding-left: 10px; 66 | font-family: 'Times New Roman', Times, serif; 67 | font-style: italic; 68 | font-weight: bold; 69 | } 70 | 71 | #heading2 { 72 | font-size: 30px; 73 | color: #d50000; 74 | font-family: serif; 75 | 76 | } 77 | 78 | .placeicon { 79 | font-family: fontawesome !important 80 | } 81 | 82 | .card2 { 83 | padding: 25px; 84 | margin: 0; 85 | height: 100% 86 | } 87 | 88 | .form-card .pay { 89 | font-weight: bold 90 | } 91 | 92 | .form-card input, 93 | .form-card textarea { 94 | padding: 10px 8px 10px 8px; 95 | border: none; 96 | border: 1px solid lightgrey; 97 | border-radius: 0px; 98 | margin-bottom: 25px; 99 | margin-top: 2px; 100 | width: 100%; 101 | box-sizing: border-box; 102 | font-family: montserrat; 103 | color: #2C3E50; 104 | font-size: 14px; 105 | letter-spacing: 1px 106 | } 107 | 108 | .form-card input:focus, 109 | .form-card textarea:focus { 110 | -moz-box-shadow: none !important; 111 | -webkit-box-shadow: none !important; 112 | box-shadow: none !important; 113 | border: none; 114 | font-weight: bold; 115 | border: 1px solid gray; 116 | outline-width: 0 117 | } 118 | 119 | .btn-info { 120 | color: #ffffff !important 121 | } 122 | 123 | .radio-group { 124 | position: relative; 125 | margin-bottom: 25px 126 | } 127 | 128 | .radio { 129 | display: inline-block; 130 | width: 204; 131 | height: 64; 132 | border-radius: 0; 133 | background: lightblue; 134 | box-sizing: border-box; 135 | border: 2px solid lightgrey; 136 | cursor: pointer; 137 | margin: 8px 25px 8px 0px 138 | } 139 | 140 | .radio:hover { 141 | box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.2) 142 | } 143 | 144 | .radio.selected { 145 | box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.4) 146 | } 147 | 148 | .fit-image { 149 | width: 100%; 150 | object-fit: cover 151 | } 152 | 153 | #writestyle{ 154 | font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; 155 | color: rgb(6, 212, 178); 156 | width: 220px; 157 | } 158 | 159 | #writestyle2{ 160 | font-family:serif; 161 | } 162 | 163 | #cvv{ 164 | width:50px; 165 | } 166 | 167 | #expirationDate{ 168 | width: 20px; 169 | 170 | } 171 | 172 | #blabla{ 173 | height:120px; 174 | 175 | } -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 |
    5 |
    6 |
    7 |
    8 |
    9 |

    Payment Summary


    10 |
    11 |
    12 |

    Marka

    13 |
    14 | 15 |
    16 |

    {{ carDetail.brandName }}

    17 |
    18 |

    19 |
    20 |
    21 |

    Renk

    22 |
    23 |
    24 |

    {{ carDetail.colorName }}

    25 |
    26 |

    27 |
    28 |
    29 |

    Modeli

    30 |
    31 |
    32 |

    {{ carDetail.modelYear }}

    33 |
    34 |

    35 |
    36 |
    37 |

    Açıklama

    38 |
    39 |
    40 |

    {{ carDetail.description }}

    41 |
    42 |

    43 |
    44 |
    45 |

    Kiralama Tarihi

    46 |
    47 |
    48 |

    {{getRentingCar().rentDate}}

    49 |
    50 |

    51 |
    52 |
    53 |

    Teslim Tarihi

    54 |
    55 |
    56 |

    {{getRentingCar().returnDate}}

    57 |
    58 |
    59 |
    60 |
    61 |

    Toplam fiyat

    62 |

    63 | {{totalPrice | vatAdded: 10 | currency: "₺"}} 64 |

    65 | 66 |
    67 |
    68 |
    69 |
    70 |
    71 |
    72 |
    73 |

    Payment


    74 |
    75 |
    76 |

    77 |
    78 | 79 |
    80 |
    81 |
    82 | 83 |
    84 |
    85 |
    86 |
    87 |
       88 |
    89 |
    90 |
    91 | 92 |

    93 | 94 | 95 | 96 |
    97 | 98 | 101 |
    102 |
    103 | 104 |
    105 | 106 | 107 |
    108 |
    109 |
    110 |
    111 |
    112 |
    113 |
    114 |
    115 |
    -------------------------------------------------------------------------------- /src/app/components/payment/payment.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup } from '@angular/forms'; 3 | import { ActivatedRoute, Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { CarDetail } from 'src/app/models/car/carDetail'; 6 | import { Customer } from 'src/app/models/customer/customer'; 7 | import { Payment } from 'src/app/models/payment/payment'; 8 | import { Rental } from 'src/app/models/rental/rental'; 9 | import { AuthService } from 'src/app/services/auth.service'; 10 | import { CarService } from 'src/app/services/car.service'; 11 | import { CustomerService } from 'src/app/services/customer.service'; 12 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 13 | import { PaymentService } from 'src/app/services/payment.service'; 14 | import { RentalService } from 'src/app/services/rental.service'; 15 | 16 | @Component({ 17 | selector: 'app-payment', 18 | templateUrl: './payment.component.html', 19 | styleUrls: ['./payment.component.css'] 20 | }) 21 | export class PaymentComponent implements OnInit { 22 | carId: number; 23 | carDetail: CarDetail; 24 | rental: Rental; 25 | costomer: Customer 26 | payments: Payment[] = []; 27 | dataLoaded = false; 28 | 29 | cardNameSurname: string; 30 | cardNumber: string; 31 | cardCvv: string; 32 | cardExpiryDate: any; 33 | card: Payment; 34 | 35 | customerId: number; 36 | 37 | // rentDate: Date; 38 | // returnDate: Date; 39 | payment: Payment; 40 | rentedCar: Rental; 41 | totalPrice: number = 0; 42 | paymentAmount: number = 0; 43 | cardExist: boolean = false; 44 | getCustomerId: number; 45 | customer: Customer; 46 | 47 | save:boolean=true; 48 | verifyCard:Payment; 49 | 50 | constructor( 51 | private paymentService: PaymentService, 52 | private activatedRoute: ActivatedRoute, 53 | private router: Router, 54 | private toastrService: ToastrService, 55 | private rentalService: RentalService, 56 | private carService: CarService, 57 | private formBuilder: FormBuilder, 58 | private customerService: CustomerService, 59 | private localStorageService:LocalStorageService, 60 | private authService:AuthService 61 | 62 | ) { } 63 | 64 | ngOnInit(): void { 65 | this.carId = Number(this.activatedRoute.snapshot.paramMap.get('carId')); 66 | // this.activatedRoute.params.subscribe(params=>{ 67 | // if (params['rental']) { 68 | // this.rental = JSON.parse(params['rental']); 69 | // this.getCustomerId =JSON.parse(params['rental']).customerId; 70 | // this.getCustomerDetailById(this.getCustomerId); 71 | // this.getCarDetails(); 72 | // } 73 | // }) 74 | this.getCarDetailByCarId(); 75 | 76 | } 77 | 78 | getCustomerDetailById(customerId: number) { 79 | this.customerService.getCustomerById(customerId).subscribe((response) => { 80 | this.customer = response.data[0]; 81 | }) 82 | } 83 | 84 | getCarDetails() { 85 | this.carService.getCarDetailByCarId(this.rental.carId).subscribe(response => { 86 | this.carDetail = response.data[0]; 87 | this.calculatePayment(); 88 | }) 89 | } 90 | 91 | getCustomerInfo() { 92 | this.paymentService.getByCustomerId(this.getRentingCar().customerId).subscribe(response => { 93 | this.payment = response.data[0]; 94 | this.carId = this.getRentingCar().carId; 95 | }) 96 | } 97 | 98 | getRentingCar(): Rental { 99 | return this.rentalService.getRentingCar(); 100 | } 101 | 102 | 103 | getCarDetailByCarId() { 104 | this.carService.getCarDetailByCarId(this.getRentingCar().carId).subscribe(response => { 105 | this.carDetail = response.data[0]; 106 | this.calculatePayment(); 107 | }) 108 | } 109 | 110 | calculatePayment() { 111 | var date1 = new Date(this.getRentingCar().returnDate.toString()); 112 | var date2 = new Date(this.getRentingCar().rentDate.toString()); 113 | var difference = date1.getTime() - date2.getTime(); 114 | var rentDays = Math.ceil(difference / (1000 * 3600 * 24)); 115 | this.totalPrice = rentDays * this.carDetail.dailyPrice; 116 | } 117 | 118 | async rentACar() { 119 | this.verifyCard= { 120 | cardNameSurname: this.cardNameSurname, 121 | cardNumber: this.cardNumber, 122 | cardExpiryDate: this.cardExpiryDate, 123 | cardCvv: this.cardCvv, 124 | customerId: this.localStorageService.getCurrentCustomer().customerId 125 | } 126 | 127 | 128 | if (this.save) { 129 | this.paymentService.addPayment(this.verifyCard).subscribe(); 130 | } 131 | this.rentalService.addRental(this.getRentingCar()).subscribe(responseSuccess=>{ 132 | this.toastrService.success(responseSuccess.message,"Başarılı") 133 | this.router.navigateByUrl("/cars") 134 | },responseError=>{ 135 | this.toastrService.error(responseError.error.message,"Hata") 136 | }); 137 | } 138 | 139 | 140 | 141 | async getCreditCardByCardNumber(cardNumber: string) { 142 | return (await this.paymentService.getByCardNumber(cardNumber).toPromise()).data[0]; 143 | } 144 | 145 | setSelectedCard(cardOnEventing: Payment) { 146 | console.log(cardOnEventing) 147 | //this.card = Object.assign(cardOnEventing, { save: false }); 148 | this.cardNameSurname= cardOnEventing.cardNameSurname; 149 | this.cardNumber= cardOnEventing.cardNumber; 150 | this.cardExpiryDate= cardOnEventing.cardExpiryDate; 151 | this.cardCvv= cardOnEventing.cardCvv; 152 | this.customerId= cardOnEventing.customerId; 153 | this.save=false; 154 | } 155 | 156 | } -------------------------------------------------------------------------------- /src/app/components/profile/profile.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/profile/profile.component.css -------------------------------------------------------------------------------- /src/app/components/profile/profile.component.html: -------------------------------------------------------------------------------- 1 |
    3 | 4 |
    5 |
    6 | 7 |

    Update the account

    8 | 9 |
    10 | 12 | 13 |
    14 | 15 |
    16 | 18 | 19 |
    20 | 21 |
    22 | 24 | 25 |
    26 | 27 |
    28 | 30 | 31 |
    32 | 33 |
    34 | 36 | 37 |
    38 | 39 |
    40 | 42 | 43 |


    44 | 45 |

    © 2017–2021

    46 |
    47 |
    48 | 49 | 50 | 51 |
    52 | -------------------------------------------------------------------------------- /src/app/components/profile/profile.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormControl, Validators, FormBuilder } from "@angular/forms"; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Customer } from 'src/app/models/customer/customer'; 6 | import { AuthService } from 'src/app/services/auth.service'; 7 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 8 | 9 | @Component({ 10 | selector: 'app-profile', 11 | templateUrl: './profile.component.html', 12 | styleUrls: ['./profile.component.css'] 13 | }) 14 | export class ProfileComponent implements OnInit { 15 | 16 | customer:Customer; 17 | customerUpdateForm:FormGroup; 18 | 19 | constructor( 20 | private localStorageService:LocalStorageService, 21 | private formBuilder:FormBuilder, 22 | private toastrService:ToastrService, 23 | private authService:AuthService, 24 | private router:Router 25 | ) { } 26 | 27 | ngOnInit(): void { 28 | this.getCustomer(); 29 | this.createCustomerUpdateForm(); 30 | } 31 | 32 | getCustomer(){ 33 | this.customer = this.localStorageService.getCurrentCustomer(); 34 | } 35 | 36 | createCustomerUpdateForm(){ 37 | this.customerUpdateForm = this.formBuilder.group({ 38 | customerId:[this.customer.customerId,Validators.required], 39 | userId:[this.customer.userId,Validators.required], 40 | firstName:[this.customer.firstName,Validators.required], 41 | lastName:[this.customer.lastName,Validators.required], 42 | companyName:[this.customer.companyName,Validators.required], 43 | email:[this.customer.email,Validators.required], 44 | findexPoint: [this.localStorageService.getCurrentCustomer().findexPoint, Validators.required], 45 | password:[""], 46 | confirmPassword:[""] 47 | }) 48 | } 49 | 50 | 51 | update(){ 52 | if(this.customerUpdateForm.invalid){ 53 | this.toastrService.warning("Bütün alanları doldurduğunuzdan emin olun","Dikkat"); 54 | return; 55 | } 56 | 57 | if(this.customerUpdateForm.value["password"] != this.customerUpdateForm.value["confirmPassword"]){ 58 | this.toastrService.error("Şifreler birbiriyle eşleşmiyor","Hata"); 59 | return; 60 | } 61 | 62 | delete this.customerUpdateForm.value["confirmPassword"]; 63 | 64 | let customerModel:Customer = Object.assign({},this.customerUpdateForm.value); 65 | 66 | this.authService.update(customerModel).subscribe(response => { 67 | this.localStorageService.removeCurrentCustomer(); 68 | delete customerModel.password; 69 | this.localStorageService.setCurrentCustomer(customerModel); 70 | this.router.navigate(["/cars"]) 71 | 72 | return this.toastrService.success("Bilgileriniz güncellendi","Başarılı"); 73 | },responseError => { 74 | if(responseError.error.ValidationErrors){ 75 | for (let i = 0; i < responseError.error.ValidationErrors.length; i++) { 76 | this.toastrService.error(responseError.error.ValidationErrors[i].ErrorMessage,"Doğrulama Hatası"); 77 | } 78 | return; 79 | } 80 | this.toastrService.error(responseError.error.StatusCode + " " + responseError.error.Message, responseError.name) 81 | }); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/register/register.component.css -------------------------------------------------------------------------------- /src/app/components/register/register.component.html: -------------------------------------------------------------------------------- 1 | 3 | 4 |
    5 |
    6 | 7 |

    sign up

    8 | 9 |
    10 | 12 | 13 |
    14 | 15 |
    16 | 18 | 19 |
    20 | 21 |
    22 | 24 | 25 |
    26 | 27 |
    28 | 30 | 31 |
    32 | 33 |
    34 | 36 | 37 |
    38 | 39 |
    40 | 42 | 43 |

    44 | 45 |

    46 |
    47 |

    Have an account?  48 | Sign in

    49 |
    50 |

    © 2017–2021

    51 |
    52 |
    53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/app/components/register/register.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormGroup, FormControl, Validators, FormBuilder } from "@angular/forms"; 3 | import { Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Customer } from 'src/app/models/customer/customer'; 6 | import { RegisterModel } from 'src/app/models/register/registerModel'; 7 | import { AuthService } from 'src/app/services/auth.service'; 8 | import { CustomerService } from 'src/app/services/customer.service'; 9 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 10 | 11 | @Component({ 12 | selector: 'app-register', 13 | templateUrl: './register.component.html', 14 | styleUrls: ['./register.component.css'] 15 | }) 16 | export class RegisterComponent implements OnInit { 17 | 18 | registerForm: FormGroup; 19 | currentCustomer:Customer; 20 | 21 | constructor( 22 | private formBuilder: FormBuilder, 23 | private toastrService: ToastrService, 24 | private localStorageService: LocalStorageService, 25 | private authService: AuthService, 26 | private router: Router, 27 | private customerService:CustomerService 28 | ) { } 29 | 30 | ngOnInit(): void { 31 | this.createRegisterForm(); 32 | } 33 | 34 | createRegisterForm() { 35 | this.registerForm = this.formBuilder.group({ 36 | firstName: ["", Validators.required], 37 | lastName: ["", Validators.required], 38 | email: ["", Validators.required], 39 | password: ["", Validators.required], 40 | confirmPassword: ["", Validators.required], 41 | companyName: ["",Validators.required], 42 | findexPoint: [70, Validators.required] 43 | }) 44 | } 45 | 46 | register(){ 47 | if (this.registerForm.invalid) { 48 | this.toastrService.warning("Bütün alanları doldurunuz", "Dikkat"); 49 | return; 50 | } 51 | 52 | if (this.registerForm.value["password"] != this.registerForm.value["confirmPassword"]) { 53 | this.toastrService.error("Şifreler eşleşmiyor", "Hata"); 54 | return; 55 | } 56 | 57 | delete this.registerForm.value["confirmPassword"]; 58 | let registerModel:RegisterModel = Object.assign({}, this.registerForm.value); 59 | 60 | this.authService.register(registerModel).subscribe(response => { 61 | this.localStorageService.setToken("token", response.data.token); 62 | this.getCurrentCustomerByEmail(registerModel.email) 63 | this.toastrService.success("Kayıt oldunuz", "Başarılı"); 64 | return this.router.navigateByUrl('/login'); 65 | }, responseError => { 66 | if (responseError.error.Errors) { 67 | for (let i = 0; i < responseError.error.Errors.length; i++) { 68 | this.toastrService.error(responseError.error.Errors[i].ErrorMessage, 'Doğrulama Hatası'); 69 | } 70 | return; 71 | } 72 | this.toastrService.error(responseError.status + ' ' + responseError.name, responseError.error); 73 | }); 74 | } 75 | 76 | getCurrentCustomerByEmail(email:string){ 77 | this.customerService.getCustomerByEmail(email).subscribe(response=>{ 78 | this.currentCustomer=response.data 79 | this.localStorageService.setCurrentCustomer(this.currentCustomer) 80 | }) 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/app/components/rental/rental.component.css -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.html: -------------------------------------------------------------------------------- 1 | 30 | 35 | 65 | 66 |
    67 |
    68 |
    69 |
    70 | 72 | 73 |
    74 |
    75 |
    76 |
    77 |
    78 |
    79 | 81 | 82 |
    83 |
    84 |

    85 | 86 |
    87 | 93 |
    94 |
    95 | -------------------------------------------------------------------------------- /src/app/components/rental/rental.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 3 | import { ActivatedRoute, Router } from '@angular/router'; 4 | import { ToastrService } from 'ngx-toastr'; 5 | import { Car } from 'src/app/models/car/car'; 6 | import { CarDetail } from 'src/app/models/car/carDetail'; 7 | import { Customer } from 'src/app/models/customer/customer'; 8 | import { Rental } from 'src/app/models/rental/rental'; 9 | import { CarService } from 'src/app/services/car.service'; 10 | import { CustomerService } from 'src/app/services/customer.service'; 11 | import { LocalStorageService } from 'src/app/services/local-storage.service'; 12 | import { RentalService } from 'src/app/services/rental.service'; 13 | 14 | @Component({ 15 | selector: 'app-rental', 16 | templateUrl: './rental.component.html', 17 | styleUrls: ['./rental.component.css'] 18 | }) 19 | export class RentalComponent implements OnInit { 20 | customers: Customer[] = []; 21 | 22 | rental: Rental; 23 | carId: number; 24 | addRentCarForm: FormGroup; 25 | currentDate: Date = new Date() 26 | totalPrice:number = 0; 27 | carDetail:CarDetail 28 | car:CarDetail 29 | 30 | rentDate:Date; 31 | returnDate:Date; 32 | 33 | constructor( 34 | private formBuilder: FormBuilder, 35 | private toastrService: ToastrService, 36 | private rentalService: RentalService, 37 | private activatedRoute: ActivatedRoute, 38 | private customerService: CustomerService, 39 | private router: Router, 40 | private localStorageService:LocalStorageService, 41 | private carService: CarService 42 | ) { } 43 | 44 | ngOnInit(): void { 45 | this.carId = Number(this.activatedRoute.snapshot.paramMap.get('carId')); 46 | this.getCarById(); 47 | this.getCustomerDetails(); 48 | this.createAddRentCarForm(); 49 | } 50 | 51 | getCustomerDetails() { 52 | this.customerService.getCustomerDetails().subscribe(response => { 53 | this.customers = response.data; 54 | }) 55 | } 56 | 57 | getCarById(){ 58 | this.carService.getCarDetailByCarId(this.carId).subscribe(response => { 59 | this.car = response.data[0] 60 | }) 61 | } 62 | 63 | createAddRentCarForm() { 64 | this.addRentCarForm = this.formBuilder.group({ 65 | carId: [this.carId, Validators.required], 66 | customerId: [this.localStorageService.getCurrentCustomer().customerId, Validators.required],//******** */ 67 | rentDate: ['', Validators.required], 68 | returnDate: ['', Validators.required] 69 | }); 70 | } 71 | 72 | setRentingCar() { 73 | if (this.addRentCarForm.invalid) { 74 | this.toastrService.warning('Alanları kontrol ediniz', 'Dikkat'); 75 | return false; 76 | } 77 | this.rental = this.addRentCarForm.value; 78 | let rentDate = new Date(this.rental.rentDate); 79 | let returnDate = new Date(this.rental.returnDate); 80 | if (rentDate < this.currentDate) { 81 | this.toastrService.warning( 82 | 'Kiralama Tarihi, bu günden sonraki günler olmalıdır', 'Dikkat' 83 | ); 84 | return false; 85 | } 86 | if (returnDate < rentDate || returnDate.getDate() == rentDate.getDate()) { 87 | this.toastrService.warning( 88 | 'Dönüş Tarihi, kiralama tarihinden sonraki günler olmalıdır', 'Dikkat' 89 | ); 90 | return false; 91 | } 92 | if(this.localStorageService.getCurrentCustomer().findexPoint > this.car.findexPoint){ 93 | this.rentalService.setRentingCar(this.rental); 94 | this.toastrService.success('Ödeme sayfasına yönlendiriliyorsunuz'); 95 | return this.router.navigate(['/payment']); 96 | }else{ 97 | return this.toastrService.error("Findeks puanınız yetmiyor","Dikkat") 98 | } 99 | 100 | } 101 | 102 | 103 | checkCarRentable() { 104 | this.rentalService.getRentalsByCarId(this.carId).subscribe(responseSuccess => { 105 | if (responseSuccess.data[0] == null) { 106 | this.setRentingCar(); 107 | return true; 108 | } 109 | let lastItem = responseSuccess.data[responseSuccess.data.length - 1]; 110 | if (lastItem.returnDate == null) { 111 | return this.toastrService.error('Bu araç henüz teslim edilmemiş'); 112 | } 113 | let returnDate = new Date(lastItem.returnDate); 114 | this.setRentingCar(); 115 | if (new Date(this.rental.rentDate) < returnDate) { 116 | this.rentalService.removeRentingCar(); 117 | return this.toastrService.warning( 118 | 'Bu aracı bu tarihler arasında kiralayamazsınız', 'Dikkat' 119 | ); 120 | } 121 | return true; 122 | }); 123 | } 124 | 125 | calculatePayment() { 126 | var date1 = new Date(this.getRentingCar().returnDate.toString()); 127 | var date2 = new Date(this.getRentingCar().rentDate.toString()); 128 | var difference = date1.getTime() - date2.getTime(); 129 | var rentDays = Math.ceil(difference / (1000 * 3600 * 24)); 130 | this.totalPrice = rentDays * this.carDetail.dailyPrice; 131 | } 132 | 133 | getRentingCar(): Rental { 134 | return this.rentalService.getRentingCar(); 135 | } 136 | 137 | } -------------------------------------------------------------------------------- /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( 13 | private authService:AuthService, 14 | private toastrService:ToastrService, 15 | private router:Router 16 | ){} 17 | 18 | canActivate( 19 | route: ActivatedRouteSnapshot, 20 | state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { 21 | if(this.authService.isAuthenticated()){ 22 | return true; 23 | }else{ 24 | this.router.navigate(["login"]) 25 | this.toastrService.info("Sisteme giriş yapmalısınız") 26 | return false; 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /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 | import { LocalStorageService } from '../services/local-storage.service'; 10 | // import { request } from 'node:http'; 11 | 12 | @Injectable() 13 | export class AuthInterceptor implements HttpInterceptor { 14 | 15 | constructor(private localStorageService:LocalStorageService) {} 16 | 17 | intercept(request: HttpRequest, next: HttpHandler): Observable> { 18 | let token=this.localStorageService.getToken("token"); 19 | if(!token){ 20 | return next.handle(request); 21 | } 22 | let newRequest:HttpRequest 23 | newRequest=request.clone({ 24 | headers:request.headers.set("Authorization","Bearer "+token) 25 | }) 26 | return next.handle(newRequest); 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/app/models/brand/brand.ts: -------------------------------------------------------------------------------- 1 | export interface Brand{ 2 | brandId:number; 3 | brandName:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/car/car.ts: -------------------------------------------------------------------------------- 1 | export interface Car{ 2 | id:number; 3 | brandId:number; 4 | colorId:number; 5 | modelYear:number; 6 | dailyPrice: number; 7 | description: string; 8 | findexPoint:number; 9 | } -------------------------------------------------------------------------------- /src/app/models/car/carDetail.ts: -------------------------------------------------------------------------------- 1 | import { Car } from "./car"; 2 | 3 | export interface CarDetail extends Car{ 4 | brandName: string; 5 | colorName: string; 6 | imagePath:string; 7 | } -------------------------------------------------------------------------------- /src/app/models/carImage/carImage.ts: -------------------------------------------------------------------------------- 1 | export interface CarImage{ 2 | id:number; 3 | carId:number; 4 | imagePath:string; 5 | date:Date; 6 | } -------------------------------------------------------------------------------- /src/app/models/color/color.ts: -------------------------------------------------------------------------------- 1 | export interface Color{ 2 | colorId:number; 3 | colorName:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/customer/customer.ts: -------------------------------------------------------------------------------- 1 | export interface Customer{ 2 | customerId:number; 3 | userId:number; 4 | companyName:string; 5 | firstName:string; 6 | lastName:string; 7 | email:string; 8 | status:boolean; 9 | findexPoint:number; 10 | password?:string; 11 | } -------------------------------------------------------------------------------- /src/app/models/listResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./responseModel"; 2 | 3 | export interface ListResponseModel extends ResponseModel{ 4 | data:T[]; 5 | } -------------------------------------------------------------------------------- /src/app/models/login/loginModel.ts: -------------------------------------------------------------------------------- 1 | export interface LoginModel{ 2 | email:string; 3 | password:string; 4 | } -------------------------------------------------------------------------------- /src/app/models/payment/payment.ts: -------------------------------------------------------------------------------- 1 | export interface Payment{ 2 | paymentId?:number; 3 | customerId:number; 4 | cardNameSurname:string; 5 | cardNumber:string; 6 | cardCvv:string; 7 | cardExpiryDate:string; 8 | } -------------------------------------------------------------------------------- /src/app/models/register/registerModel.ts: -------------------------------------------------------------------------------- 1 | export interface RegisterModel{ 2 | email:string; 3 | password:string; 4 | firstName:string; 5 | lastName:string; 6 | } -------------------------------------------------------------------------------- /src/app/models/rental/rental.ts: -------------------------------------------------------------------------------- 1 | export interface Rental{ 2 | id:number; 3 | carId:number; 4 | customerId:number; 5 | rentDate:Date; 6 | returnDate:Date; 7 | 8 | } -------------------------------------------------------------------------------- /src/app/models/rental/rentalDetail.ts: -------------------------------------------------------------------------------- 1 | import { Rental } from "./rental"; 2 | 3 | export interface RentalDetail extends Rental{ 4 | 5 | brandName:string; 6 | colorName:string; 7 | companyName:string; 8 | carModelYear:number; 9 | carDailyPrice:string; 10 | carDescription:string; 11 | customerFirstName:string; 12 | customerLastName:string; 13 | } -------------------------------------------------------------------------------- /src/app/models/responseModel.ts: -------------------------------------------------------------------------------- 1 | export interface ResponseModel{ 2 | success:boolean, 3 | message:string 4 | } -------------------------------------------------------------------------------- /src/app/models/singleResponseModel.ts: -------------------------------------------------------------------------------- 1 | import { ResponseModel } from "./responseModel"; 2 | 3 | export interface SingleResponseModel extends ResponseModel{ 4 | data:T; 5 | } -------------------------------------------------------------------------------- /src/app/models/token/tokenModel.ts: -------------------------------------------------------------------------------- 1 | export interface TokenModel{ 2 | token:string; 3 | expiration:string; 4 | } -------------------------------------------------------------------------------- /src/app/pipes/filter-brand.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { Brand } from '../models/brand/brand'; 3 | 4 | @Pipe({ 5 | name: 'filterBrand' 6 | }) 7 | export class FilterBrandPipe implements PipeTransform { 8 | 9 | transform(value: Brand[], filterBrand:string): Brand[] { 10 | filterBrand=filterBrand?filterBrand.toLocaleLowerCase():"" 11 | return filterBrand?value.filter((brand:Brand)=>brand.brandName.toLocaleLowerCase().indexOf(filterBrand)!==-1):value; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/app/pipes/filter-car.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { CarDetail } from '../models/car/carDetail'; 3 | 4 | @Pipe({ 5 | name: 'filterCar' 6 | }) 7 | export class FilterCarPipe implements PipeTransform { 8 | 9 | transform(value:CarDetail[], filterCar:string): CarDetail[] { 10 | filterCar=filterCar?filterCar.toLocaleLowerCase():"" 11 | return filterCar?value.filter((car:CarDetail)=> 12 | car.colorName.toLocaleLowerCase().indexOf(filterCar)!==-1 || 13 | car.brandName.toLocaleLowerCase().indexOf(filterCar)!==-1 || 14 | car.modelYear.toString().indexOf(filterCar)!==-1 || 15 | car.description.toLocaleLowerCase().indexOf(filterCar)!==-1 || 16 | car.dailyPrice.toString().indexOf(filterCar)!==-1 17 | ):value; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/app/pipes/filter-color.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import { Color } from '../models/color/color'; 3 | 4 | @Pipe({ 5 | name: 'filterColor' 6 | }) 7 | export class FilterColorPipe implements PipeTransform { 8 | 9 | transform(value: Color[], filterColor:string): Color[] { 10 | filterColor=filterColor?filterColor.toLocaleLowerCase():"" 11 | return filterColor?value.filter((color:Color)=>color.colorName.toLocaleLowerCase().indexOf(filterColor)!==-1):value; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/app/pipes/vat-added.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | 3 | @Pipe({ 4 | name: 'vatAdded' 5 | }) 6 | export class VatAddedPipe implements PipeTransform { 7 | 8 | transform(value: number, rate:number): number { 9 | return value - ((value * rate) / 100); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/app/services/auth.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/customer'; 5 | import { LoginModel } from '../models/login/loginModel'; 6 | import { SingleResponseModel } from '../models/singleResponseModel'; 7 | import { TokenModel } from '../models/token/tokenModel'; 8 | import { LocalStorageService } from './local-storage.service'; 9 | 10 | @Injectable({ 11 | providedIn: 'root' 12 | }) 13 | export class AuthService { 14 | 15 | apiUrl="https://localhost:44358/api/" 16 | constructor(private httpClient:HttpClient, private localStorageService:LocalStorageService) { } 17 | 18 | login(loginModel:LoginModel):Observable>{ 19 | let newPath=this.apiUrl+"auth/login"; 20 | return this.httpClient.post>(newPath,loginModel); 21 | } 22 | 23 | register(loginModel:LoginModel):Observable>{ 24 | let newPath=this.apiUrl+"auth/register"; 25 | return this.httpClient.post>(newPath,loginModel); 26 | } 27 | 28 | update(customer:Customer):Observable>{ 29 | let newPath = this.apiUrl+"auth/update"; 30 | return this.httpClient.post>(newPath,customer); 31 | } 32 | 33 | isAuthenticated():boolean { 34 | return !!this.localStorageService.getToken("token") 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/app/services/brand.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { Brand } from '../models/brand/brand'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class BrandService { 12 | 13 | apiUrl="https://localhost:44358/api/" 14 | constructor(private httpClient:HttpClient) { } 15 | 16 | getBrands():Observable>{ 17 | let newPath = this.apiUrl+"brands/getall" 18 | return this.httpClient.get>(newPath); 19 | } 20 | 21 | getByBrandId(id:number):Observable>{ 22 | let newPath = this.apiUrl+"brands/getbyid?id="+id; 23 | return this.httpClient.get>(newPath); 24 | } 25 | 26 | add(brand:Brand):Observable{ 27 | let newPath = this.apiUrl+"brands/add"; 28 | return this.httpClient.post(newPath,brand); 29 | } 30 | 31 | update(brand:Brand):Observable{ 32 | let newPath = this.apiUrl+"brands/update"; 33 | return this.httpClient.post(newPath,brand); 34 | } 35 | 36 | delete(brand:Brand):Observable{ 37 | let newPath = this.apiUrl+"brands/delete"; 38 | return this.httpClient.post(newPath,brand); 39 | } 40 | } -------------------------------------------------------------------------------- /src/app/services/car-image.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { CarImage } from '../models/carImage/carImage'; 4 | import { ListResponseModel } from '../models/listResponseModel'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class CarImageService { 10 | 11 | apiUrl='https://localhost:44358/api/'; 12 | 13 | constructor(private httpClient: HttpClient) { } 14 | 15 | getImageByCarId(carId:number){ 16 | let newPath=this.apiUrl+"carimages/getimagesbycarid?carId="+carId; 17 | return this.httpClient.get>(newPath); 18 | } 19 | 20 | getCarsImages(){ 21 | let newPath=this.apiUrl+"carimages/getall"; 22 | return this.httpClient.get>(newPath); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/app/services/car.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | import { Car } from '../models/car/car'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | import { CarDetail } from '../models/car/carDetail'; 7 | import { ResponseModel } from '../models/responseModel'; 8 | 9 | @Injectable({ 10 | providedIn: 'root', 11 | }) 12 | export class CarService { 13 | 14 | apiUrl = 'https://localhost:44358/api/'; 15 | 16 | constructor(private httpClient: HttpClient) {} 17 | 18 | getCars(): Observable> { 19 | let newPath=this.apiUrl+"cars/getcardetails"; 20 | return this.httpClient.get>(newPath); 21 | } 22 | 23 | getCarDetailByCarId(carId:number): Observable> { 24 | let newPath=this.apiUrl+"cars/getcardetailbycarid?carid="+carId; 25 | return this.httpClient.get>(newPath); 26 | } 27 | 28 | getCarDetail(): Observable> { 29 | let newPath=this.apiUrl+"cars/getallcardetail"; 30 | return this.httpClient.get>(newPath); 31 | } 32 | 33 | getCarsByBrandId(brandId:number):Observable>{ 34 | let newPath=this.apiUrl+"cars/getcarsbybrandid?brandId="+brandId; 35 | return this.httpClient.get>(newPath) 36 | } 37 | 38 | getCarsByColorId(colorId:number):Observable>{ 39 | let newPath=this.apiUrl+"cars/getcarsbycolorid?colorId="+colorId; 40 | return this.httpClient.get>(newPath) 41 | } 42 | 43 | getCarListBrandIdColorId(brandId:number, colorId:number):Observable>{ 44 | let newPath=this.apiUrl+"cars/carlistbrandidcolorid?brandId="+brandId+'&colorId='+colorId; 45 | return this.httpClient.get>(newPath); 46 | } 47 | 48 | add(car:Car):Observable{ 49 | let newPath=this.apiUrl+"cars/add"; 50 | return this.httpClient.post(newPath,car); 51 | } 52 | 53 | update(car:Car):Observable{ 54 | let newPath=this.apiUrl+"cars/update"; 55 | return this.httpClient.post(newPath,car); 56 | } 57 | 58 | delete(car:Car):Observable{ 59 | let newPath=this.apiUrl+"cars/delete"; 60 | return this.httpClient.post(newPath,car); 61 | } 62 | } -------------------------------------------------------------------------------- /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/color'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | 8 | @Injectable({ 9 | providedIn: 'root' 10 | }) 11 | export class ColorService { 12 | 13 | apiUrl="https://localhost:44358/api/"; 14 | // colorId:number; 15 | // brandId:number; 16 | constructor(private httpClient:HttpClient) { } 17 | 18 | getColors():Observable>{ 19 | let newPath=this.apiUrl+"colors/getall"; 20 | return this.httpClient.get>(newPath); 21 | } 22 | 23 | getByColorId(id:number):Observable>{ 24 | let newPath = this.apiUrl+"colors/getbyid?id="+id; 25 | return this.httpClient.get>(newPath); 26 | } 27 | 28 | add(color:Color):Observable{ 29 | let newPath = this.apiUrl+"colors/add"; 30 | return this.httpClient.post(newPath,color); 31 | } 32 | 33 | update(color:Color):Observable{ 34 | let newPath = this.apiUrl+"colors/update"; 35 | return this.httpClient.post(newPath,color); 36 | } 37 | 38 | delete(color:Color):Observable{ 39 | let newPath = this.apiUrl+"colors/delete"; 40 | return this.httpClient.post(newPath,color); 41 | } 42 | } -------------------------------------------------------------------------------- /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/customer'; 5 | import { ListResponseModel } from '../models/listResponseModel'; 6 | import { ResponseModel } from '../models/responseModel'; 7 | import { SingleResponseModel } from '../models/singleResponseModel'; 8 | 9 | @Injectable({ 10 | providedIn: 'root', 11 | }) 12 | export class CustomerService { 13 | 14 | apiUrl = 'https://localhost:44358/api/'; 15 | 16 | constructor(private httpClient: HttpClient) {} 17 | 18 | getCustomers(): Observable> { 19 | let newPath=this.apiUrl+"customers/getall"; 20 | return this.httpClient.get>(newPath); 21 | } 22 | 23 | getCustomerDetails(): Observable> { 24 | let newPath=this.apiUrl+"customers/getcustomerdetail"; 25 | return this.httpClient.get>(newPath); 26 | } 27 | 28 | getCustomerById(customerId: number): Observable> { 29 | let newPath = this.apiUrl + "customers/getcustomerdetailbycustomerid?customerId=" + customerId; 30 | return this.httpClient.get>(newPath); 31 | } 32 | 33 | getCustomerByEmail(email:string):Observable>{ 34 | let newPath = this.apiUrl + "customers/getcustomerbyemail?email="+email; 35 | return this.httpClient.get>(newPath); 36 | } 37 | 38 | update(customer: Customer): Observable { 39 | let newPath=this.apiUrl+"customers/update" 40 | return this.httpClient.put(newPath, customer); 41 | } 42 | } -------------------------------------------------------------------------------- /src/app/services/local-storage.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Customer } from '../models/customer/customer'; 3 | 4 | @Injectable({ 5 | providedIn: 'root' 6 | }) 7 | export class LocalStorageService { 8 | 9 | tokenKey:string = "token"; 10 | currentCustomer:string = "currentCustomer"; 11 | constructor() { } 12 | 13 | setToken(key:string, value:any) { 14 | localStorage.setItem(key, value); 15 | } 16 | 17 | getToken(key:string):any { 18 | return localStorage.getItem(key); 19 | } 20 | 21 | removeToken(key:string) { 22 | localStorage.removeItem(key); 23 | } 24 | 25 | setCurrentCustomer(currentCustomerValue:Customer) { 26 | localStorage.setItem(this.currentCustomer, JSON.stringify(currentCustomerValue)); 27 | } 28 | 29 | getCurrentCustomer(): Customer { 30 | var customer = JSON.parse(localStorage.getItem(this.currentCustomer)); 31 | return customer; 32 | } 33 | 34 | removeCurrentCustomer() { 35 | localStorage.removeItem(this.currentCustomer); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/app/services/payment.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from '../models/listResponseModel'; 5 | import { Payment } from '../models/payment/payment'; 6 | import { Rental } from '../models/rental/rental'; 7 | import { ResponseModel } from '../models/responseModel'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class PaymentService { 13 | 14 | apiUrl = "https://localhost:44358/api/"; 15 | 16 | constructor(private httpClient: HttpClient) { } 17 | 18 | addPayment(payment: Payment): Observable { 19 | let newPath = this.apiUrl + "payments/add"; 20 | return this.httpClient.post(newPath, payment); 21 | } 22 | 23 | getByCustomerId(customerId: number): Observable> { 24 | let getByCustomerPath = this.apiUrl + "payments/getbycustomerId?customerId=" + customerId; 25 | return this.httpClient.get>(getByCustomerPath); 26 | } 27 | 28 | verifyCard(card: Payment): Observable { 29 | let newPath = this.apiUrl + "payments/verifycard"; 30 | return this.httpClient.post(newPath, card); 31 | } 32 | 33 | getByCardNumber(cardNumber: string): Observable> { 34 | let newPath = this.apiUrl + "payments/getbycardnumber?cardNumber=" + cardNumber; 35 | return this.httpClient.get>(newPath); 36 | } 37 | 38 | updateCard(card: Payment): Observable { 39 | let newPath = this.apiUrl + "payments/update"; 40 | return this.httpClient.put(newPath, card); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/app/services/rental.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | import { ListResponseModel } from '../models/listResponseModel'; 5 | import { Rental } from '../models/rental/rental'; 6 | import { RentalDetail } from '../models/rental/rentalDetail'; 7 | import { ResponseModel } from '../models/responseModel'; 8 | 9 | @Injectable({ 10 | providedIn: 'root' 11 | }) 12 | export class RentalService { 13 | 14 | rentingCar: Rental; 15 | apiUrl = "https://localhost:44358/api/rentals/"; 16 | 17 | constructor(private httpClient: HttpClient) { this.getRentals()} 18 | 19 | getRentals(): Observable> { 20 | let newPath = this.apiUrl + "getrentaldetails"; 21 | return this.httpClient.get>(newPath); 22 | } 23 | 24 | getRentalsByCarId(carId: number): Observable> { 25 | let newPath = this.apiUrl + "getrentaldetailbycarid?carId=" + carId; 26 | return this.httpClient.get>(newPath); 27 | } 28 | 29 | setRentingCar(rental: Rental) { 30 | this.rentingCar = rental; 31 | } 32 | 33 | getRentingCar() { 34 | return this.rentingCar; 35 | } 36 | 37 | removeRentingCar() { 38 | this.rentingCar = null 39 | } 40 | 41 | addRental(rental: Rental):Observable { 42 | let newPath = this.apiUrl + "add"; 43 | return this.httpClient.post(newPath, rental); 44 | } 45 | } -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/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/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | CarRentalFrontend 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /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: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rzayevsahil/RecapProjectFrontend/a69401f015e99b5e263bced19f32aa8512d8bd7f/src/styles.css -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "strictNullChecks": false, 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 | --------------------------------------------------------------------------------