From 3ed2a74d78b5534a5645d033c45651433dec124e Mon Sep 17 00:00:00 2001 From: Mateus Felipe Date: Sun, 9 Oct 2022 10:35:46 -0300 Subject: [PATCH] Button Save Ship Quote --- .../src/app/ship-qt/ship-qt.component.html | 2 +- .../main/src/app/ship-qt/ship-qt.component.ts | 23 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) 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 224fb0f..35ab4a6 100644 --- a/frontend/main/src/app/ship-qt/ship-qt.component.html +++ b/frontend/main/src/app/ship-qt/ship-qt.component.html @@ -117,7 +117,7 @@

New Quote

- + {{i+1}} R${{quote.precoFrete}} {{quote.tempo}} dias Ășteis 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 921a5f0..70c74ab 100644 --- a/frontend/main/src/app/ship-qt/ship-qt.component.ts +++ b/frontend/main/src/app/ship-qt/ship-qt.component.ts @@ -34,6 +34,9 @@ export class ShipQtComponent implements OnInit { fatorCub!: number distance!: number carrierData = []; + progress:number = -1 + succeed:number = -1 + id!: number APIBouncePut:string = "http://localhost:8080/user/disbounce/" newBounce!:any @@ -43,6 +46,8 @@ export class ShipQtComponent implements OnInit { ngOnInit(): void { + + //this.quotes.push({ precoFrete: 45.50, tempo: 3, trackid: "BR23154546TR", cepOrigem: 88058086, cepDestino: 88058086, comprimento: 50, largura: 50, altura: 50, peso: 10 }) //this.quotes.push({ precoFrete: 94.50, tempo: 6, trackid: "BR22315445TR", cepOrigem: 46513265, cepDestino: 65898454, comprimento: 100, largura: 200, altura: 10, peso: 25 }) @@ -103,7 +108,7 @@ export class ShipQtComponent implements OnInit { 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 }); + this.quotes.push({id: this.id, 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 }); @@ -126,7 +131,10 @@ export class ShipQtComponent implements OnInit { } - regRecentQuotes(priceQuote: number, prazo: number, origem: string, destino: string, carrierID: number, cubagem: number, pessoaID:number) { + regRecentQuotes(id:number, priceQuote: number, prazo: number, origem: string, destino: string, carrierID: number, cubagem: number, pessoaID:number) { + + this.progress = -1 + this.succeed = -1 let build ={ "price":priceQuote, @@ -141,6 +149,17 @@ export class ShipQtComponent implements OnInit { this.quoteService.regRecentQuotes(build) + console.log(id); + + // this.http.delete('http://localhost:8080/quote/recent/'+id).subscribe(); + + setTimeout(()=>{ + this.succeed = id + setTimeout(() => { + this.ngOnInit() + }, 3000); + }, 1500) + }