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
49 changes: 48 additions & 1 deletion frontend/main/src/app/packreg/packreg.component.html
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
<p>packreg works!</p>
<table class="table table-bordered">
<thead>
<th>Centro de Distribuição</th>
<th>Origem</th>
<th>Destino</th>
<th>Dimensões</th>


</thead>
<tbody>
<tr>

<td><input type="text" [(ngModel)]="cd"></td>
<td><input type="text" [(ngModel)]="origem"></td>
<td><input type="text" [(ngModel)]="destino"></td>
<td><input type="text" [(ngModel)]="dimensao"></td>

</tr>
</tbody>
</table>




<button class="btn btn-success" (click)="adicionar()">Adicionar Pedido</button>
<br>
<hr>
<table class="table table-bordered">
<thead>
<th>Número de pedido</th>
<th>Centro de Distribuição</th>
<th>Origem</th>
<th>Destino</th>
<th>Dimensões</th>
<th>Ações</th>
</thead>
<tbody>
<tr *ngFor="let register of registers;let i = index;">
<td>{{i}}</td>
<td>{{register.cd}}</td>
<td>{{register.origem}}</td>
<td>{{register.destino}}</td>
<td>{{register.dimensao}}</td>
<td><button class="btn btn-danger mr-2" (click)="deletar(i)">Excluir pedido</button>
<button class="btn btn-primary mr-2" (click)="deletar(i)">Alterar pedido</button></td>
</tr>
</tbody>
</table>
27 changes: 27 additions & 0 deletions frontend/main/src/app/packreg/packreg.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,36 @@ import { Component, OnInit } from '@angular/core';
})
export class PackregComponent implements OnInit {

registers!:Array<any>
cd!:string
origem!:string
destino!:string
dimensao!:string

constructor() { }

ngOnInit(): void {
this.registers = new Array()
this.registers.push({cd:"Total Express", origem:"Blumenau", destino:"Fortaleza", dimensao:"Grande"})
this.registers.push({cd:"Jadlog", origem:"Florianópolis", destino:"Rio de Janeiro", dimensao:"Pequeno"})
this.registers.push({cd:"Braspress", origem:"São Paulo", destino:"Porto Alegre", dimensao:"Médio"})
this.registers.push({cd:"Correios", origem:"Brusque", destino:"Florianópolis", dimensao:"Pequeno"})

}

adicionar(){
if(this.cd){
this.registers.push({cd:this.cd, origem:this.origem, destino:this.destino, dimensao:this.dimensao})
this.cd =""
this.origem=""
this.destino=""
this.dimensao=""
}
}


deletar(index:number){
this.registers.splice(index,1)
}

}