Commit 960fa80c0a0a746eeca5a72c8c73bb49686b59b8
1 parent
6fdce7ecdc
Exists in
develop
and in
1 other branch
primer rectangulo pedidos pendientes segunto ultimo pedido finalizado
Showing
3 changed files
with
23 additions
and
9 deletions
Show diff stats
src/app/modules/pedidos-salientes/pedidos-salientes.component.html
1 | <div class="row justify-content-center h-15"> | 1 | <div class="row justify-content-center h-15"> |
2 | <div class="col-3 col-lg-2 mt-1"> | 2 | <div class="col-3 col-lg-2 mt-1"> |
3 | <img src="../../../assets/img/logo-spot.svg" class="w-60 h-auto d-block mx-auto" alt=""> | 3 | <img src="../../../assets/img/logo-spot.svg" class="w-60 h-auto d-block mx-auto" alt=""> |
4 | </div> | 4 | </div> |
5 | </div> | 5 | </div> |
6 | <div class="row mt-n5 justify-content-around h-75"> | 6 | <div class="row mt-n5 justify-content-around h-75"> |
7 | <div class="col-5 col-md-3 h-100"> | 7 | <div class="col-5 col-md-3 h-100"> |
8 | <div class="p-3 bg-white text-center shadow-lg rounded h-100"> | 8 | <div class="p-3 bg-white text-center shadow-lg rounded h-100"> |
9 | <h5 class="pt-3">ESTAMOS</h5> | 9 | <h5 class="pt-3">ESTAMOS</h5> |
10 | <h3 class="font-weight-bold text-secondary">preparando</h3> | 10 | <h3 class="font-weight-bold text-secondary">preparando</h3> |
11 | <h5>TU PEDIDO</h5> | 11 | <h5>TU PEDIDO</h5> |
12 | <div | 12 | <div |
13 | *ngFor="let pedido of pedidosPendientes; let i = index" | 13 | *ngFor="let pedido of pedidosPendientes; let i = index" |
14 | [hidden]="i == 0 || i > 4" | 14 | [hidden]="i == 0 || i > 4" |
15 | class="font-weight-bold mb-2 text-muted"> | 15 | class="font-weight-bold mb-2 text-muted"> |
16 | <h1 class="display-4">{{rellenar(pedido.id.toString().slice(0), 3)}}</h1> | 16 | <h1 class="display-4">{{rellenar(pedido.id.toString().slice(0), 3)}}</h1> |
17 | </div> | 17 | </div> |
18 | </div> | 18 | </div> |
19 | </div> | 19 | </div> |
20 | <div class="col-5 col-md-3 h-100"> | 20 | <div class="col-5 col-md-3 h-100"> |
21 | <div class="p-3 bg-white shadow-lg rounded text-center h-100"> | 21 | <div class="p-3 bg-white shadow-lg rounded text-center h-100"> |
22 | <h5 class="pt-3">LISTO PARA</h5> | 22 | <h5 class="pt-3">LISTO PARA</h5> |
23 | <h3 class="font-weight-bold text-primary">retirar</h3> | 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 | </div> | 27 | </div> |
28 | <h3 class="font-weight-bold text-info mt-4" style="color: yellowgreen;">¡Que lo disfrutes!</h3> | 28 | <h3 class="font-weight-bold text-info mt-4" style="color: yellowgreen;">¡Que lo disfrutes!</h3> |
29 | </div> | 29 | </div> |
30 | </div> | 30 | </div> |
31 | </div> | 31 | </div> |
32 | 32 |
src/app/modules/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/comanda.service'; | 2 | import { ComandaService } from 'src/app/services/comanda/comanda.service'; |
3 | 3 | ||
4 | @Component({ | 4 | @Component({ |
5 | selector: 'app-pedidos-salientes', | 5 | selector: 'app-pedidos-salientes', |
6 | templateUrl: './pedidos-salientes.component.html', | 6 | templateUrl: './pedidos-salientes.component.html', |
7 | styleUrls: ['./pedidos-salientes.component.scss'] | 7 | styleUrls: ['./pedidos-salientes.component.scss'] |
8 | }) | 8 | }) |
9 | export class PedidosSalientesComponent implements OnInit { | 9 | export class PedidosSalientesComponent implements OnInit { |
10 | pedidosPendientes = []; | 10 | pedidoFinalizado = []; |
11 | cicloTime; | 11 | cicloTime; |
12 | pedidosPendientes = []; | ||
12 | 13 | ||
13 | constructor( | 14 | constructor( |
14 | private comandaServices: ComandaService | 15 | private comandaServices: ComandaService |
15 | ) { } | 16 | ) { } |
16 | 17 | ||
17 | ngOnInit() { | 18 | ngOnInit() { |
18 | this.buscarPedidosPendientes(); | 19 | this.buscarPedidosFinalizados(); |
20 | this.buscarPedidosPendientes() | ||
19 | this.ciclo() | 21 | this.ciclo() |
20 | } | 22 | } |
21 | 23 | ||
22 | ngOnDestroy() { | 24 | ngOnDestroy() { |
23 | clearTimeout(this.cicloTime); | 25 | clearTimeout(this.cicloTime); |
24 | } | 26 | } |
25 | 27 | ||
26 | buscarPedidosPendientes() { | 28 | buscarPedidosFinalizados() { |
27 | this.comandaServices.getPendientesEntrega() | 29 | this.comandaServices.getPendientesEntrega() |
28 | .subscribe((pedidos: []) => { | 30 | .subscribe((pedidos: []) => { |
29 | this.pedidosPendientes = pedidos | 31 | this.pedidoFinalizado = pedidos |
30 | }) | 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 | ciclo() { | 42 | ciclo() { |
34 | this.cicloTime = setTimeout(() => { | 43 | this.cicloTime = setTimeout(() => { |
35 | this.buscarPedidosPendientes(); | 44 | this.buscarPedidosFinalizados(); |
45 | this.buscarPedidosPendientes() | ||
36 | this.ciclo(); | 46 | this.ciclo(); |
37 | }, 5000) | 47 | }, 5000) |
38 | } | 48 | } |
39 | 49 | ||
40 | rellenar(relleno, longitud) { | 50 | rellenar(relleno, longitud) { |
41 | relleno = '' + relleno; | 51 | relleno = '' + relleno; |
42 | while (relleno.length < longitud) { | 52 | while (relleno.length < longitud) { |
43 | relleno = '0' + relleno; | 53 | relleno = '0' + relleno; |
44 | } | 54 | } |
45 | return relleno; | 55 | return relleno; |
46 | } | 56 | } |
47 | 57 | ||
48 | } | 58 | } |
49 | 59 |
src/app/services/comanda/comanda.service.ts
1 | import { Injectable } from '@angular/core'; | 1 | import { Injectable } from '@angular/core'; |
2 | import { HttpClient } from "@angular/common/http"; | 2 | import { HttpClient } from "@angular/common/http"; |
3 | import { APP_SETTINGS } from "src/etc/AppSettings"; | 3 | import { APP_SETTINGS } from "src/etc/AppSettings"; |
4 | 4 | ||
5 | @Injectable({ | 5 | @Injectable({ |
6 | providedIn: 'root' | 6 | providedIn: 'root' |
7 | }) | 7 | }) |
8 | export class ComandaService { | 8 | export class ComandaService { |
9 | urlDeboSuite = APP_SETTINGS.apiDeboSuite; | 9 | urlDeboSuite = APP_SETTINGS.apiDeboSuite; |
10 | 10 | ||
11 | constructor( | 11 | constructor( |
12 | private http: HttpClient, | 12 | private http: HttpClient, |
13 | ) { } | 13 | ) { } |
14 | 14 | ||
15 | getPendientesEntrega() { | 15 | getPendientesEntrega() { |
16 | return this.http.get(`${this.urlDeboSuite}/comandas/pendientes-entrega`); | 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 | } |
20 | 24 |