Commit aec90d8f9294bb34c797a21254862ec9f3886fec
1 parent
f5e403365c
Exists in
master
Cambiado contado por efectivo.
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaModalFormaPago') | 1 | angular.module('focaModalFormaPago') |
2 | .controller('focaModalFormaPagoController', [ | 2 | .controller('focaModalFormaPagoController', [ |
3 | '$timeout', '$filter', '$scope', '$uibModal', | 3 | '$timeout', '$filter', '$scope', '$uibModal', |
4 | '$uibModalInstance', 'focaModalFormaPagoService', | 4 | '$uibModalInstance', 'focaModalFormaPagoService', |
5 | function ($timeout, $filter, $scope, $uibModal, | 5 | function ($timeout, $filter, $scope, $uibModal, |
6 | $uibModalInstance, focaModalFormaPagoService) { | 6 | $uibModalInstance, focaModalFormaPagoService) { |
7 | 7 | ||
8 | //#region Variables | 8 | //#region Variables |
9 | $scope.botones = []; | 9 | $scope.botones = []; |
10 | //#endregion | 10 | //#endregion |
11 | 11 | ||
12 | init(); | 12 | init(); |
13 | 13 | ||
14 | function init() { | 14 | function init() { |
15 | $scope.botones = focaModalFormaPagoService.getBotonera(); | 15 | $scope.botones = focaModalFormaPagoService.getBotonera(); |
16 | } | 16 | } |
17 | 17 | ||
18 | $scope.seleccionarContado = function () { | 18 | $scope.seleccionarEfectivo = function () { |
19 | var modalInstance = abrirModal('modal-tarjetas.html', | 19 | var modalInstance = abrirModal('modal-tarjetas.html', |
20 | 'focaModalTarjetasController'); | 20 | 'focaModalTarjetasController'); |
21 | modalInstance.result | 21 | modalInstance.result |
22 | .then(function (data) { | 22 | .then(function (data) { |
23 | console.log(data); | 23 | console.log(data); |
24 | }) | 24 | }) |
25 | .catch(function (e) { console.error(e); }); | 25 | .catch(function (e) { console.error(e); }); |
26 | }; | 26 | }; |
27 | 27 | ||
28 | $scope.seleccionarTarjetas = function () { | 28 | $scope.seleccionarTarjetas = function () { |
29 | var modalInstance = abrirModal('modal-tarjetas.html', | 29 | var modalInstance = abrirModal('modal-tarjetas.html', |
30 | 'focaModalTarjetasController'); | 30 | 'focaModalTarjetasController'); |
31 | modalInstance.result | 31 | modalInstance.result |
32 | .then(function (data) { | 32 | .then(function (data) { |
33 | $uibModalInstance.close(data); | 33 | $uibModalInstance.close(data); |
34 | }) | 34 | }) |
35 | .catch(function (e) { console.error(e); }); | 35 | .catch(function (e) { console.error(e); }); |
36 | }; | 36 | }; |
37 | 37 | ||
38 | $scope.seleccionarCheque = function () { | 38 | $scope.seleccionarCheque = function () { |
39 | var modalInstance = abrirModal('modal-tarjetas.html', | 39 | var modalInstance = abrirModal('modal-tarjetas.html', |
40 | 'focaModalTarjetasController'); | 40 | 'focaModalTarjetasController'); |
41 | modalInstance.result | 41 | modalInstance.result |
42 | .then(function (data) { | 42 | .then(function (data) { |
43 | console.log(data); | 43 | console.log(data); |
44 | }) | 44 | }) |
45 | .catch(function (e) { console.error(e); }); | 45 | .catch(function (e) { console.error(e); }); |
46 | }; | 46 | }; |
47 | 47 | ||
48 | $scope.seleccionarVales = function () { | 48 | $scope.seleccionarVales = function () { |
49 | var modalInstance = abrirModal('modal-tarjetas.html', | 49 | var modalInstance = abrirModal('modal-tarjetas.html', |
50 | 'focaModalTarjetasController'); | 50 | 'focaModalTarjetasController'); |
51 | modalInstance.result | 51 | modalInstance.result |
52 | .then(function (data) { | 52 | .then(function (data) { |
53 | console.log(data); | 53 | console.log(data); |
54 | }) | 54 | }) |
55 | .catch(function (e) { console.error(e); }); | 55 | .catch(function (e) { console.error(e); }); |
56 | }; | 56 | }; |
57 | 57 | ||
58 | $scope.seleccionarPagoElectronico = function () { | 58 | $scope.seleccionarPagoElectronico = function () { |
59 | var modalInstance = abrirModal('modal-tarjetas.html', | 59 | var modalInstance = abrirModal('modal-tarjetas.html', |
60 | 'focaModalTarjetasController'); | 60 | 'focaModalTarjetasController'); |
61 | modalInstance.result | 61 | modalInstance.result |
62 | .then(function (data) { | 62 | .then(function (data) { |
63 | console.log(data); | 63 | console.log(data); |
64 | }) | 64 | }) |
65 | .catch(function (e) { console.error(e); }); | 65 | .catch(function (e) { console.error(e); }); |
66 | }; | 66 | }; |
67 | 67 | ||
68 | function abrirModal(templateUrl, controller) { | 68 | function abrirModal(templateUrl, controller) { |
69 | return $uibModal.open( | 69 | return $uibModal.open( |
70 | { | 70 | { |
71 | templateUrl: templateUrl, | 71 | templateUrl: templateUrl, |
72 | controller: controller, | 72 | controller: controller, |
73 | resolve: { | 73 | resolve: { |
74 | filters: function () { return null; }, | 74 | filters: function () { return null; }, |
75 | }, | 75 | }, |
76 | size: 'lg', | 76 | size: 'lg', |
77 | } | 77 | } |
78 | ); | 78 | ); |
79 | 79 | ||
80 | } | 80 | } |
81 | 81 | ||
82 | $scope.cancel = function () { | 82 | $scope.cancel = function () { |
83 | $uibModalInstance.dismiss('cancel'); | 83 | $uibModalInstance.dismiss('cancel'); |
84 | }; | 84 | }; |
85 | }] | 85 | }] |
86 | ) | 86 | ) |
87 | .controller('focaModalTarjetasController', [ | 87 | .controller('focaModalTarjetasController', [ |
88 | '$timeout', '$filter', '$scope', '$uibModalInstance', 'focaModalTarjetasService', | 88 | '$timeout', '$filter', '$scope', '$uibModalInstance', 'focaModalTarjetasService', |
89 | function ($timeout, $filter, $scope, $uibModalInstance, focaModalTarjetasService) { | 89 | function ($timeout, $filter, $scope, $uibModalInstance, focaModalTarjetasService) { |
90 | 90 | ||
91 | //#region Variables | 91 | //#region Variables |
92 | $scope.botonesTarjetas = []; | 92 | $scope.botonesTarjetas = []; |
93 | $scope.showForm = false; | 93 | $scope.showForm = false; |
94 | 94 | ||
95 | //#endregion | 95 | //#endregion |
96 | 96 | ||
97 | init(); | 97 | init(); |
98 | 98 | ||
99 | function init() { | 99 | function init() { |
100 | $scope.botonesTarjetas = focaModalTarjetasService.getBotonera(); | 100 | $scope.botonesTarjetas = focaModalTarjetasService.getBotonera(); |
101 | } | 101 | } |
102 | 102 | ||
103 | $scope.seleccionarTarjeta = function () { | 103 | $scope.seleccionarTarjeta = function () { |
104 | animateForm(); | 104 | animateForm(); |
105 | }; | 105 | }; |
106 | 106 | ||
107 | $scope.cancel = function () { | 107 | $scope.cancel = function () { |
108 | $uibModalInstance.dismiss('cancel'); | 108 | $uibModalInstance.dismiss('cancel'); |
109 | }; | 109 | }; |
110 | 110 | ||
111 | $scope.aceptarFormaDePago = function () { | 111 | $scope.aceptarFormaDePago = function () { |
112 | $uibModalInstance.close('data de tarjeta'); | 112 | $uibModalInstance.close('data de tarjeta'); |
113 | }; | 113 | }; |
114 | 114 | ||
115 | function animateForm() { | 115 | function animateForm() { |
116 | $scope.showForm = false; | 116 | $scope.showForm = false; |
117 | $timeout(function () { | 117 | $timeout(function () { |
118 | $scope.showForm = true; | 118 | $scope.showForm = true; |
119 | }, 100); | 119 | }, 100); |
120 | } | 120 | } |
121 | }] | 121 | }] |
122 | ); | 122 | ); |
123 | 123 |
src/js/service.js
1 | angular.module('focaModalFormaPago') | 1 | angular.module('focaModalFormaPago') |
2 | .factory('focaModalFormaPagoService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { | 2 | .factory('focaModalFormaPagoService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { |
3 | return { | 3 | return { |
4 | getBotonera: function () { | 4 | getBotonera: function () { |
5 | return [ | 5 | return [ |
6 | { | 6 | { |
7 | label: 'Contado', | 7 | label: 'Efectivo', |
8 | image: 'contado.png', | 8 | image: 'efectivo.png', |
9 | disabled: true | 9 | disabled: true |
10 | }, | 10 | }, |
11 | { | 11 | { |
12 | label: 'Tarjetas', | 12 | label: 'Tarjetas', |
13 | image: 'tarjeta.png', | 13 | image: 'tarjeta.png', |
14 | disabled: false | 14 | disabled: false |
15 | }, | 15 | }, |
16 | { | 16 | { |
17 | label: 'Cheque', | 17 | label: 'Cheque', |
18 | image: 'cheque.png', | 18 | image: 'cheque.png', |
19 | disabled: true | 19 | disabled: true |
20 | }, | 20 | }, |
21 | { | 21 | { |
22 | label: 'Vales', | 22 | label: 'Vales', |
23 | image: 'vale.png', | 23 | image: 'vale.png', |
24 | disabled: true | 24 | disabled: true |
25 | }, | 25 | }, |
26 | { | 26 | { |
27 | label: 'Pago Electronico', | 27 | label: 'Pago Electronico', |
28 | image: 'qr.png', | 28 | image: 'qr.png', |
29 | disabled: true | 29 | disabled: true |
30 | } | 30 | } |
31 | ]; | 31 | ]; |
32 | } | 32 | } |
33 | }; | 33 | }; |
34 | }]) | 34 | }]) |
35 | .factory('focaModalTarjetasService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { | 35 | .factory('focaModalTarjetasService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { |
36 | return { | 36 | return { |
37 | getBotonera: function () { | 37 | getBotonera: function () { |
38 | return [ | 38 | return [ |
39 | { | 39 | { |
40 | label: 'tarjeta', | 40 | label: 'tarjeta', |
41 | image: 'visa.svg', | 41 | image: 'visa.svg', |
42 | active: false, | 42 | active: false, |
43 | }, | 43 | }, |
44 | { | 44 | { |
45 | label: 'tarjeta', | 45 | label: 'tarjeta', |
46 | image: 'mastercard.svg', | 46 | image: 'mastercard.svg', |
47 | active: false, | 47 | active: false, |
48 | }, | 48 | }, |
49 | { | 49 | { |
50 | label: 'tarjeta', | 50 | label: 'tarjeta', |
51 | image: 'maestro.svg', | 51 | image: 'maestro.svg', |
52 | active: false, | 52 | active: false, |
53 | }, | 53 | }, |
54 | { | 54 | { |
55 | label: 'tarjeta', | 55 | label: 'tarjeta', |
56 | image: 'americanExpress.svg', | 56 | image: 'americanExpress.svg', |
57 | active: false, | 57 | active: false, |
58 | }, | 58 | }, |
59 | { | 59 | { |
60 | label: 'tarjeta', | 60 | label: 'tarjeta', |
61 | image: 'naranja.png', | 61 | image: 'naranja.png', |
62 | active: false, | 62 | active: false, |
63 | }, | 63 | }, |
64 | { | 64 | { |
65 | label: 'tarjeta', | 65 | label: 'tarjeta', |
66 | image: 'cabal.svg', | 66 | image: 'cabal.svg', |
67 | active: false, | 67 | active: false, |
68 | }, | 68 | }, |
69 | { | 69 | { |
70 | label: 'tarjeta', | 70 | label: 'tarjeta', |
71 | image: 'argencard.svg', | 71 | image: 'argencard.svg', |
72 | active: false, | 72 | active: false, |
73 | }, | 73 | }, |
74 | { | 74 | { |
75 | label: 'tarjeta', | 75 | label: 'tarjeta', |
76 | image: 'nativa.png', | 76 | image: 'nativa.png', |
77 | active: false, | 77 | active: false, |
78 | }, | 78 | }, |
79 | { | 79 | { |
80 | label: 'tarjeta', | 80 | label: 'tarjeta', |
81 | image: 'cencosud.png', | 81 | image: 'cencosud.png', |
82 | active: false, | 82 | active: false, |
83 | }, | 83 | }, |
84 | ]; | 84 | ]; |
85 | } | 85 | } |
86 | }; | 86 | }; |
87 | }]); | 87 | }]); |
88 | 88 |