Commit f56a3b96168dacafc16dfca49b8ebfa0396aea38
Exists in
develop
and in
1 other branch
Merge branch 'develop' into 'develop'
Agregado pago con tarjeta See merge request !5
Showing
8 changed files
Show diff stats
src/app/app-routing.module.ts
| ... | ... | @@ -37,12 +37,12 @@ const routes: Routes = [ |
| 37 | 37 | path: 'pago-tarjeta', |
| 38 | 38 | loadChildren: () => import('./modules/pago-tarjeta/pago-tarjeta.module').then(m => m.PagoTarjetaModule) |
| 39 | 39 | }, |
| 40 | - { | |
| 41 | - path: 'mensaje-final', | |
| 42 | - loadChildren: () => import('./modules/mensaje-final/mensaje-final.module').then(m => m.MensajeFinalModule) | |
| 43 | - }, | |
| 44 | 40 | ] |
| 45 | 41 | }, |
| 42 | + { | |
| 43 | + path: 'mensaje-final', | |
| 44 | + loadChildren: () => import('./modules/mensaje-final/mensaje-final.module').then(m => m.MensajeFinalModule) | |
| 45 | + }, | |
| 46 | 46 | { path: '**', redirectTo: '', pathMatch: 'full' }, |
| 47 | 47 | ]; |
| 48 | 48 |
src/app/modules/forma-pago/forma-pago.component.html
| ... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 | <div class="col-auto px-0 h-auto align-self-start"> |
| 51 | 51 | <div |
| 52 | 52 | class="btn-effect col-auto align-self-center px-0 bg-white" |
| 53 | - [routerLink]="['/pago-tarjeta']"> | |
| 53 | + (click)="medioPago(4)"> | |
| 54 | 54 | <div class="row mx-0 bg-primary badge-pill"> |
| 55 | 55 | <div class="col-auto p-0"> |
| 56 | 56 | <img |
src/app/modules/forma-pago/forma-pago.component.ts
| 1 | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | +import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | |
| 3 | +import { Router } from '@angular/router'; | |
| 2 | 4 | |
| 3 | 5 | @Component({ |
| 4 | 6 | selector: 'app-forma-pago', |
| ... | ... | @@ -7,9 +9,24 @@ import { Component, OnInit } from '@angular/core'; |
| 7 | 9 | }) |
| 8 | 10 | export class FormaPagoComponent implements OnInit { |
| 9 | 11 | |
| 10 | - constructor() { } | |
| 12 | + constructor( | |
| 13 | + private articuloService: ArticuloService, | |
| 14 | + private router: Router, | |
| 15 | + ) { } | |
| 11 | 16 | |
| 12 | 17 | ngOnInit() { |
| 13 | 18 | } |
| 14 | 19 | |
| 20 | + medioPago(medioPago: number) { | |
| 21 | + this.articuloService.medioPago = medioPago; | |
| 22 | + switch (medioPago) { | |
| 23 | + case 4: | |
| 24 | + this.router.navigate(['pago-tarjeta']); | |
| 25 | + break; | |
| 26 | + case 9: | |
| 27 | + this.router.navigate(['pago-electronico']); | |
| 28 | + break; | |
| 29 | + } | |
| 30 | + } | |
| 31 | + | |
| 15 | 32 | } |
src/app/modules/mensaje-final/mensaje-final.component.html
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | class="img-in-top px-4 bg-white" |
| 26 | 26 | src="assets/img/ticket.svg"> |
| 27 | 27 | <p class="h6 mb-2"><small>PRESENTร EL TICKET EN CAJA Y AGUARDร TU PEDIDO</small></p> |
| 28 | - <p class="h2 text-primary">Nรบmero de pedido {{023}}</p> | |
| 28 | + <p class="h2 text-primary">Nรบmero de pedido {{articuloService.idComanda}}</p> | |
| 29 | 29 | </div> |
| 30 | 30 | </div> |
| 31 | 31 | <div class="row h-auto mt-6 mx-0 justify-content-center text-center"> |
| ... | ... | @@ -49,5 +49,20 @@ |
| 49 | 49 | </p> |
| 50 | 50 | </div> |
| 51 | 51 | </div> |
| 52 | + <div class="row justify-content-center"> | |
| 53 | + <div class="col-auto"> | |
| 54 | + <div | |
| 55 | + class="d-inline-block py-1 btn-effect bg-primary badge-pill text-white" | |
| 56 | + (click)="goToSplash()"> | |
| 57 | + <span class="px-4">FINALIZAR</span> | |
| 58 | + <img | |
| 59 | + draggable="false" | |
| 60 | + ondragstart="return false;" | |
| 61 | + (contextmenu)="false" | |
| 62 | + class="icon-30" | |
| 63 | + src="assets/img/ir.svg"> | |
| 64 | + </div> | |
| 65 | + </div> | |
| 66 | + </div> | |
| 52 | 67 | </div> |
| 53 | 68 | </div> |
src/app/modules/mensaje-final/mensaje-final.component.ts
| 1 | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | +import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | |
| 3 | +import { Router } from '@angular/router'; | |
| 2 | 4 | |
| 3 | 5 | @Component({ |
| 4 | 6 | selector: 'app-mensaje-final', |
| ... | ... | @@ -7,9 +9,20 @@ import { Component, OnInit } from '@angular/core'; |
| 7 | 9 | }) |
| 8 | 10 | export class MensajeFinalComponent implements OnInit { |
| 9 | 11 | |
| 10 | - constructor() { } | |
| 12 | + constructor( | |
| 13 | + public articuloService: ArticuloService, | |
| 14 | + private router: Router, | |
| 15 | + ) { } | |
| 11 | 16 | |
| 12 | 17 | ngOnInit() { |
| 18 | + setTimeout(() => { | |
| 19 | + this.goToSplash(); | |
| 20 | + }, 10000) | |
| 21 | + } | |
| 22 | + | |
| 23 | + goToSplash() { | |
| 24 | + this.articuloService.cleanShoppingCar(); | |
| 25 | + this.router.navigate(['']); | |
| 13 | 26 | } |
| 14 | 27 | |
| 15 | 28 | } |
src/app/modules/pago-tarjeta/pago-tarjeta.component.ts
| 1 | 1 | import { Component, OnInit } from '@angular/core'; |
| 2 | +import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | |
| 3 | +import { Router } from '@angular/router'; | |
| 2 | 4 | |
| 3 | 5 | @Component({ |
| 4 | 6 | selector: 'app-pago-tarjeta', |
| ... | ... | @@ -7,9 +9,20 @@ import { Component, OnInit } from '@angular/core'; |
| 7 | 9 | }) |
| 8 | 10 | export class PagoTarjetaComponent implements OnInit { |
| 9 | 11 | |
| 10 | - constructor() { } | |
| 12 | + constructor( | |
| 13 | + private articuloService: ArticuloService, | |
| 14 | + private router: Router, | |
| 15 | + ) { } | |
| 11 | 16 | |
| 12 | 17 | ngOnInit() { |
| 18 | + let dataPago = { | |
| 19 | + pedidoAnombreDe: '' | |
| 20 | + } | |
| 21 | + this.articuloService.pay(dataPago) | |
| 22 | + .subscribe((res: any) => { | |
| 23 | + this.articuloService.idComanda = res.data; | |
| 24 | + this.router.navigate(['mensaje-final']); | |
| 25 | + }, err => console.error(err)); | |
| 13 | 26 | } |
| 14 | 27 | |
| 15 | 28 | } |
src/app/modules/seleccion-articulos/seleccion-articulos.component.ts
| ... | ... | @@ -119,8 +119,11 @@ export class SeleccionArticulosComponent implements OnInit { |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | elegirArticulo(articulo: IArticulo) { |
| 122 | - articulo.cantidad = 1; | |
| 123 | - this.articuloService.setArticulo(articulo); | |
| 122 | + this.articuloService.getById(articulo.id) | |
| 123 | + .subscribe((res: IArticulo) => { | |
| 124 | + res.cantidad = 1; | |
| 125 | + this.articuloService.setArticulo(res); | |
| 126 | + }, err => console.error(err)); | |
| 124 | 127 | } |
| 125 | 128 | |
| 126 | 129 | increaseShow() { |
src/app/services/articulo/articulo.service.ts
| ... | ... | @@ -13,6 +13,8 @@ export class ArticuloService { |
| 13 | 13 | mostrar: string; |
| 14 | 14 | esPromoPersonalizada: boolean = false; |
| 15 | 15 | urlDeboSuite = APP_SETTINGS.apiDeboSuite; |
| 16 | + medioPago: number; | |
| 17 | + idComanda: number; | |
| 16 | 18 | |
| 17 | 19 | constructor( |
| 18 | 20 | private http: HttpClient, |
| ... | ... | @@ -46,14 +48,14 @@ export class ArticuloService { |
| 46 | 48 | return new Observable((observer) => { |
| 47 | 49 | this.clienteService.getById(-1) |
| 48 | 50 | .subscribe(cliente => { |
| 49 | - let puntoVenta = parseInt(localStorage.getItem('impresoraPVE')); | |
| 51 | + let puntoVenta = 9998; | |
| 50 | 52 | this.markArticuloInPromoAsRemoved(); |
| 51 | - this.http.post(`${this.urlDeboSuite}/comprobante/guardar/${dataPago.medioPago}`, { | |
| 53 | + this.http.post(`${this.urlDeboSuite}/comprobante/guardar/${this.medioPago}`, { | |
| 52 | 54 | productos: this.carrito, |
| 53 | 55 | cliente: cliente, |
| 54 | 56 | origen: 'autoservicio', |
| 55 | 57 | codigoVendedor: 5, |
| 56 | - puntoVenta: dataPago.medioPago === 9 ? -1 * puntoVenta : puntoVenta, | |
| 58 | + puntoVenta: this.medioPago === 9 ? -1 * puntoVenta : puntoVenta, | |
| 57 | 59 | pedidoAnombreDe: dataPago.pedidoAnombreDe, |
| 58 | 60 | numeroPlanilla: '11111', |
| 59 | 61 | }) |