Changes in / [6e6f04b:8eb1e21]


Ignore:
Location:
Farmatiko/ClientApp/src/app
Files:
8 edited

Legend:

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

    r6e6f04b r8eb1e21  
    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)" *ngIf="head.Name !== 'Admin'">Delete</a><span *ngIf="head.Name == 'Admin'">Can't delete Admin</span> | <a (click)="openEditPharmacyHeadDialog(head)">Change</a></td>
     58                  <td><a (click)="deletePharmacyHead(head)">Delete</a> | <a (click)="openEditPharmacyHeadDialog(head)">Change</a></td>
    5959                </tr>
    6060              </tbody>
  • Farmatiko/ClientApp/src/app/admin/admin.component.ts

    r6e6f04b r8eb1e21  
    5656  createHead() {
    5757    this.dataService.insertPharmacyHead(this.head)
    58         .subscribe((cHead) => {
     58        .subscribe((cHead: IPharmacyHead) => {
     59          if(cHead) {
    5960            this.heads.push(cHead);
    6061            this.openSnackBar("New head created!","OK");
     62          }
    6163        },
    6264        (err: any) => console.log(err),
     
    7779        },
    7880        (err: any) => console.log(err),
    79         () => {
    80           console.log("PharmacyHead deleted");
    81           location.reload();
    82         });
     81        () => console.log("PharmacyHead deleted"));
    8382  }
    8483
     
    8988    });
    9089    dialogRef.afterClosed().subscribe((editedHead: IPharmacyHead) => {
    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'));
     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'));
    103107      }
    104108    });
     
    123127        .subscribe((status: boolean) => {
    124128          if(status) {
    125             this.openSnackBar("Request processed!","OK");
     129            this.openSnackBar("Request rejected!","OK");
     130          }
     131          else {
     132            this.openSnackBar("Something went wrong","Try again");
    126133          }
    127134        },
    128135        (err: any) => console.log(err),
    129         () => {
    130           console.log("PharmacyHeadRequest deleted");
    131           location.reload();
    132         });
     136        () => console.log("PharmacyHeadRequest deleted"));
    133137  }
    134138
     
    144148        },
    145149        (err: any) => console.log(err),
    146         () => {
    147           console.log("PharmacyHead updated");
    148           location.reload();
    149         })
     150        () => console.log("PharmacyHead updated"))
    150151    }
    151152  }
  • Farmatiko/ClientApp/src/app/counter/counter.component.ts

    r6e6f04b r8eb1e21  
    8383    }
    8484    facils.forEach((facil) => {
    85       this.http.get<any>('https://jankuloski.xyz:8080/https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+facil.municipality+'&street='+facil.address+'&format=json').subscribe(obj => {
     85      this.http.get<any>('https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+facil.municipality+'&street='+facil.address+'&format=json').subscribe(obj => {
    8686        console.log(obj); 
    8787        if(obj.length) {
  • Farmatiko/ClientApp/src/app/dashboard/dashboard.component.ts

    r6e6f04b r8eb1e21  
    6060            .subscribe((req) => {
    6161              if(req) {
    62                 this.openSnackBar("Request sent!", "OK");
     62                this.openSnackBar("Claiming request sent!", "OK");
     63              }
     64              else {
     65                this.openSnackBar("Unable to send a request", "Try again");
    6366              }
    6467            },
     
    7578            .subscribe((req) => {
    7679              if(req) {
    77                 this.openSnackBar("Request sent!", "OK");
     80                this.openSnackBar("Claiming request sent!", "OK");
     81              }
     82              else {
     83                this.openSnackBar("Unable to send a request", "Try again");
    7884              }
    7985            },
     
    9298  saveDeletedMedicines() {
    9399    this.dataService.updatePharmacyHead(this.head)
    94       .subscribe(() => {
    95           this.openSnackBar("Success!", "OK");
     100      .subscribe((hd) => {
     101        if(hd) {
     102          this.openSnackBar("Success! Medicine deleted", "OK");
    96103          this.editedMedicine = false;
     104        }
     105        else {
     106          this.openSnackBar("Unable to delete Medicine", "Try again");
     107        }
    97108      },
    98       (err: any) => {
    99         console.log(err);
    100         this.openSnackBar("Failed!", "Try again");
    101       },
     109      (err: any) => console.log(err),
    102110      () => console.log('Update sent!'));
    103111  }
     
    124132          this.editedMedicine = true;
    125133        }
    126         this.openSnackBar("Success!", "OK");
     134        this.openSnackBar("Success! Medicine added, please save changes now", "OK");
     135      }
     136      else {
     137        this.openSnackBar("Failed! Please try again", "OK");
    127138      }
    128139    }, () => this.openSnackBar("Failed! Please try again", "OK"));
     
    149160          this.editedMedicine = true;
    150161        }
    151         this.openSnackBar("Success!", "OK");
     162        this.openSnackBar("Success! Medicines added, please save changes now", "OK");
     163      }
     164      else {
     165        this.openSnackBar("Failed! Please try again", "OK");
    152166      }
    153167    }, () => this.openSnackBar("Failed! Please try again", "OK"));
     
    201215        this.head.Pharmacy.push(editedPharmacy);
    202216        this.dataService.updatePharmacyHead(this.head)
    203             .subscribe((hd) => {
    204                 this.openSnackBar("Success!", "OK").onAction().subscribe(() => {
     217            .subscribe((hd: IPharmacyHead) => {
     218              if(hd) {
     219                this.openSnackBar("Success! Pharmacy edited", "OK").onAction().subscribe(() => {
    205220                  window.location.reload();
    206221                });
     222              }
     223              else {
     224                this.openSnackBar("Pharmacy edit failed", "Try again");
     225              }
    207226            },
    208227            (err: any) => console.log(err),
  • Farmatiko/ClientApp/src/app/dialogs/facility-dialog/facility-dialog.component.ts

    r6e6f04b r8eb1e21  
    3232
    3333  addMarkers() {
    34     this.http.get<any>('https://jankuloski.xyz:8080/https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+this.facility?.municipality+'&street='+this.facility?.address+'&format=json').subscribe(obj => {
     34    this.http.get<any>('https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+this.facility?.municipality+'&street='+this.facility?.address+'&format=json').subscribe(obj => {
    3535      console.log(obj); 
    3636      if(obj.length) {
  • Farmatiko/ClientApp/src/app/dialogs/pharmacy-dialog/pharmacy-dialog.component.ts

    r6e6f04b r8eb1e21  
    3232
    3333  addMarkers() {
    34     this.http.get<any>('https://jankuloski.xyz:8080/https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+this.pharmacy?.location+'&street='+this.pharmacy?.address+'&format=json').subscribe(obj => {
     34    this.http.get<any>('https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+this.pharmacy?.location+'&street='+this.pharmacy?.address+'&format=json').subscribe(obj => {
    3535      console.log(obj); 
    3636      if(obj.length) {
  • Farmatiko/ClientApp/src/app/home/home.component.ts

    r6e6f04b r8eb1e21  
    8282    }
    8383    pharmas.forEach((pharmacy) => {
    84       this.http.get<any>('https://jankuloski.xyz:8080/https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+pharmacy.location+'&street='+pharmacy.address+'&format=json').subscribe(obj => {
     84      this.http.get<any>('https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+pharmacy.location+'&street='+pharmacy.address+'&format=json').subscribe(obj => {
    8585        console.log(obj); 
    8686        if(obj.length) {
  • Farmatiko/ClientApp/src/app/shared/interfaces.ts

    r6e6f04b r8eb1e21  
    6464    PharmacyHead?: IPharmacyHead;
    6565    Pharmacy?: IPharmacy;
    66 }
     66} 
Note: See TracChangeset for help on using the changeset viewer.