Commit ab1188fddbe3c70ec4e424178ddd2f7f244da7c9
1 parent
8cc9a9728d
Exists in
master
and in
1 other branch
Inhabilitar fechas pasadas
Showing
4 changed files
with
21 additions
and
14 deletions
 
Show diff stats
src/js/controller.js
| ... | ... | @@ -21,10 +21,14 @@ angular.module('focaModal') | 
| 21 | 21 | } | 
| 22 | 22 | ]) | 
| 23 | 23 | .controller('focaModalFechaController', [ | 
| 24 | - '$uibModalInstance', '$scope', 'titulo', | |
| 25 | - function($uibModalInstance, $scope, titulo) { | |
| 26 | - $scope.titulo = titulo; | |
| 24 | + '$uibModalInstance', '$scope', 'parametros', | |
| 25 | + function($uibModalInstance, $scope, parametros) { | |
| 26 | + $scope.parametros = parametros; | |
| 27 | 27 | $scope.fecha = new Date(); | 
| 28 | + $scope.options = {}; | |
| 29 | + | |
| 30 | + if (parametros.minDate) $scope.options.minDate = parametros.minDate; | |
| 31 | + | |
| 28 | 32 | $scope.cancelar = function() { | 
| 29 | 33 | $uibModalInstance.dismiss(); | 
| 30 | 34 | }; | 
| ... | ... | @@ -60,7 +64,7 @@ angular.module('focaModal') | 
| 60 | 64 | arr.forEach(function(email) { | 
| 61 | 65 | var val = String(email).trim().toLowerCase(); | 
| 62 | 66 | |
| 63 | - if(!re.test(val)) result = false; | |
| 67 | + if (!re.test(val)) result = false; | |
| 64 | 68 | }); | 
| 65 | 69 | |
| 66 | 70 | return result; | 
src/js/controllerModal.js
| ... | ... | @@ -21,7 +21,7 @@ angular.module('focaModal') | 
| 21 | 21 | $scope.selectedEntidad = -1; | 
| 22 | 22 | |
| 23 | 23 | $scope.busquedaPress = function(key) { | 
| 24 | - if(key === 13) { | |
| 24 | + if (key === 13) { | |
| 25 | 25 | $scope.searchLoading = true; | 
| 26 | 26 | if (parametrosModal.query) { | 
| 27 | 27 | focaModalService.getEntidad( | 
| ... | ... | @@ -72,7 +72,7 @@ angular.module('focaModal') | 
| 72 | 72 | } | 
| 73 | 73 | } | 
| 74 | 74 | $scope.search = function(pressed) { | 
| 75 | - if($scope.entidades.length > 0) { | |
| 75 | + if ($scope.entidades.length > 0) { | |
| 76 | 76 | $scope.filteredEntidades = $filter('filter')( | 
| 77 | 77 | $scope.entidades, { $: $scope.filters } | 
| 78 | 78 | ); | 
| ... | ... | @@ -80,7 +80,7 @@ angular.module('focaModal') | 
| 80 | 80 | $scope.filteredEntidades.length / $scope.numPerPage | 
| 81 | 81 | ); | 
| 82 | 82 | $scope.resetPage(); | 
| 83 | - }else if(pressed) { | |
| 83 | + } else if (pressed) { | |
| 84 | 84 | $timeout(function() { | 
| 85 | 85 | angular.element('#search')[0].focus(); | 
| 86 | 86 | $scope.filters = ''; | 
| ... | ... | @@ -131,7 +131,7 @@ angular.module('focaModal') | 
| 131 | 131 | } | 
| 132 | 132 | }; | 
| 133 | 133 | $scope.esFecha = function(fecha) { | 
| 134 | - if(fecha.includes('fecha')) { | |
| 134 | + if (fecha.includes('fecha')) { | |
| 135 | 135 | return true; | 
| 136 | 136 | } | 
| 137 | 137 | return false; | 
| ... | ... | @@ -168,7 +168,7 @@ angular.module('focaModal') | 
| 168 | 168 | } | 
| 169 | 169 | |
| 170 | 170 | function anterior() { | 
| 171 | - if($scope.selectedEntidad === 0 && $scope.currentPage > 1) { | |
| 171 | + if ($scope.selectedEntidad === 0 && $scope.currentPage > 1) { | |
| 172 | 172 | retrocederPagina(); | 
| 173 | 173 | } else { | 
| 174 | 174 | $scope.selectedEntidad--; | 
| ... | ... | @@ -191,7 +191,7 @@ angular.module('focaModal') | 
| 191 | 191 | } | 
| 192 | 192 | |
| 193 | 193 | function avanzarPagina() { | 
| 194 | - if($scope.currentPage < $scope.lastPage) { | |
| 194 | + if ($scope.currentPage < $scope.lastPage) { | |
| 195 | 195 | $scope.selectPage($scope.currentPage + 1); | 
| 196 | 196 | $scope.selectedEntidad = 0; | 
| 197 | 197 | } | 
src/js/service.js
| ... | ... | @@ -56,13 +56,13 @@ angular.module('focaModal') | 
| 56 | 56 | return $http.get(API_ENDPOINT.URL + query, {nombre: filters}); | 
| 57 | 57 | } | 
| 58 | 58 | }, | 
| 59 | - modalFecha: function(titulo) { | |
| 59 | + modalFecha: function(parametros) { | |
| 60 | 60 | return $uibModal.open({ | 
| 61 | 61 | templateUrl: 'foca-fecha.html', | 
| 62 | 62 | controller: 'focaModalFechaController', | 
| 63 | 63 | size: 'md', | 
| 64 | 64 | resolve: { | 
| 65 | - titulo: function() {return titulo;} | |
| 65 | + parametros: function() { return parametros; } | |
| 66 | 66 | } | 
| 67 | 67 | }) | 
| 68 | 68 | .result.then( | 
src/views/foca-fecha.html
| 1 | 1 | <div class="modal-header py-1"> | 
| 2 | - <h4 ng-bind="titulo"></h4> | |
| 2 | + <h4 ng-bind="parametros.titulo"></h4> | |
| 3 | 3 | <strong ng-bind="fecha | date: 'dd/MMMM/yyyy HH:mm'"></strong> | 
| 4 | 4 | </div> | 
| 5 | 5 | <div class="modal-body"> | 
| 6 | 6 | <div class="offset-2"> | 
| 7 | - <div uib-datepicker ng-model="fecha"></div> | |
| 7 | + <div | |
| 8 | + uib-datepicker | |
| 9 | + datepicker-options="options" | |
| 10 | + ng-model="fecha"></div> | |
| 8 | 11 | </div> | 
| 9 | 12 | </div> | 
| 10 | 13 | <div class="modal-footer"> |