Index: Farmatiko/ClientApp/angular.json
===================================================================
--- Farmatiko/ClientApp/angular.json	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/angular.json	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -54,5 +54,6 @@
           "builder": "@angular-devkit/build-angular:dev-server",
           "options": {
-            "browserTarget": "Farmatiko:build"
+            "browserTarget": "Farmatiko:build",
+            "port": 80
           },
           "configurations": {
Index: Farmatiko/ClientApp/src/app/admin/admin.component.css
===================================================================
--- Farmatiko/ClientApp/src/app/admin/admin.component.css	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/admin/admin.component.css	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -11,2 +11,7 @@
     width: 30vh;
 }
+
+h2 {
+    text-align: center;
+    padding: 50px;
+}
Index: Farmatiko/ClientApp/src/app/admin/admin.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/admin/admin.component.html	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/admin/admin.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -22,5 +22,5 @@
         <div class="wrapper">
           <div>
-            <table class='table table-striped table-bordered table-sm' cellspacing="0" width="100%" aria-labelledby="tableLabel" *ngIf="true">
+            <table class='table table-striped table-bordered table-sm' cellspacing="0" width="100%" aria-labelledby="tableLabel" *ngIf="requests">
               <thead>
                 <tr>
@@ -31,8 +31,8 @@
               </thead>
               <tbody>
-                <tr *ngFor="let head of heads">
-                  <td>{{head.Name}} | {{head.Email}}</td>
-                  <td>{{head.Pharmacy[0].name}}</td>
-                  <td><a (click)="Approve()">Approve</a> | <a (click)="Reject()">Reject</a></td>
+                <tr *ngFor="let request of requests">
+                  <td>{{request.PharmacyHead.Name}} | {{request.PharmacyHead.Email}}</td>
+                  <td><a (click)="openPharmacyDialog(request.Pharmacy)">{{request.Pharmacy.name}}</a></td>
+                  <td><a (click)="approveRequest(request)">Approve</a> | <a (click)="rejectRequest(request)">Reject</a></td>
                 </tr>
               </tbody>
@@ -44,5 +44,5 @@
         <div class="wrapper">
           <div>
-            <table class='table table-striped table-bordered table-sm' cellspacing="0" width="100%" aria-labelledby="tableLabel" *ngIf="true">
+            <table class='table table-striped table-bordered table-sm' cellspacing="0" width="100%" aria-labelledby="tableLabel" *ngIf="heads">
               <thead>
                 <tr>
@@ -53,6 +53,6 @@
               <tbody>
                 <tr *ngFor="let head of heads">
-                  <td>{{head.Name}} | {{head.Email}}</td>
-                  <td><a (click)="Del(head)">Delete</a> | <a (click)="ChangeDialog(head)">Change</a></td>
+                  <td><a (click)="openPharmacyHeadDialog(head)">{{head.Name}}</a> | {{head.Email}}</td>
+                  <td><a (click)="deletePharmacyHead(head)">Delete</a> | <a (click)="openEditPharmacyHeadDialog(head)">Change</a></td>
                 </tr>
               </tbody>
@@ -62,16 +62,17 @@
       </mat-tab>
         <mat-tab label="Create new account">
-          <div class="createform">
+          <h2 *ngIf="!this.head">Loading form...</h2>
+          <div class="createform" *ngIf="this.head">
           <mat-form-field appearance="fill">
             <mat-label>Name</mat-label>
-            <input matInput [(ngModel)]="head.Name">
+            <input matInput [(ngModel)]="this.head.Name">
           </mat-form-field><br>
           <mat-form-field appearance="fill">
             <mat-label>Email</mat-label>
-            <input matInput [(ngModel)]="head.Email">
+            <input matInput [(ngModel)]="this.head.Email">
           </mat-form-field><br>
           <mat-form-field appearance="fill">
             <mat-label>Password</mat-label>
-            <input matInput [(ngModel)]="head.Passwd">
+            <input matInput [(ngModel)]="this.head.Passwd">
           </mat-form-field><br>
             <button onclick="createHead()" mat-raised-button color="primary">Create</button>
@@ -79,4 +80,2 @@
         </mat-tab>
 </mat-tab-group>
-
-<div class="status">{{status}}</div>
Index: Farmatiko/ClientApp/src/app/admin/admin.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/admin/admin.component.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/admin/admin.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -1,10 +1,11 @@
-import { Component, OnInit, Inject, Output, EventEmitter } from '@angular/core';
-import { Pharmacy } from '../models/Pharmacy';
-import { HttpClient } from '@angular/common/http';
+import { Component, OnInit } from '@angular/core';
 import { MatDialog } from '@angular/material/dialog';
 import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
