Commit 105b1865ef0fe78c2920723914ca5c769b5996d1
Exists in
master
Merge branch 'master' into 'develop'
Master(efernandez) See merge request !20
Showing
1 changed file
Show diff stats
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 | 'parametros', | 7 | 'parametros', |
| 8 | 'focaModalDetalleHojaRutaService', | 8 | 'focaModalDetalleHojaRutaService', |
| 9 | 'focaModalService', | 9 | 'focaModalService', |
| 10 | 'focaSeguimientoService', | 10 | 'focaSeguimientoService', |
| 11 | '$uibModal', | 11 | '$uibModal', |
| 12 | function($filter, $scope, $uibModalInstance, parametros, focaModalDetalleHojaRutaService, | 12 | function($filter, $scope, $uibModalInstance, parametros, focaModalDetalleHojaRutaService, |
| 13 | focaModalService, focaSeguimientoService, $uibModal) | 13 | focaModalService, focaSeguimientoService, $uibModal) |
| 14 | { | 14 | { |
| 15 | //Seteo variables | 15 | //Seteo variables |
| 16 | $scope.remito = parametros.remito; | 16 | $scope.remito = parametros.remito; |
| 17 | $scope.cisternas = parametros.remito.cisternas; | 17 | $scope.cisternas = parametros.remito.cisternas; |
| 18 | $scope.articuloSeleccionado = {}; | 18 | $scope.articuloSeleccionado = {}; |
| 19 | $scope.aDescargar = []; | 19 | $scope.aDescargar = []; |
| 20 | $scope.cargando = false; | 20 | $scope.cargando = false; |
| 21 | 21 | ||
| 22 | if ($scope.remito.rechazado) { | 22 | if ($scope.remito.rechazado) { |
| 23 | 23 | ||
| 24 | $scope.readonly = true; | 24 | $scope.readonly = true; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | //Datos | 27 | //Datos |
| 28 | // var promesaRemito = focaModalDetalleHojaRutaService | 28 | // var promesaRemito = focaModalDetalleHojaRutaService |
| 29 | // .getRemitoById(idRemito); | 29 | // .getRemitoById(idRemito); |
| 30 | // var promesaCisternas = focaModalDetalleHojaRutaService | 30 | // var promesaCisternas = focaModalDetalleHojaRutaService |
| 31 | // .getCisternasByIdRemito(idRemito); | 31 | // .getCisternasByIdRemito(idRemito); |
| 32 | 32 | ||
| 33 | // Promise.all([promesaRemito, promesaCisternas]).then(function(res) { | 33 | // Promise.all([promesaRemito, promesaCisternas]).then(function(res) { |
| 34 | // $scope.cargando = false; | 34 | // $scope.cargando = false; |
| 35 | // $scope.remito = res[0].data; | 35 | // $scope.remito = res[0].data; |
| 36 | // $scope.cisternas = res[1].data; | 36 | // $scope.cisternas = res[1].data; |
| 37 | // var articuloAChequear = $scope.remito.articulosRemito.filter( | 37 | // var articuloAChequear = $scope.remito.articulosRemito.filter( |
| 38 | // function(articulo) { | 38 | // function(articulo) { |
| 39 | // return !articulo.descargado; | 39 | // return !articulo.descargado; |
| 40 | // }); | 40 | // }); |
| 41 | // if(!articuloAChequear.length || $scope.remito.rechazado) { | 41 | // if(!articuloAChequear.length || $scope.remito.rechazado) { |
| 42 | // $scope.readonly = true; | 42 | // $scope.readonly = true; |
| 43 | // $scope.cambio($scope.remito.articulosRemito[0]); | 43 | // $scope.cambio($scope.remito.articulosRemito[0]); |
| 44 | // }else { | 44 | // }else { |
| 45 | // $scope.cambio(articuloAChequear[0]); | 45 | // $scope.cambio(articuloAChequear[0]); |
| 46 | // } | 46 | // } |
| 47 | // $scope.$digest(); | 47 | // $scope.$digest(); |
| 48 | // }, function() { | 48 | // }, function() { |
| 49 | // focaModalService.alert('El servicio no responde intente más tarde'); | 49 | // focaModalService.alert('El servicio no responde intente más tarde'); |
| 50 | // $uibModalInstance.dismiss(); | 50 | // $uibModalInstance.dismiss(); |
| 51 | // }); | 51 | // }); |
| 52 | $scope.cambio = function(articulo) { | 52 | $scope.cambio = function(articulo) { |
| 53 | if(!$scope.articuloSeleccionado.descargado) { | 53 | if(!$scope.articuloSeleccionado.descargado) { |
| 54 | $scope.articuloSeleccionado.cantidadDescargada = 0; | 54 | $scope.articuloSeleccionado.cantidadDescargada = 0; |
| 55 | } | 55 | } |
| 56 | $scope.aDescargar = []; | 56 | $scope.aDescargar = []; |
| 57 | $scope.articuloSeleccionado = articulo; | 57 | $scope.articuloSeleccionado = articulo; |
| 58 | }; | 58 | }; |
| 59 | $scope.descargar = function(key) { | 59 | $scope.descargar = function(key) { |
| 60 | if(key === 13) { | 60 | if(key === 13) { |
| 61 | $scope.cargando = true; | 61 | $scope.cargando = true; |
| 62 | var hojaRutaMovimientos = []; | 62 | var hojaRutaMovimientos = []; |
| 63 | var cisternaMovimientos = []; | 63 | var cisternaMovimientos = []; |
| 64 | var cisternaCargas = []; | 64 | var cisternaCargas = []; |
| 65 | var totalADescargar = 0; | 65 | var totalADescargar = 0; |
| 66 | for(var i = 0; i < $scope.aDescargar.length; i++) { | 66 | for(var i = 0; i < $scope.aDescargar.length; i++) { |
| 67 | totalADescargar += $scope.aDescargar[i] || 0; | 67 | totalADescargar += $scope.aDescargar[i] || 0; |
| 68 | } | 68 | } |
| 69 | focaModalService | 69 | focaModalService |
| 70 | .confirm('¿Desea descargar ' + totalADescargar + ' litros de ' + | 70 | .confirm('¿Desea descargar ' + totalADescargar + ' litros de ' + |
| 71 | $scope.articuloSeleccionado.descripcion + '?') | 71 | $scope.articuloSeleccionado.descripcion + '?') |
| 72 | .then(descargar, function() { | 72 | .then(descargar, function() { |
| 73 | $scope.cargando = false; | 73 | $scope.cargando = false; |
| 74 | }); | 74 | }); |
| 75 | } | 75 | } |
| 76 | function descargar() { | 76 | function descargar() { |
| 77 | for(var i = 0; i < $scope.cisternas.length; i++) { | 77 | for(var i = 0; i < $scope.cisternas.length; i++) { |
| 78 | var descarga = $scope.aDescargar[i]; | 78 | var descarga = $scope.aDescargar[i]; |
| 79 | var cisternaCarga = $scope.cisternas[i].cisternaCarga; | 79 | var cisternaCarga = $scope.cisternas[i].cisternaCarga; |
| 80 | if(!descarga) continue; | 80 | if(!descarga) continue; |
| 81 | if(descarga > cisternaCarga.cantidad) { | 81 | if(descarga > cisternaCarga.cantidad) { |
| 82 | focaModalService.alert('La cantidad a descargar no debe ser ' + | 82 | focaModalService.alert('La cantidad a descargar no debe ser ' + |
| 83 | 'mayor a la cantidad de la cisterna'); | 83 | 'mayor a la cantidad de la cisterna'); |
| 84 | $scope.cargando = false; | 84 | $scope.cargando = false; |
| 85 | return; | 85 | return; |
| 86 | } | 86 | } |
| 87 | cisternaCarga.cantidad -= descarga; | 87 | cisternaCarga.cantidad -= descarga; |
| 88 | 88 | ||
| 89 | //Guardar | 89 | //Guardar |
| 90 | var now = new Date(); | 90 | var now = new Date(); |
| 91 | var cisternaMovimiento = { | 91 | var cisternaMovimiento = { |
| 92 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), | 92 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), |
| 93 | cantidad: descarga, | 93 | cantidad: descarga, |
| 94 | metodo: 'descarga', | 94 | metodo: 'descarga', |
| 95 | idCisternaCarga: cisternaCarga.id, | 95 | idCisternaCarga: cisternaCarga.id, |
| 96 | idRemito: $scope.remito.id | 96 | idRemito: $scope.remito.id |
| 97 | }; | 97 | }; |
| 98 | var hojaRutaMovimiento = { | 98 | var hojaRutaMovimiento = { |
| 99 | reciboDescarga: $scope.numeroRecibo, | 99 | reciboDescarga: $scope.numeroRecibo, |
| 100 | idRemito: $scope.remito.id | 100 | idRemito: $scope.remito.id |
| 101 | }; | 101 | }; |
| 102 | delete cisternaCarga.articulo; | 102 | delete cisternaCarga.articulo; |
| 103 | cisternaCargas.push(cisternaCarga); | 103 | cisternaCargas.push(cisternaCarga); |
| 104 | cisternaMovimientos.push(cisternaMovimiento); | 104 | cisternaMovimientos.push(cisternaMovimiento); |
| 105 | hojaRutaMovimientos.push(hojaRutaMovimiento); | 105 | hojaRutaMovimientos.push(hojaRutaMovimiento); |
| 106 | } | 106 | } |
| 107 | var save = { | 107 | var save = { |
| 108 | cisternaCargas: cisternaCargas, | 108 | cisternaCargas: cisternaCargas, |
| 109 | cisternaMovimientos: cisternaMovimientos, | 109 | cisternaMovimientos: cisternaMovimientos, |
| 110 | hojaRutaMovimientos: hojaRutaMovimientos, | 110 | hojaRutaMovimientos: hojaRutaMovimientos, |
| 111 | articulo: $scope.articuloSeleccionado | 111 | articulo: $scope.articuloSeleccionado |
| 112 | }; | 112 | }; |
| 113 | 113 | ||
| 114 | focaSeguimientoService.obtenerPosicion(getPosition) | 114 | focaSeguimientoService.obtenerPosicion(getPosition); |
| 115 | |||
| 116 | var posicion; | ||
| 117 | |||
| 118 | function getPosition(position) { | ||
| 119 | |||
| 120 | posicion = { | ||
| 121 | latitud: position.coords.latitude, | ||
| 122 | longitud: position.coords.longitude, | ||
| 123 | actividad: 'Entrega de producto', | ||
| 124 | observaciones: $scope.remito.observaciones | ||
| 125 | } | ||
| 126 | } | ||
| 127 | 115 | ||
| 128 | $scope.aDescargar = []; | 116 | $scope.aDescargar = []; |
| 129 | $scope.remito.observaciones = ''; | 117 | $scope.remito.observaciones = ''; |
| 130 | 118 | ||
| 131 | if ($scope.articuloSeleccionado.cantidadDescargada === | 119 | if ($scope.articuloSeleccionado.cantidadDescargada === |
| 132 | $scope.articuloSeleccionado.cantidad ) { | 120 | $scope.articuloSeleccionado.cantidad ) { |
| 133 | 121 | ||
| 134 | $scope.articuloSeleccionado.descargado = true; | 122 | $scope.articuloSeleccionado.descargado = true; |
| 135 | } | 123 | } |
| 136 | 124 | ||
| 137 | var siguienteArticulo = $scope.remito.articulosRemito.filter( | 125 | var siguienteArticulo = $scope.remito.articulosRemito.filter( |
| 138 | function(articulo) { | 126 | function(articulo) { |
| 139 | return articulo.id != $scope.articuloSeleccionado.id; | 127 | return articulo.id != $scope.articuloSeleccionado.id; |
| 140 | } | 128 | } |
| 141 | ); | 129 | ); |
| 142 | 130 | ||
| 143 | if (siguienteArticulo.length) { | 131 | if (siguienteArticulo.length) { |
| 144 | $scope.cambio(siguienteArticulo[0]); | 132 | $scope.cambio(siguienteArticulo[0]); |
| 145 | } | 133 | } |
| 146 | 134 | ||
| 135 | success().then(function() { | ||
| 136 | $uibModalInstance.close($scope.remito); | ||
| 137 | }); | ||
| 147 | //TODO: enviar puntos de descarga, se quita para la demo. | 138 | //TODO: enviar puntos de descarga, se quita para la demo. |
| 148 | // $scope.actualizarPuntoDescarga(); | 139 | // $scope.actualizarPuntoDescarga(); |
| 149 | 140 | ||
| 150 | focaModalDetalleHojaRutaService | 141 | function getPosition(position) { |
| 151 | .postMovimientoHojaRuta(save) | 142 | |
| 152 | .then(guardarSeguimiento); | 143 | $scope.posicion = { |
| 144 | latitud: position.coords.latitude, | ||
| 145 | longitud: position.coords.longitude, | ||
| 146 | actividad: 'Entrega de producto', | ||
| 147 | observaciones: $scope.remito.observaciones | ||
| 148 | } | ||
| 149 | |||
| 150 | focaModalDetalleHojaRutaService | ||
| 151 | .postMovimientoHojaRuta(save) | ||
| 152 | .then(guardarSeguimiento); | ||
| 153 | } | ||
| 153 | 154 | ||
| 154 | function guardarSeguimiento(res) { | 155 | function guardarSeguimiento(res) { |
| 155 | 156 | ||
| 156 | posicion.idComprobante = res.data[0].id; | 157 | $scope.posicion.idComprobante = res.data[0].id; |
| 157 | focaModalDetalleHojaRutaService.guardarPosicion({ posicion: posicion }); | 158 | focaModalDetalleHojaRutaService.guardarPosicion({ posicion: $scope.posicion }); |
| 158 | } | 159 | } |
| 159 | } | 160 | } |
| 160 | }; | 161 | }; |
| 161 | 162 | ||
| 162 | $scope.cancel = function() { | 163 | $scope.cancel = function() { |
| 163 | $uibModalInstance.dismiss('cancel'); | 164 | $uibModalInstance.dismiss('cancel'); |
| 164 | }; | 165 | }; |
| 165 | 166 | ||
| 166 | $scope.distribucionDisponible = function() { | 167 | $scope.distribucionDisponible = function() { |
| 167 | return $scope.articuloSeleccionado.cantidadDescargada && | 168 | return $scope.articuloSeleccionado.cantidadDescargada && |
| 168 | $scope.articuloSeleccionado.cantidadDescargada <= | 169 | $scope.articuloSeleccionado.cantidadDescargada <= |
| 169 | $scope.articuloSeleccionado.cantidad; | 170 | $scope.articuloSeleccionado.cantidad; |
| 170 | }; | 171 | }; |
| 171 | 172 | ||
| 172 | $scope.actualizarArticulo = function() { | 173 | $scope.actualizarArticulo = function() { |
| 173 | $scope.articuloSeleccionado.cantidadDescargada = 0; | 174 | $scope.articuloSeleccionado.cantidadDescargada = 0; |
| 174 | for(var i = 0; i < $scope.aDescargar.length; i++) { | 175 | for(var i = 0; i < $scope.aDescargar.length; i++) { |
| 175 | $scope.articuloSeleccionado.cantidadDescargada += | 176 | $scope.articuloSeleccionado.cantidadDescargada += |
| 176 | parseFloat($scope.aDescargar[i]) || 0; | 177 | parseFloat($scope.aDescargar[i]) || 0; |
| 177 | } | 178 | } |
| 178 | }; | 179 | }; |
| 179 | 180 | ||
| 180 | $scope.actualizarPuntoDescarga = function() { | 181 | $scope.actualizarPuntoDescarga = function() { |
| 181 | var modalInstance = $uibModal.open( | 182 | var modalInstance = $uibModal.open( |
| 182 | { | 183 | { |
| 183 | ariaLabelledBy: 'Actualizar punto de descarga', | 184 | ariaLabelledBy: 'Actualizar punto de descarga', |
| 184 | templateUrl: 'modal-actualizar-punto-descarga.html', | 185 | templateUrl: 'modal-actualizar-punto-descarga.html', |
| 185 | controller: 'focaModalActualizarPuntoDescargaController', | 186 | controller: 'focaModalActualizarPuntoDescargaController', |
| 186 | resolve: { | 187 | resolve: { |
| 187 | notaPedido: function() { | 188 | notaPedido: function() { |
| 188 | return $scope.remito.notaPedido; | 189 | return $scope.remito.notaPedido; |
| 189 | } | 190 | } |
| 190 | }, | 191 | }, |
| 191 | size: 'lg' | 192 | size: 'lg' |
| 192 | } | 193 | } |
| 193 | ); | 194 | ); |
| 194 | modalInstance.result.then(function() { | 195 | modalInstance.result.then(function() { |
| 195 | success().then(function() { | 196 | success().then(function() { |
| 196 | $uibModalInstance.close($scope.remito); | 197 | $uibModalInstance.close($scope.remito); |
| 197 | }); | 198 | }); |
| 198 | }, function() { | 199 | }, function() { |
| 199 | success().then(function() { | 200 | success().then(function() { |
| 200 | $uibModalInstance.close($scope.remito); | 201 | $uibModalInstance.close($scope.remito); |
| 201 | }); | 202 | }); |
| 202 | }); | 203 | }); |
| 203 | }; | 204 | }; |
| 204 | 205 | ||
| 205 | $scope.rechazar = function() { | 206 | $scope.rechazar = function() { |
| 206 | focaModalService | 207 | focaModalService |
| 207 | .prompt({ | 208 | .prompt({ |
| 208 | titulo: 'Aclare el motivo de rechazo' | 209 | titulo: 'Aclare el motivo de rechazo' |
| 209 | }) | 210 | }) |
| 210 | .then(function(motivo) { | 211 | .then(function(motivo) { |
| 211 | $scope.cargando = true; | 212 | $scope.cargando = true; |
| 212 | var remitoRechazado = $.extend(true, {}, $scope.remito); | 213 | var remitoRechazado = $.extend(true, {}, $scope.remito); |
| 213 | delete remitoRechazado.articulosRemito; | 214 | delete remitoRechazado.articulosRemito; |
| 214 | delete remitoRechazado.notaPedido; | 215 | delete remitoRechazado.notaPedido; |
| 215 | delete remitoRechazado.cisternas; | 216 | delete remitoRechazado.cisternas; |
| 216 | remitoRechazado.rechazado = true; | 217 | remitoRechazado.rechazado = true; |
| 217 | remitoRechazado.motivoRechazo = motivo; | 218 | remitoRechazado.motivoRechazo = motivo; |
| 218 | remitoRechazado.fechaRemito = | 219 | remitoRechazado.fechaRemito = |
| 219 | remitoRechazado.fechaRemito.slice(0, 19).replace('T', ' '); | 220 | remitoRechazado.fechaRemito.slice(0, 19).replace('T', ' '); |
| 220 | 221 | ||
| 221 | focaModalDetalleHojaRutaService.rechazarRemito(remitoRechazado) | 222 | focaModalDetalleHojaRutaService.rechazarRemito(remitoRechazado) |
| 222 | .then(function(res) { | 223 | .then(function(res) { |
| 223 | focaSeguimientoService.guardarPosicion( | 224 | focaSeguimientoService.guardarPosicion( |
| 224 | 'Entrega de producto', | 225 | 'Entrega de producto', |
| 225 | res.data[1].id, | 226 | res.data[1].id, |
| 226 | motivo); | 227 | motivo); |
| 227 | success(); | 228 | success(); |
| 228 | }) | 229 | }) |
| 229 | .catch(error); | 230 | .catch(error); |
| 230 | $scope.readonly = true; | 231 | $scope.readonly = true; |
| 231 | }); | 232 | }); |
| 232 | }; | 233 | }; |
| 233 | 234 | ||
| 234 | //funciones | 235 | //funciones |
| 235 | function error(error) { | 236 | function error(error) { |
| 236 | focaModalService.alert('Hubo un error ' + error); | 237 | focaModalService.alert('Hubo un error ' + error); |
| 237 | } | 238 | } |
| 238 | function success() { | 239 | function success() { |
| 239 | $scope.cargando = false; | 240 | $scope.cargando = false; |
| 240 | return focaModalService.alert('Operación realizada con éxito'); | 241 | return focaModalService.alert('Operación realizada con éxito'); |
| 241 | } | 242 | } |
| 242 | 243 | ||
| 243 | var articuloAChequear = $scope.remito.articulosRemito.filter( | 244 | var articuloAChequear = $scope.remito.articulosRemito.filter( |
| 244 | function(articulo) { | 245 | function(articulo) { |
| 245 | return !articulo.descargado; | 246 | return !articulo.descargado; |
| 246 | }); | 247 | }); |
| 247 | 248 | ||
| 248 | if (!articuloAChequear.length || $scope.remito.rechazado) { | 249 | if (!articuloAChequear.length || $scope.remito.rechazado) { |
| 249 | $scope.readonly = true; | 250 | $scope.readonly = true; |
| 250 | $scope.cambio($scope.remito.articulosRemito[0]); | 251 | $scope.cambio($scope.remito.articulosRemito[0]); |
| 251 | } else { | 252 | } else { |
| 252 | $scope.cambio(articuloAChequear[0]); | 253 | $scope.cambio(articuloAChequear[0]); |
| 253 | } | 254 | } |
| 254 | 255 | ||
| 255 | } | 256 | } |
| 256 | ]) | 257 | ]) |
| 257 | .controller('focaModalActualizarPuntoDescargaController', | 258 | .controller('focaModalActualizarPuntoDescargaController', |
| 258 | [ | 259 | [ |
| 259 | '$scope', | 260 | '$scope', |
| 260 | '$uibModalInstance', | 261 | '$uibModalInstance', |
| 261 | 'focaSeguimientoService', | 262 | 'focaSeguimientoService', |
| 262 | 'focaModalService', | 263 | 'focaModalService', |
| 263 | 'notaPedido', | 264 | 'notaPedido', |
| 264 | 'focaModalDetalleHojaRutaService', | 265 | 'focaModalDetalleHojaRutaService', |
| 265 | function($scope, $uibModalInstance, focaSeguimientoService, | 266 | function($scope, $uibModalInstance, focaSeguimientoService, |
| 266 | focaModalService, notaPedido, focaModalDetalleHojaRutaService) | 267 | focaModalService, notaPedido, focaModalDetalleHojaRutaService) |
| 267 | { | 268 | { |
| 268 | $scope.notaPedido = notaPedido; | 269 | $scope.notaPedido = notaPedido; |
| 269 | $scope.descripcion = ''; | 270 | $scope.descripcion = ''; |
| 270 | focaSeguimientoService.obtenerPosicion(function(res) { | 271 | focaSeguimientoService.obtenerPosicion(function(res) { |
| 271 | $scope.posicion = res.coords; | 272 | $scope.posicion = res.coords; |
| 272 | }); | 273 | }); |
| 273 | 274 | ||
| 274 | $scope.cancel = function() { | 275 | $scope.cancel = function() { |
| 275 | if ($scope.ingreso) { | 276 | if ($scope.ingreso) { |
| 276 | $scope.ingreso = false; | 277 | $scope.ingreso = false; |
| 277 | } else { | 278 | } else { |
| 278 | $uibModalInstance.dismiss(); | 279 | $uibModalInstance.dismiss(); |
| 279 | } | 280 | } |
| 280 | }; | 281 | }; |
| 281 | 282 | ||
| 282 | $scope.select = function(puntoDescarga) { | 283 | $scope.select = function(puntoDescarga) { |
| 283 | if (!$scope.posicion) { | 284 | if (!$scope.posicion) { |
| 284 | focaModalService.alert('No se pudo obtener la ubicación'); | 285 | focaModalService.alert('No se pudo obtener la ubicación'); |
| 285 | return; | 286 | return; |
| 286 | } | 287 | } |
| 287 | puntoDescarga.latitud = $scope.posicion.latitude; | 288 | puntoDescarga.latitud = $scope.posicion.latitude; |
| 288 | puntoDescarga.longitud = $scope.posicion.longitude; | 289 | puntoDescarga.longitud = $scope.posicion.longitude; |
| 289 | focaModalDetalleHojaRutaService.guardarPuntoDescarga(puntoDescarga); | 290 | focaModalDetalleHojaRutaService.guardarPuntoDescarga(puntoDescarga); |
| 290 | $uibModalInstance.close(); | 291 | $uibModalInstance.close(); |
| 291 | }; | 292 | }; |
| 292 | 293 | ||
| 293 | $scope.guardar = function() { | 294 | $scope.guardar = function() { |
| 294 | if (!$scope.posicion) { | 295 | if (!$scope.posicion) { |
| 295 | focaModalService.alert('No se pudo obtener la ubicación'); | 296 | focaModalService.alert('No se pudo obtener la ubicación'); |
| 296 | return; | 297 | return; |
| 297 | } | 298 | } |
| 298 | focaModalDetalleHojaRutaService | 299 | focaModalDetalleHojaRutaService |
| 299 | .guardarPuntoDescarga({ | 300 | .guardarPuntoDescarga({ |
| 300 | id: 0, | 301 | id: 0, |
| 301 | id_cliente: $scope.notaPedido.idCliente, | 302 | id_cliente: $scope.notaPedido.idCliente, |
| 302 | id_da_config_0: $scope.notaPedido.idDomicilio, | 303 | id_da_config_0: $scope.notaPedido.idDomicilio, |
| 303 | descripcion: $scope.descripcion, | 304 | descripcion: $scope.descripcion, |