| @@ -38,7 +38,6 @@ export class OrdersComponent implements OnInit { | |||||
| submitFeedbackForOrder() { | submitFeedbackForOrder() { | ||||
| this.tempReview.app_user.user_id = this.userInfo.id; | this.tempReview.app_user.user_id = this.userInfo.id; | ||||
| this.selectedOrder.rating = this.tempReview; | this.selectedOrder.rating = this.tempReview; | ||||
| console.log(this.selectedOrder); | |||||
| this.orderService.updateOrder(this.selectedOrder).then(() => { | this.orderService.updateOrder(this.selectedOrder).then(() => { | ||||
| this.selectedOrder = null; | this.selectedOrder = null; | ||||
| this.tempReview = { | this.tempReview = { | ||||
| @@ -64,7 +63,6 @@ export class OrdersComponent implements OnInit { | |||||
| }); | }); | ||||
| this.orderService.getAllOrderStatus().then((data) => { | this.orderService.getAllOrderStatus().then((data) => { | ||||
| console.log(data); | |||||
| this.allOrderStatus = data; | this.allOrderStatus = data; | ||||
| }, (err) => { | }, (err) => { | ||||
| console.log(err); | console.log(err); | ||||
| @@ -4,9 +4,9 @@ | |||||
| <figure class="profile-image"> | <figure class="profile-image"> | ||||
| <img src="assets/custom/name.svg" alt=""> | <img src="assets/custom/name.svg" alt=""> | ||||
| </figure> | </figure> | ||||
| <div class="content"> | |||||
| <div class="content" *ngIf="userInfo"> | |||||
| <h5> | <h5> | ||||
| <span> {{ userInfo.name }} </span> | |||||
| <span> {{ userInfo.name }} ({{ userInfo.username }}) </span> | |||||
| <!-- <input *ngIf="showEdit" type="text" [(ngModel)]="userInfo.name"> --> | <!-- <input *ngIf="showEdit" type="text" [(ngModel)]="userInfo.name"> --> | ||||
| <button *ngIf="!showEdit" (click)="showEdit = true"> Edit </button> | <button *ngIf="!showEdit" (click)="showEdit = true"> Edit </button> | ||||
| @@ -20,6 +20,7 @@ | |||||
| <span *ngIf="!showEdit"> {{ userInfo.email }} </span> | <span *ngIf="!showEdit"> {{ userInfo.email }} </span> | ||||
| <input *ngIf="showEdit" type="tel" [(ngModel)]="userInfo.email"> | <input *ngIf="showEdit" type="tel" [(ngModel)]="userInfo.email"> | ||||
| </p> | </p> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="location-details"> | <div class="location-details"> | ||||
| @@ -21,8 +21,7 @@ export class ProfilePage implements OnInit { | |||||
| private toastService: ToastService | private toastService: ToastService | ||||
| ) { } | ) { } | ||||
| ngOnInit() { | |||||
| this.userInfo = JSON.parse(localStorage.userInfo)['User Info']; | |||||
| ngOnInit() { | |||||
| } | } | ||||
| updateUserInfo() { | updateUserInfo() { | ||||
| @@ -33,16 +32,28 @@ export class ProfilePage implements OnInit { | |||||
| email: this.userInfo.email, | email: this.userInfo.email, | ||||
| } | } | ||||
| this.authService.updateUser(tempUserInfo).then((data) => { | |||||
| console.log(data); | |||||
| this.authService.updateUser(tempUserInfo).then(() => { | |||||
| this.toastService.presentToast("Updated!", "success"); | this.toastService.presentToast("Updated!", "success"); | ||||
| }, (err) => { | |||||
| console.log(err); | |||||
| }, () => { | |||||
| this.toastService.presentToast("Failed to update", "danger"); | this.toastService.presentToast("Failed to update", "danger"); | ||||
| }); | }); | ||||
| } | } | ||||
| ionViewDidEnter() { | ionViewDidEnter() { | ||||
| this.userInfo = JSON.parse(localStorage.userInfo)['User Info']; | |||||
| this.authService.getUserDetails(this.userInfo.id).then((data: any) => { | |||||
| this.userInfo.mobile = data.mobile; | |||||
| this.userInfo.email = data.email; | |||||
| let info = JSON.parse(localStorage.userInfo); | |||||
| info['User Info'] = this.userInfo; | |||||
| localStorage.userInfo = JSON.stringify(info); | |||||
| }, () => { | |||||
| this.toastService.presentToast("Failed to get user data"); | |||||
| }); | |||||
| this.selected_tab = ''; | this.selected_tab = ''; | ||||
| setTimeout(() => { | setTimeout(() => { | ||||
| this.selected_tab = 'MY ORDERS'; | this.selected_tab = 'MY ORDERS'; | ||||
| @@ -46,4 +46,16 @@ export class AuthService { | |||||
| return this.http.put(URL + '/api/maioraservice/user/v1/update', userData, httpOptions).toPromise(); | return this.http.put(URL + '/api/maioraservice/user/v1/update', userData, httpOptions).toPromise(); | ||||
| } | } | ||||
| getUserDetails(userId: string) { | |||||
| const httpOptions = { | |||||
| headers: new HttpHeaders({ | |||||
| 'Access-Control-Allow-Origin': '*', | |||||
| 'Content-Type': 'application/json', | |||||
| 'Authorization': 'Bearer ' + localStorage.access_Token | |||||
| }) | |||||
| }; | |||||
| return this.http.get(URL + '/api/maioraservice/user/v1/user_id/' + userId + '/', httpOptions).toPromise(); | |||||
| } | |||||
| } | } | ||||