-import { Router, RouterModule } from '@angular/router';
-import { PharmacyHead } from '../models/PharmacyHead';
-import { FormControl } from '@angular/forms';
+import { Router } from '@angular/router';
+import { IPharmacyHead, IPharmacyHeadRequest, IPharmacy } from '../shared/interfaces';
+import { DataService } from '../shared/data.service';
+import { EditPharmacyHeadDialogComponent } from '../dialogs/edit-pharmacy-head-dialog/edit-pharmacy-head-dialog.component';
+import { PharmacyDialogComponent } from '../dialogs/pharmacy-dialog/pharmacy-dialog.component';
+import { PharmacyHeadDialogComponent } from '../nav-menu/dialogs/pharmacy-head-dialog/pharmacy-head-dialog.component';
 
 
@@ -15,49 +16,122 @@
 })
 export class AdminComponent implements OnInit {
-  public heads: PharmacyHead[];
-  public head: PharmacyHead;
-  public status: string;
+  public heads: IPharmacyHead[] = [];
+  public requests: IPharmacyHeadRequest[] = [];
+  public head: IPharmacyHead;
 
-  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string, private dialog: MatDialog, private _snackBar: MatSnackBar, private router: Router) {
-    http.get<PharmacyHead[]>(baseUrl + 'PharmacyHead/Get?').subscribe(result => {
-      this.heads = result;
-      console.log(this.heads);
-    }, error => console.error(error));
+  constructor(private dataService: DataService, private dialog: MatDialog, private snackBar: MatSnackBar, private router: Router) {
+
   }
 
   ngOnInit(): void {
-    this.head = new PharmacyHead();
+    this.dataService.getPharmacyHeads()
+        .subscribe((pHeads: IPharmacyHead[]) => {
+          this.heads = pHeads;
+        },
+        (err: any) => console.log(err),
+        () => console.log("PharmacyHead data retrieved"));
+
+    this.dataService.getClaimingRequests()
+    .subscribe((pRequests: IPharmacyHeadRequest[]) => {
+      this.requests = pRequests;
+    },
+    (err: any) => console.log(err),
+    () => console.log("PharmacyHead data retrieved"));
   }
 
   createHead() {
-    console.log(this.head);
-    // post request vo prodolzenie
-
-    this.status="Status bar createHead";
-    //window.location.reload();
+    this.dataService.insertPharmacyHead(this.head)
+        .subscribe((cHead: IPharmacyHead) => {
+          if(cHead) {
+            this.heads.push(cHead);
+            this.openSnackBar("New head created!","OK");
+          }
+        },
+        (err: any) => console.log(err),
+        () => console.log("PharmacyHead inserted"));
+    this.head = null;
   }
 
-  Del(head: PharmacyHead) {
-    console.log(this.head);
-    // post request vo prodolzenie
-
-    this.status="Status bar Del";
+  deletePharmacyHead(dHead: IPharmacyHead) {
+    this.dataService.deletePharmacyHead(dHead.id)
+        .subscribe((status: boolean) => {
+          if(status) {
+            this.openSnackBar("Head deleted!","OK");
+          }
+        },
+        (err: any) => console.log(err),
+        () => console.log("PharmacyHead deleted"));
   }
 
-  ChangeDialog(head: PharmacyHead) {
-    console.log(this.head);
-
+  openEditPharmacyHeadDialog(eHead: IPharmacyHead) {
+    let dialogRef = this.dialog.open(EditPharmacyHeadDialogComponent, {
+      width: '450px',
+      data: eHead
+    });
+    dialogRef.afterClosed().subscribe((editedHead: IPharmacyHead) => {
+      if(editedHead){
+        this.heads = this.heads.filter(x => x !== eHead);
+        this.heads.push(editedHead);
+        this.dataService.updatePharmacyHead(editedHead)
+            .subscribe((hd: IPharmacyHead) => {
+              if(hd) {
+                this.openSnackBar("Success! PharmacyHead edited", "OK").onAction().subscribe(() => {
+                  window.location.reload();
+                });
+              }
+              else {
+                this.openSnackBar("PharmacyHead edit failed", "Try again");
+              }
+            },
+            (err: any) => console.log(err),
+            () => console.log('PharmacyHead data updated'));
+      }
+    });
   }
 
-  Reject() {
-    console.log('Rejected');
-    // post request vo prodolzenie
-
+  openPharmacyDialog(pharmacy: IPharmacy): void {
+    this.dialog.open(PharmacyDialogComponent, {
+      width: '450px',
+      data: pharmacy
+    });
   }
 
-  Approve() {
-    console.log('Approved');
-    // post request vo prodolzenie
+  openPharmacyHeadDialog(hd: IPharmacyHead): void {
+    this.dialog.open(PharmacyHeadDialogComponent, {
+      width: '450px',
+      data: hd
+    });
+  }
 
+  rejectRequest(req: IPharmacyHeadRequest) {
+    this.dataService.deleteClaimingRequest(req.id)
+        .subscribe((status: boolean) => {
+          if(status) {
+            this.openSnackBar("Request rejected!","OK");
+          }
+          else {
+            this.openSnackBar("Something went wrong","Try again");
+          }
+        },
+        (err: any) => console.log(err),
+        () => console.log("PharmacyHeadRequest deleted"));
+  }
+
+  approveRequest(req: IPharmacyHeadRequest) {
+    if(req) {
+    req.PharmacyHead.Pharmacy.push(req.Pharmacy);
+    this.dataService.updatePharmacyHead(req.PharmacyHead)
+        .subscribe(() => {
+          
+        },
+        (err: any) => console.log(err),
+        () => console.log("PharmacyHead updated"))
+    }
+  }
+
+  openSnackBar(message: string, action: string) : MatSnackBarRef<SimpleSnackBar> {
+    return this.snackBar.open(message, action, {
+      duration: 5000,
+    });
   }
 
Index: Farmatiko/ClientApp/src/app/app.module.ts
===================================================================
--- Farmatiko/ClientApp/src/app/app.module.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/app.module.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -6,4 +6,6 @@
 import { MaterialModule } from './shared/material.module';
 import { ReactiveFormsModule } from '@angular/forms';
+
+import { DataService } from './shared/data.service';
 
 import { AppComponent } from './app.component';
@@ -16,4 +18,11 @@
 import { DashboardComponent } from './dashboard/dashboard.component';
 import { LoginComponent } from './login/login.component';
+import { MedicineDialogComponent } from './dialogs/medicine-dialog/medicine-dialog.component';
+import { PharmacyDialogComponent } from './dialogs/pharmacy-dialog/pharmacy-dialog.component';
+import { FacilityDialogComponent } from './dialogs/facility-dialog/facility-dialog.component';
+import { WorkerDialogComponent } from './dialogs/worker-dialog/worker-dialog.component';
+import { EditPharmacyDialogComponent } from './dialogs/edit-pharmacy-dialog/edit-pharmacy-dialog.component';
+import { EditPharmacyHeadDialogComponent } from './dialogs/edit-pharmacy-head-dialog/edit-pharmacy-head-dialog.component';
+import { PharmacyHeadDialogComponent } from './nav-menu/dialogs/pharmacy-head-dialog/pharmacy-head-dialog.component';
 
 @NgModule({
@@ -26,5 +35,12 @@
     AdminComponent,
     DashboardComponent,
-    LoginComponent
+    LoginComponent,
+    MedicineDialogComponent,
+    PharmacyDialogComponent,
+    FacilityDialogComponent,
+    WorkerDialogComponent,
+    EditPharmacyDialogComponent,
+    EditPharmacyHeadDialogComponent,
+    PharmacyHeadDialogComponent
   ],
   imports: [
@@ -38,4 +54,5 @@
       { path: 'admin', component: AdminComponent },
       { path: 'dashboard', component: DashboardComponent },
+      { path: 'dashboard/:token', component: DashboardComponent },
       { path: 'login', component: LoginComponent }
     ]),
@@ -44,5 +61,7 @@
     ReactiveFormsModule
   ],
-  providers: [],
+  providers: [
+    DataService
+  ],
   bootstrap: [AppComponent]
 })
Index: Farmatiko/ClientApp/src/app/counter/counter.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/counter/counter.component.html	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/counter/counter.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -8,57 +8,29 @@
     <h2>Здравствени установи</h2>
   <mat-form-field>
-    <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Пронајди установа">
+    <input matInput (keyup)="applyFilterFacilities($event.target.value)" placeholder="Пронајди установа">
   </mat-form-field>
     </div>    
-  <table [dataSource]="dataSource" mat-table matSort class="mat-elevation-z8">
-      <ng-container matColumnDef="id">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> id </th>
-        <td mat-cell *matCellDef="let facilities"> {{facilities.id}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="createdOn">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> createdOn </th>
-        <td mat-cell *matCellDef="let facilities"> {{facilities.createdOn}} </td>
-      </ng-container>
-      
-      <ng-container matColumnDef="deletedOn">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> deletedOn </th>
-        <td mat-cell *matCellDef="let facilities"> {{facilities.deletedOn}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Име">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Име </th>
-        <td mat-cell *matCellDef="let facilities"> {{facilities.name}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Општина">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Општина </th>
-        <td mat-cell *matCellDef="let facilities"> {{facilities.municipality}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Адреса">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Адреса </th>
-        <td mat-cell *matCellDef="let facilities"> {{facilities.address}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Тип">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Тип </th>
-        <td mat-cell *matCellDef="let facilities"> {{facilities.type}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Е-пошта">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Е-пошта </th>
-        <td mat-cell *matCellDef="let facilities"> {{facilities.email}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Телефон">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Телефон </th>
-        <td mat-cell *matCellDef="let facilities"> {{facilities.phone}} </td>
-      </ng-container>
-
-        <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
-        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
-    </table>
-    <mat-paginator #paginator [pageSize]="100" [pageSizeOptions]="[5, 10, 20, 100]"></mat-paginator>
+    <table class='table table-striped' aria-labelledby="tableLabel" *ngIf="true">
+      <thead>
+        <tr>
+      	  <th>Име</th>
+      	  <th>Општина</th>
+      	  <th>Адреса</th>
+      	  <th>Тип</th>
+      	  <th>Е-пошта</th>
+      	  <th>Телефон</th>
+      	</tr>
+      </thead>
+      <tbody>
+      	<tr *ngFor="let facility of filteredFacilities">
+      	  <td><a (click)="openFacilityDialog(facility)">{{ facility.name }}</a></td>
+      	  <td>{{ facility.municipality }}</td>
+      	  <td>{{ facility.address }}</td>
+      	  <td>{{ facility.type }}</td>
+      	  <td>{{ facility.email }}</td>
+      	  <td>{{ facility.phone }}</td>
+      	</tr>
+    </tbody>
+  </table>
   </div>
   </mat-tab>
@@ -71,29 +43,22 @@
     </mat-form-field>
     </div>
-      <table [dataSource]="dataSourceWorkers" mat-table matSort class="mat-elevation-z8">
-        <ng-container matColumnDef="Име">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Име </th>
-          <td mat-cell *matCellDef="let workers"> {{workers.name}} </td>
-        </ng-container>
-
-        <ng-container matColumnDef="Гранка">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Гранка </th>
-          <td mat-cell *matCellDef="let workers"> {{workers.branch}} </td>
-        </ng-container>
-
-        <ng-container matColumnDef="Установа">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Установа </th>
-          <td mat-cell *matCellDef="let workers"> {{workers.facility}} </td>
-        </ng-container>
-
-        <ng-container matColumnDef="Назив">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Назив </th>
-          <td mat-cell *matCellDef="let workers"> {{workers.title}} </td>
-        </ng-container>
-
-          <tr mat-header-row *matHeaderRowDef="displayedColumnsWorkers"></tr>
-          <tr mat-row *matRowDef="let row; columns: displayedColumnsWorkers;"></tr>
-      </table>
-      <mat-paginator #paginator [pageSize]="5" [pageSizeOptions]="[5, 10, 20, 100]"></mat-paginator>
+    <table class='table table-striped' aria-labelledby="tableLabel" *ngIf="true">
+      <thead>
+        <tr>
+      	  <th>Име</th>
+      	  <th>Гранка</th>
+      	  <th>Установа</th>
+      	  <th>Назив</th>
+      	</tr>
+      </thead>
+      <tbody>
+      	<tr *ngFor="let worker of filteredWorkers">
+      	  <td><a (click)="openWorkerDialog(worker)">{{ worker.name }}</a></td>
+      	  <td>{{ worker.branch }}</td>
+      	  <td>{{ worker.facility }}</td>
+      	  <td>{{ worker.title }}</td>
+      	</tr>
+    </tbody>
+  </table>
     </div>
     </mat-tab>
Index: Farmatiko/ClientApp/src/app/counter/counter.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/counter/counter.component.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/counter/counter.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -1,9 +1,8 @@
-import { Component, OnInit, ViewChild, Inject, Input } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-import { HealthFacilities } from '../models/HealthFacilities';
-import { MatTableDataSource } from '@angular/material/table';
-import { MatPaginator } from '@angular/material/paginator';
-import { MatSort } from '@angular/material/sort';
-import { HealthcareWorkers } from '../models/HealthcareWorkers';
+import { Component, OnInit } from '@angular/core';
+import { IHealthFacilities, IHealthcareWorkers } from '../shared/interfaces';
+import { DataService } from '../shared/data.service';
+import { MatDialog } from '@angular/material/dialog';
+import { FacilityDialogComponent } from '../dialogs/facility-dialog/facility-dialog.component';
+import { WorkerDialogComponent } from '../dialogs/worker-dialog/worker-dialog.component';
 
 @Component({
@@ -13,44 +12,71 @@
 })
 export class CounterComponent implements OnInit {
-  @Input() facilities: HealthFacilities[];
-  public workers: HealthcareWorkers[];
-  displayedColumns = ['id','createdOn','deletedOn','Име','Општина','Адреса', 'Тип', 'Е-пошта', 'Телефон'];
-  displayedColumnsWorkers = ['Име','Гранка','Установа', 'Назив'];
-  dataSource = new MatTableDataSource<HealthFacilities>();
-  dataSourceWorkers = new MatTableDataSource<HealthcareWorkers>();
+  public facilities: IHealthFacilities[] = [];
+  public workers: IHealthcareWorkers[] = [];
+  public filteredFacilities: IHealthFacilities[] = [];
+  public filteredWorkers: IHealthcareWorkers[] = [];
 
-  @ViewChild(MatPaginator, {static: false}) paginator: MatPaginator;
-  @ViewChild(MatSort) sort: MatSort;
-
-  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
-    http.get<HealthFacilities[]>(baseUrl + 'HealthFacilities/Get?').subscribe(result => {
-      this.facilities = result;
-      console.log(this.facilities);
-      this.dataSource = new MatTableDataSource<HealthFacilities>(this.facilities);
-    }, error => console.error(error));
-    http.get<HealthcareWorkers[]>(baseUrl + 'HealthcareWorker/Get?').subscribe(result => {
-      this.workers = result;
-      console.log(this.workers);
-      this.dataSourceWorkers = new MatTableDataSource<HealthcareWorkers>(this.workers);
-    }, error => console.error(error));
-  }
-  ngOnInit(): void {
+  constructor(private dataService: DataService, private dialog: MatDialog) {
+    
   }
 
-  ngAfterViewInit(): void {
-    this.dataSource.paginator = this.paginator;
-    this.dataSource.sort = this.sort;
+  ngOnInit(): void {
+    this.dataService.getFacilities()
+        .subscribe((facility: IHealthFacilities[]) => {
+          this.facilities = this.filteredFacilities = facility;
+        },
+        (err: any) => console.log(err),
+        () => console.log('Facility data retrieved!'));
+
+    this.dataService.getWorkers()
+        .subscribe((worker: IHealthcareWorkers[]) => {
+          this.workers = this.filteredWorkers = worker;
+        },
+        (err: any) => console.log(err),
+        () => console.log('Facility data retrieved!'));
   }
 
-  applyFilter(filterValue: string) {
-    filterValue = filterValue.trim();
-    filterValue = filterValue.toLowerCase();
-    this.dataSource.filter = filterValue;
+  applyFilterFacilities(filterValue: string) {
+    console.log("applyFilterFacilities works!")
+    if(filterValue) {
+      this.dataService.searchFacilities(filterValue)
+          .subscribe((facility: IHealthFacilities[]) => {
+            this.filteredFacilities = facility;
+          },
+          (err: any) => console.log(err),
+          () => console.log('Facility data retrieved!'));
+    }
+    else {
+      this.filteredFacilities = this.facilities;
+    }
   }
 
   applyFilterWorkers(filterValue: string) {
-    filterValue = filterValue.trim();
-    filterValue = filterValue.toLowerCase();
-    this.dataSourceWorkers.filter = filterValue;
+    console.log("applyFilterWorkers works!")
+    if(filterValue) {
+      this.dataService.searchWorkers(filterValue)
+          .subscribe((worker: IHealthcareWorkers[]) => {
+            this.filteredWorkers = worker;
+          },
+          (err: any) => console.log(err),
+          () => console.log('Worker data retrieved!'));
+    }
+    else {
+      this.filteredWorkers = this.workers;
+    }
+  }
+
+  openFacilityDialog(facility: IHealthFacilities): void {
+    this.dialog.open(FacilityDialogComponent, {
+      width: '450px',
+      data: facility
+    });
+  }
+  
+  openWorkerDialog(worker: IHealthcareWorkers): void {
+    this.dialog.open(WorkerDialogComponent, {
+      width: '450px',
+      data: worker
+    });
   }
 }
Index: Farmatiko/ClientApp/src/app/dashboard/dashboard.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/dashboard/dashboard.component.html	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/dashboard/dashboard.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -12,5 +12,5 @@
         <div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
           <ul class="navbar-nav flex-grow">
-            <li>Logged as  <!--{{head.Name}}--> </li>
+            <li>Logged as ...<p *ngIf="head">{{head.Name}}</p> </li>
           </ul>
         </div>
@@ -18,6 +18,5 @@
         <button mat-button [matMenuTriggerFor]="menu"><mat-icon>more_vert</mat-icon></button>
         <mat-menu #menu="matMenu">
-          <button mat-menu-item (click)="openDialog()"><mat-icon>person_add</mat-icon>View homepage</button>
-          <button mat-menu-item (click)="test()"><mat-icon>directions</mat-icon>Go to homepage</button>
+          <button mat-menu-item [routerLink]="['/']"><mat-icon>directions</mat-icon>Почетна</button>
         </mat-menu>
       </div>
@@ -30,7 +29,7 @@
     <div class="header">
     <h2>Мои аптеки</h2>
-    <p *ngIf="!mypharmacies"><em>Loading...</em></p>
+    <p *ngIf="!head"><em>Loading...</em></p>
     </div>
-    <table class='table table-striped table-bordered table-sm' cellspacing="0" width="100%" aria-labelledby="tableLabel" *ngIf="true">
+    <table class='table table-striped table-bordered table-sm' cellspacing="0" width="100%" aria-labelledby="tableLabel" *ngIf="head">
       <thead>
         <tr>
@@ -43,10 +42,10 @@
       </thead>
       <tbody>
-        <tr *ngFor="let pharmacies of mypharmacies">
+        <tr *ngFor="let pharmacies of head.Pharmacy">
           <td>{{pharmacies.name}}</td>
           <td>{{pharmacies.location}}</td>
           <td>{{pharmacies.address}}</td>
           <td>{{pharmacies.workAllTime}}</td>
-          <td><a (click)="works24hrs(pharmacies)">Работи 24/7</a> | <a (click)="doesntWork24hrs(pharmacies)">Не работи 24/7</a></td>
+          <td><a (click)="openEditPharmacyDialog(pharmacies)">Edit</a></td>
         </tr>
       </tbody>
@@ -61,35 +60,27 @@
       <input matInput (keyup)="applyFilterPharmacies($event.target.value)" placeholder="Пронајди аптека">
     </mat-form-field>
-    </div>
-      <table [dataSource]="dataSource" mat-table matSort class="mat-elevation-z8">
-        <ng-container matColumnDef="Име">a
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Име </th>
-          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.name}} </td>
-        </ng-container>
-    
-        <ng-container matColumnDef="Локација">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Локација </th>
-          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.location}} </td>
-        </ng-container>
-      
-        <ng-container matColumnDef="Адреса">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Адреса </th>
-          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.address}} </td>
-        </ng-container>
-
-        <ng-container matColumnDef="Actions">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Actions </th>
-          <td mat-cell *matCellDef="let pharmacies"> <a (click)="claimPharmacy(pharmacies)">Claim Pharmacy</a> </td>
-        </ng-container>
-  
-          <tr mat-header-row *matHeaderRowDef="displayedColumnsPharmacies"></tr>
-          <tr mat-row *matRowDef="let row; columns: displayedColumnsPharmacies;"></tr>
-      </table>
-      <mat-paginator #paginator [pageSize]="5" [pageSizeOptions]="[5, 10, 20, 100]"></mat-paginator>
+  </div>
+    <table class='table table-striped table-bordered table-sm' cellspacing="0" width="100%" aria-labelledby="tableLabel" *ngIf="pharmacies">
+      <thead>
+        <tr>
+      	  <th>Име</th>
+      	  <th>Локација</th>
+      	  <th>Адреса</th>
+      	  <th>Работи 27/7?</th>
+      	</tr>
+      </thead>
+      <tbody>
+      	<tr *ngFor="let pharmacy of pharmacies">
+      	  <td><a (click)="openPharmacyDialog(pharmacy)">{{ pharmacy.name }}</a></td>
+      	  <td>{{ pharmacy.location }}</td>
+      	  <td>{{ pharmacy.address }}</td>
+          <td>{{ pharmacy.workAllTime }}</td>
+          <td><a (click)="claimPharmacy(pharmacy)">Claim</a></td>
+      	</tr>
+    </tbody>
+  </table>
     </div>
     </mat-tab>
   </mat-tab-group>
-
-  <div class="statusbar">{{status}}</div>
 
 <div class="wrapper">
@@ -97,51 +88,31 @@
     <h2>Достапни лекови</h2>
     <mat-form-field>
-      <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Пронајди лек">
+      <input matInput (keyup)="applyFilterMedicines($event.target.value)" placeholder="Пронајди лек">
     </mat-form-field>
       </div>
-      <table [dataSource]="dataSource" mat-table matSort class="mat-elevation-z8">
-        <ng-container matColumnDef="Име">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Име </th>
-          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.name}} </td>
-        </ng-container>
-    
-        <ng-container matColumnDef="Јачина">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Јачина </th>
-          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.strength}} </td>
-        </ng-container>
-      
-        <ng-container matColumnDef="Форма">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Форма </th>
-          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.form}} </td>
-        </ng-container>
-        
-        <ng-container matColumnDef="Начин на издавање">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Начин на издавање </th>
-          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.wayOfIssuing}} </td>
-        </ng-container>
-    
-        <ng-container matColumnDef="Производител">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Производител </th>
-          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.manufacturer}} </td>
-        </ng-container>
-      
-        <ng-container matColumnDef="Цена">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Цена </th>
-          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.price}} </td>
-        </ng-container>
-  
-        <ng-container matColumnDef="Пакување">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Пакување </th>
-          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.packaging}} </td>
-        </ng-container>
-  
-        <ng-container matColumnDef="Actions">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Actions </th>
-          <td mat-cell *matCellDef="let mymedicines"> <a (click)="medicineExists(mymedicines)">Exists</a> | <a (click)="medicineDoesntSell(mymedicines)">Doesnt sell</a> </td>
-        </ng-container>
-  
-          <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
-          <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
-      </table>
-      <mat-paginator #paginator [pageSize]="5" [pageSizeOptions]="[5, 10, 20, 100]"></mat-paginator>
+      <table class='table table-striped table-bordered table-sm' cellspacing="0" width="100%" aria-labelledby="tableLabel" *ngIf="head">
+        <thead>
+          <tr>
+            <th>Име</th>
+            <th>Јачина</th>
+            <th>Форма</th>
+            <th>Начин на издавање</th>
+            <th>Производител</th>
+            <th>Цена</th>
+            <th>Пакување</th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr *ngFor="let medicine of head.PharmacyMedicines">
+            <td><a (click)="openMedicineDialog(medicine)">{{ medicine.name }}</a></td>
+            <td>{{ medicine.strength }}</td>
+            <td>{{ medicine.form }}</td>
+            <td>{{ medicine.wayOfIssuing }}</td>
+            <td>{{ medicine.manufacturer }}</td>
+            <td>{{ medicine.price }}</td>
+            <td>{{ medicine.packaging }}</td>
+            <td><a (click)="deleteMedicine(medicine)">Delete</a></td>
+          </tr>
+      </tbody>
+    </table>
 </div>
