diff --git a/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.html b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.html
new file mode 100644
index 00000000..995bd807
--- /dev/null
+++ b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.html
@@ -0,0 +1,12 @@
+
\ No newline at end of file
diff --git a/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.scss b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.scss
new file mode 100644
index 00000000..fa438f72
--- /dev/null
+++ b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.scss
@@ -0,0 +1,7 @@
+.mat-stepper-vertical {
+ margin-top: 8px;
+}
+
+.mat-mdc-form-field {
+ margin-top: 16px;
+}
\ No newline at end of file
diff --git a/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.spec.ts b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.spec.ts
new file mode 100644
index 00000000..b8e55f5a
--- /dev/null
+++ b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ReceiverInputComponent } from './receiver-input.component';
+
+describe('ReceiverInputComponent', () => {
+ let component: ReceiverInputComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [ReceiverInputComponent]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(ReceiverInputComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.ts b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.ts
new file mode 100644
index 00000000..cd6cb36c
--- /dev/null
+++ b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-input/receiver-input.component.ts
@@ -0,0 +1,46 @@
+import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
+import { ReactiveFormsModule, FormControl } from '@angular/forms';
+import { MatInputModule } from '@angular/material/input';
+import { Observable, map, startWith } from 'rxjs';
+import { AsyncPipe } from '@angular/common';
+import { MatAutocompleteModule } from '@angular/material/autocomplete';
+
+@Component({
+ selector: 'receiver-input',
+ standalone: true,
+ imports: [
+ MatInputModule,
+ MatAutocompleteModule,
+ ReactiveFormsModule,
+ AsyncPipe
+ ],
+ templateUrl: './receiver-input.component.html',
+ styleUrl: './receiver-input.component.scss'
+})
+export class ReceiverInputComponent implements OnInit, OnChanges {
+ ngOnInit(): void {
+ this.setupFiltering();
+ }
+
+ ngOnChanges(changes: SimpleChanges): void {
+ if (changes['options']) {
+ this.setupFiltering();
+ }
+ }
+
+ control = new FormControl('');
+ filteredOptions!: Observable;
+
+ @Input() options: string[] = [];
+ @Input() filter: (value: string) => string[] = value => {
+ const filterValue = value.toLowerCase();
+ return this.options.filter(option => option.toLowerCase().includes(filterValue));
+ }
+
+ private setupFiltering(): void {
+ this.filteredOptions = this.control.valueChanges.pipe(
+ startWith(''),
+ map(value => this.filter(value || '')),
+ );
+ }
+}
\ No newline at end of file
diff --git a/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.html b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.html
index c063b33e..72b9f258 100644
--- a/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.html
+++ b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.html
@@ -1,21 +1,8 @@
-
| Email |
-
-
+
|
diff --git a/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.scss b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.scss
index fa438f72..e69de29b 100644
--- a/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.scss
+++ b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.scss
@@ -1,7 +0,0 @@
-.mat-stepper-vertical {
- margin-top: 8px;
-}
-
-.mat-mdc-form-field {
- margin-top: 16px;
-}
\ No newline at end of file
diff --git a/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.ts b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.ts
index 9bdcb423..13387b71 100644
--- a/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.ts
+++ b/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/src/app/components/receiver-table/receiver-table.component.ts
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
-import { Validators, FormsModule, ReactiveFormsModule, FormControl } from '@angular/forms';
+import { FormsModule, ReactiveFormsModule, FormControl } from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
import { MatTableModule } from '@angular/material/table';
import { Observable } from 'rxjs';
@@ -8,9 +8,10 @@ import { AsyncPipe } from '@angular/common';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatFormFieldModule } from '@angular/material/form-field';
import { ReceiverService } from '../../services/receiver.service'
+import { ReceiverInputComponent } from '../receiver-input/receiver-input.component';
@Component({
- selector: 'receiver-input',
+ selector: 'receiver-table',
standalone: true,
imports: [
MatTableModule,
@@ -19,7 +20,8 @@ import { ReceiverService } from '../../services/receiver.service'
MatInputModule,
MatAutocompleteModule,
ReactiveFormsModule,
- AsyncPipe
+ AsyncPipe,
+ ReceiverInputComponent
],
templateUrl: './receiver-table.component.html',
styleUrl: './receiver-table.component.scss'
@@ -29,32 +31,17 @@ export class ReceiverTableComponent implements OnInit {
constructor(private receiverService: ReceiverService) { }
async ngOnInit() {
- this.receiverService.getReceiver().subscribe({
- next: (receivers) => {
- this.options = receivers.map((r: any) => r.emailAddress);
-
- this.filteredOptions = this.control.valueChanges.pipe(
- startWith(''),
- map(value => {
- console.log(value);
- return this._filter(value || '');
- }),
- );
- }
- })
+ this.receiver_mails = await this.receiverService.getReceiverAsync().then((receivers: any[]) => receivers.map(r => r.emailAddress));
}
- typeControl = new FormControl('Mietvertrag', [Validators.required]);
-
control = new FormControl('');
- options: string[] = [];
+ receiver_mails: string[] = [];
filteredOptions!: Observable;
-
- private _filter(value: string): string[] {
+ receiver_filter(value: string): string[] {
const filterValue = value.toLowerCase();
- return this.options.filter(option => option.toLowerCase().includes(filterValue));
+ return this.receiver_mails.filter(option => option.toLowerCase().includes(filterValue));
}
//table
@@ -63,5 +50,4 @@ export class ReceiverTableComponent implements OnInit {
];
displayedColumns: string[] = ['email', 'name', 'accessCode'];
-
}