From c623455150c76fcabefcb9dee05fd6455894edc6 Mon Sep 17 00:00:00 2001 From: Gaurav Daharia <59254@hexaware.com> Date: Thu, 23 Sep 2021 10:55:48 +0530 Subject: [PATCH] minor css and logout button added now project is complete --- .../app/components/cart/cart.component.html | 10 ++++- .../src/app/components/cart/cart.component.ts | 14 +----- .../checkout/checkout.component.css | 18 +++++++- .../checkout/checkout.component.html | 44 ++++++++++--------- .../components/checkout/checkout.component.ts | 28 +++++++----- .../page-nav-bar/page-nav-bar.component.css | 2 + .../page-nav-bar/page-nav-bar.component.html | 2 +- 7 files changed, 70 insertions(+), 48 deletions(-) diff --git a/Angular-UrbanBazaar/src/app/components/cart/cart.component.html b/Angular-UrbanBazaar/src/app/components/cart/cart.component.html index 8f7e7e5..b93e62f 100644 --- a/Angular-UrbanBazaar/src/app/components/cart/cart.component.html +++ b/Angular-UrbanBazaar/src/app/components/cart/cart.component.html @@ -8,6 +8,7 @@ S.No ProductName ProductPrice + quantity Action @@ -16,8 +17,15 @@ {{i+1}} {{c.productname}} {{c.productprice}} + - + diff --git a/Angular-UrbanBazaar/src/app/components/cart/cart.component.ts b/Angular-UrbanBazaar/src/app/components/cart/cart.component.ts index 33d81a0..33b4937 100644 --- a/Angular-UrbanBazaar/src/app/components/cart/cart.component.ts +++ b/Angular-UrbanBazaar/src/app/components/cart/cart.component.ts @@ -14,12 +14,12 @@ import { UserService } from 'src/app/services/user.service'; }) export class CartComponent implements OnInit { - public cartdetails:Cart[]; + public cartdetails: any[]=[]; public grandTotal = 0; constructor(private cartservice:CartService,private userservice:UserService,private router: Router) { - // this.cartdetails = this.cartservice.showCart(); } + // public quantity=[1,2,3,4,5,6,7,8,9,10,11] ngOnInit(): void { this.cartservice.showCart() @@ -29,16 +29,6 @@ export class CartComponent implements OnInit { this.grandTotal+=i.productprice; }) }) - // let uid = this.userservice.currentUser.userid; - // this.cartservice.showCart(uid).subscribe(data1=>{ - // this.cartNo = data1.length; - // this.cartdetails = data1; - - // this.cartdetails.forEach((i,index)=>{ - // this.grandTotal = this. - // }) - // }) - } checkout() diff --git a/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.css b/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.css index 1368657..a611832 100644 --- a/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.css +++ b/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.css @@ -2,4 +2,20 @@ border-radius: 15px; border-color:antiquewhite ; background-color: beige; -} \ No newline at end of file + padding: 1%; + flex: auto; + flex-direction: row; + position: absolute; + top: 1px; + right: 39px; + } +.card-table{ + position: relative; + display: flex; + flex-direction: column; + align-items: center; + +} +.table{ + font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; +} diff --git a/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.html b/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.html index 3be1bc6..ad43022 100644 --- a/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.html +++ b/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.html @@ -1,23 +1,25 @@ -
- - - - - - - - +
+
+
S.NoProductNameProductPrice
+ + + + + + + - - - - - - - - -
S.NoProductNameProductPrice
{{i+1}}{{c.productname}}{{c.productprice}}
Grand Total : Rs.{{grandTotal}}
- -
-
+ + + {{i+1}} + {{c.productname}} + {{c.productprice}} + + Grand Total : Rs.{{grandTotal}} + + + + + + \ No newline at end of file diff --git a/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.ts b/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.ts index 0bc1a3a..6225c98 100644 --- a/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.ts +++ b/Angular-UrbanBazaar/src/app/components/checkout/checkout.component.ts @@ -1,7 +1,8 @@ +import { unescapeIdentifier } from '@angular/compiler'; import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; -import { Cart } from 'src/app/models/cart'; import { CartService } from 'src/app/services/cart.service'; +import { UserService } from 'src/app/services/user.service'; @Component({ selector: 'app-checkout', @@ -9,31 +10,34 @@ import { CartService } from 'src/app/services/cart.service'; styleUrls: ['./checkout.component.css'] }) export class CheckoutComponent implements OnInit { - public cartdetails:Cart[]; + public cartdetails: any[] = []; public grandTotal = 0; - constructor(private cartservice:CartService,private router: Router) { + constructor(private cartservice: CartService, private router: Router,private userservice:UserService) { } + public uid = (this.userservice.currentUser.userid); + uid1 = this.uid.toString() - logout() - { + + + logout() { this.router.navigateByUrl("/"); - this.cartservice.deleteAll().subscribe(b=>{ - this.cartdetails.forEach((i,index)=>{ + this.cartservice.deleteAll().subscribe(b => { + this.cartdetails.forEach((i, index) => { this.cartdetails.splice(index); }) }); - // alert("db cleaned") + alert("your order have been placed for uid:"+this.uid1+"\n"+"Visit Again !") } ngOnInit(): void { this.cartservice.showCart() - .subscribe(res=>{ + .subscribe(res => { this.cartdetails = res; - this.cartdetails.forEach((i,index)=>{ - this.grandTotal+=i.productprice; + this.cartdetails.forEach((i, index) => { + this.grandTotal += i.productprice; }) - }) + }) } } diff --git a/Angular-UrbanBazaar/src/app/components/page-nav-bar/page-nav-bar.component.css b/Angular-UrbanBazaar/src/app/components/page-nav-bar/page-nav-bar.component.css index 0474392..445860d 100644 --- a/Angular-UrbanBazaar/src/app/components/page-nav-bar/page-nav-bar.component.css +++ b/Angular-UrbanBazaar/src/app/components/page-nav-bar/page-nav-bar.component.css @@ -10,6 +10,8 @@ right: 0; font-family: sans-serif; } + + .navbar-icon-top .navbar-nav .nav-link > .fa { top: 3px; line-height: 12px; diff --git a/Angular-UrbanBazaar/src/app/components/page-nav-bar/page-nav-bar.component.html b/Angular-UrbanBazaar/src/app/components/page-nav-bar/page-nav-bar.component.html index b008910..7f7e903 100644 --- a/Angular-UrbanBazaar/src/app/components/page-nav-bar/page-nav-bar.component.html +++ b/Angular-UrbanBazaar/src/app/components/page-nav-bar/page-nav-bar.component.html @@ -7,7 +7,7 @@