Index: Farmatiko/ClientApp/src/app/dashboard/dashboard.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/dashboard/dashboard.component.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/dashboard/dashboard.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -1,15 +1,11 @@
-import { Component, OnInit, ViewChild, Inject, Output, EventEmitter } from '@angular/core';
-import { Pharmacy } from '../models/Pharmacy';
-import { MatTableDataSource } from '@angular/material/table';
-import { MatPaginator } from '@angular/material/paginator';
-import { MatSort } from '@angular/material/sort';
-import { HttpClient } from '@angular/common/http';
+import { Component, OnInit} from '@angular/core';
 import { MatDialog } from '@angular/material/dialog';
 import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
-import { Router, RouterModule } from '@angular/router';
-import { HomeComponent } from '../home/home.component';
-import { Medicine } from '../models/Medicine';
-import { PharmacyHead } from '../models/PharmacyHead';
-import { MedicineList } from '../models/MedicineList';
+import { IPharmacy, IMedicine, IPharmacyHead, IPharmacyHeadRequest } from '../shared/interfaces';
+import { DataService } from '../shared/data.service';
+import { PharmacyDialogComponent } from '../dialogs/pharmacy-dialog/pharmacy-dialog.component';
+import { EditPharmacyDialogComponent } from '../dialogs/edit-pharmacy-dialog/edit-pharmacy-dialog.component';
+import { MedicineDialogComponent } from '../dialogs/medicine-dialog/medicine-dialog.component';
+import { ActivatedRoute, Router } from '@angular/router';
 
 @Component({
@@ -19,113 +15,139 @@
 })
 export class DashboardComponent implements OnInit {
-  public mymedicines: Medicine[];
-  public hasmymedicines: boolean[];
-  public pharmacies: Pharmacy[];
-  public mypharmacies: Pharmacy[];
-  public head: PharmacyHead;
-  public status: string;
-  displayedColumns = ['Име','Јачина','Форма', 'Начин на издавање', 'Производител', 'Цена', 'Пакување', 'Actions'];
-  displayedColumnsPharmacies = ['Име','Локација','Адреса', 'Actions'];
-  dataSource = new MatTableDataSource<Medicine>();
-  dataSourcePharmacies = new MatTableDataSource<Pharmacy>();
+  public pharmacies: IPharmacy[] = [];
+  public head: IPharmacyHead;
+  public filteredPharmacies: IPharmacy[] = [];
+  public filteredMedicines: IMedicine[] = [];
+  public request: IPharmacyHeadRequest;
+  public token: string;
 
-  @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
-  @ViewChild(MatSort) sort: MatSort;
+  constructor(private dataService: DataService, private dialog: MatDialog, private snackBar: MatSnackBar, private router: Router, private route: ActivatedRoute) {
 
-  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string, private dialog: MatDialog, private _snackBar: MatSnackBar, private router: Router) {
-    http.get<PharmacyHead>(baseUrl + 'PharmacyHead/GetLoggedHead?').subscribe(result => {
-      this.head = result;
-      console.log(this.head);
-      this.mymedicines = this.head.PharmacyMedicines.Medicines;
-      console.log(this.mymedicines);
-      this.mypharmacies = this.head.Pharmacy;
-      console.log(this.mypharmacies);
-      this.dataSource = new MatTableDataSource<Medicine>(this.mymedicines);
-    }, error => console.error(error));
-    http.get<Pharmacy[]>(baseUrl + 'Pharmacy/Get?').subscribe(result => {
-      this.pharmacies = result;
-      console.log(this.pharmacies);
-      this.dataSourcePharmacies = new MatTableDataSource<Pharmacy>(this.pharmacies);
-    }, error => console.error(error));
   }
 
   ngOnInit(): void {
+    this.token = this.route.snapshot.params['token'];
+    this.dataService.getPharmacyHead(this.token)
+        .subscribe((hd: IPharmacyHead) => {
+          this.head = hd;
+        },
+        (err: any) => console.log(err),
+        () => console.log('Head data retrieved'));
+
+    this.dataService.getPharmacies()
+        .subscribe((pharmacy: IPharmacy[]) => {
+          this.pharmacies = pharmacy;
+        },
+        (err: any) => console.log(err),
+        () => console.log('Pharmacy data retrieved'));
+  }
+  
+  claimPharmacy(pharmacy: IPharmacy) {
+    if(pharmacy && !this.head.Pharmacy.find(x => x === pharmacy)) {
+      this.request = null;
+      this.request.Pharmacy = pharmacy;
+      this.request.PharmacyHead = this.head;
+      this.dataService.claimPharmacy(this.request)
+          .subscribe((req: IPharmacyHeadRequest) => {
+            if(req) {
+              this.openSnackBar("Claiming request sent!", "OK");
+            }
+            else {
+              this.openSnackBar("Unable to send a request", "Try again");
+            }
+          },
+          (err: any) => console.log(err),
+          () => console.log('Claiming request sent!'));
+    }
   }
 
-  ngAfterViewInit(): void {
-    this.dataSource.paginator = this.paginator;
-    this.dataSource.sort = this.sort;
-    this.dataSourcePharmacies.paginator = this.paginator;
-    this.dataSourcePharmacies.sort = this.sort;
+  deleteMedicine(medicine: IMedicine){
+    this.head.PharmacyMedicines = this.head.PharmacyMedicines.filter(x => x !== medicine);
+    this.dataService.updatePharmacyHead(this.head)
+        .subscribe((hd: IPharmacyHead) => {
+          if(hd) {
+            this.openSnackBar("Success! Medicine deleted", "OK");
+          }
+          else {
+            this.openSnackBar("Unable to delete Medicine", "Try again");
+          }
+        },
+        (err: any) => console.log(err),
+        () => console.log('Update sent!'));
   }
 
-  works24hrs(pharmacy: Pharmacy) {
-    console.log(pharmacy);
-    // post request vo prodolzenie
-
-    this.status="Status bar works24hrs";
-  }
-
-  doesntWork24hrs(pharmacy: Pharmacy) {
-    console.log(pharmacy);
-    // post request vo prodolzenie
-
-    this.status="Status bar doesntWork24hrs";
-  }
-
-  claimPharmacy(pharmacy: Pharmacy) {
-    console.log(pharmacy);
-    // post request vo prodolzenie
-
-    this.status="Status bar claimPharmacy";
-  }
-
-  medicineExists(mymedicine: Medicine) {
-    console.log(mymedicine);
-    // post request vo prodolzenie
-
-    this.status="Status bar medicineexists";
-  }
-
-  medicineDoesntSell(mymedicine: Medicine) {
-    console.log(mymedicine);
-    // post request vo prodolzenie
-
-    this.status="Status bar medicineDoesntSell";
-  }
-
-  applyFilter(filterValue: string) {
-    filterValue = filterValue.trim();
-    filterValue = filterValue.toLowerCase();
-    this.dataSource.filter = filterValue;
+  applyFilterMedicines(filterValue: string) {
+    console.log("applyFilterMedicines works!")
+    if(filterValue) {
+      this.dataService.searchMedicines(filterValue)
+          .subscribe((medicine: IMedicine[]) => {
+            this.filteredMedicines = medicine;
+          },
+          (err: any) => console.log(err),
+          () => console.log('Medicine data retrieved')); 
+    }
+    else {
+      this.filteredMedicines = this.head.PharmacyMedicines;
+    }
   }
   
   applyFilterPharmacies(filterValue: string) {
-    filterValue = filterValue.trim();
-    filterValue = filterValue.toLowerCase();
-    this.dataSourcePharmacies.filter = filterValue;
+    console.log("applyFilterPharmacies works!")
+    if(filterValue) {
+      this.dataService.searchPharmacies(filterValue)
+          .subscribe((pharmacy: IPharmacy[]) => {
+            this.filteredPharmacies = pharmacy;
+          },
+          (err: any) => console.log(err),
+          () => console.log('Pharmacy data retrieved')); 
+    }
+    else {
+      this.filteredPharmacies = this.pharmacies;
+    }    
   }
 
-  test(): void {
-    console.log('Snackbar works!');
-    this.openSnackBar("Are you sure?", "Yes").onAction().subscribe(() => {
-      this.router.navigate(['/']);
+  openPharmacyDialog(pharmacy: IPharmacy): void {
+    this.dialog.open(PharmacyDialogComponent, {
+      width: '450px',
+      data: pharmacy
     });
   }
 
-  openDialog():void {
-    let dialogRef = this.dialog.open(HomeComponent, {
-      width: '70%'
+  openEditPharmacyDialog(pharmacy: IPharmacy): void {
+    let dialogRef = this.dialog.open(EditPharmacyDialogComponent, {
+      width: '450px',
+      data: pharmacy
     });
-    dialogRef.afterClosed().subscribe(result => {
-      if(result) {
-        this.openSnackBar("Success", "OK");
-      }
+    dialogRef.afterClosed().subscribe((editedPharmacy: IPharmacy) => {
+      if(editedPharmacy) {
+        this.head.Pharmacy = this.head.Pharmacy.filter(x => x !== pharmacy);
+        this.head.Pharmacy.push(editedPharmacy);
+        this.dataService.updatePharmacyHead(this.head)
+            .subscribe((hd: IPharmacyHead) => {
+              if(hd) {
+                this.openSnackBar("Success! Pharmacy edited", "OK").onAction().subscribe(() => {
+                  window.location.reload();
+                });
+              }
+              else {
+                this.openSnackBar("Pharmacy edit failed", "Try again");
+              }
+            },
+            (err: any) => console.log(err),
+            () => console.log('PharmacyHead data updated'));
+      };
+    });
+  }
+
+  openMedicineDialog(medicine: IMedicine): void {
+    this.dialog.open(MedicineDialogComponent, {
+      width: '450px',
+      data: medicine
     });
   }
 
   openSnackBar(message: string, action: string) : MatSnackBarRef<SimpleSnackBar> {
-    return this._snackBar.open(message, action, {
-      duration: 10000,
+    return this.snackBar.open(message, action, {
+      duration: 5000,
     });
   }
Index: Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-dialog/edit-pharmacy-dialog.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-dialog/edit-pharmacy-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-dialog/edit-pharmacy-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,39 @@
+
+  <form (ngSubmit)="save()" #pharmacyForm="ngForm" class="editForm" novalidate>
+    <div class="form-group">
+      <label>Name</label>
+      <input type="text" class="form-control" name="name" [(ngModel)]="pharmacy.name" #name="ngModel" required>
+      <div class="alert alert-danger" [hidden]="pharmacy.name">Name is required</div>
+    </div>
+    <div class="form-group">
+      <label>Address</label>
+      <input type="text" class="form-control" name="address" [(ngModel)]="pharmacy.address" #address="ngModel" required>
+      <div class="alert alert-danger" [hidden]="pharmacy.address">Address is required</div>
+    </div>
+    <div class="form-group">
+      <label>Location</label>
+      <input type="text" class="form-control" [(ngModel)]="pharmacy.location" #email="ngModel" required />
+      <div class="alert alert-danger" [hidden]="pharmacy.location">Location is required</div>
+    </div>
+    <div class="form-group">
+        <label>Work 24/7</label>
+        <br />
+        <div class="radio">
+          <label>
+            <input type="radio" name="workAllTime" [(ngModel)]="pharmacy.workAllTime" #workAllTime="ngModel" value="true" required />
+            Да
+          </label>
+        </div>
+        <div class="radio">
+          <label>
+            <input type="radio" name="workAllTime" [(ngModel)]="pharmacy.workAllTime" #workAlltime="ngModel" value="false" required /> 
+            Не
+          </label>
+        </div>
+      </div>
+    <br />
+    <div class="pull-right">
+        <button class="btn btn-default" (click)="close()">Cancel</button>&nbsp;&nbsp;
+        <button type="submit" class="btn btn-success" [disabled]="!pharmacyForm.valid">Save</button>
+      </div>
+  </form>
Index: Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-dialog/edit-pharmacy-dialog.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-dialog/edit-pharmacy-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-dialog/edit-pharmacy-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,28 @@
+import { Component, OnInit, Inject } from '@angular/core';
+import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
+import { IPharmacy } from '../../shared/interfaces';
+
+@Component({
+  selector: 'app-edit-pharmacy-dialog',
+  templateUrl: './edit-pharmacy-dialog.component.html',
+  styleUrls: ['./edit-pharmacy-dialog.component.css']
+})
+export class EditPharmacyDialogComponent implements OnInit {
+  pharmacy: IPharmacy;
+
+  constructor(private dialogRef: MatDialogRef<EditPharmacyDialogComponent>, @Inject(MAT_DIALOG_DATA) data) {
+    this.pharmacy = data;
+  }
+
+  ngOnInit(): void {
+  }
+
+  save() {
+    this.dialogRef.close(this.pharmacy);
+  }
+
+  close() {
+    this.dialogRef.close();
+  }
+
+}
Index: Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-head-dialog/edit-pharmacy-head-dialog.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-head-dialog/edit-pharmacy-head-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-head-dialog/edit-pharmacy-head-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,28 @@
+
+  <form (ngSubmit)="save()" #headForm="ngForm" class="editForm" novalidate>
+    <div class="form-group">
+      <label>ИД</label>
+      <input type="text" class="form-control" name="id" [(ngModel)]="head.id" #id="ngModel" required>
+      <div class="alert alert-danger">ID is required</div>
+    </div>
+    <div class="form-group">
+      <label>Име</label>
+      <input type="text" class="form-control" name="name" [(ngModel)]="head.Name" #name="ngModel" required>
+      <div class="alert alert-danger">Name is required</div>
+    </div>
+    <div class="form-group">
+      <label>Е-пошта</label>
+      <input type="text" class="form-control" name="email" [(ngModel)]="head.Email" #email="ngModel" required />
+      <div class="alert alert-danger" [hidden]="head.Email">Email is required</div>
+    </div>
+    <div class="form-group">
+      <label>Лозинка</label>
+      <input type="text" class="form-control" name="passwd" [(ngModel)]="head.Passwd" #passwd="ngModel" required />
+      <div class="alert alert-danger" [hidden]="head.Passwd">Password is required</div>
+    </div>
+    <br />
+    <div class="pull-right">
+        <button class="btn btn-default" (click)="close()">Cancel</button>&nbsp;&nbsp;
+        <button type="submit" class="btn btn-success" [disabled]="!headForm.valid">Save</button>
+      </div>
+  </form>
Index: Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-head-dialog/edit-pharmacy-head-dialog.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-head-dialog/edit-pharmacy-head-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-head-dialog/edit-pharmacy-head-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,28 @@
+import { Component, OnInit, Inject } from '@angular/core';
+import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
+import { IPharmacyHead } from '../../shared/interfaces';
+
+@Component({
+  selector: 'app-edit-pharmacy-head-dialog',
+  templateUrl: './edit-pharmacy-head-dialog.component.html',
+  styleUrls: ['./edit-pharmacy-head-dialog.component.css']
+})
+export class EditPharmacyHeadDialogComponent implements OnInit {
+  head: IPharmacyHead;
+
+  constructor(private dialogRef: MatDialogRef<EditPharmacyHeadDialogComponent>, @Inject(MAT_DIALOG_DATA) data) {
+    this.head = data;
+  }
+
+  ngOnInit(): void {
+  }
+
+  save() {
+    this.dialogRef.close(this.head);
+  }
+
+  close() {
+    this.dialogRef.close();
+  }
+
+}
Index: Farmatiko/ClientApp/src/app/dialogs/facility-dialog/facility-dialog.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/facility-dialog/facility-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/facility-dialog/facility-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,11 @@
+<h3>Повеќе инфо</h3>
+<br>
+<p>ИД: {{facility.id}}</p>
+<p>Име: {{facility.name}}</p>
+<p>Општина: {{facility.municipality}}</p>
+<p>Тип на установа: {{facility.type}}</p>
+<p>Адреса: {{facility.address}}</p>
+<p>Адреса: {{facility.email}}</p>
+<p>Адреса: {{facility.phone}}</p>
+<br>
+<p><a (click)="close()">Затвори</a></p>
Index: Farmatiko/ClientApp/src/app/dialogs/facility-dialog/facility-dialog.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/facility-dialog/facility-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/facility-dialog/facility-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,24 @@
+import { Component, OnInit, Inject } from '@angular/core';
+import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
+import { IHealthFacilities } from '../../shared/interfaces';
+
+@Component({
+  selector: 'app-facility-dialog',
+  templateUrl: './facility-dialog.component.html',
+  styleUrls: ['./facility-dialog.component.css']
+})
+export class FacilityDialogComponent implements OnInit {
+  facility: IHealthFacilities;
+
+  constructor(private dialogRef: MatDialogRef<FacilityDialogComponent>, @Inject(MAT_DIALOG_DATA) data) {
+    this.facility = data;
+  }
+
+  ngOnInit(): void {
+  }
+
+  close() {
+    this.dialogRef.close();
+  }
+
+}
Index: Farmatiko/ClientApp/src/app/dialogs/medicine-dialog/medicine-dialog.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/medicine-dialog/medicine-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/medicine-dialog/medicine-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,12 @@
+<h3>Повеќе инфо</h3>
+<br>
+<p>ИД: {{medicine.id}}</p>
+<p>Име: {{medicine.name}}</p>
+<p>Форма: {{medicine.form}}</p>
+<p>Пакување: {{medicine.packaging}}</p>
+<p>Цена: {{medicine.price}}</p>
+<p>Јачина: {{medicine.strength}}</p>
+<p>Начин на издавање: {{medicine.wayOfIssuing}}</p>
+<p>Производител: {{medicine.manufacturer}}</p>
+<br>
+<p><a (click)="close()">Затвори</a></p>
Index: Farmatiko/ClientApp/src/app/dialogs/medicine-dialog/medicine-dialog.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/medicine-dialog/medicine-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/medicine-dialog/medicine-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,24 @@
+import { Component, OnInit, Inject } from '@angular/core';
+import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
+import { IMedicine } from '../../shared/interfaces';
+
+@Component({
+  selector: 'app-medicine-dialog',
+  templateUrl: './medicine-dialog.component.html',
+  styleUrls: ['./medicine-dialog.component.css']
+})
+export class MedicineDialogComponent implements OnInit {
+  medicine: IMedicine;
+
+  constructor(private dialogRef: MatDialogRef<MedicineDialogComponent>, @Inject(MAT_DIALOG_DATA) data) {
+    this.medicine = data;
+  }
+
+  ngOnInit(): void {
+  }
+
+  close() {
+    this.dialogRef.close();
+  }
+
+}
Index: Farmatiko/ClientApp/src/app/dialogs/pharmacy-dialog/pharmacy-dialog.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/pharmacy-dialog/pharmacy-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/pharmacy-dialog/pharmacy-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,9 @@
+<h3>Повеќе инфо</h3>
+<br>
+<p>ИД: {{pharmacy.id}}</p>
+<p>Име: {{pharmacy.name}}</p>
+<p>Општина: {{pharmacy.location}}</p>
+<p>Адреса: {{pharmacy.address}}</p>
+<p>Работи 24/7: {{pharmacy.workAllTime}}</p>
+<br>
+<p><a (click)="close()">Затвори</a></p>
Index: Farmatiko/ClientApp/src/app/dialogs/pharmacy-dialog/pharmacy-dialog.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/pharmacy-dialog/pharmacy-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/pharmacy-dialog/pharmacy-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,24 @@
+import { Component, OnInit, Inject } from '@angular/core';
+import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
+import { IPharmacy } from '../../shared/interfaces';
+
+@Component({
+  selector: 'app-pharmacy-dialog',
+  templateUrl: './pharmacy-dialog.component.html',
+  styleUrls: ['./pharmacy-dialog.component.css']
+})
+export class PharmacyDialogComponent implements OnInit {
+  pharmacy: IPharmacy;
+
+  constructor(private dialogRef: MatDialogRef<PharmacyDialogComponent>, @Inject(MAT_DIALOG_DATA) data) {
+    this.pharmacy = data;
+  }
+
+  ngOnInit(): void {
+  }
+
+  close() {
+    this.dialogRef.close();
+  }
+
+}
Index: Farmatiko/ClientApp/src/app/dialogs/worker-dialog/worker-dialog.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/worker-dialog/worker-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/worker-dialog/worker-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,12 @@
+<h3>Повеќе инфо</h3>
+<br>
+<p>ИД: {{worker.id}}</p>
+<p>Име: {{worker.name}}</p>
+<p>Гранка: {{worker.branch}}</p>
+<p>Титула: {{worker.title}}</p>
+<br>
+<p>Институција: {{worker.facility.name}}</p>
+<p>{{worker.facility.municipality}}</p>
+<p>{{worker.facility.type}}</p>
+<br>
+<p><a (click)="close()">Затвори</a></p>
Index: Farmatiko/ClientApp/src/app/dialogs/worker-dialog/worker-dialog.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/dialogs/worker-dialog/worker-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/dialogs/worker-dialog/worker-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,24 @@
+import { Component, OnInit, Inject } from '@angular/core';
+import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
+import { IHealthcareWorkers } from '../../shared/interfaces';
+
+@Component({
+  selector: 'app-worker-dialog',
+  templateUrl: './worker-dialog.component.html',
+  styleUrls: ['./worker-dialog.component.css']
+})
+export class WorkerDialogComponent implements OnInit {
+  worker: IHealthcareWorkers;
+
+  constructor(private dialogRef: MatDialogRef<WorkerDialogComponent>, @Inject(MAT_DIALOG_DATA) data) {
+    this.worker = data;
+  }
+
+  ngOnInit(): void {
+  }
+
+  close() {
+    this.dialogRef.close();
+  }
+
+}
Index: Farmatiko/ClientApp/src/app/home/home.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/home/home.component.html	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/home/home.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -7,47 +7,31 @@
     <h2>Лекови</h2>
   <mat-form-field>
-    <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Пронајди лек">
+    <input matInput (keyup)="applyFilterMedicines($event.target.value)" placeholder="Пронајди лек">
   </mat-form-field>
     </div>
-    <table [dataSource]="dataSource" mat-table matSort class="mat-elevation-z8">
-      <ng-container matColumnDef="Име">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Име </th>
-        <td mat-cell *matCellDef="let medicines"> {{medicines.name}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Јачина">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Јачина </th>
-        <td mat-cell *matCellDef="let medicines"> {{medicines.strength}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Форма">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Форма </th>
-        <td mat-cell *matCellDef="let medicines"> {{medicines.form}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Начин на издавање">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Начин на издавање </th>
-        <td mat-cell *matCellDef="let medicines"> {{medicines.wayOfIssuing}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Производител">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Производител </th>
-        <td mat-cell *matCellDef="let medicines"> {{medicines.manufacturer}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Цена">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Цена </th>
-        <td mat-cell *matCellDef="let medicines"> {{medicines.price}} </td>
-      </ng-container>
-
-      <ng-container matColumnDef="Пакување">
-        <th mat-header-cell *matHeaderCellDef mat-sort-header> Пакување </th>
-        <td mat-cell *matCellDef="let medicines"> {{medicines.packaging}} </td>
-      </ng-container>
-
-        <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
-        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
-    </table>
-    <mat-paginator #paginator [pageSize]="5" [pageSizeOptions]="[5, 10, 20, 100]"></mat-paginator>
+  <table class='table table-striped' aria-labelledby="tableLabel" *ngIf="true">
+      <thead>
+        <tr>
+      	  <th>Име</th>
+      	  <th>Јачина</th>
+      	  <th>Форма</th>
+      	  <th>Начин на издавање</th>
+      	  <th>Производител</th>
+      	  <th>Цена</th>
+      	  <th>Пакување</th>
+      	</tr>
+      </thead>
+      <tbody>
+      	<tr *ngFor="let medicine of filteredMedicines">
+      	  <td><a (click)="openMedicineDialog(medicine)">{{ medicine.name }}</a></td>
+      	  <td>{{ medicine.strength }}</td>
+      	  <td>{{ medicine.form }}</td>
+      	  <td>{{ medicine.wayOfIssuing }}</td>
+      	  <td>{{ medicine.manufacturer }}</td>
+      	  <td>{{ medicine.price }}</td>
+      	  <td>{{ medicine.packaging }}</td>
+      	</tr>
+    </tbody>
+  </table>
   </div>
   </mat-tab>
@@ -60,29 +44,22 @@
     </mat-form-field>
     </div>
-      <table [dataSource]="dataSourcePharmacies" mat-table matSort class="mat-elevation-z8">
-        <ng-container matColumnDef="Име">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Име </th>
-          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.name}} </td>
-        </ng-container>
-
-        <ng-container matColumnDef="Локација">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Локација </th>
-          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.location}} </td>
-        </ng-container>
-
-        <ng-container matColumnDef="Адреса">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Адреса </th>
-          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.address}} </td>
-        </ng-container>
-
-        <ng-container matColumnDef="Работи 27/7?">
-          <th mat-header-cell *matHeaderCellDef mat-sort-header> Работи 27/7? </th>
-          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.workAllTime}} </td>
-        </ng-container>
-
-          <tr mat-header-row *matHeaderRowDef="displayedColumnsPharmacies"></tr>
-          <tr mat-row *matRowDef="let row; columns: displayedColumnsPharmacies;"></tr>
-      </table>
-      <mat-paginator #paginator [pageSize]="5" [pageSizeOptions]="[5, 10, 20, 100]"></mat-paginator>
+    <table class='table table-striped' aria-labelledby="tableLabel" *ngIf="true">
+      <thead>
+        <tr>
+      	  <th>Име</th>
+      	  <th>Локација</th>
+      	  <th>Адреса</th>
+      	  <th>Работи 27/7?</th>
+      	</tr>
+      </thead>
+      <tbody>
+      	<tr *ngFor="let pharmacy of filteredPharmacies">
+      	  <td><a (click)="openPharmacyDialog(pharmacy)">{{ pharmacy.name }}</a></td>
+      	  <td>{{ pharmacy.location }}</td>
+      	  <td>{{ pharmacy.address }}</td>
+      	  <td>{{ pharmacy.workAllTime }}</td>
+      	</tr>
+    </tbody>
+  </table>
     </div>
     </mat-tab>
Index: Farmatiko/ClientApp/src/app/home/home.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/home/home.component.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/home/home.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -1,9 +1,8 @@
-import { Component, OnInit, ViewChild, Inject } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-import { Medicine } from '../models/Medicine';
-import { Pharmacy } from '../models/Pharmacy';
-import { MatTableDataSource } from '@angular/material/table';
-import { MatPaginator } from '@angular/material/paginator';
-import { MatSort } from '@angular/material/sort';
+import { Component, OnInit } from '@angular/core';
+import { IMedicine, IPharmacy } from '../shared/interfaces';
+import { DataService } from '../shared/data.service';
+import { MatDialog } from '@angular/material/dialog';
+import { MedicineDialogComponent } from '../dialogs/medicine-dialog/medicine-dialog.component';
+import { PharmacyDialogComponent } from '../dialogs/pharmacy-dialog/pharmacy-dialog.component';
 
 @Component({
@@ -13,46 +12,71 @@
 })
 export class HomeComponent implements OnInit {
-  public medicines: Medicine[];
-  public pharmacies: Pharmacy[];
-  displayedColumns = ['Име','Јачина','Форма', 'Начин на издавање', 'Производител', 'Цена', 'Пакување'];
-  displayedColumnsPharmacies = ['Име','Локација','Адреса', 'Работи 27/7?'];
-  dataSource = new MatTableDataSource<Medicine>();
-  dataSourcePharmacies = new MatTableDataSource<Pharmacy>();
+  public medicines: IMedicine[] = [];
+  public pharmacies: IPharmacy[] = [];
+  public filteredMedicines: IMedicine[] = [];
+  public filteredPharmacies: IPharmacy[] = [];
 
-  @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
-  @ViewChild(MatSort) sort: MatSort;
+  constructor(private dataService: DataService, private dialog: MatDialog) {
 
-  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
-    http.get<Medicine[]>(baseUrl + 'Medicine/Get?').subscribe(result => {
-      this.medicines = result;
-      console.log(this.medicines);
-      this.dataSource = new MatTableDataSource<Medicine>(this.medicines);
-    }, error => console.error(error));
-    http.get<Pharmacy[]>(baseUrl + 'Pharmacy/Get?').subscribe(result => {
-      this.pharmacies = result;
-      console.log(this.pharmacies);
-      this.dataSourcePharmacies = new MatTableDataSource<Pharmacy>(this.pharmacies);
-    }, error => console.error(error));
-  }
-  ngOnInit(): void {
   }
 
-  ngAfterViewInit(): void {
-    this.dataSource.paginator = this.paginator;
-    this.dataSource.sort = this.sort;
-    this.dataSourcePharmacies.paginator = this.paginator;
-    this.dataSourcePharmacies.sort = this.sort;
+  ngOnInit(): void {
+    this.dataService.getMedicines()
+        .subscribe((medicine: IMedicine[]) => {
+          this.medicines = this.filteredMedicines = medicine;
+        },
+        (err: any) => console.log(err),
+        () => console.log('Medicine data retrieved'));
+
+    this.dataService.getPharmacies()
+        .subscribe((pharmacy: IPharmacy[]) => {
+          this.pharmacies = this.filteredPharmacies = pharmacy;
+        },
+        (err: any) => console.log(err),
+        () => console.log('Pharmacy data retrieved'));
   }
 
-  applyFilter(filterValue: string) {
-    filterValue = filterValue.trim();
-    filterValue = filterValue.toLowerCase();
-    this.dataSource.filter = filterValue;
+  applyFilterMedicines(filterValue: string) {
+    console.log("applyFilterMedicines works!")
+    if(filterValue) {
+      this.dataService.searchMedicines(filterValue)
+          .subscribe((medicine: IMedicine[]) => {
+            this.filteredMedicines = medicine;
+          },
+          (err: any) => console.log(err),
+          () => console.log('Medicine data retrieved')); 
+    }
+    else {
+      this.filteredMedicines = this.medicines;
+    }
   }
   
   applyFilterPharmacies(filterValue: string) {
-    filterValue = filterValue.trim();
-    filterValue = filterValue.toLowerCase();
-    this.dataSourcePharmacies.filter = filterValue;
+    console.log("applyFilterPharmacies works!")
+    if(filterValue) {
+      this.dataService.searchPharmacies(filterValue)
+          .subscribe((pharmacy: IPharmacy[]) => {
+            this.filteredPharmacies = pharmacy;
+          },
+          (err: any) => console.log(err),
+          () => console.log('Pharmacy data retrieved')); 
+    }
+    else {
+      this.filteredPharmacies = this.pharmacies;
+    }
+  }
+
+  openMedicineDialog(medicine: IMedicine): void {
+    this.dialog.open(MedicineDialogComponent, {
+      width: '450px',
+      data: medicine
+    });
+  }
+
+  openPharmacyDialog(pharmacy: IPharmacy): void {
+    this.dialog.open(PharmacyDialogComponent, {
+      width: '450px',
+      data: pharmacy
+    });
   }
 }
Index: Farmatiko/ClientApp/src/app/korona/korona.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/korona/korona.component.html	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/korona/korona.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -12,5 +12,5 @@
     <div class="col">
       <div class="counter">
-        <i class="fa fa-code fa-2x" *ngIf="korona">{{korona[0].totalMK}}</i>
+        <i class="fa fa-code fa-2x" *ngIf="korona">{{korona.totalMK}}</i>
         <h2 class="timer count-title count-number"></h2>
         <p class="count-text ">Вкупно случаи во земјата</p>
@@ -19,5 +19,5 @@
     <div class="col">
       <div class="counter">
-        <i class="fa fa-coffee fa-2x" *ngIf="korona">{{korona[0].activeMK}}</i>
+        <i class="fa fa-coffee fa-2x" *ngIf="korona">{{korona.activeMK}}</i>
         <h2 class="timer count-title count-number"></h2>
         <p class="count-text ">Активни случаи во земјата</p>
@@ -26,5 +26,5 @@
     <div class="col">
       <div class="counter">
-        <i class="fa fa-lightbulb-o fa-2x" *ngIf="korona">{{korona[0].deathsMK}}</i>
+        <i class="fa fa-lightbulb-o fa-2x" *ngIf="korona">{{korona.deathsMK}}</i>
         <h2 class="timer count-title count-number"></h2>
         <p class="count-text ">Смртни случаи во земјата</p>
@@ -33,5 +33,5 @@
     <div class="col">
       <div class="counter">
-        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona[0].newMK}}</i>
+        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.newMK}}</i>
         <h2 class="timer count-title count-number"></h2>
         <p class="count-text ">Нови случаи во земјата</p>
@@ -42,5 +42,5 @@
     <div class="col">
       <div class="counter">
-        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona[0].totalGlobal}}</i>
+        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.totalGlobal}}</i>
         <h2 class="timer count-title count-number"></h2>
         <p class="count-text ">Вкупно случаи глобално</p>
@@ -49,5 +49,5 @@
     <div class="col">
       <div class="counter">
-        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona[0].activeGlobal}}</i>
+        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.activeGlobal}}</i>
         <h2 class="timer count-title count-number"></h2>
         <p class="count-text ">Активни случаи глобално</p>
