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
9 changes: 9 additions & 0 deletions frontend/main/src/app/carrier.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,13 @@ export class CarrierService {


}

findName(id: number):any{

this.http.get(this.apiURL+`/`+id).subscribe((response)=>{
return response
})

}

}
6 changes: 3 additions & 3 deletions frontend/main/src/app/rct-qt/rct-qt.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<table class="table table-bordered">
<thead>
<th>Ação</th>
<th>ID</th>

<th>Preço do frete</th>
<th>Prazo</th>
<th>Transportadora</th>
Expand All @@ -13,8 +13,8 @@
</thead>
<tbody>
<tr *ngFor="let recQuote of recQuotes;let i = index;">
<td class="align-items-center"><button class="btn btn-primary" (click)="regPackage(this.recQuote.price, this.recQuote.await, this.recQuote.origin, this.recQuote.destiny, this.recQuote.carrier_id, this.recQuote.cub_height, this.recQuote.pessoa_id)">Criar pacote</button></td>
<td>{{id}}</td>
<td class="align-items-center"><button class="btn btn-primary" (click)="regPackage(this.recQuote.price, this.recQuote.await, this.recQuote.origin, this.recQuote.destiny, this.recQuote.carrier_id, this.recQuote.cub_height)">Criar pacote</button></td>

<td>R${{recQuote.price}}</td>
<td>{{recQuote.await}} dias úteis</td>
<td>{{recQuote.razaoTransportadora}}</td>
Expand Down
17 changes: 8 additions & 9 deletions frontend/main/src/app/rct-qt/rct-qt.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class RctQtComponent implements OnInit {



constructor(private loginService: LoginserviceService, public quoteService: QuoteService, private router: Router, private http: HttpClient) { }
constructor(private carrierService: CarrierService, private loginService: LoginserviceService, public quoteService: QuoteService, private router: Router, private http: HttpClient) { }

ngOnInit(): void {
this.recQuotes = new Array()
Expand All @@ -46,14 +46,11 @@ export class RctQtComponent implements OnInit {
this.origin = response[i].origin
this.destiny = response[i].destiny
this.cub_height = response[i].cub_height




this.razaoTransportadora = this.carrierService.findName(response.carrier_id);




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: this.loginService.nome})
this.recQuotes.push({id: this.id, price: this.price, await: this.await, origin: this.origin, destiny: this.destiny, cub_height: this.cub_height, razaoTransportadora: this.razaoTransportadora, carrier_id: response.carrier_id, nomePessoa: this.loginService.nome})



Expand All @@ -66,7 +63,9 @@ export class RctQtComponent implements OnInit {
}


regPackage(price: number, time: number, origin: string, destiny: string, carrier_id: number, cub_height: number, pessoa_id: number) {
regPackage(price: number, time: number, origin: string, destiny: string, carrier_id: string, cub_height: number) {



let build = {
"price": price,
Expand All @@ -75,7 +74,7 @@ export class RctQtComponent implements OnInit {
"destiny": destiny,
"carrier_id": carrier_id,
"cub_height": cub_height,
"pessoa_id": pessoa_id
"pessoa_id": this.loginService.pessoaID
}

console.log(build);
Expand Down