Compare commits
merge into: nitya_hexa:master
nitya_hexa:Nitya
nitya_hexa:master
nitya_hexa:sreeja
pull from: nitya_hexa:Nitya
nitya_hexa:Nitya
nitya_hexa:master
nitya_hexa:sreeja
4 Commits
| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
1869df986c |
Remove duplicated directory
|
4 years ago |
|
|
966a9bfe00 |
Remove duplicated directory
|
4 years ago |
|
|
33b9fbae63 |
OrderService
|
4 years ago |
|
|
a88a603d09 |
ProductService
|
4 years ago |
1074 changed files with 0 additions and 57222 deletions
Split View
Diff Options
-
0OrderService/OrderService/.gitignore
-
0OrderService/OrderService/.mvn/wrapper/MavenWrapperDownloader.java
-
0OrderService/OrderService/.mvn/wrapper/maven-wrapper.jar
-
0OrderService/OrderService/.mvn/wrapper/maven-wrapper.properties
-
0OrderService/OrderService/mvnw
-
0OrderService/OrderService/mvnw.cmd
-
0OrderService/OrderService/pom.xml
-
0OrderService/OrderService/src/main/java/com/example/demo/OrderServiceApplication.java
-
0OrderService/OrderService/src/main/java/com/example/demo/config/MessagingConfig.java
-
0OrderService/OrderService/src/main/java/com/example/demo/controller/OrderController.java
-
0OrderService/OrderService/src/main/java/com/example/demo/model/Cart.java
-
0OrderService/OrderService/src/main/java/com/example/demo/model/CartDto.java
-
0OrderService/OrderService/src/main/java/com/example/demo/model/OrderDto.java
-
0OrderService/OrderService/src/main/java/com/example/demo/model/OrderStatus.java
-
0OrderService/OrderService/src/main/java/com/example/demo/model/Orders.java
-
0OrderService/OrderService/src/main/java/com/example/demo/model/Product.java
-
0OrderService/OrderService/src/main/java/com/example/demo/model/User.java
-
0OrderService/OrderService/src/main/java/com/example/demo/repository/CartRepo.java
-
0OrderService/OrderService/src/main/java/com/example/demo/repository/OrderRepo.java
-
0OrderService/OrderService/src/main/java/com/example/demo/repository/ProductRepo.java
-
0OrderService/OrderService/src/main/java/com/example/demo/repository/UserRepo.java
-
0OrderService/OrderService/src/main/resources/application.properties
-
0OrderService/OrderService/src/test/java/com/example/demo/OrderServiceApplicationTests.java
-
0ProductService/ProductService/.gitignore
-
0ProductService/ProductService/.mvn/wrapper/MavenWrapperDownloader.java
-
0ProductService/ProductService/.mvn/wrapper/maven-wrapper.jar
-
0ProductService/ProductService/.mvn/wrapper/maven-wrapper.properties
-
0ProductService/ProductService/mvnw
-
0ProductService/ProductService/mvnw.cmd
-
0ProductService/ProductService/pom.xml
-
0ProductService/ProductService/src/main/java/com/example/demo/Product.java
-
0ProductService/ProductService/src/main/java/com/example/demo/ProductController.java
-
0ProductService/ProductService/src/main/java/com/example/demo/ProductRepo.java
-
0ProductService/ProductService/src/main/java/com/example/demo/ProductServiceApplication.java
-
0ProductService/ProductService/src/main/resources/application.properties
-
0ProductService/ProductService/src/main/resources/generated.json
-
0ProductService/ProductService/src/test/java/com/example/demo/ProductServiceApplicationTests.java
-
17angular_frontend/.browserslistrc
-
16angular_frontend/.editorconfig
-
45angular_frontend/.gitignore
-
27angular_frontend/README.md
-
106angular_frontend/angular.json
-
44angular_frontend/karma.conf.js
-
12122angular_frontend/package-lock.json
-
39angular_frontend/package.json
-
18angular_frontend/proxy.conf.json
-
39angular_frontend/src/app/app-routing.module.ts
-
29angular_frontend/src/app/app.component.css
-
45angular_frontend/src/app/app.component.html
-
35angular_frontend/src/app/app.component.spec.ts
-
10angular_frontend/src/app/app.component.ts
-
50angular_frontend/src/app/app.module.ts
-
100angular_frontend/src/app/auth/login/login.component.css
-
19angular_frontend/src/app/auth/login/login.component.html
-
25angular_frontend/src/app/auth/login/login.component.spec.ts
-
63angular_frontend/src/app/auth/login/login.component.ts
-
16angular_frontend/src/app/auth/service/auth-guard.service.spec.ts
-
21angular_frontend/src/app/auth/service/auth-guard.service.ts
-
16angular_frontend/src/app/auth/service/auth.service.spec.ts
-
23angular_frontend/src/app/auth/service/auth.service.ts
-
BINangular_frontend/src/app/banana.jpg
-
24angular_frontend/src/app/components/account/account.component.css
-
18angular_frontend/src/app/components/account/account.component.html
-
25angular_frontend/src/app/components/account/account.component.spec.ts
-
45angular_frontend/src/app/components/account/account.component.ts
-
131angular_frontend/src/app/components/beverages/beverages.component.css
-
8angular_frontend/src/app/components/beverages/beverages.component.html
-
25angular_frontend/src/app/components/beverages/beverages.component.spec.ts
-
37angular_frontend/src/app/components/beverages/beverages.component.ts
-
50angular_frontend/src/app/components/cart/cart.component.css
-
50angular_frontend/src/app/components/cart/cart.component.html
-
25angular_frontend/src/app/components/cart/cart.component.spec.ts
-
159angular_frontend/src/app/components/cart/cart.component.ts
-
100angular_frontend/src/app/components/edit-account/edit-account.component.css
-
51angular_frontend/src/app/components/edit-account/edit-account.component.html
-
25angular_frontend/src/app/components/edit-account/edit-account.component.spec.ts
-
79angular_frontend/src/app/components/edit-account/edit-account.component.ts
-
131angular_frontend/src/app/components/fruits/fruits.component.css
-
9angular_frontend/src/app/components/fruits/fruits.component.html
-
25angular_frontend/src/app/components/fruits/fruits.component.spec.ts
-
39angular_frontend/src/app/components/fruits/fruits.component.ts
-
BINangular_frontend/src/app/components/home/g1.jpg
-
26angular_frontend/src/app/components/home/home.component.css
-
11angular_frontend/src/app/components/home/home.component.html
-
25angular_frontend/src/app/components/home/home.component.spec.ts
-
27angular_frontend/src/app/components/home/home.component.ts
-
131angular_frontend/src/app/components/medicines/medicines.component.css
-
9angular_frontend/src/app/components/medicines/medicines.component.html
-
25angular_frontend/src/app/components/medicines/medicines.component.spec.ts
-
37angular_frontend/src/app/components/medicines/medicines.component.ts
-
51angular_frontend/src/app/components/orders/orders.component.css
-
30angular_frontend/src/app/components/orders/orders.component.html
-
25angular_frontend/src/app/components/orders/orders.component.spec.ts
-
38angular_frontend/src/app/components/orders/orders.component.ts
-
146angular_frontend/src/app/components/product/product.component.css
-
27angular_frontend/src/app/components/product/product.component.html
-
25angular_frontend/src/app/components/product/product.component.spec.ts
-
74angular_frontend/src/app/components/product/product.component.ts
-
171angular_frontend/src/app/components/sign-up/sign-up.component.css
-
65angular_frontend/src/app/components/sign-up/sign-up.component.html
@ -1,17 +0,0 @@ |
|||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. |
|||
# For additional information regarding the format and rule options, please see: |
|||
# https://github.com/browserslist/browserslist#queries |
|||
|
|||
# For the full list of supported browsers by the Angular framework, please see: |
|||
# https://angular.io/guide/browser-support |
|||
|
|||
# You can see what browsers were selected by your queries by running: |
|||
# npx browserslist |
|||
|
|||
last 1 Chrome version |
|||
last 1 Firefox version |
|||
last 2 Edge major versions |
|||
last 2 Safari major versions |
|||
last 2 iOS major versions |
|||
Firefox ESR |
|||
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. |
|||
@ -1,16 +0,0 @@ |
|||
# Editor configuration, see https://editorconfig.org |
|||
root = true |
|||
|
|||
[*] |
|||
charset = utf-8 |
|||
indent_style = space |
|||
indent_size = 2 |
|||
insert_final_newline = true |
|||
trim_trailing_whitespace = true |
|||
|
|||
[*.ts] |
|||
quote_type = single |
|||
|
|||
[*.md] |
|||
max_line_length = off |
|||
trim_trailing_whitespace = false |
|||
@ -1,45 +0,0 @@ |
|||
# See http://help.github.com/ignore-files/ for more about ignoring files. |
|||
|
|||
# compiled output |
|||
/dist |
|||
/tmp |
|||
/out-tsc |
|||
# Only exists if Bazel was run |
|||
/bazel-out |
|||
|
|||
# dependencies |
|||
/node_modules |
|||
|
|||
# profiling files |
|||
chrome-profiler-events*.json |
|||
|
|||
# IDEs and editors |
|||
/.idea |
|||
.project |
|||
.classpath |
|||
.c9/ |
|||
*.launch |
|||
.settings/ |
|||
*.sublime-workspace |
|||
|
|||
# IDE - VSCode |
|||
.vscode/* |
|||
!.vscode/settings.json |
|||
!.vscode/tasks.json |
|||
!.vscode/launch.json |
|||
!.vscode/extensions.json |
|||
.history/* |
|||
|
|||
# misc |
|||
/.sass-cache |
|||
/connect.lock |
|||
/coverage |
|||
/libpeerconnection.log |
|||
npm-debug.log |
|||
yarn-error.log |
|||
testem.log |
|||
/typings |
|||
|
|||
# System Files |
|||
.DS_Store |
|||
Thumbs.db |
|||
@ -1,27 +0,0 @@ |
|||
# GroceryApp |
|||
|
|||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.1.1. |
|||
|
|||
## Development server |
|||
|
|||
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. |
|||
|
|||
## Code scaffolding |
|||
|
|||
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`. |
|||
|
|||
## Build |
|||
|
|||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. |
|||
|
|||
## Running unit tests |
|||
|
|||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). |
|||
|
|||
## Running end-to-end tests |
|||
|
|||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. |
|||
|
|||
## Further help |
|||
|
|||
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. |
|||
@ -1,106 +0,0 @@ |
|||
{ |
|||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", |
|||
"version": 1, |
|||
"newProjectRoot": "projects", |
|||
"projects": { |
|||
"groceryApp": { |
|||
"projectType": "application", |
|||
"schematics": { |
|||
"@schematics/angular:application": { |
|||
"strict": true |
|||
} |
|||
}, |
|||
"root": "", |
|||
"sourceRoot": "src", |
|||
"prefix": "app", |
|||
"architect": { |
|||
"build": { |
|||
"builder": "@angular-devkit/build-angular:browser", |
|||
"options": { |
|||
"outputPath": "dist/groceryApp", |
|||
"index": "src/index.html", |
|||
"main": "src/main.ts", |
|||
"polyfills": "src/polyfills.ts", |
|||
"tsConfig": "tsconfig.app.json", |
|||
"assets": [ |
|||
"src/favicon.ico", |
|||
"src/assets" |
|||
], |
|||
"styles": [ |
|||
"src/styles.css" |
|||
], |
|||
"scripts": [] |
|||
}, |
|||
"configurations": { |
|||
"production": { |
|||
"budgets": [ |
|||
{ |
|||
"type": "initial", |
|||
"maximumWarning": "500kb", |
|||
"maximumError": "1mb" |
|||
}, |
|||
{ |
|||
"type": "anyComponentStyle", |
|||
"maximumWarning": "2kb", |
|||
"maximumError": "4kb" |
|||
} |
|||
], |
|||
"fileReplacements": [ |
|||
{ |
|||
"replace": "src/environments/environment.ts", |
|||
"with": "src/environments/environment.prod.ts" |
|||
} |
|||
], |
|||
"outputHashing": "all" |
|||
}, |
|||
"development": { |
|||
"buildOptimizer": false, |
|||
"optimization": false, |
|||
"vendorChunk": true, |
|||
"extractLicenses": false, |
|||
"sourceMap": true, |
|||
"namedChunks": true |
|||
} |
|||
}, |
|||
"defaultConfiguration": "production" |
|||
}, |
|||
"serve": { |
|||
"builder": "@angular-devkit/build-angular:dev-server", |
|||
"configurations": { |
|||
"production": { |
|||
"browserTarget": "groceryApp:build:production" |
|||
}, |
|||
"development": { |
|||
"browserTarget": "groceryApp:build:development" |
|||
} |
|||
}, |
|||
"defaultConfiguration": "development" |
|||
}, |
|||
"extract-i18n": { |
|||
"builder": "@angular-devkit/build-angular:extract-i18n", |
|||
"options": { |
|||
"browserTarget": "groceryApp:build" |
|||
} |
|||
}, |
|||
"test": { |
|||
"builder": "@angular-devkit/build-angular:karma", |
|||
"options": { |
|||
"main": "src/test.ts", |
|||
"polyfills": "src/polyfills.ts", |
|||
"tsConfig": "tsconfig.spec.json", |
|||
"karmaConfig": "karma.conf.js", |
|||
"assets": [ |
|||
"src/favicon.ico", |
|||
"src/assets" |
|||
], |
|||
"styles": [ |
|||
"src/styles.css" |
|||
], |
|||
"scripts": [] |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"defaultProject": "groceryApp" |
|||
} |
|||
@ -1,44 +0,0 @@ |
|||
// Karma configuration file, see link for more information
|
|||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|||
|
|||
module.exports = function (config) { |
|||
config.set({ |
|||
basePath: '', |
|||
frameworks: ['jasmine', '@angular-devkit/build-angular'], |
|||
plugins: [ |
|||
require('karma-jasmine'), |
|||
require('karma-chrome-launcher'), |
|||
require('karma-jasmine-html-reporter'), |
|||
require('karma-coverage'), |
|||
require('@angular-devkit/build-angular/plugins/karma') |
|||
], |
|||
client: { |
|||
jasmine: { |
|||
// you can add configuration options for Jasmine here
|
|||
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|||
// for example, you can disable the random execution with `random: false`
|
|||
// or set a specific seed with `seed: 4321`
|
|||
}, |
|||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|||
}, |
|||
jasmineHtmlReporter: { |
|||
suppressAll: true // removes the duplicated traces
|
|||
}, |
|||
coverageReporter: { |
|||
dir: require('path').join(__dirname, './coverage/groceryApp'), |
|||
subdir: '.', |
|||
reporters: [ |
|||
{ type: 'html' }, |
|||
{ type: 'text-summary' } |
|||
] |
|||
}, |
|||
reporters: ['progress', 'kjhtml'], |
|||
port: 9876, |
|||
colors: true, |
|||
logLevel: config.LOG_INFO, |
|||
autoWatch: true, |
|||
browsers: ['Chrome'], |
|||
singleRun: false, |
|||
restartOnFileChange: true |
|||
}); |
|||
}; |
|||
12122
angular_frontend/package-lock.json
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,39 +0,0 @@ |
|||
{ |
|||
"name": "grocery-app", |
|||
"version": "0.0.0", |
|||
"scripts": { |
|||
"ng": "ng", |
|||
"start": "ng serve --proxy-config proxy.conf.json --port 17599", |
|||
"build": "ng build", |
|||
"watch": "ng build --watch --configuration development", |
|||
"test": "ng test" |
|||
}, |
|||
"private": true, |
|||
"dependencies": { |
|||
"@angular/animations": "~12.1.1", |
|||
"@angular/common": "~12.1.1", |
|||
"@angular/compiler": "~12.1.1", |
|||
"@angular/core": "~12.1.1", |
|||
"@angular/forms": "~12.1.1", |
|||
"@angular/platform-browser": "~12.1.1", |
|||
"@angular/platform-browser-dynamic": "~12.1.1", |
|||
"@angular/router": "~12.1.1", |
|||
"rxjs": "~6.6.0", |
|||
"tslib": "^2.2.0", |
|||
"zone.js": "~0.11.4" |
|||
}, |
|||
"devDependencies": { |
|||
"@angular-devkit/build-angular": "~12.1.1", |
|||
"@angular/cli": "~12.1.1", |
|||
"@angular/compiler-cli": "~12.1.1", |
|||
"@types/jasmine": "~3.6.0", |
|||
"@types/node": "^12.11.1", |
|||
"jasmine-core": "~3.7.0", |
|||
"karma": "~6.3.0", |
|||
"karma-chrome-launcher": "~3.1.0", |
|||
"karma-coverage": "~2.0.3", |
|||
"karma-jasmine": "~4.0.0", |
|||
"karma-jasmine-html-reporter": "^1.5.0", |
|||
"typescript": "~4.3.2" |
|||
} |
|||
} |
|||
@ -1,18 +0,0 @@ |
|||
{ |
|||
"/userapi": { |
|||
"target": "http://10.3.117.30:5007", |
|||
"secure": false |
|||
}, |
|||
"/productapi": { |
|||
"target": "http://10.3.117.30:5008", |
|||
"secure": false |
|||
}, |
|||
"/cartapi": { |
|||
"target": "http://10.3.117.30:5006", |
|||
"secure": false |
|||
}, |
|||
"/orderapi": { |
|||
"target": "http://10.3.117.30:5009", |
|||
"secure": false |
|||
} |
|||
} |
|||
@ -1,39 +0,0 @@ |
|||
import { NgModule } from '@angular/core'; |
|||
import { RouterModule, Routes } from '@angular/router'; |
|||
import { LoginComponent } from './auth/login/login.component'; |
|||
import { AuthGuardService } from './auth/service/auth-guard.service'; |
|||
import { AccountComponent } from './components/account/account.component'; |
|||
import { BeveragesComponent } from './components/beverages/beverages.component'; |
|||
import { CartComponent } from './components/cart/cart.component'; |
|||
import { EditAccountComponent } from './components/edit-account/edit-account.component'; |
|||
import { FruitsComponent } from './components/fruits/fruits.component'; |
|||
import { HomeComponent } from './components/home/home.component'; |
|||
import { MedicinesComponent } from './components/medicines/medicines.component'; |
|||
import { OrdersComponent } from './components/orders/orders.component'; |
|||
import { ProductComponent } from './components/product/product.component'; |
|||
import { SignUpComponent } from './components/sign-up/sign-up.component'; |
|||
import { SnacksComponent } from './components/snacks/snacks.component'; |
|||
import { VegetablesComponent } from './components/vegetables/vegetables.component'; |
|||
|
|||
const routes: Routes = [ |
|||
// {path: '', component:HomeComponent},
|
|||
{path: 'account/:uid', component : AccountComponent}, |
|||
{path: 'product', component : ProductComponent}, |
|||
{path : 'account-edit/:aid',component : EditAccountComponent }, |
|||
{path: 'register', component : SignUpComponent}, |
|||
{path: 'home', component : HomeComponent}, |
|||
{path: 'fruits', component : FruitsComponent}, |
|||
{path: 'snacks', component : SnacksComponent}, |
|||
{path: 'medicines', component : MedicinesComponent}, |
|||
{path: 'beverages', component : BeveragesComponent}, |
|||
{path: 'vegetables', component : VegetablesComponent}, |
|||
{path: 'login', component : LoginComponent}, |
|||
{path: 'cart', component : CartComponent}, |
|||
{path: 'order', component : OrdersComponent} |
|||
]; |
|||
|
|||
@NgModule({ |
|||
imports: [RouterModule.forRoot(routes)], |
|||
exports: [RouterModule] |
|||
}) |
|||
export class AppRoutingModule { } |
|||
@ -1,29 +0,0 @@ |
|||
body, html { |
|||
height: 100%; |
|||
} |
|||
|
|||
.bg { |
|||
/* The image used */ |
|||
background-image: url("g1.jpg"); |
|||
|
|||
/* Full height */ |
|||
height: 100%; |
|||
width: 100%; |
|||
/* Center and scale the image nicely */ |
|||
background-position: center; |
|||
background-repeat: no-repeat; |
|||
background-size: cover; |
|||
opacity: 0.9; |
|||
} |
|||
.button { |
|||
font: bold 15px Arial; |
|||
text-decoration: none; |
|||
background-color: #5fe697; |
|||
color: #05151f; |
|||
border-radius: 4px; |
|||
padding: 6px 8px 6px 8px; |
|||
border-top: 1px solid #CCCCCC; |
|||
border-right: 1px solid #333333; |
|||
border-bottom: 1px solid #333333; |
|||
border-left: 1px solid #CCCCCC; |
|||
} |
|||
@ -1,45 +0,0 @@ |
|||
<div class="bg"> |
|||
<div> |
|||
<h1 style="text-align:center; opacity: 15; font-size: 50px;" >Express Grocery</h1> |
|||
</div> |
|||
<hr> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<a routerLink="/register" class="button">Register</a> |
|||
|
|||
<a routerLink="/login" class="button">Login</a> |
|||
|
|||
<!-- <a routerLink="/account" class="button">My Account</a> |
|||
|
|||
<a routerLink="/product" class="button">Items Available</a> |
|||
|
|||
<a routerLink="/cart" class="button">My Cart</a> --> |
|||
<hr> |
|||
|
|||
<router-outlet></router-outlet> |
|||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> |
|||
</div> |
|||
@ -1,35 +0,0 @@ |
|||
import { TestBed } from '@angular/core/testing'; |
|||
import { RouterTestingModule } from '@angular/router/testing'; |
|||
import { AppComponent } from './app.component'; |
|||
|
|||
describe('AppComponent', () => { |
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
imports: [ |
|||
RouterTestingModule |
|||
], |
|||
declarations: [ |
|||
AppComponent |
|||
], |
|||
}).compileComponents(); |
|||
}); |
|||
|
|||
it('should create the app', () => { |
|||
const fixture = TestBed.createComponent(AppComponent); |
|||
const app = fixture.componentInstance; |
|||
expect(app).toBeTruthy(); |
|||
}); |
|||
|
|||
it(`should have as title 'groceryApp'`, () => { |
|||
const fixture = TestBed.createComponent(AppComponent); |
|||
const app = fixture.componentInstance; |
|||
expect(app.title).toEqual('groceryApp'); |
|||
}); |
|||
|
|||
it('should render title', () => { |
|||
const fixture = TestBed.createComponent(AppComponent); |
|||
fixture.detectChanges(); |
|||
const compiled = fixture.nativeElement as HTMLElement; |
|||
expect(compiled.querySelector('.content span')?.textContent).toContain('groceryApp app is running!'); |
|||
}); |
|||
}); |
|||
@ -1,10 +0,0 @@ |
|||
import { Component } from '@angular/core'; |
|||
|
|||
@Component({ |
|||
selector: 'app-root', |
|||
templateUrl: './app.component.html', |
|||
styleUrls: ['./app.component.css'] |
|||
}) |
|||
export class AppComponent { |
|||
|
|||
} |
|||
@ -1,50 +0,0 @@ |
|||
import { NgModule } from '@angular/core'; |
|||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
|||
import { BrowserModule } from '@angular/platform-browser'; |
|||
import {HttpClientModule} from '@angular/common/http'; |
|||
import { AppRoutingModule } from './app-routing.module'; |
|||
import { AppComponent } from './app.component'; |
|||
import { AccountComponent } from './components/account/account.component'; |
|||
import { EditAccountComponent } from './components/edit-account/edit-account.component'; |
|||
import { SignUpComponent } from './components/sign-up/sign-up.component'; |
|||
import { LoginComponent } from './auth/login/login.component'; |
|||
import { ProductComponent } from './components/product/product.component'; |
|||
import { CartComponent } from './components/cart/cart.component'; |
|||
import { FilterPipe } from './shared/filter.pipe'; |
|||
import { FruitsComponent } from './components/fruits/fruits.component'; |
|||
import { VegetablesComponent } from './components/vegetables/vegetables.component'; |
|||
import { SnacksComponent } from './components/snacks/snacks.component'; |
|||
import { BeveragesComponent } from './components/beverages/beverages.component'; |
|||
import { MedicinesComponent } from './components/medicines/medicines.component'; |
|||
import { HomeComponent } from './components/home/home.component'; |
|||
import { OrdersComponent } from './components/orders/orders.component'; |
|||
|
|||
@NgModule({ |
|||
declarations: [ |
|||
AppComponent, |
|||
AccountComponent, |
|||
EditAccountComponent, |
|||
SignUpComponent, |
|||
LoginComponent, |
|||
ProductComponent, |
|||
CartComponent, |
|||
FilterPipe, |
|||
FruitsComponent, |
|||
VegetablesComponent, |
|||
SnacksComponent, |
|||
BeveragesComponent, |
|||
MedicinesComponent, |
|||
HomeComponent, |
|||
OrdersComponent |
|||
], |
|||
imports: [ |
|||
BrowserModule, |
|||
AppRoutingModule, |
|||
ReactiveFormsModule, |
|||
HttpClientModule, |
|||
FormsModule |
|||
], |
|||
providers: [], |
|||
bootstrap: [AppComponent] |
|||
}) |
|||
export class AppModule { } |
|||
@ -1,100 +0,0 @@ |
|||
@import url(https://fonts.googleapis.com/css?family=Roboto:300); |
|||
|
|||
.login-page { |
|||
width: 360px; |
|||
padding: 8% 0 0; |
|||
margin: auto; |
|||
} |
|||
.form { |
|||
position: relative; |
|||
z-index: 1; |
|||
background: #FFFFFF; |
|||
max-width: 360px; |
|||
margin: 0 auto 100px; |
|||
padding: 45px; |
|||
text-align: center; |
|||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24); |
|||
} |
|||
.form input { |
|||
font-family: "Roboto", sans-serif; |
|||
outline: 0; |
|||
background: #f2f2f2; |
|||
width: 100%; |
|||
border: 0; |
|||
margin: 0 0 15px; |
|||
padding: 15px; |
|||
box-sizing: border-box; |
|||
font-size: 14px; |
|||
} |
|||
.form button { |
|||
font-family: "Roboto", sans-serif; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #4CAF50; |
|||
width: 100%; |
|||
border: 0; |
|||
padding: 15px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
.form button:hover,.form button:active,.form button:focus { |
|||
background: #43A047; |
|||
} |
|||
.form .message { |
|||
margin: 15px 0 0; |
|||
color: #b3b3b3; |
|||
font-size: 12px; |
|||
} |
|||
.form .message a { |
|||
color: #4CAF50; |
|||
text-decoration: none; |
|||
} |
|||
.form .register-form { |
|||
display: none; |
|||
} |
|||
.container { |
|||
position: relative; |
|||
z-index: 1; |
|||
max-width: 300px; |
|||
margin: 0 auto; |
|||
} |
|||
.container:before, .container:after { |
|||
content: ""; |
|||
display: block; |
|||
clear: both; |
|||
} |
|||
.container .info { |
|||
margin: 50px auto; |
|||
text-align: center; |
|||
} |
|||
.container .info h1 { |
|||
margin: 0 0 15px; |
|||
padding: 0; |
|||
font-size: 36px; |
|||
font-weight: 300; |
|||
color: #1a1a1a; |
|||
} |
|||
.container .info span { |
|||
color: #4d4d4d; |
|||
font-size: 12px; |
|||
} |
|||
.container .info span a { |
|||
color: #000000; |
|||
text-decoration: none; |
|||
} |
|||
.container .info span .fa { |
|||
color: #EF3B3A; |
|||
} |
|||
body { |
|||
background: #76b852; /* fallback for old browsers */ |
|||
background: -webkit-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -moz-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -o-linear-gradient(right, #76b852, #8DC26F); |
|||
background: linear-gradient(to left, #76b852, #8DC26F); |
|||
font-family: "Roboto", sans-serif; |
|||
-webkit-font-smoothing: antialiased; |
|||
-moz-osx-font-smoothing: grayscale; |
|||
} |
|||
@ -1,19 +0,0 @@ |
|||
<div class="login-page"> |
|||
<div class="form"> |
|||
<p>Please Login</p> |
|||
<hr> |
|||
|
|||
{{msg}} |
|||
<form class="login-form" [formGroup]='loginForm' (submit)='OnLoginFormSubmit()' style="border:1px solid #ccc"> |
|||
Username: <input type="text" formControlName="username"> |
|||
<div *ngIf="loginForm.controls['username'].invalid &&(loginForm.controls['username'].touched || |
|||
loginForm.controls['username'].dirty)">Invalid username</div> |
|||
<br><br> |
|||
Password: <input type="password" formControlName="password"> |
|||
<div *ngIf="loginForm.controls['password'].invalid &&(loginForm.controls['password'].touched || |
|||
loginForm.controls['password'].dirty)">Invalid password</div> |
|||
<br><br> |
|||
|
|||
<button [disabled]="!loginForm.valid">login</button> |
|||
</form> |
|||
</div> |
|||
@ -1,25 +0,0 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { LoginComponent } from './login.component'; |
|||
|
|||
describe('LoginComponent', () => { |
|||
let component: LoginComponent; |
|||
let fixture: ComponentFixture<LoginComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ LoginComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(LoginComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,63 +0,0 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
import { Router } from '@angular/router'; |
|||
import { Account } from 'src/app/model/account.model'; |
|||
|
|||
import { AccountService } from 'src/app/service/account.service'; |
|||
|
|||
@Component({ |
|||
selector: 'app-login', |
|||
templateUrl: './login.component.html', |
|||
styleUrls: ['./login.component.css'] |
|||
}) |
|||
export class LoginComponent implements OnInit { |
|||
|
|||
loginForm: any; |
|||
user : Account = new Account(); |
|||
msg: string; |
|||
constructor(private route: Router, private accountService : AccountService) { |
|||
this.msg = ''; |
|||
} |
|||
|
|||
ngOnInit(): void { |
|||
this.loginForm = new FormGroup({ |
|||
username : new FormControl('',Validators.required), |
|||
password : new FormControl('',Validators.required) |
|||
|
|||
}); |
|||
} |
|||
OnLoginFormSubmit(){ |
|||
|
|||
// this.accountService.getAccounts().subscribe(res=>{
|
|||
// const user = res.find((a:any)=>{
|
|||
// return a.username == this.loginForm.value.username && a.password == this.loginForm.value.password;
|
|||
|
|||
// });
|
|||
// if(user){
|
|||
// alert("Login Success");
|
|||
// this.loginForm.reset();
|
|||
// this.route.navigateByUrl('/home');
|
|||
// }else{
|
|||
// alert("user not found");
|
|||
// }
|
|||
// },err=>{
|
|||
// alert("Something went wrong!!");
|
|||
// })
|
|||
this.user = { |
|||
username :this.loginForm.value.username, |
|||
password :this.loginForm.value.password |
|||
} |
|||
this.accountService.login(this.user).subscribe((data: any)=>{ |
|||
window.sessionStorage.setItem("username",this.user.username); |
|||
window.sessionStorage.setItem("isLoggedIn","true"); |
|||
this.route.navigateByUrl('/home'); |
|||
}), |
|||
(err: any)=>{ |
|||
this.msg='Invalid credentials'; |
|||
window.sessionStorage.removeItem('username'); |
|||
window.sessionStorage.removeItem('isLoggedIn'); |
|||
}; |
|||
|
|||
} |
|||
|
|||
} |
|||
@ -1,16 +0,0 @@ |
|||
import { TestBed } from '@angular/core/testing'; |
|||
|
|||
import { AuthGuardService } from './auth-guard.service'; |
|||
|
|||
describe('AuthGuardService', () => { |
|||
let service: AuthGuardService; |
|||
|
|||
beforeEach(() => { |
|||
TestBed.configureTestingModule({}); |
|||
service = TestBed.inject(AuthGuardService); |
|||
}); |
|||
|
|||
it('should be created', () => { |
|||
expect(service).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,21 +0,0 @@ |
|||
import { Injectable } from '@angular/core'; |
|||
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router'; |
|||
import { AuthService } from './auth.service'; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root' |
|||
}) |
|||
export class AuthGuardService implements CanActivate { |
|||
|
|||
status : boolean; |
|||
constructor(private authService : AuthService,private route : Router) { } |
|||
|
|||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean{ |
|||
this.status = this.authService.isAuthenticated(); |
|||
if(this.status == false){ |
|||
this.route.navigateByUrl('/login'); |
|||
} |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
@ -1,16 +0,0 @@ |
|||
import { TestBed } from '@angular/core/testing'; |
|||
|
|||
import { AuthService } from './auth.service'; |
|||
|
|||
describe('AuthService', () => { |
|||
let service: AuthService; |
|||
|
|||
beforeEach(() => { |
|||
TestBed.configureTestingModule({}); |
|||
service = TestBed.inject(AuthService); |
|||
}); |
|||
|
|||
it('should be created', () => { |
|||
expect(service).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,23 +0,0 @@ |
|||
import { Injectable } from '@angular/core'; |
|||
import { Account } from 'src/app/model/account.model'; |
|||
|
|||
|
|||
@Injectable({ |
|||
providedIn: 'root' |
|||
}) |
|||
export class AuthService { |
|||
|
|||
user: Account = new Account(); |
|||
|
|||
constructor() { |
|||
|
|||
} |
|||
isAuthenticated() : boolean { |
|||
this.user.username = window.sessionStorage.getItem('username'); |
|||
let isLoggedIn = window.sessionStorage.getItem('isLoggedIn'); |
|||
if(isLoggedIn == 'true') |
|||
return true; |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
@ -1,24 +0,0 @@ |
|||
.button { |
|||
font: bold 15px Arial; |
|||
text-decoration: none; |
|||
background-color: #5fe697; |
|||
color: #05151f; |
|||
border-radius: 4px; |
|||
padding: 6px 8px 6px 8px; |
|||
border-top: 1px solid #CCCCCC; |
|||
border-right: 1px solid #333333; |
|||
border-bottom: 1px solid #333333; |
|||
border-left: 1px solid #CCCCCC; |
|||
cursor: pointer; |
|||
} |
|||
.form { |
|||
display: block; |
|||
background: #FFFFFF; |
|||
max-width: 300px; |
|||
margin: 10px 30px; |
|||
margin-bottom: 30px; |
|||
padding: 45px; |
|||
text-align: left; |
|||
align-self: center; |
|||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24); |
|||
} |
|||
@ -1,18 +0,0 @@ |
|||
<span class="button" (click)='back()'>BACK TO HOME</span> |
|||
<h2 style="margin-left: 430px;font-size: 30px;">My Account Details</h2> |
|||
<BR>{{msg}}<BR> |
|||
|
|||
<!-- <div *ngFor="let a of accounts" style="margin-left: 400px;" class="form" > --> |
|||
<div style="margin-left: 400px;" class="form"> |
|||
<b style="font-size: 20px;">Representative Details</b><br><br><b>Username:</b> {{accounts.username}} <br> <b>Name:</b> {{accounts.fullname}} <br> <b>Gender:</b> {{accounts.gender}} <br> <b>Phone no.:</b> {{accounts.phone}} <br> <b>Email:</b> {{accounts.email}} <br><br><b style="font-size: 20px;">Building Details</b><br><br> <b>Building Address:</b> {{accounts.address}} <br> <b>City:</b> {{accounts.city}} <br> <b>State:</b> {{accounts.state}} <br> <b>Pincode:</b> {{accounts.pincode}} <br> <b>Apartments:</b> {{accounts.apartments}} |
|||
<br><br> |
|||
<br><br> |
|||
|
|||
|
|||
|
|||
<a href='javascript:void(0)' class="button" (click)='onAccountEdit(accounts.id!)'>UPDATE</a> |
|||
<br><br> |
|||
<br><br> |
|||
</div> |
|||
|
|||
|
|||
@ -1,25 +0,0 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { AccountComponent } from './account.component'; |
|||
|
|||
describe('AccountComponent', () => { |
|||
let component: AccountComponent; |
|||
let fixture: ComponentFixture<AccountComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ AccountComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(AccountComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,45 +0,0 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
import { ActivatedRoute, Router } from '@angular/router'; |
|||
import { Account } from 'src/app/model/account.model'; |
|||
import { AccountService } from 'src/app/service/account.service'; |
|||
|
|||
@Component({ |
|||
selector: 'app-account', |
|||
templateUrl: './account.component.html', |
|||
styleUrls: ['./account.component.css'] |
|||
}) |
|||
export class AccountComponent implements OnInit { |
|||
|
|||
|
|||
accounts : any; |
|||
msg:string; |
|||
uid: any ; |
|||
username: any; |
|||
constructor(private actRoute: ActivatedRoute,private accountService : AccountService, private route: Router){ |
|||
this.accounts = []; |
|||
this.msg =''; |
|||
|
|||
} |
|||
ngOnInit(): void { |
|||
this.actRoute.paramMap.subscribe(params =>{ |
|||
this.uid = params.get('uid'); |
|||
}); |
|||
this.accountService.getOneAccount(this.uid).subscribe(data =>{ |
|||
this.accounts = data; |
|||
console.log(data) |
|||
}); |
|||
|
|||
} |
|||
|
|||
|
|||
onAccountEdit(id: number){ |
|||
this.route.navigateByUrl('/account-edit/' +id); |
|||
} |
|||
|
|||
back(){ |
|||
this.route.navigateByUrl("/home"); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -1,131 +0,0 @@ |
|||
@import url(https://fonts.googleapis.com/css?family=Roboto:300); |
|||
|
|||
.login-page { |
|||
width: 260px; |
|||
padding: 8% 0 0; |
|||
align-items: left; |
|||
margin: 0 20px; |
|||
} |
|||
.form { |
|||
display: inline-block; |
|||
background: #FFFFFF; |
|||
max-width: 165px; |
|||
margin: 50px 30px; |
|||
padding: 45px; |
|||
text-align: left; |
|||
align-self: left; |
|||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24); |
|||
} |
|||
.form input { |
|||
font-family: "Roboto", sans-serif; |
|||
outline: 0; |
|||
background: #f2f2f2; |
|||
width: 100%; |
|||
border: 0; |
|||
margin: 0 0 15px; |
|||
padding: 15px; |
|||
box-sizing: border-box; |
|||
font-size: 14px; |
|||
} |
|||
.form button { |
|||
font-family: "Roboto", sans-serif; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #4CAF50; |
|||
margin: 10px 0; |
|||
width: 100%; |
|||
border: 0; |
|||
padding: 10px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
.form button:hover,.form button:active,.form button:focus { |
|||
background: #43A047; |
|||
} |
|||
.form .message { |
|||
margin: 15px 0 0; |
|||
color: #b3b3b3; |
|||
font-size: 12px; |
|||
} |
|||
.form .message a { |
|||
color: #4CAF50; |
|||
text-decoration: none; |
|||
} |
|||
.form .register-form { |
|||
display: none; |
|||
} |
|||
.container { |
|||
position: relative; |
|||
z-index: 1; |
|||
max-width: 300px; |
|||
margin: 0 auto; |
|||
} |
|||
.container:before, .container:after { |
|||
content: ""; |
|||
display: block; |
|||
clear: both; |
|||
} |
|||
.container .info { |
|||
margin: 50px auto; |
|||
text-align: center; |
|||
} |
|||
.container .info h1 { |
|||
margin: 0 0 15px; |
|||
padding: 0; |
|||
font-size: 36px; |
|||
font-weight: 300; |
|||
color: #1a1a1a; |
|||
} |
|||
.container .info span { |
|||
color: #4d4d4d; |
|||
font-size: 12px; |
|||
} |
|||
.container .info span a { |
|||
color: #000000; |
|||
text-decoration: none; |
|||
} |
|||
.container .info span .fa { |
|||
color: #EF3B3A; |
|||
} |
|||
body { |
|||
background: #76b852; /* fallback for old browsers */ |
|||
background: -webkit-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -moz-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -o-linear-gradient(right, #76b852, #8DC26F); |
|||
background: linear-gradient(to left, #76b852, #8DC26F); |
|||
font-family: "Roboto", sans-serif; |
|||
-webkit-font-smoothing: antialiased; |
|||
-moz-osx-font-smoothing: grayscale; |
|||
} |
|||
.form-control{ |
|||
border-radius: 3px; |
|||
width: 600px; |
|||
height: 30px; |
|||
margin-left: 23px; |
|||
} |
|||
.search-icon { |
|||
position: absolute; |
|||
z-index: 10; |
|||
right: 50%; |
|||
top: 20px; |
|||
color: black; |
|||
} |
|||
button { |
|||
font-family: "Roboto", sans-serif; |
|||
border-radius: 6px; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #62a7c2; |
|||
margin: 30px 20px; |
|||
width: 100px; |
|||
border: 0; |
|||
padding: 10px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
<div *ngFor="let p of products" class="form"> |
|||
|
|||
|
|||
<img src={{p.imag}} width="150px" height="100px"><br> <b>Item Name:</b> {{p.name}} <br> <b>Price:</b> {{p.price}} <br><b>Category:</b> {{p.category}} |
|||
|
|||
<br> |
|||
<button (click)=addtocart1(p.id!)>Add to cart</button> |
|||
</div> |
|||
@ -1,25 +0,0 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { BeveragesComponent } from './beverages.component'; |
|||
|
|||
describe('BeveragesComponent', () => { |
|||
let component: BeveragesComponent; |
|||
let fixture: ComponentFixture<BeveragesComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ BeveragesComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(BeveragesComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,37 +0,0 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
import { Router } from '@angular/router'; |
|||
import { Product } from 'src/app/model/product.model'; |
|||
import { CartService } from 'src/app/service/cart.service'; |
|||
import { ProductService } from 'src/app/service/product.service'; |
|||
|
|||
@Component({ |
|||
selector: 'app-beverages', |
|||
templateUrl: './beverages.component.html', |
|||
styleUrls: ['./beverages.component.css'] |
|||
}) |
|||
export class BeveragesComponent implements OnInit { |
|||
|
|||
products:Product[]; |
|||
name:string; |
|||
uid!:any; |
|||
constructor(private productService:ProductService, private route:Router,private cartService:CartService) { |
|||
this.products=[]; |
|||
this.name='Beverages'; |
|||
} |
|||
|
|||
ngOnInit(): void { |
|||
this.productService.getProductsByCategory(this.name).subscribe(data=>{ |
|||
this.products=data; |
|||
}) |
|||
} |
|||
addtocart(p:any){ |
|||
this.cartService.addtoCart(p); |
|||
} |
|||
addtocart1(pid:any){ |
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.postCart(this.uid, pid).subscribe(data=>{ |
|||
console.log('added to cart'); |
|||
}) |
|||
} |
|||
|
|||
} |
|||
@ -1,50 +0,0 @@ |
|||
.card{ |
|||
height: 60vh; |
|||
width: 25px; |
|||
padding: 25px; |
|||
} |
|||
.center{ |
|||
position: absolute; |
|||
top: 50%; |
|||
left: 50%; |
|||
transform: translate(-50%, -50%); |
|||
text-align: center; |
|||
} |
|||
#customers { |
|||
font-family: Arial, Helvetica, sans-serif; |
|||
border-collapse: collapse; |
|||
width: 100%; |
|||
} |
|||
|
|||
#customers td, #customers th { |
|||
border: 1px solid #ddd; |
|||
padding: 8px; |
|||
} |
|||
|
|||
#customers tr:nth-child(even){background-color: #f2f2f2;} |
|||
|
|||
#customers tr:hover {background-color: #ddd;} |
|||
|
|||
#customers th { |
|||
padding-top: 12px; |
|||
padding-bottom: 12px; |
|||
text-align: left; |
|||
background-color: #04AA6D; |
|||
color: white; |
|||
} |
|||
.button { |
|||
font-family: "Roboto", sans-serif; |
|||
border-radius: 6px; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #e48ac6; |
|||
margin: 10px 20px; |
|||
width: 130px; |
|||
border: 0; |
|||
padding: 10px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
@ -1,50 +0,0 @@ |
|||
<ng-container *ngIf="product.length !=0"> |
|||
<div class="card-table"> |
|||
<div class="card-product"> |
|||
<table class="table table-responsive" id="customers"> |
|||
<thead> |
|||
<tr> |
|||
<th>Sr.No</th> |
|||
<th>Product Name</th> |
|||
<th>Price</th> |
|||
<th>Quantity</th> |
|||
<th>Total</th> |
|||
<th>Action</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr *ngFor="let p of cartdto; let i = index"> |
|||
<td>{{i+1}}</td> |
|||
<td>{{p.name}}</td> |
|||
<td>{{p.price}}</td> |
|||
<td><button (click)="dec(p,p.cid!)">-</button>{{p.quantity}}<button (click)="inc(p,p.cid!)">+</button></td> |
|||
<!-- <td>{{p.quantity * p.price | number}}</td> --> |
|||
<td>{{p.price*p.quantity}}</td> |
|||
<td> |
|||
<button class="button" (click)="removeItem(p.cid!)">Delete</button> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="4"></td> |
|||
<td><button class="button" (click)="emptycart()">Empty Cart</button></td> |
|||
<td><button class="button" routerLink="/product">Buy More</button></td> |
|||
<td><button class="button" (click)=onCheckout() routerLink="/order">Checkout</button></td> |
|||
<td><strong>Grand Total : Rs.{{grandTotal1}}</strong></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</ng-container> |
|||
<ng-container *ngIf="product.length ==0"> |
|||
<div class="container"> |
|||
<div class="card"> |
|||
|
|||
</div> |
|||
<div class="center"> |
|||
<img src="" alt=""> |
|||
<h3>Your cart is empty!</h3> |
|||
<button class="button" routerLink="/product">Want to Buy!!</button> |
|||
</div> |
|||
</div> |
|||
</ng-container> |
|||
@ -1,25 +0,0 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { CartComponent } from './cart.component'; |
|||
|
|||
describe('CartComponent', () => { |
|||
let component: CartComponent; |
|||
let fixture: ComponentFixture<CartComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ CartComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(CartComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,159 +0,0 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
import { Cart } from 'src/app/model/cart.model'; |
|||
import { CartDto } from 'src/app/model/cartDto.model'; |
|||
import { OrderDto } from 'src/app/model/orderDto.model'; |
|||
import { Orders } from 'src/app/model/orders.model'; |
|||
import { CartService } from 'src/app/service/cart.service'; |
|||
import { OrdersService } from 'src/app/service/orders.service'; |
|||
|
|||
@Component({ |
|||
selector: 'app-cart', |
|||
templateUrl: './cart.component.html', |
|||
styleUrls: ['./cart.component.css'] |
|||
}) |
|||
export class CartComponent implements OnInit { |
|||
|
|||
public product : any=[]; |
|||
cartItem!:Cart[]; |
|||
cartdto!: CartDto[]; |
|||
orderdto!: OrderDto[]; |
|||
uid!:any; |
|||
msg: string=''; |
|||
public grandTotal : number = 0; |
|||
public grandTotal1 : any; |
|||
constructor(private cartService : CartService,private orderService:OrdersService) { |
|||
|
|||
} |
|||
|
|||
ngOnInit(): void { |
|||
this.cartService.getProducts().subscribe(res=>{ |
|||
this.product = res; |
|||
// this.grandTotal = this.cartService.getTotalPrice();
|
|||
}) |
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.getCartdto(this.uid).subscribe(res=>{ |
|||
this.cartdto = res; |
|||
}) |
|||
// this.uid = window.sessionStorage.getItem('userid');
|
|||
// this.orderService.getOrderdto(this.uid).subscribe(res=>{
|
|||
// this.orderdto = res;
|
|||
// })
|
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.CartSum(this.uid).subscribe(res=>{ |
|||
this.grandTotal1 = res; |
|||
}) |
|||
|
|||
} |
|||
|
|||
checkout(){ |
|||
this.orderService.checkout(); |
|||
} |
|||
onCheckout(){ |
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.getCartdto(this.uid).subscribe(res=>{ |
|||
this.orderdto = res; |
|||
console.log(this.orderdto); |
|||
}) |
|||
this.orderService.addOrder(this.uid).subscribe(data=>{ |
|||
console.log('added to order'); |
|||
}) |
|||
} |
|||
removeItem(cid: number){ |
|||
// this.cartService.removeCartItem(item);
|
|||
this.cartService.deleteCartItem(cid).subscribe(data=>{ |
|||
this.cartdto.forEach((i,index)=>{ |
|||
if(i.cid == cid){ |
|||
this.cartdto.splice(index,1); |
|||
|
|||
} |
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.CartSum(this.uid).subscribe(res=>{ |
|||
this.grandTotal1 = res; |
|||
console.log("deleted"); |
|||
}) |
|||
}) |
|||
}, |
|||
(err:any)=>{ |
|||
this.msg = 'unable to delete record'; |
|||
} |
|||
) |
|||
|
|||
} |
|||
removeOrder(oid: number){ |
|||
this.orderService.deleteOrderItem(oid).subscribe(data=>{ |
|||
this.orderdto.forEach((i,index)=>{ |
|||
if(i.cid == oid){ |
|||
this.orderdto.splice(index,1); |
|||
|
|||
} |
|||
|
|||
}) |
|||
}, |
|||
(err:any)=>{ |
|||
this.msg = 'unable to delete record'; |
|||
} |
|||
) |
|||
} |
|||
// onCartItemDelete(id: number){
|
|||
// this.cartService.deleteCartItem(id).subscribe(data=>{
|
|||
// this.cartdto.forEach((i,index)=>{
|
|||
// if(i.cid == id){
|
|||
// this.product.splice(index,1);
|
|||
|
|||
// }
|
|||
// })
|
|||
// },
|
|||
// (err:any)=>{
|
|||
// this.msg = 'unable to delete record';
|
|||
// }
|
|||
// )
|
|||
// }
|
|||
emptycart(){ |
|||
this.cartService.removeAllCart(); |
|||
} |
|||
inc(prod:any, cid: number){ |
|||
|
|||
if(prod.quantity != 5){ |
|||
prod.quantity = prod.quantity + 1; |
|||
this.cartService.postQuantity(cid, prod.quantity).subscribe(data=>{ |
|||
console.log('added to cart'); |
|||
}) |
|||
|
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.CartSum(this.uid).subscribe(res=>{ |
|||
this.grandTotal1 = res; |
|||
}) |
|||
} |
|||
|
|||
} |
|||
dec(prod:any, cid: number){ |
|||
|
|||
if(prod.quantity != 1){ |
|||
|
|||
prod.quantity = prod.quantity - 1; |
|||
this.cartService.postQuantity(cid, prod.quantity).subscribe(data=>{ |
|||
console.log('deleted from cart'); |
|||
}) |
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.CartSum(this.uid).subscribe(res=>{ |
|||
this.grandTotal1 = res; |
|||
}) |
|||
} |
|||
|
|||
} |
|||
// OnCheckout(){
|
|||
// let orders : Orders = {
|
|||
// name : this.accountForm.value.username,
|
|||
// fullname : this.accountForm.value.fullname,
|
|||
// gender : this.accountForm.value.gender,
|
|||
// phone : this.accountForm.value.phone,
|
|||
// email : this.accountForm.value.email,
|
|||
// address : this.accountForm.value.address,
|
|||
// city : this.accountForm.value.city,
|
|||
// state : this.accountForm.value.state,
|
|||
// pincode : this.accountForm.value.pincode,
|
|||
// apartments : this.accountForm.value.apartments,
|
|||
|
|||
|
|||
// }
|
|||
} |
|||
@ -1,100 +0,0 @@ |
|||
@import url(https://fonts.googleapis.com/css?family=Roboto:300); |
|||
|
|||
.login-page { |
|||
width: 700px; |
|||
padding: 8% 0 0; |
|||
margin: auto; |
|||
} |
|||
.form { |
|||
position: relative; |
|||
z-index: 1; |
|||
background: #FFFFFF; |
|||
max-width: 700px; |
|||
margin: 0 auto 100px; |
|||
padding: 45px; |
|||
text-align: center; |
|||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24); |
|||
} |
|||
.form input { |
|||
font-family: "Roboto", sans-serif; |
|||
outline: 0; |
|||
background: #f2f2f2; |
|||
width: 50%; |
|||
border: 0; |
|||
margin: 0 0 15px; |
|||
padding: 10px; |
|||
box-sizing: border-box; |
|||
font-size: 14px; |
|||
} |
|||
.form button { |
|||
font-family: "Roboto", sans-serif; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #4CAF50; |
|||
width: 100%; |
|||
border: 0; |
|||
padding: 15px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
.form button:hover,.form button:active,.form button:focus { |
|||
background: #43A047; |
|||
} |
|||
.form .message { |
|||
margin: 15px 0 0; |
|||
color: #b3b3b3; |
|||
font-size: 12px; |
|||
} |
|||
.form .message a { |
|||
color: #4CAF50; |
|||
text-decoration: none; |
|||
} |
|||
.form .register-form { |
|||
display: none; |
|||
} |
|||
.container { |
|||
position: relative; |
|||
z-index: 1; |
|||
max-width: 300px; |
|||
margin: 0 auto; |
|||
} |
|||
.container:before, .container:after { |
|||
content: ""; |
|||
display: block; |
|||
clear: both; |
|||
} |
|||
.container .info { |
|||
margin: 50px auto; |
|||
text-align: center; |
|||
} |
|||
.container .info h1 { |
|||
margin: 0 0 15px; |
|||
padding: 0; |
|||
font-size: 36px; |
|||
font-weight: 300; |
|||
color: #1a1a1a; |
|||
} |
|||
.container .info span { |
|||
color: #4d4d4d; |
|||
font-size: 12px; |
|||
} |
|||
.container .info span a { |
|||
color: #000000; |
|||
text-decoration: none; |
|||
} |
|||
.container .info span .fa { |
|||
color: #EF3B3A; |
|||
} |
|||
body { |
|||
background: #76b852; /* fallback for old browsers */ |
|||
background: -webkit-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -moz-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -o-linear-gradient(right, #76b852, #8DC26F); |
|||
background: linear-gradient(to left, #76b852, #8DC26F); |
|||
font-family: "Roboto", sans-serif; |
|||
-webkit-font-smoothing: antialiased; |
|||
-moz-osx-font-smoothing: grayscale; |
|||
} |
|||
@ -1,51 +0,0 @@ |
|||
<div class="login-page"> |
|||
<div class="form"> |
|||
<h2>Update Account</h2> |
|||
<br><br> |
|||
|
|||
<form [formGroup]='accountForm' (submit)='OnAccountFormSubmit()'> |
|||
|
|||
Username: <input type="text" formControlName="username"> |
|||
<div *ngIf="accountForm.controls['username'].invalid &&(accountForm.controls['username'].touched || |
|||
accountForm.controls['username'].dirty)">Invalid username</div> |
|||
<br><br> |
|||
Name: <input type="text" formControlName="fullname"> |
|||
<div *ngIf="accountForm.controls['fullname'].invalid &&(accountForm.controls['fullname'].touched || |
|||
accountForm.controls['fullname'].dirty)">Invalid full name</div> |
|||
<br><br> |
|||
Gender: <input type="text" formControlName="gender"> |
|||
<div *ngIf="accountForm.controls['gender'].invalid &&(accountForm.controls['gender'].touched || |
|||
accountForm.controls['gender'].dirty)">Invalid gender</div> |
|||
<br><br> |
|||
Phone no: <input type="number" formControlName="phone"> |
|||
<div *ngIf="accountForm.controls['phone'].invalid &&(accountForm.controls['phone'].touched || |
|||
accountForm.controls['phone'].dirty)">Invalid phone number</div> |
|||
<br><br> |
|||
Email: <input type="text" formControlName="email"> |
|||
<div *ngIf="accountForm.controls['email'].invalid &&(accountForm.controls['email'].touched || |
|||
accountForm.controls['email'].dirty)">Invalid email</div> |
|||
<br><br> |
|||
Building Address: <input type="text" formControlName="address"> |
|||
<div *ngIf="accountForm.controls['address'].invalid &&(accountForm.controls['address'].touched || |
|||
accountForm.controls['address'].dirty)">Invalid building address</div> |
|||
<br><br> |
|||
City: <input type="text" formControlName="city"> |
|||
<div *ngIf="accountForm.controls['city'].invalid &&(accountForm.controls['city'].touched || |
|||
accountForm.controls['city'].dirty)">Invalid city</div> |
|||
<br><br> |
|||
State: <input type="text" formControlName="state"> |
|||
<div *ngIf="accountForm.controls['state'].invalid &&(accountForm.controls['state'].touched || |
|||
accountForm.controls['state'].dirty)">Invalid state</div> |
|||
<br><br> |
|||
Pincode: <input type="text" formControlName="pincode"> |
|||
<div *ngIf="accountForm.controls['pincode'].invalid &&(accountForm.controls['pincode'].touched || |
|||
accountForm.controls['pincode'].dirty)">Invalid pincode</div> |
|||
<br><br> |
|||
Apartments: <input type="text" formControlName="apartments"> |
|||
<div *ngIf="accountForm.controls['apartments'].invalid &&(accountForm.controls['apartments'].touched || |
|||
accountForm.controls['apartments'].dirty)">Invalid no. of apartments</div> |
|||
<br><br> |
|||
<button [disabled]="!accountForm.valid">Update</button> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
@ -1,25 +0,0 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { EditAccountComponent } from './edit-account.component'; |
|||
|
|||
describe('EditAccountComponent', () => { |
|||
let component: EditAccountComponent; |
|||
let fixture: ComponentFixture<EditAccountComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ EditAccountComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(EditAccountComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,79 +0,0 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
import { FormControl, FormGroup, Validators } from '@angular/forms'; |
|||
import { ActivatedRoute, Router } from '@angular/router'; |
|||
import { Account } from 'src/app/model/account.model'; |
|||
import { AccountService } from 'src/app/service/account.service'; |
|||
|
|||
@Component({ |
|||
selector: 'app-edit-account', |
|||
templateUrl: './edit-account.component.html', |
|||
styleUrls: ['./edit-account.component.css'] |
|||
}) |
|||
export class EditAccountComponent implements OnInit { |
|||
|
|||
aid: any ; |
|||
account: any; |
|||
accountForm: FormGroup; |
|||
|
|||
constructor(private actRoute: ActivatedRoute,private route : Router, private accountService : AccountService) { |
|||
this.accountForm = new FormGroup({ |
|||
username : new FormControl(''), |
|||
fullname: new FormControl(''), |
|||
gender: new FormControl(''), |
|||
phone: new FormControl(''), |
|||
email: new FormControl(''), |
|||
address: new FormControl(''), |
|||
city: new FormControl(''), |
|||
state: new FormControl(''), |
|||
pincode: new FormControl(''), |
|||
apartments: new FormControl('') |
|||
}); |
|||
} |
|||
|
|||
|
|||
ngOnInit(): void { |
|||
this.actRoute.paramMap.subscribe(params =>{ |
|||
this.aid = params.get('aid'); |
|||
}); |
|||
this.accountService.getOneAccount(this.aid).subscribe(data=>{ |
|||
this.account = data; |
|||
this.accountForm = new FormGroup({ |
|||
username : new FormControl(this.account.username,Validators.required), |
|||
fullname: new FormControl(this.account.fullname,Validators.required), |
|||
gender: new FormControl(this.account.gender,Validators.required), |
|||
phone: new FormControl(this.account.phone,Validators.required), |
|||
email: new FormControl(this.account.email,Validators.required), |
|||
address: new FormControl(this.account.address,Validators.required), |
|||
city: new FormControl(this.account.city,Validators.required), |
|||
state: new FormControl(this.account.state,Validators.required), |
|||
pincode: new FormControl(this.account.pincode,Validators.required), |
|||
apartments: new FormControl(this.account.apartments,Validators.required) |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
OnAccountFormSubmit(){ |
|||
let acc : Account = { |
|||
id : +this.aid, |
|||
username : this.accountForm.value.username, |
|||
fullname : this.accountForm.value.fullname, |
|||
gender : this.accountForm.value.gender, |
|||
phone : this.accountForm.value.phone, |
|||
email : this.accountForm.value.email, |
|||
address : this.accountForm.value.address, |
|||
city : this.accountForm.value.city, |
|||
state : this.accountForm.value.state, |
|||
pincode : this.accountForm.value.pincode, |
|||
apartments : this.accountForm.value.apartments, |
|||
|
|||
|
|||
} |
|||
this.accountService.editAccount(this.aid,acc).subscribe(data=>{ |
|||
this.route.navigateByUrl("/account/"+this.aid); |
|||
}, |
|||
(err: any) =>{ |
|||
console.log(err); |
|||
}); |
|||
|
|||
} |
|||
} |
|||
@ -1,131 +0,0 @@ |
|||
@import url(https://fonts.googleapis.com/css?family=Roboto:300); |
|||
|
|||
.login-page { |
|||
width: 260px; |
|||
padding: 8% 0 0; |
|||
align-items: left; |
|||
margin: 0 20px; |
|||
} |
|||
.form { |
|||
display: inline-block; |
|||
background: #FFFFFF; |
|||
max-width: 165px; |
|||
margin: 50px 30px; |
|||
padding: 45px; |
|||
text-align: left; |
|||
align-self: left; |
|||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24); |
|||
} |
|||
.form input { |
|||
font-family: "Roboto", sans-serif; |
|||
outline: 0; |
|||
background: #f2f2f2; |
|||
width: 100%; |
|||
border: 0; |
|||
margin: 0 0 15px; |
|||
padding: 15px; |
|||
box-sizing: border-box; |
|||
font-size: 14px; |
|||
} |
|||
.form button { |
|||
font-family: "Roboto", sans-serif; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #4CAF50; |
|||
margin: 10px 0; |
|||
width: 100%; |
|||
border: 0; |
|||
padding: 10px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
.form button:hover,.form button:active,.form button:focus { |
|||
background: #43A047; |
|||
} |
|||
.form .message { |
|||
margin: 15px 0 0; |
|||
color: #b3b3b3; |
|||
font-size: 12px; |
|||
} |
|||
.form .message a { |
|||
color: #4CAF50; |
|||
text-decoration: none; |
|||
} |
|||
.form .register-form { |
|||
display: none; |
|||
} |
|||
.container { |
|||
position: relative; |
|||
z-index: 1; |
|||
max-width: 300px; |
|||
margin: 0 auto; |
|||
} |
|||
.container:before, .container:after { |
|||
content: ""; |
|||
display: block; |
|||
clear: both; |
|||
} |
|||
.container .info { |
|||
margin: 50px auto; |
|||
text-align: center; |
|||
} |
|||
.container .info h1 { |
|||
margin: 0 0 15px; |
|||
padding: 0; |
|||
font-size: 36px; |
|||
font-weight: 300; |
|||
color: #1a1a1a; |
|||
} |
|||
.container .info span { |
|||
color: #4d4d4d; |
|||
font-size: 12px; |
|||
} |
|||
.container .info span a { |
|||
color: #000000; |
|||
text-decoration: none; |
|||
} |
|||
.container .info span .fa { |
|||
color: #EF3B3A; |
|||
} |
|||
body { |
|||
background: #76b852; /* fallback for old browsers */ |
|||
background: -webkit-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -moz-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -o-linear-gradient(right, #76b852, #8DC26F); |
|||
background: linear-gradient(to left, #76b852, #8DC26F); |
|||
font-family: "Roboto", sans-serif; |
|||
-webkit-font-smoothing: antialiased; |
|||
-moz-osx-font-smoothing: grayscale; |
|||
} |
|||
.form-control{ |
|||
border-radius: 3px; |
|||
width: 600px; |
|||
height: 30px; |
|||
margin-left: 23px; |
|||
} |
|||
.search-icon { |
|||
position: absolute; |
|||
z-index: 10; |
|||
right: 50%; |
|||
top: 20px; |
|||
color: black; |
|||
} |
|||
button { |
|||
font-family: "Roboto", sans-serif; |
|||
border-radius: 6px; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #62a7c2; |
|||
margin: 30px 20px; |
|||
width: 100px; |
|||
border: 0; |
|||
padding: 10px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
|
|||
<div *ngFor="let p of products" class="form"> |
|||
|
|||
|
|||
<img src={{p.imag}} width="150px" height="100px"><br> <b>Item Name:</b> {{p.name}} <br> <b>Price:</b> {{p.price}} <br><b>Category:</b> {{p.category}} |
|||
|
|||
<br> |
|||
<button (click)=addtocart1(p.id!)>Add to cart</button> |
|||
</div> |
|||
@ -1,25 +0,0 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { FruitsComponent } from './fruits.component'; |
|||
|
|||
describe('FruitsComponent', () => { |
|||
let component: FruitsComponent; |
|||
let fixture: ComponentFixture<FruitsComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ FruitsComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(FruitsComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,39 +0,0 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
import { Router } from '@angular/router'; |
|||
import { Product } from 'src/app/model/product.model'; |
|||
import { ProductService } from 'src/app/service/product.service'; |
|||
import { CartService } from 'src/app/service/cart.service'; |
|||
|
|||
|
|||
|
|||
|
|||
@Component({ |
|||
selector: 'app-fruits', |
|||
templateUrl: './fruits.component.html', |
|||
styleUrls: ['./fruits.component.css'] |
|||
}) |
|||
export class FruitsComponent implements OnInit { |
|||
|
|||
products:Product[]; |
|||
name:string; |
|||
uid!:any; |
|||
constructor(private productService:ProductService, private route:Router,private cartService:CartService) { |
|||
this.products=[]; |
|||
this.name='Fruits'; |
|||
} |
|||
|
|||
ngOnInit(): void { |
|||
this.productService.getProductsByCategory(this.name).subscribe(data=>{ |
|||
this.products=data; |
|||
}) |
|||
} |
|||
addtocart(p:any){ |
|||
this.cartService.addtoCart(p); |
|||
} |
|||
addtocart1(pid:any){ |
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.postCart(this.uid, pid).subscribe(data=>{ |
|||
console.log('added to cart'); |
|||
}) |
|||
} |
|||
} |
|||
@ -1,26 +0,0 @@ |
|||
.button { |
|||
font: bold 15px Arial; |
|||
text-decoration: none; |
|||
background-color: #5fe697; |
|||
color: #05151f; |
|||
border-radius: 4px; |
|||
padding: 6px 8px 6px 8px; |
|||
border-top: 1px solid #CCCCCC; |
|||
border-right: 1px solid #333333; |
|||
border-bottom: 1px solid #333333; |
|||
border-left: 1px solid #CCCCCC; |
|||
cursor: pointer; |
|||
} |
|||
.bg { |
|||
/* The image used */ |
|||
background-image: url("g1.jpg"); |
|||
|
|||
/* Full height */ |
|||
height: 100%; |
|||
width: 100%; |
|||
/* Center and scale the image nicely */ |
|||
background-position: center; |
|||
background-repeat: no-repeat; |
|||
background-size: cover; |
|||
opacity: 0.9; |
|||
} |
|||
@ -1,11 +0,0 @@ |
|||
<!-- <div class="bg"> --> |
|||
<a (click)="onAccount()" class="button">My Account</a> |
|||
|
|||
<a routerLink="/product" class="button">Items Available</a> |
|||
|
|||
<a routerLink="/cart" class="button">My Cart</a> |
|||
|
|||
<a routerLink="/order" class="button">My Order</a> |
|||
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> |
|||
<router-outlet></router-outlet> |
|||
<!-- </div> --> |
|||
@ -1,25 +0,0 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { HomeComponent } from './home.component'; |
|||
|
|||
describe('HomeComponent', () => { |
|||
let component: HomeComponent; |
|||
let fixture: ComponentFixture<HomeComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ HomeComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(HomeComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,27 +0,0 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
import { Router } from '@angular/router'; |
|||
import { AccountService } from 'src/app/service/account.service'; |
|||
|
|||
@Component({ |
|||
selector: 'app-home', |
|||
templateUrl: './home.component.html', |
|||
styleUrls: ['./home.component.css'] |
|||
}) |
|||
export class HomeComponent implements OnInit { |
|||
uid!:any; |
|||
constructor(private accountService : AccountService, private route: Router) { } |
|||
|
|||
ngOnInit(): void { |
|||
this.accountService.getDetails(window.sessionStorage.getItem("username")).subscribe(data =>{ |
|||
window.sessionStorage.setItem('userid',String(data.id)); |
|||
console.log("home") |
|||
}); |
|||
} |
|||
|
|||
onAccount(){ |
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.route.navigateByUrl('/account/'+this.uid); |
|||
console.log("get by id") |
|||
} |
|||
|
|||
} |
|||
@ -1,131 +0,0 @@ |
|||
@import url(https://fonts.googleapis.com/css?family=Roboto:300); |
|||
|
|||
.login-page { |
|||
width: 260px; |
|||
padding: 8% 0 0; |
|||
align-items: left; |
|||
margin: 0 20px; |
|||
} |
|||
.form { |
|||
display: inline-block; |
|||
background: #FFFFFF; |
|||
max-width: 165px; |
|||
margin: 50px 30px; |
|||
padding: 45px; |
|||
text-align: left; |
|||
align-self: left; |
|||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24); |
|||
} |
|||
.form input { |
|||
font-family: "Roboto", sans-serif; |
|||
outline: 0; |
|||
background: #f2f2f2; |
|||
width: 100%; |
|||
border: 0; |
|||
margin: 0 0 15px; |
|||
padding: 15px; |
|||
box-sizing: border-box; |
|||
font-size: 14px; |
|||
} |
|||
.form button { |
|||
font-family: "Roboto", sans-serif; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #4CAF50; |
|||
margin: 10px 0; |
|||
width: 100%; |
|||
border: 0; |
|||
padding: 10px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
.form button:hover,.form button:active,.form button:focus { |
|||
background: #43A047; |
|||
} |
|||
.form .message { |
|||
margin: 15px 0 0; |
|||
color: #b3b3b3; |
|||
font-size: 12px; |
|||
} |
|||
.form .message a { |
|||
color: #4CAF50; |
|||
text-decoration: none; |
|||
} |
|||
.form .register-form { |
|||
display: none; |
|||
} |
|||
.container { |
|||
position: relative; |
|||
z-index: 1; |
|||
max-width: 300px; |
|||
margin: 0 auto; |
|||
} |
|||
.container:before, .container:after { |
|||
content: ""; |
|||
display: block; |
|||
clear: both; |
|||
} |
|||
.container .info { |
|||
margin: 50px auto; |
|||
text-align: center; |
|||
} |
|||
.container .info h1 { |
|||
margin: 0 0 15px; |
|||
padding: 0; |
|||
font-size: 36px; |
|||
font-weight: 300; |
|||
color: #1a1a1a; |
|||
} |
|||
.container .info span { |
|||
color: #4d4d4d; |
|||
font-size: 12px; |
|||
} |
|||
.container .info span a { |
|||
color: #000000; |
|||
text-decoration: none; |
|||
} |
|||
.container .info span .fa { |
|||
color: #EF3B3A; |
|||
} |
|||
body { |
|||
background: #76b852; /* fallback for old browsers */ |
|||
background: -webkit-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -moz-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -o-linear-gradient(right, #76b852, #8DC26F); |
|||
background: linear-gradient(to left, #76b852, #8DC26F); |
|||
font-family: "Roboto", sans-serif; |
|||
-webkit-font-smoothing: antialiased; |
|||
-moz-osx-font-smoothing: grayscale; |
|||
} |
|||
.form-control{ |
|||
border-radius: 3px; |
|||
width: 600px; |
|||
height: 30px; |
|||
margin-left: 23px; |
|||
} |
|||
.search-icon { |
|||
position: absolute; |
|||
z-index: 10; |
|||
right: 50%; |
|||
top: 20px; |
|||
color: black; |
|||
} |
|||
button { |
|||
font-family: "Roboto", sans-serif; |
|||
border-radius: 6px; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #62a7c2; |
|||
margin: 30px 20px; |
|||
width: 100px; |
|||
border: 0; |
|||
padding: 10px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
|
|||
<div *ngFor="let p of products" class="form"> |
|||
|
|||
|
|||
<img src={{p.imag}} width="150px" height="100px"><br> <b>Item Name:</b> {{p.name}} <br> <b>Price:</b> {{p.price}} <br><b>Category:</b> {{p.category}} |
|||
|
|||
<br> |
|||
<button (click)=addtocart1(p.id!)>Add to cart</button> |
|||
</div> |
|||
@ -1,25 +0,0 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { MedicinesComponent } from './medicines.component'; |
|||
|
|||
describe('MedicinesComponent', () => { |
|||
let component: MedicinesComponent; |
|||
let fixture: ComponentFixture<MedicinesComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ MedicinesComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(MedicinesComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,37 +0,0 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
import { Router } from '@angular/router'; |
|||
import { Product } from 'src/app/model/product.model'; |
|||
import { CartService } from 'src/app/service/cart.service'; |
|||
import { ProductService } from 'src/app/service/product.service'; |
|||
|
|||
@Component({ |
|||
selector: 'app-medicines', |
|||
templateUrl: './medicines.component.html', |
|||
styleUrls: ['./medicines.component.css'] |
|||
}) |
|||
export class MedicinesComponent implements OnInit { |
|||
|
|||
products:Product[]; |
|||
name:string; |
|||
uid!:any; |
|||
constructor(private productService:ProductService, private route:Router,private cartService:CartService) { |
|||
this.products=[]; |
|||
this.name='Medicines'; |
|||
} |
|||
|
|||
ngOnInit(): void { |
|||
this.productService.getProductsByCategory(this.name).subscribe(data=>{ |
|||
this.products=data; |
|||
}) |
|||
} |
|||
addtocart(p:any){ |
|||
this.cartService.addtoCart(p); |
|||
} |
|||
addtocart1(pid:any){ |
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.postCart(this.uid, pid).subscribe(data=>{ |
|||
console.log('added to cart'); |
|||
}) |
|||
} |
|||
|
|||
} |
|||
@ -1,51 +0,0 @@ |
|||
.card{ |
|||
height: 60vh; |
|||
width: 25px; |
|||
padding: 25px; |
|||
} |
|||
.center{ |
|||
position: absolute; |
|||
top: 50%; |
|||
left: 50%; |
|||
transform: translate(-50%, -50%); |
|||
text-align: center; |
|||
} |
|||
#customers { |
|||
font-family: Arial, Helvetica, sans-serif; |
|||
border-collapse: collapse; |
|||
width: 60%; |
|||
align-self: center; |
|||
} |
|||
|
|||
#customers td, #customers th { |
|||
border: 3px solid #ddd; |
|||
padding: 8px; |
|||
} |
|||
|
|||
#customers tr:nth-child(even){background-color: #f2f2f2;} |
|||
|
|||
#customers tr:hover {background-color: #ddd;} |
|||
|
|||
#customers th { |
|||
padding-top: 12px; |
|||
padding-bottom: 12px; |
|||
text-align: left; |
|||
background-color: #04AA6D; |
|||
color: white; |
|||
} |
|||
button { |
|||
font-family: "Roboto", sans-serif; |
|||
border-radius: 6px; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #e48ac6; |
|||
margin: 10px 20px; |
|||
width: 130px; |
|||
border: 0; |
|||
padding: 10px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
@ -1,30 +0,0 @@ |
|||
|
|||
<div class="card-table"> |
|||
<div class="card-product"> |
|||
<table class="table table-responsive" id="customers" class="center"> |
|||
<thead> |
|||
<tr> |
|||
<th>Order.No</th> |
|||
<th>Product Details</th> |
|||
<th>Final Price</th> |
|||
<th>Delivery Status</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<!-- <tr *ngFor="let p of product; let i = index"> --> |
|||
<td>OODR1</td> |
|||
<tbody> |
|||
<tr *ngFor="let p of orderdto; let i = index"> |
|||
<td>{{p.name}} Rs.{{p.totalPrice}}</td> |
|||
</tr> |
|||
</tbody> |
|||
<td> Rs.{{grandTotal1}}</td> |
|||
<td>To be delivered by tomorrow 8:30 A.M</td> |
|||
|
|||
</tr> |
|||
|
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
@ -1,25 +0,0 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { OrdersComponent } from './orders.component'; |
|||
|
|||
describe('OrdersComponent', () => { |
|||
let component: OrdersComponent; |
|||
let fixture: ComponentFixture<OrdersComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ OrdersComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(OrdersComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,38 +0,0 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
import { OrderDto } from 'src/app/model/orderDto.model'; |
|||
import { Orders } from 'src/app/model/orders.model'; |
|||
import { CartService } from 'src/app/service/cart.service'; |
|||
import { OrdersService } from 'src/app/service/orders.service'; |
|||
|
|||
@Component({ |
|||
selector: 'app-orders', |
|||
templateUrl: './orders.component.html', |
|||
styleUrls: ['./orders.component.css'] |
|||
}) |
|||
export class OrdersComponent implements OnInit { |
|||
|
|||
public product : any=[]; |
|||
cartItem!:Orders[]; |
|||
orderdto!: OrderDto[]; |
|||
public grandTotal1 : any; |
|||
uid!:any; |
|||
public grandTotal : number = 0; |
|||
constructor(private cartService : CartService, private orderService:OrdersService) { } |
|||
|
|||
ngOnInit(): void { |
|||
// this.cartService.getProducts().subscribe(res=>{
|
|||
// this.product = res;
|
|||
// // this.grandTotal = this.cartService.getTotalPrice();
|
|||
// })
|
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.getCartdto(this.uid).subscribe(res=>{ |
|||
this.orderdto = res; |
|||
console.log(this.orderdto); |
|||
}) |
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.CartSum(this.uid).subscribe(res=>{ |
|||
this.grandTotal1 = res; |
|||
}) |
|||
} |
|||
|
|||
} |
|||
@ -1,146 +0,0 @@ |
|||
@import url(https://fonts.googleapis.com/css?family=Roboto:300); |
|||
|
|||
.login-page { |
|||
width: 260px; |
|||
padding: 8% 0 0; |
|||
align-items: left; |
|||
margin: 0 20px; |
|||
} |
|||
.form { |
|||
display: inline-block; |
|||
background: #FFFFFF; |
|||
max-width: 165px; |
|||
margin: 50px 30px; |
|||
padding: 45px; |
|||
text-align: left; |
|||
align-self: left; |
|||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24); |
|||
} |
|||
.form input { |
|||
font-family: "Roboto", sans-serif; |
|||
outline: 0; |
|||
background: #f2f2f2; |
|||
width: 100%; |
|||
border: 0; |
|||
margin: 0 0 15px; |
|||
padding: 15px; |
|||
box-sizing: border-box; |
|||
font-size: 14px; |
|||
} |
|||
.form button { |
|||
font-family: "Roboto", sans-serif; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #4CAF50; |
|||
margin: 10px 0; |
|||
width: 100%; |
|||
border: 0; |
|||
padding: 10px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
.form button:hover,.form button:active,.form button:focus { |
|||
background: #43A047; |
|||
} |
|||
.form .message { |
|||
margin: 15px 0 0; |
|||
color: #b3b3b3; |
|||
font-size: 12px; |
|||
} |
|||
.form .message a { |
|||
color: #4CAF50; |
|||
text-decoration: none; |
|||
} |
|||
.form .register-form { |
|||
display: none; |
|||
} |
|||
.container { |
|||
position: relative; |
|||
z-index: 1; |
|||
max-width: 300px; |
|||
margin: 0 auto; |
|||
} |
|||
.container:before, .container:after { |
|||
content: ""; |
|||
display: block; |
|||
clear: both; |
|||
} |
|||
.container .info { |
|||
margin: 50px auto; |
|||
text-align: center; |
|||
} |
|||
.container .info h1 { |
|||
margin: 0 0 15px; |
|||
padding: 0; |
|||
font-size: 36px; |
|||
font-weight: 300; |
|||
color: #1a1a1a; |
|||
} |
|||
.container .info span { |
|||
color: #4d4d4d; |
|||
font-size: 12px; |
|||
} |
|||
.container .info span a { |
|||
color: #000000; |
|||
text-decoration: none; |
|||
} |
|||
.container .info span .fa { |
|||
color: #EF3B3A; |
|||
} |
|||
body { |
|||
background: #76b852; /* fallback for old browsers */ |
|||
background: -webkit-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -moz-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -o-linear-gradient(right, #76b852, #8DC26F); |
|||
background: linear-gradient(to left, #76b852, #8DC26F); |
|||
font-family: "Roboto", sans-serif; |
|||
-webkit-font-smoothing: antialiased; |
|||
-moz-osx-font-smoothing: grayscale; |
|||
} |
|||
.form-control{ |
|||
border-radius: 3px; |
|||
width: 600px; |
|||
height: 30px; |
|||
margin-left: 23px; |
|||
} |
|||
.search-icon { |
|||
position: absolute; |
|||
z-index: 10; |
|||
right: 50%; |
|||
top: 20px; |
|||
color: black; |
|||
} |
|||
.button { |
|||
font-family: "Roboto", sans-serif; |
|||
border-radius: 6px; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
text-decoration: none; |
|||
background: #62a7c2; |
|||
/* /* margin-top: 70px; */ |
|||
margin: 0 20px; |
|||
width: 100px; |
|||
border: 0; |
|||
padding: 10px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
#button { |
|||
font: bold 15px Arial; |
|||
text-decoration: none; |
|||
background-color: #5fe697; |
|||
color: #05151f; |
|||
border-radius: 4px; |
|||
padding: 6px 8px 6px 8px; |
|||
border-top: 1px solid #CCCCCC; |
|||
border-right: 1px solid #333333; |
|||
border-bottom: 1px solid #333333; |
|||
border-left: 1px solid #CCCCCC; |
|||
cursor: pointer; |
|||
} |
|||
@ -1,27 +0,0 @@ |
|||
|
|||
<br><br> |
|||
<div class="form-group"> |
|||
<input type="text" class="form-control" [(ngModel)]="searchTerm" (keyup)="search($event)" placeholder="search products"> |
|||
|
|||
<span id="button" (click)='back()'>GO TO CART</span> |
|||
</div> |
|||
<br><br> |
|||
<br><br> |
|||
<!-- <button (click)="filter('')">All Items</button> --> |
|||
<!-- --> |
|||
<a routerLink="/fruits" class="button">Fruits</a> |
|||
<a routerLink="/vegetables" class="button">Vegetables</a> |
|||
<a routerLink="/snacks" class="button">Snacks</a> |
|||
<a routerLink="/medicines" class="button">Medicines</a> |
|||
<a routerLink="/beverages" class="button">Beverages</a> |
|||
|
|||
<br><br> |
|||
<div *ngFor="let p of products | filter:searchKey:'name'" class="form"> |
|||
<span class="fas fa-search search-icon"></span> |
|||
|
|||
<img src={{p.imag}} width="150px" height="100px"><br> <b>Item Name:</b> {{p.name}} <br> <b>Price:</b> {{p.price}} <br><b>Category:</b> {{p.category}} |
|||
|
|||
<br> |
|||
<button (click)=addtocart1(p.id!) (click)=addtocart(p) >Add to cart</button> |
|||
</div> |
|||
<!-- (click)=onCheckout(p.id!) --> |
|||
@ -1,25 +0,0 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { ProductComponent } from './product.component'; |
|||
|
|||
describe('ProductComponent', () => { |
|||
let component: ProductComponent; |
|||
let fixture: ComponentFixture<ProductComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ ProductComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(ProductComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,74 +0,0 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
import { Router } from '@angular/router'; |
|||
|
|||
import { Product } from 'src/app/model/product.model'; |
|||
import { CartService } from 'src/app/service/cart.service'; |
|||
import { OrdersService } from 'src/app/service/orders.service'; |
|||
import { ProductService } from 'src/app/service/product.service'; |
|||
|
|||
@Component({ |
|||
selector: 'app-product', |
|||
templateUrl: './product.component.html', |
|||
styleUrls: ['./product.component.css'] |
|||
}) |
|||
export class ProductComponent implements OnInit { |
|||
|
|||
products : Product[]; |
|||
uid! : any; |
|||
public filterCategory : any; |
|||
searchKey:string=""; |
|||
public searchTerm !:string; |
|||
msg:string; |
|||
constructor(private productService : ProductService, private route: Router,private cartService:CartService, private orderService:OrdersService){ |
|||
this.products = []; |
|||
this.msg =''; |
|||
|
|||
} |
|||
ngOnInit(): void { |
|||
this.productService.getProducts().subscribe(data =>{ |
|||
this.products = data; |
|||
this.filterCategory = data; |
|||
this.products.forEach((a:any)=>{ |
|||
Object.assign(a,{quantity:1,total:a.price}); |
|||
}); |
|||
}); |
|||
this.cartService.search.subscribe((val:any)=>{ |
|||
this.searchKey = val; |
|||
}) |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
addtocart(p:any){ |
|||
this.cartService.addtoCart(p); |
|||
} |
|||
addtocart1(pid:any){ |
|||
this.uid = window.sessionStorage.getItem('userid'); |
|||
this.cartService.postCart(this.uid, pid).subscribe(data=>{ |
|||
console.log('added to cart'); |
|||
}) |
|||
} |
|||
// onCheckout(pid:any){
|
|||
// this.uid = window.sessionStorage.getItem('userid');
|
|||
// this.orderService.postOrder(this.uid, pid).subscribe(data=>{
|
|||
// console.log('added to order');
|
|||
// })
|
|||
// }
|
|||
filter(category:string){ |
|||
this.filterCategory = this.products.filter((a:any)=>{ |
|||
if(a.category == category || category==''){ |
|||
return a; |
|||
} |
|||
}) |
|||
} |
|||
search(event:any){ |
|||
this.searchTerm = (event.target as HTMLInputElement).value; |
|||
console.log(this.searchTerm); |
|||
this.cartService.search.next(this.searchTerm); |
|||
} |
|||
back(){ |
|||
this.route.navigateByUrl("/cart"); |
|||
} |
|||
|
|||
} |
|||
@ -1,171 +0,0 @@ |
|||
/* * {box-sizing: border-box} |
|||
|
|||
/* Full-width input fields */ |
|||
/* input[type=text], input[type=password], input[type=number] { |
|||
width: 70%; |
|||
padding: 10px; |
|||
margin: 2px 0 22px 0; |
|||
display: inline-block; |
|||
border: none; |
|||
background: #f1f1f1; */ |
|||
/* } |
|||
|
|||
input[type=text]:focus, input[type=password]:focus { |
|||
background-color: #ddd; |
|||
outline: none; |
|||
} |
|||
|
|||
hr { |
|||
border: 1px solid #f1f1f1; |
|||
margin-bottom: 25px; |
|||
} |
|||
|
|||
/* Set a style for all buttons */ |
|||
/* button { |
|||
background-color: #04AA6D; |
|||
color: white; |
|||
padding: 14px 20px; |
|||
margin: 8px 0; |
|||
border: none; |
|||
cursor: pointer; |
|||
width: 100%; |
|||
opacity: 0.9; |
|||
} |
|||
|
|||
button:hover { |
|||
opacity:1; |
|||
} */ |
|||
|
|||
/* Extra styles for the cancel button */ |
|||
/* .cancelbtn { |
|||
padding: 14px 20px; |
|||
background-color: #f44336; |
|||
} */ |
|||
|
|||
/* Float cancel and signup buttons and add an equal width */ |
|||
/* .cancelbtn, .signupbtn { |
|||
float: left; |
|||
width: 50%; |
|||
} */ |
|||
|
|||
/* Add padding to container elements */ |
|||
/* .container { |
|||
padding: 50px; |
|||
width: 500px; |
|||
align-self: center; |
|||
margin-left: 400px; |
|||
} */ |
|||
|
|||
/* Clear floats */ |
|||
/* .clearfix::after { |
|||
content: ""; |
|||
clear: both; |
|||
display: table; |
|||
} */ |
|||
|
|||
/* Change styles for cancel button and signup button on extra small screens */ |
|||
/* @media screen and (max-width: 300px) { |
|||
.cancelbtn, .signupbtn { |
|||
width: 100%; |
|||
} |
|||
} */ |
|||
@import url(https://fonts.googleapis.com/css?family=Roboto:300); |
|||
|
|||
.login-page { |
|||
width: 700px; |
|||
padding: 8% 0 0; |
|||
margin: auto; |
|||
} |
|||
.form { |
|||
position: relative; |
|||
z-index: 1; |
|||
background: #FFFFFF; |
|||
max-width: 700px; |
|||
margin: 0 auto 100px; |
|||
padding: 45px; |
|||
text-align: center; |
|||
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 0.24); |
|||
} |
|||
.form input { |
|||
font-family: "Roboto", sans-serif; |
|||
outline: 0; |
|||
background: #f2f2f2; |
|||
width: 50%; |
|||
border: 0; |
|||
margin: 0 0 15px; |
|||
padding: 10px; |
|||
box-sizing: border-box; |
|||
font-size: 14px; |
|||
} |
|||
.form button { |
|||
font-family: "Roboto", sans-serif; |
|||
text-transform: uppercase; |
|||
outline: 0; |
|||
background: #4CAF50; |
|||
width: 100%; |
|||
border: 0; |
|||
padding: 15px; |
|||
color: #FFFFFF; |
|||
font-size: 14px; |
|||
-webkit-transition: all 0.3 ease; |
|||
transition: all 0.3 ease; |
|||
cursor: pointer; |
|||
} |
|||
.form button:hover,.form button:active,.form button:focus { |
|||
background: #43A047; |
|||
} |
|||
.form .message { |
|||
margin: 15px 0 0; |
|||
color: #b3b3b3; |
|||
font-size: 12px; |
|||
} |
|||
.form .message a { |
|||
color: #4CAF50; |
|||
text-decoration: none; |
|||
} |
|||
.form .register-form { |
|||
display: none; |
|||
} |
|||
.container { |
|||
position: relative; |
|||
z-index: 1; |
|||
max-width: 300px; |
|||
margin: 0 auto; |
|||
} |
|||
.container:before, .container:after { |
|||
content: ""; |
|||
display: block; |
|||
clear: both; |
|||
} |
|||
.container .info { |
|||
margin: 50px auto; |
|||
text-align: center; |
|||
} |
|||
.container .info h1 { |
|||
margin: 0 0 15px; |
|||
padding: 0; |
|||
font-size: 36px; |
|||
font-weight: 300; |
|||
color: #1a1a1a; |
|||
} |
|||
.container .info span { |
|||
color: #4d4d4d; |
|||
font-size: 12px; |
|||
} |
|||
.container .info span a { |
|||
color: #000000; |
|||
text-decoration: none; |
|||
} |
|||
.container .info span .fa { |
|||
color: #EF3B3A; |
|||
} |
|||
body { |
|||
background: #76b852; /* fallback for old browsers */ |
|||
background: -webkit-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -moz-linear-gradient(right, #76b852, #8DC26F); |
|||
background: -o-linear-gradient(right, #76b852, #8DC26F); |
|||
background: linear-gradient(to left, #76b852, #8DC26F); |
|||
font-family: "Roboto", sans-serif; |
|||
-webkit-font-smoothing: antialiased; |
|||
-moz-osx-font-smoothing: grayscale; |
|||
} |
|||
@ -1,65 +0,0 @@ |
|||
|
|||
<div class="login-page"> |
|||
<div class="form"> |
|||
<!-- <div class="container"> --> |
|||
<h1>Register Yourself</h1> |
|||
<p>Please fill in this form to create an account.</p> |
|||
<hr> |
|||
|
|||
<form [formGroup]='accountForm' (submit)='OnAccountFormSubmit()'> |
|||
|
|||
Username: <input type="text" formControlName="username"> |
|||
<div *ngIf="accountForm.controls['username'].invalid &&(accountForm.controls['username'].touched || |
|||
accountForm.controls['username'].dirty)">Invalid username</div> |
|||
<br><br> |
|||
Password: <input type="password" formControlName="password"> |
|||
<div *ngIf="accountForm.controls['password'].invalid &&(accountForm.controls['password'].touched || |
|||
accountForm.controls['password'].dirty)">Invalid password</div> |
|||
<br><br> |
|||
Name: <input type="text" formControlName="fullname"> |
|||
<div *ngIf="accountForm.controls['fullname'].invalid &&(accountForm.controls['fullname'].touched || |
|||
accountForm.controls['fullname'].dirty)">Invalid full name</div> |
|||
<br><br> |
|||
Gender: <input type="text" formControlName="gender"> |
|||
<div *ngIf="accountForm.controls['gender'].invalid &&(accountForm.controls['gender'].touched || |
|||
accountForm.controls['gender'].dirty)">Invalid gender</div> |
|||
<br><br> |
|||
Phone no: <input type="number" formControlName="phone"> |
|||
<div *ngIf="accountForm.controls['phone'].invalid &&(accountForm.controls['phone'].touched || |
|||
accountForm.controls['phone'].dirty)">Invalid phone number</div> |
|||
<br><br> |
|||
Email: <input type="text" formControlName="email"> |
|||
<div *ngIf="accountForm.controls['email'].invalid &&(accountForm.controls['email'].touched || |
|||
accountForm.controls['email'].dirty)">Invalid email</div> |
|||
<br><br> |
|||
Building Address: <input type="text" formControlName="address"> |
|||
<div *ngIf="accountForm.controls['address'].invalid &&(accountForm.controls['address'].touched || |
|||
accountForm.controls['address'].dirty)">Invalid building address</div> |
|||
<br><br> |
|||
City: <input type="text" formControlName="city"> |
|||
<div *ngIf="accountForm.controls['city'].invalid &&(accountForm.controls['city'].touched || |
|||
accountForm.controls['city'].dirty)">Invalid city</div> |
|||
<br><br> |
|||
State: <input type="text" formControlName="state"> |
|||
<div *ngIf="accountForm.controls['state'].invalid &&(accountForm.controls['state'].touched || |
|||
accountForm.controls['state'].dirty)">Invalid state</div> |
|||
<br><br> |
|||
Pincode: <input type="text" formControlName="pincode"> |
|||
<div *ngIf="accountForm.controls['pincode'].invalid &&(accountForm.controls['pincode'].touched || |
|||
accountForm.controls['pincode'].dirty)">Invalid pincode</div> |
|||
<br><br> |
|||
Apartments: <input type="text" formControlName="apartments"> |
|||
<div *ngIf="accountForm.controls['apartments'].invalid &&(accountForm.controls['apartments'].touched || |
|||
accountForm.controls['apartments'].dirty)">Invalid no. of apartments</div> |
|||
<br><br> |
|||
<div class="clearfix"> |
|||
<button [disabled]="!accountForm.valid">Register</button> |
|||
</div> |
|||
</form> |
|||
|
|||
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p> |
|||
|
|||
|
|||
<!-- </div> --> |
|||
</div> |
|||
</div> |
|||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue