From 3ae76c44bb7c056f02355160f6754fe29a25ab36 Mon Sep 17 00:00:00 2001 From: Mateus Felipe Date: Mon, 3 Oct 2022 18:40:28 -0300 Subject: [PATCH 1/2] Updated --- frontend/main/src/app/quote.service.ts | 10 ++++ .../main/src/app/rct-qt/rct-qt.component.html | 26 ++++++---- .../main/src/app/rct-qt/rct-qt.component.ts | 52 ++++++++++++++++--- 3 files changed, 70 insertions(+), 18 deletions(-) diff --git a/frontend/main/src/app/quote.service.ts b/frontend/main/src/app/quote.service.ts index 0ae04f1..266b2e5 100644 --- a/frontend/main/src/app/quote.service.ts +++ b/frontend/main/src/app/quote.service.ts @@ -12,6 +12,7 @@ export class QuoteService { apiURL:string = 'http://localhost:8080/ship' apiURL2:string = 'http://localhost:8080/quote' + apiURL3:string = 'http://localhost:8080/' constructor(private router: Router, private http: HttpClient) { } @@ -39,6 +40,15 @@ export class QuoteService { } + regPackage(object:any){ + this.http.post(this.apiURL3+'/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 c81acf7..3b11fe2 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.html +++ b/frontend/main/src/app/rct-qt/rct-qt.component.html @@ -4,23 +4,27 @@ ID Preço do frete Prazo + Transportadora Origem Destino - Transportadora Peso cubado + Usuário - + \ 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 cc30a23..a6e1bd2 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.ts +++ b/frontend/main/src/app/rct-qt/rct-qt.component.ts @@ -11,24 +11,62 @@ import { QuoteService } from '../quote.service'; }) export class RctQtComponent implements OnInit { - + + 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(public quoteService: QuoteService, private router: Router, private http: HttpClient) { } ngOnInit(): void { - this.quoteService.recQuote().pipe().subscribe((response: any) => { + // this.quoteService.recQuote().pipe().subscribe((response: any) => { - var count = Object.keys(response).length; + // var count = Object.keys(response).length; - for (let i = 0; i < count; i++) { + // 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 - } + // } + + // }) + } + + + regPackage(price: number, time: number, origin: string, destiny: string, carrier_id: number, cub_height: number, pessoa_id: number) { + + let build = { + "price": price, + "time": time, + "origin": origin, + "destiny": destiny, + "carrier_id": carrier_id, + "cub_height": cub_height, + "pessoa_id": pessoa_id + } + + this.quoteService.regPackage(build) + + + - }) } } From 33bf2232dcec5f58549af492bef11e1654bd480a Mon Sep 17 00:00:00 2001 From: Mateus Felipe Date: Mon, 3 Oct 2022 19:19:15 -0300 Subject: [PATCH 2/2] Updated Carriers and Users --- .../src/app/carriers/carriers.component.html | 8 +++++-- .../src/app/carriers/carriers.component.ts | 9 ++++++++ frontend/main/src/app/quote.service.ts | 2 +- .../main/src/app/rct-qt/rct-qt.component.ts | 22 +++++++++---------- .../main/src/app/users/users.component.html | 3 ++- .../main/src/app/users/users.component.ts | 1 + 6 files changed, 30 insertions(+), 15 deletions(-) diff --git a/frontend/main/src/app/carriers/carriers.component.html b/frontend/main/src/app/carriers/carriers.component.html index 4e87155..6d77686 100644 --- a/frontend/main/src/app/carriers/carriers.component.html +++ b/frontend/main/src/app/carriers/carriers.component.html @@ -34,18 +34,22 @@ Taxa E-mail Cnpj + Ação - {{i}} + {{i+1}} {{carrier.razao}} {{carrier.taxa}} {{carrier.email}} {{carrier.cnpj}} - + + + + diff --git a/frontend/main/src/app/carriers/carriers.component.ts b/frontend/main/src/app/carriers/carriers.component.ts index d45bf09..2901bd0 100644 --- a/frontend/main/src/app/carriers/carriers.component.ts +++ b/frontend/main/src/app/carriers/carriers.component.ts @@ -71,4 +71,13 @@ export class CarriersComponent implements OnInit { this.carriers.push({razao:this.razao, taxa:this.taxa, email:this.email, cnpj:this.cnpj}); } + deletar(){ + + + } + + alterar(){ + + } + } diff --git a/frontend/main/src/app/quote.service.ts b/frontend/main/src/app/quote.service.ts index c49bf09..f851d95 100644 --- a/frontend/main/src/app/quote.service.ts +++ b/frontend/main/src/app/quote.service.ts @@ -62,7 +62,7 @@ export class QuoteService { this.http.post(this.APIBouncePut+this.login.idBounce, this.newBounce) //FIM DO BOUNCE - return this.http.get(this.apiURL) + return this.http.get(this.apiURL2+`/recent`) } 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 a6e1bd2..5364b01 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.ts +++ b/frontend/main/src/app/rct-qt/rct-qt.component.ts @@ -29,24 +29,24 @@ export class RctQtComponent implements OnInit { ngOnInit(): void { - // this.quoteService.recQuote().pipe().subscribe((response: any) => { + this.quoteService.recQuote().pipe().subscribe((response: any) => { - // var count = Object.keys(response).length; + var count = Object.keys(response).length; - // for (let i = 0; i < count; i++) { + 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.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 - // } + } - // }) + }) } diff --git a/frontend/main/src/app/users/users.component.html b/frontend/main/src/app/users/users.component.html index 9e1debe..a825d34 100644 --- a/frontend/main/src/app/users/users.component.html +++ b/frontend/main/src/app/users/users.component.html @@ -31,10 +31,11 @@ E-mail CPF Data nascimento + Ação - {{i}} + {{i+1}} {{user.name}} {{user.email}} {{user.document}} diff --git a/frontend/main/src/app/users/users.component.ts b/frontend/main/src/app/users/users.component.ts index de25fa8..08f69e9 100644 --- a/frontend/main/src/app/users/users.component.ts +++ b/frontend/main/src/app/users/users.component.ts @@ -31,6 +31,7 @@ birth!:string 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});