diff --git a/frontend/main/src/app/quote.service.ts b/frontend/main/src/app/quote.service.ts index 60805db..85787f1 100644 --- a/frontend/main/src/app/quote.service.ts +++ b/frontend/main/src/app/quote.service.ts @@ -99,4 +99,9 @@ export class QuoteService { }) } + + deleteRecentQuote(id:number){ + this.http.delete(this.apiURL2+'/recent/'+id) + } + } 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 c64ada3..43d8946 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.html +++ b/frontend/main/src/app/rct-qt/rct-qt.component.html @@ -11,7 +11,7 @@ - + R${{recQuote.price}} {{recQuote.await}} dias Ășteis 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 717b519..cd82bd8 100644 --- a/frontend/main/src/app/rct-qt/rct-qt.component.ts +++ b/frontend/main/src/app/rct-qt/rct-qt.component.ts @@ -12,8 +12,8 @@ import { QuoteService } from '../quote.service'; }) export class RctQtComponent implements OnInit { - progress!:boolean - succeed:boolean = false + progress:number = -1 + succeed:number = -1 recQuotes!: Array id!: number price!: number @@ -32,7 +32,12 @@ export class RctQtComponent implements OnInit { ngOnInit(): void { this.recQuotes = new Array() - this.quoteService.recQuote().pipe().subscribe((response: any) => { + this.progress = -1 + this.succeed = -1 + + this.quoteService.recQuote() + .pipe() + .subscribe((response: any) => { console.log(response); @@ -55,14 +60,13 @@ export class RctQtComponent implements OnInit { } - console.log(); - }) + } - regPackage(price: number, time: number, origin: string, destiny: string, carrier_id: string, cub_height: number) { + regPackage(id:number, price: number, time: number, origin: string, destiny: string, carrier_id: string, cub_height: number) { - this.progress = true + this.progress = id let build = { "price": price, @@ -75,11 +79,18 @@ export class RctQtComponent implements OnInit { } console.log(build); - this.quoteService.regPackage(build) + console.log(id); + + + this.http.delete('http://localhost:8080/quote/recent/'+id) + setTimeout(()=>{ - this.succeed = true + this.succeed = id + setTimeout(() => { + this.ngOnInit() + }, 2000); }, 1500) }