mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
Merged PR 425: #1314 B2C Geschäftliche Angaben Rechnungsadresse
#1314 B2C Geschäftliche Angaben Rechnungsadresse
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { FormGroup, Validators } from '@angular/forms';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { AbstractControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { PayerCreateComponent } from './payer-create.component';
|
||||
|
||||
@Component({
|
||||
@@ -7,7 +8,29 @@ import { PayerCreateComponent } from './payer-create.component';
|
||||
templateUrl: 'payer-create-b2c.component.html',
|
||||
styleUrls: ['payer-create.component.scss'],
|
||||
})
|
||||
export class PayerCreateB2CComponent extends PayerCreateComponent {
|
||||
export class PayerCreateB2CComponent extends PayerCreateComponent implements OnInit, OnDestroy {
|
||||
formsSubscription: Subscription;
|
||||
|
||||
get organisationGroup(): AbstractControl {
|
||||
return this.control?.get('organisation');
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit();
|
||||
this.formsSubscription = this.organisationGroup?.get('name').valueChanges.subscribe((value: string) => {
|
||||
if (!value) {
|
||||
this.organisationGroup.get('department').reset();
|
||||
this.organisationGroup.get('vatId').reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.formsSubscription) {
|
||||
this.formsSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
initForm(): FormGroup {
|
||||
const fb = this.fb;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { FormGroup, Validators } from '@angular/forms';
|
||||
import { Component, OnDestroy } from '@angular/core';
|
||||
import { AbstractControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { PayerEditComponent } from './payer-edit.component';
|
||||
|
||||
@Component({
|
||||
@@ -7,11 +8,23 @@ import { PayerEditComponent } from './payer-edit.component';
|
||||
templateUrl: 'payer-edit-b2c.component.html',
|
||||
styleUrls: ['payer-edit.component.scss'],
|
||||
})
|
||||
export class PayerEditB2CComponent extends PayerEditComponent {
|
||||
export class PayerEditB2CComponent extends PayerEditComponent implements OnDestroy {
|
||||
formsSubscription: Subscription;
|
||||
|
||||
get organisationGroup(): AbstractControl {
|
||||
return this.control?.get('organisation');
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.formsSubscription) {
|
||||
this.formsSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
async initForm() {
|
||||
const fb = this.fb;
|
||||
let payerDTO = await this.payer$.toPromise();
|
||||
let isDefault = await this.isDefault$.toPromise();
|
||||
const payerDTO = await this.payer$.toPromise();
|
||||
const isDefault = await this.isDefault$.toPromise();
|
||||
|
||||
this.control = fb.group({
|
||||
gender: fb.control(payerDTO?.gender || undefined, [Validators.required]),
|
||||
@@ -34,5 +47,12 @@ export class PayerEditB2CComponent extends PayerEditComponent {
|
||||
isDefault: fb.control(isDefault),
|
||||
});
|
||||
this.cdr.markForCheck();
|
||||
|
||||
this.formsSubscription = this.organisationGroup?.get('name').valueChanges.subscribe((value: string) => {
|
||||
if (!value) {
|
||||
this.organisationGroup.get('department').reset();
|
||||
this.organisationGroup.get('vatId').reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
388
package-lock.json
generated
388
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user