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
26 changes: 12 additions & 14 deletions frontend/main/src/app/quote.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export class QuoteService {
apiURL:string = 'http://localhost:8080/ship'
apiURL2:string = 'http://localhost:8080/quote'

apiURL3:string = 'http://localhost:8080/'

APIBouncePut:string = "http://localhost:8080/user/disbounce/"
newBounce!:any

Expand Down Expand Up @@ -47,22 +45,22 @@ export class QuoteService {
recQuote():any{

//ATUALIZA BOUNCE
new LoginserviceService(this.router, this.http)
new LoginserviceService(this.router, this.http)

this.newBounce = {
"id":this.login.idBounce,
"user":this.login.userBounce,
"date":this.login.dateBounce,
"time":this.login.timeBounce,
"bounce_rate":false
}
this.newBounce = {
"id":this.login.idBounce,
"user":this.login.userBounce,
"date":this.login.dateBounce,
"time":this.login.timeBounce,
"bounce_rate":false
}

console.log(this.newBounce);
console.log(this.newBounce);

this.http.post(this.APIBouncePut+this.login.idBounce, this.newBounce)
this.http.post(this.APIBouncePut+this.login.idBounce, this.newBounce)
//FIM DO BOUNCE

return this.http.get(this.apiURL2+`/recent`)
return this.http.get(this.apiURL2+`/recent/`+this.login.pessoaID)

}

Expand Down Expand Up @@ -97,7 +95,7 @@ export class QuoteService {
}

regPackage(object:any){
this.http.post(this.apiURL3+'/register',object)
this.http.post(this.apiURL2+'/register',object)
.subscribe((response)=>{


Expand Down
4 changes: 2 additions & 2 deletions frontend/main/src/app/rct-qt/rct-qt.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
</thead>
<tbody>
<tr *ngFor="let recQuote of recQuotes;let i = index;">
<td class="align-items-center"><button class="btn btn-primary" >Criar pacote</button></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, this.recQuote.pessoa_id)">Criar pacote</button></td>
<td>{{id}}</td>
<td>R${{recQuote.price}}</td>
<td>{{recQuote.await}} dias úteis</td>
<td>{{recQuote.razaoTransportadora}}</td>
<td>{{recQuote.origin}}</td>
<td>{{recQuote.destiny}}</td>
<td>{{recQuote.cub_height}} kg</td>
<td>{{recQuote.nomePessoa}} kg</td>
<td>{{recQuote.nomePessoa}}</td>



Expand Down
19 changes: 15 additions & 4 deletions frontend/main/src/app/rct-qt/rct-qt.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { CarrierService } from '../carrier.service';
import { LoginserviceService } from '../loginservice.service';
import { QuoteService } from '../quote.service';

@Component({
Expand All @@ -23,29 +24,37 @@ export class RctQtComponent implements OnInit {
pessoa_id!: number
nomePessoa!: string
razaoTransportadora!: string



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

ngOnInit(): void {
this.recQuotes = new Array()

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.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.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: "Mateus"})


}

console.log();


})
}

Expand All @@ -54,14 +63,16 @@ export class RctQtComponent implements OnInit {

let build = {
"price": price,
"time": time,
"await": time,
"origin": origin,
"destiny": destiny,
"carrier_id": carrier_id,
"cub_height": cub_height,
"pessoa_id": pessoa_id
}

console.log(build);

this.quoteService.regPackage(build)


Expand Down