Compare View

switch
from
...
to
 
Commits (47)
... ... @@ -4,11 +4,12 @@
4 4 "description": "Modales de foca",
5 5 "main": "index.js",
6 6 "scripts": {
  7 + "refresh": "gulp uglify && cp tmp/foca-modal.js ../wrapper-demo/node_modules/foca-modal/dist/foca-modal.min.js",
7 8 "test": "echo \"Error: no test specified\" && exit 1",
8 9 "gulp-pre-commit": "gulp pre-commit",
9 10 "compile": "gulp uglify",
10 11 "postinstall": "npm run compile && gulp clean-post-install",
11   - "install-dev": "npm install -D angular gulp gulp-angular-templatecache gulp-clean gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify jshint pump git+http://git.focasoftware.com/npm/foca-directivas.git"
  12 + "install-dev": "npm install -D angular gulp gulp-angular-templatecache gulp-clean gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify jshint pump git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git"
12 13 },
13 14 "pre-commit": [
14 15 "gulp-pre-commit"
... ... @@ -20,11 +21,11 @@
20 21 "author": "Foca Software",
21 22 "license": "ISC",
22 23 "peerDependencies": {
23   - "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git"
  24 + "foca-directivas": "git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git"
24 25 },
25 26 "devDependencies": {
26 27 "angular": "^1.7.5",
27   - "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git",
  28 + "foca-directivas": "git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git",
28 29 "gulp": "^3.9.1",
29 30 "gulp-angular-templatecache": "^2.2.5",
30 31 "gulp-clean": "^0.4.0",
src/js/controller.js
... ... @@ -11,6 +11,15 @@ angular.module('focaModal')
11 11 };
12 12 }
13 13 ])
  14 +.controller('focaModalInfoController', [
  15 + '$uibModalInstance', '$scope', 'textoModal',
  16 + function($uibModalInstance, $scope, textoModal) {
  17 + $scope.textoModal = textoModal;
  18 + $scope.aceptar = function() {
  19 + $uibModalInstance.close(true);
  20 + };
  21 + }
  22 +])
