File tree Expand file tree Collapse file tree 3 files changed +77
-7
lines changed
government-service/components/representative-list Expand file tree Collapse file tree 3 files changed +77
-7
lines changed Original file line number Diff line number Diff line change @@ -3,20 +3,20 @@ import { BrowserModule } from '@angular/platform-browser';
3
3
4
4
import { AppComponent } from './app.component' ;
5
5
import { HttpClientModule } from "@angular/common/http" ;
6
- import { ApiModule } from "../../build/openapi/governemnt-service" ;
6
+ import { ApiModule , GovernmentRepresentativeService , RepresentativeModel } from "../../build/openapi/governemnt-service" ;
7
7
import { RepresentativeListComponent } from './government-service/components/representative-list/representative-list.component' ;
8
8
9
9
@NgModule ( {
10
10
declarations : [
11
11
AppComponent ,
12
12
RepresentativeListComponent
13
13
] ,
14
- providers : [ ] ,
15
14
imports : [
16
15
BrowserModule ,
17
16
HttpClientModule ,
18
- ApiModule
17
+ ApiModule ,
19
18
] ,
19
+ providers : [ GovernmentRepresentativeService ] ,
20
20
bootstrap : [ AppComponent ]
21
21
} )
22
22
export class AppModule { }
Original file line number Diff line number Diff line change 1
- < p > representative-list works!</ p >
1
+ < div class ="main-content ">
2
+ < div class ="section-content section-content-p30 ">
3
+ < div class ="container-fluid ">
4
+ < div class ="row ">
5
+ <!--loop over the collection of donees-->
6
+ < div *ngFor ="let tempRepresentative of representatives " class ="col-md-3 ">
7
+ < div class ="representative-name-box ">
8
+ < img [src] ="tempRepresentative.image " alt ="{{ tempRepresentative.name}} " class ="img-responsive ">
9
+ < h1 > {{ tempRepresentative.name }}</ h1 >
10
+ < div class ="description ">
11
+ {{ tempRepresentative.jobTitle }}
12
+ </ div >
13
+ < div class ="description ">
14
+ {{ tempRepresentative.government }}
15
+ </ div >
16
+ < div class ="description ">
17
+ {{ tempRepresentative.email }}
18
+ </ div >
19
+ < div class ="description ">
20
+ {{ tempRepresentative.phoneNumber }}
21
+ </ div >
22
+ < div class ="description ">
23
+ {{ tempRepresentative.address }}
24
+ </ div >
25
+ < div class ="description ">
26
+ {{ tempRepresentative.note }}
27
+ </ div >
28
+ < div style ="display: flex; gap: 10px; ">
29
+ < a href ="# " class ="primary-btn "> Módosít</ a >
30
+ < a href ="# " class ="primary-btn "> Töröl</ a >
31
+ </ div >
32
+ </ div >
33
+ </ div >
34
+ </ div >
35
+ </ div >
36
+ </ div >
37
+ </ div >
Original file line number Diff line number Diff line change 1
1
import { Component , OnInit } from '@angular/core' ;
2
- import { GovernmentRepresentativeService } from "../../../../../build/openapi/governemnt-service" ;
2
+ import {
3
+ Availability ,
4
+ GovernmentRepresentativeService
5
+ } from "../../../../../build/openapi/governemnt-service" ;
6
+ import { DomSanitizer , SafeUrl } from "@angular/platform-browser" ;
3
7
4
8
@Component ( {
5
9
selector : 'app-representative-list' ,
@@ -8,9 +12,39 @@ import {GovernmentRepresentativeService} from "../../../../../build/openapi/gove
8
12
} )
9
13
export class RepresentativeListComponent implements OnInit {
10
14
11
- $representatives = this . representativeService . renderAllRepresentatives ( )
12
- constructor ( private readonly representativeService : GovernmentRepresentativeService ) { }
15
+ representatives : SanitizedRepresentativeModel [ ] = [ ] ;
16
+
17
+ constructor ( private readonly representativeService : GovernmentRepresentativeService , private sanitizer : DomSanitizer ) { }
13
18
14
19
ngOnInit ( ) : void {
20
+ this . listRepresentatives ( ) ;
21
+ }
22
+
23
+ private listRepresentatives ( ) {
24
+ this . representativeService . renderAllRepresentatives ( ) . subscribe (
25
+ data => {
26
+ this . representatives = data . map ( representative => ( {
27
+ ...representative ,
28
+ image : this . sanitizer . bypassSecurityTrustUrl ( `data:image/png;base64,${ representative . image } ` )
29
+ } ) ) ;
30
+ }
31
+ ) ;
15
32
}
16
33
}
34
+
35
+ interface SanitizedRepresentativeModel {
36
+ id ?: string ;
37
+ name ?: string ;
38
+ email ?: string ;
39
+ phoneNumber ?: string ;
40
+ address ?: string ;
41
+ image : SafeUrl ;
42
+ jobTitle ?: string ;
43
+ note ?: string ;
44
+ availability ?: Availability ;
45
+ government ?: string ;
46
+ createdAt ?: string ;
47
+ updatedAt ?: string ;
48
+ createdBy ?: string ;
49
+ updatedBy ?: string ;
50
+ }
You can’t perform that action at this time.
0 commit comments