Changeset de18858 for Farmatiko/ClientApp/src/app/home
- Timestamp:
- 07/29/20 19:46:21 (4 years ago)
- Branches:
- master
- Children:
- 4e72684
- Parents:
- e42f61a
- Location:
- Farmatiko/ClientApp/src/app/home
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Farmatiko/ClientApp/src/app/home/home.component.html
re42f61a rde18858 13 13 <ng-container matColumnDef="Име"> 14 14 <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> 16 16 </ng-container> 17 17 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> 21 21 </ng-container> 22 22 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> 26 26 </ng-container> 27 27 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> 31 31 </ng-container> 32 32 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> 36 36 </ng-container> 37 37 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> 41 46 </ng-container> 42 47 … … 52 57 <h2>Аптеки</h2> 53 58 <mat-form-field> 54 <input matInput (keyup)="applyFilter ($event.target.value)" placeholder="Пронајди аптека">59 <input matInput (keyup)="applyFilterPharmacies($event.target.value)" placeholder="Пронајди аптека"> 55 60 </mat-form-field> 56 61 </div> 57 62 <table [dataSource]="dataSource" mat-table matSort class="mat-elevation-z8"> 58 <ng-container matColumnDef="Име"> 63 <ng-container matColumnDef="Име">a 59 64 <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> 61 66 </ng-container> 62 67 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> 66 71 </ng-container> 67 72 68 73 <ng-container matColumnDef="Адреса"> 69 74 <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> 71 76 </ng-container> 72 77 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> 86 81 </ng-container> 87 82 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> 90 85 </table> 91 86 <mat-paginator #paginator [pageSize]="5" [pageSizeOptions]="[5, 10, 20, 100]"></mat-paginator> -
Farmatiko/ClientApp/src/app/home/home.component.ts
re42f61a rde18858 1 1 import { Component, OnInit, ViewChild, Inject } from '@angular/core'; 2 2 import { HttpClient } from '@angular/common/http'; 3 import { HealthFacilities } from '../models/HealthFacilities'; 3 import { Medicine } from '../models/Medicine'; 4 import { Pharmacy } from '../models/Pharmacy'; 4 5 import { MatTableDataSource } from '@angular/material/table'; 5 6 import { MatPaginator } from '@angular/material/paginator'; 6 7 import { MatSort } from '@angular/material/sort'; 7 8 8 9 9 @Component({ … … 13 13 }) 14 14 export 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>(); 18 21 19 22 @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator; … … 21 24 22 25 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); 27 35 }, error => console.error(error)); 28 36 } … … 33 41 this.dataSource.paginator = this.paginator; 34 42 this.dataSource.sort = this.sort; 43 this.dataSourcePharmacies.paginator = this.paginator; 44 this.dataSourcePharmacies.sort = this.sort; 35 45 } 36 46 … … 40 50 this.dataSource.filter = filterValue; 41 51 } 52 53 applyFilterPharmacies(filterValue: string) { 54 filterValue = filterValue.trim(); 55 filterValue = filterValue.toLowerCase(); 56 this.dataSourcePharmacies.filter = filterValue; 57 } 42 58 }
Note:
See TracChangeset
for help on using the changeset viewer.