Commit ac964d0816946c62d733eb55334c641f1716b17e

Authored by Marcelo Puebla
1 parent e635d1e96e
Exists in master and in 1 other branch validar_pve

Creado componente comanda.

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 { HomeComponent } from './components/home/home.component'; 3 import { HomeComponent } from './components/home/home.component';
4 import { InicioComponent } from './components/inicio/inicio.component'; 4 import { InicioComponent } from './components/inicio/inicio.component';
5 import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component'; 5 import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component';
6 import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component'; 6 import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component';
7 import { MasterComponent } from './components/master/master.component'; 7 import { MasterComponent } from './components/master/master.component';
8 import { AmbImagenesComponent } from './components/amb-imagenes/amb-imagenes.component'; 8 import { AmbImagenesComponent } from './components/amb-imagenes/amb-imagenes.component';
9 import { PagoComponent } from './components/pago/pago.component'; 9 import { PagoComponent } from './components/pago/pago.component';
10 import { CancelarCompraComponent } from './components/cancelar-compra/cancelar-compra.component'; 10 import { CancelarCompraComponent } from './components/cancelar-compra/cancelar-compra.component';
11 import { MensajeFinalComponent } from './components/mensaje-final/mensaje-final.component'; 11 import { MensajeFinalComponent } from './components/mensaje-final/mensaje-final.component';
12 import { ComandaComponent } from './components/comanda/comanda.component';
12 13
13 const routes: Routes = [ 14 const routes: Routes = [
14 { path: '', component: HomeComponent }, 15 { path: '', component: HomeComponent },
15 { path: 'home', component: HomeComponent }, 16 { path: 'home', component: HomeComponent },
16 { path: 'abm-imagenes', component: AmbImagenesComponent }, 17 { path: 'abm-imagenes', component: AmbImagenesComponent },
17 { path: 'confirmacion-carrito', component: ConfirmacionCarritoComponent }, 18 { path: 'confirmacion-carrito', component: ConfirmacionCarritoComponent },
18 { path: 'pago', component: PagoComponent }, 19 { path: 'pago', component: PagoComponent },
19 { path: 'cancelar-compra', component: CancelarCompraComponent }, 20 { path: 'cancelar-compra', component: CancelarCompraComponent },
20 { path: 'mensaje-final', component: MensajeFinalComponent }, 21 { path: 'mensaje-final', component: MensajeFinalComponent },
22 { path: 'comanda', component: ComandaComponent },
21 { 23 {
22 path: '', 24 path: '',
23 component: MasterComponent, 25 component: MasterComponent,
24 children: [ 26 children: [
25 { path: 'inicio', component: InicioComponent }, 27 { path: 'inicio', component: InicioComponent },
26 { path: 'busqueda-productos', component: BusquedaProductosComponent } 28 { path: 'busqueda-productos', component: BusquedaProductosComponent }
27 ] 29 ]
28 }, 30 },
29 { path: '**', redirectTo: '/home', pathMatch: 'full' }, 31 { path: '**', redirectTo: '/home', pathMatch: 'full' },
30 ]; 32 ];
31 33
32 @NgModule({ 34 @NgModule({
33 imports: [RouterModule.forRoot(routes, {onSameUrlNavigation: 'reload'})], 35 imports: [RouterModule.forRoot(routes, {onSameUrlNavigation: 'reload'})],
34 exports: [RouterModule] 36 exports: [RouterModule]
35 }) 37 })
36 38
37 export class AppRoutingModule { } 39 export class AppRoutingModule { }
38 40
src/app/app.module.ts
1 //#region MODULES 1 //#region MODULES
2 import { BrowserModule } from '@angular/platform-browser'; 2 import { BrowserModule } from '@angular/platform-browser';
3 import { NgModule } from '@angular/core'; 3 import { NgModule } from '@angular/core';
4 import { AppRoutingModule } from './app-routing.module'; 4 import { AppRoutingModule } from './app-routing.module';
5 import { HttpClientModule } from '@angular/common/http'; 5 import { HttpClientModule } from '@angular/common/http';
6 import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 6 import { FormsModule, ReactiveFormsModule } from '@angular/forms';
7 import { TooltipModule } from 'ngx-bootstrap/tooltip'; 7 import { TooltipModule } from 'ngx-bootstrap/tooltip';
8 import { PopoverModule } from 'ngx-bootstrap/popover'; 8 import { PopoverModule } from 'ngx-bootstrap/popover';
9 import { CarouselModule } from 'ngx-bootstrap/carousel'; 9 import { CarouselModule } from 'ngx-bootstrap/carousel';
10 import { PaginationModule } from 'ngx-bootstrap/pagination'; 10 import { PaginationModule } from 'ngx-bootstrap/pagination';
11 //#endregion 11 //#endregion
12 12
13 //#region Keyboard 13 //#region Keyboard
14 import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 14 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
15 import { MatButtonModule } from '@angular/material/button'; 15 import { MatButtonModule } from '@angular/material/button';
16 import { MatKeyboardModule } from '@ngx-material-keyboard/core'; 16 import { MatKeyboardModule } from '@ngx-material-keyboard/core';
17 //#endregion 17 //#endregion
18 18
19 //#region COMPONENTS 19 //#region COMPONENTS
20 import { AppComponent } from './app.component'; 20 import { AppComponent } from './app.component';
21 import { HeaderComponent } from './components/header/header.component'; 21 import { HeaderComponent } from './components/header/header.component';
22 import { SidebarComponent } from './components/sidebar/sidebar.component'; 22 import { SidebarComponent } from './components/sidebar/sidebar.component';
23 import { HomeComponent } from './components/home/home.component'; 23 import { HomeComponent } from './components/home/home.component';
24 import { InicioComponent } from './components/inicio/inicio.component'; 24 import { InicioComponent } from './components/inicio/inicio.component';
25 import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component'; 25 import { BusquedaProductosComponent } from './components/busqueda-productos/busqueda-productos.component';
26 import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component'; 26 import { ConfirmacionCarritoComponent } from './components/confirmacion-carrito/confirmacion-carrito.component';
27 import { MasterComponent } from './components/master/master.component'; 27 import { MasterComponent } from './components/master/master.component';
28 import { PopoverPromosComponent } from './components/popover-promos/popover-promos.component'; 28 import { PopoverPromosComponent } from './components/popover-promos/popover-promos.component';
29 import { PopoverSinonimosComponent } from './components/popover-sinonimos/popover-sinonimos.component'; 29 import { PopoverSinonimosComponent } from './components/popover-sinonimos/popover-sinonimos.component';
30 import { AmbImagenesComponent } from './components/amb-imagenes/amb-imagenes.component'; 30 import { AmbImagenesComponent } from './components/amb-imagenes/amb-imagenes.component';
31 import { PagoComponent } from './components/pago/pago.component'; 31 import { PagoComponent } from './components/pago/pago.component';
32 import { CancelarCompraComponent } from './components/cancelar-compra/cancelar-compra.component'; 32 import { CancelarCompraComponent } from './components/cancelar-compra/cancelar-compra.component';
33 import { MensajeFinalComponent } from './components/mensaje-final/mensaje-final.component'; 33 import { MensajeFinalComponent } from './components/mensaje-final/mensaje-final.component';
34 import { ComandaComponent } from './components/comanda/comanda.component';
34 //#endregion 35 //#endregion
35 36
36 @NgModule({ 37 @NgModule({
37 declarations: [ 38 declarations: [
38 AppComponent, 39 AppComponent,
39 HeaderComponent, 40 HeaderComponent,
40 SidebarComponent, 41 SidebarComponent,
41 HomeComponent, 42 HomeComponent,
42 InicioComponent, 43 InicioComponent,
43 BusquedaProductosComponent, 44 BusquedaProductosComponent,
44 ConfirmacionCarritoComponent, 45 ConfirmacionCarritoComponent,
45 MasterComponent, 46 MasterComponent,
46 PopoverPromosComponent, 47 PopoverPromosComponent,
47 PopoverSinonimosComponent, 48 PopoverSinonimosComponent,
48 AmbImagenesComponent, 49 AmbImagenesComponent,
49 PagoComponent, 50 PagoComponent,
50 CancelarCompraComponent, 51 CancelarCompraComponent,
51 MensajeFinalComponent 52 MensajeFinalComponent,
53 ComandaComponent
52 ], 54 ],
53 imports: [ 55 imports: [
54 BrowserModule, 56 BrowserModule,
55 AppRoutingModule, 57 AppRoutingModule,
56 HttpClientModule, 58 HttpClientModule,
57 FormsModule, 59 FormsModule,
58 ReactiveFormsModule, 60 ReactiveFormsModule,
59 ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }), 61 ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: 'never' }),
60 TooltipModule.forRoot(), 62 TooltipModule.forRoot(),
61 PopoverModule.forRoot(), 63 PopoverModule.forRoot(),
62 BrowserAnimationsModule, 64 BrowserAnimationsModule,
63 MatKeyboardModule, 65 MatKeyboardModule,
64 MatButtonModule, 66 MatButtonModule,
65 CarouselModule.forRoot(), 67 CarouselModule.forRoot(),
66 PaginationModule.forRoot() 68 PaginationModule.forRoot()
67 ], 69 ],
68 providers: [], 70 providers: [],
69 bootstrap: [AppComponent] 71 bootstrap: [AppComponent]
70 }) 72 })
71 export class AppModule { } 73 export class AppModule { }
72 74
src/app/components/comanda/comanda.component.html
File was created 1 <div class="container-fluid p-0">
2 <div class="row m-1 fade-in disable-user-select">
3 <div class="col-2 col-1-5 p-1" *ngFor="let item of itemsArray">
4 <div
5 class="card rounded-sm shadow-sm"
6 [ngClass]="{ 'green-card': false, 'red-card': false }"
7 >
8 <img
9 class="card-img-top rounded-sm shadow"
10 src="{{ apiImagenes }}/imagenes/cerealitas.jpg"
11 />
12 <div class="card-body px-1 py-2">
13 <p class="h6 card-title">Title</p>
14 <p class="card-text">Text</p>
15 <button class="btn btn-block btn-danger shadow p-1">Elaborar</button>
16 <button class="btn btn-block btn-success shadow p-1">
17 Terminado
18 </button>
19 <div class="row mt-2 m-0">
20 <div class="col-6 p-0 pr-1">
21 <button class="btn btn-block btn-secondary btn-sm shadow p-0">
22 <span class="pr-1 h7"><small>Eliminar</small></span>
23 <i class="fa fa-trash" aria-hidden="true"></i>
24 </button>
25 </div>
26 <div class="col-6 p-0 pl-1">
27 <button class="btn btn-block btn-light btn-sm shadow p-0">
28 <span class="pr-1 h7"><small>En espera</small></span>
29 <i class="fa fa-undo text-warning" aria-hidden="true"></i>
30 </button>
31 </div>
32 </div>
33 </div>
34 </div>
35 </div>
36 </div>
37 </div>
38
src/app/components/comanda/comanda.component.scss
File was created 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 .h7 {
13 font-size: 0.75rem;
14 }
15
16 .red-card {
17 background-color: #8c000e;
18 .card-body {
19 color: #fff;
20 }
21 }
22
23 .green-card {
24 background-color: #00751B;
25 .card-body {
26 color: #fff;
27 }
28 }
29
src/app/components/comanda/comanda.component.spec.ts
File was created 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 });
26
src/app/components/comanda/comanda.component.ts
File was created 1 import { Component, OnInit } from '@angular/core';
2 import { appSettings } from 'src/etc/AppSettings';
3
4 @Component({
5 selector: 'app-comanda',
6 templateUrl: './comanda.component.html',
7 styleUrls: ['./comanda.component.scss']
8 })
9 export class ComandaComponent implements OnInit {
10
11 private apiImagenes = appSettings.apiImagenes;
12 private itemsArray = [{},{},{},{},{},{},{},{}]
13
14 constructor() { }
15
16 ngOnInit() {
17 }
18
19 }
20