Commit fc0db6803cfc9a4073329b3078ace1e431ac1686
1 parent
e7ad1a7a5a
Exists in
master
servicio modal fecha
Showing
5 changed files
with
56 additions
and
5 deletions
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
| ... | ... | @@ -35,8 +35,7 @@ angular.module('focaModal') |
| 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; }, |
| ... | ... | @@ -51,6 +50,21 @@ angular.module('focaModal') |
| 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> |