Commit 12a3efbb58c6021451ca4ac3ba532962760f2c4f
Exists in
master
conflicst
Showing
4 changed files
Show diff stats
package.json
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | "gulp-pre-commit": "gulp pre-commit", |
| 9 | 9 | "compile": "gulp uglify", |
| 10 | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
| 11 | - "install-dev": "npm install -D angular font-awesome pump jquery bootstrap ui-bootstrap4 jshint gulp gulp-uglify gulp-concat gulp-htmlmin gulp-rename gulp-uglify gulp-jshint gulp-replace gulp-connect gulp-clean gulp-angular-templatecache git+ssh://git@git.focasoftware.com:npm/foca-directivas.git" | |
| 11 | + "install-dev": "npm install -D angular font-awesome pump jquery bootstrap ui-bootstrap4 jshint gulp gulp-uglify gulp-concat gulp-htmlmin gulp-rename gulp-uglify gulp-jshint gulp-replace gulp-connect gulp-clean gulp-angular-templatecache git+http://git.focasoftware.com/npm/foca-directivas.git" | |
| 12 | 12 | }, |
| 13 | 13 | "pre-commit": [ |
| 14 | 14 | "gulp-pre-commit" |
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | "devDependencies": { |
| 23 | 23 | "angular": "^1.7.5", |
| 24 | 24 | "bootstrap": "^4.1.3", |
| 25 | - "foca-directivas": "git+ssh://git@git.focasoftware.com:npm/foca-directivas.git", | |
| 25 | + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | |
| 26 | 26 | "font-awesome": "^4.7.0", |
| 27 | 27 | "gulp": "^3.9.1", |
| 28 | 28 | "gulp-angular-templatecache": "^2.2.5", |
src/js/controller.js
| ... | ... | @@ -8,8 +8,9 @@ angular.module('focaModalDetalleHojaRuta') |
| 8 | 8 | 'focaModalDetalleHojaRutaService', |
| 9 | 9 | 'focaModalService', |
| 10 | 10 | 'focaSeguimientoService', |
| 11 | + '$uibModal', | |
| 11 | 12 | function($filter, $scope, $uibModalInstance, idRemito, focaModalDetalleHojaRutaService, |
| 12 | - focaModalService, focaSeguimientoService) | |
| 13 | + focaModalService, focaSeguimientoService, $uibModal) | |
| 13 | 14 | { |
| 14 | 15 | //Seteo variables |
| 15 | 16 | $scope.remito = {}; |
| ... | ... | @@ -125,7 +126,7 @@ angular.module('focaModalDetalleHojaRuta') |
| 125 | 126 | if(siguienteArticulo.length) { |
| 126 | 127 | $scope.cambio(siguienteArticulo[0]); |
| 127 | 128 | } |
| 128 | - success(); | |
| 129 | + $scope.actualizarPuntoDescarga(); | |
| 129 | 130 | } |
| 130 | 131 | } |
| 131 | 132 | }; |
| ... | ... | @@ -148,6 +149,27 @@ angular.module('focaModalDetalleHojaRuta') |
| 148 | 149 | } |
| 149 | 150 | }; |
| 150 | 151 | |
| 152 | + $scope.actualizarPuntoDescarga = function() { | |
| 153 | + var modalInstance = $uibModal.open( | |
| 154 | + { | |
| 155 | + ariaLabelledBy: 'Actualizar punto de descarga', | |
| 156 | + templateUrl: 'modal-actualizar-punto-descarga.html', | |
| 157 | + controller: 'focaModalActualizarPuntoDescargaController', | |
| 158 | + resolve: { | |
| 159 | + puntosDescarga: function() { | |
| 160 | + return $scope.remito.notaPedido.notaPedidoPuntoDescarga; | |
| 161 | + } | |
| 162 | + }, | |
| 163 | + size: 'lg' | |
| 164 | + } | |
| 165 | + ); | |
| 166 | + modalInstance.result.then(function() { | |
| 167 | + success(); | |
| 168 | + }, function() { | |
| 169 | + success(); | |
| 170 | + }); | |
| 171 | + }; | |
| 172 | + | |
| 151 | 173 | $scope.rechazar = function() { |
| 152 | 174 | focaModalService |
| 153 | 175 | .prompt('Aclare el motivo de rechazo') |
| ... | ... | @@ -163,7 +185,7 @@ angular.module('focaModalDetalleHojaRuta') |
| 163 | 185 | focaModalDetalleHojaRutaService |
| 164 | 186 | .rechazarRemito(remitoRechazado) |
| 165 | 187 | .then(success) |
| 166 | - .catch(error) | |
| 188 | + .catch(error); | |
| 167 | 189 | $scope.readonly = true; |
| 168 | 190 | }); |
| 169 | 191 | }; |
| ... | ... | @@ -178,4 +200,40 @@ angular.module('focaModalDetalleHojaRuta') |
| 178 | 200 | } |
| 179 | 201 | } |
| 180 | 202 | ] |
| 203 | + ) | |
| 204 | + .controller('focaModalActualizarPuntoDescargaController', | |
| 205 | + [ | |
| 206 | + '$scope', | |
| 207 | + '$uibModalInstance', | |
| 208 | + 'focaSeguimientoService', | |
| 209 | + 'focaModalService', | |
| 210 | + 'puntosDescarga', | |
| 211 | + 'focaModalDetalleHojaRutaService', | |
| 212 | + function($scope, $uibModalInstance, focaSeguimientoService, | |
| 213 | + focaModalService, puntosDescarga, focaModalDetalleHojaRutaService) | |
| 214 | + { | |
| 215 | + $scope.puntosDescarga = puntosDescarga; | |
| 216 | + focaSeguimientoService.obtenerPosicion(function(res) { | |
| 217 | + $scope.posicion = res.coords; | |
| 218 | + }); | |
| 219 | + | |
| 220 | + $scope.cancel = function() { | |
| 221 | + $uibModalInstance.dismiss(); | |
| 222 | + }; | |
| 223 | + | |
| 224 | + $scope.select = function(puntoDescarga) { | |
| 225 | + if(!$scope.posicion){ | |
| 226 | + focaModalService.alert('No se pudo obtener la ubicacion'); | |
| 227 | + return; | |
| 228 | + } | |
| 229 | + puntoDescarga.latitud = $scope.posicion.latitude; | |
| 230 | + puntoDescarga.longitud = $scope.posicion.longitude; | |
| 231 | + focaModalDetalleHojaRutaService | |
| 232 | + .updatePuntoDescarga(puntoDescarga) | |
| 233 | + .then(function(res) { | |
| 234 | + $uibModalInstance.close(res.data); | |
| 235 | + }); | |
| 236 | + }; | |
| 237 | + } | |
| 238 | + ] | |
| 181 | 239 | ); |
src/js/service.js
| ... | ... | @@ -18,6 +18,10 @@ angular.module('focaModalDetalleHojaRuta') |
| 18 | 18 | }, |
| 19 | 19 | rechazarRemito: function(remito) { |
| 20 | 20 | return $http.post(API_ENDPOINT.URL + '/remito/update', {remito: remito}); |
| 21 | + }, | |
| 22 | + updatePuntoDescarga: function(puntoDescarga) { | |
| 23 | + return $http.post(API_ENDPOINT.URL + '/punto-descarga', | |
| 24 | + {puntoDescarga: puntoDescarga}); | |
| 21 | 25 | } |
| 22 | 26 | }; |
| 23 | 27 | } |
src/views/modal-actualizar-punto-descarga.html
| ... | ... | @@ -0,0 +1,57 @@ |
| 1 | +<div class="modal-header py-1"> | |
| 2 | + <h5 class="modal-title">Actualizar posición punto de descarga</h5> | |
| 3 | +</div> | |
| 4 | +<div class="modal-body" id="modal-body"> | |
| 5 | + <table | |
| 6 | + class="table table-striped table-sm col-12" | |
| 7 | + ng-hide="ingreso || cargaArticulos"> | |
| 8 | + <thead> | |
| 9 | + <tr> | |
| 10 | + <th>Código</th> | |
| 11 | + <th>Descripción</th> | |
| 12 | + <th>Latitud</th> | |
| 13 | + <th>Longitud</th> | |
| 14 | + <th></th> | |
| 15 | + </tr> | |
| 16 | + </thead> | |
| 17 | + <tbody> | |
| 18 | + <tr ng-show="!puntosDescarga.length"> | |
| 19 | + <td colspan="5"> | |
| 20 | + No se encontraron resultados. | |
| 21 | + </td> | |
| 22 | + </tr> | |
| 23 | + <tr class="selected" | |
| 24 | + ng-repeat="(key, puntoDescarga) in puntosDescarga | filter: filters" | |
| 25 | + > | |
| 26 | + <td | |
| 27 | + ng-bind="puntoDescarga.puntoDescarga.id | rellenarDigitos: 3: 0" | |
| 28 | + ng-click="seleccionarPunto(key)"></td> | |
| 29 | + <td | |
| 30 | + ng-bind="puntoDescarga.puntoDescarga.descripcion" | |
| 31 | + ng-click="seleccionarPunto(key)"></td> | |
| 32 | + <td | |
| 33 | + ng-bind="puntoDescarga.puntoDescarga.latitud" | |
| 34 | + ng-click="seleccionarPunto(key)"></td> | |
| 35 | + <td | |
| 36 | + ng-bind="puntoDescarga.puntoDescarga.longitud" | |
| 37 | + ng-click="seleccionarPunto(key)"></td> | |
| 38 | + <td> | |
| 39 | + <button | |
| 40 | + type="button" | |
| 41 | + class="btn btn-xs btn-primary p-1 float-right mr-5" | |
| 42 | + ng-click="select(puntoDescarga.puntoDescarga)" | |
| 43 | + title="Actualizar"> | |
| 44 | + <i class="fa fa-circle-thin" aria-hidden="true"></i> | |
| 45 | + </button> | |
| 46 | + </td> | |
| 47 | + </tr> | |
| 48 | + </tbody> | |
| 49 | + </table> | |
| 50 | +</div> | |
| 51 | +<div class="modal-footer py-2"> | |
| 52 | + <button | |
| 53 | + class="btn btn-secondary btn-sm" | |
| 54 | + type="button" | |
| 55 | + ng-click="cancel()" | |
| 56 | + >Cancelar</button> | |
| 57 | +</div> |