import { Component, Input, OnInit } from '@angular/core'; import { Validators } from '@angular/forms'; import { CreateOpenBatchModalResponse } from '@core/typings/payment.typing'; import { TypeSafeFormBuilder, TypeSafeFormGroup } from '@yourcause/common'; import { AnalyticsService, EventType } from '@yourcause/common/analytics'; import { YCModalComponent } from '@yourcause/common/modals'; interface BatchGroup { name: string; notes: string; externalBatchId: string; } @Component({ selector: 'gc-create-open-batch-modal', templateUrl: './create-open-batch-modal.component.html', styleUrls: ['./create-open-batch-modal.component.scss'] }) export class CreateOpenBatchModalComponent extends YCModalComponent implements OnInit { @Input() isExternal = false; formGroup: TypeSafeFormGroup; constructor ( private formBuilder: TypeSafeFormBuilder, private analyticsService: AnalyticsService ) { super(); } ngOnInit () { this.formGroup = this.formBuilder.group({ name: ['', Validators.required], notes: [''], externalBatchId: '' }); } save () { this.closeModal.emit(this.formGroup.value); this.analyticsService.emitEvent({ eventName: 'Create open batch modal save', eventType: EventType.Click, extras: null }); } }