Commit 960fa80c0a0a746eeca5a72c8c73bb49686b59b8

Authored by Benjamin Rodriguez
1 parent 6fdce7ecdc

primer rectangulo pedidos pendientes segunto ultimo pedido finalizado

src/app/modules/pedidos-salientes/pedidos-salientes.component.html
... ... @@ -21,9 +21,9 @@
21 21 <div class="p-3 bg-white shadow-lg rounded text-center h-100">
22 22 <h5 class="pt-3">LISTO PARA</h5>
23 23 <h3 class="font-weight-bold text-primary">retirar</h3>
24   - <div *ngIf="pedidosPendientes.length">
  24 + <div *ngIf="pedidoFinalizado.length">
25 25  
26   - <h1 class="display-1 mt-4 text-primary">{{rellenar(pedidosPendientes[0].id.toString().slice(0), 3)}}</h1>
  26 + <h1 class="display-1 mt-4 text-primary">{{rellenar(pedidoFinalizado[0].id.toString().slice(0), 3)}}</h1>
27 27 </div>
28 28 <h3 class="font-weight-bold text-info mt-4" style="color: yellowgreen;">¡Que lo disfrutes!</h3>
29 29 </div>
src/app/modules/pedidos-salientes/pedidos-salientes.component.ts
... ... @@ -7,15 +7,17 @@ import { ComandaService } from &#39;src/app/services/comanda/comanda.service&#39;;
7 7 styleUrls: ['./pedidos-salientes.component.scss']
8 8 })
9 9 export class PedidosSalientesComponent implements OnInit {
10   - pedidosPendientes = [];
  10 + pedidoFinalizado = [];
11 11 cicloTime;
  12 + pedidosPendientes = [];
12 13  
13 14 constructor(
14 15 private comandaServices: ComandaService
15 16 ) { }
16 17  
17 18 ngOnInit() {
18   - this.buscarPedidosPendientes();
  19 + this.buscarPedidosFinalizados();
  20 + this.buscarPedidosPendientes()
19 21 this.ciclo()
20 22 }
21 23  
... ... @@ -23,16 +25,24 @@ export class PedidosSalientesComponent implements OnInit {
23 25 clearTimeout(this.cicloTime);
24 26 }
25 27  
26   - buscarPedidosPendientes() {
  28 + buscarPedidosFinalizados() {
27 29 this.comandaServices.getPendientesEntrega()
28   - .subscribe((pedidos: []) => {
29   - this.pedidosPendientes = pedidos
30   - })
  30 + .subscribe((pedidos: []) => {
  31 + this.pedidoFinalizado = pedidos
  32 + })
  33 + }
  34 +
  35 + buscarPedidosPendientes() {
  36 + this.comandaServices.getAll()
  37 + .subscribe((resComandas: []) => {
  38 + this.pedidosPendientes = resComandas;
  39 + }, e => console.error(e));
31 40 }
32 41  
33 42 ciclo() {
34 43 this.cicloTime = setTimeout(() => {
35   - this.buscarPedidosPendientes();
  44 + this.buscarPedidosFinalizados();
  45 + this.buscarPedidosPendientes()
36 46 this.ciclo();
37 47 }, 5000)
38 48 }
src/app/services/comanda/comanda.service.ts
... ... @@ -16,4 +16,8 @@ export class ComandaService {
16 16 return this.http.get(`${this.urlDeboSuite}/comandas/pendientes-entrega`);
17 17 }
18 18  
  19 + getAll() {
  20 + return this.http.get(`${this.urlDeboSuite}/comandas`);
  21 + }
  22 +
19 23 }