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