Changeset de18858


Ignore:
Timestamp:
07/29/20 19:46:21 (4 years ago)
Author:
Mile Jankuloski <mile.jankuloski@…>
Branches:
master
Children:
4e72684
Parents:
e42f61a
Message:

Prepared and improved components for data flows

Location:
Farmatiko/ClientApp/src/app
Files:
2 deleted
15 edited

Legend:

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

    re42f61a rde18858  
    3131              </thead>
    3232              <tbody>
    33                 <tr *ngFor="">
    34                   <td>data1</td>
    35                   <td>data2</td>
    36                   <td>data3</td>
     33                <tr *ngFor="let head of heads">
     34                  <td>{{head.Name}} | {{head.Email}}</td>
     35                  <td>{{head.Pharmacy[0].name}}</td>
     36                  <td><a (click)="Approve()">Approve</a> | <a (click)="Reject()">Reject</a></td>
    3737                </tr>
    3838              </tbody>
    3939            </table>
    4040        </div>
     41        </div>
     42      </mat-tab>
    4143      <mat-tab label="Manage accounts">
    4244        <div class="wrapper">
     
    5052              </thead>
    5153              <tbody>
    52                 <tr *ngFor="">
    53                   <td>data1</td>
    54                   <td>data2</td>
     54                <tr *ngFor="let head of heads">
     55                  <td>{{head.Name}} | {{head.Email}}</td>
     56                  <td><a (click)="Del(head)">Delete</a> | <a (click)="ChangeDialog(head)">Change</a></td>
    5557                </tr>
    5658              </tbody>
    5759            </table>
     60          </div>
    5861        </div>
     62      </mat-tab>
    5963        <mat-tab label="Create new account">
    6064          <div class="createform">
    6165          <mat-form-field appearance="fill">
    6266            <mat-label>Name</mat-label>
    63             <input matInput>
     67            <input matInput [(ngModel)]="head.Name">
    6468          </mat-form-field><br>
    6569          <mat-form-field appearance="fill">
    6670            <mat-label>Email</mat-label>
    67             <input matInput>
     71            <input matInput [(ngModel)]="head.Email">
    6872          </mat-form-field><br>
    6973          <mat-form-field appearance="fill">
    7074            <mat-label>Password</mat-label>
    71             <input matInput>
     75            <input matInput [(ngModel)]="head.Passwd">
    7276          </mat-form-field><br>
    73             <button mat-raised-button color="primary">Create</button>
     77            <button onclick="createHead()" mat-raised-button color="primary">Create</button>
    7478          </div>
     79        </mat-tab>
     80</mat-tab-group>
     81
     82<div class="status">{{status}}</div>
  • Farmatiko/ClientApp/src/app/admin/admin.component.ts

    re42f61a rde18858  
    1 import { Component, OnInit } from '@angular/core';
     1import { Component, OnInit, Inject, Output, EventEmitter } from '@angular/core';
     2import { Pharmacy } from '../models/Pharmacy';
     3import { HttpClient } from '@angular/common/http';
     4import { MatDialog } from '@angular/material/dialog';
     5import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
     6import { Router, RouterModule } from '@angular/router';
     7import { PharmacyHead } from '../models/PharmacyHead';
    28import { FormControl } from '@angular/forms';
     9
    310
    411@Component({
     
    815})
    916export class AdminComponent implements OnInit {
     17  public heads: PharmacyHead[];
     18  public head: PharmacyHead;
     19  public status: string;
    1020
    11   constructor() { }
     21  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string, private dialog: MatDialog, private _snackBar: MatSnackBar, private router: Router) {
     22    http.get<PharmacyHead[]>(baseUrl + 'PharmacyHead/Get?').subscribe(result => {
     23      this.heads = result;
     24      console.log(this.heads);
     25    }, error => console.error(error));
     26  }
    1227
    1328  ngOnInit(): void {
     29    this.head = new PharmacyHead();
     30  }
     31
     32  createHead() {
     33    console.log(this.head);
     34    // post request vo prodolzenie
     35
     36    this.status="Status bar createHead";
     37    //window.location.reload();
     38  }
     39
     40  Del(head: PharmacyHead) {
     41    console.log(this.head);
     42    // post request vo prodolzenie
     43
     44    this.status="Status bar Del";
     45  }
     46
     47  ChangeDialog(head: PharmacyHead) {
     48    console.log(this.head);
     49
     50  }
     51
     52  Reject() {
     53    console.log('Rejected');
     54    // post request vo prodolzenie
     55
     56  }
     57
     58  Approve() {
     59    console.log('Approved');
     60    // post request vo prodolzenie
     61
    1462  }
    1563
  • Farmatiko/ClientApp/src/app/app.module.ts

    re42f61a rde18858  
    1111import { HomeComponent } from './home/home.component';
    1212import { CounterComponent } from './counter/counter.component';
    13 import { FetchDataComponent } from './fetch-data/fetch-data.component';
    1413import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
    1514import { KoronaComponent } from './korona/korona.component';
     
    2423    HomeComponent,
    2524    CounterComponent,
    26     FetchDataComponent,
    2725    KoronaComponent,
    2826    AdminComponent,
     
    3735      { path: '', component: HomeComponent, pathMatch: 'full' },
    3836      { path: 'mapa', component: CounterComponent },
    39       { path: 'fetch-data', component: FetchDataComponent },
    4037      { path: 'koronavirus', component: KoronaComponent },
    4138      { path: 'admin', component: AdminComponent },
  • Farmatiko/ClientApp/src/app/counter/counter.component.html

    re42f61a rde18858  
    5353    <h2>Здравствени работници</h2>
    5454    <mat-form-field>
    55       <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Пронајди работник">
     55      <input matInput (keyup)="applyFilterWorkers($event.target.value)" placeholder="Пронајди работник">
    5656    </mat-form-field>
    5757    </div>
     
    7777        </ng-container>
    7878
    79 
    80 
    8179          <tr mat-header-row *matHeaderRowDef="displayedColumnsWorkers"></tr>
    8280          <tr mat-row *matRowDef="let row; columns: displayedColumnsWorkers;"></tr>
  • Farmatiko/ClientApp/src/app/counter/counter.component.ts

    re42f61a rde18858  
    4949    filterValue = filterValue.toLowerCase();
    5050    this.dataSource.filter = filterValue;
     51  }
     52
     53  applyFilterWorkers(filterValue: string) {
     54    filterValue = filterValue.trim();
     55    filterValue = filterValue.toLowerCase();
    5156    this.dataSourceWorkers.filter = filterValue;
    5257  }
  • Farmatiko/ClientApp/src/app/dashboard/dashboard.component.html

    re42f61a rde18858  
    1212        <div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
    1313          <ul class="navbar-nav flex-grow">
    14             <li>Logged as ...</li>
     14            <li>Logged as  <!--{{head.Name}}--> </li>
    1515          </ul>
    1616        </div>
     
    1919        <mat-menu #menu="matMenu">
    2020          <button mat-menu-item (click)="openDialog()"><mat-icon>person_add</mat-icon>View homepage</button>
    21           <button mat-menu-item (click)="test()"><mat-icon> directions</mat-icon>Go to homepage</button>
     21          <button mat-menu-item (click)="test()"><mat-icon>directions</mat-icon>Go to homepage</button>
    2222        </mat-menu>
    2323      </div>
     
    3030    <div class="header">
    3131    <h2>Мои аптеки</h2>
     32    <p *ngIf="!mypharmacies"><em>Loading...</em></p>
    3233    </div>
    3334    <table class='table table-striped table-bordered table-sm' cellspacing="0" width="100%" aria-labelledby="tableLabel" *ngIf="true">
    3435      <thead>
    3536        <tr>
    36           <th>Placeholder1</th>
    37           <th>Placeholder2</th>
    38           <th>Placeholder3</th>
    39           <th>Placeholder4</th>
     37          <th>Име</th>
     38          <th>Локација</th>
     39          <th>Адреса</th>
     40          <th>Работи 24/7</th>
     41          <th>Actions</th>
    4042        </tr>
    4143      </thead>
    4244      <tbody>
    43         <tr *ngFor="let facility of facilities">
    44           <td>data1</td>
    45           <td>data2</td>
    46           <td>data3</td>
    47           <td>data4</td>
     45        <tr *ngFor="let pharmacies of mypharmacies">
     46          <td>{{pharmacies.name}}</td>
     47          <td>{{pharmacies.location}}</td>
     48          <td>{{pharmacies.address}}</td>
     49          <td>{{pharmacies.workAllTime}}</td>
     50          <td><a (click)="works24hrs(pharmacies)">Работи 24/7</a> | <a (click)="doesntWork24hrs(pharmacies)">Не работи 24/7</a></td>
    4851        </tr>
    4952      </tbody>
     
    5659    <h2>Сите аптеки</h2>
    5760    <mat-form-field>
    58       <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Пронајди аптека">
     61      <input matInput (keyup)="applyFilterPharmacies($event.target.value)" placeholder="Пронајди аптека">
    5962    </mat-form-field>
    6063    </div>
    6164      <table [dataSource]="dataSource" mat-table matSort class="mat-elevation-z8">
    62         <ng-container matColumnDef="Име">
     65        <ng-container matColumnDef="Име">a
    6366          <th mat-header-cell *matHeaderCellDef mat-sort-header> Име </th>
    64           <td mat-cell *matCellDef="let facilities"> {{facilities.name}} </td>
     67          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.name}} </td>
    6568        </ng-container>
    6669   
    67         <ng-container matColumnDef="Општина">
    68           <th mat-header-cell *matHeaderCellDef mat-sort-header> Општина </th>
    69           <td mat-cell *matCellDef="let facilities"> {{facilities.municipality}} </td>
     70        <ng-container matColumnDef="Локација">
     71          <th mat-header-cell *matHeaderCellDef mat-sort-header> Локација </th>
     72          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.location}} </td>
    7073        </ng-container>
    7174     
    7275        <ng-container matColumnDef="Адреса">
    7376          <th mat-header-cell *matHeaderCellDef mat-sort-header> Адреса </th>
    74           <td mat-cell *matCellDef="let facilities"> {{facilities.address}} </td>
     77          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.address}} </td>
    7578        </ng-container>
    76        
    77         <ng-container matColumnDef="Тип">
    78           <th mat-header-cell *matHeaderCellDef mat-sort-header> Тип </th>
    79           <td mat-cell *matCellDef="let facilities"> {{facilities.type}} </td>
    80         </ng-container>
    81    
    82         <ng-container matColumnDef="Е-пошта">
    83           <th mat-header-cell *matHeaderCellDef mat-sort-header> Е-пошта </th>
    84           <td mat-cell *matCellDef="let facilities"> {{facilities.email}} </td>
    85         </ng-container>
    86      
    87         <ng-container matColumnDef="Телефон">
    88           <th mat-header-cell *matHeaderCellDef mat-sort-header> Телефон </th>
    89           <td mat-cell *matCellDef="let facilities"> {{facilities.phone}} </td>
     79
     80        <ng-container matColumnDef="Actions">
     81          <th mat-header-cell *matHeaderCellDef mat-sort-header> Actions </th>
     82          <td mat-cell *matCellDef="let pharmacies"> <a (click)="claimPharmacy(pharmacies)">Claim Pharmacy</a> </td>
    9083        </ng-container>
    9184 
    92           <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
    93           <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
     85          <tr mat-header-row *matHeaderRowDef="displayedColumnsPharmacies"></tr>
     86          <tr mat-row *matRowDef="let row; columns: displayedColumnsPharmacies;"></tr>
    9487      </table>
    9588      <mat-paginator #paginator [pageSize]="5" [pageSizeOptions]="[5, 10, 20, 100]"></mat-paginator>
     
    9790    </mat-tab>
    9891  </mat-tab-group>
     92
     93  <div class="statusbar">{{status}}</div>
    9994
    10095<div class="wrapper">
     
    10499      <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Пронајди лек">
    105100    </mat-form-field>
    106     </div>
     101      </div>
    107102      <table [dataSource]="dataSource" mat-table matSort class="mat-elevation-z8">
    108103        <ng-container matColumnDef="Име">
    109104          <th mat-header-cell *matHeaderCellDef mat-sort-header> Име </th>
    110           <td mat-cell *matCellDef="let facilities"> {{facilities.name}} </td>
     105          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.name}} </td>
    111106        </ng-container>
    112107   
    113         <ng-container matColumnDef="Општина">
    114           <th mat-header-cell *matHeaderCellDef mat-sort-header> Општина </th>
    115           <td mat-cell *matCellDef="let facilities"> {{facilities.municipality}} </td>
     108        <ng-container matColumnDef="Јачина">
     109          <th mat-header-cell *matHeaderCellDef mat-sort-header> Јачина </th>
     110          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.strength}} </td>
    116111        </ng-container>
    117112     
    118         <ng-container matColumnDef="Адреса">
    119           <th mat-header-cell *matHeaderCellDef mat-sort-header> Адреса </th>
    120           <td mat-cell *matCellDef="let facilities"> {{facilities.address}} </td>
     113        <ng-container matColumnDef="Форма">
     114          <th mat-header-cell *matHeaderCellDef mat-sort-header> Форма </th>
     115          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.form}} </td>
    121116        </ng-container>
    122117       
    123         <ng-container matColumnDef="Тип">
    124           <th mat-header-cell *matHeaderCellDef mat-sort-header> Тип </th>
    125           <td mat-cell *matCellDef="let facilities"> {{facilities.type}} </td>
     118        <ng-container matColumnDef="Начин на издавање">
     119          <th mat-header-cell *matHeaderCellDef mat-sort-header> Начин на издавање </th>
     120          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.wayOfIssuing}} </td>
    126121        </ng-container>
    127122   
    128         <ng-container matColumnDef="Е-пошта">
    129           <th mat-header-cell *matHeaderCellDef mat-sort-header> Е-пошта </th>
    130           <td mat-cell *matCellDef="let facilities"> {{facilities.email}} </td>
     123        <ng-container matColumnDef="Производител">
     124          <th mat-header-cell *matHeaderCellDef mat-sort-header> Производител </th>
     125          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.manufacturer}} </td>
    131126        </ng-container>
    132127     
    133         <ng-container matColumnDef="Телефон">
    134           <th mat-header-cell *matHeaderCellDef mat-sort-header> Телефон </th>
    135           <td mat-cell *matCellDef="let facilities"> {{facilities.phone}} </td>
     128        <ng-container matColumnDef="Цена">
     129          <th mat-header-cell *matHeaderCellDef mat-sort-header> Цена </th>
     130          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.price}} </td>
     131        </ng-container>
     132 
     133        <ng-container matColumnDef="Пакување">
     134          <th mat-header-cell *matHeaderCellDef mat-sort-header> Пакување </th>
     135          <td mat-cell *matCellDef="let mymedicines"> {{mymedicines.packaging}} </td>
     136        </ng-container>
     137 
     138        <ng-container matColumnDef="Actions">
     139          <th mat-header-cell *matHeaderCellDef mat-sort-header> Actions </th>
     140          <td mat-cell *matCellDef="let mymedicines"> <a (click)="medicineExists(mymedicines)">Exists</a> | <a (click)="medicineDoesntSell(mymedicines)">Doesnt sell</a> </td>
    136141        </ng-container>
    137142 
  • Farmatiko/ClientApp/src/app/dashboard/dashboard.component.ts

    re42f61a rde18858  
    44import { MatPaginator } from '@angular/material/paginator';
    55import { MatSort } from '@angular/material/sort';
    6 import { HealthFacilities } from '../models/HealthFacilities';
    76import { HttpClient } from '@angular/common/http';
    87import { MatDialog } from '@angular/material/dialog';
     
    109import { Router, RouterModule } from '@angular/router';
    1110import { HomeComponent } from '../home/home.component';
     11import { Medicine } from '../models/Medicine';
     12import { PharmacyHead } from '../models/PharmacyHead';
     13import { MedicineList } from '../models/MedicineList';
    1214
    1315@Component({
     
    1719})
    1820export class DashboardComponent implements OnInit {
    19   public facilities: HealthFacilities[];
    20   displayedColumns = ['Име','Општина','Адреса', 'Тип', 'Е-пошта', 'Телефон'];
    21   dataSource = new MatTableDataSource<HealthFacilities>();
     21  public mymedicines: Medicine[];
     22  public hasmymedicines: boolean[];
     23  public pharmacies: Pharmacy[];
     24  public mypharmacies: Pharmacy[];
     25  public head: PharmacyHead;
     26  public status: string;
     27  displayedColumns = ['Име','Јачина','Форма', 'Начин на издавање', 'Производител', 'Цена', 'Пакување', 'Actions'];
     28  displayedColumnsPharmacies = ['Име','Локација','Адреса', 'Actions'];
     29  dataSource = new MatTableDataSource<Medicine>();
     30  dataSourcePharmacies = new MatTableDataSource<Pharmacy>();
    2231
    2332  @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
     
    2534
    2635  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string, private dialog: MatDialog, private _snackBar: MatSnackBar, private router: Router) {
    27     http.get<HealthFacilities[]>(baseUrl + 'HealthFacilities/Get?').subscribe(result => {
    28       this.facilities = result;
    29       console.log(this.facilities);
    30       this.dataSource = new MatTableDataSource<HealthFacilities>(this.facilities);
     36    http.get<PharmacyHead>(baseUrl + 'PharmacyHead/GetLoggedHead?').subscribe(result => {
     37      this.head = result;
     38      console.log(this.head);
     39      this.mymedicines = this.head.PharmacyMedicines.Medicines;
     40      console.log(this.mymedicines);
     41      this.mypharmacies = this.head.Pharmacy;
     42      console.log(this.mypharmacies);
     43      this.dataSource = new MatTableDataSource<Medicine>(this.mymedicines);
     44    }, error => console.error(error));
     45    http.get<Pharmacy[]>(baseUrl + 'Pharmacy/Get?').subscribe(result => {
     46      this.pharmacies = result;
     47      console.log(this.pharmacies);
     48      this.dataSourcePharmacies = new MatTableDataSource<Pharmacy>(this.pharmacies);
    3149    }, error => console.error(error));
    3250  }
     51
    3352  ngOnInit(): void {
    3453  }
     
    3756    this.dataSource.paginator = this.paginator;
    3857    this.dataSource.sort = this.sort;
     58    this.dataSourcePharmacies.paginator = this.paginator;
     59    this.dataSourcePharmacies.sort = this.sort;
     60  }
     61
     62  works24hrs(pharmacy: Pharmacy) {
     63    console.log(pharmacy);
     64    // post request vo prodolzenie
     65
     66    this.status="Status bar works24hrs";
     67  }
     68
     69  doesntWork24hrs(pharmacy: Pharmacy) {
     70    console.log(pharmacy);
     71    // post request vo prodolzenie
     72
     73    this.status="Status bar doesntWork24hrs";
     74  }
     75
     76  claimPharmacy(pharmacy: Pharmacy) {
     77    console.log(pharmacy);
     78    // post request vo prodolzenie
     79
     80    this.status="Status bar claimPharmacy";
     81  }
     82
     83  medicineExists(mymedicine: Medicine) {
     84    console.log(mymedicine);
     85    // post request vo prodolzenie
     86
     87    this.status="Status bar medicineexists";
     88  }
     89
     90  medicineDoesntSell(mymedicine: Medicine) {
     91    console.log(mymedicine);
     92    // post request vo prodolzenie
     93
     94    this.status="Status bar medicineDoesntSell";
    3995  }
    4096
     
    44100    this.dataSource.filter = filterValue;
    45101  }
     102 
     103  applyFilterPharmacies(filterValue: string) {
     104    filterValue = filterValue.trim();
     105    filterValue = filterValue.toLowerCase();
     106    this.dataSourcePharmacies.filter = filterValue;
     107  }
     108
    46109  test(): void {
    47110    console.log('Snackbar works!');
  • Farmatiko/ClientApp/src/app/home/home.component.html

    re42f61a rde18858  
    1313      <ng-container matColumnDef="Име">
    1414        <th mat-header-cell *matHeaderCellDef mat-sort-header> Име </th>
    15         <td mat-cell *matCellDef="let facilities"> {{facilities.name}} </td>
     15        <td mat-cell *matCellDef="let medicines"> {{medicines.name}} </td>
    1616      </ng-container>
    1717 
    18       <ng-container matColumnDef="Општина">
    19         <th mat-header-cell *matHeaderCellDef mat-sort-header> Општина </th>
    20         <td mat-cell *matCellDef="let facilities"> {{facilities.municipality}} </td>
     18      <ng-container matColumnDef="Јачина">
     19        <th mat-header-cell *matHeaderCellDef mat-sort-header> Јачина </th>
     20        <td mat-cell *matCellDef="let medicines"> {{medicines.strength}} </td>
    2121      </ng-container>
    2222   
    23       <ng-container matColumnDef="Адреса">
    24         <th mat-header-cell *matHeaderCellDef mat-sort-header> Адреса </th>
    25         <td mat-cell *matCellDef="let facilities"> {{facilities.address}} </td>
     23      <ng-container matColumnDef="Форма">
     24        <th mat-header-cell *matHeaderCellDef mat-sort-header> Форма </th>
     25        <td mat-cell *matCellDef="let medicines"> {{medicines.form}} </td>
    2626      </ng-container>
    2727     
    28       <ng-container matColumnDef="Тип">
    29         <th mat-header-cell *matHeaderCellDef mat-sort-header> Тип </th>
    30         <td mat-cell *matCellDef="let facilities"> {{facilities.type}} </td>
     28      <ng-container matColumnDef="Начин на издавање">
     29        <th mat-header-cell *matHeaderCellDef mat-sort-header> Начин на издавање </th>
     30        <td mat-cell *matCellDef="let medicines"> {{medicines.wayOfIssuing}} </td>
    3131      </ng-container>
    3232 
    33       <ng-container matColumnDef="Е-пошта">
    34         <th mat-header-cell *matHeaderCellDef mat-sort-header> Е-пошта </th>
    35         <td mat-cell *matCellDef="let facilities"> {{facilities.email}} </td>
     33      <ng-container matColumnDef="Производител">
     34        <th mat-header-cell *matHeaderCellDef mat-sort-header> Производител </th>
     35        <td mat-cell *matCellDef="let medicines"> {{medicines.manufacturer}} </td>
    3636      </ng-container>
    3737   
    38       <ng-container matColumnDef="Телефон">
    39         <th mat-header-cell *matHeaderCellDef mat-sort-header> Телефон </th>
    40         <td mat-cell *matCellDef="let facilities"> {{facilities.phone}} </td>
     38      <ng-container matColumnDef="Цена">
     39        <th mat-header-cell *matHeaderCellDef mat-sort-header> Цена </th>
     40        <td mat-cell *matCellDef="let medicines"> {{medicines.price}} </td>
     41      </ng-container>
     42
     43      <ng-container matColumnDef="Пакување">
     44        <th mat-header-cell *matHeaderCellDef mat-sort-header> Пакување </th>
     45        <td mat-cell *matCellDef="let medicines"> {{medicines.packaging}} </td>
    4146      </ng-container>
    4247
     
    5257    <h2>Аптеки</h2>
    5358    <mat-form-field>
    54       <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Пронајди аптека">
     59      <input matInput (keyup)="applyFilterPharmacies($event.target.value)" placeholder="Пронајди аптека">
    5560    </mat-form-field>
    5661    </div>
    5762      <table [dataSource]="dataSource" mat-table matSort class="mat-elevation-z8">
    58         <ng-container matColumnDef="Име">
     63        <ng-container matColumnDef="Име">a
    5964          <th mat-header-cell *matHeaderCellDef mat-sort-header> Име </th>
    60           <td mat-cell *matCellDef="let facilities"> {{facilities.name}} </td>
     65          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.name}} </td>
    6166        </ng-container>
    6267   
    63         <ng-container matColumnDef="Општина">
    64           <th mat-header-cell *matHeaderCellDef mat-sort-header> Општина </th>
    65           <td mat-cell *matCellDef="let facilities"> {{facilities.municipality}} </td>
     68        <ng-container matColumnDef="Локација">
     69          <th mat-header-cell *matHeaderCellDef mat-sort-header> Локација </th>
     70          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.location}} </td>
    6671        </ng-container>
    6772     
    6873        <ng-container matColumnDef="Адреса">
    6974          <th mat-header-cell *matHeaderCellDef mat-sort-header> Адреса </th>
    70           <td mat-cell *matCellDef="let facilities"> {{facilities.address}} </td>
     75          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.address}} </td>
    7176        </ng-container>
    7277       
    73         <ng-container matColumnDef="Тип">
    74           <th mat-header-cell *matHeaderCellDef mat-sort-header> Тип </th>
    75           <td mat-cell *matCellDef="let facilities"> {{facilities.type}} </td>
    76         </ng-container>
    77    
    78         <ng-container matColumnDef="Е-пошта">
    79           <th mat-header-cell *matHeaderCellDef mat-sort-header> Е-пошта </th>
    80           <td mat-cell *matCellDef="let facilities"> {{facilities.email}} </td>
    81         </ng-container>
    82      
    83         <ng-container matColumnDef="Телефон">
    84           <th mat-header-cell *matHeaderCellDef mat-sort-header> Телефон </th>
    85           <td mat-cell *matCellDef="let facilities"> {{facilities.phone}} </td>
     78        <ng-container matColumnDef="Работи 27/7?">
     79          <th mat-header-cell *matHeaderCellDef mat-sort-header> Работи 27/7? </th>
     80          <td mat-cell *matCellDef="let pharmacies"> {{pharmacies.workAllTime}} </td>
    8681        </ng-container>
    8782 
    88           <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
    89           <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
     83          <tr mat-header-row *matHeaderRowDef="displayedColumnsPharmacies"></tr>
     84          <tr mat-row *matRowDef="let row; columns: displayedColumnsPharmacies;"></tr>
    9085      </table>
    9186      <mat-paginator #paginator [pageSize]="5" [pageSizeOptions]="[5, 10, 20, 100]"></mat-paginator>
  • Farmatiko/ClientApp/src/app/home/home.component.ts

    re42f61a rde18858  
    11import { Component, OnInit, ViewChild, Inject } from '@angular/core';
    22import { HttpClient } from '@angular/common/http';
    3 import { HealthFacilities } from '../models/HealthFacilities';
     3import { Medicine } from '../models/Medicine';
     4import { Pharmacy } from '../models/Pharmacy';
    45import { MatTableDataSource } from '@angular/material/table';
    56import { MatPaginator } from '@angular/material/paginator';
    67import { MatSort } from '@angular/material/sort';
    7 
    88
    99@Component({
     
    1313})
    1414export class HomeComponent implements OnInit {
    15   public facilities: HealthFacilities[];
    16   displayedColumns = ['Име','Општина','Адреса', 'Тип', 'Е-пошта', 'Телефон'];
    17   dataSource = new MatTableDataSource<HealthFacilities>();
     15  public medicines: Medicine[];
     16  public pharmacies: Pharmacy[];
     17  displayedColumns = ['Име','Јачина','Форма', 'Начин на издавање', 'Производител', 'Цена', 'Пакување'];
     18  displayedColumnsPharmacies = ['Име','Локација','Адреса', 'Работи 27/7?'];
     19  dataSource = new MatTableDataSource<Medicine>();
     20  dataSourcePharmacies = new MatTableDataSource<Pharmacy>();
    1821
    1922  @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
     
    2124
    2225  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
    23     http.get<HealthFacilities[]>(baseUrl + 'HealthFacilities/Get?').subscribe(result => {
    24       this.facilities = result;
    25       console.log(this.facilities);
    26       this.dataSource = new MatTableDataSource<HealthFacilities>(this.facilities);
     26    http.get<Medicine[]>(baseUrl + 'Medicine/Get?').subscribe(result => {
     27      this.medicines = result;
     28      console.log(this.medicines);
     29      this.dataSource = new MatTableDataSource<Medicine>(this.medicines);
     30    }, error => console.error(error));
     31    http.get<Pharmacy[]>(baseUrl + 'Pharmacy/Get?').subscribe(result => {
     32      this.pharmacies = result;
     33      console.log(this.pharmacies);
     34      this.dataSourcePharmacies = new MatTableDataSource<Pharmacy>(this.pharmacies);
    2735    }, error => console.error(error));
    2836  }
     
    3341    this.dataSource.paginator = this.paginator;
    3442    this.dataSource.sort = this.sort;
     43    this.dataSourcePharmacies.paginator = this.paginator;
     44    this.dataSourcePharmacies.sort = this.sort;
    3545  }
    3646
     
    4050    this.dataSource.filter = filterValue;
    4151  }
     52 
     53  applyFilterPharmacies(filterValue: string) {
     54    filterValue = filterValue.trim();
     55    filterValue = filterValue.toLowerCase();
     56    this.dataSourcePharmacies.filter = filterValue;
     57  }
    4258}
  • Farmatiko/ClientApp/src/app/korona/korona.component.html

    re42f61a rde18858  
    88      <p>статистика</p>
    99    </div>
    10 
    11 
    12 
    1310  </div>
    1411  <div class="row text-center pads">
    1512    <div class="col">
    1613      <div class="counter">
    17         <i class="fa fa-code fa-2x">0</i>
    18         <h2 class="timer count-title count-number" data-to="100" data-speed="1500"></h2>
     14        <i class="fa fa-code fa-2x" *ngIf="korona">{{korona.totalMK}}</i>
     15        <h2 class="timer count-title count-number"></h2>
    1916        <p class="count-text ">Вкупно случаи во земјата</p>
    2017      </div>
     
    2219    <div class="col">
    2320      <div class="counter">
    24         <i class="fa fa-coffee fa-2x">0</i>
    25         <h2 class="timer count-title count-number" data-to="1700" data-speed="1500"></h2>
     21        <i class="fa fa-coffee fa-2x" *ngIf="korona">{{korona.activeMK}}</i>
     22        <h2 class="timer count-title count-number"></h2>
    2623        <p class="count-text ">Активни случаи во земјата</p>
    2724      </div>
     
    2926    <div class="col">
    3027      <div class="counter">
    31         <i class="fa fa-lightbulb-o fa-2x">0</i>
    32         <h2 class="timer count-title count-number" data-to="11900" data-speed="1500"></h2>
     28        <i class="fa fa-lightbulb-o fa-2x" *ngIf="korona">{{korona.deathsMK}}</i>
     29        <h2 class="timer count-title count-number"></h2>
    3330        <p class="count-text ">Смртни случаи во земјата</p>
    3431      </div>
     
    3633    <div class="col">
    3734      <div class="counter">
    38         <i class="fa fa-bug fa-2x">0</i>
    39         <h2 class="timer count-title count-number" data-to="157" data-speed="1500"></h2>
     35        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.newMK}}</i>
     36        <h2 class="timer count-title count-number"></h2>
    4037        <p class="count-text ">Нови случаи во земјата</p>
    4138      </div>
     
    4542    <div class="col">
    4643      <div class="counter">
    47         <i class="fa fa-bug fa-2x">0</i>
    48         <h2 class="timer count-title count-number" data-to="157" data-speed="1500"></h2>
     44        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.totalGlobal}}</i>
     45        <h2 class="timer count-title count-number"></h2>
    4946        <p class="count-text ">Вкупно случаи глобално</p>
    5047      </div>
     
    5249    <div class="col">
    5350      <div class="counter">
    54         <i class="fa fa-bug fa-2x">0</i>
    55         <h2 class="timer count-title count-number" data-to="157" data-speed="1500"></h2>
     51        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.activeGlobal}}</i>
     52        <h2 class="timer count-title count-number"></h2>
    5653        <p class="count-text ">Активни случаи глобално</p>
    5754      </div>
     
    5956    <div class="col">
    6057      <div class="counter">
    61         <i class="fa fa-bug fa-2x">0</i>
    62         <h2 class="timer count-title count-number" data-to="157" data-speed="1500"></h2>
     58        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.deathsGlobal}}</i>
     59        <h2 class="timer count-title count-number"></h2>
    6360        <p class="count-text ">Смртни случаи глобално</p>
    6461      </div>
  • Farmatiko/ClientApp/src/app/korona/korona.component.ts

    re42f61a rde18858  
    1 import { Component, OnInit } from '@angular/core';
     1import { Component, OnInit, Inject } from '@angular/core';
     2import { Pandemic } from '../models/Pandemic';
     3import { MatTableDataSource } from '@angular/material/table';
     4import { HttpClient } from '@angular/common/http';
    25
    36@Component({
     
    710})
    811export class KoronaComponent implements OnInit {
     12  public korona: Pandemic;
    913
    10   constructor() { }
     14  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
     15    http.get<Pandemic>(baseUrl + 'Pandemic/Get?').subscribe(result => {
     16      this.korona = result;
     17      console.log(this.korona);
     18    }, error => console.error(error));
     19  }
    1120
    1221  ngOnInit(): void {
  • Farmatiko/ClientApp/src/app/models/HealthcareWorkers.ts

    re42f61a rde18858  
    22
    33export class HealthcareWorkers {
    4   Name: string;
    5   Branch: Date;
    6   Facility: HealthFacilities;
    7   Title: string;
     4  name: string;
     5  branch: Date;
     6  facility: HealthFacilities;
     7  title: string;
    88}
  • Farmatiko/ClientApp/src/app/models/Medicine.ts

    re42f61a rde18858  
    11export class Medicine {
    2   Name: string;
    3   Strength: string;
    4   Form: string;
    5   WayOfIssuing: string;
    6   Manufacturer: string;
    7   Price: Float32Array;
    8   Packaging: string;
     2  name: string;
     3  strength: string;
     4  form: string;
     5  wayOfIssuing: string;
     6  manufacturer: string;
     7  price: number;
     8  packaging: string;
    99}
  • Farmatiko/ClientApp/src/app/models/Pandemic.ts

    re42f61a rde18858  
    11export class Pandemic {
    2   Name: string;
    3   TotalMK: number;
    4   ActiveMK: number;
    5   DeathsMK: number;
    6   NewMK: number;
    7   TotalGlobal: number;
    8   DeathsGlobal: number;
    9   ActiveGlobal: number;
     2  name: string;
     3  totalMK: number;
     4  activeMK: number;
     5  deathsMK: number;
     6  newMK: number;
     7  totalGlobal: number;
     8  deathsGlobal: number;
     9  activeGlobal: number;
    1010}
  • Farmatiko/ClientApp/src/app/models/Pharmacy.ts

    re42f61a rde18858  
    11export class Pharmacy {
    2   Name: string;
    3   Location: string;
    4   Address: string;
    5   WorkAllTime: boolean;
     2  name: string;
     3  location: string;
     4  address: string;
     5  workAllTime: boolean;
    66}
Note: See TracChangeset for help on using the changeset viewer.