@@ -56,5 +56,5 @@
     <div class="col">
       <div class="counter">
-        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona[0].deathsGlobal}}</i>
+        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.deathsGlobal}}</i>
         <h2 class="timer count-title count-number"></h2>
         <p class="count-text ">Смртни случаи глобално</p>
Index: Farmatiko/ClientApp/src/app/korona/korona.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/korona/korona.component.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/korona/korona.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -1,6 +1,5 @@
-import { Component, OnInit, Inject } from '@angular/core';
-import { Pandemic } from '../models/Pandemic';
-import { MatTableDataSource } from '@angular/material/table';
-import { HttpClient } from '@angular/common/http';
+import { Component, OnInit } from '@angular/core';
+import { DataService } from '../shared/data.service';
+import { IPandemic } from '../shared/interfaces';
 
 @Component({
@@ -10,14 +9,17 @@
 })
 export class KoronaComponent implements OnInit {
-  public korona: Pandemic[];
+  public korona: IPandemic;
 
-  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
-    http.get<Pandemic[]>(baseUrl + 'Pandemic/Get?').subscribe(result => {
-      this.korona = result;
-      console.log(this.korona);
-    }, error => console.error(error));
+  constructor(private dataService: DataService) {
+
   }
 
   ngOnInit(): void {
+    this.dataService.getPandemic()
+        .subscribe((res: IPandemic) => {
+          this.korona = res;
+        },
+        (err: any) => console.log(err),
+        () => console.log('Pandemic data retrieved'));
   }
 
Index: Farmatiko/ClientApp/src/app/login/login.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/login/login.component.html	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/login/login.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -6,12 +6,12 @@
   <div class="example-container">
     <mat-form-field>
-      <input matInput placeholder="Email" formControlName="email">
+      <input matInput placeholder="Email" [(ngModel)]="this.email" formControlName="email">
     </mat-form-field>
 
     <mat-form-field>
-      <input matInput type="password" placeholder="Password" formControlName="password">    
+      <input matInput type="password" placeholder="Password" [(ngModel)]="this.passwd" formControlName="password">    
     </mat-form-field>
 
-    <button [disabled]="!loginForm.valid" mat-raised-button color="primary" [routerLink]="['/dashboard']" mat-button>Најави се</button>
+    <button [disabled]="!loginForm.valid" mat-raised-button color="primary" (click)="loginPharmacyHead()" mat-button>Најави се</button>
   </div>
 </form>
Index: Farmatiko/ClientApp/src/app/login/login.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/login/login.component.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ Farmatiko/ClientApp/src/app/login/login.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -1,4 +1,6 @@
 import { Component, OnInit } from '@angular/core';
-import { FormBuilder, FormGroup, FormControl, Validators, FormArray } from '@angular/forms';
+import { FormGroup, FormControl, Validators } from '@angular/forms';
+import { Router, ActivatedRoute } from '@angular/router';
+import { DataService } from '../shared/data.service';
 
 @Component({
@@ -9,6 +11,9 @@
 export class LoginComponent implements OnInit {
   loginForm: FormGroup;
+  email: string;
+  passwd: string;
+  errorMessage: string;
 
-  constructor() {
+  constructor(private dataService: DataService,private router: Router, private route: ActivatedRoute) {
     this.loginForm = new FormGroup({
       email: new FormControl('', [Validators.required, Validators.email]),
@@ -20,3 +25,16 @@
   }
 
+  loginPharmacyHead() {
+    this.dataService.loginPharmacyHead(this.email, this.passwd)
+                .subscribe((id: Number) => {
+                  if(id) {
+                    this.router.navigate(['/dashboard/' + id]);
+                  }
+                  else {
+                    this.errorMessage = 'There was a problem signing in!';
+                    console.log(this.errorMessage);
+                  }
+                },
+                (err: any) => console.log(err));
+  }
 }
Index: rmatiko/ClientApp/src/app/models/HealthFacilities.ts
===================================================================
--- Farmatiko/ClientApp/src/app/models/HealthFacilities.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ 	(revision )
@@ -1,11 +1,0 @@
-export class HealthFacilities {
-  address: string;
-  createdOn: string;
-  deletedOn: string;
-  email: string;
-  id: number;
-  municipality: string;
-  name: string;
-  phone: string;
-  type: string;
-}
Index: rmatiko/ClientApp/src/app/models/HealthcareWorkers.ts
===================================================================
--- Farmatiko/ClientApp/src/app/models/HealthcareWorkers.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ 	(revision )
@@ -1,8 +1,0 @@
-import { HealthFacilities } from "./HealthFacilities";
-
-export class HealthcareWorkers {
-  name: string;
-  branch: Date;
-  facility: HealthFacilities;
-  title: string;
-}
Index: rmatiko/ClientApp/src/app/models/Medicine.ts
===================================================================
--- Farmatiko/ClientApp/src/app/models/Medicine.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ 	(revision )
@@ -1,9 +1,0 @@
-export class Medicine {
-  name: string;
-  strength: string;
-  form: string;
-  wayOfIssuing: string;
-  manufacturer: string;
-  price: number;
-  packaging: string;
-}
Index: rmatiko/ClientApp/src/app/models/MedicineList.ts
===================================================================
--- Farmatiko/ClientApp/src/app/models/MedicineList.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ 	(revision )
@@ -1,6 +1,0 @@
-import { Medicine } from "./Medicine";
-
-export class MedicineList {
-  Medicines: Medicine[];
-  HasMedicine: boolean[];
-}
Index: rmatiko/ClientApp/src/app/models/Pandemic.ts
===================================================================
--- Farmatiko/ClientApp/src/app/models/Pandemic.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ 	(revision )
@@ -1,13 +1,0 @@
-export class Pandemic {
-  id: number;
-  createdOn: string;
-  deletedOn: string;
-  name: string;
-  totalMK: number;
-  activeMK: number;
-  deathsMK: number;
-  newMK: number;
-  totalGlobal: number;
-  deathsGlobal: number;
-  activeGlobal: number;
-}
Index: rmatiko/ClientApp/src/app/models/Pharmacy.ts
===================================================================
--- Farmatiko/ClientApp/src/app/models/Pharmacy.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ 	(revision )
@@ -1,6 +1,0 @@
-export class Pharmacy {
-  name: string;
-  location: string;
-  address: string;
-  workAllTime: boolean;
-}
Index: rmatiko/ClientApp/src/app/models/PharmacyHead.ts
===================================================================
--- Farmatiko/ClientApp/src/app/models/PharmacyHead.ts	(revision c73269da31e030fe9495c2027a505e09c4d5a292)
+++ 	(revision )
@@ -1,10 +1,0 @@
-import { MedicineList } from "./MedicineList";
-import { Pharmacy } from "./Pharmacy";
-
-export class PharmacyHead {
-  PharmacyMedicines: MedicineList;
-  Pharmacy: Pharmacy[];
-  Email: string;
-  Passwd: string;
-  Name: string;
-}
Index: Farmatiko/ClientApp/src/app/nav-menu/dialogs/pharmacy-head-dialog/pharmacy-head-dialog.component.html
===================================================================
--- Farmatiko/ClientApp/src/app/nav-menu/dialogs/pharmacy-head-dialog/pharmacy-head-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/nav-menu/dialogs/pharmacy-head-dialog/pharmacy-head-dialog.component.html	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,1 @@
+<p>pharmacy-head-dialog works!</p>
Index: Farmatiko/ClientApp/src/app/nav-menu/dialogs/pharmacy-head-dialog/pharmacy-head-dialog.component.ts
===================================================================
--- Farmatiko/ClientApp/src/app/nav-menu/dialogs/pharmacy-head-dialog/pharmacy-head-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/nav-menu/dialogs/pharmacy-head-dialog/pharmacy-head-dialog.component.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,15 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+  selector: 'app-pharmacy-head-dialog',
+  templateUrl: './pharmacy-head-dialog.component.html',
+  styleUrls: ['./pharmacy-head-dialog.component.css']
+})
+export class PharmacyHeadDialogComponent implements OnInit {
+
+  constructor() { }
+
+  ngOnInit(): void {
+  }
+
+}
Index: Farmatiko/ClientApp/src/app/shared/data.service.ts
===================================================================
--- Farmatiko/ClientApp/src/app/shared/data.service.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/shared/data.service.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,208 @@
+import { Injectable,  } from '@angular/core';
+import { HttpClient, HttpErrorResponse } from '@angular/common/http';
+
+import { Observable } from 'rxjs';
+import { map, catchError } from 'rxjs/operators';
+
+import { IHealthFacilities, IHealthcareWorkers, IMedicine, IPandemic, IPharmacy, IPharmacyHead, IPharmacyHeadRequest } from './interfaces';
+
+@Injectable()
+export class DataService {
+    baseFacilitiesUrl: string = '/api/facilities';
+    baseWorkersUrl: string = '/api/workers';
+    baseMedicineUrl: string = '/api/medicine';
+    basePandemicUrl: string = '/api/pandemic';
+    basePharmacyUrl: string = '/api/pharmacy';
+    basePharmacyHead: string = '/api/pharmacyhead';
+
+    constructor(private http: HttpClient) { 
+
+    }
+
+    //Facility GET
+    getFacilities() : Observable<IHealthFacilities[]> {
+        return this.http.get<IHealthFacilities[]>(this.baseFacilitiesUrl)
+                   .pipe(
+                        map((facilities: IHealthFacilities[]) => {
+                            return facilities;
+                        }),
+                        catchError(this.handleError)
+                   );
+    }
+    searchFacilities(searchquery: string) : Observable<IHealthFacilities[]> {
+        return this.http.get<IHealthFacilities[]>(this.baseFacilitiesUrl + '/search/' + searchquery)
+                   .pipe(
+                        map((facilities: IHealthFacilities[]) => {
+                            return facilities;
+                        }),
+                        catchError(this.handleError)
+                   );
+    }
+    getFacility(id: string) : Observable<IHealthFacilities> {
+        return this.http.get<IHealthFacilities>(this.baseFacilitiesUrl + '/' + id)
+                   .pipe(catchError(this.handleError));
+    }
+
+    
+    //Worker GET
+    getWorkers() : Observable<IHealthcareWorkers[]> {
+        return this.http.get<IHealthcareWorkers[]>(this.baseWorkersUrl)
+                   .pipe(
+                        map((workers: IHealthcareWorkers[]) => {
+                            return workers;
+                        }),
+                        catchError(this.handleError)
+                   );
+    }
+    searchWorkers(searchquery: string) : Observable<IHealthcareWorkers[]> {
+        return this.http.get<IHealthcareWorkers[]>(this.baseWorkersUrl + '/search/' + searchquery)
+                   .pipe(
+                        map((workers: IHealthcareWorkers[]) => {
+                            return workers;
+                        }),
+                        catchError(this.handleError)
+                   );
+    }
+    getWorker(id: string) : Observable<IHealthcareWorkers> {
+        return this.http.get<IHealthcareWorkers>(this.baseWorkersUrl + '/' + id)
+                   .pipe(catchError(this.handleError));
+    }
+
+    
+    //Medicine GET
+    getMedicines() : Observable<IMedicine[]> {
+        return this.http.get<IMedicine[]>(this.baseMedicineUrl)
+                   .pipe(
+                        map((medicines: IMedicine[]) => {
+                            return medicines;
+                        }),
+                        catchError(this.handleError)
+                   );
+    }
+    searchMedicines(searchquery: string) : Observable<IMedicine[]> {
+        return this.http.get<IMedicine[]>(this.baseMedicineUrl + '/search/' + searchquery)
+                   .pipe(
+                        map((medicines: IMedicine[]) => {
+                            return medicines;
+                        }),
+                        catchError(this.handleError)
+                   );
+    }
+    getMedicine(id: string) : Observable<IMedicine> {
+        return this.http.get<IMedicine>(this.baseMedicineUrl + '/' + id)
+                   .pipe(catchError(this.handleError));
+    }
+
+
+    getPandemic() : Observable<IPandemic> {
+        return this.http.get<IPandemic>(this.basePandemicUrl)
+                   .pipe(catchError(this.handleError));
+    }
+
+
+    //Pharmacy GET
+    getPharmacies() : Observable<IPharmacy[]> {
+        return this.http.get<IPharmacy[]>(this.basePharmacyUrl)
+                   .pipe(
+                        map((pharmacies: IPharmacy[]) => {
+                            return pharmacies;
+                        }),
+                        catchError(this.handleError)
+                   );
+    }
+    searchPharmacies(searchquery: string) : Observable<IPharmacy[]> {
+        return this.http.get<IPharmacy[]>(this.basePharmacyUrl + '/search/' + searchquery)
+                   .pipe(
+                        map((pharmacies: IPharmacy[]) => {
+                            return pharmacies;
+                        }),
+                        catchError(this.handleError)
+                   );
+    }
+    getPharmacy(id: string) : Observable<IPharmacy> {
+        return this.http.get<IPharmacy>(this.basePharmacyUrl + '/' + id)
+                   .pipe(catchError(this.handleError));
+    }
+
+    //PharmacyHead GET
+    getPharmacyHeads() : Observable<IPharmacyHead[]> {
+        return this.http.get<IPharmacyHead[]>(this.basePharmacyHead)
+                   .pipe(
+                        map((pharmacyheads: IPharmacyHead[]) => {
+                            return pharmacyheads;
+                        }),
+                        catchError(this.handleError)
+                   );
+    }
+    getClaimingRequests() : Observable<IPharmacyHeadRequest[]> {
+        return this.http.get<IPharmacyHeadRequest[]>(this.basePharmacyHead + '/requests')
+                   .pipe(
+                        map((requests: IPharmacyHeadRequest[]) => {
+                            return requests;
+                        }),
+                        catchError(this.handleError)
+                   );
+    }
+    loginPharmacyHead(email: string, passwd: string) : Observable<any> {
+        let postData = {email : email ,password :passwd};
+        return this.http.post<any>(this.basePharmacyHead + '/login', postData)
+                   .pipe(
+                        map((data) => {
+                            return data;
+                        }),
+                        catchError(this.handleError)
+                    );
+    }
+    getPharmacyHead(id: string) : Observable<IPharmacyHead> {
+        return this.http.get<IPharmacyHead>(this.basePharmacyHead + '/' + id)
+                   .pipe(catchError(this.handleError));
+    }
+    //PharmacyHead POST
+    insertPharmacyHead(head: IPharmacyHead) : Observable<IPharmacyHead> {
+        return this.http.post<IPharmacyHead>(this.basePharmacyHead, head)
+                   .pipe(
+                        map((data) => {
+                            return data;
+                        }),
+                        catchError(this.handleError)
+                    );
+    }
+    claimPharmacy(req: IPharmacyHeadRequest) : Observable<IPharmacyHeadRequest> {
+        return this.http.post<IPharmacyHeadRequest>(this.basePharmacyHead + '/requests', req)
+                    .pipe(
+                        map((data) => {
+                            return data;
+                        }),
+                        catchError(this.handleError)
+                    );
+    }
+    //PharmacyHead PUT
+    updatePharmacyHead(head: IPharmacyHead) : Observable<IPharmacyHead> {
+        return this.http.put<IPharmacyHead>(this.basePharmacyHead + '/' + head.id, head) 
+                   .pipe(
+                        map((data) => {
+                            return data;
+                        }),
+                        catchError(this.handleError)
+                    );
+    }
+    //PharmacyHead DELETE
+    deletePharmacyHead(id: string) : Observable<boolean> {
+        return this.http.delete<boolean>(this.basePharmacyHead + '/' + id)
+                   .pipe(catchError(this.handleError));
+    }
+    deleteClaimingRequest(id: string) : Observable<boolean> {
+        return this.http.delete<boolean>(this.basePharmacyHead + '/requests/' + id)
+                   .pipe(catchError(this.handleError));
+    }
+
+    private handleError(error: HttpErrorResponse) {
+        console.error('server error:', error); 
+        if (error.error instanceof Error) {
+          let errMessage = error.error.message;
+          return Observable.throw(errMessage);
+        }
+        return Observable.throw(error || 'ASP.NET Core server error');
+    }
+
+}
Index: Farmatiko/ClientApp/src/app/shared/interfaces.ts
===================================================================
--- Farmatiko/ClientApp/src/app/shared/interfaces.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
+++ Farmatiko/ClientApp/src/app/shared/interfaces.ts	(revision ee137aa0f7283d2d56e78e6d02e354b59cbb6e44)
@@ -0,0 +1,62 @@
+export interface IHealthcareWorkers {
+    id?: string;
+    name: string;
+    branch: Date;
+    facility: IHealthFacilities;
+    title: string;
+}
+
+export interface IHealthFacilities {
+    id?: string;
+    address: string;
+    email?: string;
+    municipality: string;
+    name: string;
+    phone?: string;
+    type?: string;
+}
+
+export interface IMedicine {
+    id?: string;
+    name: string;
+    strength: string;
+    form: string;
+    wayOfIssuing: string;
+    manufacturer: string;
+    price: number;
+    packaging: string;
+}
+
+export interface IPandemic {
+    name?: string;
+    totalMK?: number;
+    activeMK?: number;
+    deathsMK?: number;
+    newMK?: number;
+    totalGlobal?: number;
+    deathsGlobal?: number;
+    activeGlobal?: number;
+}
+
+export interface IPharmacy {
+    id?: string;
+    name: string;
+    location: string;
+    address: string;
+    workAllTime?: boolean;
+}
+
+export interface IPharmacyHead {
+    id?: string;
+    PharmacyMedicines?: IMedicine[];
+    Pharmacy?: IPharmacy[];
+    Email: string;
+    Passwd: string;
+    Name: string;
+}  
+
+export interface IPharmacyHeadRequest {
+    id?: string;
+    PharmacyHead?: IPharmacyHead;
+    Pharmacy?: IPharmacy;
+}  
