Changeset 1db5673 for Farmatiko/ClientApp/src/app
- Timestamp:
- 11/14/20 12:27:30 (4 years ago)
- Branches:
- master
- Children:
- 68454c6
- Parents:
- ad60966
- Location:
- Farmatiko/ClientApp/src/app
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Farmatiko/ClientApp/src/app/admin/admin.component.html
rad60966 r1db5673 76 76 <input matInput [(ngModel)]="this.head.Passwd"> 77 77 </mat-form-field><br> 78 <button onclick="createHead()" mat-raised-button color="primary">Create</button>78 <button (click)="createHead()" mat-raised-button color="primary">Create</button> 79 79 </div> 80 80 </mat-tab> -
Farmatiko/ClientApp/src/app/dashboard/dashboard.component.ts
rad60966 r1db5673 43 43 44 44 claimPharmacy(pharmacy: IPharmacy) { 45 if(pharmacy && !this.head.Pharmacy.find(x => x === pharmacy)) { 46 this.request = null; 47 this.request.Pharmacy = pharmacy; 48 this.request.PharmacyHead = this.head; 49 this.dataService.claimPharmacy(this.request) 50 .subscribe((req: IPharmacyHeadRequest) => { 51 if(req) { 52 this.openSnackBar("Claiming request sent!", "OK"); 53 } 54 else { 55 this.openSnackBar("Unable to send a request", "Try again"); 56 } 57 }, 58 (err: any) => console.log(err), 59 () => console.log('Claiming request sent!')); 45 if(this.head.Pharmacy != null) { 46 if(pharmacy && !this.head.Pharmacy.find(x => x === pharmacy)) { 47 this.request = {}; 48 this.request.Pharmacy = pharmacy; 49 this.request.PharmacyHead = this.head; 50 this.dataService.claimPharmacy(this.request) 51 .subscribe((req) => { 52 if(req) { 53 this.openSnackBar("Claiming request sent!", "OK"); 54 } 55 else { 56 this.openSnackBar("Unable to send a request", "Try again"); 57 } 58 }, 59 (err: any) => console.log(err), 60 () => console.log('Claiming request sent!')); 61 } 62 } 63 else { 64 if(pharmacy) { 65 this.request = {}; 66 this.request.Pharmacy = pharmacy; 67 this.request.PharmacyHead = this.head; 68 this.dataService.claimPharmacy(this.request) 69 .subscribe((req) => { 70 if(req) { 71 this.openSnackBar("Claiming request sent!", "OK"); 72 } 73 else { 74 this.openSnackBar("Unable to send a request", "Try again"); 75 } 76 }, 77 (err: any) => console.log(err), 78 () => console.log('Claiming request sent!')); 79 } 60 80 } 61 81 } -
Farmatiko/ClientApp/src/app/login/login.component.ts
rad60966 r1db5673 54 54 .subscribe( 55 55 (data) => { 56 if(data.role == 'Admin') {56 if(data.role === 'Admin') { 57 57 this.router.navigate(['/admin']); 58 58 } -
Farmatiko/ClientApp/src/app/shared/data.service.ts
rad60966 r1db5673 6 6 7 7 import { IHealthFacilities, IHealthcareWorkers, IMedicine, IPandemic, IPharmacy, IPharmacyHead, IPharmacyHeadRequest } from './interfaces'; 8 import { environment } from '../../environments/environment'; 8 9 9 10 @Injectable() 10 11 export class DataService { 11 baseFacilitiesUrl: string = '/api/facilities';12 baseWorkersUrl: string = '/api/workers';13 baseMedicineUrl: string = '/api/medicines';14 basePandemicUrl: string = '/api/pandemic';15 basePharmacyUrl: string = '/api/pharmacy';16 basePharmacyHead: string = '/api/pharmacyhead';12 baseFacilitiesUrl: string = `${environment.baseApiUrl}api/facilities`; 13 baseWorkersUrl: string = `${environment.baseApiUrl}api/workers`; 14 baseMedicineUrl: string = `${environment.baseApiUrl}api/medicines`; 15 basePandemicUrl: string = `${environment.baseApiUrl}api/pandemic`; 16 basePharmacyUrl: string = `${environment.baseApiUrl}api/pharmacy`; 17 basePharmacyHead: string = `${environment.baseApiUrl}api/pharmacyhead`; 17 18 18 19 constructor(private http: HttpClient) { … … 179 180 //PharmacyHead PUT 180 181 updatePharmacyHead(head: IPharmacyHead) : Observable<IPharmacyHead> { 181 return this.http.put<IPharmacyHead>(this.basePharmacyHead + '/' + head.id, head)182 return this.http.put<IPharmacyHead>(this.basePharmacyHead, head) 182 183 .pipe( 183 184 map((data) => { -
Farmatiko/ClientApp/src/app/shared/interfaces.ts
rad60966 r1db5673 57 57 originalUserName?: string; 58 58 Role?: string; 59 } 60 59 } 61 60 export interface IPharmacyHeadRequest { 62 61 id?: string; -
Farmatiko/ClientApp/src/app/shared/services/auth.service.ts
rad60966 r1db5673 9 9 10 10 interface LoginResult { 11 user name: string;11 userName: string; 12 12 role: string; 13 13 originalUserName?: string; … … 36 36 this.http.get<LoginResult>(`${this.apiUrl}/user`).subscribe((x) => { 37 37 this._user.next({ 38 Email: x.user name,38 Email: x.userName, 39 39 Passwd: x.head.Passwd, 40 40 Role: x.role, … … 64 64 map((x) => { 65 65 this._user.next({ 66 Email: x.user name,66 Email: x.userName, 67 67 Passwd: x.head.Passwd, 68 68 Role: x.role, … … 105 105 map((x) => { 106 106 this._user.next({ 107 Email: x.user name,107 Email: x.userName, 108 108 Passwd: x.head.Passwd, 109 109 Role: x.role,
Note:
See TracChangeset
for help on using the changeset viewer.