| @@ -51,7 +51,7 @@ | |||||
| </td> | </td> | ||||
| <td> | <td> | ||||
| <div class="action-buttons" *ngIf="order.orderstatus.orderstatus_id === 6"> | <div class="action-buttons" *ngIf="order.orderstatus.orderstatus_id === 6"> | ||||
| <button class="round-button"> Confirm </button> | |||||
| <button class="round-button" (click)="order.orderstatus.orderstatus_id = 1; updateOrder(order)"> Confirm </button> | |||||
| <button class="round-button" (click)="showRejectionPopup = true"> Reject </button> | <button class="round-button" (click)="showRejectionPopup = true"> Reject </button> | ||||
| </div> | </div> | ||||
| <div class="status" [ngClass]="{'success': order.orderstatus.orderstatus_id === 1, | <div class="status" [ngClass]="{'success': order.orderstatus.orderstatus_id === 1, | ||||
| @@ -32,7 +32,10 @@ export class OrdersComponent implements OnInit { | |||||
| id: 'today' | id: 'today' | ||||
| }]; | }]; | ||||
| console.log(JSON.parse(localStorage.vendor_info)) | |||||
| let vendor_info = JSON.parse(localStorage.vendor_info); | |||||
| console.log(vendor_info); | |||||
| this.orderService.getOrders().then((data) => { | this.orderService.getOrders().then((data) => { | ||||
| console.log(data); | console.log(data); | ||||
| @@ -50,7 +53,7 @@ export class OrdersComponent implements OnInit { | |||||
| this.orderStatus = data; | this.orderStatus = data; | ||||
| }, () => { | }, () => { | ||||
| alert("Error getting the order statuses"); | alert("Error getting the order statuses"); | ||||
| }) | |||||
| }); | |||||
| } | } | ||||
| getFormattedDate(date: any, format: string) { | getFormattedDate(date: any, format: string) { | ||||
| @@ -67,4 +70,13 @@ export class OrdersComponent implements OnInit { | |||||
| }); | }); | ||||
| } | } | ||||
| updateOrder(order) { | |||||
| this.orderService.updateOrder(order).then((data) => { | |||||
| console.log(data); | |||||
| }, (err) => { | |||||
| console.log(err) | |||||
| alert("Failed to update order"); | |||||
| }) | |||||
| } | |||||
| } | } | ||||
| @@ -31,4 +31,27 @@ export class OrderService { | |||||
| }; | }; | ||||
| return this.http.get(URL + '/api/maioraservice/orders/getallOrderStatus', httpOptions).toPromise(); | return this.http.get(URL + '/api/maioraservice/orders/getallOrderStatus', httpOptions).toPromise(); | ||||
| } | } | ||||
| getOrdersByUserId(uid: string | number) { | |||||
| const httpOptions = { | |||||
| headers: new HttpHeaders({ | |||||
| 'Access-Control-Allow-Origin': '*', | |||||
| 'Content-Type': 'application/json', | |||||
| 'Authorization': 'Bearer ' + localStorage.vendor_token | |||||
| }) | |||||
| }; | |||||
| return this.http.get(URL + '/api/maioraservice/orders/getorders/user_id/' + uid + '/', httpOptions).toPromise(); | |||||
| } | |||||
| updateOrder(data: any) { | |||||
| const httpOptions = { | |||||
| headers: new HttpHeaders({ | |||||
| 'Access-Control-Allow-Origin': '*', | |||||
| 'Content-Type': 'application/json', | |||||
| 'Authorization': 'Bearer ' + localStorage.vendor_token | |||||
| }) | |||||
| }; | |||||
| return this.http.post(URL + '/api/maioraservice/orders/v1/update', data , httpOptions).toPromise(); | |||||
| } | |||||
| } | } | ||||