From a6953ed792f093c0bbb013e9af5b81b64480d4ee Mon Sep 17 00:00:00 2001 From: Florian Eisenmenger Date: Thu, 15 Feb 2024 10:42:39 +0100 Subject: [PATCH] pagination - contactsdetail --- .../contacts-detail.component.html | 125 ++++++------------ .../contacts-detail.component.ts | 34 ++++- .../partners-detail.component.html | 26 +++- .../partners-detail.component.ts | 2 +- .../src/app/partners/partners.component.ts | 3 +- 5 files changed, 96 insertions(+), 94 deletions(-) diff --git a/matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.html b/matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.html index b65b909..d7ed3a3 100644 --- a/matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.html +++ b/matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.html @@ -1,21 +1,22 @@
-

{{contact.firstName}} {{contact.lastName}}

+

{{ contact.firstName }} {{ contact.lastName }}

Position:
-
{{contact.position}}
+
{{ contact.position }}
Telefon:
-
{{contact.phone}}
+
{{ contact.phone }}
E-Mail:
-
{{contact.email}}
+
{{ contact.email }}
Geburtstag:
-
{{contact.birthday | date:'dd.MM.YYYY'}}
+
{{ contact.birthday | date:'dd.MM.YYYY' }}
- {{contact.firstName}} {{contact.lastName}} + {{contact.firstName}} {{contact.lastName}}
@@ -25,92 +26,48 @@

Notizen

-
-
-
-
-

12.10.2023

-

Jan Hansen

-
-
-

Neues Tool nutzen

-

Immer alles hier rein schreiben!

+
+
+
+
+
+

{{ post.createdAt | date:'dd.MM.YYYY hh:mm' }}

+

{{ post.ownerName }}

+
+
+

{{ post.headline }}

+

{{ post.message }}

+
-
- -
-
-
-
-
-

01.10.2023

-

Jan Hansen

-
-
-

Konditionen

-

Wir gewähren immer 10% Rabatt bei Bestellungen über 20.000 €.

+
+
+
+

04.10.2023

+

Jan Hansen

+
+
+

Leider geht er mobil selten dran. Eher E-Mails schicken!

+
-
-
-
-
-

02.10.2023

-

Daniel Knudsen

-
-
-

Achja! Gut zu wissen!

+
+
+
+

02.10.2023

+

Florian Eisenmenger

+
+
+

Ich habe mit FAX die besten Erfahrungen gemacht...

+
-
- -
-
-
-
-
-

12.09.2023

-

Florian Eisenmenger

-
-
-

Ausland - Schwer erreichbar

-

Peter Müller ist der Chef, aber schwer erreichbar. Am besten Mobil probieren!

-
-
-
-
-
-
-

04.10.2023

-

Jan Hansen

-
-
-

Leider geht er mobil selten dran. Eher E-Mails schicken!

-
+
-
-
-
-

02.10.2023

-

Florian Eisenmenger

-
-
-

Ich habe mit FAX die besten Erfahrungen gemacht...

-
-
-
-
- ; protected postsDataSource; protected postsLength: number; protected postsPageEvent: PageEvent; @@ -27,7 +29,8 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit { constructor( private contactService: ContactService, - private route: ActivatedRoute + private route: ActivatedRoute, + private postService: PostService ) { this.id = ""; this.contact = {} as ContactJsonld; @@ -35,8 +38,10 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit { this.contactSub = new Subscription(); // TODO: Change Jsonld + this.postsSub = new Subscription(); + this.posts = []; this.postsPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype); - this.postsDataSource = new MatTableDataSource; //(this.contacts) + this.postsDataSource = new MatTableDataSource(this.posts); this.postsLength = 0; this.postsPageEvent = new PageEvent(); this.postsPageSize = 30; @@ -47,14 +52,14 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit { this.route.params.subscribe(params => { this.id = params['id']; }); - this.getData(); + this.getContactData(); } ngAfterViewInit() { this.postsDataSource.paginator = this.postsPaginator; } - getData() { + getContactData() { // switch over this.dataType (customers, etc.) this.contactSub = this.contactService.contactsIdGet( this.id @@ -65,11 +70,28 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit { ); } + getPostsData() { + this.postsSub = this.postService.postsGetCollection( + this.postsPageIndex + 1, + 10, + undefined, + undefined, + this.id + ).subscribe( + data => { + console.log(data); + this.posts = data["hydra:member"]; + this.postsLength = Number(data["hydra:totalItems"]); + this.postsPaginator.length = this.postsLength; + } + ); + } + postsHandlePageEvent(e: PageEvent) { this.postsPageEvent = e; this.postsLength = e.length; this.postsPageIndex = e.pageIndex.valueOf(); this.postsPageSize = e.pageSize.valueOf(); - // this.getData(); + this.getPostsData(); } } diff --git a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html index 281d8b6..6089edf 100644 --- a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html +++ b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.html @@ -55,7 +55,7 @@ Details
-
+
+
+
+

04.10.2023

+

Jan Hansen

+
+
+

Leider geht er mobil selten dran. Eher E-Mails schicken!

+
+
+
+
+
+
+

02.10.2023

+

Florian Eisenmenger

+
+
+

Ich habe mit FAX die besten Erfahrungen gemacht...

+
+
+
-