Commit b32ee7afaf5e322c5a0a97b242a5601e38bba78e
1 parent
d164045dd0
Exists in
master
and in
1 other branch
Borrado espacio.
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
src/app/components/pedidos-salientes/pedidos-salientes.component.ts
1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; |
2 | import { ComandaService } from 'src/app/services/comanda.service'; | 2 | import { ComandaService } from 'src/app/services/comanda.service'; |
3 | import { Title } from '@angular/platform-browser'; | 3 | import { Title } from '@angular/platform-browser'; |
4 | 4 | ||
5 | @Component({ | 5 | @Component({ |
6 | selector: 'app-pedidos-salientes', | 6 | selector: 'app-pedidos-salientes', |
7 | templateUrl: './pedidos-salientes.component.html', | 7 | templateUrl: './pedidos-salientes.component.html', |
8 | styleUrls: ['./pedidos-salientes.component.scss'] | 8 | styleUrls: ['./pedidos-salientes.component.scss'] |
9 | }) | 9 | }) |
10 | export class PedidosSalientesComponent implements OnInit { | 10 | export class PedidosSalientesComponent implements OnInit { |
11 | 11 | ||
12 | private pedidosRecientes = []; | 12 | private pedidosRecientes = []; |
13 | private cicloTime; | 13 | private cicloTime; |
14 | 14 | ||
15 | constructor( | 15 | constructor( |
16 | private comandaService: ComandaService, | 16 | private comandaService: ComandaService, |
17 | private titleService: Title | 17 | private titleService: Title |
18 | ) { | 18 | ) { |
19 | 19 | ||
20 | this.titleService.setTitle('Pedidos Salientes'); | 20 | this.titleService.setTitle('Pedidos Salientes'); |
21 | } | 21 | } |
22 | 22 | ||
23 | ngOnInit() { | 23 | ngOnInit() { |
24 | 24 | ||
25 | this.buscar(); | 25 | this.buscar(); |
26 | this.ciclo(); | 26 | this.ciclo(); |
27 | } | 27 | } |
28 | 28 | ||
29 | ngOnDestroy() { | 29 | ngOnDestroy() { |
30 | 30 | ||
31 | clearTimeout(this.cicloTime); | 31 | clearTimeout(this.cicloTime); |
32 | } | 32 | } |
33 | 33 | ||
34 | ciclo() { | 34 | ciclo() { |
35 | 35 | ||
36 | this.cicloTime = setTimeout(() => { | 36 | this.cicloTime = setTimeout(() => { |
37 | 37 | ||
38 | this.buscar(); | 38 | this.buscar(); |
39 | this.ciclo(); | 39 | this.ciclo(); |
40 | }, 5000) | 40 | }, 5000) |
41 | } | 41 | } |
42 | 42 | ||
43 | buscar() { | 43 | buscar() { |
44 | this.comandaService | 44 | this.comandaService |
45 | .getPendientesEntrega() | 45 | .getPendientesEntrega() |
46 | .subscribe((pedidos: []) => { | 46 | .subscribe((pedidos: []) => { |
47 | 47 | ||
48 | this.pedidosRecientes = pedidos; | 48 | this.pedidosRecientes = pedidos; |
49 | }, console.log); | 49 | }, console.log); |
50 | } | 50 | } |
51 | 51 | ||
52 | rellenar(relleno, longitud) { | 52 | rellenar(relleno, longitud) { |
53 | relleno = '' + relleno; | 53 | relleno = '' + relleno; |
54 | while (relleno.length < longitud) { | 54 | while (relleno.length < longitud) { |
55 | relleno = '0' + relleno; | 55 | relleno = '0' + relleno; |
56 | } | 56 | } |
57 | return relleno; | 57 | return relleno; |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 |