| @@ -1,4 +1,5 @@ | |||
| npm run generate:api | |||
| find ./src/app/core/api/v1/model -type f -exec sed -i '' -e '' -e "s/hydramember/'hydra:member'/g" {} + | |||
| find ./src/app/core/api/v1/model -type f -exec sed -i '' -e '' -e "s/hydratotalItems/'hydra:totalItems'/g" {} + | |||
| find ./src/app/core/api/v1/model -type f -exec sed -i '' -e "s/hydraview/'hydra:view'/g" {} + | |||
| @@ -795,6 +795,58 @@ paths: | |||
| style: form | |||
| explode: false | |||
| allowReserved: false | |||
| - | |||
| name: partner | |||
| in: query | |||
| description: '' | |||
| required: false | |||
| deprecated: false | |||
| allowEmptyValue: true | |||
| schema: | |||
| type: string | |||
| style: form | |||
| explode: false | |||
| allowReserved: false | |||
| - | |||
| name: 'partner[]' | |||
| in: query | |||
| description: '' | |||
| required: false | |||
| deprecated: false | |||
| allowEmptyValue: true | |||
| schema: | |||
| type: array | |||
| items: | |||
| type: string | |||
| style: form | |||
| explode: true | |||
| allowReserved: false | |||
| - | |||
| name: contact | |||
| in: query | |||
| description: '' | |||
| required: false | |||
| deprecated: false | |||
| allowEmptyValue: true | |||
| schema: | |||
| type: string | |||
| style: form | |||
| explode: false | |||
| allowReserved: false | |||
| - | |||
| name: 'contact[]' | |||
| in: query | |||
| description: '' | |||
| required: false | |||
| deprecated: false | |||
| allowEmptyValue: true | |||
| schema: | |||
| type: array | |||
| items: | |||
| type: string | |||
| style: form | |||
| explode: true | |||
| allowReserved: false | |||
| deprecated: false | |||
| post: | |||
| operationId: api_posts_post | |||
| @@ -1239,6 +1291,7 @@ components: | |||
| format: iri-reference | |||
| example: 'https://example.com/' | |||
| imageUrl: | |||
| readOnly: true | |||
| type: | |||
| - string | |||
| - 'null' | |||
| @@ -1304,6 +1357,7 @@ components: | |||
| format: iri-reference | |||
| example: 'https://example.com/' | |||
| imageUrl: | |||
| readOnly: true | |||
| type: | |||
| - string | |||
| - 'null' | |||
| @@ -1383,6 +1437,7 @@ components: | |||
| format: iri-reference | |||
| example: 'https://example.com/' | |||
| imageUrl: | |||
| readOnly: true | |||
| type: | |||
| - string | |||
| - 'null' | |||
| @@ -1522,6 +1577,7 @@ components: | |||
| format: iri-reference | |||
| example: 'https://example.com/' | |||
| logoUrl: | |||
| readOnly: true | |||
| type: | |||
| - string | |||
| - 'null' | |||
| @@ -1593,6 +1649,7 @@ components: | |||
| format: iri-reference | |||
| example: 'https://example.com/' | |||
| logoUrl: | |||
| readOnly: true | |||
| type: | |||
| - string | |||
| - 'null' | |||
| @@ -1678,6 +1735,7 @@ components: | |||
| format: iri-reference | |||
| example: 'https://example.com/' | |||
| logoUrl: | |||
| readOnly: true | |||
| type: | |||
| - string | |||
| - 'null' | |||
| @@ -1697,8 +1755,13 @@ components: | |||
| description: '' | |||
| deprecated: false | |||
| required: | |||
| - headline | |||
| - message | |||
| properties: | |||
| headline: | |||
| type: | |||
| - string | |||
| - 'null' | |||
| message: | |||
| type: | |||
| - string | |||
| @@ -1710,6 +1773,11 @@ components: | |||
| - 'null' | |||
| format: iri-reference | |||
| example: 'https://example.com/' | |||
| ownerName: | |||
| readOnly: true | |||
| type: | |||
| - string | |||
| - 'null' | |||
| partner: | |||
| anyOf: | |||
| - | |||
| @@ -1733,6 +1801,7 @@ components: | |||
| description: '' | |||
| deprecated: false | |||
| required: | |||
| - headline | |||
| - message | |||
| properties: | |||
| _links: | |||
| @@ -1744,6 +1813,10 @@ components: | |||
| href: | |||
| type: string | |||
| format: iri-reference | |||
| headline: | |||
| type: | |||
| - string | |||
| - 'null' | |||
| message: | |||
| type: | |||
| - string | |||
| @@ -1755,6 +1828,11 @@ components: | |||
| - 'null' | |||
| format: iri-reference | |||
| example: 'https://example.com/' | |||
| ownerName: | |||
| readOnly: true | |||
| type: | |||
| - string | |||
| - 'null' | |||
| partner: | |||
| anyOf: | |||
| - | |||
| @@ -1778,6 +1856,7 @@ components: | |||
| description: '' | |||
| deprecated: false | |||
| required: | |||
| - headline | |||
| - message | |||
| properties: | |||
| '@context': | |||
| @@ -1803,6 +1882,10 @@ components: | |||
| '@type': | |||
| readOnly: true | |||
| type: string | |||
| headline: | |||
| type: | |||
| - string | |||
| - 'null' | |||
| message: | |||
| type: | |||
| - string | |||
| @@ -1814,6 +1897,11 @@ components: | |||
| - 'null' | |||
| format: iri-reference | |||
| example: 'https://example.com/' | |||
| ownerName: | |||
| readOnly: true | |||
| type: | |||
| - string | |||
| - 'null' | |||
| partner: | |||
| anyOf: | |||
| - | |||
| @@ -104,13 +104,17 @@ export class PostService { | |||
| * Retrieves the collection of Post resources. | |||
| * @param page The collection page number | |||
| * @param itemsPerPage The number of items per page | |||
| * @param partner | |||
| * @param partner2 | |||
| * @param contact | |||
| * @param contact2 | |||
| * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. | |||
| * @param reportProgress flag to report request and response progress. | |||
| */ | |||
| public postsGetCollection(page?: number, itemsPerPage?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<ApiPostsGetCollection200Response>; | |||
| public postsGetCollection(page?: number, itemsPerPage?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpResponse<ApiPostsGetCollection200Response>>; | |||
| public postsGetCollection(page?: number, itemsPerPage?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpEvent<ApiPostsGetCollection200Response>>; | |||
| public postsGetCollection(page?: number, itemsPerPage?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<any> { | |||
| public postsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, contact?: string, contact2?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<ApiPostsGetCollection200Response>; | |||
| public postsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, contact?: string, contact2?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpResponse<ApiPostsGetCollection200Response>>; | |||
| public postsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, contact?: string, contact2?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<HttpEvent<ApiPostsGetCollection200Response>>; | |||
| public postsGetCollection(page?: number, itemsPerPage?: number, partner?: string, partner2?: Array<string>, contact?: string, contact2?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/ld+json' | 'application/json' | 'text/html' | 'application/hal+json', context?: HttpContext}): Observable<any> { | |||
| let localVarQueryParameters = new HttpParams({encoder: this.encoder}); | |||
| if (page !== undefined && page !== null) { | |||
| @@ -121,6 +125,26 @@ export class PostService { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>itemsPerPage, 'itemsPerPage'); | |||
| } | |||
| if (partner !== undefined && partner !== null) { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>partner, 'partner'); | |||
| } | |||
| if (partner2) { | |||
| partner2.forEach((element) => { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>element, 'partner[]'); | |||
| }) | |||
| } | |||
| if (contact !== undefined && contact !== null) { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>contact, 'contact'); | |||
| } | |||
| if (contact2) { | |||
| contact2.forEach((element) => { | |||
| localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | |||
| <any>element, 'contact[]'); | |||
| }) | |||
| } | |||
| let localVarHeaders = this.defaultHeaders; | |||
| @@ -20,7 +20,7 @@ export interface Contact { | |||
| partner?: string | null; | |||
| birthday?: string | null; | |||
| image?: string | null; | |||
| imageUrl?: string | null; | |||
| readonly imageUrl?: string | null; | |||
| position?: string | null; | |||
| phone?: string | null; | |||
| email?: string | null; | |||
| @@ -22,7 +22,7 @@ export interface ContactJsonhal { | |||
| partner?: string | null; | |||
| birthday?: string | null; | |||
| image?: string | null; | |||
| imageUrl?: string | null; | |||
| readonly imageUrl?: string | null; | |||
| position?: string | null; | |||
| phone?: string | null; | |||
| email?: string | null; | |||
| @@ -23,7 +23,7 @@ export interface ContactJsonld { | |||
| partner?: string | null; | |||
| birthday?: string | null; | |||
| image?: string | null; | |||
| imageUrl?: string | null; | |||
| readonly imageUrl?: string | null; | |||
| position?: string | null; | |||
| phone?: string | null; | |||
| email?: string | null; | |||
| @@ -24,7 +24,7 @@ export interface Partner { | |||
| country?: string | null; | |||
| website?: string | null; | |||
| logo?: string | null; | |||
| logoUrl?: string | null; | |||
| readonly logoUrl?: string | null; | |||
| createdAt?: string | null; | |||
| contacts?: Array<string>; | |||
| } | |||
| @@ -26,7 +26,7 @@ export interface PartnerJsonhal { | |||
| country?: string | null; | |||
| website?: string | null; | |||
| logo?: string | null; | |||
| logoUrl?: string | null; | |||
| readonly logoUrl?: string | null; | |||
| createdAt?: string | null; | |||
| contacts?: Array<string>; | |||
| } | |||
| @@ -26,7 +26,7 @@ export interface PartnerJsonld { | |||
| country?: string | null; | |||
| website?: string | null; | |||
| logo?: string | null; | |||
| logoUrl?: string | null; | |||
| readonly logoUrl?: string | null; | |||
| createdAt?: string | null; | |||
| contacts?: Array<string>; | |||
| } | |||
| @@ -17,8 +17,10 @@ import { Contact } from './contact'; | |||
| * | |||
| */ | |||
| export interface Post { | |||
| headline: string | null; | |||
| message: string | null; | |||
| owner?: string | null; | |||
| readonly ownerName?: string | null; | |||
| partner?: Partner | null; | |||
| contact?: Contact | null; | |||
| readonly createdAt?: string | null; | |||
| @@ -19,8 +19,10 @@ import { PartnerJsonhal } from './partnerJsonhal'; | |||
| */ | |||
| export interface PostJsonhal { | |||
| _links?: ContactJsonhalLinks; | |||
| headline: string | null; | |||
| message: string | null; | |||
| owner?: string | null; | |||
| readonly ownerName?: string | null; | |||
| partner?: PartnerJsonhal | null; | |||
| contact?: ContactJsonhal | null; | |||
| readonly createdAt?: string | null; | |||
| @@ -20,8 +20,10 @@ export interface PostJsonld { | |||
| context?: string | null; | |||
| readonly id?: string; | |||
| readonly type?: string; | |||
| headline: string | null; | |||
| message: string | null; | |||
| owner?: string | null; | |||
| readonly ownerName?: string | null; | |||
| partner?: PartnerJsonld | null; | |||
| contact?: ContactJsonld | null; | |||
| readonly createdAt?: string | null; | |||
| @@ -130,89 +130,24 @@ | |||
| <h2>Notizen</h2> | |||
| <button>Neue Notiz</button> | |||
| </div> | |||
| <div class="post mb-3"> | |||
| <div class="card"> | |||
| <div class="card-body"> | |||
| <div class="d-flex justify-content-between align-items-center"> | |||
| <p>12.10.2023</p> | |||
| <p>Jan Hansen</p> | |||
| </div> | |||
| <div> | |||
| <h3>Neues Tool nutzen</h3> | |||
| <p>Immer alles hier rein schreiben!</p> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="d-flex justify-content-end"> | |||
| <a routerLink="#" class="badge bg-secondary">Kommentieren</a> | |||
| </div> | |||
| </div> | |||
| <div class="post mb-3"> | |||
| <div class="card"> | |||
| <div class="card-body"> | |||
| <div class="d-flex justify-content-between align-items-center"> | |||
| <p>01.10.2023</p> | |||
| <p>Jan Hansen</p> | |||
| </div> | |||
| <div> | |||
| <h3>Konditionen</h3> | |||
| <p>Wir gewähren immer 10% Rabatt bei Bestellungen über 20.000 €.</p> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="card ms-5"> | |||
| <div class="card-body"> | |||
| <div class="d-flex justify-content-between align-items-center"> | |||
| <p>02.10.2023</p> | |||
| <p>Daniel Knudsen</p> | |||
| </div> | |||
| <div> | |||
| <p>Achja! Gut zu wissen!</p> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="d-flex justify-content-end"> | |||
| <a routerLink="#" class="badge bg-secondary">Kommentieren</a> | |||
| </div> | |||
| </div> | |||
| <div class="post mb-3"> | |||
| <div class="card"> | |||
| <div class="card-body"> | |||
| <div class="d-flex justify-content-between align-items-center"> | |||
| <p>12.09.2023</p> | |||
| <p>Florian Eisenmenger</p> | |||
| </div> | |||
| <div> | |||
| <h3>Ausland - Schwer erreichbar</h3> | |||
| <p>Peter Müller ist der Chef, aber schwer erreichbar. Am besten Mobil probieren!</p> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="card ms-5"> | |||
| <div class="card-body"> | |||
| <div class="d-flex justify-content-between align-items-center"> | |||
| <p>04.10.2023</p> | |||
| <p>Jan Hansen</p> | |||
| </div> | |||
| <div> | |||
| <p>Leider geht er mobil selten dran. Eher E-Mails schicken!</p> | |||
| <div *ngFor="let post of posts"> | |||
| <div class="post mb-3"> | |||
| <div class="card"> | |||
| <div class="card-body"> | |||
| <div class="d-flex justify-content-between align-items-center"> | |||
| <p>{{ post.createdAt | date:'dd.MM.YYYY hh:mm' }}</p> | |||
| <p>{{ post.ownerName }}</p> | |||
| </div> | |||
| <div> | |||
| <h3>{{ post.headline }}</h3> | |||
| <p>{{ post.message }}</p> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="card ms-5"> | |||
| <div class="card-body"> | |||
| <div class="d-flex justify-content-between align-items-center"> | |||
| <p>02.10.2023</p> | |||
| <p>Florian Eisenmenger</p> | |||
| </div> | |||
| <div> | |||
| <p>Ich habe mit FAX die besten Erfahrungen gemacht...</p> | |||
| </div> | |||
| <div class="d-flex justify-content-end"> | |||
| <a routerLink="#" class="badge bg-secondary">Kommentieren</a> | |||
| </div> | |||
| </div> | |||
| <div class="d-flex justify-content-end"> | |||
| <a routerLink="#" class="badge bg-secondary">Kommentieren</a> | |||
| </div> | |||
| </div> | |||
| <mat-paginator class="mb-4" [length]="postsLength" | |||
| (page)="postsHandlePageEvent($event)" | |||
| @@ -3,7 +3,7 @@ import {NgbModal} from "@ng-bootstrap/ng-bootstrap"; | |||
| import {ModalComponent} from "@app/_components/modal/modal.component"; | |||
| import {NewContactComponent} from "@app/partners/new-contact/new-contact.component"; | |||
| import {ActivatedRoute, Router} from "@angular/router"; | |||
| import {ContactJsonld, ContactService, PartnerJsonld, PartnerService} from "@app/core/api/v1"; | |||
| import {ContactJsonld, ContactService, PartnerJsonld, PartnerService, PostJsonld, PostService} from "@app/core/api/v1"; | |||
| import {Subscription} from "rxjs"; | |||
| import {environment} from "@environments/environment"; | |||
| import {ApiConverter} from "@app/_helpers/api.converter"; | |||
| @@ -25,24 +25,24 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| protected partnerDetailSub: Subscription; | |||
| protected partner: PartnerJsonld; | |||
| protected partnerLogoSub: Subscription; | |||
| protected partnerLogo: string | null | undefined; | |||
| protected partnerContactsSub: Subscription; | |||
| protected contactsSub: Subscription; | |||
| protected contacts: Array<ContactJsonld>; | |||
| protected contactsDataSource; | |||
| protected contactsLength: number; | |||
| protected contactsPageEvent: PageEvent; | |||
| protected contactsPageSize: number; | |||
| protected contactsPageIndex: number; | |||
| //protected posts: Array<PostJsonld>; | |||
| protected tasksDataSource; | |||
| protected tasksLength: number; | |||
| protected tasksPageEvent: PageEvent; | |||
| protected tasksPageSize: number; | |||
| protected tasksPageIndex: number; | |||
| protected postsSub: Subscription; | |||
| protected posts: Array<PostJsonld>; | |||
| protected postsDataSource; | |||
| protected postsLength: number; | |||
| protected postsPageEvent: PageEvent; | |||
| @@ -56,16 +56,15 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| private modalService: NgbModal, | |||
| private route: ActivatedRoute, | |||
| private partnerService: PartnerService, | |||
| private contactService: ContactService | |||
| private contactService: ContactService, | |||
| private postService: PostService | |||
| ) { | |||
| this.id = ""; | |||
| this.partnerDetailSub = new Subscription(); | |||
| this.partner = {} as PartnerJsonld; | |||
| this.partnerLogoSub = new Subscription(); | |||
| this.partnerLogo = ""; | |||
| this.partnerContactsSub = new Subscription(); | |||
| this.contacts = []; | |||
| this.contactsSub = new Subscription(); | |||
| this.contacts = []; | |||
| this.contactsPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype); | |||
| this.contactsDataSource = new MatTableDataSource<ContactJsonld>(this.contacts); | |||
| this.contactsLength = 0; | |||
| @@ -82,6 +81,8 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| this.tasksPageIndex = 0; | |||
| // TODO: Change Jsonld | |||
| this.postsSub = new Subscription(); | |||
| this.posts = []; | |||
| this.postsPaginator = new MatPaginator(new MatPaginatorIntl(), ChangeDetectorRef.prototype); | |||
| this.postsDataSource = new MatTableDataSource<ContactJsonld>(this.contacts); | |||
| this.postsLength = 0; | |||
| @@ -99,7 +100,9 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| this.route.params.subscribe(params => { | |||
| this.id = params['id']; | |||
| }); | |||
| this.getData(); | |||
| this.getPartnerData(); | |||
| this.getContactsData(); | |||
| this.getPostsData(); | |||
| } | |||
| ngAfterViewInit() { | |||
| @@ -108,24 +111,41 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| this.postsDataSource.paginator = this.postsPaginator; | |||
| } | |||
| getData() { | |||
| getPartnerData() { | |||
| this.partnerDetailSub = this.partnerService.partnersIdGet( | |||
| this.id | |||
| ).subscribe( | |||
| data => { | |||
| this.partner = data; | |||
| } | |||
| ); | |||
| } | |||
| this.partnerContactsSub = this.contactService.contactsGetCollection( | |||
| this.contactsPageIndex + 1, | |||
| 6, | |||
| ApiConverter.extractId(this.partner.id) | |||
| ).subscribe( | |||
| data => { | |||
| this.contacts = data["hydra:member"]; | |||
| this.contactsLength = Number(data["hydra:totalItems"]); | |||
| this.contactsPaginator.length = this.contactsLength; | |||
| } | |||
| ) | |||
| getContactsData() { | |||
| this.contactsSub = this.contactService.contactsGetCollection( | |||
| this.contactsPageIndex + 1, | |||
| 6, | |||
| this.id | |||
| ).subscribe( | |||
| data => { | |||
| this.contacts = data["hydra:member"]; | |||
| this.contactsLength = Number(data["hydra:totalItems"]); | |||
| this.contactsPaginator.length = this.contactsLength; | |||
| } | |||
| ); | |||
| } | |||
| getPostsData() { | |||
| this.postsSub = this.postService.postsGetCollection( | |||
| this.postsPageIndex + 1, | |||
| 10, | |||
| this.id | |||
| ).subscribe( | |||
| data => { | |||
| console.log(data); | |||
| this.posts = data["hydra:member"]; | |||
| this.postsLength = Number(data["hydra:totalItems"]); | |||
| this.postsPaginator.length = this.contactsLength; | |||
| } | |||
| ); | |||
| } | |||
| @@ -135,7 +155,7 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| this.contactsLength = e.length; | |||
| this.contactsPageIndex = e.pageIndex.valueOf(); | |||
| this.contactsPageSize = e.pageSize.valueOf(); | |||
| this.getData(); | |||
| this.getContactsData(); | |||
| } | |||
| tasksHandlePageEvent(e: PageEvent) { | |||
| @@ -151,7 +171,7 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { | |||
| this.postsLength = e.length; | |||
| this.postsPageIndex = e.pageIndex.valueOf(); | |||
| this.postsPageSize = e.pageSize.valueOf(); | |||
| // this.getData(); | |||
| this.getPostsData(); | |||
| } | |||
| navigateToContactDetails(element: any) { | |||