Changeset 28d7d35 for Farmatiko/ClientApp/src/app
- Timestamp:
- 01/31/21 06:27:26 (4 years ago)
- Branches:
- master
- Children:
- de9d697
- Parents:
- 7520f88
- Location:
- Farmatiko/ClientApp/src/app
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
Farmatiko/ClientApp/src/app/app.module.ts
r7520f88 r28d7d35 6 6 import { MaterialModule } from './shared/material.module'; 7 7 import { ReactiveFormsModule } from '@angular/forms'; 8 import { LeafletModule } from '@asymmetrik/ngx-leaflet'; 8 9 9 10 import { CoreModule } from './shared/core.module'; … … 65 66 MaterialModule, 66 67 ReactiveFormsModule, 68 LeafletModule, 67 69 CoreModule 68 70 ], -
Farmatiko/ClientApp/src/app/counter/counter.component.css
r7520f88 r28d7d35 2 2 display: flex; 3 3 flex-direction: column; 4 max-height: 500px;5 4 min-width: 300px; 6 5 } … … 27 26 padding: 1em 0; 28 27 } 28 .tableRow:hover { 29 background-color: #D4F2CD; 30 transform: scale(1.0005); 31 } 32 33 h2 button { 34 float: right; 35 padding: 0 5em; 36 } 37 38 #map { 39 height: 100%; 40 } 41 42 .map-frame { 43 border: 2px solid black; 44 height: 100%; 45 } 46 47 .map-wrapper { 48 margin: 0 3em 3em 3em; 49 min-height: 400px; 50 } -
Farmatiko/ClientApp/src/app/counter/counter.component.html
r7520f88 r28d7d35 6 6 <div class="wrapper"> 7 7 <div class="header"> 8 <h2>Здравствени установи</h2> 8 <h2>Здравствени установи 9 <button mat-icon-button color="primary" (click)="refreshMap()" [disabled]="!showMap"> 10 <mat-icon>refresh</mat-icon>Освежи 11 </button> 12 <button mat-icon-button color="accent" [disabled]="clicked" (click)="toggleMap(); clicked = true"> 13 <mat-icon>map</mat-icon>Активирај 14 </button> 15 </h2> 16 <div class="map-wrapper" *ngIf="showMap"> 17 <div class="map-frame"> 18 <div id="map" style="height: 400px;" leaflet [leafletOptions]="options"></div> 19 </div> 20 </div> 21 9 22 <mat-form-field> 10 23 <input matInput (keyup)="applyFilterFacilities($event.target.value)" placeholder="Пронајди установа"> … … 16 29 <th>Име</th> 17 30 <th>Општина</th> 18 <th>Адреса</th>19 31 <th>Тип</th> 20 <th>Е-пошта</th>21 <th>Телефон</th>22 32 </tr> 23 33 </thead> 24 34 <tbody> 25 <tr *ngFor="let facility of filteredFacilities" >26 <td> <a (click)="openFacilityDialog(facility)">{{ facility.name }}</a></td>35 <tr *ngFor="let facility of filteredFacilities" (click)="openFacilityDialog(facility)" class="tableRow"> 36 <td>{{ facility.name }}</td> 27 37 <td>{{ facility.municipality }}</td> 28 <td>{{ facility.address }}</td>29 38 <td>{{ facility.type }}</td> 30 <td>{{ facility.email }}</td>31 <td>{{ facility.phone }}</td>32 39 </tr> 33 40 </tbody> … … 48 55 <th>Име</th> 49 56 <th>Гранка</th> 50 <th>Установа</th>51 <th>Назив</th>52 57 </tr> 53 58 </thead> 54 59 <tbody> 55 <tr *ngFor="let worker of filteredWorkers" >56 <td> <a (click)="openWorkerDialog(worker)">{{ worker.name }}</a></td>60 <tr *ngFor="let worker of filteredWorkers" (click)="openWorkerDialog(worker)" class="tableRow"> 61 <td>{{ worker.name }}</td> 57 62 <td>{{ worker.branch }}</td> 58 <td>{{ worker.facility }}</td>59 <td>{{ worker.title }}</td>60 63 </tr> 61 64 </tbody> -
Farmatiko/ClientApp/src/app/counter/counter.component.ts
r7520f88 r28d7d35 5 5 import { FacilityDialogComponent } from '../dialogs/facility-dialog/facility-dialog.component'; 6 6 import { WorkerDialogComponent } from '../dialogs/worker-dialog/worker-dialog.component'; 7 import { latLng, LatLng, tileLayer, marker, icon } from 'leaflet'; 8 import { HttpClient } from '@angular/common/http'; 7 9 8 10 @Component({ … … 16 18 public filteredFacilities: IHealthFacilities[] = []; 17 19 public filteredWorkers: IHealthcareWorkers[] = []; 18 19 constructor(private dataService: DataService, private dialog: MatDialog) { 20 public lat; 21 public lng; 22 clicked = false; 23 showMap: boolean = false; 24 options = { 25 layers: [ 26 tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }) 27 ], 28 zoom: 8, 29 center: latLng(41.61807, 21.74348) 30 } 31 32 constructor(private dataService: DataService, private dialog: MatDialog, private http: HttpClient) { 20 33 21 34 } … … 27 40 }, 28 41 (err: any) => console.log(err), 29 () => console.log('Facility data retrieved!')); 42 () => { 43 this.appendFacilityMarkers(this.facilities) 44 console.log('Facility data retrieved!'); 45 }); 30 46 31 47 this.dataService.getWorkers() … … 35 51 (err: any) => console.log(err), 36 52 () => console.log('Facility data retrieved!')); 53 54 if (navigator.geolocation) { 55 navigator.geolocation.getCurrentPosition((position) => { 56 if (position) { 57 this.lat = position.coords.latitude; 58 this.lng = position.coords.longitude; 59 let layer = marker([ this.lat, this.lng ], { 60 icon: icon({ 61 iconSize: [ 25, 41 ], 62 iconAnchor: [ 13, 41 ], 63 iconUrl: 'assets/home-icon.png' 64 }) 65 }).bindPopup("Вашата локација"); 66 this.options.layers.push(layer); 67 } 68 }); 69 } 70 } 71 72 appendFacilityMarkers(facils: IHealthFacilities[]) { 73 this.options.layers = []; 74 this.options.layers.push(tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'})); 75 if(this.lat && this.lng) { 76 this.options.layers.push(marker([ this.lat, this.lng ], { 77 icon: icon({ 78 iconSize: [ 25, 41 ], 79 iconAnchor: [ 13, 41 ], 80 iconUrl: 'assets/home-icon.png' 81 }) 82 }).bindPopup("Вашата локација")); 83 } 84 facils.forEach((facil) => { 85 this.http.get<any>('https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+facil.municipality+'&street='+facil.address+'&format=json').subscribe(obj => { 86 console.log(obj); 87 if(obj.length) { 88 let layer = marker([ obj[0]?.lat, obj[0]?.lon ], { 89 icon: icon({ 90 iconSize: [ 25, 41 ], 91 iconAnchor: [ 13, 41 ], 92 iconUrl: 'assets/hospital-icon.png' 93 }) 94 }).bindPopup(facil.name); 95 this.options.layers.push(layer); 96 } 97 }, error => console.error(error)); 98 }); 37 99 } 38 100 … … 45 107 }, 46 108 (err: any) => console.log(err), 47 () => console.log('Facility data retrieved!')); 109 () => { 110 this.appendFacilityMarkers(this.filteredFacilities); 111 if(this.showMap) { 112 this.showMap = false; 113 setTimeout(() => this.showMap = true, 300); 114 } 115 console.log('Facility data retrieved!'); 116 }); 48 117 } 49 118 else { 50 119 this.filteredFacilities = this.facilities; 120 this.appendFacilityMarkers(this.facilities); 121 if(this.showMap) { 122 this.showMap = false; 123 setTimeout(() => this.showMap = true, 300); 124 } 51 125 } 52 126 } … … 80 154 }); 81 155 } 156 157 toggleMap() { 158 this.showMap = !this.showMap; 159 } 160 161 refreshMap() { 162 this.showMap = false; 163 setTimeout(() => this.showMap = true, 300); 164 } 165 82 166 } -
Farmatiko/ClientApp/src/app/dashboard/dashboard.component.html
r7520f88 r28d7d35 44 44 <tbody> 45 45 <tr *ngFor="let pharmacies of head.Pharmacy"> 46 <td >{{pharmacies.name}}</td>47 <td >{{pharmacies.location}}</td>48 <td >{{pharmacies.address}}</td>49 <td >{{pharmacies.workAllTime}}</td>46 <td (click)="openPharmacyDialog(pharmacies)">{{pharmacies.name}}</td> 47 <td (click)="openPharmacyDialog(pharmacies)">{{pharmacies.location}}</td> 48 <td (click)="openPharmacyDialog(pharmacies)">{{pharmacies.address}}</td> 49 <td (click)="openPharmacyDialog(pharmacies)">{{pharmacies.workAllTime}}</td> 50 50 <td><a (click)="openEditPharmacyDialog(pharmacies)">Edit</a></td> 51 51 </tr> … … 72 72 </thead> 73 73 <tbody> 74 <tr *ngFor="let pharmacy of pharmacies">75 <td ><a (click)="openPharmacyDialog(pharmacy)">{{ pharmacy.name }}</a></td>76 <td >{{ pharmacy.location }}</td>77 <td >{{ pharmacy.address }}</td>78 <td >{{ pharmacy.workAllTime }}</td>79 <td><a (click)="claimPharmacy(pharmacy)" >Claim</a></td>74 <tr *ngFor="let pharmacy of filteredPharmacies"> 75 <td (click)="openPharmacyDialog(pharmacy)">{{ pharmacy.name }}</td> 76 <td (click)="openPharmacyDialog(pharmacy)">{{ pharmacy.location }}</td> 77 <td (click)="openPharmacyDialog(pharmacy)">{{ pharmacy.address }}</td> 78 <td (click)="openPharmacyDialog(pharmacy)">{{ pharmacy.workAllTime }}</td> 79 <td><a (click)="claimPharmacy(pharmacy)" *ngIf="!pharmacy.headName">Claim</a> <span *ngIf="pharmacy.headName">Already claimed</span></td> 80 80 </tr> 81 81 </tbody> … … 114 114 <tbody> 115 115 <tr *ngFor="let medicine of filteredMedicines"> 116 <td *ngIf="!medicinesEditMode" ><a (click)="openMedicineDialog(medicine)">{{ medicine.name }}</a></td>116 <td *ngIf="!medicinesEditMode" (click)="openMedicineDialog(medicine)">{{ medicine.name }}</td> 117 117 <td *ngIf="medicinesEditMode"><mat-form-field appearance="fill"><input matInput [(ngModel)]="medicine.name" name="medname"></mat-form-field></td> 118 <td *ngIf="!medicinesEditMode" >{{ medicine.strength }}</td>118 <td *ngIf="!medicinesEditMode" (click)="openMedicineDialog(medicine)">{{ medicine.strength }}</td> 119 119 <td *ngIf="medicinesEditMode"><mat-form-field appearance="fill"><input matInput [(ngModel)]="medicine.strength" name="medstr"></mat-form-field></td> 120 <td *ngIf="!medicinesEditMode" >{{ medicine.form }}</td>120 <td *ngIf="!medicinesEditMode" (click)="openMedicineDialog(medicine)">{{ medicine.form }}</td> 121 121 <td *ngIf="medicinesEditMode"><mat-form-field appearance="fill"><input matInput [(ngModel)]="medicine.form" name="medform"></mat-form-field></td> 122 <td *ngIf="!medicinesEditMode" >{{ medicine.wayOfIssuing }}</td>122 <td *ngIf="!medicinesEditMode" (click)="openMedicineDialog(medicine)">{{ medicine.wayOfIssuing }}</td> 123 123 <td *ngIf="medicinesEditMode"><mat-form-field appearance="fill"><input matInput [(ngModel)]="medicine.wayOfIssuing" name="medwayOfIssuing"></mat-form-field></td> 124 <td *ngIf="!medicinesEditMode" >{{ medicine.manufacturer }}</td>124 <td *ngIf="!medicinesEditMode" (click)="openMedicineDialog(medicine)">{{ medicine.manufacturer }}</td> 125 125 <td *ngIf="medicinesEditMode"><mat-form-field appearance="fill"><input matInput [(ngModel)]="medicine.manufacturer" name="medmanufacturer"></mat-form-field></td> 126 <td *ngIf="!medicinesEditMode" >{{ medicine.price }}</td>126 <td *ngIf="!medicinesEditMode" (click)="openMedicineDialog(medicine)">{{ medicine.price }}</td> 127 127 <td *ngIf="medicinesEditMode"><mat-form-field appearance="fill"><input matInput [(ngModel)]="medicine.price" name="medprice"></mat-form-field></td> 128 <td *ngIf="!medicinesEditMode" >{{ medicine.packaging }}</td>128 <td *ngIf="!medicinesEditMode" (click)="openMedicineDialog(medicine)">{{ medicine.packaging }}</td> 129 129 <td *ngIf="medicinesEditMode"><mat-form-field appearance="fill"><input matInput [(ngModel)]="medicine.packaging" name="medpackaging"></mat-form-field></td> 130 130 <td> -
Farmatiko/ClientApp/src/app/dashboard/dashboard.component.ts
r7520f88 r28d7d35 40 40 this.dataService.getPharmacies() 41 41 .subscribe((pharmacy: IPharmacy[]) => { 42 this.pharmacies = pharmacy; 43 this.head.Pharmacy.forEach((pharma) => { 44 this.filteredPharmacies = this.pharmacies = this.pharmacies.filter(x => x == pharma); 45 }); 42 this.pharmacies = this.filteredPharmacies = pharmacy; 43 // Iskluceno filtriranje na farmacies (Star metod) 44 // this.head.Pharmacy.forEach((pharma) => { 45 // this.filteredPharmacies = this.pharmacies = this.pharmacies.filter(x => x == pharma); 46 // }); 46 47 }, 47 48 (err: any) => console.log(err), … … 147 148 if(listMedicines){ 148 149 listMedicines.forEach((medicine) => { 149 this.head.PharmacyMedicines = this.head.PharmacyMedicines.filter(x => x != medicine); 150 if(this.head.PharmacyMedicines) { 151 this.head.PharmacyMedicines = this.head.PharmacyMedicines.filter(x => x != medicine); 152 } 153 else { 154 this.head.PharmacyMedicines = []; 155 } 150 156 this.head.PharmacyMedicines.push(medicine); 151 157 this.filteredMedicines = this.head.PharmacyMedicines; … … 175 181 .subscribe((pharmacy: IPharmacy[]) => { 176 182 this.filteredPharmacies = pharmacy; 177 this.head.Pharmacy.forEach((pharma) => {178 this.filteredPharmacies = this.filteredPharmacies.filter(x => x == pharma);179 });183 // this.head.Pharmacy.forEach((pharma) => { 184 // this.filteredPharmacies = this.filteredPharmacies.filter(x => x == pharma); 185 // }); 180 186 }, 181 187 (err: any) => console.log(err), -
Farmatiko/ClientApp/src/app/dialogs/edit-pharmacy-head-dialog/edit-pharmacy-head-dialog.component.html
r7520f88 r28d7d35 3 3 <div class="form-group"> 4 4 <label>ИД</label> 5 <input type="text" class="form-control" name="id" [(ngModel)]="head.id" #id="ngModel" required >5 <input type="text" class="form-control" name="id" [(ngModel)]="head.id" #id="ngModel" required disabled> 6 6 <div class="alert alert-danger">ID is required</div> 7 7 </div> -
Farmatiko/ClientApp/src/app/dialogs/facility-dialog/facility-dialog.component.css
r7520f88 r28d7d35 1 button { 2 float: right; 3 } -
Farmatiko/ClientApp/src/app/dialogs/facility-dialog/facility-dialog.component.html
r7520f88 r28d7d35 1 <h3>Повеќе инфо</h3> 1 <h3>Повеќе информации</h3> 2 <table class="table table-striped"> 3 <tbody> 4 <tr> 5 <td>Име</td> 6 <td>{{facility?.name}}</td> 7 </tr> 8 <tr> 9 <td>Општина</td> 10 <td>{{facility?.municipality}}</td> 11 </tr> 12 <tr> 13 <td>Тип на установа</td> 14 <td>{{facility?.type}}</td> 15 </tr> 16 <tr> 17 <td>Адреса</td> 18 <td>{{facility?.address}}</td> 19 </tr> 20 <tr> 21 <td>Е-пошта</td> 22 <td>{{facility?.email}}</td> 23 </tr> 24 <tr> 25 <td>Телефон</td> 26 <td>{{facility?.phone}}</td> 27 </tr> 28 </tbody> 29 </table> 30 31 <div style="height: 200px;" leaflet [leafletOptions]="options" *ngIf="mapShown"></div> 2 32 <br> 3 <p>ИД: {{facility.id}}</p> 4 <p>Име: {{facility.name}}</p> 5 <p>Општина: {{facility.municipality}}</p> 6 <p>Тип на установа: {{facility.type}}</p> 7 <p>Адреса: {{facility.address}}</p> 8 <p>Адреса: {{facility.email}}</p> 9 <p>Адреса: {{facility.phone}}</p> 10 <br> 11 <p><a (click)="close()">Затвори</a></p> 33 <p><button mat-button color="primary" (click)="close()">Затвори</button></p> -
Farmatiko/ClientApp/src/app/dialogs/facility-dialog/facility-dialog.component.ts
r7520f88 r28d7d35 2 2 import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; 3 3 import { IHealthFacilities } from '../../shared/interfaces'; 4 import { latLng, LatLng, tileLayer, marker, icon } from 'leaflet'; 5 import { HttpClient } from '@angular/common/http'; 4 6 5 7 @Component({ … … 10 12 export class FacilityDialogComponent implements OnInit { 11 13 facility: IHealthFacilities; 14 mapShown: boolean = true; 15 options = { 16 layers: [ 17 tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }) 18 ], 19 zoom: 7, 20 center: latLng(41.61807, 21.74348) 21 } 12 22 13 constructor(private dialogRef: MatDialogRef<FacilityDialogComponent>, @Inject(MAT_DIALOG_DATA) data ) {23 constructor(private dialogRef: MatDialogRef<FacilityDialogComponent>, @Inject(MAT_DIALOG_DATA) data, private http: HttpClient) { 14 24 this.facility = data; 25 if(this.facility) { 26 this.addMarkers(); 27 } 15 28 } 16 29 17 30 ngOnInit(): void { 18 31 } 32 33 addMarkers() { 34 this.http.get<any>('https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+this.facility?.municipality+'&street='+this.facility?.address+'&format=json').subscribe(obj => { 35 console.log(obj); 36 if(obj.length) { 37 let layer = marker([ obj[0]?.lat, obj[0]?.lon ], { 38 icon: icon({ 39 iconSize: [ 25, 41 ], 40 iconAnchor: [ 13, 41 ], 41 iconUrl: 'assets/hospital-icon.png' 42 }) 43 }).bindPopup("Аптека: "+this.facility?.name); 44 this.options.layers.push(layer); 45 this.options.center = latLng(obj[0]?.lat, obj[0]?.lon); 46 this.options.zoom = 13; 47 } 48 }, error => console.error(error)); 49 this.mapShown = false; 50 setTimeout(() => this.mapShown = true, 300); 51 } 52 19 53 20 54 close() { -
Farmatiko/ClientApp/src/app/dialogs/medicine-dialog/medicine-dialog.component.css
r7520f88 r28d7d35 1 button { 2 float: right; 3 } -
Farmatiko/ClientApp/src/app/dialogs/medicine-dialog/medicine-dialog.component.html
r7520f88 r28d7d35 1 <h3>Повеќе инфо</h3> 2 <br> 3 <p>ИД: {{medicine.id}}</p> 4 <p>Име: {{medicine.name}}</p> 5 <p>Форма: {{medicine.form}}</p> 6 <p>Пакување: {{medicine.packaging}}</p> 7 <p>Цена: {{medicine.price}}</p> 8 <p>Јачина: {{medicine.strength}}</p> 9 <p>Начин на издавање: {{medicine.wayOfIssuing}}</p> 10 <p>Производител: {{medicine.manufacturer}}</p> 11 <br> 12 <p><a (click)="close()">Затвори</a></p> 1 <h3>Повеќе информации</h3> 2 <table class="table table-striped"> 3 <tbody> 4 <tr> 5 <td>Име</td> 6 <td>{{medicine?.name}}</td> 7 </tr> 8 <tr> 9 <td>Форма</td> 10 <td>{{medicine?.form}}</td> 11 </tr> 12 <tr> 13 <td>Пакување</td> 14 <td>{{medicine?.packaging}}</td> 15 </tr> 16 <tr> 17 <td>Цена</td> 18 <td>{{medicine?.price}}</td> 19 </tr> 20 <tr> 21 <td>Јачина</td> 22 <td>{{medicine?.strength}}</td> 23 </tr> 24 <tr> 25 <td>Начин на издавање</td> 26 <td>{{medicine?.wayOfIssuing}}</td> 27 </tr> 28 <tr> 29 <td>Производител</td> 30 <td>{{medicine?.manufacturer}}</td> 31 </tr> 32 </tbody> 33 </table> 34 <div *ngIf="medicine?.headNames"> 35 <h5>Достапен во аптеките на:</h5> 36 <table class="table table-striped"> 37 <tbody> 38 <tr *ngFor="let head of medicine?.headNames"> 39 <td>{{head}}</td> 40 </tr> 41 </tbody> 42 </table> 43 </div> 44 <p><button mat-button color="primary" (click)="close()">Затвори</button></p> -
Farmatiko/ClientApp/src/app/dialogs/pharmacy-dialog/pharmacy-dialog.component.css
r7520f88 r28d7d35 1 button { 2 float: right; 3 } 4 5 div { 6 white-space: nowrap; 7 } -
Farmatiko/ClientApp/src/app/dialogs/pharmacy-dialog/pharmacy-dialog.component.html
r7520f88 r28d7d35 1 <h3>Повеќе инфо</h3> 1 <h3>Повеќе информации</h3> 2 <table class="table table-striped"> 3 <tbody> 4 <tr> 5 <td>Име</td> 6 <td>{{pharmacy?.name}}</td> 7 </tr> 8 <tr> 9 <td>Општина</td> 10 <td>{{pharmacy?.location}}</td> 11 </tr> 12 <tr> 13 <td>Адреса</td> 14 <td>{{pharmacy?.address}}</td> 15 </tr> 16 <tr> 17 <td>Работи 24/7</td> 18 <td><div *ngIf="pharmacy.workAllTime == true">Да</div><div *ngIf="pharmacy.workAllTime != true">Не</div></td> 19 </tr> 20 <tr> 21 <td>Компанија</td> 22 <td>{{pharmacy?.headName}}</td> 23 </tr> 24 </tbody> 25 </table> 26 27 <div style="height: 200px;" leaflet [leafletOptions]="options" *ngIf="mapShown"></div> 2 28 <br> 3 <p>ИД: {{pharmacy.id}}</p> 4 <p>Име: {{pharmacy.name}}</p> 5 <p>Општина: {{pharmacy.location}}</p> 6 <p>Адреса: {{pharmacy.address}}</p> 7 <p>Работи 24/7: {{pharmacy.workAllTime}}</p> 8 <br> 9 <p><a (click)="close()">Затвори</a></p> 29 <p><button mat-button color="primary" (click)="close()">Затвори</button></p> -
Farmatiko/ClientApp/src/app/dialogs/pharmacy-dialog/pharmacy-dialog.component.ts
r7520f88 r28d7d35 1 import { Component, OnInit, Inject } from '@angular/core';1 import { Component, OnInit, Inject, AfterViewInit } from '@angular/core'; 2 2 import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; 3 3 import { IPharmacy } from '../../shared/interfaces'; 4 import { latLng, LatLng, tileLayer, marker, icon } from 'leaflet'; 5 import { HttpClient } from '@angular/common/http'; 4 6 5 7 @Component({ … … 10 12 export class PharmacyDialogComponent implements OnInit { 11 13 pharmacy: IPharmacy; 14 mapShown: boolean = true; 15 options = { 16 layers: [ 17 tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }) 18 ], 19 zoom: 7, 20 center: latLng(41.61807, 21.74348) 21 } 12 22 13 constructor(private dialogRef: MatDialogRef<PharmacyDialogComponent>, @Inject(MAT_DIALOG_DATA) data ) {23 constructor(private dialogRef: MatDialogRef<PharmacyDialogComponent>, @Inject(MAT_DIALOG_DATA) data, private http: HttpClient) { 14 24 this.pharmacy = data; 25 if(this.pharmacy) { 26 this.addMarkers(); 27 } 15 28 } 16 29 17 30 ngOnInit(): void { 31 } 32 33 addMarkers() { 34 this.http.get<any>('https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+this.pharmacy?.location+'&street='+this.pharmacy?.address+'&format=json').subscribe(obj => { 35 console.log(obj); 36 if(obj.length) { 37 let layer = marker([ obj[0]?.lat, obj[0]?.lon ], { 38 icon: icon({ 39 iconSize: [ 25, 41 ], 40 iconAnchor: [ 13, 41 ], 41 iconUrl: 'assets/pharmacy-icon.png' 42 }) 43 }).bindPopup("Аптека: "+this.pharmacy?.name); 44 this.options.layers.push(layer); 45 this.options.center = latLng(obj[0]?.lat, obj[0]?.lon); 46 this.options.zoom = 13; 47 } 48 }, error => console.error(error)); 49 this.mapShown = false; 50 setTimeout(() => this.mapShown = true, 300); 18 51 } 19 52 … … 22 55 } 23 56 57 24 58 } -
Farmatiko/ClientApp/src/app/dialogs/worker-dialog/worker-dialog.component.css
r7520f88 r28d7d35 1 button { 2 float: right; 3 } -
Farmatiko/ClientApp/src/app/dialogs/worker-dialog/worker-dialog.component.html
r7520f88 r28d7d35 1 <h3>Повеќе инфо </h3>1 <h3>Повеќе информации</h3> 2 2 <br> 3 <p>ИД: {{worker.id}}</p> 4 <p>Име: {{worker.name}}</p> 5 <p>Гранка: {{worker.branch}}</p> 6 <p>Титула: {{worker.title}}</p> 7 <br> 8 <p>Институција: {{worker.facility.name}}</p> 9 <p>{{worker.facility.municipality}}</p> 10 <p>{{worker.facility.type}}</p> 11 <br> 12 <p><a (click)="close()">Затвори</a></p> 3 <table class="table table-striped"> 4 <tbody> 5 <tr> 6 <td>Име</td> 7 <td>{{worker?.name}}</td> 8 </tr> 9 <tr> 10 <td>Гранка</td> 11 <td>{{worker?.branch}}</td> 12 </tr> 13 <tr> 14 <td>Титула</td> 15 <td>{{worker?.title}}</td> 16 </tr> 17 </tbody> 18 <br> 19 <tbody *ngIf="worker?.facility"> 20 <tr> 21 <td>Институција</td> 22 <td>{{worker?.facility?.name}}</td> 23 </tr> 24 <tr *ngIf="isExpanded"> 25 <td>Општина</td> 26 <td>{{worker?.facility?.municipality}}</td> 27 </tr> 28 <tr *ngIf="isExpanded"> 29 <td>Тип</td> 30 <td>{{worker?.facility?.type}}</td> 31 </tr> 32 <tr *ngIf="isExpanded"> 33 <td>Адреса</td> 34 <td>{{worker.facility?.address}}</td> 35 </tr> 36 <tr *ngIf="isExpanded"> 37 <td>Е-пошта</td> 38 <td>{{worker.facility?.email}}</td> 39 </tr> 40 <tr *ngIf="isExpanded"> 41 <td>Телефон</td> 42 <td>{{worker.facility?.phone}}</td> 43 </tr> 44 </tbody> 45 <tbody *ngIf="!worker?.facility"> 46 <tr> 47 <td>Институција</td> 48 <td>Нема податок</td> 49 </tr> 50 <tr *ngIf="isExpanded"> 51 <td>Општина</td> 52 <td>Нема податок</td> 53 </tr> 54 <tr *ngIf="isExpanded"> 55 <td>Тип</td> 56 <td>Нема податок</td> 57 </tr> 58 <tr *ngIf="isExpanded"> 59 <td>Адреса</td> 60 <td>Нема податок</td> 61 </tr> 62 <tr *ngIf="isExpanded"> 63 <td>Е-пошта</td> 64 <td>Нема податок</td> 65 </tr> 66 <tr *ngIf="isExpanded"> 67 <td>Телефон</td> 68 <td>Нема податок</td> 69 </tr> 70 </tbody> 71 </table> 72 <button mat-icon-button color="primary" *ngIf="!isExpanded" (click)="toggleExpansion()" style="min-width: 100%"> 73 <mat-icon>expand_more</mat-icon> 74 </button> 75 <button mat-icon-button color="primary" *ngIf="isExpanded" (click)="toggleExpansion()" style="min-width: 100%"> 76 <mat-icon>expand_less</mat-icon> 77 </button> 78 <p><button mat-button color="primary" (click)="close()">Затвори</button></p> -
Farmatiko/ClientApp/src/app/dialogs/worker-dialog/worker-dialog.component.ts
r7520f88 r28d7d35 10 10 export class WorkerDialogComponent implements OnInit { 11 11 worker: IHealthcareWorkers; 12 isExpanded: boolean = false; 12 13 13 14 constructor(private dialogRef: MatDialogRef<WorkerDialogComponent>, @Inject(MAT_DIALOG_DATA) data) { … … 22 23 } 23 24 25 toggleExpansion() { 26 this.isExpanded = !this.isExpanded; 27 } 28 24 29 } -
Farmatiko/ClientApp/src/app/home/home.component.css
r7520f88 r28d7d35 2 2 display: flex; 3 3 flex-direction: column; 4 max-height: 500px;5 4 min-width: 300px; 6 5 } … … 27 26 padding: 1em 0; 28 27 } 28 .tableRow:hover { 29 background-color: #D4F2CD; 30 transform: scale(1.0005); 31 } 32 33 h2 button { 34 float: right; 35 padding: 0 5em; 36 } 37 38 #map { 39 height: 100%; 40 } 41 42 .map-frame { 43 border: 2px solid black; 44 height: 100%; 45 } 46 47 .map-wrapper { 48 margin: 0 3em 3em 3em; 49 min-height: 400px; 50 } -
Farmatiko/ClientApp/src/app/home/home.component.html
r7520f88 r28d7d35 14 14 <tr> 15 15 <th>Име</th> 16 <th>Јачина</th>17 16 <th>Форма</th> 18 <th>Начин на издавање</th>19 <th>Производител</th>20 17 <th>Цена</th> 21 <th>Пакување</th>22 18 </tr> 23 19 </thead> 24 20 <tbody> 25 <tr *ngFor="let medicine of filteredMedicines"> 26 <td><a (click)="openMedicineDialog(medicine)">{{ medicine.name }}</a></td> 27 <td>{{ medicine.strength }}</td> 21 <tr *ngFor="let medicine of filteredMedicines" (click)="openMedicineDialog(medicine)" class="tableRow"> 22 <td>{{ medicine.name }}</td> 28 23 <td>{{ medicine.form }}</td> 29 <td>{{ medicine.wayOfIssuing }}</td>30 <td>{{ medicine.manufacturer }}</td>31 24 <td>{{ medicine.price }}</td> 32 <td>{{ medicine.packaging }}</td>33 25 </tr> 34 26 </tbody> … … 39 31 <div class="wrapper"> 40 32 <div class="header"> 41 <h2>Аптеки</h2> 33 <h2>Аптеки 34 <button mat-icon-button color="primary" (click)="refreshMap()" [disabled]="!showMap"> 35 <mat-icon>refresh</mat-icon>Освежи 36 </button> 37 <button mat-icon-button color="accent" [disabled]="clicked" (click)="toggleMap(); clicked = true"> 38 <mat-icon>map</mat-icon>Активирај 39 </button> 40 </h2> 41 <div class="map-wrapper" *ngIf="showMap"> 42 <div class="map-frame"> 43 <div id="map" style="height: 400px;" leaflet [leafletOptions]="options"></div> 44 </div> 45 </div> 46 42 47 <mat-form-field> 43 48 <input matInput (keyup)="applyFilterPharmacies($event.target.value)" placeholder="Пронајди аптека"> … … 49 54 <th>Име</th> 50 55 <th>Локација</th> 51 <th>Адреса</th>52 56 <th>Работи 27/7?</th> 53 57 </tr> 54 58 </thead> 55 59 <tbody> 56 <tr *ngFor="let pharmacy of filteredPharmacies" >57 <td> <a (click)="openPharmacyDialog(pharmacy)">{{ pharmacy.name }}</a></td>60 <tr *ngFor="let pharmacy of filteredPharmacies" (click)="openPharmacyDialog(pharmacy)" class="tableRow"> 61 <td>{{ pharmacy.name }}</td> 58 62 <td>{{ pharmacy.location }}</td> 59 <td >{{ pharmacy.address }}</td>60 <td >{{ pharmacy.workAllTime }}</td>63 <td *ngIf="pharmacy.workAllTime == true">Да</td> 64 <td *ngIf="pharmacy.workAllTime != true">Не</td> 61 65 </tr> 62 66 </tbody> 63 67 </table> 68 64 69 </div> 65 70 </mat-tab> -
Farmatiko/ClientApp/src/app/home/home.component.ts
r7520f88 r28d7d35 5 5 import { MedicineDialogComponent } from '../dialogs/medicine-dialog/medicine-dialog.component'; 6 6 import { PharmacyDialogComponent } from '../dialogs/pharmacy-dialog/pharmacy-dialog.component'; 7 import { latLng, LatLng, tileLayer, marker, icon } from 'leaflet'; 8 import { HttpClient } from '@angular/common/http'; 7 9 8 10 @Component({ … … 16 18 public filteredMedicines: IMedicine[] = []; 17 19 public filteredPharmacies: IPharmacy[] = []; 20 public lat; 21 public lng; 22 clicked = false; 23 showMap: boolean = false; 24 options = { 25 layers: [ 26 tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }) 27 ], 28 zoom: 8, 29 center: latLng(41.61807, 21.74348) 30 } 18 31 19 constructor(private dataService: DataService, private dialog: MatDialog ) {32 constructor(private dataService: DataService, private dialog: MatDialog, private http: HttpClient) { 20 33 21 34 } … … 34 47 }, 35 48 (err: any) => console.log(err), 36 () => console.log('Pharmacy data retrieved')); 49 () => { 50 this.appendPharmacyMarkers(this.pharmacies); 51 console.log('Pharmacy data retrieved'); 52 }); 53 if (navigator.geolocation) { 54 navigator.geolocation.getCurrentPosition((position) => { 55 if (position) { 56 this.lat = position.coords.latitude; 57 this.lng = position.coords.longitude; 58 let layer = marker([ this.lat, this.lng ], { 59 icon: icon({ 60 iconSize: [ 25, 41 ], 61 iconAnchor: [ 13, 41 ], 62 iconUrl: 'assets/home-icon.png' 63 }) 64 }).bindPopup("Вашата локација"); 65 this.options.layers.push(layer); 66 } 67 }); 68 } 37 69 } 70 71 appendPharmacyMarkers(pharmas: IPharmacy[]) { 72 this.options.layers = []; 73 this.options.layers.push(tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'})); 74 if(this.lat && this.lng) { 75 this.options.layers.push(marker([ this.lat, this.lng ], { 76 icon: icon({ 77 iconSize: [ 25, 41 ], 78 iconAnchor: [ 13, 41 ], 79 iconUrl: 'assets/home-icon.png' 80 }) 81 }).bindPopup("Вашата локација")); 82 } 83 pharmas.forEach((pharmacy) => { 84 this.http.get<any>('https://nominatim.openstreetmap.org/search/?country=Macedonia&city='+pharmacy.location+'&street='+pharmacy.address+'&format=json').subscribe(obj => { 85 console.log(obj); 86 if(obj.length) { 87 let layer = marker([ obj[0]?.lat, obj[0]?.lon ], { 88 icon: icon({ 89 iconSize: [ 25, 41 ], 90 iconAnchor: [ 13, 41 ], 91 iconUrl: 'assets/pharmacy-icon.png' 92 }) 93 }).bindPopup("Аптека: "+pharmacy.name); 94 this.options.layers.push(layer); 95 } 96 }, error => console.error(error)); 97 }); 98 } 99 38 100 39 101 applyFilterMedicines(filterValue: string) { … … 60 122 }, 61 123 (err: any) => console.log(err), 62 () => console.log('Pharmacy data retrieved')); 124 () => { 125 this.appendPharmacyMarkers(this.filteredPharmacies); 126 if(this.showMap) { 127 this.showMap = false; 128 setTimeout(() => this.showMap = true, 300); 129 } 130 console.log('Pharmacy data retrieved') 131 }); 63 132 } 64 133 else { 65 134 this.filteredPharmacies = this.pharmacies; 135 this.appendPharmacyMarkers(this.pharmacies); 136 if(this.showMap) { 137 this.showMap = false; 138 setTimeout(() => this.showMap = true, 300); 139 } 66 140 } 67 141 } … … 80 154 }); 81 155 } 156 157 toggleMap() { 158 this.showMap = !this.showMap; 159 } 160 161 refreshMap() { 162 this.showMap = false; 163 setTimeout(() => this.showMap = true, 300); 164 } 165 82 166 } -
Farmatiko/ClientApp/src/app/login/login.component.css
r7520f88 r28d7d35 44 44 justify-content: flex-end; 45 45 } 46 47 .aligner { 48 float: right; 49 padding-left: 2.5em; 50 } -
Farmatiko/ClientApp/src/app/login/login.component.html
r7520f88 r28d7d35 1 1 <div class="wrapper"> 2 2 <mat-card> 3 <mat-card-header><h2>Најава</h2></mat-card-header> 3 <mat-card-header><h2>Најава 4 <div class="aligner"> 5 <button mat-icon-button color="primary" [routerLink]="['/']"> 6 Почетна <mat-icon>home</mat-icon> 7 </button> 8 </div></h2></mat-card-header> 4 9 <mat-card-content> 5 10 <form [formGroup]="loginForm" novalidate> -
Farmatiko/ClientApp/src/app/nav-menu/nav-menu.component.html
r7520f88 r28d7d35 33 33 </mat-menu> 34 34 </li> 35 <li *ngIf="!loggedIn"> 36 <button mat-raised-button color="primary" [routerLink]="['/login']"><mat-icon>account_circle</mat-icon> Најава</button> 37 </li> 35 38 </ul> 36 39 </div> -
Farmatiko/ClientApp/src/app/shared/interfaces.ts
r7520f88 r28d7d35 26 26 price: number; 27 27 packaging: string; 28 headNames?: string[]; 28 29 } 29 30 … … 46 47 address: string; 47 48 workAllTime?: boolean; 49 headName?: string; 48 50 } 49 51
Note:
See TracChangeset
for help on using the changeset viewer.