diff --git a/matsen-tool/src/app/_components/modal/modal.component.html b/matsen-tool/src/app/_components/modal/modal.component.html index 1bf5593..3ac6f29 100644 --- a/matsen-tool/src/app/_components/modal/modal.component.html +++ b/matsen-tool/src/app/_components/modal/modal.component.html @@ -3,7 +3,7 @@ + diff --git a/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts b/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts index 3d4d915..bd0b00f 100644 --- a/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts +++ b/matsen-tool/src/app/contacts/new-contact/new-contact.component.ts @@ -3,21 +3,24 @@ import {FormGroup} from "@angular/forms"; import {contactForm} from "@app/_forms/apiForms"; import {ContactJsonld, ContactService} from "@app/core/api/v1"; import {Subscription} from "rxjs"; +import {ModalContent} from "@app/_interfaces/modalContent"; + @Component({ selector: 'app-new-contact', templateUrl: './new-contact.component.html', styleUrl: './new-contact.component.scss' }) -export class NewContactComponent implements OnInit { - @Input() contactId: number | undefined; +export class NewContactComponent implements ModalContent, OnInit { + + @Input() public inputData: any; protected contactForm: FormGroup; protected selectedImage: File | null; protected contactSub: Subscription; constructor( - private contactService: ContactService + private contactService: ContactService, ) { this.contactForm = contactForm; this.selectedImage = null; @@ -25,20 +28,20 @@ export class NewContactComponent implements OnInit { this.contactSub = new Subscription(); } - ngOnInit() { - console.log(this.contactId); - } - - getData(meineId: any) { - console.log(meineId); + ngOnInit(): void { + console.log(this.inputData); } onSubmit() { + //console.log(this.partnerId); if (this.contactForm.valid) { // Hier können Sie die Daten senden oder weitere Aktionen durchführen console.log(this.selectedImage); console.log('Formular wurde gesendet:', this.contactForm.value); + let newContact: ContactJsonld = this.contactForm.value as ContactJsonld; + newContact.postings = []; + this.contactSub = this.contactService.contactsPost( this.contactForm.value as ContactJsonld ).subscribe( diff --git a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts index 9491fef..e8d21c4 100644 --- a/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts +++ b/matsen-tool/src/app/partners/partners-detail/partners-detail.component.ts @@ -11,6 +11,7 @@ import {MatPaginator, MatPaginatorIntl, PageEvent} from "@angular/material/pagin import {MatTableDataSource} from "@angular/material/table"; import {NewPostingComponent} from "@app/postings/new-posting/new-posting.component"; import {NewTaskComponent} from "@app/tasks/new-task/new-task.component"; +import {NewPartnerComponent} from "@app/partners/new-partner/new-partner.component"; @Component({ selector: 'app-partners-detail', @@ -95,16 +96,14 @@ export class PartnersDetailComponent implements OnInit, AfterViewInit { openModalNewContact() { const modalRef = this.modalService.open(ModalComponent); - const newContactComponentInstance = new NewContactComponent(this.contactService); - newContactComponentInstance.contactId = 3; - // const newContactComponentInstance = modalRef.componentInstance.dynamicComponent = new NewContactComponent(this.contactService); - //newContactComponentVar.getData(3); - modalRef.componentInstance.dynamicComponent = newContactComponentInstance; + modalRef.componentInstance.dynamicComponent = NewContactComponent; + modalRef.componentInstance.inputData = ModalComponent.createInputData(this.partner.id); } openModalNewPosting() { const modalRef = this.modalService.open(ModalComponent); modalRef.componentInstance.dynamicComponent = NewPostingComponent; + } openModalNewTask() {