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
| 1 | { | 1 | { | 
| 2 | "name": "autoservicio", | 2 | "name": "autoservicio", | 
| 3 | "version": "0.0.0", | 3 | "version": "0.0.0", | 
| 4 | "scripts": { | 4 | "scripts": { | 
| 5 | "ng": "ng", | 5 | "ng": "ng", | 
| 6 | "start": "ng serve", | 6 | "start": "ng serve", | 
| 7 | "build": "ng build", | 7 | "build": "ng build", | 
| 8 | "test": "ng test", | 8 | "test": "ng test", | 
| 9 | "lint": "ng lint", | 9 | "lint": "ng lint", | 
| 10 | "e2e": "ng e2e" | 10 | "e2e": "ng e2e" | 
| 11 | }, | 11 | }, | 
| 12 | "private": true, | 12 | "private": true, | 
| 13 | "dependencies": { | 13 | "dependencies": { | 
| 14 | "@angular/animations": "^8.2.3", | 14 | "@angular/animations": "^8.2.3", | 
| 15 | "@angular/cdk": "^8.1.3", | 15 | "@angular/cdk": "^8.1.3", | 
| 16 | "@angular/common": "~8.0.0", | 16 | "@angular/common": "~8.0.0", | 
| 17 | "@angular/compiler": "~8.0.0", | 17 | "@angular/compiler": "~8.0.0", | 
| 18 | "@angular/core": "~8.0.0", | 18 | "@angular/core": "~8.0.0", | 
| 19 | "@angular/forms": "~8.0.0", | 19 | "@angular/forms": "~8.0.0", | 
| 20 | "@angular/material": "^8.1.3", | 20 | "@angular/material": "^8.1.3", | 
| 21 | "@angular/platform-browser": "~8.0.0", | 21 | "@angular/platform-browser": "~8.0.0", | 
| 22 | "@angular/platform-browser-dynamic": "~8.0.0", | 22 | "@angular/platform-browser-dynamic": "~8.0.0", | 
| 23 | "@angular/router": "~8.0.0", | 23 | "@angular/router": "~8.0.0", | 
| 24 | "@ngx-material-keyboard/core": "^0.1.1", | 24 | "@ngx-material-keyboard/core": "^0.1.1", | 
| 25 | "bootstrap": "^4.3.1", | 25 | "bootstrap": "^4.3.1", | 
| 26 | "font-awesome": "^4.7.0", | 26 | "font-awesome": "^4.7.0", | 
| 27 | "jquery": "^1.12.4", | 27 | "jquery": "^1.12.4", | 
| 28 | "lodash": "^4.17.15", | ||
| 28 | "material-design-icons": "^3.0.1", | 29 | "material-design-icons": "^3.0.1", | 
| 29 | "ngx-bootstrap": "^5.1.1", | 30 | "ngx-bootstrap": "^5.1.1", | 
| 30 | "popper.js": "^1.15.0", | 31 | "popper.js": "^1.15.0", | 
| 31 | "rxjs": "~6.4.0", | 32 | "rxjs": "~6.4.0", | 
| 32 | "rxjs-compat": "^6.5.2", | 33 | "rxjs-compat": "^6.5.2", | 
| 33 | "simple-keyboard": "^2.26.2", | 34 | "simple-keyboard": "^2.26.2", | 
| 34 | "tslib": "^1.9.0", | 35 | "tslib": "^1.9.0", | 
| 35 | "zone.js": "~0.9.1" | 36 | "zone.js": "~0.9.1" | 
| 36 | }, | 37 | }, | 
| 37 | "devDependencies": { | 38 | "devDependencies": { | 
| 38 | "@angular-devkit/build-angular": "~0.800.0", | 39 | "@angular-devkit/build-angular": "~0.800.0", | 
| 39 | "@angular/cli": "~8.0.0", | 40 | "@angular/cli": "~8.0.0", | 
| 40 | "@angular/compiler-cli": "~8.0.0", | 41 | "@angular/compiler-cli": "~8.0.0", | 
| 41 | "@angular/language-service": "~8.0.0", | 42 | "@angular/language-service": "~8.0.0", | 
| 42 | "@types/node": "~8.9.4", | ||
| 43 | "@types/jasmine": "~3.3.8", | 43 | "@types/jasmine": "~3.3.8", | 
| 44 | "@types/jasminewd2": "~2.0.3", | 44 | "@types/jasminewd2": "~2.0.3", | 
| 45 | "@types/lodash": "^4.14.138", | ||
| 46 | "@types/node": "~8.9.4", | ||
| 45 | "codelyzer": "^5.0.0", | 47 | "codelyzer": "^5.0.0", | 
| 46 | "jasmine-core": "~3.4.0", | 48 | "jasmine-core": "~3.4.0", | 
| 47 | "jasmine-spec-reporter": "~4.2.1", | 49 | "jasmine-spec-reporter": "~4.2.1", | 
| 48 | "karma": "~4.1.0", | 50 | "karma": "~4.1.0", | 
| 49 | "karma-chrome-launcher": "~2.2.0", | 51 | "karma-chrome-launcher": "~2.2.0", | 
| 50 | "karma-coverage-istanbul-reporter": "~2.0.1", | 52 | "karma-coverage-istanbul-reporter": "~2.0.1", | 
| 51 | "karma-jasmine": "~2.0.1", | 53 | "karma-jasmine": "~2.0.1", | 
| 52 | "karma-jasmine-html-reporter": "^1.4.0", | 54 | "karma-jasmine-html-reporter": "^1.4.0", | 
| 53 | "protractor": "~5.4.0", | 55 | "protractor": "~5.4.0", | 
| 54 | "ts-node": "~7.0.0", | 56 | "ts-node": "~7.0.0", | 
| 55 | "tslint": "~5.15.0", | 57 | "tslint": "~5.15.0", | 
| 56 | "typescript": "~3.4.3" | 58 | "typescript": "~3.4.3" | 
| 57 | } | 59 | } | 
| 58 | } | 60 | } | 
src/app/components/comanda/comanda.component.html
| 1 | <div class="container-fluid fade-in p-0"> | 1 | <div class="container-fluid fade-in p-0"> | 
| 2 | <div class="row m-1 fade-in disable-user-select"> | 2 | <div class="row m-1 fade-in disable-user-select"> | 
| 3 | <div | 3 | <div | 
| 4 | [ngClass]="{ 'swing-out-top-bck': comanda.estado === 3 }" | 4 | [ngClass]="{ 'swing-out-top-bck': comanda.estado === 3 }" | 
| 5 | class="col-2 col-1-5 p-1" *ngFor="let comanda of comandas"> | 5 | class="col-2 col-1-5 p-1" *ngFor="let comanda of comandas"> | 
| 6 | 6 | ||
| 7 | <div | 7 | <div | 
| 8 | class="card-comanda fade-in d-flex align-items-end flex-column bg-danger rounded-xs shadow-sm border-0 h-100" | 8 | class="card-comanda fade-in d-flex align-items-end flex-column bg-danger rounded-xs shadow-sm border-0 h-100" | 
| 9 | [ngClass]=" | 9 | [ngClass]=" | 
| 10 | { | 10 | { | 
| 11 | 'bg-light': comanda.estado === 1, | 11 | 'bg-light': comanda.estado === 1, | 
| 12 | 'bg-danger': comanda.estado === 2, | 12 | 'bg-danger': comanda.estado === 2, | 
| 13 | 'bg-success': comanda.estado === 3 | 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 | <div class="row w-100 m-0 mt-2"> | 18 | <div class="row w-100 m-0 mt-2"> | 
| 17 | <p class="col-12 px-2 mb-2 m-0 h6">Title</p> | 19 | <p class="col-12 px-2 mb-2 m-0 h6">{{comanda.detalles[0].articulo.DetArt}}</p> | 
| 18 | <p class="col-12 px-2 mb-2 m-0 h6"><small>Text</small></p> | 20 | <p class="col-12 px-2 mb-2 m-0 h6"><small>{{comanda.detalles[0].articulo.DET_LAR}}</small></p> | 
| 19 | </div> | 21 | </div> | 
| 20 | <div class="row w-100 m-0 mb-2 mt-auto"> | 22 | <div class="row w-100 m-0 mb-2 mt-auto"> | 
| 21 | <div | 23 | <div | 
| 22 | class="col-12 px-2" | 24 | class="col-12 px-2" | 
| 23 | *ngIf="comanda.estado === 1"> | 25 | *ngIf="comanda.estado === 1"> | 
| 24 | <button | 26 | <button | 
| 25 | class="btn btn-block btn-danger shadow-sm" | 27 | class="btn btn-block btn-danger shadow-sm" | 
| 26 | (click)="updateComanda(comanda, 2, 'En elaboracion')"> | 28 | (click)="updateComanda(comanda, 2, 'En elaboracion')"> | 
| 27 | Elaborar | 29 | Elaborar | 
| 28 | </button> | 30 | </button> | 
| 29 | </div> | 31 | </div> | 
| 30 | <div | 32 | <div | 
| 31 | class="col-12 px-2" | 33 | class="col-12 px-2" | 
| 32 | *ngIf="comanda.estado === 2"> | 34 | *ngIf="comanda.estado === 2"> | 
| 33 | <button | 35 | <button | 
| 34 | class="btn btn-block btn-success shadow-sm" | 36 | class="btn btn-block btn-success shadow-sm" | 
| 35 | (click)="updateComanda(comanda, 3, 'Terminado')"> | 37 | (click)="updateComanda(comanda, 3, 'Terminado')"> | 
| 36 | Terminado | 38 | Terminado | 
| 37 | </button> | 39 | </button> | 
| 38 | </div> | 40 | </div> | 
| 39 | </div> | 41 | </div> | 
| 40 | <div | 42 | <div | 
| 41 | *ngIf="comanda.estado === 2" | 43 | *ngIf="comanda.estado === 2" | 
| 42 | class="row w-100 mx-0 mb-2"> | 44 | class="row w-100 mx-0 mb-2"> | 
| 43 | <div class="col-12 px-2"> | 45 | <div class="col-12 px-2"> | 
| 44 | <button | 46 | <button | 
| 45 | class="btn btn-block btn-light btn-sm shadow-sm p-0" | 47 | class="btn btn-block btn-light btn-sm shadow-sm p-0" | 
| 46 | (click)="updateComanda(comanda, 1, 'Pagado')"> | 48 | (click)="updateComanda(comanda, 1, 'Pagado')"> | 
| 47 | <span class="pr-1 h6"><small>En espera</small></span> | 49 | <span class="pr-1 h6"><small>En espera</small></span> | 
| 48 | <i class="fa fa-undo text-warning" aria-hidden="true"></i> | 50 | <i class="fa fa-undo text-warning" aria-hidden="true"></i> | 
| 49 | </button> | 51 | </button> | 
| 50 | </div> | 52 | </div> | 
| 51 | </div> | 53 | </div> | 
| 52 | </div> | 54 | </div> | 
| 53 | 55 | ||
| 54 | </div> | 56 | </div> | 
| 55 | </div> | 57 | </div> | 
| 56 | </div> | 58 | </div> | 
| 57 | 59 | 
src/app/components/comanda/comanda.component.ts
| 1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit } from '@angular/core'; | 
| 2 | import { appSettings } from 'src/etc/AppSettings'; | 2 | import { appSettings } from 'src/etc/AppSettings'; | 
| 3 | import { ComandaService } from 'src/app/services/comanda.service'; | 3 | import { ComandaService } from 'src/app/services/comanda.service'; | 
| 4 | import { Comanda } from 'src/app/wrappers/comanda'; | 4 | import { Comanda } from 'src/app/wrappers/comanda'; | 
| 5 | import * as _ from 'lodash'; | ||
| 5 | 6 | ||
| 6 | @Component({ | 7 | @Component({ | 
| 7 | selector: 'app-comanda', | 8 | selector: 'app-comanda', | 
| 8 | templateUrl: './comanda.component.html', | 9 | templateUrl: './comanda.component.html', | 
| 9 | styleUrls: ['./comanda.component.scss'] | 10 | styleUrls: ['./comanda.component.scss'] | 
| 10 | }) | 11 | }) | 
| 11 | export class ComandaComponent implements OnInit { | 12 | export class ComandaComponent implements OnInit { | 
| 12 | 13 | ||
| 13 | private apiImagenes = appSettings.apiImagenes; | 14 | private apiImagenes = appSettings.apiImagenes; | 
| 14 | private comandas: Comanda[] = []; | 15 | private comandas: Comanda[] = []; | 
| 16 | private cicloTime; | ||
| 15 | 17 | ||
| 16 | constructor( | 18 | constructor( | 
| 17 | private comandaService: ComandaService | 19 | private comandaService: ComandaService | 
| 18 | ) { } | 20 | ) { } | 
| 19 | 21 | ||
| 20 | ngOnInit() { | 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 | this.comandaService.getAll() | 36 | this.comandaService.getAll() | 
| 23 | .subscribe((res: Comanda[]) => { | 37 | .subscribe((res: Comanda[]) => { | 
| 38 | |||
| 39 | if (!_.isEqual(res, this.comandas)) { | ||
| 24 | 40 | ||
| 25 | this.comandas = res; | 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 | updateComanda(comanda: Comanda, estadoNuevo: number, observacionNueva: string) { | 54 | updateComanda(comanda: Comanda, estadoNuevo: number, observacionNueva: string) { | 
| 30 | 55 | ||
| 31 | this.comandaService.updateComanda(comanda.id, estadoNuevo, observacionNueva) | 56 | this.comandaService.updateComanda(comanda.id, estadoNuevo, observacionNueva) | 
| 32 | .subscribe(res => { | 57 | .subscribe(res => { | 
| 33 | 58 | ||
| 34 | if (res.data) { | 59 | if (res.data) { | 
| 35 | comanda.estado = estadoNuevo; | 60 | comanda.estado = estadoNuevo; | 
| 36 | comanda.observacion = observacionNueva; | 61 | comanda.observacion = observacionNueva; | 
| 37 | } | 62 | } | 
| 38 | }, e => console.error(e)) | 63 | }, e => console.error(e)) | 
| 39 | } | 64 | } | 
| 40 | 65 | ||
| 41 | } | 66 | } | 
| 42 | 67 | 
src/app/components/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.service'; | 2 | import { ComandaService } from 'src/app/services/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 | 10 | ||
| 11 | private pedidosRecientes = []; | 11 | private pedidosRecientes = []; | 
| 12 | private ciclo; | 12 | private cicloTime; | 
| 13 | 13 | ||
| 14 | constructor(private comandaService: ComandaService) { } | 14 | constructor(private comandaService: ComandaService) { } | 
| 15 | 15 | ||
| 16 | ngOnInit() { | 16 | ngOnInit() { | 
| 17 | this.buscar(); | ||
| 18 | 17 | ||
| 19 | this.ciclo = setTimeout(() => { | 18 | this.buscar(); | 
| 20 | this.buscar(); | 19 | this.ciclo(); | 
| 21 | }, 5000) | ||
| 22 | } | 20 | } | 
| 23 | 21 | ||
| 24 | ngOnDestroy() { | 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 | .subscribe((pedidos: []) => { | 39 | .subscribe((pedidos: []) => { | 
| 33 | 40 | ||
| 34 | this.pedidosRecientes = pedidos; | 41 | this.pedidosRecientes = pedidos; | 
| 35 | }, console.log); | 42 | }, console.log); | 
| 36 | } | 43 | } | 
| 37 | 44 | ||
| 38 | rellenar(relleno, longitud) { | 45 | rellenar(relleno, longitud) { | 
| 39 | relleno = '' + relleno; | 46 | relleno = '' + relleno; | 
| 40 | while (relleno.length < longitud) { | 47 | while (relleno.length < longitud) { | 
| 41 | relleno = '0' + relleno; | 48 | relleno = '0' + relleno; | 
| 42 | } | 49 | } | 
| 43 | return relleno; | 50 | return relleno; | 
| 44 | } | 51 | } |