Commit ef028abf9d7c685c7c015d633237e02116c1ed12
1 parent
1caffe05d1
Exists in
master
and in
1 other branch
Arreglo con botones de aceptar.
Showing
3 changed files
with
14 additions
and
12 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.botonesTarjetas = []; | 9 | $scope.botones = []; |
| 10 | //#endregion | 10 | //#endregion |
| 11 | 11 | ||
| 12 | init(); | 12 | init(); |
| 13 | 13 | ||
| 14 | function init() { | 14 | function init() { |
| 15 | $scope.botonesTarjetas = focaModalFormaPagoService.getBotonera(); | 15 | $scope.botones = focaModalFormaPagoService.getBotonera(); |
| 16 | console.log($scope.botones); | ||
| 16 | } | 17 | } |
| 17 | 18 | ||
| 18 | $scope.seleccionarContado = function () { | 19 | $scope.seleccionarContado = function () { |
| 19 | var modalInstance = abrirModal('modal-tarjetas.html', | 20 | var modalInstance = abrirModal('modal-tarjetas.html', |
| 20 | 'focaModalTarjetasController'); | 21 | 'focaModalTarjetasController'); |
| 21 | modalInstance.result | 22 | modalInstance.result |
| 22 | .then(function (data) { | 23 | .then(function (data) { |
| 23 | console.log(data); | 24 | console.log(data); |
| 24 | }) | 25 | }) |
| 25 | .catch(function (e) { console.error(e); }); | 26 | .catch(function (e) { console.error(e); }); |
| 26 | }; | 27 | }; |
| 27 | 28 | ||
| 28 | $scope.seleccionarTarjetas = function () { | 29 | $scope.seleccionarTarjetas = function () { |
| 29 | var modalInstance = abrirModal('modal-tarjetas.html', | 30 | var modalInstance = abrirModal('modal-tarjetas.html', |
| 30 | 'focaModalTarjetasController'); | 31 | 'focaModalTarjetasController'); |
| 31 | modalInstance.result | 32 | modalInstance.result |
| 32 | .then(function (data) { | 33 | .then(function (data) { |
| 33 | console.log(data); | 34 | $uibModalInstance.close(data); |
| 34 | }) | 35 | }) |
| 35 | .catch(function (e) { console.error(e); }); | 36 | .catch(function (e) { console.error(e); }); |
| 36 | }; | 37 | }; |
| 37 | 38 | ||
| 38 | $scope.seleccionarCheque = function () { | 39 | $scope.seleccionarCheque = function () { |
| 39 | var modalInstance = abrirModal('modal-tarjetas.html', | 40 | var modalInstance = abrirModal('modal-tarjetas.html', |
| 40 | 'focaModalTarjetasController'); | 41 | 'focaModalTarjetasController'); |
| 41 | modalInstance.result | 42 | modalInstance.result |
| 42 | .then(function (data) { | 43 | .then(function (data) { |
| 43 | console.log(data); | 44 | console.log(data); |
| 44 | }) | 45 | }) |
| 45 | .catch(function (e) { console.error(e); }); | 46 | .catch(function (e) { console.error(e); }); |
| 46 | }; | 47 | }; |
| 47 | 48 | ||
| 48 | $scope.seleccionarVales = function () { | 49 | $scope.seleccionarVales = function () { |
| 49 | var modalInstance = abrirModal('modal-tarjetas.html', | 50 | var modalInstance = abrirModal('modal-tarjetas.html', |
| 50 | 'focaModalTarjetasController'); | 51 | 'focaModalTarjetasController'); |
| 51 | modalInstance.result | 52 | modalInstance.result |
| 52 | .then(function (data) { | 53 | .then(function (data) { |
| 53 | console.log(data); | 54 | console.log(data); |
| 54 | }) | 55 | }) |
| 55 | .catch(function (e) { console.error(e); }); | 56 | .catch(function (e) { console.error(e); }); |
| 56 | }; | 57 | }; |
| 57 | 58 | ||
| 58 | $scope.seleccionarPagoElectronico = function () { | 59 | $scope.seleccionarPagoElectronico = function () { |
| 59 | var modalInstance = abrirModal('modal-tarjetas.html', | 60 | var modalInstance = abrirModal('modal-tarjetas.html', |
| 60 | 'focaModalTarjetasController'); | 61 | 'focaModalTarjetasController'); |
| 61 | modalInstance.result | 62 | modalInstance.result |
| 62 | .then(function (data) { | 63 | .then(function (data) { |
| 63 | console.log(data); | 64 | console.log(data); |
| 64 | }) | 65 | }) |
| 65 | .catch(function (e) { console.error(e); }); | 66 | .catch(function (e) { console.error(e); }); |
| 66 | }; | 67 | }; |
| 67 | 68 | ||
| 68 | function abrirModal(templateUrl, controller) { | 69 | function abrirModal(templateUrl, controller) { |
| 69 | return $uibModal.open( | 70 | return $uibModal.open( |
| 70 | { | 71 | { |
| 71 | templateUrl: templateUrl, | 72 | templateUrl: templateUrl, |
| 72 | controller: controller, | 73 | controller: controller, |
| 73 | resolve: { | 74 | resolve: { |
| 74 | filters: function () { return null; }, | 75 | filters: function () { return null; }, |
| 75 | }, | 76 | }, |
| 76 | size: 'lg', | 77 | size: 'lg', |
| 77 | } | 78 | } |
| 78 | ); | 79 | ); |
| 79 | 80 | ||
| 80 | } | 81 | } |
| 81 | 82 | ||
| 82 | $scope.cancel = function () { | 83 | $scope.cancel = function () { |
| 83 | $uibModalInstance.dismiss('cancel'); | 84 | $uibModalInstance.dismiss('cancel'); |
| 84 | }; | 85 | }; |
| 85 | |||
| 86 | $scope.select = function (iva) { | ||
| 87 | $uibModalInstance.close(iva); | ||
| 88 | }; | ||
| 89 | }] | 86 | }] |
| 90 | ) | 87 | ) |
| 91 | .controller('focaModalTarjetasController', [ | 88 | .controller('focaModalTarjetasController', [ |
| 92 | '$timeout', '$filter', '$scope', '$uibModalInstance', 'focaModalTarjetasService', | 89 | '$timeout', '$filter', '$scope', '$uibModalInstance', 'focaModalTarjetasService', |
| 93 | function ($timeout, $filter, $scope, $uibModalInstance, focaModalTarjetasService) { | 90 | function ($timeout, $filter, $scope, $uibModalInstance, focaModalTarjetasService) { |
| 94 | 91 | ||
| 95 | //#region Variables | 92 | //#region Variables |
| 96 | $scope.botonesTarjetas = []; | 93 | $scope.botonesTarjetas = []; |
| 97 | $scope.showForm = false; | 94 | $scope.showForm = false; |
| 98 | 95 | ||
| 99 | //#endregion | 96 | //#endregion |
| 100 | 97 | ||
| 101 | init(); | 98 | init(); |
| 102 | 99 | ||
| 103 | function init() { | 100 | function init() { |
| 104 | $scope.botonesTarjetas = focaModalTarjetasService.getBotonera(); | 101 | $scope.botonesTarjetas = focaModalTarjetasService.getBotonera(); |
| 105 | } | 102 | } |
| 106 | 103 | ||
| 107 | $scope.seleccionarTarjeta = function () { | 104 | $scope.seleccionarTarjeta = function () { |
| 108 | animateForm(); | 105 | animateForm(); |
| 109 | }; | 106 | }; |
| 110 | 107 | ||
| 111 | $scope.cancel = function () { | 108 | $scope.cancel = function () { |
| 112 | $uibModalInstance.dismiss('cancel'); | 109 | $uibModalInstance.dismiss('cancel'); |
| 113 | }; | 110 | }; |
| 114 | 111 | ||
| 115 | $scope.select = function (iva) { | 112 | $scope.aceptarFormaDePago = function () { |
| 116 | $uibModalInstance.close(iva); | 113 | $uibModalInstance.close('data de tarjeta'); |
| 117 | }; | 114 | }; |
| 118 | 115 | ||
| 119 | function animateForm() { | 116 | function animateForm() { |
| 120 | $scope.showForm = false; | 117 | $scope.showForm = false; |
| 121 | $timeout(function () { | 118 | $timeout(function () { |
| 122 | $scope.showForm = true; | 119 | $scope.showForm = true; |
| 123 | }, 100); | 120 | }, 100); |
| 124 | } | 121 | } |
| 125 | }] | 122 | }] |
| 126 | ); | 123 | ); |
src/views/modal-forma-pago.html
| 1 | <div class="modal-header"> | 1 | <div class="modal-header"> |
| 2 | <h5 class="modal-title">Formas de pago</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"> | 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-forma-pago | 10 | <foca-botonera-forma-pago |
| 11 | botones="botonesTarjetas" | 11 | botones="botones" |
| 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-forma-pago> | 15 | </foca-botonera-forma-pago> |
| 16 | </div> | 16 | </div> |
| 17 | </div> | 17 | </div> |
| 18 | </div> | 18 | </div> |
| 19 | </div> | 19 | </div> |
| 20 | </div> | 20 | </div> |
| 21 | 21 | ||
| 22 | <div class="modal-footer"> | 22 | <div class="modal-footer"> |
| 23 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | 23 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
| 24 | </div> | 24 | </div> |
| 25 | 25 |
src/views/modal-tarjetas.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">Pago con Tarjeta</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 mb-2"> |
| 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-tarjetas |
| 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-tarjetas> |
| 16 | </div> | 16 | </div> |
| 17 | </div> | 17 | </div> |
| 18 | </div> | 18 | </div> |
| 19 | </div> | 19 | </div> |
| 20 | <div class="border-top" ng-show="showForm"> | 20 | <div class="border-top" ng-show="showForm"> |
| 21 | <div class="row mt-4 fadeIn"> | 21 | <div class="row mt-4 fadeIn"> |
| 22 | <div class="col"> | 22 | <div class="col"> |
| 23 | <form> | 23 | <form> |
| 24 | <div class="row pb-3"> | 24 | <div class="row pb-3"> |
| 25 | <div class="col-3 col-sm-2 pr-1"> | 25 | <div class="col-3 col-sm-2 pr-1"> |
| 26 | <input class="form-control form-control-sm"> | 26 | <input class="form-control form-control-sm"> |
| 27 | </div> | 27 | </div> |
| 28 | <div class="col-9 col-sm-4 pl-2"> | 28 | <div class="col-9 col-sm-4 pl-2"> |
| 29 | <input class="form-control form-control-sm"> | 29 | <input class="form-control form-control-sm"> |
| 30 | </div> | 30 | </div> |
| 31 | </div> | 31 | </div> |
| 32 | <div class="row pb-3"> | 32 | <div class="row pb-3"> |
| 33 | <div class="col"> | 33 | <div class="col"> |
| 34 | <span>Importe</span> | 34 | <span>Importe</span> |
| 35 | <strong>$1560.45</strong> | 35 | <strong>$1560.45</strong> |
| 36 | </div> | 36 | </div> |
| 37 | </div> | 37 | </div> |
| 38 | <div class="row pb-3"> | 38 | <div class="row pb-3"> |
| 39 | <div class="col-auto pr-1 my-auto"> | 39 | <div class="col-auto pr-1 my-auto"> |
| 40 | <span>Cuotas</span> | 40 | <span>Cuotas</span> |
| 41 | </div> | 41 | </div> |
| 42 | <div class="col col-sm-5 pl-1"> | 42 | <div class="col col-sm-5 pl-1"> |
| 43 | <input | 43 | <input |
| 44 | class="form-control form-control-sm" | 44 | class="form-control form-control-sm" |
| 45 | type="number" | 45 | type="number" |
| 46 | ng-disabled="readonly"> | 46 | ng-disabled="readonly"> |
| 47 | </div> | 47 | </div> |
| 48 | </div> | 48 | </div> |
| 49 | <div class="row pb-3"> | 49 | <div class="row pb-3"> |
| 50 | <div class="col-auto pr-1 my-auto"> | 50 | <div class="col-auto pr-1 my-auto"> |
| 51 | <span>Terminal Nº</span> | 51 | <span>Terminal Nº</span> |
| 52 | </div> | 52 | </div> |
| 53 | <div class="col col-sm-5 pl-1"> | 53 | <div class="col col-sm-5 pl-1"> |
| 54 | <input | 54 | <input |
| 55 | class="form-control form-control-sm" | 55 | class="form-control form-control-sm" |
| 56 | type="number" | 56 | type="number" |
| 57 | ng-disabled="readonly"> | 57 | ng-disabled="readonly"> |
| 58 | </div> | 58 | </div> |
| 59 | </div> | 59 | </div> |
| 60 | </form> | 60 | </form> |
| 61 | </div> | 61 | </div> |
| 62 | </div> | 62 | </div> |
| 63 | </div> | 63 | </div> |
| 64 | </div> | 64 | </div> |
| 65 | 65 | ||
| 66 | 66 | ||
| 67 | <div class="modal-footer d-flex justify-content-between"> | 67 | <div class="modal-footer d-flex" ng-class="{ 'justify-content-between': showForm }"> |
| 68 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | 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> | 69 | <button |
| 70 | class="btn btn-sm btn-primary" | ||
| 71 | type="button" | ||
| 72 | ng-click="aceptarFormaDePago()" | ||
| 73 | ng-show="showForm">Aceptar | ||
| 74 | </button> | ||
| 70 | </div> | 75 | </div> |
| 71 | 76 |