Commit f748d6563029c57e103f66597f3e7b295c56594f

Authored by Eric Fernandez
Exists in master and in 1 other branch develop

Merge branch 'master' into 'develop'

Master(mpuebla)

See merge request !1
src/js/controller.js
1 angular.module('focaModalFormaPago') 1 angular.module('focaModalFormaPago')
2 .controller('focaModalFormaPagoController', [ 2 .controller('focaModalFormaPagoController', [
3 '$timeout', '$filter', '$scope', '$uibModalInstance', 'focaModalFormaPagoService', 3 '$timeout', '$filter', '$scope', '$uibModal',
4 function ($timeout, $filter, $scope, $uibModalInstance, focaModalFormaPagoService) { 4 '$uibModalInstance', 'focaModalFormaPagoService',
5 function ($timeout, $filter, $scope, $uibModal,
6 $uibModalInstance, focaModalFormaPagoService) {
7
8 //#region Variables
9 $scope.botonesTarjetas = [];
10 //#endregion
11
12 init();
13
14 function init() {
15 $scope.botonesTarjetas = focaModalFormaPagoService.getBotonera();
16 }
17
18 $scope.seleccionarContado = function () {
19 var modalInstance = abrirModal('modal-tarjetas.html',
20 'focaModalTarjetasController');
21 modalInstance.result
22 .then(function (data) {
23 console.log(data);
24 })
25 .catch(function (e) { console.error(e); });
26 };
27
28 $scope.seleccionarTarjetas = function () {
29 var modalInstance = abrirModal('modal-tarjetas.html',
30 'focaModalTarjetasController');
31 modalInstance.result
32 .then(function (data) {
33 console.log(data);
34 })
35 .catch(function (e) { console.error(e); });
36 };
37
38 $scope.seleccionarCheque = function () {
39 var modalInstance = abrirModal('modal-tarjetas.html',
40 'focaModalTarjetasController');
41 modalInstance.result
42 .then(function (data) {
43 console.log(data);
44 })
45 .catch(function (e) { console.error(e); });
46 };
47
48 $scope.seleccionarVales = function () {
49 var modalInstance = abrirModal('modal-tarjetas.html',
50 'focaModalTarjetasController');
51 modalInstance.result
52 .then(function (data) {
53 console.log(data);
54 })
55 .catch(function (e) { console.error(e); });
56 };
57
58 $scope.seleccionarPagoElectronico = function () {
59 var modalInstance = abrirModal('modal-tarjetas.html',
60 'focaModalTarjetasController');
61 modalInstance.result
62 .then(function (data) {
63 console.log(data);
64 })
65 .catch(function (e) { console.error(e); });
66 };
67
68 function abrirModal(templateUrl, controller) {
69 return $uibModal.open(
70 {
71 templateUrl: templateUrl,
72 controller: controller,
73 resolve: {
74 filters: function () { return null; },
75 },
76 size: 'lg',
77 }
78 );
79
80 }
81
82 $scope.cancel = function () {
83 $uibModalInstance.dismiss('cancel');
84 };
85
86 $scope.select = function (iva) {
87 $uibModalInstance.close(iva);
88 };
89 }]
90 )
91 .controller('focaModalTarjetasController', [
92 '$timeout', '$filter', '$scope', '$uibModalInstance', 'focaModalTarjetasService',
93 function ($timeout, $filter, $scope, $uibModalInstance, focaModalTarjetasService) {
5 94
6 //#region Variables 95 //#region Variables
7 $scope.botonesTarjetas = []; 96 $scope.botonesTarjetas = [];
8 $scope.showForm = false; 97 $scope.showForm = false;
9 98
10 //#endregion 99 //#endregion
11 100
12 init(); 101 init();
13 102
14 function init() { 103 function init() {
15 $scope.botonesTarjetas = focaModalFormaPagoService.getBotonera(); 104 $scope.botonesTarjetas = focaModalTarjetasService.getBotonera();
16 } 105 }
17 106
18 $scope.seleccionarTarjeta = function () { 107 $scope.seleccionarTarjeta = function () {
19 animateForm(); 108 animateForm();
20 }; 109 };
21 110
22 $scope.cancel = function () { 111 $scope.cancel = function () {
23 $uibModalInstance.dismiss('cancel'); 112 $uibModalInstance.dismiss('cancel');
24 }; 113 };
25 114
26 $scope.select = function (iva) { 115 $scope.select = function (iva) {
27 $uibModalInstance.close(iva); 116 $uibModalInstance.close(iva);
28 }; 117 };
29 118
30 function animateForm() { 119 function animateForm() {
31 $scope.showForm = false; 120 $scope.showForm = false;
32 $timeout(function () { 121 $timeout(function () {
33 $scope.showForm = true; 122 $scope.showForm = true;
34 }, 100); 123 }, 100);
35 } 124 }
36 }] 125 }]
37 ); 126 );
38 127
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 getFormasPago: function () { 4 getBotonera: function () {
5 //TODO: pasar filtro 5 return [
6 return $http.get(API_ENDPOINT.URL + '/forma-pago'); 6 {
7 }, 7 label: 'Contado',
8 image: 'contado.png',
9 disabled: true
10 },
11 {
12 label: 'Tarjetas',
13 image: 'tarjeta.png',
14 disabled: false
15 },
16 {
17 label: 'Cheque',
18 image: 'cheque.png',
19 disabled: true
20 },
21 {
22 label: 'Vales',
23 image: 'vale.png',
24 disabled: true
25 },
26 {
27 label: 'Pago Electronico',
28 image: 'qr.png',
29 disabled: true
30 }
31 ];
32 }
33 };
34 }])
35 .factory('focaModalTarjetasService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) {
36 return {
8 getBotonera: function () { 37 getBotonera: function () {
9 return [ 38 return [
10 { 39 {
11 label: 'tarjeta', 40 label: 'tarjeta',
12 image: 'visa.svg', 41 image: 'visa.svg',
13 active: false, 42 active: false,
14 }, 43 },
15 { 44 {
16 label: 'tarjeta', 45 label: 'tarjeta',
17 image: 'mastercard.svg', 46 image: 'mastercard.svg',
18 active: false, 47 active: false,
19 }, 48 },
20 { 49 {
21 label: 'tarjeta', 50 label: 'tarjeta',
22 image: 'maestro.svg', 51 image: 'maestro.svg',
23 active: false, 52 active: false,
24 }, 53 },
25 { 54 {
26 label: 'tarjeta', 55 label: 'tarjeta',
27 image: 'americanExpress.svg', 56 image: 'americanExpress.svg',
28 active: false, 57 active: false,
29 }, 58 },
30 { 59 {
31 label: 'tarjeta', 60 label: 'tarjeta',
32 image: 'naranja.png', 61 image: 'naranja.png',
33 active: false, 62 active: false,
34 }, 63 },
35 { 64 {
36 label: 'tarjeta', 65 label: 'tarjeta',
37 image: 'cabal.svg', 66 image: 'cabal.svg',
38 active: false, 67 active: false,
39 }, 68 },
40 { 69 {
41 label: 'tarjeta', 70 label: 'tarjeta',
42 image: 'argencard.svg', 71 image: 'argencard.svg',
43 active: false, 72 active: false,
44 }, 73 },
45 { 74 {
46 label: 'tarjeta', 75 label: 'tarjeta',
47 image: 'nativa.png', 76 image: 'nativa.png',
48 active: false, 77 active: false,
49 }, 78 },
50 { 79 {
51 label: 'tarjeta', 80 label: 'tarjeta',
52 image: 'cencosud.png', 81 image: 'cencosud.png',
53 active: false, 82 active: false,
54 }, 83 },
55 ]; 84 ];
56 } 85 }
57 }; 86 };
58 }]); 87 }]);
59 88
src/views/modal-forma-pago.html
1 <div class="modal-header"> 1 <div class="modal-header">
2 <h5 class="modal-title">Pago con Tarjeta</h5> 2 <h5 class="modal-title">Formas de pago</h5>
3 </div> 3 </div>
4 4
5 <div class="modal-body" id="modal-body"> 5 <div class="modal-body" id="modal-body">
6 <div class="row mb-2"> 6 <div class="row">
7 <div class="col-12 p-0"> 7 <div class="col-12 p-0">
8 <div class="row mx-0 botonera-secundaria"> 8 <div class="row mx-0 botonera-secundaria">
9 <div class="col-12"> 9 <div class="col-12">
10 <foca-botonera-tarjetas 10 <foca-botonera-forma-pago
11 botones="botonesTarjetas" 11 botones="botonesTarjetas"
12 max="1" 12 max="1"
13 class="row justify-content-start mx-0" 13 class="row justify-content-start mx-0"
14 > 14 >
15 </foca-botonera-tarjetas> 15 </foca-botonera-forma-pago>
16 </div> 16 </div>
17 </div> 17 </div>
18 </div> 18 </div>
19 </div> 19 </div>
20
21 <div class="border-top" ng-show="showForm">
22 <div class="row mt-4 fadeIn">
23 <div class="col">
24 <form>
25 <div class="row">
26 <div class="col-3 col-sm-2 pr-1">
27 <input class="form-control">
28 </div>
29 <div class="col-9 col-sm-4 pl-2">
30 <input class="form-control">
31 </div>
32 </div>
33 </form>
34 </div>
35 </div>
36 </div>
37
38 </div> 20 </div>
39 21
40 <div class="modal-footer"> 22 <div class="modal-footer">
41 <button class="btn btn-sm btn-secondary my-1" type="button" ng-click="cancel()">Cancelar</button> 23 <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button>
42 </div> 24 </div>
43 25
src/views/modal-tarjetas.html
File was created 1 <div class="modal-header">
2 <h5 class="modal-title">Pago con Tarjeta</h5>
3 </div>
4
5 <div class="modal-body" id="modal-body">
6 <div class="row mb-2">
7 <div class="col-12 p-0">
8 <div class="row mx-0 botonera-secundaria">
9 <div class="col-12">
10 <foca-botonera-tarjetas
11 botones="botonesTarjetas"
12 max="1"
13 class="row justify-content-start mx-0"
14 >
15 </foca-botonera-tarjetas>
16 </div>
17 </div>
18 </div>
19 </div>
20 <div class="border-top" ng-show="showForm">
21 <div class="row mt-4 fadeIn">
22 <div class="col">
23 <form>
24 <div class="row pb-3">
25 <div class="col-3 col-sm-2 pr-1">
26 <input class="form-control form-control-sm">
27 </div>
28 <div class="col-9 col-sm-4 pl-2">
29 <input class="form-control form-control-sm">
30 </div>
31 </div>
32 <div class="row pb-3">
33 <div class="col">
34 <span>Importe</span>
35 <strong>$1560.45</strong>
36 </div>
37 </div>
38 <div class="row pb-3">
39 <div class="col-auto pr-1 my-auto">
40 <span>Cuotas</span>
41 </div>
42 <div class="col col-sm-5 pl-1">
43 <input
44 class="form-control form-control-sm"
45 type="number"
46 ng-disabled="readonly">
47 </div>
48 </div>
49 <div class="row pb-3">
50 <div class="col-auto pr-1 my-auto">
51 <span>Terminal Nº</span>
52 </div>
53 <div class="col col-sm-5 pl-1">
54 <input
55 class="form-control form-control-sm"
56 type="number"
57 ng-disabled="readonly">
58 </div>
59 </div>
60 </form>
61 </div>
62 </div>
63 </div>
64 </div>
65
66
67 <div class="modal-footer d-flex justify-content-between">
68 <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button>
69 <button class="btn btn-sm btn-primary" type="button" ng-click="cancel()">Aceptar</button>
70 </div>
71