import { Component, OnInit } from "@angular/core";
import { FormControl, FormGroup, Validators } from "@angular/forms";
import { AddAction } from "../../models/add-action.enum";
import { ServiceComm } from "../../services/service-comm.service";

@Component({
  selector: "app-new-jump-type",
  templateUrl: "./new-jump-type.component.html",
  styleUrls: ["./new-jump-type.component.css"]
})
export class NewJumpTypeComponent implements OnInit {
  public addForm: FormGroup;

  constructor(private serviceComm: ServiceComm) {
    this.addForm = new FormGroup({
      jumptypeName: new FormControl("", Validators.required)
    });
  }

  ngOnInit() {}

  onSubmit(formData) {
    console.log(formData.status);
    console.warn("New data : ", formData);

    this.serviceComm.RefreshData(AddAction.Gear);
    this.addForm.reset();
  }
}
