Commit d816745ff98b21fbcdffa349464863e4e2518db6
1 parent
2a79d24e61
Exists in
master
recibo parámetros \n envío datos de tarjeta
Showing
3 changed files
with
90 additions
and
59 deletions
Show diff stats
src/js/controller.js
1 | 1 | angular.module('focaModalFormaPago') |
2 | 2 | .controller('focaModalFormaPagoController', [ |
3 | 3 | '$timeout', '$filter', '$scope', '$uibModal', |
4 | - '$uibModalInstance', 'focaModalFormaPagoService', | |
4 | + '$uibModalInstance', 'focaModalFormaPagoService', 'parametros', | |
5 | 5 | function ($timeout, $filter, $scope, $uibModal, |
6 | - $uibModalInstance, focaModalFormaPagoService) { | |
6 | + $uibModalInstance, focaModalFormaPagoService, parametros) { | |
7 | 7 | |
8 | 8 | //#region Variables |
9 | 9 | $scope.botones = []; |
... | ... | @@ -71,7 +71,9 @@ angular.module('focaModalFormaPago') |
71 | 71 | templateUrl: templateUrl, |
72 | 72 | controller: controller, |
73 | 73 | resolve: { |
74 | - filters: function () { return null; }, | |
74 | + parametros: function () { return { | |
75 | + importe: parametros.importe | |
76 | + }; }, | |
75 | 77 | }, |
76 | 78 | size: 'lg', |
77 | 79 | } |
... | ... | @@ -86,7 +88,12 @@ angular.module('focaModalFormaPago') |
86 | 88 | ) |
87 | 89 | .controller('focaModalTarjetasController', [ |
88 | 90 | '$timeout', '$filter', '$scope', '$uibModalInstance', 'focaModalTarjetasService', |
89 | - function ($timeout, $filter, $scope, $uibModalInstance, focaModalTarjetasService) { | |
91 | + 'parametros', | |
92 | + function ($timeout, $filter, $scope, $uibModalInstance, focaModalTarjetasService, | |
93 | + parametros) | |
94 | + { | |
95 | + | |
96 | + $scope.parametros = parametros; | |
90 | 97 | |
91 | 98 | //#region Variables |
92 | 99 | $scope.botonesTarjetas = []; |
... | ... | @@ -97,10 +104,25 @@ angular.module('focaModalFormaPago') |
97 | 104 | init(); |
98 | 105 | |
99 | 106 | function init() { |
100 | - $scope.botonesTarjetas = focaModalTarjetasService.getBotonera(); | |
107 | + | |
108 | + focaModalTarjetasService.getTarjetas().then(function(res) { | |
109 | + | |
110 | + res.data.forEach(function (boton) { | |
111 | + $scope.botonesTarjetas.push({ | |
112 | + id: boton.ID, | |
113 | + label: 'tarjeta', | |
114 | + nombre: boton.NOM, | |
115 | + image: boton.nombreImagen, | |
116 | + imageDefault: 'tarjetaDefault.svg' | |
117 | + }); | |
118 | + }); | |
119 | + | |
120 | + }); | |
121 | + | |
101 | 122 | } |
102 | 123 | |
103 | - $scope.seleccionarTarjeta = function () { | |
124 | + $scope.seleccionarTarjeta = function (tarjeta) { | |
125 | + $scope.tarjeta = tarjeta; | |
104 | 126 | animateForm(); |
105 | 127 | }; |
106 | 128 | |
... | ... | @@ -109,7 +131,12 @@ angular.module('focaModalFormaPago') |
109 | 131 | }; |
110 | 132 | |
111 | 133 | $scope.aceptarFormaDePago = function () { |
112 | - $uibModalInstance.close('data de tarjeta'); | |
134 | + $uibModalInstance.close({ | |
135 | + tarjeta: $scope.tarjeta, | |
136 | + terminal: $scope.terminal, | |
137 | + numeroCupon: $scope.numeroCupon, | |
138 | + cuotas: $scope.cuotas | |
139 | + }); | |
113 | 140 | }; |
114 | 141 | |
115 | 142 | function animateForm() { |
src/js/service.js
... | ... | @@ -34,54 +34,55 @@ angular.module('focaModalFormaPago') |
34 | 34 | }]) |
35 | 35 | .factory('focaModalTarjetasService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { |
36 | 36 | return { |
37 | - getBotonera: function () { | |
38 | - return [ | |
39 | - { | |
40 | - label: 'tarjeta', | |
41 | - image: 'visa.svg', | |
42 | - active: false, | |
43 | - }, | |
44 | - { | |
45 | - label: 'tarjeta', | |
46 | - image: 'mastercard.svg', | |
47 | - active: false, | |
48 | - }, | |
49 | - { | |
50 | - label: 'tarjeta', | |
51 | - image: 'maestro.svg', | |
52 | - active: false, | |
53 | - }, | |
54 | - { | |
55 | - label: 'tarjeta', | |
56 | - image: 'americanExpress.svg', | |
57 | - active: false, | |
58 | - }, | |
59 | - { | |
60 | - label: 'tarjeta', | |
61 | - image: 'naranja.png', | |
62 | - active: false, | |
63 | - }, | |
64 | - { | |
65 | - label: 'tarjeta', | |
66 | - image: 'cabal.svg', | |
67 | - active: false, | |
68 | - }, | |
69 | - { | |
70 | - label: 'tarjeta', | |
71 | - image: 'argencard.svg', | |
72 | - active: false, | |
73 | - }, | |
74 | - { | |
75 | - label: 'tarjeta', | |
76 | - image: 'nativa.png', | |
77 | - active: false, | |
78 | - }, | |
79 | - { | |
80 | - label: 'tarjeta', | |
81 | - image: 'cencosud.png', | |
82 | - active: false, | |
83 | - }, | |
84 | - ]; | |
37 | + getTarjetas: function () { | |
38 | + return $http.get(API_ENDPOINT.URL + '/tarjetas'); | |
39 | + // return [ | |
40 | + // { | |
41 | + // label: 'tarjeta', | |
42 | + // image: 'visa.svg', | |
43 | + // active: false, | |
44 | + // }, | |
45 | + // { | |
46 | + // label: 'tarjeta', | |
47 | + // image: 'mastercard.svg', | |
48 | + // active: false, | |
49 | + // }, | |
50 | + // { | |
51 | + // label: 'tarjeta', | |
52 | + // image: 'maestro.svg', | |
53 | + // active: false, | |
54 | + // }, | |
55 | + // { | |
56 | + // label: 'tarjeta', | |
57 | + // image: 'americanExpress.svg', | |
58 | + // active: false, | |
59 | + // }, | |
60 | + // { | |
61 | + // label: 'tarjeta', | |
62 | + // image: 'naranja.png', | |
63 | + // active: false, | |
64 | + // }, | |
65 | + // { | |
66 | + // label: 'tarjeta', | |
67 | + // image: 'cabal.svg', | |
68 | + // active: false, | |
69 | + // }, | |
70 | + // { | |
71 | + // label: 'tarjeta', | |
72 | + // image: 'argencard.svg', | |
73 | + // active: false, | |
74 | + // }, | |
75 | + // { | |
76 | + // label: 'tarjeta', | |
77 | + // image: 'nativa.png', | |
78 | + // active: false, | |
79 | + // }, | |
80 | + // { | |
81 | + // label: 'tarjeta', | |
82 | + // image: 'cencosud.png', | |
83 | + // active: false, | |
84 | + // }, | |
85 | + // ]; | |
85 | 86 | } |
86 | 87 | }; |
87 | 88 | }]); |
src/views/modal-tarjetas.html
... | ... | @@ -23,16 +23,16 @@ |
23 | 23 | <form> |
24 | 24 | <div class="row pb-3"> |
25 | 25 | <div class="col-3 col-sm-2 pr-1"> |
26 | - <input class="form-control form-control-sm"> | |
26 | + <strong ng-bind="tarjeta.id"></strong> | |
27 | 27 | </div> |
28 | 28 | <div class="col-9 col-sm-4 pl-2"> |
29 | - <input class="form-control form-control-sm"> | |
29 | + <strong ng-bind="tarjeta.nombre"></strong> | |
30 | 30 | </div> |
31 | 31 | </div> |
32 | 32 | <div class="row pb-3"> |
33 | 33 | <div class="col"> |
34 | 34 | <span>Importe</span> |
35 | - <strong>$1560.45</strong> | |
35 | + <strong ng-bind="parametros.importe | currency: '$'"></strong> | |
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | <div class="row pb-3"> |
... | ... | @@ -42,6 +42,7 @@ |
42 | 42 | <div class="col col-sm-4 pl-1"> |
43 | 43 | <input |
44 | 44 | class="form-control form-control-sm" |
45 | + ng-model="terminal" | |
45 | 46 | type="number" |
46 | 47 | ng-disabled="readonly"> |
47 | 48 | </div> |
... | ... | @@ -53,6 +54,7 @@ |
53 | 54 | <div class="col col-sm-3 pl-1"> |
54 | 55 | <input |
55 | 56 | class="form-control form-control-sm" |
57 | + ng-model="numeroCupon" | |
56 | 58 | type="number" |
57 | 59 | ng-disabled="readonly"> |
58 | 60 | </div> |
... | ... | @@ -65,11 +67,12 @@ |
65 | 67 | <input |
66 | 68 | class="form-control form-control-sm" |
67 | 69 | type="number" |
70 | + ng-model="cuotas" | |
68 | 71 | ng-disabled="readonly"> |
69 | 72 | </div> |
70 | 73 | </div> |
71 | 74 | </form> |
72 | - </div> | |
75 | + </div> | |
73 | 76 | </div> |
74 | 77 | </div> |
75 | 78 | </div> |