Commit 45f97eb98fe03cc34ac8b4fdbcb03ea4203e2351
1 parent
a486afa8ba
Exists in
develop
Change
Cambio en formato de pedidos salientes
Showing
2 changed files
with
33 additions
and
25 deletions
Show diff stats
src/app/modules/pedidos-salientes/pedidos-salientes.component.html
1 | <div class="row mt-2 justify-content-center h-15"> | 1 | <div class="row mx-0 mt-5 justify-content-around"> |
2 | <div class="col-3 col-lg-2"> | 2 | <div class="col"> |
3 | <div class="p-3 bg-white text-center shadow-lg rounded h-100"> | ||
4 | <p class="h5 mt-3">ESTAMOS</p> | ||
5 | <p class="h3 font-weight-bold text-secondary">preparando</p> | ||
6 | <p class="h5">TU PEDIDO</p> | ||
7 | <div | ||
8 | *ngFor="let pedido of pedidosPendientes; let i = index" | ||
9 | [hidden]="i > 3" | ||
10 | class="font-weight-bold mb-2 text-muted"> | ||
11 | <p class="display-4">{{rellenar(pedido.id.toString().slice(0), 3)}}</p> | ||
12 | </div> | ||
13 | </div> | ||
14 | </div> | ||
15 | <div class="col"> | ||
3 | <img | 16 | <img |
4 | draggable="false" | 17 | draggable="false" |
5 | ondragstart="return false;" | 18 | ondragstart="return false;" |
6 | (contextmenu)="false" | 19 | (contextmenu)="false" |
7 | class="w-60 h-auto d-block mx-auto" | 20 | class="w-40 h-auto d-block mx-auto" |
8 | src="assets/img/logo-spot.svg"> | 21 | src="assets/img/logo-spot.svg"> |
22 | <div class="p-3 text-center h-100"> | ||
23 | <p class="h5 mt-3">LISTO PARA</p> | ||
24 | <p class="h3 font-weight-bold text-primary">retirar</p> | ||
25 | <div *ngIf="pedidosFinalizados.length"> | ||
26 | <p class="display-1 mt-2 text-primary mb-0">{{rellenar(pedidosFinalizados[0].id.toString().slice(0), 3)}}</p> | ||
27 | </div> | ||
28 | <p class="h3 font-weight-bold text-info mt-2">¡Que lo disfrutes!</p> | ||
29 | </div> | ||
9 | </div> | 30 | </div> |
10 | </div> | 31 | <div class="col"> |
11 | <div class="row mt-n5 mx-0 justify-content-around h-75"> | ||
12 | <div class="col-5 col-md-6 col-lg-4 h-100"> | ||
13 | <div class="p-3 bg-white text-center shadow-lg rounded h-100"> | 32 | <div class="p-3 bg-white text-center shadow-lg rounded h-100"> |
14 | <h5 class="pt-3">ESTAMOS</h5> | 33 | <p class="h5 mt-3">YA FUÉ</p> |
15 | <h3 class="font-weight-bold text-secondary">preparando</h3> | 34 | <p class="h3 font-weight-bold text-primary">entregado</p> |
16 | <h5>TU PEDIDO</h5> | 35 | <p class="h5">TU PEDIDO</p> |
17 | <div | 36 | <div |
18 | *ngFor="let pedido of pedidosPendientes; let i = index" | 37 | *ngFor="let pedido of pedidosFinalizados; let i = index" |
19 | [hidden]="i > 3" | 38 | [hidden]="i > 4 || i == 0" |
20 | class="font-weight-bold mb-2 text-muted"> | 39 | class="font-weight-bold mb-2 text-muted"> |
21 | <h1 class="display-4">{{rellenar(pedido.id.toString().slice(0), 3)}}</h1> | 40 | <p class="display-4">{{rellenar(pedido.id.toString().slice(0), 3)}}</p> |
22 | </div> | ||
23 | </div> | ||
24 | </div> |
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 | pedidoFinalizado = []; | 10 | pedidosFinalizados = []; |
11 | cicloTime; | 11 | cicloTime; |
12 | pedidosPendientes = []; | 12 | pedidosPendientes = []; |
13 | 13 | ||
14 | constructor( | 14 | constructor( |
15 | private comandaServices: ComandaService | 15 | private comandaServices: ComandaService |
16 | ) { } | 16 | ) { } |
17 | 17 | ||
18 | ngOnInit() { | 18 | ngOnInit() { |
19 | this.buscarPedidosFinalizados(); | 19 | this.buscarPedidosFinalizados(); |
20 | this.buscarPedidosPendientes(); | 20 | this.buscarPedidosPendientes(); |
21 | this.ciclo(); | 21 | this.ciclo(); |
22 | } | 22 | } |
23 | 23 | ||
24 | OnDestroy() { | 24 | OnDestroy() { |
25 | clearTimeout(this.cicloTime); | 25 | clearTimeout(this.cicloTime); |
26 | } | 26 | } |
27 | 27 | ||
28 | buscarPedidosFinalizados() { | 28 | buscarPedidosFinalizados() { |
29 | this.comandaServices.getPendientesEntrega() | 29 | this.comandaServices.getPendientesEntrega() |
30 | .subscribe((pedidos: []) => { | 30 | .subscribe((pedidos: []) => { |
31 | this.pedidoFinalizado = pedidos; | 31 | this.pedidosFinalizados = pedidos; |
32 | }); | 32 | }); |
33 | } | 33 | } |
34 | 34 | ||
35 | buscarPedidosPendientes() { | 35 | buscarPedidosPendientes() { |
36 | this.comandaServices.getAll() | 36 | this.comandaServices.getAll() |
37 | .subscribe((resComandas: []) => { | 37 | .subscribe((resComandas: []) => { |
38 | this.pedidosPendientes = resComandas; | 38 | this.pedidosPendientes = resComandas; |
39 | }, e => console.error(e)); | 39 | }, e => console.error(e)); |
40 | } | 40 | } |
41 | 41 | ||
42 | ciclo() { | 42 | ciclo() { |
43 | this.cicloTime = setTimeout(() => { | 43 | this.cicloTime = setTimeout(() => { |
44 | this.buscarPedidosFinalizados(); | 44 | this.buscarPedidosFinalizados(); |
45 | this.buscarPedidosPendientes(); | 45 | this.buscarPedidosPendientes(); |
46 | this.ciclo(); | 46 | this.ciclo(); |
47 | }, 5000); | 47 | }, 5000); |
48 | } | 48 | } |
49 | 49 | ||
50 | rellenar(relleno, longitud) { | 50 | rellenar(relleno, longitud) { |
51 | relleno = '' + relleno; | 51 | relleno = '' + relleno; |
52 | while (relleno.length < longitud) { | 52 | while (relleno.length < longitud) { |
53 | relleno = '0' + relleno; | 53 | relleno = '0' + relleno; |
54 | } | 54 | } |
55 | return relleno; | 55 | return relleno; |
56 | } | 56 | } |
57 | 57 | ||
58 | } | 58 | } |
59 | 59 |
-
mentioned in commit 90d685