import {Component, Inject} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; import {ScheduleInfo, ScheduleService} from "../../../../api"; import {FormControl, Validators} from "@angular/forms"; @Component({ selector: 'app-stop-schedule-manually', templateUrl: './stop-schedule-manually.component.html', styleUrls: ['./stop-schedule-manually.component.css'] }) export class StopScheduleManuallyComponent { formControl: FormControl = new FormControl('', [Validators.required]) constructor(@Inject(MAT_DIALOG_DATA) public schedule: ScheduleInfo, private scheduleService: ScheduleService, private dialogRef: MatDialogRef) { } cancel() { this.dialogRef.close(); } save() { console.log(this.schedule.scheduleID) this.scheduleService.schedulesScheduleIDStopManualPost(this.schedule.scheduleID, { duration: this.formControl.value }).subscribe({ next: resp => { this.dialogRef.close(Number(this.formControl.value)) } }) } }