Commit 6f920dbea40153c32b9a7d0acf4770199e9d412a
Exists in
develop
Merge branch 'master' into 'develop'
Master(benjamin) See merge request !98
Showing
4 changed files
Show diff stats
src/app/modules/info-formas-pago/info-formas-pago.component.ts
1 | import { Component, OnInit, TemplateRef, OnDestroy } from '@angular/core'; | 1 | import { Component, OnInit, TemplateRef, OnDestroy } from '@angular/core'; |
2 | import { BsModalService } from 'ngx-bootstrap/modal'; | 2 | import { BsModalService } from 'ngx-bootstrap/modal'; |
3 | 3 | ||
4 | @Component({ | 4 | @Component({ |
5 | selector: 'app-formas-pago', | 5 | selector: 'app-formas-pago', |
6 | templateUrl: './info-formas-pago.component.html', | 6 | templateUrl: './info-formas-pago.component.html', |
7 | styleUrls: ['./info-formas-pago.component.scss'] | 7 | styleUrls: ['./info-formas-pago.component.scss'] |
8 | }) | 8 | }) |
9 | export class InfoFormasPagoComponent implements OnInit, OnDestroy { | 9 | export class InfoFormasPagoComponent implements OnInit, OnDestroy { |
10 | timer: any; | 10 | timer: any; |
11 | 11 | ||
12 | constructor( | 12 | constructor( |
13 | private modalService: BsModalService, | 13 | private modalService: BsModalService, |
14 | ) { } | 14 | ) { } |
15 | 15 | ||
16 | ngOnInit() { | 16 | ngOnInit() { |
17 | this.mediaPantalla(); | 17 | this.mediaPantalla(); |
18 | } | 18 | } |
19 | 19 | ||
20 | ngOnDestroy() { | 20 | ngOnDestroy() { |
21 | if (this.timer) clearTimeout(this.timer); | 21 | if (this.timer) clearTimeout(this.timer); |
22 | } | 22 | } |
23 | 23 | ||
24 | openGoCaja(templateRef: TemplateRef<any>) { | 24 | openGoCaja(templateRef: TemplateRef<any>) { |
25 | const modalRef = this.modalService.show(templateRef, { class: 'modal-dialog-centered' }); | 25 | const modalRef = this.modalService.show(templateRef, { class: 'modal-lg modal-dialog-centered' }); |
26 | this.timer = setTimeout(() => { | 26 | this.timer = setTimeout(() => { |
27 | modalRef.hide(); | 27 | modalRef.hide(); |
28 | }, 3000); | 28 | }, 3000); |
29 | } | 29 | } |
30 | 30 | ||
31 | mediaPantalla() { | 31 | mediaPantalla() { |
32 | if ($('body').hasClass('media-pantalla')) { | 32 | if ($('body').hasClass('media-pantalla')) { |
33 | $('.reduce-card-1,.reduce-card-2') | 33 | $('.reduce-card-1,.reduce-card-2') |
34 | .addClass('media-pantalla') | 34 | .addClass('media-pantalla') |
35 | .addBack('media-pantalla'); | 35 | .addBack('media-pantalla'); |
36 | } | 36 | } |
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 |
src/app/modules/pago-tarjeta/pago-tarjeta.component.html
1 | <div class="h-92 bg-white fade-in-left"> | 1 | <div class="h-92 bg-white fade-in-left"> |
2 | <div class="row mx-0 h-15"> | 2 | <div class="row mx-0 h-15"> |
3 | <div class="col-12 px-0 h-80 my-auto"> | 3 | <div class="col-12 px-0 h-80 my-auto"> |
4 | <img | 4 | <img |
5 | draggable="false" | 5 | draggable="false" |
6 | ondragstart="return false;" | 6 | ondragstart="return false;" |
7 | (contextmenu)="false" | 7 | (contextmenu)="false" |
8 | class="d-block mx-auto h-100" | 8 | class="d-block mx-auto h-100" |
9 | src="assets/img/logo-spot.svg"> | 9 | src="assets/img/logo-spot.svg"> |
10 | </div> | 10 | </div> |
11 | </div> | 11 | </div> |
12 | <div class="h-85 pago-tarjeta"> | 12 | <div class="h-85 pago-tarjeta"> |
13 | <div class="row h-50 mx-0 justify-content-center text-center"> | 13 | <div class="row h-50 mx-0 justify-content-center text-center"> |
14 | <div class="col-7 p-5 h-auto align-self-end border border-secondary rounded"> | 14 | <div class="col-7 p-5 h-auto align-self-end border border-secondary rounded"> |
15 | <img | 15 | <img |
16 | draggable="false" | 16 | draggable="false" |
17 | ondragstart="return false;" | 17 | ondragstart="return false;" |
18 | (contextmenu)="false" | 18 | (contextmenu)="false" |
19 | class="img-in-top px-4 bg-white" | 19 | class="img-in-top px-4 bg-white" |
20 | src="assets/img/icono-tarjetas.svg"> | 20 | src="assets/img/icono-tarjetas.svg"> |
21 | <p class="h6 m-0">AHORA ESPERE QUE SE ACTIVE EL POSNET</p> | 21 | <p class="h6 m-0">AHORA ESPERE QUE SE ACTIVE EL POSNET</p> |
22 | <p class="h2 mb-3 text-secondary"> | 22 | <p class="h2 mb-3 text-secondary"> |
23 | deslice su tarjeta | 23 | deslice su tarjeta |
24 | </p> | 24 | </p> |
25 | <p class="h6 m-0">Y SIGA LAS INSTRUCCIONES DEL LECTOR</p> | 25 | <p class="h6 m-0">Y SIGA LAS INSTRUCCIONES DEL LECTOR</p> |
26 | </div> | 26 | </div> |
27 | </div> | 27 | </div> |
28 | <div class="row mt-5 justify-content-center arrow-slide arrow-delay-1"> | 28 | <div class="row mt-5 justify-content-center arrow-slide arrow-delay-1"> |
29 | <div class="col-1"> | 29 | <div class="col-1"> |
30 | <img | 30 | <img |
31 | draggable="false" | 31 | draggable="false" |
32 | ondragstart="return false;" | 32 | ondragstart="return false;" |
33 | (contextmenu)="false" | 33 | (contextmenu)="false" |
34 | class="img-fluid" | 34 | class="img-fluid" |
35 | src="assets/img/down-chevron.svg"> | 35 | src="assets/img/down-chevron.svg"> |
36 | </div> | 36 | </div> |
37 | </div> | 37 | </div> |
38 | <div class="row justify-content-center arrow-slide arrow-delay-2"> | 38 | <div class="row justify-content-center arrow-slide arrow-delay-2"> |
39 | <div class="col-1"> | 39 | <div class="col-1"> |
40 | <img | 40 | <img |
41 | draggable="false" | 41 | draggable="false" |
42 | ondragstart="return false;" | 42 | ondragstart="return false;" |
43 | (contextmenu)="false" | 43 | (contextmenu)="false" |
44 | class="img-fluid" | 44 | class="img-fluid" |
45 | src="assets/img/down-chevron.svg"> | 45 | src="assets/img/down-chevron.svg"> |
46 | </div> | 46 | </div> |
47 | </div> | 47 | </div> |
48 | <div class="row justify-content-center arrow-slide arrow-delay-3"> | 48 | <div class="row justify-content-center arrow-slide arrow-delay-3"> |
49 | <div class="col-1"> | 49 | <div class="col-1"> |
50 | <img | 50 | <img |
51 | draggable="false" | 51 | draggable="false" |
52 | ondragstart="return false;" | 52 | ondragstart="return false;" |
53 | (contextmenu)="false" | 53 | (contextmenu)="false" |
54 | class="img-fluid" | 54 | class="img-fluid" |
55 | src="assets/img/down-chevron.svg"> | 55 | src="assets/img/down-chevron.svg"> |
56 | </div> | 56 | </div> |
57 | </div> | 57 | </div> |
58 | </div> | 58 | </div> |
59 | </div> | 59 | </div> |
60 | |||
61 | <ng-template #template> | ||
62 | <div class="modal-body rounded bg-primary"> | ||
63 | <h1 class="text-white text-center my-4">Por favor,<br>espera un momento</h1> | ||
64 | <div class="d-flex justify-content-center mt-2 mb-4"> | ||
65 | <div class="spinner-border text-white text-center" role="status"> | ||
66 | <span class="sr-only">Loading...</span> | ||
67 | </div> | ||
68 | </div> | ||
69 | </div> | ||
70 | </ng-template> | ||
60 | 71 |
src/app/modules/pago-tarjeta/pago-tarjeta.component.scss
1 | .arrow-slide { | 1 | .arrow-slide { |
2 | animation: slide 1.5s infinite; | 2 | animation: slide 1.5s infinite; |
3 | -webkit-animation: slide 1.5s infinite; | 3 | -webkit-animation: slide 1.5s infinite; |
4 | opacity: 0; | 4 | opacity: 0; |
5 | } | 5 | } |
6 | 6 | ||
7 | @for $i from 1 through 3 { | 7 | @for $i from 1 through 3 { |
8 | $delayValue: $i * 0.2s; | 8 | $delayValue: $i * 0.2s; |
9 | .arrow-delay-#{$i} { | 9 | .arrow-delay-#{$i} { |
10 | animation-delay: $delayValue; | 10 | animation-delay: $delayValue; |
11 | -webkit-animation-delay: $delayValue; | 11 | -webkit-animation-delay: $delayValue; |
12 | } | 12 | } |
13 | } | 13 | } |
14 | 14 | ||
15 | @-webkit-keyframes slide { | 15 | @-webkit-keyframes slide { |
16 | 0% { | 16 | 0% { |
17 | opacity: 0; | 17 | opacity: 0; |
18 | transform: translateY(-10px); | 18 | transform: translateY(-10px); |
19 | } | 19 | } |
20 | 33% { | 20 | 33% { |
21 | opacity: 1; | 21 | opacity: 1; |
22 | transform: translateY(-5px); | 22 | transform: translateY(-5px); |
23 | } | 23 | } |
24 | 66% { | 24 | 66% { |
25 | opacity: 0; | 25 | opacity: 0; |
26 | transform: translateY(0px); | 26 | transform: translateY(0px); |
27 | } | 27 | } |
28 | 100% { | 28 | 100% { |
29 | opacity: 0; | 29 | opacity: 0; |
30 | transform: translateY(-10px); | 30 | transform: translateY(-10px); |
31 | } | 31 | } |
32 | } | 32 | } |
33 | @keyframes slide { | 33 | @keyframes slide { |
34 | 0% { | 34 | 0% { |
35 | opacity: 0; | 35 | opacity: 0; |
36 | transform: translateY(-10px); | 36 | transform: translateY(-10px); |
37 | } | 37 | } |
38 | 33% { | 38 | 33% { |
39 | opacity: 1; | 39 | opacity: 1; |
40 | transform: translateY(-5px); | 40 | transform: translateY(-5px); |
41 | } | 41 | } |
42 | 66% { | 42 | 66% { |
43 | opacity: 0; | 43 | opacity: 0; |
44 | transform: translateY(0px); | 44 | transform: translateY(0px); |
45 | } | 45 | } |
46 | 100% { | 46 | 100% { |
47 | opacity: 0; | 47 | opacity: 0; |
48 | transform: translateY(-10px); | 48 | transform: translateY(-10px); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | .pago-tarjeta.media-pantalla{ | 52 | .pago-tarjeta.media-pantalla{ |
53 | margin-top: 50px !important; | 53 | margin-top: 50px !important; |
54 | } | 54 | } |
55 | |||
56 | .spinner-border { | ||
57 | width: 5rem; | ||
58 | height: 5rem; | ||
59 | } | ||
55 | 60 |
src/app/modules/pago-tarjeta/pago-tarjeta.component.ts
1 | import { Component, OnInit, OnDestroy } from '@angular/core'; | 1 | import { Component, OnInit, TemplateRef, OnDestroy, ViewChild } from '@angular/core'; |
2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; | 2 | import { ArticuloService } from 'src/app/services/articulo/articulo.service'; |
3 | import { Router } from '@angular/router'; | 3 | import { Router } from '@angular/router'; |
4 | import { BsModalService } from 'ngx-bootstrap/modal'; | 4 | import { BsModalService } from 'ngx-bootstrap/modal'; |
5 | import { ErrorFormaPagoComponent } from 'src/app/shared/error-forma-pago/error-forma-pago.component'; | 5 | import { ErrorFormaPagoComponent } from 'src/app/shared/error-forma-pago/error-forma-pago.component'; |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
8 | selector: 'app-pago-tarjeta', | 8 | selector: 'app-pago-tarjeta', |
9 | templateUrl: './pago-tarjeta.component.html', | 9 | templateUrl: './pago-tarjeta.component.html', |
10 | styleUrls: ['./pago-tarjeta.component.scss'] | 10 | styleUrls: ['./pago-tarjeta.component.scss'] |
11 | }) | 11 | }) |
12 | export class PagoTarjetaComponent implements OnInit, OnDestroy { | 12 | export class PagoTarjetaComponent implements OnInit, OnDestroy { |
13 | timer: any; | ||
14 | @ViewChild('template', {static: true}) public template: TemplateRef<any>; | ||
13 | 15 | ||
14 | constructor( | 16 | constructor( |
15 | private articuloService: ArticuloService, | 17 | private articuloService: ArticuloService, |
16 | private router: Router, | 18 | private router: Router, |
17 | private modalService: BsModalService, | 19 | private modalService: BsModalService, |
18 | ) { } | 20 | ) { } |
19 | 21 | ||
20 | ngOnInit() { | 22 | ngOnInit() { |
21 | if (!this.articuloService.carrito.length) { | 23 | if (!this.articuloService.carrito.length) { |
22 | this.router.navigate(['']); | 24 | this.router.navigate(['']); |
23 | return; | 25 | return; |
24 | } | 26 | } |
27 | this.openModalEspera(this.template); | ||
25 | const dataPago = { | 28 | const dataPago = { |
26 | pedidoAnombreDe: '' | 29 | pedidoAnombreDe: '' |
27 | }; | 30 | }; |
28 | this.articuloService.pay(dataPago) | 31 | this.articuloService.pay(dataPago) |
29 | .subscribe((res: any) => { | 32 | .subscribe((res: any) => { |
30 | this.articuloService.idComanda = res.data; | 33 | this.articuloService.idComanda = res.data; |
31 | this.router.navigate(['mensaje-final']); | 34 | this.router.navigate(['mensaje-final']); |
32 | }, (err) => { | 35 | }, (err) => { |
33 | this.modalService.show(ErrorFormaPagoComponent, { | 36 | this.modalService.show(ErrorFormaPagoComponent, { |
34 | class: 'modal-lg modal-dialog-centered', | 37 | class: 'modal-lg modal-dialog-centered', |
35 | ignoreBackdropClick: true, | 38 | ignoreBackdropClick: true, |
36 | }); | 39 | }); |
37 | }); | 40 | }); |
38 | this.mediaPantalla(); | 41 | this.mediaPantalla(); |
39 | } | 42 | } |
40 | 43 | ||
41 | ngOnDestroy() { | 44 | ngOnDestroy() { |
45 | if (this.timer) clearTimeout(this.timer); | ||
42 | for (let i = 1; i <= this.modalService.getModalsCount(); i++) { | 46 | for (let i = 1; i <= this.modalService.getModalsCount(); i++) { |
43 | this.modalService.hide(i); | 47 | this.modalService.hide(i); |
44 | } | 48 | } |
45 | } | 49 | } |
46 | 50 | ||
47 | mediaPantalla() { | 51 | mediaPantalla() { |
48 | if ($('body').hasClass('media-pantalla')) { | 52 | if ($('body').hasClass('media-pantalla')) { |
49 | $('.pago-tarjeta').addClass('media-pantalla'); | 53 | $('.pago-tarjeta').addClass('media-pantalla'); |
50 | } | 54 | } |
51 | } | 55 | } |
56 | |||
57 | openModalEspera(templateRef: TemplateRef<any>) { | ||
58 | const modalRef = this.modalService.show(templateRef, { class: 'modal-lg modal-dialog-centered' }); | ||
59 | this.timer = setTimeout(() => { | ||
60 | modalRef.hide(); | ||
61 | }, 5000); | ||
62 | } | ||
52 | } | 63 | } |
53 | 64 |