Ignore:
Timestamp:
11/16/20 03:55:10 (4 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
db484c9
Parents:
8b13eb2
Message:

Fix bugs, add some more.

Location:
Farmatiko/ClientApp/src/app/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/ClientApp/src/app/admin/admin.component.html

    r8b13eb2 r8e74e2f  
    1212        <div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
    1313          <ul class="navbar-nav flex-grow">
    14             <li>Administration panel</li>
     14            <li>Administration panel:</li>
     15            <li>&nbsp;Logged as <p *ngIf="head">{{adminHead.Name}}</p> </li>
     16            <li (click)="logout()" class="btn btn-link"><a>Logout</a></li>
    1517          </ul>
    1618        </div>
     
    1820    </nav>
    1921</header>
    20 <mat-tab-group mat-stretch-tabs>
     22<mat-tab-group mat-stretch-tabs dynamicHeight>
    2123      <mat-tab label="Claiming requests">
    2224        <div class="wrapper">
  • Farmatiko/ClientApp/src/app/admin/admin.component.ts

    r8b13eb2 r8e74e2f  
    77import { EditPharmacyHeadDialogComponent } from '../dialogs/edit-pharmacy-head-dialog/edit-pharmacy-head-dialog.component';
    88import { PharmacyDialogComponent } from '../dialogs/pharmacy-dialog/pharmacy-dialog.component';
    9 import { PharmacyHeadDialogComponent } from '../nav-menu/dialogs/pharmacy-head-dialog/pharmacy-head-dialog.component';
     9import { PharmacyHeadDialogComponent } from '../dialogs/pharmacy-head-dialog/pharmacy-head-dialog.component';
     10import { AuthService } from '../shared/services/auth.service';
    1011
    1112
     
    1920  public requests: IPharmacyHeadRequest[] = [];
    2021  public head: IPharmacyHead = {
    21     PharmacyMedicines: null,
    22     Pharmacy: null,
    2322    Email: '',
    2423    Passwd: '',
    2524    Name: ''
    2625  };
     26  public adminHead: IPharmacyHead;
    2727
    28   constructor(private dataService: DataService, private dialog: MatDialog, private snackBar: MatSnackBar, private router: Router) {
     28  constructor(private dataService: DataService, private authService: AuthService, private dialog: MatDialog, private snackBar: MatSnackBar, private router: Router) {
    2929
    3030  }
    3131
    3232  ngOnInit(): void {
     33    this.authService.getUser()
     34        .subscribe((data) => {
     35          console.log(data);
     36          this.adminHead = data;
     37        },
     38        (err: any) => console.log(err),
     39        () => console.log('User data retrieved'));
     40
    3341    this.dataService.getPharmacyHeads()
    3442        .subscribe((pHeads: IPharmacyHead[]) => {
     
    3947
    4048    this.dataService.getClaimingRequests()
    41     .subscribe((pRequests: IPharmacyHeadRequest[]) => {
    42       this.requests = pRequests;
    43     },
    44     (err: any) => console.log(err),
    45     () => console.log("PharmacyHead data retrieved"));
     49        .subscribe((pRequests: IPharmacyHeadRequest[]) => {
     50          this.requests = pRequests;
     51        },
     52        (err: any) => console.log(err),
     53        () => console.log("PharmacyHead data retrieved"));
    4654  }
    4755
     
    5765        () => console.log("PharmacyHead inserted"));
    5866    this.head = {
    59       PharmacyMedicines: null,
    60       Pharmacy: null,
    6167      Email: '',
    6268      Passwd: '',
     
    8389    dialogRef.afterClosed().subscribe((editedHead: IPharmacyHead) => {
    8490      if(editedHead){
     91        console.log(editedHead);
    8592        this.heads = this.heads.filter(x => x !== eHead);
    8693        this.heads.push(editedHead);
     
    142149  }
    143150
     151  logout() {
     152    this.authService.logout();
     153  }
     154
    144155  openSnackBar(message: string, action: string) : MatSnackBarRef<SimpleSnackBar> {
    145156    return this.snackBar.open(message, action, {
Note: See TracChangeset for help on using the changeset viewer.