import { Component, Input, OnInit } from '@angular/core'; import { Validators } from '@angular/forms'; import { TypeSafeFormBuilder, TypeSafeFormGroup } from '@yourcause/common'; import { AnalyticsService, EventType } from '@yourcause/common/analytics'; import { YCModalComponent } from '@yourcause/common/modals'; interface ExpeditePaymentFormGroup { name: string; notes: string; } @Component({ selector: 'gc-expedite-payment-modal', templateUrl: './expedite-payment-modal.component.html', styleUrls: ['./expedite-payment-modal.component.scss'] }) export class ExpeditePaymentModalComponent extends YCModalComponent implements OnInit { @Input() paymentId: number; formGroup: TypeSafeFormGroup; constructor ( private formBuilder: TypeSafeFormBuilder, private analyticsService: AnalyticsService ) { super(); } ngOnInit () { this.formGroup = this.formBuilder.group({ name: ['', Validators.required], notes: '' }); } save () { this.closeModal.emit(this.formGroup.value); this.analyticsService.emitEvent({ eventName: 'Expedite payment modal save', eventType: EventType.Click, extras: null }); } }