14 23 .controller('focaModalAlertController', [
15 24 '$uibModalInstance', '$scope', 'textoModal',
16 25 function($uibModalInstance, $scope, textoModal) {
... ... @@ -26,9 +35,9 @@ angular.module('focaModal')
26 35 $scope.parametros = parametros;
27 36 $scope.fecha = new Date();
28 37 $scope.options = {};
29   -
  38 +
30 39 if (parametros.minDate) $scope.options.minDate = parametros.minDate;
31   -
  40 +
32 41 $scope.cancelar = function() {
33 42 $uibModalInstance.dismiss();
34 43 };
... ... @@ -42,6 +51,10 @@ angular.module('focaModal')
42 51 function($uibModalInstance, $scope, options, focaModalService) {
43 52  
44 53 $scope.options = options;
  54 +
  55 + if (!$scope.options.tipo) {
  56 + $scope.options.tipo = 'text'
  57 + }
45 58 $scope.cancelar = function() {
46 59 $uibModalInstance.dismiss();
47 60 };
src/js/controllerMail.js
... ... @@ -6,7 +6,7 @@ angular.module('focaModal')
6 6 'Blob',
7 7 'focaModalService',
8 8 'options',
9   - function($scope, $uibModalInstance, FileSaver, Blob,
  9 + function ($scope, $uibModalInstance, FileSaver, Blob,
10 10 focaModalService, options) {
11 11  
12 12 var regexMail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
... ... @@ -15,30 +15,40 @@ angular.module(&#39;focaModal&#39;)
15 15 $scope.correoNoEnviado = false;
16 16 $scope.esperando = false;
17 17 $scope.titulo = options.titulo;
18   - $scope.mailCliente = options.envio.mailCliente;
  18 + $scope.checkboxVar = false;
19 19  
20   - $scope.aceptar = function() {
  20 + $scope.aceptar = function () {
21 21 $uibModalInstance.close();
22 22 };
23   - $scope.salir = function() {
  23 + $scope.salir = function () {
24 24 $uibModalInstance.close($scope.descargado);
25 25 };
26   - $scope.imprimir = function () {
  26 + $scope.validarImpresion = function () {
  27 + var rutaComprobante;
  28 + rutaComprobante = $scope.checkboxVar === true ? options.descargaSinValorizar : options.descarga;
  29 + imprimir(rutaComprobante);
  30 + }
  31 + imprimir = function (rutaComprobante) {
27 32 $scope.descargado = true;
28 33 $scope.esperando = true;
29 34 focaModalService
30   - .imprimirComprobante(options.descarga.url, options.options)
31   - .then(function(res) {
32   - var data = new Blob([res.data], {type: 'application/pdf'});
  35 + .imprimirComprobante(rutaComprobante.url, options.options)
  36 + .then(function (res) {
  37 + var data = new Blob([res.data], { type: 'application/pdf' });
33 38  
34 39 FileSaver.saveAs(
35 40 data,
36   - options.descarga.nombre
  41 + rutaComprobante.nombre
37 42 );
38 43 $scope.esperando = false;
39 44 });
40 45 };
41   - $scope.enviarCorreo = function(key) {
  46 + $scope.enviarComprobante = function () {
  47 + var rutaEnvioComprobante;
  48 + rutaEnvioComprobante = $scope.checkboxVar === true ? options.envioSinValorizar : options.envio;
  49 + enviarCorreo(rutaEnvioComprobante, 13);
  50 + }
  51 + enviarCorreo = function (rutaEnvioComprobante, key) {
42 52 if (key === 13) {
43 53 if (!validarMail()) {
44 54 focaModalService.alert('Ingrese email/s válido/s');
... ... @@ -46,14 +56,15 @@ angular.module(&#39;focaModal&#39;)
46 56 }
47 57 $scope.descargado = true;
48 58 $scope.esperando = true;
49   - Object.assign(options.options, {receiver: $scope.mailCliente});
  59 + rutaEnvioComprobante.mailCliente = $scope.mailCliente;
  60 + Object.assign(options.options, { receiver: $scope.mailCliente });
50 61  
51 62 focaModalService
52   - .enviarCorreo(options.envio.url, options.options)
53   - .then(function() {
  63 + .enviarCorreo(rutaEnvioComprobante.url, options.options)
  64 + .then(function () {
54 65 $scope.correoEnviado = true;
55 66 $scope.esperando = false;
56   - }, function() {
  67 + }, function () {
57 68 $scope.esperando = false;
58 69 $scope.correoNoEnviado = true;
59 70 });
... ... @@ -62,7 +73,7 @@ angular.module(&#39;focaModal&#39;)
62 73 function validarMail() {
63 74 var emails = $scope.mailCliente.split(',');
64 75 var result = true;
65   - emails.forEach(function(email) {
  76 + emails.forEach(function (email) {
66 77 if (!regexMail.test(email.trim())) result = false;
67 78 });
68 79 return result;
src/js/controllerModal.js
... ... @@ -197,5 +197,9 @@ angular.module(&#39;focaModal&#39;)
197 197 }
198 198 }
199 199 $scope.busquedaPress(13);
  200 +
  201 + $scope.clearInput = function() {
  202 + $scope.filters = '';
  203 + };
200 204 }]
201 205 );
... ... @@ -17,6 +17,20 @@ angular.module(&#39;focaModal&#39;)
17 17 }
18 18 );
19 19 },
  20 + info: function(textoModal) {
  21 + return $uibModal.open({
  22 + templateUrl: 'modal-info.html',
  23 + controller: 'focaModalInfoController',
  24 + animation: false,
  25 + backdrop: false,
  26 + resolve: { textoModal: function() { return textoModal; } }
  27 + })
  28 + .result.then(
  29 + function(resultado) {
  30 + return resultado;
  31 + }
  32 + );
  33 + },
20 34 alert: function(textoModal) {
21 35 return $uibModal.open({
22 36 templateUrl: 'modal-alert.html',
... ... @@ -91,6 +105,7 @@ angular.module(&#39;focaModal&#39;)
91 105 templateUrl: 'modal-mail.html',
92 106 controller: 'focaModalMailController',
93 107 size: 'md',
  108 + backdrop: false,
94 109 resolve: {
95 110 options: function() {return options;},
96 111 }
src/views/foca-modal.html
... ... @@ -18,6 +18,14 @@
18 18 ng-focus="selectedEntidad = -1"
19 19 teclado-virtual
20 20 >
  21 + <button
  22 + ng-show="filters.length >= 1"
  23 + type="button"
  24 + class="clear-input"
  25 + ng-click="clearInput()"
  26 + >
  27 + <i class="fa fa-times"></i>
  28 + </button>
21 29 <div class="input-group-append">
22 30 <button
23 31 ladda="searchLoading"
src/views/modal-alert.html
... ... @@ -2,10 +2,10 @@
2 2 <h4>Atención</h4>
3 3 </div>
4 4 <div class="modal-body">
5   - <p ng-bind="textoModal">
  5 + <p ng-bind="textoModal" class="line-break">
6 6  
7 7 </p>
8 8 </div>
9 9 <div class="modal-footer">
10   - <button class="btn btn-info" ng-click="aceptar()" foca-focus="true">Aceptar</button>
  10 + <button class="btn btn-primary" ng-click="aceptar()" foca-focus="true">Aceptar</button>
11 11 </div>
src/views/modal-confirm.html
... ... @@ -2,7 +2,7 @@
2 2 <h4>Confirmar</h4>
3 3 </div>
4 4 <div class="modal-body">
5   - <p ng-bind="textoModal">
  5 + <p ng-bind="textoModal" class="line-break">
6 6  
7 7 </p>
8 8 </div>
src/views/modal-info.html
... ... @@ -0,0 +1,21 @@
  1 +<div class="focus-in">
  2 + <div class="modal-header">
  3 + <h4>Información</h4>
  4 + </div>
  5 + <div class="modal-body">
  6 + <p ng-bind="textoModal" class="line-break m-0 pb-2"></p>
  7 + <!-- La versión está tipeada, después habria que hacer que se haga una consulta y devuelva la versión -->
  8 + <p class="m-0 border-bottom border-top pt-2 pb-2">DEBO® Distribuidores: Versión 2.0</p>
  9 + <p class="mt-1">Ante un inconveniente con el sistema,</br>
  10 + comuniquese con nuestra <a href="http://focasoftware.com" target="__blank">mesa de ayuda</a></p>
  11 + <a href="http://focasoftware.com" target="__blank">
  12 + <img src="img/logo-foca.png" class="w-25 rounded mx-auto d-block mt-4">
  13 + </a>
  14 + </div>
  15 + <div class="modal-footer">
  16 + <button class="btn btn-primary" ng-click="aceptar()" foca-focus="true">Aceptar</button>
  17 + </div>
  18 +</div>
  19 +
  20 +
  21 +
src/views/modal-mail.html
... ... @@ -12,29 +12,42 @@
12 12 <label>Enviar correo a</label>
13 13 <div class="d-flex">
14 14 <input
  15 + type="email"
15 16 class="form-control col-9"
16 17 ng-model="mailCliente"
17   - ng-keypress="enviarCorreo($event.keyCode)"
  18 + ng-keypress="enviarComprobante($event.keyCode)"
18 19 teclado-virtual/>
19 20 <button
20 21 type="button"
21   - class="btn btn-primary ml-auto"
22   - ng-click="enviarCorreo(13)"
  22 + class="btn btn-enviar ml-auto"
  23 + ng-click="enviarComprobante(13)"
23 24 ladda="esperando"
24 25 >Enviar</button>
25 26 </div>
26 27 </div>
27 28 <hr>
28 29 <div>
29   - <label>Descargar comprobante en este dispositivo</label>
30   - <button
31   - class="btn btn-primary float-right"
32   - ng-click="imprimir()"
33   - ladda="esperando"
34   - >Descargar</button>
  30 + <label>Descargar comprobante</label>
  31 + <div class="col my-1 d-flex justify-content-end">
  32 + <button
  33 + class="btn btn-enviar float-right"
  34 + ng-click="validarImpresion()"
  35 + ladda="esperando"
  36 + >Descargar</button>
  37 + </div>
35 38 </div>
36 39 </div>
37 40 <div class="modal-footer">
  41 + <div class="custom-control custom-checkbox my-auto mr-5">
  42 + <input
  43 + type="checkbox"
  44 + class="custom-control-input mr-5"
  45 + id="check"
  46 + ng-click="checkboxVar = !checkboxVar">
  47 + <label class="custom-control-label disable-selection" for="check">
  48 + Combrobante sin valorizar
  49 + </label>
  50 + </div>
38 51 <button
39 52 type="button"
40 53 class="btn btn-secondary"
src/views/modal-prompt.html
... ... @@ -3,7 +3,7 @@
3 3 </div>
4 4 <div class="modal-body">
5 5 <input
6   - type="text"
  6 + type="{{options.tipo}}"
7 7 class="form-control"
8 8 ng-model="options.value"
9 9 ng-show="!options.textarea"