diff --git a/Shopify-Cart.rar b/Shopify-Cart.rar
new file mode 100644
index 0000000..381e2d3
Binary files /dev/null and b/Shopify-Cart.rar differ
diff --git a/Shopify-Cart/src/main/resources/application.properties b/Shopify-Cart/src/main/resources/application.properties
index 884da9a..448603d 100644
--- a/Shopify-Cart/src/main/resources/application.properties
+++ b/Shopify-Cart/src/main/resources/application.properties
@@ -1,6 +1,6 @@
server.port=8002
-spring.datasource.url=jdbc:mysql://10.3.117.22:3306/Shopify_DB?createDatabaseIfNotExist=true
+spring.datasource.url=jdbc:mysql://10.3.117.30:3306/Shopify_DB?createDatabaseIfNotExist=true
spring.datasource.username=testuser1
spring.datasource.password=PASSWORD123
diff --git a/ShopifyUI/proxy.conf.json b/ShopifyUI/proxy.conf.json
index 033abd2..0cd07fa 100644
--- a/ShopifyUI/proxy.conf.json
+++ b/ShopifyUI/proxy.conf.json
@@ -1,14 +1,14 @@
{
"/api1": {
- "target": "http://10.3.117.22:8001",
+ "target": "http://10.3.117.30:8001",
"secure": false
},
"/api2": {
- "target": "http://10.3.117.22:8002",
+ "target": "http://10.3.117.30:8002",
"secure": false
},
"/api3": {
- "target": "http://10.3.117.22:8003",
+ "target": "http://10.3.117.30:8004",
"secure": false
}
}
\ No newline at end of file
diff --git a/ShopifyUI/src/app/app-routing.module.ts b/ShopifyUI/src/app/app-routing.module.ts
index 87ba8af..cd7ebf8 100644
--- a/ShopifyUI/src/app/app-routing.module.ts
+++ b/ShopifyUI/src/app/app-routing.module.ts
@@ -6,6 +6,7 @@ import { SignUpComponent } from './auth/sign-up/sign-up.component';
import { AdminComponent } from './components/admin/admin.component';
import { CartComponent } from './components/cart/cart.component';
import { HomeComponent } from './components/home/home.component';
+import { OrdersComponent } from './components/orders/orders.component';
import { PaymentsComponent } from './components/payments/payments.component';
import { ProductDetailComponent } from './components/product-detail/product-detail.component';
import { ProductsComponent } from './components/products/products.component';
@@ -17,6 +18,7 @@ const routes: Routes = [
{ path: 'products', component: ProductsComponent},
{ path: 'products/:product_id', component: ProductDetailComponent},
{ path: 'cart/:user_id', component: CartComponent, canActivate:[AuthGuardService] },
+ { path: 'orders/:user_id', component: OrdersComponent, canActivate:[AuthGuardService] },
{ path: 'payment', component: PaymentsComponent, canActivate: [AuthGuardService]},
{ path: 'login', component: LoginComponent},
{ path: 'signup', component: SignUpComponent},
diff --git a/ShopifyUI/src/app/auth/login/login.component.html b/ShopifyUI/src/app/auth/login/login.component.html
index 1d315c3..3cef7b6 100644
--- a/ShopifyUI/src/app/auth/login/login.component.html
+++ b/ShopifyUI/src/app/auth/login/login.component.html
@@ -4,10 +4,10 @@
Shopify
diff --git a/ShopifyUI/src/app/auth/sign-up/sign-up.component.html b/ShopifyUI/src/app/auth/sign-up/sign-up.component.html
index 3eb70b5..9c4cf48 100644
--- a/ShopifyUI/src/app/auth/sign-up/sign-up.component.html
+++ b/ShopifyUI/src/app/auth/sign-up/sign-up.component.html
@@ -4,10 +4,10 @@
Shopify
diff --git a/ShopifyUI/src/app/components/cart/cart.component.html b/ShopifyUI/src/app/components/cart/cart.component.html
index 2a5dbcd..94369d8 100644
--- a/ShopifyUI/src/app/components/cart/cart.component.html
+++ b/ShopifyUI/src/app/components/cart/cart.component.html
@@ -20,9 +20,9 @@
Hello {{username}}
- Personal details
- Orders
- Logout
+ Personal details
+ Orders
+ Logout
@@ -87,10 +87,11 @@
-
+
Total : Rs {{totalPrice}}
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/ShopifyUI/src/app/components/home/home.component.html b/ShopifyUI/src/app/components/home/home.component.html
index 45117f6..253c7f2 100644
--- a/ShopifyUI/src/app/components/home/home.component.html
+++ b/ShopifyUI/src/app/components/home/home.component.html
@@ -20,9 +20,9 @@
Hello {{username}}
- Personal details
- Orders
- Logout
+ Personal details
+ Orders
+ Logout
diff --git a/ShopifyUI/src/app/components/orders/orders.component.css b/ShopifyUI/src/app/components/orders/orders.component.css
index e69de29..326e375 100644
--- a/ShopifyUI/src/app/components/orders/orders.component.css
+++ b/ShopifyUI/src/app/components/orders/orders.component.css
@@ -0,0 +1,43 @@
+.orders {
+ margin: 0px auto;
+}
+
+.orderHeading h1 {
+ font-size: 3em;
+}
+.order{
+ color: #1B4F72;
+ padding: 12px;
+ border: 1px solid lightgray;
+}
+
+.data {
+ overflow-x: hidden;
+ overflow-y: scroll;
+ height: 520px;
+ border: 1px solid lightgray;
+}
+
+.dataheading {
+ overflow-x: hidden;
+ overflow-y: scroll;
+ background-color: #1B4F72;
+ padding: 12px;
+}
+
+.nd {
+ background-color: #F39C12;
+ padding: 6px;
+ border-radius: 20px;
+ color: white;
+}
+
+.d {
+ background-color: #27AE60;
+ color: white;
+}
+
+.dc {
+ background-color: #E74C3C;
+ color: white;
+}
\ No newline at end of file
diff --git a/ShopifyUI/src/app/components/orders/orders.component.html b/ShopifyUI/src/app/components/orders/orders.component.html
index 66000b4..db2e0c1 100644
--- a/ShopifyUI/src/app/components/orders/orders.component.html
+++ b/ShopifyUI/src/app/components/orders/orders.component.html
@@ -1 +1,70 @@
-orders works!
+
+
+
+
Shopify
+
+
+
+
+
+
+
+
+
Welcome {{username}}
+
+ Hello {{username}}
+
+ Personal details
+ Orders
+ Logout
+
+
+
+
+ Login To Continue
+
+
+
+
+
+
+
+
+
+
+
Order Id
+
Order Number
+
Product Name
+
Quantity
+
Price
+
Order Status
+
+
+
+
+
+
+
+
{{o.id}}
+
{{o.orderNumber}}
+
{{o.productName}}
+
{{o.quantity}}
+
{{o.price}}
+
{{o.status}}
+
{{o.status}}
+
{{o.status}}
+
+
+
+
+
\ No newline at end of file
diff --git a/ShopifyUI/src/app/components/orders/orders.component.ts b/ShopifyUI/src/app/components/orders/orders.component.ts
index 1f2f704..e333665 100644
--- a/ShopifyUI/src/app/components/orders/orders.component.ts
+++ b/ShopifyUI/src/app/components/orders/orders.component.ts
@@ -1,4 +1,7 @@
import { Component, OnInit } from '@angular/core';
+import { Order } from 'src/app/model/order.model';
+import { CartService } from 'src/app/service/cart.service';
+import { OrderService } from 'src/app/service/order.service';
@Component({
selector: 'app-orders',
@@ -7,9 +10,37 @@ import { Component, OnInit } from '@angular/core';
})
export class OrdersComponent implements OnInit {
- constructor() { }
+ uid:any = 0;
+ username:any='';
+ authcode:any='';
+ cartNo: number = 0;
+ orders: Order[];
+ constructor(private cartService: CartService, private orderService:OrderService) { }
ngOnInit(): void {
+ this.username = window.sessionStorage.getItem("username");
+ this.authcode = window.sessionStorage.getItem("authcode");
+ if (this.authcode !== null) {
+ this.uid = window.sessionStorage.getItem("user_id");
+ }
+ this.cartService.getCartByUser(this.uid).subscribe(data1 => {
+ this.cartNo = data1.length;
+ })
+ this.orderService.getOrderByUser(this.uid).subscribe(data => {
+ this.orders = data;
+ console.log(this.orders)
+ })
}
+ onLogout() {
+ if (this.authcode != null) {
+ this.authcode = null;
+ this.username = null;
+ window.sessionStorage.removeItem("username");
+ window.sessionStorage.removeItem("user_id");
+ window.sessionStorage.removeItem("authcode");
+ window.sessionStorage.removeItem("isLoggedIn");
+ this.cartNo = 0;
+ }
+ }
}
diff --git a/ShopifyUI/src/app/components/payments/payments.component.html b/ShopifyUI/src/app/components/payments/payments.component.html
index 9961503..d6fcd51 100644
--- a/ShopifyUI/src/app/components/payments/payments.component.html
+++ b/ShopifyUI/src/app/components/payments/payments.component.html
@@ -43,6 +43,6 @@
- Proceed To Checkout
+ Proceed To Checkout
\ No newline at end of file
diff --git a/ShopifyUI/src/app/components/payments/payments.component.ts b/ShopifyUI/src/app/components/payments/payments.component.ts
index 6836d88..b80a099 100644
--- a/ShopifyUI/src/app/components/payments/payments.component.ts
+++ b/ShopifyUI/src/app/components/payments/payments.component.ts
@@ -1,6 +1,9 @@
import { Component, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
import { Cart } from 'src/app/model/cart.model';
+import { Order } from 'src/app/model/order.model';
import { CartService } from 'src/app/service/cart.service';
+import { OrderService } from 'src/app/service/order.service';
@Component({
selector: 'app-payments',
@@ -9,17 +12,20 @@ import { CartService } from 'src/app/service/cart.service';
})
export class PaymentsComponent implements OnInit {
- uid:number = 1;
+ uid:any = 0;
cartNo: number = 0;
cartItems: Cart[] = [];
totalPrice: number = 0;
username:any = '';
authcode:any = '';
- constructor(private cartService: CartService) { }
+ constructor(private cartService: CartService,private orderService: OrderService, private route:Router) { }
ngOnInit(): void {
this.username = window.sessionStorage.getItem("username");
this.authcode = window.sessionStorage.getItem("authcode");
+ if (this.authcode !== null) {
+ this.uid = window.sessionStorage.getItem("user_id");
+ }
this.cartService.getCartByUser(this.uid).subscribe(data1 => {
this.cartNo = data1.length;
this.cartItems=data1;
@@ -30,6 +36,15 @@ export class PaymentsComponent implements OnInit {
})
}
+ addOrder() {
+ let order:Order = {
+ status: "Not Delivered"
+ }
+ this.orderService.postOrder(this.uid,order).subscribe(data => {
+ })
+ this.route.navigateByUrl("/orders/" + this.uid);
+ }
+
onLogout() {
if (this.authcode != null) {
this.authcode = null;
diff --git a/ShopifyUI/src/app/components/product-detail/product-detail.component.html b/ShopifyUI/src/app/components/product-detail/product-detail.component.html
index d3ab0d6..6f20d2b 100644
--- a/ShopifyUI/src/app/components/product-detail/product-detail.component.html
+++ b/ShopifyUI/src/app/components/product-detail/product-detail.component.html
@@ -20,9 +20,9 @@
Hello {{username}}
- Personal details
- Orders
- Logout
+ Personal details
+ Orders
+ Logout
@@ -95,7 +95,7 @@
Submit Your Review
-
+
diff --git a/ShopifyUI/src/app/model/order.model.ts b/ShopifyUI/src/app/model/order.model.ts
index e69de29..eade3dc 100644
--- a/ShopifyUI/src/app/model/order.model.ts
+++ b/ShopifyUI/src/app/model/order.model.ts
@@ -0,0 +1,11 @@
+export class Order {
+ id?: number;
+ quantity?: number;
+ price?: number;
+ status?: string;
+ orderNumber?: number;
+ userId?: number;
+ productId?: number;
+ username?: string;
+ productName?: string;
+}
\ No newline at end of file
diff --git a/ShopifyUI/src/app/service/order.service.ts b/ShopifyUI/src/app/service/order.service.ts
index c20ec33..d6127a3 100644
--- a/ShopifyUI/src/app/service/order.service.ts
+++ b/ShopifyUI/src/app/service/order.service.ts
@@ -1,9 +1,24 @@
+import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
+import { Observable } from 'rxjs';
+import { Order } from '../model/order.model';
@Injectable({
providedIn: 'root'
})
export class OrderService {
- constructor() { }
+ path:String = "http://localhost:59279/api3";
+
+ constructor(private httpClient:HttpClient) { }
+
+ public postOrder(uid:number, order:Order): Observable
{
+ let order_post_api = this.path + "/order/" + uid;
+ return this.httpClient.post(order_post_api,order);
+ }
+
+ public getOrderByUser(uid:number): Observable {
+ let order_get_api = this.path + "/order/" + uid;
+ return this.httpClient.get(order_get_api);
+ }
}
diff --git a/ShopifyUI/src/styles.css b/ShopifyUI/src/styles.css
index 2971ba9..c51fdda 100644
--- a/ShopifyUI/src/styles.css
+++ b/ShopifyUI/src/styles.css
@@ -94,4 +94,10 @@ body {
background-color: #1B4F72;
color: white;
padding-top: 10px;
+}
+
+/* For Dropdown */
+.activeBtn {
+ background-color: #1B4F72;
+ color: white;
}
\ No newline at end of file