From a8daffdfd677e641823c36a9c793fba508d9afdf Mon Sep 17 00:00:00 2001 From: jordanPena Date: Thu, 14 Mar 2019 00:20:58 -0300 Subject: [PATCH] =?UTF-8?q?#10=20#21=20-=20incluindo=20valida=C3=A7=C3=A3o?= =?UTF-8?q?=20nos=20campos=20do=20formul=C3=A1rio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/home/home.component.html | 60 ++++++++++++++++---------------- src/app/home/home.component.ts | 28 ++++++++++++--- 2 files changed, 54 insertions(+), 34 deletions(-) diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 6ab3c57..14b9159 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -82,30 +82,27 @@
Coordenador responsável
- - - - - - - + *ngIf="registrationSteps != 1 && registrationSteps != 'step4'" + (click)="backStep();">Voltar + + Passo {{ registrationSteps }}/4. diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 521cc66..39b3803 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -27,6 +27,8 @@ export class HomeComponent implements OnInit { public modalRef: BsModalRef; public customPatterns = {'0': { pattern: new RegExp('\[0-9\]')}}; + + //Validators.pattern(new RegExp('^1234$')) public formCadastro: FormGroup; @@ -39,19 +41,19 @@ export class HomeComponent implements OnInit { razaoSocial: new FormControl(''), atividadePrincipal: new FormControl(''), areaAtuacao: new FormControl('selecione', [Validators.required]), - sigla: new FormControl('', [Validators.required]), - nomeFantasia: new FormControl(''), + sigla: new FormControl('', [Validators.required, Validators.minLength(3), Validators.maxLength(10)]), + nomeFantasia: new FormControl('', [Validators.required, Validators.minLength(2), Validators.maxLength(125)]), email: new FormControl('', [Validators.required, Validators.email]), lat: new FormControl(''), lng: new FormControl(''), receita: new FormControl(''), responsavel: new FormGroup({ uid: new FormControl(''), - nome: new FormControl('', [Validators.required]), + nome: new FormControl('', [Validators.required, Validators.minLength(3), Validators.maxLength(125)]), cpf: new FormControl(''), emailResponsavel: new FormControl('', [Validators.required, Validators.email]), senha: new FormControl(''), - senhaOk: new FormControl('', [Validators.required]) + senhaOk: new FormControl('', [Validators.required, Validators.minLength(4), Validators.maxLength(125)]) }) }); } @@ -167,6 +169,24 @@ console.log(this.formCadastro) } + validaSelecioneAreaAtuacao(){ + return { + 'is-invalid': this.formCadastro.get('areaAtuacao').touched && this.formCadastro.get('areaAtuacao').value == 'selecione' + } + } + + aplicaCSSerro(campo: string){ + return { + 'is-invalid': this.formCadastro.get(campo).touched && !this.formCadastro.get(campo).valid + } + } + + aplicaCSSerroInputsResponsavel(campo: string){ + return { + 'is-invalid': this.formCadastro.controls['responsavel'].get(campo).touched && !this.formCadastro.controls['responsavel'].get(campo).valid + } + } + // test envio e-mail Cloud Functions firebase enviaEmail() { this.EnviaEmailService.sendEmail();