diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html
index 997164a..918ee2d 100644
--- a/src/app/dashboard/dashboard.component.html
+++ b/src/app/dashboard/dashboard.component.html
@@ -2,8 +2,8 @@
-
+ 0">
- -
+
-
-
+
-
-
Mc Chicken Regular Meals
-
-
- 2
-
-
-
-
-
- Today at 10:30 AM
-
-
-
-
- No
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
Mc Chicken Regular Meals
-
-
- 2
-
-
-
-
-
- Today at 10:30 AM
-
-
-
-
- No
-
-
-
-
-
-
-
- -
-
-
-
-
-
Mc Chicken Regular Meals
-
-
- 2
-
-
+
+
+
{{ item.menu_item_name }}
+
+
+ {{ item.quantity }}
+
+
-
-
- Today at 10:30 AM
-
+
+
+ {{ getFormattedDate(item.pickup_time, 'DD MMM @ hh:mm a') }}
+
-
-
- No
-
+
+
+ No
+ Yes
+
+
-
-
-
-
-
-
-
- -
-
-
-
-
-
Mc Chicken Regular Meals
-
-
- 2
-
-
-
-
-
- Today at 10:30 AM
-
-
-
-
- No
-
-
-
+
+
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts
index cf3302c..d160bd9 100644
--- a/src/app/dashboard/dashboard.component.ts
+++ b/src/app/dashboard/dashboard.component.ts
@@ -1,5 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { IFilterOption } from '../models/filter-option';
+import { OrderService } from '../services/order.service';
+import * as moment from 'moment';
@Component({
selector: 'app-dashboard',
@@ -8,8 +10,12 @@ import { IFilterOption } from '../models/filter-option';
})
export class DashboardComponent implements OnInit {
filterOptions: Array;
+ orderList: any = [];
+ orderStatus: any = [];
- constructor() { }
+ constructor(
+ private orderService: OrderService
+ ) { }
ngOnInit() {
this.filterOptions = [{
@@ -19,6 +25,47 @@ export class DashboardComponent implements OnInit {
name: 'Today',
id: 'today'
}];
+
+ this.orderService.getOrders().then((data) => {
+ this.orderList = data;
+
+ this.orderList = this.orderList.filter((order) => {
+ return order.orderstatus;
+ });
+ }, () => {
+ alert("Error getting the orders");
+ });
}
+ getFormattedDate(date: any, format: string) {
+ return moment(date).format(format);
+ }
+
+ getFilteredOrders(type: 'pending' | 'delivered' | 'confirmed') {
+ switch(type) {
+ case 'pending':
+ return this.orderList.filter((order) => {
+ return order.orderstatus.orderstatus_id === 6;
+ });
+ case 'delivered':
+ return this.orderList.filter((order) => {
+ return order.orderstatus.orderstatus_id === 3;
+ });
+ case 'confirmed':
+ return this.orderList.filter((order) => {
+ return order.orderstatus.orderstatus_id === 1;
+ });
+ default: return [];
+ }
+ }
+
+ updateOrder(order) {
+ this.orderService.updateOrder(order).then((data) => {
+ console.log(data);
+ }, (err) => {
+ console.log(err)
+ alert("Failed to update order");
+ })
+ }
+
}
diff --git a/src/app/orders/orders.component.ts b/src/app/orders/orders.component.ts
index 041f22c..8e84d1c 100644
--- a/src/app/orders/orders.component.ts
+++ b/src/app/orders/orders.component.ts
@@ -12,9 +12,7 @@ export class OrdersComponent implements OnInit {
statusOptions: Array;
dateOptions: Array;
showRejectionPopup: boolean = false;
-
- orderList: any;
-
+ orderList: any = [];
orderStatus: any = [];
constructor(
@@ -32,13 +30,7 @@ export class OrdersComponent implements OnInit {
id: 'today'
}];
-
- let vendor_info = JSON.parse(localStorage.vendor_info);
-
- console.log(vendor_info);
-
this.orderService.getOrders().then((data) => {
- console.log(data);
this.orderList = data;
this.orderList = this.orderList.filter((order) => {
diff --git a/src/app/services/order.service.ts b/src/app/services/order.service.ts
index 9edeaf5..af3996c 100644
--- a/src/app/services/order.service.ts
+++ b/src/app/services/order.service.ts
@@ -44,7 +44,7 @@ export class OrderService {
return this.http.get(URL + '/api/maioraservice/orders/getorders/user_id/' + uid + '/', httpOptions).toPromise();
}
- updateOrder(data: any) {
+ updateOrder(data: any) {
const httpOptions = {
headers: new HttpHeaders({
'Access-Control-Allow-Origin': '*',
@@ -52,6 +52,6 @@ export class OrderService {
'Authorization': 'Bearer ' + localStorage.vendor_token
})
};
- return this.http.post(URL + '/api/maioraservice/orders/v1/update', data , httpOptions).toPromise();
+ return this.http.put(URL + '/api/maioraservice/orders/v1/update', data , httpOptions).toPromise();
}
}
diff --git a/src/app/widgets-holder/widgets-holder.component.html b/src/app/widgets-holder/widgets-holder.component.html
index 4c7b362..183135b 100644
--- a/src/app/widgets-holder/widgets-holder.component.html
+++ b/src/app/widgets-holder/widgets-holder.component.html
@@ -14,9 +14,10 @@
- John Doe
- Member ID: 03293
- Restaurant Rating: 4.0
+ {{ vendor_info.vendorName }}
+ Vendor ID: {{ vendor_info.vendor_Id }}
+ {{ vendor_info.outlet.length }} Outlets
+ Average Rating: 4.0
diff --git a/src/app/widgets-holder/widgets-holder.component.ts b/src/app/widgets-holder/widgets-holder.component.ts
index d5d7678..d3b3f81 100644
--- a/src/app/widgets-holder/widgets-holder.component.ts
+++ b/src/app/widgets-holder/widgets-holder.component.ts
@@ -6,11 +6,14 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./widgets-holder.component.scss']
})
export class WidgetsHolderComponent implements OnInit {
- selected_nav: string = 'orders';
+ selected_nav: string = 'dashboard';
+ vendor_info: any;
constructor() { }
ngOnInit() {
+ let data = JSON.parse(localStorage.vendor_info);
+ this.vendor_info = data['Info Info'];
}
getNavPage(page: string) {