Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 2x 2x 2x 2x 7x 7x 7x 7x 7x 7x 7x 7x 7x 3x 3x 3x 4x 7x 6x | import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { FormlyFieldConfig } from '@ngx-formly/core'; import { PaymentMethod } from 'ish-core/models/payment-method/payment-method.model'; @Component({ selector: 'ish-payment-parameter-form', templateUrl: './payment-parameter-form.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class PaymentParameterFormComponent implements OnInit, OnChanges { @Input({ required: true }) parentForm: FormGroup; @Input({ required: true }) paymentMethod: PaymentMethod; @Input() submitDisabled: boolean; /** * should be set to true by the parent, if component is visible */ @Input() activated = false; @Output() cancelPayment = new EventEmitter(); @Output() submitPayment = new EventEmitter(); fields: FormlyFieldConfig[]; model: { [key: string]: unknown } = {}; form = new FormGroup({}); ngOnInit() { this.fields = []; this.paymentMethod.parameters.forEach(param => this.fields.push({ ...param })); this.fields.forEach(field => { if (field.key === 'IBAN') { field.props.mask = 'UU00 AAAA 0000 0009 9999 9999 9999 9999 99'; field.props.placeholder = 'XX00 0000 0000 000'; // max length of IBAN is 34, but the 8 spaces of the mask must be added field.props.maxLength = 42; } else Iif (field.key === 'BIC') { field.props.mask = 'AAAAAAAA||AAAAAAAAAAA'; } this.model[field.key as string] = field.props?.options ? undefined : ''; }); } /** * load concardis script if component is shown */ ngOnChanges() { Iif (this.paymentMethod && this.activated) { this.parentForm.setControl('parameters', this.form); } } cancelNewPaymentInstrument() { this.cancelPayment.emit(); } submitParameterForm() { this.submitPayment.emit(); } } |