35 lines
961 B
TypeScript
35 lines
961 B
TypeScript
import { UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms";
|
|
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
|
|
|
export interface ContactSupportPersist{
|
|
subject: string,
|
|
description: string;
|
|
}
|
|
|
|
export interface PublicContactSupportPersist{
|
|
fullName: string,
|
|
email: string,
|
|
affiliation: string;
|
|
message: string
|
|
}
|
|
|
|
export class ContactEmailFormModel implements ContactSupportPersist{
|
|
subject: string;
|
|
description: string;
|
|
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
|
|
|
|
fromModel(item: ContactSupportPersist): ContactEmailFormModel {
|
|
this.subject = item.subject;
|
|
this.description = item.description;
|
|
return this;
|
|
}
|
|
|
|
buildForm(): UntypedFormGroup {
|
|
const formGroup = new UntypedFormBuilder().group({
|
|
subject: [this.subject, [Validators.required]],
|
|
description: [this.description, [Validators.required]]
|
|
});
|
|
return formGroup;
|
|
}
|
|
}
|