From abae9237c5b73fbc5a8e3c7e9526c323ee608a8f Mon Sep 17 00:00:00 2001 From: mpuebla Date: Fri, 19 Jul 2019 16:08:17 -0300 Subject: [PATCH] First commit --- package.json | 1 + src/js/controller.js | 45 +++++++++++-------- src/js/service.js | 53 +++++++++++++++++++++- src/views/modal-forma-pago.html | 97 ++++++++++++++--------------------------- 4 files changed, 113 insertions(+), 83 deletions(-) diff --git a/package.json b/package.json index 9a7b424..8215811 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Modal para seleccionar la forma de pago", "main": "index.js", "scripts": { + "refresh": "gulp uglify && cp tmp/foca-modal-forma-pago.js ../wrapper-demo/node_modules/foca-modal-forma-pago/dist/foca-modal-forma-pago.min.js", "test": "echo \"Error: no test specified\" && exit 1", "gulp-pre-commit": "gulp pre-commit", "compile": "gulp uglify", diff --git a/src/js/controller.js b/src/js/controller.js index a59e13a..eb43114 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -1,26 +1,37 @@ angular.module('focaModalFormaPago') .controller('focaModalFormaPagoController', [ - '$timeout', - '$filter', - '$scope', - '$uibModalInstance', - 'focaModalFormaPagoService', - 'filters', - function($timeout, $filter, $scope, $uibModalInstance, focaModalFormaPagoService, filters) { - - $scope.filters = filters; - $scope.formasPago = []; - - focaModalFormaPagoService.getFormasPago().then(function(res) { - $scope.formasPago = res.data; - }); - - $scope.cancel = function() { + '$timeout', '$filter', '$scope', '$uibModalInstance', 'focaModalFormaPagoService', + function ($timeout, $filter, $scope, $uibModalInstance, focaModalFormaPagoService) { + + //#region Variables + $scope.botonesTarjetas = []; + $scope.showForm = false; + + //#endregion + + init(); + + function init() { + $scope.botonesTarjetas = focaModalFormaPagoService.getBotonera(); + } + + $scope.seleccionarTarjeta = function () { + animateForm(); + }; + + $scope.cancel = function () { $uibModalInstance.dismiss('cancel'); }; - $scope.select = function(iva) { + $scope.select = function (iva) { $uibModalInstance.close(iva); }; + + function animateForm() { + $scope.showForm = false; + $timeout(function () { + $scope.showForm = true; + }, 100); + } }] ); diff --git a/src/js/service.js b/src/js/service.js index b66b727..3ae839a 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -1,9 +1,58 @@ angular.module('focaModalFormaPago') - .factory('focaModalFormaPagoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { + .factory('focaModalFormaPagoService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { return { - getFormasPago: function() { + getFormasPago: function () { //TODO: pasar filtro return $http.get(API_ENDPOINT.URL + '/forma-pago'); + }, + getBotonera: function () { + return [ + { + label: 'tarjeta', + image: 'visa.svg', + active: false, + }, + { + label: 'tarjeta', + image: 'mastercard.svg', + active: false, + }, + { + label: 'tarjeta', + image: 'maestro.svg', + active: false, + }, + { + label: 'tarjeta', + image: 'americanExpress.svg', + active: false, + }, + { + label: 'tarjeta', + image: 'naranja.png', + active: false, + }, + { + label: 'tarjeta', + image: 'cabal.svg', + active: false, + }, + { + label: 'tarjeta', + image: 'argencard.svg', + active: false, + }, + { + label: 'tarjeta', + image: 'nativa.png', + active: false, + }, + { + label: 'tarjeta', + image: 'cencosud.png', + active: false, + }, + ]; } }; }]); diff --git a/src/views/modal-forma-pago.html b/src/views/modal-forma-pago.html index a42d37c..06c8267 100644 --- a/src/views/modal-forma-pago.html +++ b/src/views/modal-forma-pago.html @@ -1,73 +1,42 @@ +