Commit 917a1f5510ab4688b80be0e1d7ee6a8595df9f29
Exists in
develop
and in
1 other branch
Merge branch 'master' into 'develop'
Master(benjamin) See merge request !17
Showing
18 changed files
Show diff stats
angular.json
| ... | ... | @@ -29,11 +29,13 @@ |
| 29 | 29 | ], |
| 30 | 30 | "styles": [ |
| 31 | 31 | "./node_modules/bootstrap/dist/css/bootstrap.min.css", |
| 32 | + "./node_modules/@fortawesome/fontawesome-free/css/all.min.css", | |
| 32 | 33 | "src/styles.scss" |
| 33 | 34 | ], |
| 34 | 35 | "scripts": [ |
| 35 | 36 | "./node_modules/jquery/dist/jquery.slim.min.js", |
| 36 | 37 | "./node_modules/popper.js/dist/umd/popper.min.js", |
| 38 | + "./node_modules/@fortawesome/fontawesome-free/js/all.min.js", | |
| 37 | 39 | "./node_modules/bootstrap/dist/js/bootstrap.min.js" |
| 38 | 40 | ] |
| 39 | 41 | }, |
package-lock.json
| ... | ... | @@ -1881,6 +1881,12 @@ |
| 1881 | 1881 | } |
| 1882 | 1882 | } |
| 1883 | 1883 | }, |
| 1884 | + "@fortawesome/fontawesome-free": { | |
| 1885 | + "version": "5.12.0", | |
| 1886 | + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.12.0.tgz", | |
| 1887 | + "integrity": "sha512-vKDJUuE2GAdBERaQWmmtsciAMzjwNrROXA5KTGSZvayAsmuTGjam5z6QNqNPCwDfVljLWuov1nEC3mEQf/n6fQ==", | |
| 1888 | + "dev": true | |
| 1889 | + }, | |
| 1884 | 1890 | "@ngtools/webpack": { |
| 1885 | 1891 | "version": "8.3.20", |
| 1886 | 1892 | "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-8.3.20.tgz", |
package.json
src/app/app-routing.module.ts
| ... | ... | @@ -47,6 +47,10 @@ const routes: Routes = [ |
| 47 | 47 | path: 'pedidos-salientes', |
| 48 | 48 | loadChildren: () => import('./modules/pedidos-salientes/pedidos-salientes.module').then(m => m.PedidosSalientesModule) |
| 49 | 49 | }, |
| 50 | + { | |
| 51 | + path: 'comanda', | |
| 52 | + loadChildren: () => import('./modules/comanda/comanda.module').then(m => m.ComandaModule) | |
| 53 | + }, | |
| 50 | 54 | { path: '**', redirectTo: '', pathMatch: 'full' }, |
| 51 | 55 | ]; |
| 52 | 56 |
src/app/app.module.ts
| ... | ... | @@ -10,6 +10,7 @@ import { SplashScreenComponent } from './modules/splash-screen/splash-screen.com |
| 10 | 10 | import { AdminComponent } from './modules/admin/admin.component'; |
| 11 | 11 | import { FooterComponent } from './shared/footer/footer.component'; |
| 12 | 12 | import { SharedModule } from './modules/shared/shared.module'; |
| 13 | +import { NgxSpinnerModule } from 'ngx-spinner'; | |
| 13 | 14 | |
| 14 | 15 | @NgModule({ |
| 15 | 16 | declarations: [ |
| ... | ... | @@ -28,6 +29,7 @@ import { SharedModule } from './modules/shared/shared.module'; |
| 28 | 29 | ReactiveFormsModule, |
| 29 | 30 | ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }), |
| 30 | 31 | SharedModule.forRoot(), |
| 32 | + NgxSpinnerModule, | |
| 31 | 33 | ], |
| 32 | 34 | bootstrap: [AppComponent] |
| 33 | 35 | }) |
src/app/interfaces/IComanda.ts
| ... | ... | @@ -0,0 +1,34 @@ |
| 1 | +export interface IComanda { | |
| 2 | + id: string; | |
| 3 | + estado: number; | |
| 4 | + observacion: string; | |
| 5 | + pedidoAnombreDe: string; | |
| 6 | + paraLlevar: boolean; | |
| 7 | + detalles: IComandaDetalle[]; | |
| 8 | + timerElaboracion?: any; | |
| 9 | + secondsElaboracion?: any; | |
| 10 | + hoursElaboracion?: any; | |
| 11 | + secondsPedido?: any; | |
| 12 | + hoursPedido?: any; | |
| 13 | +} | |
| 14 | + | |
| 15 | +export interface IComandaDetalle { | |
| 16 | + DetLar: string; | |
| 17 | + CodArt: number; | |
| 18 | + CodSec: number; | |
| 19 | + cantidad: number; | |
| 20 | + idArticulo: number; | |
| 21 | + componentes: IComponente[]; | |
| 22 | + seeDetalle?: boolean; | |
| 23 | +} | |
| 24 | + | |
| 25 | +export interface IComponente { | |
| 26 | + CodArt: number; | |
| 27 | + CodSec: number; | |
| 28 | + DetArt: string; | |
| 29 | + esSustraible: number; | |
| 30 | + esAdicionable: number; | |
| 31 | + tipoArticulo: number; | |
| 32 | + cantidadSeleccionada: number; | |
| 33 | + importeAdicional: number; | |
| 34 | +} |
src/app/modules/comanda/comanda-routing.module.ts
| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | +import { NgModule } from '@angular/core'; | |
| 2 | +import { Routes, RouterModule } from '@angular/router'; | |
| 3 | +import { ComandaComponent } from './comanda.component'; | |
| 4 | + | |
| 5 | + | |
| 6 | +const routes: Routes = [ | |
| 7 | + { path: '', component: ComandaComponent } | |
| 8 | +]; | |
| 9 | + | |
| 10 | +@NgModule({ | |
| 11 | + imports: [RouterModule.forChild(routes)], | |
| 12 | + exports: [RouterModule] | |
| 13 | +}) | |
| 14 | +export class ComandaRoutingModule { } |
src/app/modules/comanda/comanda.component.html
| ... | ... | @@ -0,0 +1,116 @@ |
| 1 | +<div class="container-fluid d-flex flex-column h-100 fade-in pb-4 pr-2"> | |
| 2 | + <div class="row pt-5 mt-n5"> | |
| 3 | + <div class="col-12"> | |
| 4 | + <p class="mb-3 h2 text-center mt-2">Pedidos a elaborar</p> | |
| 5 | + </div> | |
| 6 | + </div> | |
| 7 | + <div class="row flex-fill m-0 overflow-scroll"> | |
| 8 | + <div class="col-12 px-2"> | |
| 9 | + <div class="card-columns h-100 m-1 fade-in disable-user-select"> | |
| 10 | + <div | |
| 11 | + *ngFor="let comanda of comandas" | |
| 12 | + class="card fade-in rounded-xs shadow-sm mt-2" | |
| 13 | + [ngClass]="{ | |
| 14 | + 'bg-light': comanda.estado === 1, | |
| 15 | + 'bg-danger': comanda.estado === 2, | |
| 16 | + 'bg-success swing-out-top-bck': comanda.estado === 3 | |
| 17 | + }"> | |
| 18 | + <div class="card-body p-2"> | |
| 19 | + <div class="row justify-content-between"> | |
| 20 | + <img | |
| 21 | + src="../../../assets/img/para-llevar-fondo-sombra.png" | |
| 22 | + class="w-25 h-25 float-left ml-0 mt-n3" | |
| 23 | + *ngIf="comanda.paraLlevar == true"> | |
| 24 | + <div></div> | |
| 25 | + <!-- NUMERO DE PEDIDO --> | |
| 26 | + <p class="h1 text-right mr-3"> | |
| 27 | + {{rellenar(comanda.id.toString().slice(0), 3)}} | |
| 28 | + </p> | |
| 29 | + </div> | |
| 30 | + <div> | |
| 31 | + <!-- PEDIDO A NOMBRE DE --> | |
| 32 | + <p class="text-center m-0"> | |
| 33 | + {{comanda.pedidoAnombreDe ? comanda.pedidoAnombreDe.toUpperCase() : ''}} | |
| 34 | + </p> | |
| 35 | + <!-- TIMER PEDIDO --> | |
| 36 | + <div class="d-flex justify-content-between align-items-center mt-2"> | |
| 37 | + <p><i class="fas fa-user-clock text-info"></i></p> | |
| 38 | + <p class="text-center mb-1"> | |
| 39 | + {{comanda.hoursPedido}}:{{comanda.minutesPedido}}:{{comanda.secondsPedido}} | |
| 40 | + </p> | |
| 41 | + <p><i class="far fa-clock fa-spin text-info"></i></p> | |
| 42 | + </div> | |
| 43 | + <div *ngFor="let detalle of comanda.detalles"> | |
| 44 | + <p | |
| 45 | + class="card-text border-top pt-2 mb-2" | |
| 46 | + [ngClass]=" | |
| 47 | + { | |
| 48 | + 'border-secondary': comanda.estado === 1, | |
| 49 | + 'border-light': comanda.estado != 1 | |
| 50 | + }"> | |
| 51 | + <!-- DETALLE Y CANTIDAD --> | |
| 52 | + <small>{{detalle.DetLar}}</small><br> | |
| 53 | + <small>CANT.{{detalle.cantidad}}</small> | |
| 54 | + </p> | |
| 55 | + </div> | |
| 56 | + <!-- BOTONES --> | |
| 57 | + <button | |
| 58 | + *ngIf="comanda.estado === 1" | |
| 59 | + class="btn btn-block btn-primary shadow-sm btn-elaborar" | |
| 60 | + (click)="updateComanda(comanda, 2, 'En elaboracion')"> | |
| 61 | + <div class="row justify-content-between"> | |
| 62 | + <div></div> | |
| 63 | + <p class="ml-4" style="color: #fff;">Elaborar</p> | |
| 64 | + <img | |
| 65 | + draggable="false" | |
| 66 | + ondragstart="return false;" | |
| 67 | + (contextmenu)="false" | |
| 68 | + class="icon-30 mr-2" | |
| 69 | + src="assets/img/ir.svg"> | |
| 70 | + </div> | |
| 71 | + </button> | |
| 72 | + <button | |
| 73 | + *ngIf="comanda.estado === 2" | |
| 74 | + class="btn btn-block shadow-sm btn-terminar" | |
| 75 | + (click)="updateComanda(comanda, 3, 'Terminado')"> | |
| 76 | + <div class="row justify-content-between"> | |
| 77 | + <div></div> | |
| 78 | + <p class="ml-4">Terminar</p> | |
| 79 | + <img | |
| 80 | + draggable="false" | |
| 81 | + ondragstart="return false;" | |
| 82 | + (contextmenu)="false" | |
| 83 | + class="icon-30 mr-2" | |
| 84 | + src="assets/img/flecha-borde-color.svg"> | |
| 85 | + </div> | |
| 86 | + </button> | |
| 87 | + <button | |
| 88 | + *ngIf="comanda.estado === 2" | |
| 89 | + class="btn btn-block btn-deshacer btn-sm shadow-sm p-0" | |
| 90 | + (click)="updateComanda(comanda, 1, 'Pagado')"> | |
| 91 | + <div class="row justify-content-between"> | |
| 92 | + <div></div> | |
| 93 | + <span class="h6 ml-4"><small>Deshacer</small></span> | |
| 94 | + <i class="fas fa-undo-alt text-info mr-4 my-auto"></i> | |
| 95 | + </div> | |
| 96 | + </button> | |
| 97 | + </div> | |
| 98 | + <!-- TIMER DE ELABORACION --> | |
| 99 | + <div *ngIf="comanda.estado === 2" class="d-flex justify-content-between align-items-center mt-2"> | |
| 100 | + <div *ngIf="comanda.estado !== 1"> | |
| 101 | + <i class="fa fa-utensils text-info" aria-hidden="true"></i> | |
| 102 | + </div> | |
| 103 | + <span *ngIf="comanda.estado === 1" class="text-dark"> | |
| 104 | + {{comanda.hoursElaboracion}}:{{comanda.minutesElaboracion}}:{{comanda.secondsElaboracion}} | |
| 105 | + </span> | |
| 106 | + <span *ngIf="comanda.estado !== 1" class="text-white"> | |
| 107 | + {{comanda.hoursElaboracion}}:{{comanda.minutesElaboracion}}:{{comanda.secondsElaboracion}} | |
| 108 | + </span> | |
| 109 | + <i class="fas fa-clock fa-spin text-info"></i> | |
| 110 | + </div> | |
| 111 | + </div> | |
| 112 | + </div> | |
| 113 | + </div> | |
| 114 | + </div> | |
| 115 | + </div> | |
| 116 | +</div> |
src/app/modules/comanda/comanda.component.scss
| ... | ... | @@ -0,0 +1,163 @@ |
| 1 | +@media (min-width: 1200px) { | |
| 2 | + .col-1-5 { | |
| 3 | + flex: 0 0 12.5%; | |
| 4 | + max-width: 12.5%; | |
| 5 | + position: relative; | |
| 6 | + width: 100%; | |
| 7 | + padding-right: 15px; | |
| 8 | + padding-left: 15px; | |
| 9 | + } | |
| 10 | +} | |
| 11 | + | |
| 12 | +@media (min-width: 1200px) { | |
| 13 | + .card-columns { | |
| 14 | + column-count: 5 !important; | |
| 15 | + column-gap: 0.5rem !important; | |
| 16 | + } | |
| 17 | +} | |
| 18 | + | |
| 19 | +@media (max-width: 1200px) { | |
| 20 | + .card-columns { | |
| 21 | + column-count: 4 !important; | |
| 22 | + column-gap: 0.5rem !important; | |
| 23 | + } | |
| 24 | +} | |
| 25 | + | |
| 26 | +@media (max-width: 768px) { | |
| 27 | + .card-columns { | |
| 28 | + column-count: 3 !important; | |
| 29 | + column-gap: 0.5rem !important; | |
| 30 | + } | |
| 31 | +} | |
| 32 | + | |
| 33 | +.bg-danger { | |
| 34 | + transition: 0.2s; | |
| 35 | + background-color: #aa006b !important; | |
| 36 | + p { | |
| 37 | + color: #fff; | |
| 38 | + } | |
| 39 | +} | |
| 40 | + | |
| 41 | +.bg-success { | |
| 42 | + transition: 0.2s; | |
| 43 | + background-color: #EEEEF0 !important; | |
| 44 | + p { | |
| 45 | + color: black; | |
| 46 | + } | |
| 47 | +} | |
| 48 | + | |
| 49 | +.bg-light { | |
| 50 | + transition: 0.2s; | |
| 51 | + background-color: white !important; | |
| 52 | + p { | |
| 53 | + color: #212529; | |
| 54 | + } | |
| 55 | +} | |
| 56 | + | |
| 57 | +.bg-dark-red { | |
| 58 | + background-color: #670006 !important; | |
| 59 | + p { | |
| 60 | + color: white; | |
| 61 | + } | |
| 62 | +} | |
| 63 | + | |
| 64 | +.btn-elaborar { | |
| 65 | + border-radius: 2rem; | |
| 66 | + .p { | |
| 67 | + color: #fff; | |
| 68 | + } | |
| 69 | +} | |
| 70 | + | |
| 71 | +.btn-deshacer { | |
| 72 | + background-color: #fff; | |
| 73 | + border-radius: 2rem; | |
| 74 | +} | |
| 75 | + | |
| 76 | +.btn-terminar { | |
| 77 | + background-color: rgb(212, 212, 212); | |
| 78 | + border-radius: 2rem; | |
| 79 | + p { | |
| 80 | + color: #212529; | |
| 81 | + } | |
| 82 | +} | |
| 83 | + | |
| 84 | +.rounded-xs { | |
| 85 | + border-radius: 1rem; | |
| 86 | + border-color: #aa006b ; | |
| 87 | +} | |
| 88 | + | |
| 89 | +.card-comanda { | |
| 90 | + min-height: 250px; | |
| 91 | +} | |
| 92 | + | |
| 93 | +.swing-out-top-bck { | |
| 94 | + -webkit-animation: swing-out-top-bck 0.45s | |
| 95 | + cubic-bezier(0.6, -0.28, 0.735, 0.045) 10s both; | |
| 96 | + animation: swing-out-top-bck 0.8s cubic-bezier(0.6, -0.28, 0.735, 0.045) 10s | |
| 97 | + both; | |
| 98 | +} | |
| 99 | + | |
| 100 | +@-webkit-keyframes swing-out-top-bck { | |
| 101 | + 0% { | |
| 102 | + -webkit-transform: rotateX(0deg); | |
| 103 | + transform: rotateX(0deg); | |
| 104 | + -webkit-transform-origin: top; | |
| 105 | + transform-origin: top; | |
| 106 | + opacity: 1; | |
| 107 | + } | |
| 108 | + 75% { | |
| 109 | + -webkit-transform: rotateX(-100deg); | |
| 110 | + transform: rotateX(-100deg); | |
| 111 | + -webkit-transform-origin: top; | |
| 112 | + transform-origin: top; | |
| 113 | + } | |
| 114 | + 100% { | |
| 115 | + -webkit-transform: rotateX(-100deg); | |
| 116 | + transform: rotateX(-100deg); | |
| 117 | + -webkit-transform-origin: top; | |
| 118 | + transform-origin: top; | |
| 119 | + opacity: 0; | |
| 120 | + display: none; | |
| 121 | + position: absolute; | |
| 122 | + } | |
| 123 | +} | |
| 124 | + | |
| 125 | +@keyframes swing-out-top-bck { | |
| 126 | + 0% { | |
| 127 | + -webkit-transform: rotateX(0deg); | |
| 128 | + transform: rotateX(0deg); | |
| 129 | + -webkit-transform-origin: top; | |
| 130 | + transform-origin: top; | |
| 131 | + opacity: 1; | |
| 132 | + } | |
| 133 | + 75% { | |
| 134 | + -webkit-transform: rotateX(-100deg); | |
| 135 | + transform: rotateX(-100deg); | |
| 136 | + -webkit-transform-origin: top; | |
| 137 | + transform-origin: top; | |
| 138 | + } | |
| 139 | + 100% { | |
| 140 | + -webkit-transform: rotateX(-100deg); | |
| 141 | + transform: rotateX(-100deg); | |
| 142 | + -webkit-transform-origin: top; | |
| 143 | + transform-origin: top; | |
| 144 | + opacity: 0; | |
| 145 | + display: none; | |
| 146 | + position: absolute; | |
| 147 | + } | |
| 148 | +} | |
| 149 | + | |
| 150 | +blockquote p::before, | |
| 151 | +blockquote p::after { | |
| 152 | + content: "โ"; | |
| 153 | + font-family: Georgia; | |
| 154 | + font-size: 40px; | |
| 155 | + margin: -10px 0 0 -20px !important; | |
| 156 | + position: absolute; | |
| 157 | + opacity: 0.5; | |
| 158 | +} | |
| 159 | + | |
| 160 | +blockquote p::after { | |
| 161 | + content: "โ"; | |
| 162 | + margin: -5px 0 0 4px !important; | |
| 163 | +} |
src/app/modules/comanda/comanda.component.spec.ts
| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
| 2 | + | |
| 3 | +import { ComandaComponent } from './comanda.component'; | |
| 4 | + | |
| 5 | +describe('ComandaComponent', () => { | |
| 6 | + let component: ComandaComponent; | |
| 7 | + let fixture: ComponentFixture<ComandaComponent>; | |
| 8 | + | |
| 9 | + beforeEach(async(() => { | |
| 10 | + TestBed.configureTestingModule({ | |
| 11 | + declarations: [ ComandaComponent ] | |
| 12 | + }) | |
| 13 | + .compileComponents(); | |
| 14 | + })); | |
| 15 | + | |
| 16 | + beforeEach(() => { | |
| 17 | + fixture = TestBed.createComponent(ComandaComponent); | |
| 18 | + component = fixture.componentInstance; | |
| 19 | + fixture.detectChanges(); | |
| 20 | + }); | |
| 21 | + | |
| 22 | + it('should create', () => { | |
| 23 | + expect(component).toBeTruthy(); | |
| 24 | + }); | |
| 25 | +}); |
src/app/modules/comanda/comanda.component.ts
| ... | ... | @@ -0,0 +1,118 @@ |
| 1 | +import { Component, OnInit } from '@angular/core'; | |
| 2 | +import { IComanda, IComandaDetalle, IComponente } from 'src/app/interfaces/IComanda'; | |
| 3 | +import { ComandaService } from 'src/app/services/comanda/comanda.service'; | |
| 4 | +import * as _ from 'lodash'; | |
| 5 | +import { NgxSpinnerService } from 'ngx-spinner' | |
| 6 | + | |
| 7 | +@Component({ | |
| 8 | + selector: 'app-comanda', | |
| 9 | + templateUrl: './comanda.component.html', | |
| 10 | + styleUrls: ['./comanda.component.scss'] | |
| 11 | +}) | |
| 12 | +export class ComandaComponent implements OnInit { | |
| 13 | + comandas: IComanda[] = []; | |
| 14 | + cicloTime: any; | |
| 15 | + | |
| 16 | + constructor( | |
| 17 | + private comandaService: ComandaService, | |
| 18 | + private spinnerService: NgxSpinnerService, | |
| 19 | + ) { } | |
| 20 | + | |
| 21 | + ngOnInit() { | |
| 22 | + this.getComandas(); | |
| 23 | + this.timerGetComandas(); | |
| 24 | + } | |
| 25 | + | |
| 26 | + ngOnDestroy() { | |
| 27 | + clearInterval(this.cicloTime); | |
| 28 | + } | |
| 29 | + | |
| 30 | + timerGetComandas() { | |
| 31 | + this.cicloTime = setInterval(() => { | |
| 32 | + this.getComandas(); | |
| 33 | + }, 5000); | |
| 34 | + } | |
| 35 | + | |
| 36 | + getComandas() { | |
| 37 | + this.comandaService.getAll() | |
| 38 | + .subscribe((resComandas: IComanda[]) => { | |
| 39 | + this.addNewComandas(resComandas); | |
| 40 | + }, e => console.error(e)); | |
| 41 | + } | |
| 42 | + | |
| 43 | + addNewComandas(resComandas: IComanda[]) { | |
| 44 | + for (let j = 0; j < resComandas.length; j++) { | |
| 45 | + for (let i = 0; i < this.comandas.length; i++) { | |
| 46 | + if (this.comandas[i].id === resComandas[j].id) { | |
| 47 | + resComandas.splice(j, 1); | |
| 48 | + } | |
| 49 | + } | |
| 50 | + } | |
| 51 | + if (!resComandas.length) return; | |
| 52 | + Array.prototype.push.apply(this.comandas, resComandas); | |
| 53 | + this.startTimersPedido(resComandas); | |
| 54 | + } | |
| 55 | + | |
| 56 | + updateComanda(comanda: IComanda, estadoNuevo: number, observacionNueva: string) { | |
| 57 | + let data = { | |
| 58 | + idComanda: comanda.id, | |
| 59 | + estado: estadoNuevo, | |
| 60 | + observacion: observacionNueva, | |
| 61 | + tiempoEspera: `${comanda.hoursPedido}:${comanda.secondsPedido}:${comanda.secondsPedido}`, | |
| 62 | + tiempoElaboracion: `${comanda.hoursElaboracion}:${comanda.secondsElaboracion}:${comanda.secondsElaboracion}`, | |
| 63 | + } | |
| 64 | + if (data.estado == 3) { | |
| 65 | + this.comandaService.imprimirComandaCocina(parseInt(data.idComanda)) | |
| 66 | + .subscribe(res => { }, err => console.error(err) | |
| 67 | + ); | |
| 68 | + } | |
| 69 | + | |
| 70 | + if (estadoNuevo !== 2) comanda.detalles.forEach(d => d.seeDetalle = false); | |
| 71 | + | |
| 72 | + this.comandaService.update(data) | |
| 73 | + .subscribe((res: any) => { | |
| 74 | + if (res.data) { | |
| 75 | + comanda.estado = estadoNuevo; | |
| 76 | + comanda.observacion = observacionNueva; | |
| 77 | + if (estadoNuevo == 2) { | |
| 78 | + this.startTimerElaboracion(comanda); | |
| 79 | + } else if (comanda.timerElaboracion) { | |
| 80 | + clearInterval(comanda.timerElaboracion) | |
| 81 | + } | |
| 82 | + } | |
| 83 | + }, e => console.error(e)); | |
| 84 | + } | |
| 85 | + | |
| 86 | + rellenar(relleno, longitud) { | |
| 87 | + relleno = '' + relleno; | |
| 88 | + while (relleno.length < longitud) { | |
| 89 | + relleno = '0' + relleno; | |
| 90 | + } | |
| 91 | + return relleno; | |
| 92 | + } | |
| 93 | + | |
| 94 | + toggleVerComponentes(detalle: IComandaDetalle, comanda: IComanda) { | |
| 95 | + detalle.seeDetalle = !detalle.seeDetalle; | |
| 96 | + } | |
| 97 | + | |
| 98 | + hasTipo(componentes: IComponente[]) { | |
| 99 | + return componentes.some(c => c.tipoArticulo === 6); | |
| 100 | + } | |
| 101 | + | |
| 102 | + //#region TIMERS | |
| 103 | + startTimersPedido(comandas) { | |
| 104 | + comandas.forEach((comanda: IComanda) => { | |
| 105 | + this.comandaService.startTimerComanda(comanda, 'Pedido'); | |
| 106 | + if (comanda.estado === 2) { | |
| 107 | + this.startTimerElaboracion(comanda); | |
| 108 | + } | |
| 109 | + }); | |
| 110 | + } | |
| 111 | + | |
| 112 | + startTimerElaboracion(comanda: IComanda) { | |
| 113 | + this.spinnerService.show(comanda.id.toString()); | |
| 114 | + this.comandaService.startTimerComanda(comanda, 'Elaboracion'); | |
| 115 | + } | |
| 116 | + //#endregion | |
| 117 | + | |
| 118 | +} |
src/app/modules/comanda/comanda.module.ts
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +import { NgModule } from '@angular/core'; | |
| 2 | +import { CommonModule } from '@angular/common'; | |
| 3 | + | |
| 4 | +import { ComandaRoutingModule } from './comanda-routing.module'; | |
| 5 | +import { ComandaComponent } from './comanda.component'; | |
| 6 | + | |
| 7 | + | |
| 8 | +@NgModule({ | |
| 9 | + declarations: [ComandaComponent], | |
| 10 | + imports: [ | |
| 11 | + CommonModule, | |
| 12 | + ComandaRoutingModule | |
| 13 | + ] | |
| 14 | +}) | |
| 15 | +export class ComandaModule { } |
src/app/modules/mensaje-final/mensaje-final.component.ts
| ... | ... | @@ -8,6 +8,7 @@ import { Router } from '@angular/router'; |
| 8 | 8 | styleUrls: ['./mensaje-final.component.scss'] |
| 9 | 9 | }) |
| 10 | 10 | export class MensajeFinalComponent implements OnInit { |
| 11 | + timer: any; | |
| 11 | 12 | |
| 12 | 13 | constructor( |
| 13 | 14 | public articuloService: ArticuloService, |
| ... | ... | @@ -15,11 +16,15 @@ export class MensajeFinalComponent implements OnInit { |
| 15 | 16 | ) { } |
| 16 | 17 | |
| 17 | 18 | ngOnInit() { |
| 18 | - setTimeout(() => { | |
| 19 | + this.timer = setTimeout(() => { | |
| 19 | 20 | this.goToSplash(); |
| 20 | 21 | }, 10000); |
| 21 | 22 | } |
| 22 | 23 | |
| 24 | + ngOnDestroy() { | |
| 25 | + clearTimeout(this.timer); | |
| 26 | + } | |
| 27 | + | |
| 23 | 28 | goToSplash() { |
| 24 | 29 | this.articuloService.cleanShoppingCar(); |
| 25 | 30 | this.router.navigate(['']); |
src/app/services/comanda/comanda.service.ts
| 1 | 1 | import { Injectable } from '@angular/core'; |
| 2 | 2 | import { HttpClient } from '@angular/common/http'; |
| 3 | 3 | import { APP_SETTINGS } from 'src/etc/AppSettings'; |
| 4 | +import { IComanda } from 'src/app/interfaces/IComanda'; | |
| 4 | 5 | |
| 5 | 6 | @Injectable({ |
| 6 | 7 | providedIn: 'root' |
| ... | ... | @@ -16,8 +17,40 @@ export class ComandaService { |
| 16 | 17 | return this.http.get(`${this.urlDeboSuite}/comandas/pendientes-entrega`); |
| 17 | 18 | } |
| 18 | 19 | |
| 20 | + update(data: object) { | |
| 21 | + return this.http.post(`${this.urlDeboSuite}/comandas/update`, { data: data }); | |
| 22 | + } | |
| 23 | + | |
| 19 | 24 | getAll() { |
| 20 | 25 | return this.http.get(`${this.urlDeboSuite}/comandas`); |
| 21 | 26 | } |
| 22 | 27 | |
| 28 | + imprimirComandaCocina(idComanda: number) { | |
| 29 | + return this.http.get(`${this.urlDeboSuite}/comandas/imprimir/${idComanda}`); | |
| 30 | + } | |
| 31 | + | |
| 32 | + startTimerComanda(comanda: IComanda, tipo: string) { | |
| 33 | + let hours = 0; | |
| 34 | + let minutes = 0; | |
| 35 | + let seconds = 0; | |
| 36 | + comanda[`hours${tipo}`] = '0'; | |
| 37 | + comanda[`seconds${tipo}`] = comanda[`minutes${tipo}`] = '00'; | |
| 38 | + comanda[`timer${tipo}`] = setInterval(() => { | |
| 39 | + seconds++; | |
| 40 | + comanda[`seconds${tipo}`] = seconds < 10 ? `0${seconds}` : seconds.toString(); | |
| 41 | + if (seconds === 60) { | |
| 42 | + minutes++; | |
| 43 | + comanda[`minutes${tipo}`] = minutes < 10 ? `0${minutes}` : minutes.toString(); | |
| 44 | + seconds = 0; | |
| 45 | + comanda[`seconds${tipo}`] = '00'; | |
| 46 | + } | |
| 47 | + if (minutes === 60) { | |
| 48 | + hours++; | |
| 49 | + minutes = 0; | |
| 50 | + comanda[`hours${tipo}`] = hours.toString(); | |
| 51 | + comanda[`minutes${tipo}`] = '00'; | |
| 52 | + } | |
| 53 | + }, 1000); | |
| 54 | + } | |
| 55 | + | |
| 23 | 56 | } |
src/assets/img/flecha-borde-color.svg
| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | |
| 3 | +<!-- Creator: CorelDRAW X7 --> | |
| 4 | +<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="19.8306mm" height="19.8306mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" | |
| 5 | +viewBox="0 0 523 523" | |
| 6 | + xmlns:xlink="http://www.w3.org/1999/xlink"> | |
| 7 | + <defs> | |
| 8 | + <style type="text/css"> | |
| 9 | + <![CDATA[ | |
| 10 | + .fil0 {fill:#AA006B;fill-rule:nonzero} | |
| 11 | + ]]> | |
| 12 | + </style> | |
| 13 | + </defs> | |
| 14 | + <g id="Capa_x0020_1"> | |
| 15 | + <metadata id="CorelCorpID_0Corel-Layer"/> | |
| 16 | + <path class="fil0" d="M262 0c72,0 137,29 185,77 47,47 76,112 76,185 0,72 -29,137 -76,185 -48,47 -113,76 -185,76 -73,0 -138,-29 -185,-76 -48,-48 -77,-113 -77,-185 0,-73 29,-138 77,-185 47,-48 112,-77 185,-77zm169 92c-43,-43 -103,-70 -169,-70 -66,0 -126,27 -170,70 -43,44 -70,104 -70,170 0,66 27,126 70,169 44,43 104,70 170,70 66,0 126,-27 169,-70 43,-43 70,-103 70,-169 0,-66 -27,-126 -70,-170zm-202 32l110 138 -110 137 -16 -16 95 -121 -95 -122 16 -16z"/> | |
| 17 | + </g> | |
| 18 | +</svg> |
src/assets/img/logodebogris.png
26.1 KB
src/assets/img/para-llevar-fondo-sombra.png
8.33 KB
src/assets/img/para-llevar-fondo.png
6.99 KB