cic-staff-client/src/app/pages/settings/invite/invite.component.ts

34 lines
858 B
TypeScript
Raw Normal View History

2020-11-25 08:59:48 +01:00
import { Component, OnInit } from '@angular/core';
2021-02-08 12:47:07 +01:00
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {CustomErrorStateMatcher} from '@app/_helpers';
2020-11-25 08:59:48 +01:00
@Component({
selector: 'app-invite',
templateUrl: './invite.component.html',
styleUrls: ['./invite.component.scss']
})
export class InviteComponent implements OnInit {
2021-02-08 12:47:07 +01:00
inviteForm: FormGroup;
submitted: boolean = false;
matcher = new CustomErrorStateMatcher();
2020-11-25 08:59:48 +01:00
2021-02-08 12:47:07 +01:00
constructor(
private formBuilder: FormBuilder
) { }
2020-11-25 08:59:48 +01:00
ngOnInit(): void {
2021-02-08 12:47:07 +01:00
this.inviteForm = this.formBuilder.group({
email: ['', Validators.required],
role: ['', Validators.required]
});
2020-11-25 08:59:48 +01:00
}
2021-02-08 12:47:07 +01:00
get inviteFormStub(): any { return this.inviteForm.controls; }
invite(): void {
this.submitted = true;
if (this.inviteForm.invalid) { return; }
this.submitted = false;
}
2020-11-25 08:59:48 +01:00
}