-
{{ post.createdAt | date:'dd.MM.YYYY hh:mm' }}
-
{{ post.ownerName }}
-
+
+
+
+
{{ post.createdAt | date:'dd.MM.YYYY HH:mm' }}
+
{{ post.ownerName }}
-
-
-
-
-
04.10.2023
-
Jan Hansen
-
-
-
Leider geht er mobil selten dran. Eher E-Mails schicken!
-
+
+
{{ post.headline }}
+
{{ post.message }}
+
-
-
-
-
02.10.2023
-
Florian Eisenmenger
-
-
-
Ich habe mit FAX die besten Erfahrungen gemacht...
-
+
+
+
+
+
{{ comment.createdAt | date:'dd.MM.YYYY HH:mm' }}
+
{{ comment.ownerName }}
+
+
{{ comment.message }}
+
+
-
+
+
+
+ Kommentieren
-
0" class="mb-4" [length]="postsLength"
+ 0" class="mb-4"
+ [pageSizeOptions]="[10,20,30]"
+ [length]="postsLength"
(page)="postsHandlePageEvent($event)"
[pageSize]="postsPageSize"
[pageIndex]="postsPageIndex"
diff --git a/matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.ts b/matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.ts
index ae114a8..ff6b7f9 100644
--- a/matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.ts
+++ b/matsen-tool/src/app/contacts/contacts-detail/contacts-detail.component.ts
@@ -1,6 +1,6 @@
import {AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core';
import {environment} from "@environments/environment";
-import {ContactJsonld, ContactService, PartnerJsonld, PostJsonld, PostService} from "@app/core/api/v1";
+import {CommentJsonld, ContactJsonld, ContactService, PartnerJsonld, PostJsonld, PostService} from "@app/core/api/v1";
import {Subscription} from "rxjs";
import {ActivatedRoute} from "@angular/router";
import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/paginator";
@@ -10,6 +10,9 @@ import {ModalComponent} from "@app/_components/modal/modal.component";
import {NgbModal} from "@ng-bootstrap/ng-bootstrap";
import {NewContactComponent} from "@app/contacts/new-contact/new-contact.component";
import {ModalStatus} from "@app/_helpers/modal.states";
+import {User} from "@app/_models";
+import {AccountService} from "@app/_services";
+import {NewCommentComponent} from "@app/postings/new-comment/new-comment.component";
@Component({
selector: 'app-contacts-detail',
@@ -19,6 +22,8 @@ import {ModalStatus} from "@app/_helpers/modal.states";
export class ContactsDetailComponent implements OnInit, AfterViewInit {
@ViewChild(MatPaginator) postsPaginator: MatPaginator;
+ protected user: User | null;
+
protected readonly environment = environment;
protected contact: ContactJsonld;
protected id: string;
@@ -34,23 +39,25 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit {
constructor(
private contactService: ContactService,
+ private accountService: AccountService,
private route: ActivatedRoute,
private postService: PostService,
private modalService: NgbModal
) {
+ this.user = this.accountService.userValue;
+
this.id = "";
this.contact = {} as ContactJsonld;
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.posts);
this.postsLength = 0;
this.postsPageEvent = new PageEvent();
- this.postsPageSize = 30;
+ this.postsPageSize = 10;
this.postsPageIndex = 0;
}
@@ -59,6 +66,8 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit {
this.id = params['id'];
});
this.getContactData();
+ this.getPostsData();
+ console.log(this.posts);
}
ngAfterViewInit() {
@@ -80,16 +89,14 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit {
getPostsData() {
this.postsSub = this.postService.postsGetCollection(
this.postsPageIndex + 1,
- 10,
- undefined,
- undefined,
+ this.postsPageSize,
+ this.contact.partner + '',
+ [],
this.id
).subscribe(
data => {
- console.log(data);
this.posts = data["hydra:member"];
this.postsLength = Number(data["hydra:totalItems"]);
- this.postsPaginator.length = this.postsLength;
}
);
}
@@ -103,8 +110,53 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit {
}
openModalNewPosting() {
- const modalRef = this.modalService.open(ModalComponent);
- modalRef.componentInstance.dynamicComponent = NewPostingComponent;
+ const modalRefPosting = this.modalService.open(NewPostingComponent);
+ let posting: PostJsonld = {} as PostJsonld;
+ posting.contact = this.contact.id ?? null;
+ posting.partner = this.contact.partner ?? null;
+ modalRefPosting.componentInstance.posting = posting;
+ modalRefPosting.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefPosting.dismiss();
+ this.getPostsData();
+ }
+ });
+ }
+
+ openModalNewComment(post: PostJsonld) {
+ const modalRefComment = this.modalService.open(NewCommentComponent);
+ let comment: CommentJsonld = {} as CommentJsonld;
+ comment.post = post.id ?? null;
+ modalRefComment.componentInstance.comment = comment;
+ modalRefComment.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefComment.dismiss();
+ this.getPostsData();
+ }
+ });
+ }
+
+ openModalEditPosting(post: PostJsonld) {
+ const modalRefPostingEdit = this.modalService.open(NewPostingComponent);
+ modalRefPostingEdit.componentInstance.posting = post;
+ modalRefPostingEdit.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefPostingEdit.dismiss();
+ this.getPostsData();
+ }
+ });
+ }
+
+ openModalEditComment(comment: CommentJsonld) {
+ console.log(comment);
+ const modalRefComment = this.modalService.open(NewCommentComponent);
+ modalRefComment.componentInstance.comment = comment;
+ modalRefComment.componentInstance.submit.subscribe((modalStatus: ModalStatus) => {
+ if (modalStatus === ModalStatus.Submitted) {
+ modalRefComment.dismiss();
+ this.getPostsData();
+ }
+ });
}
openModalEditContact() {
diff --git a/matsen-tool/src/app/layout/two-column/two-column.component.html b/matsen-tool/src/app/layout/two-column/two-column.component.html
index 19c0050..44204e5 100644
--- a/matsen-tool/src/app/layout/two-column/two-column.component.html
+++ b/matsen-tool/src/app/layout/two-column/two-column.component.html
@@ -46,7 +46,9 @@
-
Zurück
-
+
+ Zurück
+
+
\ No newline at end of file
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 2d946ef..18e56c7 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
@@ -157,17 +157,18 @@
-
{{ comment.createdAt | date:'dd.MM.YYYY hh:mm' }}
+
{{ comment.createdAt | date:'dd.MM.YYYY HH:mm' }}
{{ comment.ownerName }}
+
-
Kommentieren
+
Kommentieren