Skip to content

Commit

Permalink
recuperacao3
Browse files Browse the repository at this point in the history
  • Loading branch information
profgonzagas committed Dec 15, 2023
1 parent 46f1192 commit 6873617
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
<main>
<router-outlet></router-outlet>

<br>
<br>
<br>
<br>
<br>




Expand Down
16 changes: 12 additions & 4 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
import { Component, ElementRef, ViewChild, AfterViewInit, OnInit } from '@angular/core';
import * as M from 'materialize-css';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { LocalStorageService } from './local-storage.service'; // Corrigido o caminho de importação

import { ActivatedRoute } from '@angular/router';

@Component({
selector: 'app-root',
Expand All @@ -18,16 +18,18 @@ export class AppComponent implements AfterViewInit {
mostrarResultado: boolean = false;
today: Date = new Date();
username: string = '';


constructor(private fb: FormBuilder, private localStorageService: LocalStorageService) {
constructor(private fb: FormBuilder, private localStorageService: LocalStorageService, private route: ActivatedRoute) {
this.formulario = this.fb.group({
nome: ['', Validators.required],

username: [''],
email: ['', [Validators.required, Validators.email]],
senha: ['', [Validators.required, Validators.pattern(/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/)]],
});
}


onUsernameInput(event: any): void {
this.username = event.target.value.toUpperCase();
}
Expand Down Expand Up @@ -70,7 +72,13 @@ export class AppComponent implements AfterViewInit {

// Limpando o LocalStorage
this.localStorageService.clear();


}







Expand Down
2 changes: 2 additions & 0 deletions src/app/contato/contato.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ <h2>CONTATO</h2>
<br>
<br>
<h1> Logo abaixo são exemplos dos códigos desenvolvidos na Pós em Java:</h1>





Expand Down
41 changes: 40 additions & 1 deletion src/app/sobre/sobre.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,43 @@ <h2>Trabalho com fotografia há 4 anos, desenvolvendo...</h2>
<p>Além da fotografia, também me especializo em serviços como filmagem, edição, utilização de drones para perspectivas únicas e cobertura de eventos especiais. Cada projeto é uma oportunidade de criar algo único e significativo, proporcionando aos clientes lembranças duradouras e impactantes.</p>
<p>Minha missão é não apenas capturar momentos, mas criar experiências visuais que perduram ao longo do tempo. Estou comprometido em oferecer serviços de alta qualidade, personalizados para atender às necessidades individuais de cada cliente.</p>
<p>Se você está procurando um profissional apaixonado pela arte da fotografia, estou aqui para transformar suas ideias em imagens extraordinárias. Obrigado por considerar meu trabalho e estou ansioso para colaborar em seu próximo projeto fotográfico.</p>
</div>
</div>
<br>
<br>
<br>
<br>
<h1>Cadastre-se para receber notícias</h1>
<form [formGroup]="formGroup">
<input id="nome" type="text" class="form-control" formControlName="username" placeholder="Nome">
<div *ngIf="formGroup.get('username')?.errors?.['required'] && formGroup.get('username')?.touched" class="text-danger">
Nome obrigatório
</div>



<input id="username" type="text" class="form-control" formControlName="email" placeholder="Username">
<div *ngIf="formGroup.get('email')?.errors?.['required'] && formGroup.get('email')?.touched" class="text-danger">
Email obrigatório
</div>
<div *ngIf="formGroup.get('email')?.errors?.['pattern']" class="text-danger">
Email inválido
</div>

<input id="email" type="email" class="form-control" formControlName="email" placeholder="Email">
<div *ngIf="formGroup.get('senha')?.errors?.['required'] && formGroup.get('senha')?.touched" class="text-danger">
Senha obrigatória
</div>
<div *ngIf="formGroup.get('senha')?.errors?.['pattern']" class="text-danger">
Senha inválida (mínimo de 8 caracteres, pelo menos uma letra e um número)
</div>

<input id="senha" type="password" class="form-control" formControlName="senha" placeholder="Senha">
<button [disabled]="!formGroup.valid" (click)="cadastrarUsuario()">
Cadastre-se1
</button>

<div *ngIf="mostrarResultado">
<p>Resultado do LocalStorage: {{ resultadoLocalStorage | json }}</p>
</div>
</form>

85 changes: 83 additions & 2 deletions src/app/sobre/sobre.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,91 @@
import { Component } from '@angular/core';
// Importações necessárias do Angular
import { Component, ElementRef, ViewChild, AfterViewInit, NgModule } from '@angular/core';
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule } from '@angular/forms';

// Importações específicas do seu projeto
import { LocalStorageService } from '../local-storage.service';
import { ActivatedRoute } from '@angular/router';
import * as M from 'materialize-css';

@Component({
selector: 'app-sobre',
templateUrl: './sobre.component.html',
styleUrls: ['./sobre.component.css']
})
export class SobreComponent {
export class SobreComponent implements AfterViewInit {
@ViewChild('mobile') sideNav?: ElementRef;
title = 'gestaofotografo';
formGroup: FormGroup;
resultadoLocalStorage: any;
mostrarResultado: boolean = false;
today: Date = new Date();
username: string = '';
inputname: string = '';


constructor(
private fb: FormBuilder,
private localStorageService: LocalStorageService,
private route: ActivatedRoute
) {
this.formGroup = this.fb.group({
username: new FormControl('', Validators.required),
email: new FormControl('', [Validators.required, Validators.email]),
senha: new FormControl('', [Validators.required, Validators.pattern(/^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/)]),
});
}

onUsernameInput(event: any): void {
this.username = event.target.value.toUpperCase();
}

TransferData(name: any): void {
this.inputname = name;
}

ngAfterViewInit(): void {
if (this.sideNav) {
const sidenavInstance = M.Sidenav.init(this.sideNav.nativeElement);
}
}

cadastrarUsuario(): void {
const dadosUsuario = this.formGroup.value;
this.localStorageService.set('usuario', dadosUsuario);
this.resultadoLocalStorage = dadosUsuario;
this.mostrarResultado = true;
}

testLocalStorage(): void {
// Testando o serviço LocalStorage
const key = 'exemplo';
const value = { mensagem: 'Isso é um exemplo.' };

// Setando no LocalStorage
this.localStorageService.set(key, value);

// Obtendo do LocalStorage
const resultado = this.localStorageService.get(key);
console.log('Resultado do LocalStorage:', resultado);

// Armazenando o resultado para exibição no HTML
this.resultadoLocalStorage = resultado;

// Exibindo o resultado no HTML
this.mostrarResultado = true;

// Removendo do LocalStorage
this.localStorageService.remove(key);

// Limpando o LocalStorage
this.localStorageService.clear();
}
}

@NgModule({
imports: [CommonModule, ReactiveFormsModule],
declarations: [SobreComponent],
})
export class SobreModule { }

0 comments on commit 6873617

Please sign in to comment.