diff --git a/frontend/main/src/app/quote.service.ts b/frontend/main/src/app/quote.service.ts index f851d95..a0505ff 100644 --- a/frontend/main/src/app/quote.service.ts +++ b/frontend/main/src/app/quote.service.ts @@ -14,8 +14,6 @@ export class QuoteService { apiURL:string = 'http://localhost:8080/ship' apiURL2:string = 'http://localhost:8080/quote' - apiURL3:string = 'http://localhost:8080/' - APIBouncePut:string = "http://localhost:8080/user/disbounce/" newBounce!:any @@ -47,22 +45,22 @@ export class QuoteService { recQuote():any{ //ATUALIZA BOUNCE - new LoginserviceService(this.router, this.http) + 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 - } + 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); + console.log(this.newBounce); - this.http.post(this.APIBouncePut+this.login.idBounce, this.newBounce) + this.http.post(this.APIBouncePut+this.login.idBounce, this.newBounce) //FIM DO BOUNCE - return this.http.get(this.apiURL2+`/recent`) + return this.http.get(this.apiURL2+`/recent/`+this.login.pessoaID) } @@ -97,7 +95,7 @@ export class QuoteService { } regPackage(object:any){ - this.http.post(this.apiURL3+'/register',object) + this.http.post(this.apiURL2+'/register',object) .subscribe((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 3b11fe2..df965ea 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.html +++ b/frontend/main/src/app/rct-qt/rct-qt.component.html @@ -13,7 +13,7 @@ - + {{id}} R${{recQuote.price}} {{recQuote.await}} dias Ășteis @@ -21,7 +21,7 @@ {{recQuote.origin}} {{recQuote.destiny}} {{recQuote.cub_height}} kg - {{recQuote.nomePessoa}} kg + {{recQuote.nomePessoa}} 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 5364b01..ef9b629 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.ts +++ b/frontend/main/src/app/rct-qt/rct-qt.component.ts @@ -2,6 +2,7 @@ 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({ @@ -23,29 +24,37 @@ export class RctQtComponent implements OnInit { pessoa_id!: number nomePessoa!: string razaoTransportadora!: string + - constructor(public quoteService: QuoteService, private router: Router, private http: HttpClient) { } + constructor(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.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.recQuotes.push({id: this.id, price: this.price, await: this.await, origin: this.origin, destiny: this.destiny, cub_height: this.cub_height, razaoTransportadora: "ABC", nomePessoa: "Mateus"}) + } + console.log(); + + }) } @@ -54,7 +63,7 @@ export class RctQtComponent implements OnInit { let build = { "price": price, - "time": time, + "await": time, "origin": origin, "destiny": destiny, "carrier_id": carrier_id, @@ -62,6 +71,8 @@ export class RctQtComponent implements OnInit { "pessoa_id": pessoa_id } + console.log(build); + this.quoteService.regPackage(build)