\ No newline at end of file
diff --git a/frontend/main/src/app/edit/edit.component.ts b/frontend/main/src/app/edit/edit.component.ts
index 5fba7ea..7c0e0ca 100644
--- a/frontend/main/src/app/edit/edit.component.ts
+++ b/frontend/main/src/app/edit/edit.component.ts
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
+import { LoginserviceService } from '../loginservice.service';
@Component({
selector: 'app-edit',
@@ -18,15 +19,25 @@ password!:string
constructor(
- private router:Router
+ private router:Router,
+ private login: LoginserviceService
) { }
ngOnInit(): void {
+
+this.user= this.login.user
+this.name= this.login.nome
+this.birth= this.login.birth
+this.document= this.login.document
+this.email= this.login.email
+this.password = this.login.password
+
}
- alterar(index:number){
+ alterar(){
+ alert("Funcionou!!!")
//this.edit.splice()
}
diff --git a/frontend/main/src/app/insight/insight.component.html b/frontend/main/src/app/insight/insight.component.html
index 936871e..6bf3143 100644
--- a/frontend/main/src/app/insight/insight.component.html
+++ b/frontend/main/src/app/insight/insight.component.html
@@ -4,6 +4,7 @@
+
{{countPackages}}
New packages
@@ -18,7 +19,6 @@
-
12%
Bounce Rate
@@ -50,7 +50,7 @@
{{countClient}}
-
{{countVisitors/2}}
+
{{countVisitors}}
Visitors
@@ -287,4 +287,4 @@
-
\ No newline at end of file
+
diff --git a/frontend/main/src/app/insight/insight.component.ts b/frontend/main/src/app/insight/insight.component.ts
index 25ce337..9fddf9c 100644
--- a/frontend/main/src/app/insight/insight.component.ts
+++ b/frontend/main/src/app/insight/insight.component.ts
@@ -11,29 +11,36 @@ import { Observable } from 'rxjs';
})
export class InsightComponent implements OnInit {
- readonly TMSLoginAPI: string = "http://localhost:8080/user/countClients"
+ readonly APICountUsers: string = "http://localhost:8080/user/countClients"
- readonly apiURL:string = "http://localhost:8080/user/countVisitors"
+ readonly APICountVisits:string = "http://localhost:8080/user/countVisitors"
+
+ readonly APICountPackages:string = "http://localhost:8080/quote/go"
countClient!: number
countVisitors!: number
+ countPackages!:number
+
+ constructor(private router:Router, private http:HttpClient) {
- constructor(private router:Router, private http:HttpClient) {
-
}
ngOnInit(): void {
- this.http.get(this.TMSLoginAPI)
+ this.http.get(this.APICountUsers)
.subscribe((resultado:any) => {
this.countClient=resultado
});
- this.http.get(this.apiURL)
+ this.http.get(this.APICountVisits)
.subscribe((resultado:any) => {
this.countVisitors=resultado
});
+ this.http.get(this.APICountPackages)
+ .subscribe((response:any)=>{
+ this.countPackages=response
+ })
}
@@ -48,7 +55,7 @@ export class InsightComponent implements OnInit {
// countClients() {
// this.http.get(`${this.TMSLoginAPI}/countClients`).subscribe(resultado => console.log(resultado));
// return ;
-
+
// }
// countVisitors(){
// this.http.get(`${this.apiURL}/countVisitors`).subscribe(resultado => console.log(resultado));
diff --git a/frontend/main/src/app/login/login.component.ts b/frontend/main/src/app/login/login.component.ts
index 5ec4416..4545f57 100644
--- a/frontend/main/src/app/login/login.component.ts
+++ b/frontend/main/src/app/login/login.component.ts
@@ -30,22 +30,16 @@ export class LoginComponent implements OnInit {
}
submit():void{
+
if(this.user != null && this.password != null){
+
this.loginService.logging(this.user, this.password)
- .pipe()
- .subscribe((response:any)=>{
- console.log('Running...', response)
- if(response == ""){
- this.loginService.progress = false;
- alert("USUARIO OU SENHA ERRADOS")
- }else{
- this.loginService.succeed = true
- this.gotoHome()
- }
- });
+
}else{
+
alert('DIGITE TODOS OS CAMPOS OBRIGATÓRIOS!')
this.loginService.progress = false
+
}
}
@@ -95,7 +89,7 @@ export class LoginComponent implements OnInit {
this.http.get(this.TMSLoginAPI+'/user/'+ID)
.subscribe((response:any)=>{
console.log(response);
- this.loginService.user = response.nome
+ this.loginService.nome = response.nome
})
},500)
diff --git a/frontend/main/src/app/loginservice.service.ts b/frontend/main/src/app/loginservice.service.ts
index 065e399..656cd3c 100644
--- a/frontend/main/src/app/loginservice.service.ts
+++ b/frontend/main/src/app/loginservice.service.ts
@@ -8,15 +8,33 @@ import { LoginComponent } from './login/login.component';
@Injectable({
providedIn: 'root'
})
+
export class LoginserviceService implements CanActivate {
- user!: string
readonly TMSLoginAPI: string = "http://localhost:8080"
+ readonly APIBounceInit: string = "http://localhost:8080/login/init"
+
+ //DADOS BÁSICOS
+ nome!: string
+ user!: string
+ email!: string
+ password!: string
+ birth!: Date
+ document!: string
+
+ //DADOS DE CONTROLE
succeed!: boolean
- progress: boolean = false
- admin:boolean = false
- enterprise:boolean = false
- pessoaID!:number
+ progress!: boolean
+ admin!: boolean
+ enterprise!: boolean
+ pessoaID!: number
+ adminEnter:boolean = false
+
+ //DADOS ESTATÍSTICOS
+ idBounce!: number
+ userBounce!: string
+ dateBounce!: string
+ timeBounce!: string
constructor(private router: Router, private http: HttpClient) { }
@@ -24,9 +42,9 @@ export class LoginserviceService implements CanActivate {
this.progress = true
- let build:any = {
- 'user':user,
- 'senha':password
+ let build: any = {
+ 'user': user,
+ 'senha': password
}
this.http.post(this.TMSLoginAPI +'/login', build)
@@ -37,46 +55,77 @@ export class LoginserviceService implements CanActivate {
})
)
.subscribe((response:any)=>{
+
+ this.admin = response[0].admin
+ this.enterprise = response[0].enterprise
+
+ if(this.admin == true){
+ this.adminEnter = true;
+ if(this.enterprise == true){
+ this.adminEnter = true
+ }
+ }
+
+ if(response == ""){
+ this.progress = false;
+ alert("USUARIO OU SENHA ERRADOS")
+ }else{
+ this.succeed = true
+ new LoginComponent(this.router, this, this.http).gotoHome();
+ }
+
this.http.get(this.TMSLoginAPI+'/user/'+response[0].pessoa_id)
.subscribe((resp:any) =>{
console.log(resp);
- this.user = resp.nome
- this.admin = resp.admin
- this.enterprise = resp.enterprise
+ this.nome = resp.nome
this.pessoaID = response[0].pessoa_id
+ this.birth = resp.birth
+ this.document = resp.document
+ this.email = resp.email
+ this.password = response[0].senha
})
- return response
- })
- return this.http.post(this.TMSLoginAPI +'/login', build)
+ let bounce: any = {
+ "user": response[0].user
+ }
+
+ this.http.post(this.APIBounceInit, bounce)
+ .subscribe((response: any) => {
+ console.log(response);
+ this.idBounce = response.id
+ this.userBounce = response.user
+ this.dateBounce = response.date
+ this.timeBounce = response.time
+ })
+ })
}
- registering(name:string ,user: string, email: string, password: string) {
+ registering(name: string, user: string, email: string, password: string) {
this.progress = true
- let build:any = {
- 'nome':name,
- 'user':user,
- 'email':email,
- 'senha':password
+ let build: any = {
+ 'nome': name,
+ 'user': user,
+ 'email': email,
+ 'senha': password
}
- let buildLogin:any = {
- 'user':user,
- 'senha':password
+ let buildLogin: any = {
+ 'user': user,
+ 'senha': password
}
- this.http.post(this.TMSLoginAPI+'/register', build)
- .pipe(
- catchError((error)=>{
- return error
+ this.http.post(this.TMSLoginAPI + '/register', build)
+ .pipe(
+ catchError((error) => {
+ return error
+ })
+ )
+ .subscribe((response) => {
+ buildLogin = response
+ return buildLogin
})
- )
- .subscribe((response)=>{
- buildLogin = response
- return buildLogin
- })
return buildLogin
diff --git a/frontend/main/src/app/notification.service.spec.ts b/frontend/main/src/app/notification.service.spec.ts
new file mode 100644
index 0000000..c4f2cd6
--- /dev/null
+++ b/frontend/main/src/app/notification.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { NotificationService } from './notification.service';
+
+describe('NotificationService', () => {
+ let service: NotificationService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(NotificationService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/frontend/main/src/app/notification.service.ts b/frontend/main/src/app/notification.service.ts
new file mode 100644
index 0000000..21001b5
--- /dev/null
+++ b/frontend/main/src/app/notification.service.ts
@@ -0,0 +1,13 @@
+import { Injectable } from '@angular/core';
+import { LoginserviceService } from './loginservice.service';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class NotificationService {
+
+ constructor(private login:LoginserviceService) { }
+
+
+
+}
diff --git a/frontend/main/src/app/quote.service.ts b/frontend/main/src/app/quote.service.ts
index 6cfa1b6..a0505ff 100644
--- a/frontend/main/src/app/quote.service.ts
+++ b/frontend/main/src/app/quote.service.ts
@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { type } from 'os';
import { catchError } from 'rxjs';
+import { LoginserviceService } from './loginservice.service';
import { ShipQtComponent } from './ship-qt/ship-qt.component';
@Injectable({
@@ -13,26 +14,95 @@ export class QuoteService {
apiURL:string = 'http://localhost:8080/ship'
apiURL2:string = 'http://localhost:8080/quote'
- constructor(private router: Router, private http: HttpClient) { }
+ APIBouncePut:string = "http://localhost:8080/user/disbounce/"
+ newBounce!:any
+
+
+ constructor(private router: Router, private http: HttpClient, private login:LoginserviceService) { }
quote(cepOrigem:string, cepDestino:string):any{
+ //ATUALIZA BOUNCE
+ new LoginserviceService(this.router, this.http)
+
+ this.newBounce = {
+ "id":this.login.idBounce,
+ "user":this.login.userBounce,
+ "date":this.login.dateBounce,
+ "time":this.login.timeBounce,
+ "bounce_rate":false
+ }
+
+ console.log(this.newBounce);
+
+ this.http.post(this.APIBouncePut+this.login.idBounce, this.newBounce)
+ //FIM DO BOUNCE
+
return this.http.get(this.apiURL+'/'+cepOrigem+'/'+cepDestino)
}
+ recQuote():any{
+
+ //ATUALIZA BOUNCE
+ new LoginserviceService(this.router, this.http)
+
+ this.newBounce = {
+ "id":this.login.idBounce,
+ "user":this.login.userBounce,
+ "date":this.login.dateBounce,
+ "time":this.login.timeBounce,
+ "bounce_rate":false
+ }
+
+ console.log(this.newBounce);
+
+ this.http.post(this.APIBouncePut+this.login.idBounce, this.newBounce)
+ //FIM DO BOUNCE
+
+ return this.http.get(this.apiURL2+`/recent/`+this.login.pessoaID)
+
+ }
+
regRecentQuotes(object:any){
+
+ //ATUALIZA BOUNCE
+ new LoginserviceService(this.router, this.http)
+
+ this.newBounce = {
+ "id":this.login.idBounce,
+ "user":this.login.userBounce,
+ "date":this.login.dateBounce,
+ "time":this.login.timeBounce,
+ "bounce_rate":false
+ }
+
+ console.log(this.newBounce);
+
+ this.http.post(this.APIBouncePut+this.login.idBounce, this.newBounce)
+ //FIM DO BOUNCE
+
+
this.http.post(this.apiURL2+'/recent',object)
.subscribe((response)=>{
-
+
console.log(response);
-
+
})
}
+ regPackage(object:any){
+ this.http.post(this.apiURL2+'/register',object)
+ .subscribe((response)=>{
+
+
+ console.log(response);
+
+})
+ }
}
diff --git a/frontend/main/src/app/rct-qt/rct-qt.component.html b/frontend/main/src/app/rct-qt/rct-qt.component.html
index 1b35802..9ee9d9d 100644
--- a/frontend/main/src/app/rct-qt/rct-qt.component.html
+++ b/frontend/main/src/app/rct-qt/rct-qt.component.html
@@ -1 +1,30 @@
-
rct-qt works!
+
+
+ | Ação |
+
+ Preço do frete |
+ Prazo |
+ Transportadora |
+ Origem |
+ Destino |
+ Peso cubado |
+ Usuário |
+
+
+
+
+ |
+
+ R${{recQuote.price}} |
+ {{recQuote.await}} dias úteis |
+ {{recQuote.razaoTransportadora}} |
+ {{recQuote.origin}} |
+ {{recQuote.destiny}} |
+ {{recQuote.cub_height}} kg |
+ {{recQuote.nomePessoa}} |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/main/src/app/rct-qt/rct-qt.component.ts b/frontend/main/src/app/rct-qt/rct-qt.component.ts
index be12925..1cbccbc 100644
--- a/frontend/main/src/app/rct-qt/rct-qt.component.ts
+++ b/frontend/main/src/app/rct-qt/rct-qt.component.ts
@@ -1,4 +1,9 @@
+import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
+import { CarrierService } from '../carrier.service';
+import { LoginserviceService } from '../loginservice.service';
+import { QuoteService } from '../quote.service';
@Component({
selector: 'app-rct-qt',
@@ -7,9 +12,78 @@ import { Component, OnInit } from '@angular/core';
})
export class RctQtComponent implements OnInit {
- constructor() { }
+
+ recQuotes!: Array
+ id!: number
+ price!: number
+ await!: number
+ origin!: string
+ destiny!: string
+ carrier_id!: number
+ cub_height!: number
+ pessoa_id!: number
+ nomePessoa!: string
+ razaoTransportadora!: string
+
+
+
+ constructor(private carrierService: CarrierService, private loginService: LoginserviceService, public quoteService: QuoteService, private router: Router, private http: HttpClient) { }
ngOnInit(): void {
+ this.recQuotes = new Array()
+
+ this.quoteService.recQuote().pipe().subscribe((response: any) => {
+
+ console.log(response);
+
+ var count = Object.keys(response).length;
+
+ for (let i = 0; i < count; i++) {
+
+ this.id = response[i].id
+ this.price = response[i].price
+ this.await = response[i].await
+ this.origin = response[i].origin
+ this.destiny = response[i].destiny
+ this.cub_height = response[i].cub_height
+
+
+ this.razaoTransportadora = this.carrierService.findName(response.carrier_id);
+
+ this.recQuotes.push({id: this.id, price: this.price, await: this.await, origin: this.origin, destiny: this.destiny, cub_height: this.cub_height, razaoTransportadora: this.razaoTransportadora, carrier_id: response.carrier_id, nomePessoa: this.loginService.nome})
+
+
+
+ }
+
+ console.log();
+
+
+ })
+ }
+
+
+ regPackage(price: number, time: number, origin: string, destiny: string, carrier_id: string, cub_height: number) {
+
+
+
+ let build = {
+ "price": price,
+ "await": time,
+ "origin": origin,
+ "destiny": destiny,
+ "carrier_id": carrier_id,
+ "cub_height": cub_height,
+ "pessoa_id": this.loginService.pessoaID
+ }
+
+ console.log(build);
+
+ this.quoteService.regPackage(build)
+
+
+
+
}
}
diff --git a/frontend/main/src/app/ship-qt/ship-qt.component.html b/frontend/main/src/app/ship-qt/ship-qt.component.html
index 6ff8125..457c158 100644
--- a/frontend/main/src/app/ship-qt/ship-qt.component.html
+++ b/frontend/main/src/app/ship-qt/ship-qt.component.html
@@ -37,7 +37,7 @@
|
- {{i}} |
+ {{i+1}} |
R${{quote.precoFrete}} |
{{quote.tempo}} dias úteis |
{{quote.start_adress}} |
diff --git a/frontend/main/src/app/ship-qt/ship-qt.component.ts b/frontend/main/src/app/ship-qt/ship-qt.component.ts
index 00ee164..89eb84b 100644
--- a/frontend/main/src/app/ship-qt/ship-qt.component.ts
+++ b/frontend/main/src/app/ship-qt/ship-qt.component.ts
@@ -35,6 +35,9 @@ export class ShipQtComponent implements OnInit {
distance!: number
carrierData = [];
+ APIBouncePut:string = "http://localhost:8080/user/disbounce/"
+ newBounce!:any
+
constructor(public loginService: LoginserviceService, public carrierService: CarrierService, public quoteService: QuoteService, private router: Router, private http: HttpClient) { }
@@ -47,6 +50,22 @@ export class ShipQtComponent implements OnInit {
quote() {
+ //ATUALIZA BOUNCE
+ new LoginserviceService(this.router, this.http)
+
+ this.newBounce = {
+ "id":this.loginService.idBounce,
+ "user":this.loginService.userBounce,
+ "date":this.loginService.dateBounce,
+ "time":this.loginService.timeBounce,
+ "bounce_rate":false
+ }
+
+ console.log(this.newBounce);
+
+ this.http.post(this.APIBouncePut+this.loginService.idBounce, this.newBounce)
+ //FIM DO BOUNCE
+
if (this.cepOrigem != null && this.cepDestino != null && this.comprimento != null, this.altura != null, this.largura != null, this.peso != null) {
this.quoteService.quote(this.cepOrigem, this.cepDestino)
.pipe()
@@ -64,11 +83,11 @@ export class ShipQtComponent implements OnInit {
this.distance = (response.routes[0].legs[0].distance.value);
//cálculos
- this.vol = (this.comprimento * this.altura * this.largura) / 1000000; //conversão em m³
+ this.vol = (this.comprimento * this.altura * this.largura) / 1000000; //conversão em m³
this.cubagem = this.vol * this.fatorCub;
this.tempo = Math.ceil((((this.distance) / 1000) / 80) / 7); //dividido por 1000 para converter, /80 velocidade med, /7 horas diárias
- //dados da transportadora
+ //dados da transportadora
this.carrierService.listCarrier().pipe().subscribe((response: any) => {
var count = Object.keys(response).length;
@@ -79,7 +98,8 @@ export class ShipQtComponent implements OnInit {
console.log(this.priceFix + this.distance * response[i].taxa * this.cubagem);
- this.precoFrete = this.priceFix + this.distance * response[i].taxa * this.cubagem;
+ this.precoFrete = (this.priceFix + this.distance * response[i].taxa * this.cubagem);
+
this.quotes.push({ precoFrete: this.precoFrete, tempo: this.tempo, start_adress: this.start_adress, end_address: this.end_address, carrier: response[i].razao, vol: this.vol, cubagem: this.cubagem, carrierID: response[i].id, pessoaID: this.loginService.pessoaID });
@@ -105,7 +125,7 @@ export class ShipQtComponent implements OnInit {
}
regRecentQuotes(priceQuote: number, prazo: number, origem: string, destino: string, carrierID: number, cubagem: number, pessoaID:number) {
-
+
let build ={
"price":priceQuote,
"await":prazo,
@@ -117,7 +137,7 @@ export class ShipQtComponent implements OnInit {
}
this.quoteService.regRecentQuotes(build)
-
+
}
diff --git a/frontend/main/src/app/user-client/user-client.component.css b/frontend/main/src/app/user-client/user-client.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/frontend/main/src/app/user-client/user-client.component.html b/frontend/main/src/app/user-client/user-client.component.html
new file mode 100644
index 0000000..abe7264
--- /dev/null
+++ b/frontend/main/src/app/user-client/user-client.component.html
@@ -0,0 +1 @@
+user-client works!
diff --git a/frontend/main/src/app/user-client/user-client.component.spec.ts b/frontend/main/src/app/user-client/user-client.component.spec.ts
new file mode 100644
index 0000000..03ee03b
--- /dev/null
+++ b/frontend/main/src/app/user-client/user-client.component.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { UserClientComponent } from './user-client.component';
+
+describe('UserClientComponent', () => {
+ let component: UserClientComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ UserClientComponent ]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(UserClientComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/frontend/main/src/app/user-client/user-client.component.ts b/frontend/main/src/app/user-client/user-client.component.ts
new file mode 100644
index 0000000..e040787
--- /dev/null
+++ b/frontend/main/src/app/user-client/user-client.component.ts
@@ -0,0 +1,15 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-user-client',
+ templateUrl: './user-client.component.html',
+ styleUrls: ['./user-client.component.css']
+})
+export class UserClientComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit(): void {
+ }
+
+}
diff --git a/frontend/main/src/app/users.service.spec.ts b/frontend/main/src/app/users.service.spec.ts
new file mode 100644
index 0000000..f81244a
--- /dev/null
+++ b/frontend/main/src/app/users.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { UsersService } from './users.service';
+
+describe('UsersService', () => {
+ let service: UsersService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(UsersService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/frontend/main/src/app/users.service.ts b/frontend/main/src/app/users.service.ts
new file mode 100644
index 0000000..2f2d66f
--- /dev/null
+++ b/frontend/main/src/app/users.service.ts
@@ -0,0 +1,29 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+import { Router } from '@angular/router';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class UsersService {
+
+ apiURL:string = 'http://localhost:8080/user'
+
+ constructor(private router: Router, private http: HttpClient) { }
+
+ listUsers():any{
+
+ return this.http.get(this.apiURL)
+
+ }
+
+ adicionar(object:any){
+ this.http.post(this.apiURL,object)
+ .subscribe((response)=>{
+
+
+ console.log(response);
+
+ })
+}
+}
\ No newline at end of file
diff --git a/frontend/main/src/app/users/users.component.html b/frontend/main/src/app/users/users.component.html
index 72942f2..a825d34 100644
--- a/frontend/main/src/app/users/users.component.html
+++ b/frontend/main/src/app/users/users.component.html
@@ -3,6 +3,7 @@
Nome |
E-mail |
CPF |
+ Data nascimento |
@@ -10,7 +11,8 @@
|
|
- |
+ |
+ |
@@ -19,7 +21,7 @@
-
+
@@ -28,17 +30,19 @@
| Nome |
E-mail |
CPF |
- Ações |
+ Data nascimento |
+ Ação |
- | {{i}} |
+ {{i+1}} |
{{user.name}} |
{{user.email}} |
- {{user.cpf}} |
+ {{user.document}} |
+ {{user.birth}} |
-
-
+
+
|
diff --git a/frontend/main/src/app/users/users.component.ts b/frontend/main/src/app/users/users.component.ts
index a1c6bbc..08f69e9 100644
--- a/frontend/main/src/app/users/users.component.ts
+++ b/frontend/main/src/app/users/users.component.ts
@@ -1,4 +1,7 @@
+import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
+import { Router } from '@angular/router';
+import { UsersService } from '../users.service';
@Component({
selector: 'app-users',
@@ -9,38 +12,63 @@ export class UsersComponent implements OnInit {
users!:Array
name!:string
email!:string
-cpf!:string
+document!:string
+birth!:string
- constructor() { }
+ constructor(public usersService: UsersService, private router: Router, private http: HttpClient) { }
ngOnInit(): void {
this.users = new Array()
- this.users.push({name:"Mateus Felipe", email:"mateusgoettems@gmail.com", cpf:"03215415454"})
- this.users.push({name:"Bruno Roberto", email:"bruno@gmail.com", cpf:"03215415454"})
- this.users.push({name:"Cristian Schaufer", email:"cristian@gmail.com", cpf:"03215415454"})
- this.users.push({name:"Kalil", email:"kalil@gmail.com", cpf:"03215415454"})
+ this.usersService.listUsers().pipe().subscribe((response: any) => {
+ console.log(response);
+
+ var count = Object.keys(response).length;
+
+ for (let i = 0; i < count; i++) {
+
+ this.name = response[i].nome;
+ this.email = response[i].email;
+ this.document = response[i].document;
+ this.birth = response[i].birth;
+
+
+ this.users.push({name:this.name, email:this.email, document:this.document, birth:this.birth});
+
+ }
+
+ this.name = "";
+ this.email = "";
+ this.document = "";
+ this.birth = "";
+
+ })
+
}
- adicionar(){
- if(this.name != null && this.email != null && this.cpf != null){
- this.users.push({name:this.name, email:this.email, cpf:this.cpf})
- this.name =""
- this.email=""
- this.cpf=""
- }else{
- alert('DIGITE TODOS OS DADOS!')
- }
+ adicionar(name: string, email: string, document: string, birth: string) {
+
+
+ let build ={
+ "nome":name,
+ "email":email,
+ "document":document,
+ // "birth":birth,
+
}
+ this.usersService.adicionar(build)
- deletar(index:number){
- this.users.splice(index,1)
+ this.users.push({name:this.name, email:this.email, document:this.document, birth:this.birth});
}
- alterar(index:number){
- // this.users.splice(index,1)
+ deletar(){
+
}
+ alterar(){
+
+ }
+
}
diff --git a/mark.html b/mark.html
new file mode 100644
index 0000000..77af944
--- /dev/null
+++ b/mark.html
@@ -0,0 +1,13 @@
+$$$$$$$$\ $$\ $$\ $$$$$$\ $$$$$$$\ $$\
+\__$$ __|$$$\ $$$ |$$ __$$\ $$ __$$\ $$ |
+ $$ | $$$$\ $$$$ |$$ / \__| $$ | $$ | $$$$$$\ $$$$$$\ $$\ $$$$$$\ $$$$$$$\ $$$$$$\
+ $$ | $$\$$\$$ $$ |\$$$$$$\ $$$$$$$ |$$ __$$\ $$ __$$\ \__|$$ __$$\ $$ _____|\_$$ _|
+ $$ | $$ \$$$ $$ | \____$$\ $$ ____/ $$ | \__|$$ / $$ |$$\ $$$$$$$$ |$$ / $$ |
+ $$ | $$ |\$ /$$ |$$\ $$ | $$ | $$ | $$ | $$ |$$ |$$ ____|$$ | $$ |$$\
+ $$ | $$ | \_/ $$ |\$$$$$$ | $$ | $$ | \$$$$$$ |$$ |\$$$$$$$\ \$$$$$$$\ \$$$$ |
+ \__| \__| \__| \______/ \__| \__| \______/ $$ | \_______| \_______| \____/
+ $$\ $$ |
+ \$$$$$$ |
+ \______/
+
+Developed with ❤️ by Team Roxo!