Commit 01db302e7e3964be578fbc4be66f33f41b226df0
1 parent
a667c64fe1
Exists in
master
and in
1 other branch
timeout
Showing
3 changed files
with
30 additions
and
6 deletions
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,29 @@ export class ComandaComponent implements OnInit { |
| 19 | 21 | |
| 20 | 22 | ngOnInit() { |
| 21 | 23 | |
| 24 | + this.buscar(); | |
| 25 | + this.ciclo(); | |
| 26 | + | |
| 27 | + } | |
| 28 | + | |
| 29 | + buscar() { | |
| 30 | + | |
| 22 | 31 | this.comandaService.getAll() |
| 23 | - .subscribe((res: Comanda[]) => { | |
| 32 | + .subscribe((res: Comanda[]) => { | |
| 33 | + | |
| 34 | + if (!_.isEqual(res, this.comandas)) { | |
| 24 | 35 | |
| 25 | 36 | this.comandas = res; |
| 26 | - }, e => console.error(e)) | |
| 37 | + } | |
| 38 | + }, e => console.error(e)) | |
| 39 | + } | |
| 40 | + | |
| 41 | + ciclo() { | |
| 42 | + | |
| 43 | + this.cicloTime = setTimeout(() => { | |
| 44 | + this.buscar(); | |
| 45 | + this.ciclo(); | |
| 46 | + }, 5000); | |
| 27 | 47 | } |
| 28 | 48 | |
| 29 | 49 | updateComanda(comanda: Comanda, estadoNuevo: number, observacionNueva: string) { |