Changeset dae4cde for Farmatiko/ClientApp/src/app/admin
- Timestamp:
- 02/10/21 22:31:53 (4 years ago)
- Branches:
- master
- Children:
- 6e6f04b
- Parents:
- e0cdea2
- Location:
- Farmatiko/ClientApp/src/app/admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Farmatiko/ClientApp/src/app/admin/admin.component.html
re0cdea2 rdae4cde 56 56 <tr *ngFor="let head of heads"> 57 57 <td><a (click)="openPharmacyHeadDialog(head)">{{head.Name}}</a> | {{head.Email}}</td> 58 <td><a (click)="deletePharmacyHead(head)" >Delete</a> | <a (click)="openEditPharmacyHeadDialog(head)">Change</a></td>58 <td><a (click)="deletePharmacyHead(head)" *ngIf="head.Name !== 'Admin'">Delete</a><span *ngIf="head.Name == 'Admin'">Can't delete Admin</span> | <a (click)="openEditPharmacyHeadDialog(head)">Change</a></td> 59 59 </tr> 60 60 </tbody> -
Farmatiko/ClientApp/src/app/admin/admin.component.ts
re0cdea2 rdae4cde 56 56 createHead() { 57 57 this.dataService.insertPharmacyHead(this.head) 58 .subscribe((cHead: IPharmacyHead) => { 59 if(cHead) { 58 .subscribe((cHead) => { 60 59 this.heads.push(cHead); 61 60 this.openSnackBar("New head created!","OK"); 62 }63 61 }, 64 62 (err: any) => console.log(err), … … 79 77 }, 80 78 (err: any) => console.log(err), 81 () => console.log("PharmacyHead deleted")); 79 () => { 80 console.log("PharmacyHead deleted"); 81 location.reload(); 82 }); 82 83 } 83 84 … … 88 89 }); 89 90 dialogRef.afterClosed().subscribe((editedHead: IPharmacyHead) => { 90 if(editedHead){ 91 console.log(editedHead); 92 this.heads = this.heads.filter(x => x !== eHead); 93 this.heads.push(editedHead); 94 this.dataService.updatePharmacyHead(editedHead) 95 .subscribe((hd: IPharmacyHead) => { 96 if(hd) { 97 this.openSnackBar("Success! PharmacyHead edited", "OK").onAction().subscribe(() => { 98 window.location.reload(); 99 }); 100 } 101 else { 102 this.openSnackBar("PharmacyHead edit failed", "Try again"); 103 } 104 }, 105 (err: any) => console.log(err), 106 () => console.log('PharmacyHead data updated')); 91 if(editedHead) { 92 console.log(editedHead); 93 this.heads = this.heads.filter(x => x !== eHead); 94 this.heads.push(editedHead); 95 this.dataService.updatePharmacyHead(editedHead) 96 .subscribe((hd: IPharmacyHead) => { 97 this.openSnackBar("Success! PharmacyHead edited", "OK").onAction().subscribe(() => { 98 location.reload(); 99 }); 100 }, 101 (err: any) => console.log(err), 102 () => console.log('PharmacyHead data updated')); 107 103 } 108 104 }); … … 127 123 .subscribe((status: boolean) => { 128 124 if(status) { 129 this.openSnackBar("Request rejected!","OK"); 130 } 131 else { 132 this.openSnackBar("Something went wrong","Try again"); 125 this.openSnackBar("Request processed!","OK"); 133 126 } 134 127 }, 135 128 (err: any) => console.log(err), 136 () => console.log("PharmacyHeadRequest deleted")); 129 () => { 130 console.log("PharmacyHeadRequest deleted"); 131 location.reload(); 132 }); 137 133 } 138 134 … … 148 144 }, 149 145 (err: any) => console.log(err), 150 () => console.log("PharmacyHead updated")) 146 () => { 147 console.log("PharmacyHead updated"); 148 location.reload(); 149 }) 151 150 } 152 151 }
Note:
See TracChangeset
for help on using the changeset viewer.