Commit 9ac7139017d974c83908865613761436015d0c17
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master(efernandez) See merge request !82
Showing
4 changed files
Show diff stats
package.json
... | ... | @@ -25,6 +25,7 @@ |
25 | 25 | "bootstrap": "^4.3.1", |
26 | 26 | "font-awesome": "^4.7.0", |
27 | 27 | "jquery": "^1.12.4", |
28 | + "lodash": "^4.17.15", | |
28 | 29 | "material-design-icons": "^3.0.1", |
29 | 30 | "ngx-bootstrap": "^5.1.1", |
30 | 31 | "popper.js": "^1.15.0", |
... | ... | @@ -39,9 +40,10 @@ |
39 | 40 | "@angular/cli": "~8.0.0", |
40 | 41 | "@angular/compiler-cli": "~8.0.0", |
41 | 42 | "@angular/language-service": "~8.0.0", |
42 | - "@types/node": "~8.9.4", | |
43 | 43 | "@types/jasmine": "~3.3.8", |
44 | 44 | "@types/jasminewd2": "~2.0.3", |
45 | + "@types/lodash": "^4.14.138", | |
46 | + "@types/node": "~8.9.4", | |
45 | 47 | "codelyzer": "^5.0.0", |
46 | 48 | "jasmine-core": "~3.4.0", |
47 | 49 | "jasmine-spec-reporter": "~4.2.1", |
src/app/components/comanda/comanda.component.html
... | ... | @@ -12,10 +12,12 @@ |
12 | 12 | 'bg-danger': comanda.estado === 2, |
13 | 13 | 'bg-success': comanda.estado === 3 |
14 | 14 | }"> |
15 | - <img class="card-img-top rounded-xs shadow-sm" src="{{apiImagenes}}/imagenes/cerealitas.jpg"/> | |
15 | + <img | |
16 | + class="card-img-top rounded-xs shadow-sm" | |
17 | + src="{{apiImagenes}}/imagenes/{{comanda.detalles[0].articulo.imagenes[0].imagen}}"/> | |
16 | 18 | <div class="row w-100 m-0 mt-2"> |
17 | - <p class="col-12 px-2 mb-2 m-0 h6">Title</p> | |
18 | - <p class="col-12 px-2 mb-2 m-0 h6"><small>Text</small></p> | |
19 | + <p class="col-12 px-2 mb-2 m-0 h6">{{comanda.detalles[0].articulo.DetArt}}</p> | |
20 | + <p class="col-12 px-2 mb-2 m-0 h6"><small>{{comanda.detalles[0].articulo.DET_LAR}}</small></p> | |
19 | 21 | </div> |
20 | 22 | <div class="row w-100 m-0 mb-2 mt-auto"> |
21 | 23 | <div |
src/app/components/comanda/comanda.component.ts
... | ... | @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; |
2 | 2 | import { appSettings } from 'src/etc/AppSettings'; |
3 | 3 | import { ComandaService } from 'src/app/services/comanda.service'; |
4 | 4 | import { Comanda } from 'src/app/wrappers/comanda'; |
5 | +import * as _ from 'lodash'; | |
5 | 6 | |
6 | 7 | @Component({ |
7 | 8 | selector: 'app-comanda', |
... | ... | @@ -12,6 +13,7 @@ export class ComandaComponent implements OnInit { |
12 | 13 | |
13 | 14 | private apiImagenes = appSettings.apiImagenes; |
14 | 15 | private comandas: Comanda[] = []; |
16 | + private cicloTime; | |
15 | 17 | |
16 | 18 | constructor( |
17 | 19 | private comandaService: ComandaService |
... | ... | @@ -19,11 +21,34 @@ export class ComandaComponent implements OnInit { |
19 | 21 | |
20 | 22 | ngOnInit() { |
21 | 23 | |
24 | + this.buscar(); | |
25 | + this.ciclo(); | |
26 | + | |
27 | + } | |
28 | + | |
29 | + ngOnDestroy() { | |
30 | + | |
31 | + clearTimeout(this.cicloTime); | |
32 | + } | |
33 | + | |
34 | + buscar() { | |
35 | + | |
22 | 36 | this.comandaService.getAll() |
23 | - .subscribe((res: Comanda[]) => { | |
37 | + .subscribe((res: Comanda[]) => { | |
38 | + | |
39 | + if (!_.isEqual(res, this.comandas)) { | |
24 | 40 | |
25 | 41 | this.comandas = res; |
26 | - }, e => console.error(e)) | |
42 | + } | |
43 | + }, e => console.error(e)) | |
44 | + } | |
45 | + | |
46 | + ciclo() { | |
47 | + | |
48 | + this.cicloTime = setTimeout(() => { | |
49 | + this.buscar(); | |
50 | + this.ciclo(); | |
51 | + }, 5000); | |
27 | 52 | } |
28 | 53 | |
29 | 54 | updateComanda(comanda: Comanda, estadoNuevo: number, observacionNueva: string) { |
src/app/components/pedidos-salientes/pedidos-salientes.component.ts
... | ... | @@ -9,26 +9,33 @@ import { ComandaService } from 'src/app/services/comanda.service'; |
9 | 9 | export class PedidosSalientesComponent implements OnInit { |
10 | 10 | |
11 | 11 | private pedidosRecientes = []; |
12 | - private ciclo; | |
12 | + private cicloTime; | |
13 | 13 | |
14 | 14 | constructor(private comandaService: ComandaService) { } |
15 | 15 | |
16 | 16 | ngOnInit() { |
17 | - this.buscar(); | |
18 | 17 | |
19 | - this.ciclo = setTimeout(() => { | |
20 | - this.buscar(); | |
21 | - }, 5000) | |
18 | + this.buscar(); | |
19 | + this.ciclo(); | |
22 | 20 | } |
23 | 21 | |
24 | 22 | ngOnDestroy() { |
25 | 23 | |
26 | - clearTimeout(this.ciclo); | |
24 | + clearTimeout(this.cicloTime); | |
27 | 25 | } |
28 | 26 | |
29 | - buscar() { | |
27 | + ciclo() { | |
28 | + | |
29 | + this.cicloTime = setTimeout(() => { | |
30 | 30 | |
31 | - this.comandaService.getPendientesEntrega() | |
31 | + this.buscar(); | |
32 | + this.ciclo(); | |
33 | + }, 5000) | |
34 | + } | |
35 | + | |
36 | + buscar() { | |
37 | + this.comandaService | |
38 | + .getPendientesEntrega() | |
32 | 39 | .subscribe((pedidos: []) => { |
33 | 40 | |
34 | 41 | this.pedidosRecientes = pedidos; |