Commit bf8877f3f8379f568f43a49b2b91d228215eedc1
1 parent
d58c9381ac
Exists in
master
modal actualizar posicion puntos de descarga
Showing
4 changed files
with
124 additions
and
5 deletions
Show diff stats
package.json
| 1 | { | 1 | { |
| 2 | "name": "foca-modal-detalle-hoja-ruta", | 2 | "name": "foca-modal-detalle-hoja-ruta", |
| 3 | "version": "0.0.2", | 3 | "version": "0.0.2", |
| 4 | "description": "Modal de búsqueda de detalles de hoja de ruta", | 4 | "description": "Modal de búsqueda de detalles de hoja de ruta", |
| 5 | "main": "index.js", | 5 | "main": "index.js", |
| 6 | "scripts": { | 6 | "scripts": { |
| 7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
| 8 | "gulp-pre-commit": "gulp pre-commit", | 8 | "gulp-pre-commit": "gulp pre-commit", |
| 9 | "compile": "gulp uglify", | 9 | "compile": "gulp uglify", |
| 10 | "postinstall": "npm run compile && gulp clean-post-install", | 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 | "pre-commit": [ | 13 | "pre-commit": [ |
| 14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
| 15 | ], | 15 | ], |
| 16 | "repository": { | 16 | "repository": { |
| 17 | "type": "git", | 17 | "type": "git", |
| 18 | "url": "https://debo.suite.repo/modulos-npm/foca-modal-detalle-hoja-ruta.git" | 18 | "url": "https://debo.suite.repo/modulos-npm/foca-modal-detalle-hoja-ruta.git" |
| 19 | }, | 19 | }, |
| 20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
| 21 | "license": "ISC", | 21 | "license": "ISC", |
| 22 | "devDependencies": { | 22 | "devDependencies": { |
| 23 | "angular": "^1.7.5", | 23 | "angular": "^1.7.5", |
| 24 | "bootstrap": "^4.1.3", | 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 | "font-awesome": "^4.7.0", | 26 | "font-awesome": "^4.7.0", |
| 27 | "gulp": "^3.9.1", | 27 | "gulp": "^3.9.1", |
| 28 | "gulp-angular-templatecache": "^2.2.5", | 28 | "gulp-angular-templatecache": "^2.2.5", |
| 29 | "gulp-clean": "^0.4.0", | 29 | "gulp-clean": "^0.4.0", |
| 30 | "gulp-concat": "^2.6.1", | 30 | "gulp-concat": "^2.6.1", |
| 31 | "gulp-connect": "^5.6.1", | 31 | "gulp-connect": "^5.6.1", |
| 32 | "gulp-htmlmin": "^5.0.1", | 32 | "gulp-htmlmin": "^5.0.1", |
| 33 | "gulp-jshint": "^2.1.0", | 33 | "gulp-jshint": "^2.1.0", |
| 34 | "gulp-rename": "^1.4.0", | 34 | "gulp-rename": "^1.4.0", |
| 35 | "gulp-replace": "^1.0.0", | 35 | "gulp-replace": "^1.0.0", |
| 36 | "gulp-uglify": "^3.0.1", | 36 | "gulp-uglify": "^3.0.1", |
| 37 | "jquery": "^3.3.1", | 37 | "jquery": "^3.3.1", |
| 38 | "jshint": "^2.9.6", | 38 | "jshint": "^2.9.6", |
| 39 | "pump": "^3.0.0", | 39 | "pump": "^3.0.0", |
| 40 | "ui-bootstrap4": "^3.0.5" | 40 | "ui-bootstrap4": "^3.0.5" |
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | 43 |
src/js/controller.js
| 1 | angular.module('focaModalDetalleHojaRuta') | 1 | angular.module('focaModalDetalleHojaRuta') |
| 2 | .controller('focaModalDetalleHojaRutaController', | 2 | .controller('focaModalDetalleHojaRutaController', |
| 3 | [ | 3 | [ |
| 4 | '$filter', | 4 | '$filter', |
| 5 | '$scope', | 5 | '$scope', |
| 6 | '$uibModalInstance', | 6 | '$uibModalInstance', |
| 7 | 'idRemito', | 7 | 'idRemito', |
| 8 | 'focaModalDetalleHojaRutaService', | 8 | 'focaModalDetalleHojaRutaService', |
| 9 | 'focaModalService', | 9 | 'focaModalService', |
| 10 | 'focaSeguimientoService', | 10 | 'focaSeguimientoService', |
| 11 | '$uibModal', | ||
| 11 | function($filter, $scope, $uibModalInstance, idRemito, focaModalDetalleHojaRutaService, | 12 | function($filter, $scope, $uibModalInstance, idRemito, focaModalDetalleHojaRutaService, |
| 12 | focaModalService, focaSeguimientoService) | 13 | focaModalService, focaSeguimientoService, $uibModal) |
| 13 | { | 14 | { |
| 14 | //Seteo variables | 15 | //Seteo variables |
| 15 | $scope.remito = {}; | 16 | $scope.remito = {}; |
| 16 | $scope.cisternas = []; | 17 | $scope.cisternas = []; |
| 17 | $scope.articuloSeleccionado = {}; | 18 | $scope.articuloSeleccionado = {}; |
| 18 | $scope.aDescargar = []; | 19 | $scope.aDescargar = []; |
| 19 | $scope.cargando = true; | 20 | $scope.cargando = true; |
| 20 | 21 | ||
| 21 | //Datos | 22 | //Datos |
| 22 | var promesaRemito = focaModalDetalleHojaRutaService | 23 | var promesaRemito = focaModalDetalleHojaRutaService |
| 23 | .getRemitoById(idRemito); | 24 | .getRemitoById(idRemito); |
| 24 | var promesaCisternas = focaModalDetalleHojaRutaService | 25 | var promesaCisternas = focaModalDetalleHojaRutaService |
| 25 | .getCisternasByIdRemito(idRemito); | 26 | .getCisternasByIdRemito(idRemito); |
| 26 | 27 | ||
| 27 | Promise.all([promesaRemito, promesaCisternas]).then(function(res) { | 28 | Promise.all([promesaRemito, promesaCisternas]).then(function(res) { |
| 28 | $scope.cargando = false; | 29 | $scope.cargando = false; |
| 29 | $scope.remito = res[0].data; | 30 | $scope.remito = res[0].data; |
| 30 | $scope.cisternas = res[1].data; | 31 | $scope.cisternas = res[1].data; |
| 31 | var articuloAChequear = $scope.remito.articulosRemito.filter( | 32 | var articuloAChequear = $scope.remito.articulosRemito.filter( |
| 32 | function(articulo) { | 33 | function(articulo) { |
| 33 | return !articulo.descargado; | 34 | return !articulo.descargado; |
| 34 | }); | 35 | }); |
| 35 | if(!articuloAChequear.length || $scope.remito.rechazado) { | 36 | if(!articuloAChequear.length || $scope.remito.rechazado) { |
| 36 | $scope.readonly = true; | 37 | $scope.readonly = true; |
| 37 | $scope.cambio($scope.remito.articulosRemito[0]); | 38 | $scope.cambio($scope.remito.articulosRemito[0]); |
| 38 | }else { | 39 | }else { |
| 39 | $scope.cambio(articuloAChequear[0]); | 40 | $scope.cambio(articuloAChequear[0]); |
| 40 | } | 41 | } |
| 41 | $scope.$digest(); | 42 | $scope.$digest(); |
| 42 | }, function() { | 43 | }, function() { |
| 43 | focaModalService.alert('El servicio no responde intente más tarde'); | 44 | focaModalService.alert('El servicio no responde intente más tarde'); |
| 44 | $uibModalInstance.dismiss(); | 45 | $uibModalInstance.dismiss(); |
| 45 | }); | 46 | }); |
| 46 | $scope.cambio = function(articulo) { | 47 | $scope.cambio = function(articulo) { |
| 47 | if(!$scope.articuloSeleccionado.descargado) { | 48 | if(!$scope.articuloSeleccionado.descargado) { |
| 48 | $scope.articuloSeleccionado.cantidadDescargada = 0; | 49 | $scope.articuloSeleccionado.cantidadDescargada = 0; |
| 49 | } | 50 | } |
| 50 | $scope.aDescargar = []; | 51 | $scope.aDescargar = []; |
| 51 | $scope.articuloSeleccionado = articulo; | 52 | $scope.articuloSeleccionado = articulo; |
| 52 | }; | 53 | }; |
| 53 | $scope.descargar = function(key) { | 54 | $scope.descargar = function(key) { |
| 54 | if(key === 13) { | 55 | if(key === 13) { |
| 55 | $scope.cargando = true; | 56 | $scope.cargando = true; |
| 56 | var hojaRutaMovimientos = []; | 57 | var hojaRutaMovimientos = []; |
| 57 | var cisternaMovimientos = []; | 58 | var cisternaMovimientos = []; |
| 58 | var cisternaCargas = []; | 59 | var cisternaCargas = []; |
| 59 | var totalADescargar = 0; | 60 | var totalADescargar = 0; |
| 60 | for(var i = 0; i < $scope.aDescargar.length; i++) { | 61 | for(var i = 0; i < $scope.aDescargar.length; i++) { |
| 61 | totalADescargar += $scope.aDescargar[i] || 0; | 62 | totalADescargar += $scope.aDescargar[i] || 0; |
| 62 | } | 63 | } |
| 63 | focaModalService | 64 | focaModalService |
| 64 | .confirm('¿Desea descargar ' + totalADescargar + ' litros de ' + | 65 | .confirm('¿Desea descargar ' + totalADescargar + ' litros de ' + |
| 65 | $scope.articuloSeleccionado.descripcion + '?') | 66 | $scope.articuloSeleccionado.descripcion + '?') |
| 66 | .then(descargar, function() { | 67 | .then(descargar, function() { |
| 67 | $scope.cargando = false; | 68 | $scope.cargando = false; |
| 68 | }); | 69 | }); |
| 69 | } | 70 | } |
| 70 | function descargar() { | 71 | function descargar() { |
| 71 | for(var i = 0; i < $scope.cisternas.length; i++) { | 72 | for(var i = 0; i < $scope.cisternas.length; i++) { |
| 72 | var descarga = $scope.aDescargar[i]; | 73 | var descarga = $scope.aDescargar[i]; |
| 73 | var cisternaCarga = $scope.cisternas[i].cisternaCarga; | 74 | var cisternaCarga = $scope.cisternas[i].cisternaCarga; |
| 74 | if(!descarga) continue; | 75 | if(!descarga) continue; |
| 75 | if(descarga > cisternaCarga.cantidad) { | 76 | if(descarga > cisternaCarga.cantidad) { |
| 76 | focaModalService.alert('La cantidad a descargar no debe ser ' + | 77 | focaModalService.alert('La cantidad a descargar no debe ser ' + |
| 77 | 'mayor a la cantidad de la cisterna'); | 78 | 'mayor a la cantidad de la cisterna'); |
| 78 | $scope.cargando = false; | 79 | $scope.cargando = false; |
| 79 | return; | 80 | return; |
| 80 | } | 81 | } |
| 81 | cisternaCarga.cantidad -= descarga; | 82 | cisternaCarga.cantidad -= descarga; |
| 82 | 83 | ||
| 83 | //Guardar | 84 | //Guardar |
| 84 | var now = new Date(); | 85 | var now = new Date(); |
| 85 | var cisternaMovimiento = { | 86 | var cisternaMovimiento = { |
| 86 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), | 87 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), |
| 87 | cantidad: descarga, | 88 | cantidad: descarga, |
| 88 | metodo: 'descarga', | 89 | metodo: 'descarga', |
| 89 | idCisternaCarga: cisternaCarga.id, | 90 | idCisternaCarga: cisternaCarga.id, |
| 90 | idRemito: $scope.remito.id | 91 | idRemito: $scope.remito.id |
| 91 | }; | 92 | }; |
| 92 | var hojaRutaMovimiento = { | 93 | var hojaRutaMovimiento = { |
| 93 | reciboDescarga: $scope.numeroRecibo, | 94 | reciboDescarga: $scope.numeroRecibo, |
| 94 | idRemito: $scope.remito.id | 95 | idRemito: $scope.remito.id |
| 95 | }; | 96 | }; |
| 96 | delete cisternaCarga.articulo; | 97 | delete cisternaCarga.articulo; |
| 97 | cisternaCargas.push(cisternaCarga); | 98 | cisternaCargas.push(cisternaCarga); |
| 98 | cisternaMovimientos.push(cisternaMovimiento); | 99 | cisternaMovimientos.push(cisternaMovimiento); |
| 99 | hojaRutaMovimientos.push(hojaRutaMovimiento); | 100 | hojaRutaMovimientos.push(hojaRutaMovimiento); |
| 100 | } | 101 | } |
| 101 | var save = { | 102 | var save = { |
| 102 | cisternaCargas: cisternaCargas, | 103 | cisternaCargas: cisternaCargas, |
| 103 | cisternaMovimientos: cisternaMovimientos, | 104 | cisternaMovimientos: cisternaMovimientos, |
| 104 | hojaRutaMovimientos: hojaRutaMovimientos, | 105 | hojaRutaMovimientos: hojaRutaMovimientos, |
| 105 | articulo: $scope.articuloSeleccionado | 106 | articulo: $scope.articuloSeleccionado |
| 106 | }; | 107 | }; |
| 107 | focaModalDetalleHojaRutaService | 108 | focaModalDetalleHojaRutaService |
| 108 | .postMovimientoHojaRuta(save) | 109 | .postMovimientoHojaRuta(save) |
| 109 | .then(guardarSeguimiento) | 110 | .then(guardarSeguimiento) |
| 110 | .catch(error); | 111 | .catch(error); |
| 111 | function guardarSeguimiento(res) { | 112 | function guardarSeguimiento(res) { |
| 112 | focaSeguimientoService | 113 | focaSeguimientoService |
| 113 | .guardarPosicion( | 114 | .guardarPosicion( |
| 114 | 'Entrega de producto', | 115 | 'Entrega de producto', |
| 115 | res.data[0].id, | 116 | res.data[0].id, |
| 116 | $scope.remito.observaciones); | 117 | $scope.remito.observaciones); |
| 117 | $scope.aDescargar = []; | 118 | $scope.aDescargar = []; |
| 118 | $scope.remito.observaciones = ''; | 119 | $scope.remito.observaciones = ''; |
| 119 | $scope.articuloSeleccionado.descargado = true; | 120 | $scope.articuloSeleccionado.descargado = true; |
| 120 | var siguienteArticulo = $scope.remito.articulosRemito.filter( | 121 | var siguienteArticulo = $scope.remito.articulosRemito.filter( |
| 121 | function(articulo) { | 122 | function(articulo) { |
| 122 | return articulo.id != $scope.articuloSeleccionado.id; | 123 | return articulo.id != $scope.articuloSeleccionado.id; |
| 123 | } | 124 | } |
| 124 | ); | 125 | ); |
| 125 | if(siguienteArticulo.length) { | 126 | if(siguienteArticulo.length) { |
| 126 | $scope.cambio(siguienteArticulo[0]); | 127 | $scope.cambio(siguienteArticulo[0]); |
| 127 | } | 128 | } |
| 128 | success(); | 129 | $scope.actualizarPuntoDescarga(); |
| 129 | } | 130 | } |
| 130 | } | 131 | } |
| 131 | }; | 132 | }; |
| 132 | 133 | ||
| 133 | $scope.cancel = function() { | 134 | $scope.cancel = function() { |
| 134 | $uibModalInstance.dismiss('cancel'); | 135 | $uibModalInstance.dismiss('cancel'); |
| 135 | }; | 136 | }; |
| 136 | 137 | ||
| 137 | $scope.distribucionDisponible = function() { | 138 | $scope.distribucionDisponible = function() { |
| 138 | return $scope.articuloSeleccionado.cantidadDescargada && | 139 | return $scope.articuloSeleccionado.cantidadDescargada && |
| 139 | $scope.articuloSeleccionado.cantidadDescargada <= | 140 | $scope.articuloSeleccionado.cantidadDescargada <= |
| 140 | $scope.articuloSeleccionado.cantidad; | 141 | $scope.articuloSeleccionado.cantidad; |
| 141 | }; | 142 | }; |
| 142 | 143 | ||
| 143 | $scope.actualizarArticulo = function() { | 144 | $scope.actualizarArticulo = function() { |
| 144 | $scope.articuloSeleccionado.cantidadDescargada = 0; | 145 | $scope.articuloSeleccionado.cantidadDescargada = 0; |
| 145 | for(var i = 0; i < $scope.aDescargar.length; i++) { | 146 | for(var i = 0; i < $scope.aDescargar.length; i++) { |
| 146 | $scope.articuloSeleccionado.cantidadDescargada += | 147 | $scope.articuloSeleccionado.cantidadDescargada += |
| 147 | parseFloat($scope.aDescargar[i]) || 0; | 148 | parseFloat($scope.aDescargar[i]) || 0; |
| 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 | $scope.rechazar = function() { | 173 | $scope.rechazar = function() { |
| 152 | focaModalService | 174 | focaModalService |
| 153 | .prompt('Aclare el motivo de rechazo') | 175 | .prompt('Aclare el motivo de rechazo') |
| 154 | .then(function(motivo) { | 176 | .then(function(motivo) { |
| 155 | $scope.cargando = true; | 177 | $scope.cargando = true; |
| 156 | var remitoRechazado = $.extend(true, {}, $scope.remito); | 178 | var remitoRechazado = $.extend(true, {}, $scope.remito); |
| 157 | delete remitoRechazado.articulosRemito; | 179 | delete remitoRechazado.articulosRemito; |
| 158 | delete remitoRechazado.notaPedido; | 180 | delete remitoRechazado.notaPedido; |
| 159 | remitoRechazado.rechazado = true; | 181 | remitoRechazado.rechazado = true; |
| 160 | remitoRechazado.motivoRechazo = motivo; | 182 | remitoRechazado.motivoRechazo = motivo; |
| 161 | remitoRechazado.fechaRemito = | 183 | remitoRechazado.fechaRemito = |
| 162 | remitoRechazado.fechaRemito.slice(0, 19).replace('T', ' '); | 184 | remitoRechazado.fechaRemito.slice(0, 19).replace('T', ' '); |
| 163 | focaModalDetalleHojaRutaService | 185 | focaModalDetalleHojaRutaService |
| 164 | .rechazarRemito(remitoRechazado) | 186 | .rechazarRemito(remitoRechazado) |
| 165 | .then(success) | 187 | .then(success) |
| 166 | .catch(error) | 188 | .catch(error); |
| 167 | $scope.readonly = true; | 189 | $scope.readonly = true; |
| 168 | }); | 190 | }); |
| 169 | }; | 191 | }; |
| 170 | 192 | ||
| 171 | //funciones | 193 | //funciones |
| 172 | function error(error) { | 194 | function error(error) { |
| 173 | focaModalService.alert('Hubo un error ' + error); | 195 | focaModalService.alert('Hubo un error ' + error); |
| 174 | } | 196 | } |
| 175 | function success() { | 197 | function success() { |
| 176 | focaModalService.alert('Operación realizada con éxito'); | 198 | focaModalService.alert('Operación realizada con éxito'); |
| 177 | $scope.cargando = false; | 199 | $scope.cargando = false; |
| 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 | ); |
| 182 | 240 |
src/js/service.js
| 1 | angular.module('focaModalDetalleHojaRuta') | 1 | angular.module('focaModalDetalleHojaRuta') |
| 2 | .service('focaModalDetalleHojaRutaService', [ | 2 | .service('focaModalDetalleHojaRutaService', [ |
| 3 | '$http', | 3 | '$http', |
| 4 | 'API_ENDPOINT', | 4 | 'API_ENDPOINT', |
| 5 | function($http, API_ENDPOINT) { | 5 | function($http, API_ENDPOINT) { |
| 6 | return { | 6 | return { |
| 7 | getDetallesHojaRuta: function() { | 7 | getDetallesHojaRuta: function() { |
| 8 | return $http.get(API_ENDPOINT.URL + '/transportista'); | 8 | return $http.get(API_ENDPOINT.URL + '/transportista'); |
| 9 | }, | 9 | }, |
| 10 | getCisternasByIdRemito: function(idRemito) { | 10 | getCisternasByIdRemito: function(idRemito) { |
| 11 | return $http.get(API_ENDPOINT.URL + '/cisternas/obtener/remito/' + idRemito); | 11 | return $http.get(API_ENDPOINT.URL + '/cisternas/obtener/remito/' + idRemito); |
| 12 | }, | 12 | }, |
| 13 | getRemitoById: function(idRemito) { | 13 | getRemitoById: function(idRemito) { |
| 14 | return $http.get(API_ENDPOINT.URL + '/remito/obtener/' + idRemito + '/punto'); | 14 | return $http.get(API_ENDPOINT.URL + '/remito/obtener/' + idRemito + '/punto'); |
| 15 | }, | 15 | }, |
| 16 | postMovimientoHojaRuta: function(datos) { | 16 | postMovimientoHojaRuta: function(datos) { |
| 17 | return $http.post(API_ENDPOINT.URL + '/hoja-ruta/movimiento', datos); | 17 | return $http.post(API_ENDPOINT.URL + '/hoja-ruta/movimiento', datos); |
| 18 | }, | 18 | }, |
| 19 | rechazarRemito: function(remito) { | 19 | rechazarRemito: function(remito) { |
| 20 | return $http.post(API_ENDPOINT.URL + '/remito/update', {remito: remito}); | 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 | } |
| 24 | ]); | 28 | ]); |
| 25 | 29 |
src/views/modal-actualizar-punto-descarga.html
| File was created | 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> | ||
| 58 |