Commit 2b259f108f842f16f95894629978f0fbd9e34d14
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master(efernandez) See merge request !2
Showing
5 changed files
 
Show diff stats
src/js/controller.js
| ... | ... | @@ -19,4 +19,17 @@ angular.module('focaModal') | 
| 19 | 19 | $uibModalInstance.close(true); | 
| 20 | 20 | }; | 
| 21 | 21 | } | 
| 22 | +]) | |
| 23 | +.controller('focaModalFechaController', [ | |
| 24 | + '$uibModalInstance', '$scope', 'titulo', | |
| 25 | + function($uibModalInstance, $scope, titulo) { | |
| 26 | + $scope.titulo = titulo; | |
| 27 | + $scope.fecha = new Date(); | |
| 28 | + $scope.cancelar = function() { | |
| 29 | + $uibModalInstance.dismiss(); | |
| 30 | + }; | |
| 31 | + $scope.aceptar = function() { | |
| 32 | + $uibModalInstance.close($scope.fecha); | |
| 33 | + }; | |
| 34 | + } | |
| 22 | 35 | ]); | 
src/js/controllerModal.js
| ... | ... | @@ -13,7 +13,7 @@ angular.module('focaModal') | 
| 13 | 13 | |
| 14 | 14 | $scope.filters = ''; | 
| 15 | 15 | $scope.columnas = columnas; | 
| 16 | - $scope.titulo = titulo | |
| 16 | + $scope.titulo = titulo; | |
| 17 | 17 | $scope.entidades = []; | 
| 18 | 18 | $scope.primerBusqueda = false; | 
| 19 | 19 | $scope.searchLoading = false; | 
| ... | ... | @@ -44,7 +44,6 @@ angular.module('focaModal') | 
| 44 | 44 | $scope.filteredEntidades = $filter('filter')( | 
| 45 | 45 | $scope.entidades, { $: $scope.filters } | 
| 46 | 46 | ); | 
| 47 | - | |
| 48 | 47 | $scope.lastPage = Math.ceil( | 
| 49 | 48 | $scope.filteredEntidades.length / $scope.numPerPage | 
| 50 | 49 | ); | 
| ... | ... | @@ -99,6 +98,12 @@ angular.module('focaModal') | 
| 99 | 98 | avanzarPagina(); | 
| 100 | 99 | } | 
| 101 | 100 | }; | 
| 101 | + $scope.esFecha = function(fecha) { | |
| 102 | + if(fecha.includes('fecha')) { | |
| 103 | + return true; | |
| 104 | + } | |
| 105 | + return false; | |
| 106 | + } | |
| 102 | 107 | |
| 103 | 108 | function calcularPages(paginaActual) { | 
| 104 | 109 | var paginas = []; | 
src/js/service.js
| ... | ... | @@ -29,14 +29,13 @@ angular.module('focaModal') | 
| 29 | 29 | function(resultado) { | 
| 30 | 30 | return resultado; | 
| 31 | 31 | } | 
| 32 | - ) | |
| 32 | + ); | |
| 33 | 33 | }, | 
| 34 | 34 | modal: function(columnas, query, titulo) { | 
| 35 | 35 | return $uibModal.open({ | 
| 36 | 36 | templateUrl: 'foca-modal.html', | 
| 37 | 37 | controller: 'focaModalController', | 
| 38 | - animation: false, | |
| 39 | - backdrop: false, | |
| 38 | + size: 'lg', | |
| 40 | 39 | resolve: { | 
| 41 | 40 | columnas: function() { return columnas; }, | 
| 42 | 41 | query: function() { return query; }, | 
| ... | ... | @@ -47,10 +46,25 @@ angular.module('focaModal') | 
| 47 | 46 | function(resultado) { | 
| 48 | 47 | return resultado; | 
| 49 | 48 | } | 
| 50 | - ) | |
| 49 | + ); | |
| 51 | 50 | }, | 
| 52 | 51 | getEntidad: function(filters, query) { | 
| 53 | 52 | return $http.get(API_ENDPOINT.URL + query, {nombre: filters}); | 
| 53 | + }, | |
| 54 | + modalFecha: function(titulo) { | |
| 55 | + return $uibModal.open({ | |
| 56 | + templateUrl: 'foca-fecha.html', | |
| 57 | + controller: 'focaModalFechaController', | |
| 58 | + size: 'md', | |
| 59 | + resolve: { | |
| 60 | + titulo: function() {return titulo;} | |
| 61 | + } | |
| 62 | + }) | |
| 63 | + .result.then( | |
| 64 | + function(resultado) { | |
| 65 | + return resultado; | |
| 66 | + } | |
| 67 | + ); | |
| 54 | 68 | } | 
| 55 | 69 | }; | 
| 56 | 70 | } | 
src/views/foca-fecha.html
| ... | ... | @@ -0,0 +1,17 @@ | 
| 1 | +<div class="modal-header py-1"> | |
| 2 | + <h4 ng-bind="titulo"></h4> | |
| 3 | + <strong ng-bind="fecha | date: 'dd/MMMM/yyyy HH:mm'"></strong> | |
| 4 | +</div> | |
| 5 | +<div class="modal-body"> | |
| 6 | + <div class="offset-2"> | |
| 7 | + <div uib-datepicker ng-model="fecha"></div> | |
| 8 | + </div> | |
| 9 | +</div> | |
| 10 | +<div class="modal-footer"> | |
| 11 | + <button | |
| 12 | + class="form-control btn btn-secondary" | |
| 13 | + ng-click="cancelar()">Cancelar</button> | |
| 14 | + <button | |
| 15 | + class="form-control btn btn-primary" | |
| 16 | + ng-click="aceptar()">Aceptar</button> | |
| 17 | +</div> | 
src/views/foca-modal.html
| ... | ... | @@ -55,7 +55,9 @@ | 
| 55 | 55 | ng-repeat="(key, entidad) in currentPageEntidades" | 
| 56 | 56 | ng-click="select(entidad)" | 
| 57 | 57 | > | 
| 58 | - <td ng-repeat="propiedad in columnas.propiedad" ng-bind="entidad[propiedad]"></td> | |
| 58 | + <td | |
| 59 | + ng-repeat="propiedad in columnas.propiedad" | |
| 60 | + ng-bind="entidad[propiedad]"></td> | |
| 59 | 61 | <td class="d-md-none text-primary"> | 
| 60 | 62 | <i class="fa fa-circle-thin" aria-hidden="true"></i> | 
| 61 | 63 | </td> |