Commit 8b6bab1ec7f3ab751ecb6379a44968d67950e157
1 parent
8a9b7ef5c2
Exists in
master
and in
1 other branch
Agregado ver mas de un digito
Showing
3 changed files
with
11 additions
and
3 deletions
Show diff stats
src/app/components/comanda/comanda.component.html
1 | <div class="container-fluid d-flex flex-column h-100 fade-in pb-4 pr-2"> | 1 | <div class="container-fluid d-flex flex-column h-100 fade-in pb-4 pr-2"> |
2 | 2 | ||
3 | <div class="row z-index-0 fixed-top m-0 w-100"> | 3 | <div class="row z-index-0 fixed-top m-0 w-100"> |
4 | <div class="col-12 p-3"> | 4 | <div class="col-12 p-3"> |
5 | <img class="w-15 float-right" src="../../../assets/img/debo-gray.png"> | 5 | <img class="w-15 float-right" src="../../../assets/img/debo-gray.png"> |
6 | </div> | 6 | </div> |
7 | </div> | 7 | </div> |
8 | 8 | ||
9 | <div class="row pt-5 m-3"> | 9 | <div class="row pt-5 m-3"> |
10 | <div class="col-12"> | 10 | <div class="col-12"> |
11 | <p class="m-0 h2 text-center">Pedidos a elaborar</p> | 11 | <p class="m-0 h2 text-center">Pedidos a elaborar</p> |
12 | </div> | 12 | </div> |
13 | </div> | 13 | </div> |
14 | 14 | ||
15 | <div class="row flex-fill m-0 overflow-scroll"> | 15 | <div class="row flex-fill m-0 overflow-scroll"> |
16 | <div class="col-12 px-2"> | 16 | <div class="col-12 px-2"> |
17 | <div class="card-columns h-100 m-1 fade-in disable-user-select"> | 17 | <div class="card-columns h-100 m-1 fade-in disable-user-select"> |
18 | <div *ngFor="let comanda of comandas" class="card fade-in rounded-xs shadow-sm" [ngClass]="{ | 18 | <div *ngFor="let comanda of comandas" class="card fade-in rounded-xs shadow-sm" [ngClass]="{ |
19 | 'bg-light': comanda.estado === 1, | 19 | 'bg-light': comanda.estado === 1, |
20 | 'bg-danger': comanda.estado === 2, | 20 | 'bg-danger': comanda.estado === 2, |
21 | 'bg-success swing-out-top-bck': comanda.estado === 3 | 21 | 'bg-success swing-out-top-bck': comanda.estado === 3 |
22 | }"> | 22 | }"> |
23 | <div class="card-body p-2"> | 23 | <div class="card-body p-2"> |
24 | <p class="h1 card-title text-center mb-1">{{comanda.id.toString().slice(comanda.id.toString().length - 2)}} | 24 | <p class="h1 card-title text-center mb-1">{{rellenar(comanda.id.toString().slice(comanda.id.toString().length - 3), 3)}} |
25 | </p> | 25 | </p> |
26 | <!-- TODO: Implementar moment --> | 26 | <!-- TODO: Implementar moment --> |
27 | <p class="card-title text-center mb-1">{{comanda.fechafinelaboracion | date: 'dd-MM-yyyy HH:mm' : '+0000'}} | 27 | <p class="card-title text-center mb-1">{{comanda.fechafinelaboracion | date: 'dd-MM-yyyy HH:mm' : '+0000'}} |
28 | </p> | 28 | </p> |
29 | <p *ngFor="let detalle of comanda.detalles" [ngClass]=" | 29 | <p *ngFor="let detalle of comanda.detalles" [ngClass]=" |
30 | { | 30 | { |
31 | 'border-secondary': comanda.estado === 1, | 31 | 'border-secondary': comanda.estado === 1, |
32 | 'border-light': comanda.estado != 1 | 32 | 'border-light': comanda.estado != 1 |
33 | }" class="card-text border-top pt-2 mb-2"> | 33 | }" class="card-text border-top pt-2 mb-2"> |
34 | <small> | 34 | <small> |
35 | {{detalle.articulo.DET_LAR}} | 35 | {{detalle.articulo.DET_LAR}} |
36 | </small><br> | 36 | </small><br> |
37 | <small> | 37 | <small> |
38 | CANT. {{detalle.cantidad}} | 38 | CANT. {{detalle.cantidad}} |
39 | </small> | 39 | </small> |
40 | </p> | 40 | </p> |
41 | <button *ngIf="comanda.estado === 1" class="btn btn-block btn-danger shadow-sm" | 41 | <button *ngIf="comanda.estado === 1" class="btn btn-block btn-danger shadow-sm" |
42 | (click)="updateComanda(comanda, 2, 'En elaboracion')"> | 42 | (click)="updateComanda(comanda, 2, 'En elaboracion')"> |
43 | Elaborar | 43 | Elaborar |
44 | </button> | 44 | </button> |
45 | <button *ngIf="comanda.estado === 2" class="btn btn-block btn-success shadow-sm" | 45 | <button *ngIf="comanda.estado === 2" class="btn btn-block btn-success shadow-sm" |
46 | (click)="updateComanda(comanda, 3, 'Terminado')"> | 46 | (click)="updateComanda(comanda, 3, 'Terminado')"> |
47 | Terminar | 47 | Terminar |
48 | </button> | 48 | </button> |
49 | <button *ngIf="comanda.estado === 2" class="btn btn-block btn-light btn-sm shadow-sm p-0" | 49 | <button *ngIf="comanda.estado === 2" class="btn btn-block btn-light btn-sm shadow-sm p-0" |
50 | (click)="updateComanda(comanda, 1, 'Pagado')"> | 50 | (click)="updateComanda(comanda, 1, 'Pagado')"> |
51 | <span class="pr-2 h6"><small>Deshacer</small></span> | 51 | <span class="pr-2 h6"><small>Deshacer</small></span> |
52 | <i class="fa fa-undo text-warning" aria-hidden="true"></i> | 52 | <i class="fa fa-undo text-warning" aria-hidden="true"></i> |
53 | </button> | 53 | </button> |
54 | </div> | 54 | </div> |
55 | </div> | 55 | </div> |
56 | </div> | 56 | </div> |
57 | </div> | 57 | </div> |
58 | </div> | 58 | </div> |
59 | 59 | ||
60 | </div> | 60 | </div> |
61 | 61 |
src/app/components/comanda/comanda.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 { Comanda } from 'src/app/wrappers/comanda'; | 3 | import { Comanda } from 'src/app/wrappers/comanda'; |
4 | import * as _ from 'lodash'; | 4 | import * as _ from 'lodash'; |
5 | import { Title } from '@angular/platform-browser'; | 5 | import { Title } from '@angular/platform-browser'; |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
8 | selector: 'app-comanda', | 8 | selector: 'app-comanda', |
9 | templateUrl: './comanda.component.html', | 9 | templateUrl: './comanda.component.html', |
10 | styleUrls: ['./comanda.component.scss'] | 10 | styleUrls: ['./comanda.component.scss'] |
11 | }) | 11 | }) |
12 | export class ComandaComponent implements OnInit { | 12 | export class ComandaComponent implements OnInit { |
13 | 13 | ||
14 | private comandas: Comanda[] = []; | 14 | private comandas: Comanda[] = []; |
15 | private cicloTime; | 15 | private cicloTime; |
16 | 16 | ||
17 | constructor( | 17 | constructor( |
18 | private comandaService: ComandaService, | 18 | private comandaService: ComandaService, |
19 | private titleService: Title | 19 | private titleService: Title |
20 | ) { | 20 | ) { |
21 | 21 | ||
22 | this.titleService.setTitle('Comanda'); | 22 | this.titleService.setTitle('Comanda'); |
23 | } | 23 | } |
24 | 24 | ||
25 | ngOnInit() { | 25 | ngOnInit() { |
26 | 26 | ||
27 | this.buscar(); | 27 | this.buscar(); |
28 | this.ciclo(); | 28 | this.ciclo(); |
29 | } | 29 | } |
30 | 30 | ||
31 | ngOnDestroy() { | 31 | ngOnDestroy() { |
32 | 32 | ||
33 | clearTimeout(this.cicloTime); | 33 | clearTimeout(this.cicloTime); |
34 | } | 34 | } |
35 | 35 | ||
36 | buscar() { | 36 | buscar() { |
37 | 37 | ||
38 | this.comandaService.getAll() | 38 | this.comandaService.getAll() |
39 | .subscribe((res: Comanda[]) => { | 39 | .subscribe((res: Comanda[]) => { |
40 | 40 | ||
41 | if (!_.isEqual(res, this.comandas)) { | 41 | if (!_.isEqual(res, this.comandas)) { |
42 | 42 | ||
43 | this.comandas = res; | 43 | this.comandas = res; |
44 | } | 44 | } |
45 | }, e => console.error(e)) | 45 | }, e => console.error(e)) |
46 | } | 46 | } |
47 | 47 | ||
48 | ciclo() { | 48 | ciclo() { |
49 | 49 | ||
50 | this.cicloTime = setTimeout(() => { | 50 | this.cicloTime = setTimeout(() => { |
51 | 51 | ||
52 | this.buscar(); | 52 | this.buscar(); |
53 | this.ciclo(); | 53 | this.ciclo(); |
54 | }, 5000); | 54 | }, 5000); |
55 | } | 55 | } |
56 | 56 | ||
57 | updateComanda(comanda: Comanda, estadoNuevo: number, observacionNueva: string) { | 57 | updateComanda(comanda: Comanda, estadoNuevo: number, observacionNueva: string) { |
58 | 58 | ||
59 | this.comandaService.updateComanda(comanda.id, estadoNuevo, observacionNueva) | 59 | this.comandaService.updateComanda(comanda.id, estadoNuevo, observacionNueva) |
60 | .subscribe(res => { | 60 | .subscribe(res => { |
61 | 61 | ||
62 | if (res.data) { | 62 | if (res.data) { |
63 | comanda.estado = estadoNuevo; | 63 | comanda.estado = estadoNuevo; |
64 | comanda.observacion = observacionNueva; | 64 | comanda.observacion = observacionNueva; |
65 | } | 65 | } |
66 | }, e => console.error(e)) | 66 | }, e => console.error(e)) |
67 | } | 67 | } |
68 | 68 | ||
69 | rellenar(relleno, longitud) { | ||
70 | relleno = '' + relleno; | ||
71 | while (relleno.length < longitud) { | ||
72 | relleno = '0' + relleno; | ||
73 | } | ||
74 | return relleno; | ||
75 | } | ||
76 | |||
69 | } | 77 | } |
70 | 78 |
src/app/components/pedidos-salientes/pedidos-salientes.component.html
1 | <div class="bg-primary-gradient vh-100 disable-user-select"> | 1 | <div class="bg-primary-gradient vh-100 disable-user-select"> |
2 | <div class="d-flex justify-content-center"> | 2 | <div class="d-flex justify-content-center"> |
3 | <div class="row z-index-0 fixed-top m-0 w-100"> | 3 | <div class="row z-index-0 fixed-top m-0 w-100"> |
4 | <div class="col-12 p-3"> | 4 | <div class="col-12 p-3"> |
5 | <img class="w-15 float-right" src="../../../assets/img/debo-gray.png"> | 5 | <img class="w-15 float-right" src="../../../assets/img/debo-gray.png"> |
6 | </div> | 6 | </div> |
7 | </div> | 7 | </div> |
8 | <div class="row m-5 text-white text-center"> | 8 | <div class="row m-5 text-white text-center"> |
9 | 9 | ||
10 | <div class="col-12 p-0"> | 10 | <div class="col-12 p-0"> |
11 | <p class="h1 m-0">Pedidos terminados.</p> | 11 | <p class="h1 m-0">Pedidos terminados.</p> |
12 | <p class="h2 m-0">Nº de Pedido</p> | 12 | <p class="h2 m-0">Nº de Pedido</p> |
13 | </div> | 13 | </div> |
14 | 14 | ||
15 | <div | 15 | <div |
16 | *ngIf="pedidosRecientes.length" | 16 | *ngIf="pedidosRecientes.length" |
17 | class="col-12 p-2"> | 17 | class="col-12 p-2"> |
18 | <div class="border rounded shadow h-big"> | 18 | <div class="border rounded shadow h-big"> |
19 | <div class="font-weight-bold m-0 h-100"> | 19 | <div class="font-weight-bold m-0 h-100"> |
20 | {{rellenar(pedidosRecientes[0].id.toString().slice(pedidosRecientes[0].id.toString().length - 2), 2)}} | 20 | {{rellenar(pedidosRecientes[0].id.toString().slice(pedidosRecientes[0].id.toString().length - 3), 3)}} |
21 | </div> | 21 | </div> |
22 | </div> | 22 | </div> |
23 | </div> | 23 | </div> |
24 | 24 | ||
25 | <div | 25 | <div |
26 | *ngFor="let pedido of pedidosRecientes; let i = index" | 26 | *ngFor="let pedido of pedidosRecientes; let i = index" |
27 | [hidden]="i == 0 || i > 8" | 27 | [hidden]="i == 0 || i > 8" |
28 | class="col-3 p-2"> | 28 | class="col-3 p-2"> |
29 | <p class="font-weight-bold display-1 m-0 py-1 border rounded shadow"> | 29 | <p class="font-weight-bold display-1 m-0 py-1 border rounded shadow"> |
30 | {{rellenar(pedido.id.toString().slice(pedido.id.toString().length - 2), 2)}} | 30 | {{rellenar(pedido.id.toString().slice(pedido.id.toString().length - 2), 3)}} |
31 | </p> | 31 | </p> |
32 | </div> | 32 | </div> |
33 | 33 | ||
34 | </div> | 34 | </div> |
35 | </div> | 35 | </div> |
36 | </div> | 36 | </div> |
37 | 37 |