Commit 5cb91c754535b3ff4af141792a9b2b5ded99e2b3
Exists in
develop
and in
1 other branch
Merge branch 'master' into 'develop'
Master(benjamin) See merge request !9
Showing
9 changed files
Show diff stats
src/app/app-routing.module.ts
1 | import { NgModule } from '@angular/core'; | 1 | import { NgModule } from '@angular/core'; |
2 | import { Routes, RouterModule } from '@angular/router'; | 2 | import { Routes, RouterModule } from '@angular/router'; |
3 | import { SplashScreenComponent } from './modules/splash-screen/splash-screen.component'; | 3 | import { SplashScreenComponent } from './modules/splash-screen/splash-screen.component'; |
4 | import { AdminComponent } from './modules/admin/admin.component'; | 4 | import { AdminComponent } from './modules/admin/admin.component'; |
5 | 5 | ||
6 | const routes: Routes = [ | 6 | const routes: Routes = [ |
7 | { path: '', component: SplashScreenComponent }, | 7 | { path: '', component: SplashScreenComponent }, |
8 | { | 8 | { |
9 | path: '', | 9 | path: '', |
10 | component: AdminComponent, | 10 | component: AdminComponent, |
11 | children: [ | 11 | children: [ |
12 | { | 12 | { |
13 | path: 'info-formas-pago', | 13 | path: 'info-formas-pago', |
14 | loadChildren: () => import('./modules/info-formas-pago/info-formas-pago.module').then(m => m.InfoFormasPagoModule) | 14 | loadChildren: () => import('./modules/info-formas-pago/info-formas-pago.module').then(m => m.InfoFormasPagoModule) |
15 | }, | 15 | }, |
16 | { | 16 | { |
17 | path: 'opcion-pedido', | 17 | path: 'opcion-pedido', |
18 | loadChildren: () => import('./modules/opcion-pedido/opcion-pedido.module').then(m => m.OpcionPedidoModule) | 18 | loadChildren: () => import('./modules/opcion-pedido/opcion-pedido.module').then(m => m.OpcionPedidoModule) |
19 | }, | 19 | }, |
20 | { | 20 | { |
21 | path: 'seleccion-articulos', | 21 | path: 'seleccion-articulos', |
22 | loadChildren: () => import('./modules/seleccion-articulos/seleccion-articulos.module').then(m => m.SeleccionArticulosModule) | 22 | loadChildren: () => import('./modules/seleccion-articulos/seleccion-articulos.module').then(m => m.SeleccionArticulosModule) |
23 | }, | 23 | }, |
24 | { | 24 | { |
25 | path: 'carrito', | 25 | path: 'carrito', |
26 | loadChildren: () => import('./modules/carrito/carrito.module').then(m => m.CarritoModule) | 26 | loadChildren: () => import('./modules/carrito/carrito.module').then(m => m.CarritoModule) |
27 | }, | 27 | }, |
28 | { | 28 | { |
29 | path: 'forma-pago', | 29 | path: 'forma-pago', |
30 | loadChildren: () => import('./modules/forma-pago/forma-pago.module').then(m => m.FormaPagoModule) | 30 | loadChildren: () => import('./modules/forma-pago/forma-pago.module').then(m => m.FormaPagoModule) |
31 | }, | 31 | }, |
32 | { | 32 | { |
33 | path: 'pago-electronico', | 33 | path: 'pago-electronico', |
34 | loadChildren: () => import('./modules/pago-electronico/pago-electronico.module').then(m => m.PagoElectronicoModule) | 34 | loadChildren: () => import('./modules/pago-electronico/pago-electronico.module').then(m => m.PagoElectronicoModule) |
35 | }, | 35 | }, |
36 | { | 36 | { |
37 | path: 'pago-tarjeta', | 37 | path: 'pago-tarjeta', |
38 | loadChildren: () => import('./modules/pago-tarjeta/pago-tarjeta.module').then(m => m.PagoTarjetaModule) | 38 | loadChildren: () => import('./modules/pago-tarjeta/pago-tarjeta.module').then(m => m.PagoTarjetaModule) |
39 | }, | 39 | }, |
40 | ] | 40 | ] |
41 | }, | 41 | }, |
42 | { | 42 | { |
43 | path: 'mensaje-final', | 43 | path: 'mensaje-final', |
44 | loadChildren: () => import('./modules/mensaje-final/mensaje-final.module').then(m => m.MensajeFinalModule) | 44 | loadChildren: () => import('./modules/mensaje-final/mensaje-final.module').then(m => m.MensajeFinalModule) |
45 | }, | 45 | }, |
46 | { | ||
47 | path: 'pedidos-salientes', | ||
48 | loadChildren: () => import('./modules/pedidos-salientes/pedidos-salientes.module').then(m => m.PedidosSalientesModule) | ||
49 | }, | ||
46 | { path: '**', redirectTo: '', pathMatch: 'full' }, | 50 | { path: '**', redirectTo: '', pathMatch: 'full' }, |
47 | ]; | 51 | ]; |
48 | 52 | ||
49 | @NgModule({ | 53 | @NgModule({ |
50 | imports: [RouterModule.forRoot(routes, { useHash: true })], | 54 | imports: [RouterModule.forRoot(routes, { useHash: true })], |
51 | exports: [RouterModule] | 55 | exports: [RouterModule] |
52 | }) | 56 | }) |
53 | export class AppRoutingModule { } | 57 | export class AppRoutingModule { } |
54 | 58 |
src/app/modules/pedidos-salientes/pedidos-salientes-routing.module.ts
File was created | 1 | import { NgModule } from '@angular/core'; | |
2 | import { Routes, RouterModule } from '@angular/router'; | ||
3 | import { PedidosSalientesComponent } from './pedidos-salientes.component'; | ||
4 | |||
5 | |||
6 | const routes: Routes = [ | ||
7 | { path: '', component: PedidosSalientesComponent } | ||
8 | ]; | ||
9 | |||
10 | @NgModule({ | ||
11 | imports: [RouterModule.forChild(routes)], | ||
12 | exports: [RouterModule] | ||
13 | }) | ||
14 | export class PedidosSalientesRoutingModule { } | ||
15 |
src/app/modules/pedidos-salientes/pedidos-salientes.component.html
File was created | 1 | <div class="row justify-content-center h-15"> | |
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"> | ||
4 | </div> | ||
5 | </div> | ||
6 | <div class="row mt-n5 justify-content-around h-75"> | ||
7 | <div class="col-5 col-md-3 h-100"> | ||
8 | <div class="p-3 bg-white text-center shadow-lg rounded h-100"> | ||
9 | <h5 class="pt-3">ESTAMOS</h5> | ||
10 | <h3 class="font-weight-bold text-secondary">preparando</h3> | ||
11 | <h5>TU PEDIDO</h5> | ||
12 | <div | ||
13 | *ngFor="let pedido of pedidosPendientes; let i = index" | ||
14 | [hidden]="i == 0 || i > 4" | ||
15 | class="font-weight-bold mb-2 text-muted"> | ||
16 | <h1 class="display-4">{{rellenar(pedido.id.toString().slice(1), 2)}}</h1> | ||
17 | </div> | ||
18 | </div> | ||
19 | </div> | ||
20 | <div class="col-5 col-md-3 h-100"> | ||
21 | <div class="p-3 bg-white shadow-lg rounded text-center h-100"> | ||
22 | <h5 class="pt-3">LISTO PARA</h5> | ||
23 | <h3 class="font-weight-bold text-primary">retirar</h3> | ||
24 | <div *ngIf="pedidoFinalizado.length"> | ||
25 | <h1 class="display-1 mt-4 text-primary mb-0">{{rellenar(pedidoFinalizado[0].id.toString().slice(1), 2)}}</h1> | ||
26 | <hr class="line mt-0"> | ||
27 | </div> | ||
28 | <h3 class="font-weight-bold text-info mt-4">¡Que lo disfrutes!</h3> | ||
29 | </div> | ||
30 | </div> | ||
31 | </div> | ||
32 |
src/app/modules/pedidos-salientes/pedidos-salientes.component.scss
File was created | 1 | hr.line { | |
2 | height: 10px; | ||
3 | border-radius: 15px; | ||
4 | box-shadow: 0 15px 13px -16px #8b8c8c inset; | ||
5 | } | ||
6 |
src/app/modules/pedidos-salientes/pedidos-salientes.component.spec.ts
File was created | 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
2 | |||
3 | import { PedidosSalientesComponent } from './pedidos-salientes.component'; | ||
4 | |||
5 | describe('PedidosSalientesComponent', () => { | ||
6 | let component: PedidosSalientesComponent; | ||
7 | let fixture: ComponentFixture<PedidosSalientesComponent>; | ||
8 | |||
9 | beforeEach(async(() => { | ||
10 | TestBed.configureTestingModule({ | ||
11 | declarations: [ PedidosSalientesComponent ] | ||
12 | }) | ||
13 | .compileComponents(); | ||
14 | })); | ||
15 | |||
16 | beforeEach(() => { | ||
17 | fixture = TestBed.createComponent(PedidosSalientesComponent); | ||
18 | component = fixture.componentInstance; | ||
19 | fixture.detectChanges(); | ||
20 | }); | ||
21 | |||
22 | it('should create', () => { | ||
23 | expect(component).toBeTruthy(); | ||
24 | }); | ||
25 | }); | ||
26 |
src/app/modules/pedidos-salientes/pedidos-salientes.component.ts
File was created | 1 | import { Component, OnInit } from '@angular/core'; | |
2 | import { ComandaService } from 'src/app/services/comanda/comanda.service'; | ||
3 | |||
4 | @Component({ | ||
5 | selector: 'app-pedidos-salientes', | ||
6 | templateUrl: './pedidos-salientes.component.html', | ||
7 | styleUrls: ['./pedidos-salientes.component.scss'] | ||
8 | }) | ||
9 | export class PedidosSalientesComponent implements OnInit { | ||
10 | pedidoFinalizado = []; | ||
11 | cicloTime; | ||
12 | pedidosPendientes = []; | ||
13 | |||
14 | constructor( | ||
15 | private comandaServices: ComandaService | ||
16 | ) { } | ||
17 | |||
18 | ngOnInit() { | ||
19 | this.buscarPedidosFinalizados(); | ||
20 | this.buscarPedidosPendientes(); | ||
21 | this.ciclo(); | ||
22 | } | ||
23 | |||
24 | ngOnDestroy() { | ||
25 | clearTimeout(this.cicloTime); | ||
26 | } | ||
27 | |||
28 | buscarPedidosFinalizados() { | ||
29 | this.comandaServices.getPendientesEntrega() | ||
30 | .subscribe((pedidos: []) => { | ||
31 | this.pedidoFinalizado = pedidos; | ||
32 | }); | ||
33 | } | ||
34 | |||
35 | buscarPedidosPendientes() { | ||
36 | this.comandaServices.getAll() | ||
37 | .subscribe((resComandas: []) => { | ||
38 | this.pedidosPendientes = resComandas; | ||
39 | }, e => console.error(e)); | ||
40 | } | ||
41 | |||
42 | ciclo() { | ||
43 | this.cicloTime = setTimeout(() => { | ||
44 | this.buscarPedidosFinalizados(); | ||
45 | this.buscarPedidosPendientes(); | ||
46 | this.ciclo(); | ||
47 | }, 5000); | ||
48 | } | ||
49 | |||
50 | rellenar(relleno, longitud) { | ||
51 | relleno = '' + relleno; | ||
52 | while (relleno.length < longitud) { | ||
53 | relleno = '0' + relleno; | ||
54 | } | ||
55 | return relleno; | ||
56 | } | ||
57 | |||
58 | } | ||
59 |
src/app/modules/pedidos-salientes/pedidos-salientes.module.ts
File was created | 1 | import { NgModule } from '@angular/core'; | |
2 | import { CommonModule } from '@angular/common'; | ||
3 | |||
4 | import { PedidosSalientesRoutingModule } from './pedidos-salientes-routing.module'; | ||
5 | import { PedidosSalientesComponent } from './pedidos-salientes.component'; | ||
6 | |||
7 | |||
8 | @NgModule({ | ||
9 | declarations: [PedidosSalientesComponent], | ||
10 | imports: [ | ||
11 | CommonModule, | ||
12 | PedidosSalientesRoutingModule | ||
13 | ] | ||
14 | }) | ||
15 | export class PedidosSalientesModule { } | ||
16 |
src/app/services/comanda/comanda.service.spec.ts
File was created | 1 | import { TestBed } from '@angular/core/testing'; | |
2 | |||
3 | import { ComandaService } from './comanda.service'; | ||
4 | |||
5 | describe('ComandaService', () => { | ||
6 | beforeEach(() => TestBed.configureTestingModule({})); | ||
7 | |||
8 | it('should be created', () => { | ||
9 | const service: ComandaService = TestBed.get(ComandaService); | ||
10 | expect(service).toBeTruthy(); | ||
11 | }); | ||
12 | }); | ||
13 |
src/app/services/comanda/comanda.service.ts
File was created | 1 | import { Injectable } from '@angular/core'; | |
2 | import { HttpClient } from "@angular/common/http"; | ||
3 | import { APP_SETTINGS } from "src/etc/AppSettings"; | ||
4 | |||
5 | @Injectable({ | ||
6 | providedIn: 'root' | ||
7 | }) | ||
8 | export class ComandaService { | ||
9 | urlDeboSuite = APP_SETTINGS.apiDeboSuite; | ||
10 | |||
11 | constructor( | ||
12 | private http: HttpClient, | ||
13 | ) { } | ||
14 | |||
15 | getPendientesEntrega() { | ||
16 | return this.http.get(`${this.urlDeboSuite}/comandas/pendientes-entrega`); | ||
17 | } | ||
18 | |||
19 | getAll() { | ||
20 | return this.http.get(`${this.urlDeboSuite}/comandas`); | ||
21 | } | ||
22 | |||
23 | } | ||
24 |