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/carriers/carriers.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ <h2 class="text-uppercase">Edit Carrier</h2>
<br>
<button class="btn btn-primary btn-xl text-uppercase"
data-bs-dismiss="modal" type="button" (click)="closeModalEdit()"
(click)="alterar()">
(click)="alterar(this.id, this.razao, this.taxa, this.email, this.cnpj)">
<i class="fas fa-xmark me-1"></i>
Save
</button>
Expand Down
33 changes: 26 additions & 7 deletions frontend/main/src/app/carriers/carriers.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,16 @@ export class CarriersComponent implements OnInit {

console.log(response);



var count = Object.keys(response).length;

for (let i = 0; i < count; i++) {


this.id = response[i].id;
this.razao = response[i].razao;
this.taxa = response[i].taxa;
this.email = response[i].email;
this.cnpj = response[i].cnpj;

this.carriers.push({id: this.id, razao: this.razao, taxa: this.taxa, email: this.email, cnpj: this.cnpj});

}

this.razao = "";
Expand All @@ -71,7 +66,6 @@ export class CarriersComponent implements OnInit {
"taxa":taxa,
"email":email,
"cnpj":cnpj

}

this.carrierService.adicionar(build)
Expand All @@ -95,12 +89,37 @@ export class CarriersComponent implements OnInit {

}

alterar(){
alterar(id:number, razao:string, taxa:string, email:string, cnpj:string){
console.log("É TETRA");
let build ={
"id": id,
"razao":razao,
"taxa":taxa,
"email":email,
"cnpj":cnpj
}

this.http.put('http://35.199.78.13:8080/carriers',build)
.subscribe((response)=>{


console.log(response);

})

setTimeout(() => {
this.ngOnInit();
}, 500);

}

openModal(){

this.razao = "";
this.taxa = "";
this.email = "";
this.cnpj = "";

var modal = document.getElementById('modal2')

modal?.setAttribute('style', 'display:block;')
Expand Down
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 @@ -72,7 +72,7 @@ <h2 class="text-uppercase">New Quote</h2>
Quote
</button>

<button class="btn btn-danger btn-xl text-uppercase " data-bs-dismiss="modal" type="button"
<button class="btn btn-danger btn-xl text-uppercase ml-2" data-bs-dismiss="modal" type="button"
(click)="closeModal()">
<i class="fas fa-xmark me-1"></i>
Close
Expand Down
14 changes: 8 additions & 6 deletions frontend/main/src/app/users/users.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2 class="text-uppercase">New User</h2>
<!-- <img class="img-fluid d-block mx-auto" src="assets/img/portfolio/2.jpg" alt="..." /> -->
<div class="input-group" style="width: 100%;">
<span class="input-group-text"
style="border-radius: 5px; border-right: 10px;">🧑🏽‍💻</span>
style="border-radius: 5px; border-right: 10px;">🧑</span>
<input type="text" [(ngModel)]="name" class="form-control" name="Nome"
placeholder="Nome completo" required tabindex="1">
</div>
Expand Down Expand Up @@ -110,7 +110,11 @@ <h2 class="text-uppercase">New User</h2>
<button class="btn btn-danger mr-2" (click)="deletar(user.id)">Delet</button>


<button class="btn btn-primary" (click)="openModalEdit()">Edit</button>
<button class="btn btn-primary" (click)="openModalEdit(this.user.id, this.user.name, this.user.email, this.user.document, this.user.birth)">Edit</button>

</td>
</tr>
</tbody>

<div class="portfolio-modal modal fade show" id="modal3" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
Expand Down Expand Up @@ -154,7 +158,7 @@ <h2 class="text-uppercase">Edit User</h2>
<br>
<button class="btn btn-primary btn-xl text-uppercase" data-bs-dismiss="modal" type="button"
(click)="closeModalEdit()"
(click)="alterar()">
(click)="alterar(this.id, this.name, this.email, this.document, this.birth)">
<i class="fas fa-xmark me-1"></i>
Save
</button>
Expand All @@ -177,7 +181,5 @@ <h2 class="text-uppercase">Edit User</h2>



</td>
</tr>
</tbody>

</table>
36 changes: 34 additions & 2 deletions frontend/main/src/app/users/users.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,38 @@ id!: number

}

alterar(){
alterar(id:number, name:string, email:string, document:string, birth:string){

console.log("É TETRA");
let build ={
"id": id,
"nome":name,
"email":email,
"document": document,
"birth": birth
}

this.http.put('http://35.199.78.13:8080/user',build)
.subscribe((response)=>{


console.log(response);

})

setTimeout(() => {
this.ngOnInit();
}, 500);

}

openModal(){

this.name = ""
this.email = ""
this.document = ""
this.birth = ""

var modal = document.getElementById('modal2')

modal?.setAttribute('style', 'display:block;')
Expand All @@ -113,7 +139,13 @@ id!: number

}

openModalEdit(){
openModalEdit(id:number, name:string, email:string, documents:string, birth:string){

this.id = id
this.name = name
this.email = email
this.document = documents
this.birth = birth

var modal = document.getElementById('modal3')

Expand Down