Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/main/src/app/ship-qt/ship-qt.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ <h2 class="text-uppercase">New Quote</h2>
</thead>
<tbody>
<tr *ngFor="let quote of quotes;let i = index;">
<td class="align-items-center"><button class="btn btn-primary" (click)="regRecentQuotes(this.quote.precoFrete, this.quote.tempo, this.quote.start_adress, this.quote.end_address, this.quote.carrierID, this.quote.cubagem, this.quote.pessoaID )">Save</button></td>
<td class="align-items-center"><button [hidden]="succeed==this.quote.id" class="btn btn-primary" (click)="regRecentQuotes(this.quote.id, this.quote.precoFrete, this.quote.tempo, this.quote.start_adress, this.quote.end_address, this.quote.carrierID, this.quote.cubagem, this.quote.pessoaID)"><i [ngClass]="{'fas fa-circle-notch fa-spin':progress==this.quote.id}"></i> Save</button><button disabled [hidden]="succeed!=this.quote.id" class="btn btn-success"><i class="fas fa-check"></i> Added!</button></td>
<td>{{i+1}}</td>
<td>R${{quote.precoFrete}}</td>
<td>{{quote.tempo}} dias úteis</td>
Expand Down
23 changes: 21 additions & 2 deletions frontend/main/src/app/ship-qt/ship-qt.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 })

Expand Down Expand Up @@ -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 });



Expand All @@ -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,
Expand All @@ -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)


}

Expand Down