diff --git a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration-request-form.component.html b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration-request-form.component.html new file mode 100644 index 0000000000000000000000000000000000000000..440c5df943e2039bdeafe35874100fb8698a125d --- /dev/null +++ b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration-request-form.component.html @@ -0,0 +1,12 @@ +<form [formGroup]="formService.form"> + <ods-text-editor + label="Titel" + [formControlName]="formServiceClass.FIELD_TITLE" + [isRequired]="true" + ></ods-text-editor> + <ods-textarea-editor + label="Nachricht" + [formControlName]="formServiceClass.FIELD_NACHRICHT" + [isRequired]="true" + ></ods-textarea-editor> +</form> diff --git a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration-request-form.component.spec.ts b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration-request-form.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..7d9a65d558231b860cfc674d52f80b79bc8b66c3 --- /dev/null +++ b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration-request-form.component.spec.ts @@ -0,0 +1,39 @@ +import { Mock, mock } from '@alfa-client/test-utils'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ReactiveFormsModule } from '@angular/forms'; +import { TextEditorComponent, TextareaEditorComponent } from '@ods/component'; +import { MockComponent } from 'ng-mocks'; +import { CollaborationRequestFormComponent } from './collaboration-request-form.component'; +import { CollaborationRequestFormService } from './collaboration.request.formservice'; + +describe('CollaborationRequestFormComponent', () => { + let component: CollaborationRequestFormComponent; + let fixture: ComponentFixture<CollaborationRequestFormComponent>; + + const formService: Mock<CollaborationRequestFormService> = mock(CollaborationRequestFormService); + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ReactiveFormsModule], + declarations: [ + CollaborationRequestFormComponent, + MockComponent(TextEditorComponent), + MockComponent(TextareaEditorComponent), + ], + providers: [ + { + provide: CollaborationRequestFormService, + useValue: formService, + }, + ], + }).compileComponents(); + + fixture = TestBed.createComponent(CollaborationRequestFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration-request-form.component.ts b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration-request-form.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..682db1d4f83289c061ff5d733745a42947915530 --- /dev/null +++ b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration-request-form.component.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; +import { CollaborationRequestFormService } from './collaboration.request.formservice'; + +@Component({ + selector: 'alfa-collaboration-request-form', + templateUrl: './collaboration-request-form.component.html', + providers: [CollaborationRequestFormService], +}) +export class CollaborationRequestFormComponent { + constructor(readonly formService: CollaborationRequestFormService) {} + + public readonly formServiceClass = CollaborationRequestFormService; +} diff --git a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration.request.formservice.spec.ts b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration.request.formservice.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..7f76f28a47ec441ac67defcb897a2abc557390bb --- /dev/null +++ b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration.request.formservice.spec.ts @@ -0,0 +1,16 @@ +import { UntypedFormBuilder } from '@angular/forms'; +import { CollaborationRequestFormService } from './collaboration.request.formservice'; + +describe('CollaborationRequestFormService', () => { + let formService: CollaborationRequestFormService; + + const formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); + + beforeEach(() => { + formService = new CollaborationRequestFormService(formBuilder); + }); + + it('should create', () => { + expect(formService).toBeTruthy(); + }); +}); diff --git a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration.request.formservice.ts b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration.request.formservice.ts new file mode 100644 index 0000000000000000000000000000000000000000..2cb39040c5fdd34ae2d77138aba820a89ae4e17c --- /dev/null +++ b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration.request.formservice.ts @@ -0,0 +1,30 @@ +import { CommandResource } from '@alfa-client/command-shared'; +import { AbstractFormService, EMPTY_STRING, StateResource } from '@alfa-client/tech-shared'; +import { Injectable } from '@angular/core'; +import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms'; +import { Observable, of } from 'rxjs'; + +@Injectable() +export class CollaborationRequestFormService extends AbstractFormService { + public static readonly FIELD_TITLE = 'titel'; + public static readonly FIELD_NACHRICHT = 'nachricht'; + + constructor(formBuilder: UntypedFormBuilder) { + super(formBuilder); + } + + protected initForm(): UntypedFormGroup { + return this.formBuilder.group({ + [CollaborationRequestFormService.FIELD_TITLE]: new UntypedFormControl(null), + [CollaborationRequestFormService.FIELD_NACHRICHT]: new UntypedFormControl(null), + }); + } + + protected doSubmit(): Observable<StateResource<CommandResource>> { + return of(); + } + + protected getPathPrefix(): string { + return EMPTY_STRING; + } +} diff --git a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/zustaendige-stelle-container.component.html b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/zustaendige-stelle-container.component.html index 6e905e5ef08a3ffc8043d3083fc528018fdeb1d5..afd66214af8ab4ffd7e8e7694820b5406874d5c0 100644 --- a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/zustaendige-stelle-container.component.html +++ b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/zustaendige-stelle-container.component.html @@ -7,6 +7,9 @@ ICON_PLATZHALTER <ods-save-icon icon class="fill-text"></ods-save-icon> </ods-button> +<alfa-collaboration-request-form></alfa-collaboration-request-form> + +<ods-button text="Zuarbeit anfragen" data-test-id="zuarbeit-anfragen-button"></ods-button> <ods-button variant="outline" text="Abbrechen" diff --git a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/zustaendige-stelle-container.component.spec.ts b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/zustaendige-stelle-container.component.spec.ts index 44b14427ee5bf2bb5ec1ad38c90fe6426fa90b86..17bb7ec95072ba953347eee4b456b99ecbd15e68 100644 --- a/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/zustaendige-stelle-container.component.spec.ts +++ b/alfa-client/libs/collaboration/src/lib/collaboration-in-vorgang-container/zustaendige-stelle-container/zustaendige-stelle-container.component.spec.ts @@ -3,6 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ButtonComponent, CloseIconComponent, SaveIconComponent } from '@ods/system'; import { getDataTestIdOf } from 'libs/tech-shared/test/data-test'; import { MockComponent } from 'ng-mocks'; +import { CollaborationRequestFormComponent } from './collaboration-request-form/collaboration-request-form.component'; import { ZustaendigeStelleContainerComponent } from './zustaendige-stelle-container.component'; describe('ZustaendigeStelleContainerComponent', () => { @@ -18,6 +19,7 @@ describe('ZustaendigeStelleContainerComponent', () => { ZustaendigeStelleContainerComponent, MockComponent(SaveIconComponent), MockComponent(CloseIconComponent), + MockComponent(CollaborationRequestFormComponent), ], }).compileComponents(); diff --git a/alfa-client/libs/collaboration/src/lib/collaboration.module.ts b/alfa-client/libs/collaboration/src/lib/collaboration.module.ts index a73ec83dde3bf2b9dd7da59e4d98adf876ccc31b..6bd22a196d15a35333d5061c10382888e7da03de 100644 --- a/alfa-client/libs/collaboration/src/lib/collaboration.module.ts +++ b/alfa-client/libs/collaboration/src/lib/collaboration.module.ts @@ -1,6 +1,8 @@ import { CollaborationSharedModule } from '@alfa-client/collaboration-shared'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { TextEditorComponent, TextareaEditorComponent } from '@ods/component'; import { ButtonComponent, CloseIconComponent, @@ -8,6 +10,7 @@ import { SaveIconComponent, } from '@ods/system'; import { CollaborationInVorgangContainerComponent } from './collaboration-in-vorgang-container/collaboration-in-vorgang-container.component'; +import { CollaborationRequestFormComponent } from './collaboration-in-vorgang-container/zustaendige-stelle-container/collaboration-request-form/collaboration-request-form.component'; import { ZustaendigeStelleContainerComponent } from './collaboration-in-vorgang-container/zustaendige-stelle-container/zustaendige-stelle-container.component'; @NgModule({ @@ -18,8 +21,16 @@ import { ZustaendigeStelleContainerComponent } from './collaboration-in-vorgang- CloseIconComponent, CollaborationSharedModule, CollaborationIconComponent, + TextEditorComponent, + TextareaEditorComponent, + FormsModule, + ReactiveFormsModule, + ], + declarations: [ + CollaborationInVorgangContainerComponent, + ZustaendigeStelleContainerComponent, + CollaborationRequestFormComponent, ], - declarations: [CollaborationInVorgangContainerComponent, ZustaendigeStelleContainerComponent], exports: [CollaborationInVorgangContainerComponent], }) export class CollaborationModule {} diff --git a/alfa-client/package-lock.json b/alfa-client/package-lock.json index 986f8539663f4c42b3f2e4cf04bc7cb7d945515a..6f74aee054bb6dd8cf0188cb27a4e8c4ce1b78b5 100644 --- a/alfa-client/package-lock.json +++ b/alfa-client/package-lock.json @@ -79,7 +79,6 @@ "@storybook/core-server": "^8.1.4", "@swc-node/register": "1.9.1", "@swc/core": "~1.5.7", - "@swc/helpers": "~0.5.2", "@testing-library/jest-dom": "6.4.5", "@types/file-saver": "2.0.7", "@types/jest": "29.4.4", @@ -15268,7 +15267,8 @@ "version": "0.5.12", "resolved": "http://nexus.ozg-sh.de/repository/npm-proxy/@swc/helpers/-/helpers-0.5.12.tgz", "integrity": "sha512-KMZNXiGibsW9kvZAO1Pam2JPTDBm+KSHMMHWdsyI/1DbIZjT2A6Gy3hblVXUMEDvUAKq+e0vL0X0o54owWji7g==", - "devOptional": true, + "optional": true, + "peer": true, "dependencies": { "tslib": "^2.4.0" }