Commit a06557473a19947e6ae5c3995955075a4ab428d2
1 parent
08da9f7ace
Exists in
master
and in
1 other branch
agregada y maquetada pantalla de pago con tarjeta.
Showing
26 changed files
with
204 additions
and
5 deletions
Show diff stats
src/app/app.module.ts
| ... | ... | @@ -8,6 +8,7 @@ import { TooltipModule } from 'ngx-bootstrap/tooltip'; |
| 8 | 8 | import { PopoverModule } from 'ngx-bootstrap/popover'; |
| 9 | 9 | import { CarouselModule } from 'ngx-bootstrap/carousel'; |
| 10 | 10 | import { PaginationModule } from 'ngx-bootstrap/pagination'; |
| 11 | +import { ModalModule } from 'ngx-bootstrap/modal'; | |
| 11 | 12 | //#endregion |
| 12 | 13 | |
| 13 | 14 | //#region Keyboard |
| ... | ... | @@ -31,6 +32,7 @@ import { CancelarCompraComponent } from './components/cancelar-compra/cancelar-c |
| 31 | 32 | import { MensajeFinalComponent } from './components/mensaje-final/mensaje-final.component'; |
| 32 | 33 | import { ComandaComponent } from './components/comanda/comanda.component'; |
| 33 | 34 | import { PedidosSalientesComponent } from './components/pedidos-salientes/pedidos-salientes.component'; |
| 35 | +import { PagoConTarjetaComponent } from './components/pago-con-tarjeta/pago-con-tarjeta.component'; | |
| 34 | 36 | //#endregion |
| 35 | 37 | |
| 36 | 38 | @NgModule({ |
| ... | ... | @@ -48,7 +50,8 @@ import { PedidosSalientesComponent } from './components/pedidos-salientes/pedido |
| 48 | 50 | CancelarCompraComponent, |
| 49 | 51 | MensajeFinalComponent, |
| 50 | 52 | ComandaComponent, |
| 51 | - PedidosSalientesComponent | |
| 53 | + PedidosSalientesComponent, | |
| 54 | + PagoConTarjetaComponent | |
| 52 | 55 | ], |
| 53 | 56 | imports: [ |
| 54 | 57 | BrowserModule, |
| ... | ... | @@ -63,9 +66,11 @@ import { PedidosSalientesComponent } from './components/pedidos-salientes/pedido |
| 63 | 66 | MatKeyboardModule, |
| 64 | 67 | MatButtonModule, |
| 65 | 68 | CarouselModule.forRoot(), |
| 66 | - PaginationModule.forRoot() | |
| 69 | + PaginationModule.forRoot(), | |
| 70 | + ModalModule.forRoot(), | |
| 67 | 71 | ], |
| 68 | 72 | providers: [], |
| 69 | - bootstrap: [AppComponent] | |
| 73 | + bootstrap: [AppComponent], | |
| 74 | + entryComponents: [PagoConTarjetaComponent] | |
| 70 | 75 | }) |
| 71 | 76 | export class AppModule { } |
src/app/components/confirmacion-carrito/confirmacion-carrito.component.html
| ... | ... | @@ -168,7 +168,8 @@ |
| 168 | 168 | </div> |
| 169 | 169 | |
| 170 | 170 | <!-- TARJETA --> |
| 171 | - <div class="row card-effect card-forma-pago mx-1 my-3 rounded-sm shadow-sm bg-white"> | |
| 171 | + <div class="row card-effect card-forma-pago mx-1 my-3 rounded-sm shadow-sm bg-white" | |
| 172 | + (click)="abrirPagoConTarjeta()"> | |
| 172 | 173 | <div class="col-7 text-center my-auto px-2"> |
| 173 | 174 | <span class="h5 font-weight-bold">Tarjeta</span> |
| 174 | 175 | </div> |
src/app/components/confirmacion-carrito/confirmacion-carrito.component.ts
| ... | ... | @@ -5,6 +5,8 @@ import { ProductoService } from 'src/app/services/producto.service'; |
| 5 | 5 | import { Producto } from 'src/app/wrappers/producto'; |
| 6 | 6 | import { Router } from '@angular/router'; |
| 7 | 7 | import { Subscription } from 'rxjs'; |
| 8 | +import { BsModalService } from 'ngx-bootstrap'; | |
| 9 | +import { PagoConTarjetaComponent } from '../pago-con-tarjeta/pago-con-tarjeta.component'; | |
| 8 | 10 | |
| 9 | 11 | @Component({ |
| 10 | 12 | selector: 'app-confirmacion-carrito', |
| ... | ... | @@ -25,7 +27,8 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { |
| 25 | 27 | constructor( |
| 26 | 28 | private location: Location, |
| 27 | 29 | private productoService: ProductoService, |
| 28 | - private router: Router | |
| 30 | + private router: Router, | |
| 31 | + private modalService: BsModalService, | |
| 29 | 32 | ) { } |
| 30 | 33 | |
| 31 | 34 | ngOnInit() { |
| ... | ... | @@ -106,4 +109,12 @@ export class ConfirmacionCarritoComponent implements OnInit, OnDestroy { |
| 106 | 109 | } |
| 107 | 110 | //#endregion |
| 108 | 111 | |
| 112 | + abrirPagoConTarjeta() { | |
| 113 | + | |
| 114 | + this.modalService.show(PagoConTarjetaComponent, { | |
| 115 | + class: 'modal-lg', | |
| 116 | + ignoreBackdropClick: true, | |
| 117 | + initialState: { importeTotal: this.total }, | |
| 118 | + }); | |
| 119 | + } | |
| 109 | 120 | } |
src/app/components/pago-con-tarjeta/pago-con-tarjeta.component.html
| ... | ... | @@ -0,0 +1,87 @@ |
| 1 | +<div class="modal-header p-2"> | |
| 2 | + <div class="row m-0 w-100"> | |
| 3 | + <div class="col"> | |
| 4 | + <span class="h4 m-0">Pago con tarjeta</span> | |
| 5 | + </div> | |
| 6 | + </div> | |
| 7 | +</div> | |
| 8 | + | |
| 9 | +<div class="modal-body" id="modal-body"> | |
| 10 | + <div class="w-75 mx-auto card-columns"> | |
| 11 | + <div | |
| 12 | + class="card card-effect shadow-sm rounded-sm" | |
| 13 | + *ngFor="let tarjeta of tarjetas" | |
| 14 | + [ngClass]="{'active': tarjetaSeleccionada && tarjetaSeleccionada.ID === tarjeta.ID}" | |
| 15 | + (click)="seleccionarTarjeta(tarjeta)"> | |
| 16 | + <img | |
| 17 | + class="w-100 p-1" | |
| 18 | + src="../../../assets/img/{{tarjeta.nombreImagen ? tarjeta.nombreImagen : 'generica.png'}}"> | |
| 19 | + </div> | |
| 20 | + </div> | |
| 21 | + <div class="border-top w-75 mx-auto" *ngIf="showForm"> | |
| 22 | + <div class="row mt-2 fade-in"> | |
| 23 | + <form class="col"> | |
| 24 | + <div class="row py-3"> | |
| 25 | + <div class="col-auto pr-1"> | |
| 26 | + <span class="font-weight-bold">{{tarjetaSeleccionada.ID}}</span> | |
| 27 | + </div> | |
| 28 | + <div class="col-auto pl-2"> | |
| 29 | + <span class="font-weight-bold">{{tarjetaSeleccionada.NOM}}</span> | |
| 30 | + </div> | |
| 31 | + </div> | |
| 32 | + <div class="row pb-3"> | |
| 33 | + <div class="col-auto pr-1"> | |
| 34 | + <span>Importe</span> | |
| 35 | + </div> | |
| 36 | + <div class="col-auto pl-2"> | |
| 37 | + <span class="font-weight-bold">{{ importeTotal | currency}}</span> | |
| 38 | + </div> | |
| 39 | + </div> | |
| 40 | + <div class="row pb-3"> | |
| 41 | + <div class="col-auto pr-1 my-auto"> | |
| 42 | + <span>Terminal Nยบ</span> | |
| 43 | + </div> | |
| 44 | + <div class="col-12 col-md-auto pl-md-1"> | |
| 45 | + <input | |
| 46 | + class="form-control form-control-sm" | |
| 47 | + type="number"> | |
| 48 | + </div> | |
| 49 | + </div> | |
| 50 | + <div class="row pb-3"> | |
| 51 | + <div class="col-auto pr-1 my-auto"> | |
| 52 | + <span>Nรบmero de Cupรณn</span> | |
| 53 | + </div> | |
| 54 | + <div class="col-12 col-md-auto pl-md-1"> | |
| 55 | + <input | |
| 56 | + class="form-control form-control-sm" | |
| 57 | + type="number"> | |
| 58 | + </div> | |
| 59 | + </div> | |
| 60 | + <div class="row pb-3"> | |
| 61 | + <div class="col-auto pr-1 my-auto"> | |
| 62 | + <span>Cuotas</span> | |
| 63 | + </div> | |
| 64 | + <div class="col-12 col-md-auto pl-md-1"> | |
| 65 | + <input | |
| 66 | + class="form-control form-control-sm" | |
| 67 | + type="number"> | |
| 68 | + </div> | |
| 69 | + </div> | |
| 70 | + </form> | |
| 71 | + </div> | |
| 72 | + </div> | |
| 73 | +</div> | |
| 74 | + | |
| 75 | +<div class="modal-footer py-1"> | |
| 76 | + <button | |
| 77 | + class="btn btn-sm btn-secondary" | |
| 78 | + type="button" | |
| 79 | + (click)="close()"> | |
| 80 | + Cancelar | |
| 81 | + </button> | |
| 82 | + <button | |
| 83 | + class="btn btn-sm btn-primary" | |
| 84 | + type="button"> | |
| 85 | + Guardar | |
| 86 | + </button> | |
| 87 | +</div> |
src/app/components/pago-con-tarjeta/pago-con-tarjeta.component.scss
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | +app-pago-con-tarjeta { | |
| 2 | + user-select: none !important; | |
| 3 | +} | |
| 4 | + | |
| 5 | +.card-columns { | |
| 6 | + column-count: 6 !important; | |
| 7 | + column-gap: 0.5rem !important; | |
| 8 | + @media (max-width: 576px) { | |
| 9 | + column-count: 3 !important; | |
| 10 | + } | |
| 11 | +} | |
| 12 | + | |
| 13 | +.card-effect { | |
| 14 | + border-width: 2px !important; | |
| 15 | + &:hover { | |
| 16 | + background-color: #c9c9c9b3 !important; | |
| 17 | + transition: background-color 0.3s; | |
| 18 | + } | |
| 19 | + &:active { | |
| 20 | + border-color: #2872ae !important; | |
| 21 | + transition: background-color 0.3s; | |
| 22 | + } | |
| 23 | +} | |
| 24 | + | |
| 25 | +.active { | |
| 26 | + border-color: #2872ae !important; | |
| 27 | + transition: background-color 0.3s; | |
| 28 | +} |
src/app/components/pago-con-tarjeta/pago-con-tarjeta.component.spec.ts
| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | |
| 2 | + | |
| 3 | +import { PagoConTarjetaComponent } from './pago-con-tarjeta.component'; | |
| 4 | + | |
| 5 | +describe('PagoConTarjetaComponent', () => { | |
| 6 | + let component: PagoConTarjetaComponent; | |
| 7 | + let fixture: ComponentFixture<PagoConTarjetaComponent>; | |
| 8 | + | |
| 9 | + beforeEach(async(() => { | |
| 10 | + TestBed.configureTestingModule({ | |
| 11 | + declarations: [ PagoConTarjetaComponent ] | |
| 12 | + }) | |
| 13 | + .compileComponents(); | |
| 14 | + })); | |
| 15 | + | |
| 16 | + beforeEach(() => { | |
| 17 | + fixture = TestBed.createComponent(PagoConTarjetaComponent); | |
| 18 | + component = fixture.componentInstance; | |
| 19 | + fixture.detectChanges(); | |
| 20 | + }); | |
| 21 | + | |
| 22 | + it('should create', () => { | |
| 23 | + expect(component).toBeTruthy(); | |
| 24 | + }); | |
| 25 | +}); |
src/app/components/pago-con-tarjeta/pago-con-tarjeta.component.ts
| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | +import { Component, OnInit } from '@angular/core'; | |
| 2 | +import { BsModalRef } from 'ngx-bootstrap'; | |
| 3 | +import { TarjetasService } from 'src/app/services/tarjetas.service'; | |
| 4 | +import { Tarjeta } from 'src/app/wrappers/tarjeta'; | |
| 5 | + | |
| 6 | +@Component({ | |
| 7 | + selector: 'app-pago-con-tarjeta', | |
| 8 | + templateUrl: './pago-con-tarjeta.component.html', | |
| 9 | + styleUrls: ['./pago-con-tarjeta.component.scss'], | |
| 10 | +}) | |
| 11 | +export class PagoConTarjetaComponent implements OnInit { | |
| 12 | + | |
| 13 | + private tarjetas: Tarjeta[] = []; | |
| 14 | + private tarjetaSeleccionada: Tarjeta; | |
| 15 | + private showForm = false; | |
| 16 | + private importeTotal: number; | |
| 17 | + | |
| 18 | + constructor( | |
| 19 | + private modalRef: BsModalRef, | |
| 20 | + private tarjetasService: TarjetasService, | |
| 21 | + ) { } | |
| 22 | + | |
| 23 | + ngOnInit() { | |
| 24 | + | |
| 25 | + this.tarjetasService.getTarjetas() | |
| 26 | + .subscribe((res: Tarjeta[]) => { | |
| 27 | + | |
| 28 | + this.tarjetas = res; | |
| 29 | + }, err => console.error(err)); | |
| 30 | + } | |
| 31 | + | |
| 32 | + seleccionarTarjeta(tarjeta: Tarjeta) { | |
| 33 | + | |
| 34 | + this.tarjetaSeleccionada = tarjeta; | |
| 35 | + this.showForm = true; | |
| 36 | + } | |
| 37 | + | |
| 38 | + close() { | |
| 39 | + | |
| 40 | + this.modalRef.hide() | |
| 41 | + } | |
| 42 | +} |
src/assets/img/americanExpress.png
10.4 KB
src/assets/img/argencard.png
7.48 KB
src/assets/img/cabal.png
7.38 KB
src/assets/img/cencosud.png
10.6 KB
src/assets/img/galiciaRural.png
10.1 KB
src/assets/img/generica.png
6.44 KB
src/assets/img/macro.png
9.1 KB
src/assets/img/macroAgro.png
11.8 KB
src/assets/img/maestro.png
9 KB
src/assets/img/mastercard.png
9.46 KB
src/assets/img/mercadoPago.png
13.9 KB
src/assets/img/naranja.png
10.4 KB
src/assets/img/nativa.png
12.1 KB
src/assets/img/tarjetaShopping.png
15.2 KB
src/assets/img/visa.png
7.03 KB
src/assets/img/visaCredito.png
10.3 KB
src/assets/img/visaDebito.png
10.1 KB
src/assets/img/visaElectron.png
9.8 KB