From 13131eb6f0bd0a83ee15829c45b7054a3d6fb251 Mon Sep 17 00:00:00 2001 From: kaka-jaques Date: Mon, 3 Oct 2022 22:40:31 -0300 Subject: [PATCH] UPDATE! PROGRESS BUTTON ON RCT QT --- frontend/main/src/app/quote.service.ts | 7 +-- .../main/src/app/rct-qt/rct-qt.component.html | 16 +++--- .../main/src/app/rct-qt/rct-qt.component.ts | 50 +++++++------------ 3 files changed, 26 insertions(+), 47 deletions(-) diff --git a/frontend/main/src/app/quote.service.ts b/frontend/main/src/app/quote.service.ts index a0505ff..7e69baa 100644 --- a/frontend/main/src/app/quote.service.ts +++ b/frontend/main/src/app/quote.service.ts @@ -4,6 +4,7 @@ import { Router } from '@angular/router'; import { type } from 'os'; import { catchError } from 'rxjs'; import { LoginserviceService } from './loginservice.service'; +import { RctQtComponent } from './rct-qt/rct-qt.component'; import { ShipQtComponent } from './ship-qt/ship-qt.component'; @Injectable({ @@ -82,27 +83,21 @@ export class QuoteService { 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 9ee9d9d..043e5e8 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.html +++ b/frontend/main/src/app/rct-qt/rct-qt.component.html @@ -1,7 +1,7 @@ - + @@ -12,19 +12,17 @@ - - - + + + - - - - + + -
AçãoPreço do frete Prazo Transportadora
R${{recQuote.price}} {{recQuote.await}} dias úteis {{recQuote.razaoTransportadora}} {{recQuote.origin}} {{recQuote.destiny}}{{recQuote.cub_height}} kg{{recQuote.nomePessoa}}{{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 df6f13a..717b519 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.ts +++ b/frontend/main/src/app/rct-qt/rct-qt.component.ts @@ -12,7 +12,8 @@ import { QuoteService } from '../quote.service'; }) export class RctQtComponent implements OnInit { - + progress!:boolean + succeed:boolean = false recQuotes!: Array id!: number price!: number @@ -25,8 +26,6 @@ export class RctQtComponent implements OnInit { nomePessoa!: string razaoTransportadora!: string carrier!: any - - constructor(private carrierService: CarrierService, private loginService: LoginserviceService, public quoteService: QuoteService, private router: Router, private http: HttpClient) { } @@ -36,48 +35,34 @@ export class RctQtComponent implements OnInit { 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.carrierService.findName(response[i].carrier_id).subscribe((response:any) => { - - this.recQuotes.push({id: this.id, price: this.price, await: this.await, origin: this.origin, destiny: this.destiny, cub_height: this.cub_height, razaoTransportadora: response.razao, carrier_id: response.id, nomePessoa: this.loginService.nome}) - - - }) - - - - + // 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.carrierService.findName(response[i].carrier_id).subscribe((resp:any) => { - + this.recQuotes.push({id: response[i].id, price: response[i].price, await: response[i].await, origin: response[i].origin, destiny: response[i].destiny, cub_height: response[i].cub_height, razaoTransportadora: resp.razao, carrier_id: resp.id, nomePessoa: this.loginService.nome}) + }) } console.log(); - - }) + }) } - regPackage(price: number, time: number, origin: string, destiny: string, carrier_id: string, cub_height: number) { - + this.progress = true let build = { "price": price, @@ -90,11 +75,12 @@ export class RctQtComponent implements OnInit { } console.log(build); - - this.quoteService.regPackage(build) - + this.quoteService.regPackage(build) + setTimeout(()=>{ + this.succeed = true + }, 1500) }