Ignore:
Timestamp:
02/11/21 03:50:10 (4 years ago)
Author:
Dimitar Slezenkovski <dslezenkovski@…>
Branches:
master
Children:
f554983
Parents:
8eb1e21 (diff), dae4cde (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://develop.finki.ukim.mk/git/farmatiko

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

Legend:

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

    r8eb1e21 r6e6f04b  
    5656                <tr *ngFor="let head of heads">
    5757                  <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>
    5959                </tr>
    6060              </tbody>
  • Farmatiko/ClientApp/src/app/admin/admin.component.ts

    r8eb1e21 r6e6f04b  
    5656  createHead() {
    5757    this.dataService.insertPharmacyHead(this.head)
    58         .subscribe((cHead: IPharmacyHead) => {
    59           if(cHead) {
     58        .subscribe((cHead) => {
    6059            this.heads.push(cHead);
    6160            this.openSnackBar("New head created!","OK");
    62           }
    6361        },
    6462        (err: any) => console.log(err),
     
    7977        },
    8078        (err: any) => console.log(err),
    81         () => console.log("PharmacyHead deleted"));
     79        () => {
     80          console.log("PharmacyHead deleted");
     81          location.reload();
     82        });
    8283  }
    8384
     
    8889    });
    8990    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'));
    107103      }
    108104    });
     
    127123        .subscribe((status: boolean) => {
    128124          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");
    133126          }
    134127        },
    135128        (err: any) => console.log(err),
    136         () => console.log("PharmacyHeadRequest deleted"));
     129        () => {
     130          console.log("PharmacyHeadRequest deleted");
     131          location.reload();
     132        });
    137133  }
    138134
     
    148144        },
    149145        (err: any) => console.log(err),
    150         () => console.log("PharmacyHead updated"))
     146        () => {
     147          console.log("PharmacyHead updated");
     148          location.reload();
     149        })
    151150    }
    152151  }
Note: See TracChangeset for help on using the changeset viewer.