Commit af23c9133666b4a1f52b8ea6ebaffed37dd4e8e5
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !21
Showing
6 changed files
Show diff stats
src/js/controller.js
| 1 | angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaController', [ | 1 | angular.module('focaLogisticaPedidoRuta') .controller('focaLogisticaPedidoRutaController', [ |
| 2 | '$scope', 'focaLogisticaPedidoRutaService', '$location', '$uibModal', '$filter', | 2 | '$scope', 'focaLogisticaPedidoRutaService', '$location', '$uibModal', '$filter', |
| 3 | 'focaModalService', 'focaBotoneraLateralService', '$interval', | 3 | 'focaModalService', 'focaBotoneraLateralService', '$interval', |
| 4 | function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter, | 4 | function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter, |
| 5 | focaModalService, focaBotoneraLateralService, $interval | 5 | focaModalService, focaBotoneraLateralService, $interval |
| 6 | ) { | 6 | ) { |
| 7 | $scope.actividad = 'Logistica'; | 7 | $scope.actividad = 'Logistica'; |
| 8 | 8 | ||
| 9 | //Datos Pantalla | 9 | //Datos Pantalla |
| 10 | $scope.titulo = 'Logistica de Pedidos'; | 10 | $scope.titulo = 'Logistica de Pedidos'; |
| 11 | var transportista = { | 11 | var transportista = { |
| 12 | label: 'Unidad', | 12 | label: 'Unidad', |
| 13 | image: 'abmChofer.png' | 13 | image: 'abmChofer.png' |
| 14 | }; | 14 | }; |
| 15 | var fecha = { | 15 | var fecha = { |
| 16 | label: 'Fecha Reparto', | 16 | label: 'Fecha Reparto', |
| 17 | image: 'abmChofer.png' | 17 | image: 'fechaDeReparto.png' |
| 18 | }; | 18 | }; |
| 19 | $scope.botonera = [fecha, transportista]; | 19 | $scope.botonera = [fecha, transportista]; |
| 20 | var cabecera = ''; | 20 | var cabecera = ''; |
| 21 | $scope.now = new Date(); | 21 | $scope.now = new Date(); |
| 22 | $scope.idVendedor = 0; | 22 | $scope.idVendedor = 0; |
| 23 | $scope.marcadores = []; | 23 | $scope.marcadores = []; |
| 24 | $scope.vehiculos = []; | 24 | $scope.vehiculos = []; |
| 25 | getSeguimiento(); | 25 | getSeguimiento(); |
| 26 | $scope.arrastrando = false; | 26 | $scope.arrastrando = false; |
| 27 | $scope.general = function() { | 27 | $scope.general = function() { |
| 28 | $scope.idVendedor = 0; | 28 | $scope.idVendedor = 0; |
| 29 | getSeguimiento(); | 29 | getSeguimiento(); |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | //SETEO BOTONERA LATERAL | 32 | //SETEO BOTONERA LATERAL |
| 33 | focaBotoneraLateralService.showSalir(true); | 33 | focaBotoneraLateralService.showSalir(true); |
| 34 | focaBotoneraLateralService.showPausar(false); | 34 | focaBotoneraLateralService.showPausar(false); |
| 35 | focaBotoneraLateralService.showGuardar(false); | 35 | focaBotoneraLateralService.showGuardar(false); |
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | $scope.general = function() { | 39 | $scope.general = function() { |
| 40 | $scope.idVendedor = 0; | 40 | $scope.idVendedor = 0; |
| 41 | getSeguimiento(); | 41 | getSeguimiento(); |
| 42 | $scope.$broadcast('removeCabecera', cabecera); | 42 | $scope.$broadcast('removeCabecera', cabecera); |
| 43 | $scope.$broadcast('addCabecera',{ | 43 | $scope.$broadcast('addCabecera',{ |
| 44 | label: 'General', | 44 | label: 'General', |
| 45 | valor: '' | 45 | valor: '' |
| 46 | }); | 46 | }); |
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | $scope.cargar = function(idVehiculo, punto) { | 49 | $scope.cargar = function(idVehiculo, punto) { |
| 50 | if(!$scope.fechaReparto) { | 50 | if(!$scope.fechaReparto) { |
| 51 | focaModalService.alert('Primero seleccione fecha de reparto'); | 51 | focaModalService.alert('Primero seleccione fecha de reparto'); |
| 52 | return; | 52 | return; |
| 53 | } | 53 | } |
| 54 | var idRemito; | 54 | var idRemito; |
| 55 | if(punto === -1) { | 55 | if(punto === -1) { |
| 56 | idRemito = -1; | 56 | idRemito = -1; |
| 57 | }else { | 57 | }else { |
| 58 | idRemito = JSON.parse(punto).notaPedido.remito.id; | 58 | idRemito = JSON.parse(punto).notaPedido.remito.id; |
| 59 | } | 59 | } |
| 60 | var modalInstance = $uibModal.open( | 60 | var modalInstance = $uibModal.open( |
| 61 | { | 61 | { |
| 62 | ariaLabelledBy: 'Busqueda de Vehiculo', | 62 | ariaLabelledBy: 'Busqueda de Vehiculo', |
| 63 | templateUrl: 'foca-detalle-vehiculo.html', | 63 | templateUrl: 'foca-detalle-vehiculo.html', |
| 64 | controller: 'focaDetalleVehiculo', | 64 | controller: 'focaDetalleVehiculo', |
| 65 | size: 'lg', | 65 | size: 'lg', |
| 66 | resolve: { | 66 | resolve: { |
| 67 | idVehiculo: function() {return idVehiculo;}, | 67 | idVehiculo: function() {return idVehiculo;}, |
| 68 | idRemito: function() {return idRemito;}, | 68 | idRemito: function() {return idRemito;}, |
| 69 | fechaReparto: function() {return $scope.fechaReparto;} | 69 | fechaReparto: function() {return $scope.fechaReparto;} |
| 70 | } | 70 | } |
| 71 | } | 71 | } |
| 72 | ); | 72 | ); |
| 73 | modalInstance.result.then(function() { | 73 | modalInstance.result.then(function() { |
| 74 | }, function() { | 74 | }, function() { |
| 75 | }); | 75 | }); |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | $scope.quitarVehiculo = function(vehiculo) { | 78 | $scope.quitarVehiculo = function(vehiculo) { |
| 79 | //TODO: Pasar validación a función | ||
| 80 | $scope.fechaReparto.setHours(0, 0, 0, 0); | ||
| 81 | var idUsuario = focaLogisticaPedidoRutaService.idUsuario; | ||
| 82 | for(var i = 0; i < vehiculo.cisternas.length; i++) { | ||
| 83 | for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { | ||
| 84 | var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; | ||
| 85 | if(cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto | ||
| 86 | .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso !== | ||
| 87 | idUsuario) | ||
| 88 | { | ||
| 89 | focaModalService.alert('El vehículo está siendo usado por otro usuario'); | ||
| 90 | return; | ||
| 91 | } | ||
| 92 | } | ||
| 93 | } | ||
| 79 | focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + | 94 | focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + |
| 80 | vehiculo.codigo + '?').then(function() { | 95 | vehiculo.codigo + '?').then(function() { |
| 81 | eliminarVehiculo(vehiculo); | 96 | eliminarVehiculo(vehiculo); |
| 82 | }); | 97 | }); |
| 83 | }; | 98 | }; |
| 84 | 99 | ||
| 85 | $scope.hacerHojaRuta = function(vehiculo) { | 100 | $scope.hacerHojaRuta = function(vehiculo) { |
| 86 | if(!$scope.fechaReparto) { | 101 | if(!$scope.fechaReparto) { |
| 87 | focaModalService.alert('Primero seleccione fecha de reparto'); | 102 | focaModalService.alert('Primero seleccione fecha de reparto'); |
| 88 | return; | 103 | return; |
| 89 | } | 104 | } |
| 105 | //TODO: Pasar validación a función | ||
| 106 | $scope.fechaReparto.setHours(0, 0, 0, 0); | ||
| 107 | var idUsuario = focaLogisticaPedidoRutaService.idUsuario; | ||
| 108 | for(var i = 0; i < vehiculo.cisternas.length; i++) { | ||
| 109 | for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { | ||
| 110 | var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; | ||
| 111 | if(cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto | ||
| 112 | .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso !== | ||
| 113 | idUsuario) | ||
| 114 | { | ||
| 115 | focaModalService.alert('El vehículo está siendo usado por otro usuario'); | ||
| 116 | return; | ||
| 117 | } | ||
| 118 | } | ||
| 119 | } | ||
| 90 | var modalInstance = $uibModal.open( | 120 | var modalInstance = $uibModal.open( |
| 91 | { | 121 | { |
| 92 | ariaLabelledBy: 'Creación hoja ruta', | 122 | ariaLabelledBy: 'Creación hoja ruta', |
| 93 | templateUrl: 'foca-modal-cerrar-vehiculo.html', | 123 | templateUrl: 'foca-modal-cerrar-vehiculo.html', |
| 94 | controller: 'focaModalCerrarVehiculo', | 124 | controller: 'focaModalCerrarVehiculo', |
| 95 | size: 'lg', | 125 | size: 'lg', |
| 96 | resolve: { | 126 | resolve: { |
| 97 | idVehiculo: function() {return vehiculo.id;} | 127 | idVehiculo: function() {return vehiculo.id;} |
| 98 | } | 128 | } |
| 99 | } | 129 | } |
| 100 | ); | 130 | ); |
| 101 | modalInstance.result.then(function() { | 131 | modalInstance.result.then(function() { |
| 102 | 132 | ||
| 103 | }, function() { | 133 | }, function() { |
| 104 | //usar cuando se cancela el modal | 134 | //usar cuando se cancela el modal |
| 105 | }); | 135 | }); |
| 106 | }; | 136 | }; |
| 107 | 137 | ||
| 108 | $scope.arrastra = function() { | 138 | $scope.arrastra = function() { |
| 109 | $scope.arrastrando = true; | 139 | $scope.arrastrando = true; |
| 110 | $scope.$digest(); | 140 | $scope.$digest(); |
| 111 | }; | 141 | }; |
| 112 | 142 | ||
| 113 | $scope.noArrastra = function() { | 143 | $scope.noArrastra = function() { |
| 114 | $scope.arrastrando = false; | 144 | $scope.arrastrando = false; |
| 115 | $scope.$digest(); | 145 | $scope.$digest(); |
| 116 | }; | 146 | }; |
| 117 | 147 | ||
| 118 | $scope.individual = function() { | 148 | $scope.individual = function() { |
| 119 | $scope.idVendedor = -1; | 149 | $scope.idVendedor = -1; |
| 120 | }; | 150 | }; |
| 121 | 151 | ||
| 122 | $scope.mostrarDetalle = function() { | 152 | $scope.mostrarDetalle = function() { |
| 123 | $scope.detalle = true; | 153 | $scope.detalle = true; |
| 124 | }; | 154 | }; |
| 125 | 155 | ||
| 126 | $scope.salir = function() { | 156 | $scope.salir = function() { |
| 127 | $location.path('/'); | 157 | $location.path('/'); |
| 128 | }; | 158 | }; |
| 129 | 159 | ||
| 130 | $scope.search = function() { | 160 | $scope.search = function() { |
| 131 | getSeguimiento(); | 161 | getSeguimiento(); |
| 132 | }; | 162 | }; |
| 133 | 163 | ||
| 134 | $scope.fecha = function() { | 164 | $scope.fecha = function() { |
| 135 | getSeguimiento(); | 165 | getSeguimiento(); |
| 136 | }; | 166 | }; |
| 137 | 167 | ||
| 138 | $scope.seleccionarUnidad = function() { | 168 | $scope.seleccionarUnidad = function() { |
| 139 | var modalInstance = $uibModal.open( | 169 | var modalInstance = $uibModal.open( |
| 140 | { | 170 | { |
| 141 | ariaLabelledBy: 'Busqueda de Transportista', | 171 | ariaLabelledBy: 'Busqueda de Transportista', |
| 142 | templateUrl: 'modal-proveedor.html', | 172 | templateUrl: 'modal-proveedor.html', |
| 143 | controller: 'focaModalProveedorCtrl', | 173 | controller: 'focaModalProveedorCtrl', |
| 144 | size: 'lg', | 174 | size: 'lg', |
| 145 | resolve: { | 175 | resolve: { |
| 146 | transportista: function() { | 176 | transportista: function() { |
| 147 | return true; | 177 | return true; |
| 148 | } | 178 | } |
| 149 | } | 179 | } |
| 150 | } | 180 | } |
| 151 | ); | 181 | ); |
| 152 | modalInstance.result.then(function(transportista) { | 182 | modalInstance.result.then(function(transportista) { |
| 153 | $scope.seleccionarVehiculo(transportista.COD); | 183 | $scope.seleccionarVehiculo(transportista.COD); |
| 154 | }); | 184 | }); |
| 155 | }; | 185 | }; |
| 156 | 186 | ||
| 157 | $scope.seleccionarVehiculo = function(idTransportista) { | 187 | $scope.seleccionarVehiculo = function(idTransportista) { |
| 158 | var query = '/vehiculo/transportista/' + idTransportista; | 188 | var query = '/vehiculo/transportista/' + idTransportista; |
| 159 | var columnas = { | 189 | var columnas = { |
| 160 | nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], | 190 | nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], |
| 161 | propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] | 191 | propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] |
| 162 | }; | 192 | }; |
| 163 | var titulo = 'Búsqueda de vehiculos'; | 193 | var titulo = 'Búsqueda de vehiculos'; |
| 164 | focaModalService.modal(columnas, query, titulo).then( | 194 | focaModalService.modal(columnas, query, titulo).then( |
| 165 | function(vehiculo) { | 195 | function(vehiculo) { |
| 166 | var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); | 196 | var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); |
| 167 | if(existe.length) { | 197 | if(existe.length) { |
| 168 | focaModalService.alert('El vehiculo ya ha sido cargado'); | 198 | focaModalService.alert('El vehiculo ya ha sido cargado'); |
| 169 | return; | 199 | return; |
| 170 | } | 200 | } |
| 171 | if(!vehiculo.cisternas.length) { | 201 | if(!vehiculo.cisternas.length) { |
| 172 | focaModalService.alert('El vehiculo no tiene cisternas'); | 202 | focaModalService.alert('El vehiculo no tiene cisternas'); |
| 173 | return; | 203 | return; |
| 174 | } | 204 | } |
| 175 | $scope.vehiculos.push(vehiculo); | 205 | $scope.vehiculos.push(vehiculo); |
| 176 | }, function() { | 206 | }, function() { |
| 177 | // funcion ejecutada cuando se cancela el modal | 207 | // funcion ejecutada cuando se cancela el modal |
| 178 | }); | 208 | }); |
| 179 | }; | 209 | }; |
| 180 | 210 | ||
| 181 | $scope.seleccionarFechaReparto = function() { | 211 | $scope.seleccionarFechaReparto = function() { |
| 182 | focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { | 212 | focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { |
| 183 | $scope.$broadcast('addCabecera',{ | 213 | $scope.$broadcast('addCabecera',{ |
| 184 | label: 'Fecha:', | 214 | label: 'Fecha:', |
| 185 | valor: fecha.toLocaleDateString() | 215 | valor: fecha.toLocaleDateString() |
| 186 | }); | 216 | }); |
| 187 | $scope.fechaReparto = fecha; | 217 | $scope.fechaReparto = fecha; |
| 188 | focaLogisticaPedidoRutaService.setFechaReparto(fecha); | 218 | focaLogisticaPedidoRutaService.setFechaReparto(fecha); |
| 189 | focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) { | 219 | focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) { |
| 190 | $scope.vehiculos = res.data; | 220 | $scope.vehiculos = res.data; |
| 191 | }); | 221 | }); |
| 192 | }); | 222 | }); |
| 193 | }; | 223 | }; |
| 194 | 224 | ||
| 195 | function getSeguimiento() { | 225 | function getSeguimiento() { |
| 196 | var desde = new Date('1900/01/01'); | 226 | var desde = new Date('1900/01/01'); |
| 197 | var hasta = new Date('2099/01/01'); | 227 | var hasta = new Date('2099/01/01'); |
| 198 | if($scope.fechaDesde) { | 228 | if($scope.fechaDesde) { |
| 199 | var fechaDesde = $scope.fechaDesde; | 229 | var fechaDesde = $scope.fechaDesde; |
| 200 | desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); | 230 | desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); |
| 201 | desde = new Date(desde); | 231 | desde = new Date(desde); |
| 202 | } | 232 | } |
| 203 | if($scope.fechaHasta) { | 233 | if($scope.fechaHasta) { |
| 204 | var fechaHasta = $scope.fechaHasta; | 234 | var fechaHasta = $scope.fechaHasta; |
| 205 | hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); | 235 | hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); |
| 206 | hasta = hasta.setDate(hasta.getDate() + 1); | 236 | hasta = hasta.setDate(hasta.getDate() + 1); |
| 207 | hasta = new Date(hasta); | 237 | hasta = new Date(hasta); |
| 208 | } | 238 | } |
| 209 | var datos = { | 239 | var datos = { |
| 210 | actividad: $scope.actividad, | 240 | actividad: $scope.actividad, |
| 211 | idUsuario: $scope.idVendedor, | 241 | idUsuario: $scope.idVendedor, |
| 212 | fechaDesde: desde, | 242 | fechaDesde: desde, |
| 213 | fechaHasta: hasta, | 243 | fechaHasta: hasta, |
| 214 | asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? | 244 | asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? |
| 215 | false : undefined) | 245 | false : undefined) |
| 216 | }; | 246 | }; |
| 217 | 247 | ||
| 218 | $scope.datosBuscados = { | 248 | $scope.datosBuscados = { |
| 219 | actividad: $scope.actividad, | 249 | actividad: $scope.actividad, |
| 220 | individual: $scope.idVendedor ? true : false | 250 | individual: $scope.idVendedor ? true : false |
| 221 | }; | 251 | }; |
| 222 | 252 | ||
| 223 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { | 253 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { |
| 224 | if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { | 254 | if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { |
| 225 | $scope.marcadores = datos.data; | 255 | $scope.marcadores = datos.data; |
| 226 | } | 256 | } |
| 227 | }); | 257 | }); |
| 228 | } | 258 | } |
| 229 | 259 | ||
| 230 | function eliminarVehiculo(vehiculo) { | 260 | function eliminarVehiculo(vehiculo) { |
| 231 | focaLogisticaPedidoRutaService.getRemitos(vehiculo.id).then(function(res) { | 261 | focaLogisticaPedidoRutaService.getRemitos(vehiculo.id).then(function(res) { |
| 232 | if(!focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data).length) { | 262 | if(!focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data).length) { |
| 233 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | 263 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
| 234 | }else { | 264 | }else { |
| 235 | focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + | 265 | focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + |
| 236 | 'tiene remitos asociados').then(function() { | 266 | 'tiene remitos asociados').then(function() { |
| 237 | $scope.hacerHojaRuta(vehiculo); | 267 | $scope.hacerHojaRuta(vehiculo); |
| 238 | }); | 268 | }); |
| 239 | } | 269 | } |
| 240 | }); | 270 | }); |
| 241 | } | 271 | } |
| 242 | $interval(function() { | 272 | $interval(function() { |
| 243 | getSeguimiento(); | 273 | getSeguimiento(); |
| 244 | }, 5000); | 274 | }, 5000); |
| 245 | } | 275 | } |
| 246 | ]); | 276 | ]); |
| 247 | 277 |
src/js/controllerCerrarVehiculo.js
| 1 | angular.module('focaLogisticaPedidoRuta') | 1 | angular.module('focaLogisticaPedidoRuta') |
| 2 | .controller('focaModalCerrarVehiculo', [ | 2 | .controller('focaModalCerrarVehiculo', [ |
| 3 | '$scope', | 3 | '$scope', |
| 4 | '$uibModalInstance', | 4 | '$uibModalInstance', |
| 5 | '$uibModal', | 5 | '$uibModal', |
| 6 | 'focaLogisticaPedidoRutaService', | 6 | 'focaLogisticaPedidoRutaService', |
| 7 | 'idVehiculo', | 7 | 'idVehiculo', |
| 8 | 'focaModalService', | 8 | 'focaModalService', |
| 9 | '$filter', | 9 | '$filter', |
| 10 | function($scope, $uibModalInstance, $uibModal, focaLogisticaPedidoRutaService, | 10 | function($scope, $uibModalInstance, $uibModal, focaLogisticaPedidoRutaService, |
| 11 | idVehiculo, focaModalService, $filter) { | 11 | idVehiculo, focaModalService, $filter) { |
| 12 | $scope.vehiculo = {}; | 12 | $scope.vehiculo = {}; |
| 13 | $scope.remitos = []; | 13 | $scope.remitos = []; |
| 14 | $scope.now = new Date(); | 14 | $scope.now = new Date(); |
| 15 | focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then(function(res) { | 15 | focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then(function(res) { |
| 16 | $scope.vehiculo = res.data; | 16 | $scope.vehiculo = res.data; |
| 17 | }); | 17 | }); |
| 18 | //TODO: refactor código esta rre feo | ||
| 19 | focaLogisticaPedidoRutaService.getRemitos(idVehiculo).then(function(res) { | 18 | focaLogisticaPedidoRutaService.getRemitos(idVehiculo).then(function(res) { |
| 20 | $scope.remitos = focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data); | 19 | $scope.remitos = focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data); |
| 21 | }); | 20 | }); |
| 22 | |||
| 23 | focaLogisticaPedidoRutaService.numeroHojaRuta().then(function(res) { | 21 | focaLogisticaPedidoRutaService.numeroHojaRuta().then(function(res) { |
| 24 | $scope.sucursal = res.data.sucursal; | 22 | $scope.sucursal = res.data.sucursal; |
| 25 | $scope.numero = res.data.numeroHojaRuta; | 23 | $scope.numero = res.data.numeroHojaRuta; |
| 26 | }); | 24 | }); |
| 27 | $scope.cancelar = function() { | 25 | $scope.cancelar = function() { |
| 28 | $uibModalInstance.close(); | 26 | $uibModalInstance.close(); |
| 29 | }; | 27 | }; |
| 30 | $scope.aceptar = function() { | 28 | $scope.aceptar = function() { |
| 31 | var save = { | 29 | var idsRemito = []; |
| 32 | hojaRuta: { | 30 | $scope.remitos.forEach(function(remito) { |
| 33 | id: 0, | 31 | idsRemito.push(remito.id); |
| 34 | fechaCreacion: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | ||
| 35 | idTransportista: $scope.vehiculo.idTransportista, | ||
| 36 | idChofer: $scope.chofer.id, | ||
| 37 | idVehiculo: $scope.vehiculo.id, | ||
| 38 | tarifaFlete: $scope.tarifaFlete | ||
| 39 | }, | ||
| 40 | remitos: $scope.remitos, | ||
| 41 | idVehiculo: $scope.vehiculo.id | ||
| 42 | }; | ||
| 43 | focaLogisticaPedidoRutaService.crearHojaRuta(save).then(function() { | ||
| 44 | $uibModalInstance.close(); | ||
| 45 | focaModalService.alert('Hoja de ruta guardada con éxito'); | ||
| 46 | }); | 32 | }); |
| 33 | var cierreDistribuicion = { | ||
| 34 | idsRemito: idsRemito, | ||
| 35 | fechaReparto: focaLogisticaPedidoRutaService.fecha | ||
| 36 | }; | ||
| 37 | focaLogisticaPedidoRutaService.cerrarDistribuicion(cierreDistribuicion) | ||
| 38 | .then(function() { | ||
| 39 | focaModalService.alert('Vehículo cerrado con éxito'); | ||
| 40 | } | ||
| 41 | ); | ||
| 47 | }; | 42 | }; |
| 48 | $scope.seleccionarChofer = function() { | 43 | $scope.seleccionarChofer = function() { |
| 49 | var modalInstance = $uibModal.open( | 44 | var modalInstance = $uibModal.open( |
| 50 | { | 45 | { |
| 51 | ariaLabelledBy: 'Busqueda de Chofer', | 46 | ariaLabelledBy: 'Busqueda de Chofer', |
| 52 | templateUrl: 'modal-chofer.html', | 47 | templateUrl: 'modal-chofer.html', |
| 53 | controller: 'focaModalChoferController', | 48 | controller: 'focaModalChoferController', |
| 54 | size: 'lg' | 49 | size: 'lg' |
| 55 | } | 50 | } |
| 56 | ); | 51 | ); |
| 57 | 52 | ||
| 58 | modalInstance.result.then( | 53 | modalInstance.result.then( |
| 59 | function(chofer) { | 54 | function(chofer) { |
| 60 | $scope.chofer = chofer; | 55 | $scope.chofer = chofer; |
| 61 | }, function() { | 56 | }, function() { |
| 62 | // funcion ejecutada cuando se cancela el modal | 57 | // funcion ejecutada cuando se cancela el modal |
| 63 | } | 58 | } |
| 64 | ); | 59 | ); |
| 65 | }; | 60 | }; |
| 66 | $scope.eliminarRemitos = function() { | 61 | $scope.eliminarRemitos = function() { |
| 67 | var remitosDel = $filter('filter')($scope.remitos, {checked: true}); | 62 | var remitosDel = $filter('filter')($scope.remitos, {checked: true}); |
| 68 | focaModalService.alert('¿Seguro que desea desasociar estos remitos del vehículo?') | 63 | focaModalService.alert('¿Seguro que desea desasociar estos remitos del vehículo?') |
| 69 | .then(function() { | 64 | .then(function() { |
| 70 | eliminarRemitos(remitosDel); | 65 | eliminarRemitos(remitosDel); |
| 71 | } | 66 | } |
| 72 | ); | 67 | ); |
| 73 | }; | 68 | }; |
| 74 | $scope.minimoUnoChecked = function() { | 69 | $scope.minimoUnoChecked = function() { |
| 75 | var remitosChequeados = $filter('filter')($scope.remitos, {checked: true}); | 70 | var remitosChequeados = $filter('filter')($scope.remitos, {checked: true}); |
| 76 | return !remitosChequeados.length; | 71 | return !remitosChequeados.length; |
| 77 | }; | 72 | }; |
| 78 | function eliminarRemitos(remitosDel) { | 73 | function eliminarRemitos(remitosDel) { |
src/js/controllerDetalleVehiculo.js
| 1 | angular.module('focaLogisticaPedidoRuta') | 1 | angular.module('focaLogisticaPedidoRuta') |
| 2 | .controller('focaDetalleVehiculo', | 2 | .controller('focaDetalleVehiculo', |
| 3 | ['$scope', | 3 | ['$scope', |
| 4 | '$uibModalInstance', | 4 | '$uibModalInstance', |
| 5 | 'idVehiculo', | 5 | 'idVehiculo', |
| 6 | 'idRemito', | 6 | 'idRemito', |
| 7 | 'focaModalService', | 7 | 'focaModalService', |
| 8 | '$filter', | 8 | '$filter', |
| 9 | 'focaLogisticaPedidoRutaService', | 9 | 'focaLogisticaPedidoRutaService', |
| 10 | function($scope, $uibModalInstance, idVehiculo, idRemito, focaModalService, $filter, | 10 | function($scope, $uibModalInstance, idVehiculo, idRemito, focaModalService, $filter, |
| 11 | focaLogisticaPedidoRutaService | 11 | focaLogisticaPedidoRutaService |
| 12 | ) { | 12 | ) { |
| 13 | //seteo variables | 13 | //seteo variables |
| 14 | $scope.cargandoDatos = true; | 14 | $scope.cargandoDatos = true; |
| 15 | $scope.idRemito = idRemito; | 15 | $scope.idRemito = idRemito; |
| 16 | $scope.articulos = []; | 16 | $scope.articulos = []; |
| 17 | $scope.vehiculo = {}; | 17 | $scope.vehiculo = {}; |
| 18 | $scope.cisternas = []; | 18 | $scope.cisternas = []; |
| 19 | $scope.cisternasCarga = []; | 19 | $scope.cisternasCarga = []; |
| 20 | $scope.remito = {}; | 20 | $scope.remito = {}; |
| 21 | $scope.aCargar = []; | 21 | $scope.aCargar = []; |
| 22 | var cisternaMovimientos = []; | 22 | var cisternaMovimientos = []; |
| 23 | var promesaRemito; | 23 | var promesaRemito; |
| 24 | var promesaVehiculo = focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo); | 24 | var promesaVehiculo = focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo); |
| 25 | var promesaCisternas = focaLogisticaPedidoRutaService | 25 | var promesaCisternas = focaLogisticaPedidoRutaService |
| 26 | .obtenerCisternasPorFecha(idVehiculo); | 26 | .obtenerCisternasPorFecha(idVehiculo); |
| 27 | if(idRemito !== -1) { | 27 | if(idRemito !== -1) { |
| 28 | promesaRemito = focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito); | 28 | promesaRemito = focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito); |
| 29 | } | 29 | } |
| 30 | Promise.all([promesaVehiculo, promesaCisternas, promesaRemito]).then(function(res) { | 30 | Promise.all([promesaVehiculo, promesaCisternas, promesaRemito]).then(function(res) { |
| 31 | $scope.cargandoDatos = false; | 31 | $scope.cargandoDatos = false; |
| 32 | $scope.vehiculo = res[0].data; | 32 | $scope.vehiculo = res[0].data; |
| 33 | $scope.cisternas = res[1].data; | 33 | $scope.cisternas = res[1].data; |
| 34 | if(!res[2]) return; | 34 | if(!res[2]) return; |
| 35 | $scope.remito = res[2].data; | 35 | $scope.remito = res[2].data; |
| 36 | if($scope.remito.idUsuarioProceso) { | 36 | if($scope.remito.idUsuarioProceso) { |
| 37 | focaModalService.alert('Remito ya asignado'); | 37 | focaModalService.alert('Remito ya asignado'); |
| 38 | $uibModalInstance.close(); | 38 | $uibModalInstance.close(); |
| 39 | } | 39 | } |
| 40 | $scope.articulos = $scope.remito.articulosRemito; | 40 | $scope.articulos = $scope.remito.articulosRemito; |
| 41 | $scope.seleccionarArticulo($scope.articulos[0]); | 41 | $scope.seleccionarArticulo($scope.articulos[0]); |
| 42 | var tieneUsuario = $scope.cisternas.filter(function(cisterna) { | ||
| 43 | if(cisterna.cisternaCarga) { | ||
| 44 | return cisterna.cisternaCarga.idUsuarioProceso !== | ||
| 45 | focaLogisticaPedidoRutaService.idUsuario; | ||
| 46 | } | ||
| 47 | }); | ||
| 48 | if(tieneUsuario.length) { | ||
| 49 | focaModalService.alert('Otro usario esta usando este vehículo'); | ||
| 50 | $uibModalInstance.close(); | ||
| 51 | return; | ||
| 52 | } | ||
| 42 | }); | 53 | }); |
| 43 | $scope.aceptar = function() { | 54 | $scope.aceptar = function() { |
| 44 | $scope.cargando = true; | 55 | $scope.cargando = true; |
| 45 | for(var i = 0; i < $scope.cisternasCarga.length; i++) { | 56 | for(var i = 0; i < $scope.cisternasCarga.length; i++) { |
| 57 | $scope.cisternasCarga[i].idUsuarioProceso = | ||
| 58 | focaLogisticaPedidoRutaService.idUsuario; | ||
| 46 | delete $scope.cisternasCarga[i].articulo; | 59 | delete $scope.cisternasCarga[i].articulo; |
| 47 | } | 60 | } |
| 48 | var cisterna = { | 61 | var cisterna = { |
| 49 | cisternaMovimientos: cisternaMovimientos, | 62 | cisternaMovimientos: cisternaMovimientos, |
| 50 | cisternaCargas: $scope.cisternasCarga, | 63 | cisternaCargas: $scope.cisternasCarga, |
| 51 | idVehiculo: $scope.vehiculo.id | 64 | idVehiculo: $scope.vehiculo.id, |
| 65 | fechaReparto: focaLogisticaPedidoRutaService.fecha | ||
| 52 | }; | 66 | }; |
| 53 | focaLogisticaPedidoRutaService.guardarCisternas(cisterna, $scope.remito.id) | 67 | focaLogisticaPedidoRutaService.guardarCisternas(cisterna, $scope.remito.id) |
| 54 | .then(function() { | 68 | .then(function() { |
| 55 | focaModalService.alert('Cisternas cargadas con éxito').then(function() { | 69 | focaModalService.alert('Cisternas cargadas con éxito').then(function() { |
| 56 | $scope.cargando = false; | 70 | $scope.cargando = false; |
| 57 | $uibModalInstance.close(); | 71 | $uibModalInstance.close(); |
| 58 | }); | 72 | }); |
| 59 | }).catch(function(error) { | 73 | }).catch(function(error) { |
| 60 | $scope.cargando = false; | 74 | $scope.cargando = false; |
| 61 | $uibModalInstance.close(); | 75 | $uibModalInstance.close(); |
| 62 | if (error.status === 403.1) { | 76 | if (error.status === 403) { |
| 63 | focaModalService.alert('ERROR: El vehículo esta en uso'); | 77 | focaModalService.alert('ERROR: ' + error.data); |
| 64 | } | ||
| 65 | if(error.status === 403.2) { | ||
| 66 | focaModalService.alert('ERROR: Otro usario ya cargó este remito'); | ||
| 67 | return; | 78 | return; |
| 68 | } | 79 | } |
| 69 | focaModalService.alert('Hubo un error al cargar las cisternas'); | 80 | focaModalService.alert('Hubo un error al cargar las cisternas'); |
| 70 | }); | 81 | }); |
| 71 | }; | 82 | }; |
| 72 | $scope.cancelar = function() { | 83 | $scope.cancelar = function() { |
| 73 | $uibModalInstance.close(); | 84 | $uibModalInstance.close(); |
| 74 | }; | 85 | }; |
| 75 | $scope.cargarACisternas = function() { | 86 | $scope.cargarACisternas = function() { |
| 76 | for(var i = 0; i < $scope.cisternas.length; i++) { | 87 | for(var i = 0; i < $scope.cisternas.length; i++) { |
| 77 | var cisterna = $scope.cisternas[i]; | 88 | var cisterna = $scope.cisternas[i]; |
| 78 | var aCargar = parseFloat($scope.aCargar[i]); | 89 | var aCargar = parseFloat($scope.aCargar[i]); |
| 79 | var fechaReparto = focaLogisticaPedidoRutaService.fecha; | 90 | var fechaReparto = focaLogisticaPedidoRutaService.fecha; |
| 80 | //validaciones | 91 | //validaciones |
| 81 | if(!aCargar) { | 92 | if(!aCargar) { |
| 82 | continue; | 93 | continue; |
| 83 | } | 94 | } |
| 84 | //cargar | 95 | //cargar |
| 85 | if(cisterna.cisternaCarga.cantidad) { | 96 | if(cisterna.cisternaCarga.cantidad) { |
| 86 | cisterna.cisternaCarga.cantidad += aCargar; | 97 | cisterna.cisternaCarga.cantidad += aCargar; |
| 87 | }else { | 98 | }else { |
| 88 | cisterna.cisternaCarga.cantidad = aCargar; | 99 | cisterna.cisternaCarga.cantidad = aCargar; |
| 89 | cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo; | 100 | cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo; |
| 90 | } | 101 | } |
| 91 | cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad; | 102 | cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad; |
| 92 | 103 | ||
| 93 | cisterna.cisternaCarga.articulo = { | 104 | cisterna.cisternaCarga.articulo = { |
| 94 | DetArt: $scope.articuloSeleccionado.descripcion | 105 | DetArt: $scope.articuloSeleccionado.descripcion |
| 95 | }; | 106 | }; |
| 96 | $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0] | 107 | $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0] |
| 97 | .cargado = true; | 108 | .cargado = true; |
| 98 | 109 | ||
| 99 | $scope.calcularPorcentaje(cisterna); | 110 | $scope.calcularPorcentaje(cisterna); |
| 100 | //Guardar | 111 | //Guardar |
| 101 | var now = new Date(); | 112 | var now = new Date(); |
| 102 | var cisternaMovimiento = { | 113 | var cisternaMovimiento = { |
| 103 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), | 114 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), |
| 104 | cantidad: aCargar, | 115 | cantidad: aCargar, |
| 105 | metodo: 'carga', | 116 | metodo: 'carga', |
| 106 | idCisternaCarga: cisterna.cisternaCarga.id, | 117 | idCisternaCarga: cisterna.cisternaCarga.id, |
| 107 | idRemito: $scope.remito.id | 118 | idRemito: $scope.remito.id |
| 108 | }; | 119 | }; |
| 109 | cisterna.cisternaCarga.fechaReparto = fechaReparto; | 120 | cisterna.cisternaCarga.fechaReparto = fechaReparto; |
| 110 | cisterna.cisternaCarga.idCisterna = cisterna.id; | 121 | cisterna.cisternaCarga.idCisterna = cisterna.id; |
| 111 | $scope.cisternasCarga.push(cisterna.cisternaCarga); | 122 | $scope.cisternasCarga.push(cisterna.cisternaCarga); |
| 112 | cisternaMovimientos.push(cisternaMovimiento); | 123 | cisternaMovimientos.push(cisternaMovimiento); |
| 113 | } | 124 | } |
| 114 | var articuloSiguiente = $scope.articulos.filter( | 125 | var articuloSiguiente = $scope.articulos.filter( |
| 115 | function(filter) { | 126 | function(filter) { |
| 116 | return filter.cargado !== true; | 127 | return filter.cargado !== true; |
| 117 | } | 128 | } |
| 118 | ); | 129 | ); |
| 119 | if(articuloSiguiente.length > 0) { | 130 | if(articuloSiguiente.length > 0) { |
| 120 | $scope.seleccionarArticulo(articuloSiguiente[0]); | 131 | $scope.seleccionarArticulo(articuloSiguiente[0]); |
| 121 | } | 132 | } |
| 122 | }; | 133 | }; |
| 123 | $scope.calcularPorcentaje = function(cisterna) { | 134 | $scope.calcularPorcentaje = function(cisterna) { |
| 124 | if(!cisterna.cisternaCarga) { | 135 | if(!cisterna.cisternaCarga) { |
| 125 | cisterna.cisternaCarga = { | 136 | cisterna.cisternaCarga = { |
| 126 | cantidad: 0 | 137 | cantidad: 0 |
| 127 | }; | 138 | }; |
| 128 | } | 139 | } |
| 129 | var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / | 140 | var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / |
| 130 | cisterna.capacidad) + '%'; | 141 | cisterna.capacidad) + '%'; |
| 131 | var elementHtml = document.getElementById(cisterna.id); | 142 | var elementHtml = document.getElementById(cisterna.id); |
| 132 | if(elementHtml) { | 143 | if(elementHtml) { |
| 133 | elementHtml.style.width = porcentaje; | 144 | elementHtml.style.width = porcentaje; |
| 134 | } | 145 | } |
| 135 | }; | 146 | }; |
| 136 | $scope.seleccionarArticulo = function(articulo) { | 147 | $scope.seleccionarArticulo = function(articulo) { |
| 137 | $scope.articuloSeleccionado = articulo; | 148 | $scope.articuloSeleccionado = articulo; |
| 138 | $scope.cisternaDisponible(); | 149 | $scope.cisternaDisponible(); |
| 139 | $scope.autoCompletar(); | 150 | $scope.autoCompletar(); |
| 140 | $scope.actualizarArticulo(); | 151 | $scope.actualizarArticulo(); |
| 141 | }; | 152 | }; |
| 142 | $scope.actualizarArticulo = function () { | 153 | $scope.actualizarArticulo = function () { |
| 143 | $scope.articuloSeleccionado.cantidadCargada = 0; | 154 | $scope.articuloSeleccionado.cantidadCargada = 0; |
| 144 | for (var i = 0; i < $scope.aCargar.length; i++) { | 155 | for (var i = 0; i < $scope.aCargar.length; i++) { |
| 145 | $scope.articuloSeleccionado.cantidadCargada += | 156 | $scope.articuloSeleccionado.cantidadCargada += |
| 146 | parseFloat($scope.aCargar[i]) || 0; | 157 | parseFloat($scope.aCargar[i]) || 0; |
| 147 | } | 158 | } |
| 148 | }; | 159 | }; |
| 149 | $scope.autoCompletar = function() { | 160 | $scope.autoCompletar = function() { |
| 150 | $scope.aCargar = []; | 161 | $scope.aCargar = []; |
| 151 | var disponible = $filter('filter')($scope.cisternas, {disabled: false}); | 162 | var disponible = $filter('filter')($scope.cisternas, {disabled: false}); |
| 152 | var index = $scope.cisternas.indexOf(disponible[0]); | 163 | var index = $scope.cisternas.indexOf(disponible[0]); |
| 153 | $scope.aCargar[index] = $scope.articuloSeleccionado.cantidad; | 164 | $scope.aCargar[index] = $scope.articuloSeleccionado.cantidad; |
| 154 | }; | 165 | }; |
| 155 | $scope.cisternaDisponible = function() { | 166 | $scope.cisternaDisponible = function() { |
| 156 | for(var i = 0; i < $scope.cisternas.length; i++) { | 167 | for(var i = 0; i < $scope.cisternas.length; i++) { |
| 157 | if($scope.articuloSeleccionado.cantidad > $scope.cisternas[i].disponible) { | 168 | if($scope.articuloSeleccionado.cantidad > $scope.cisternas[i].disponible) { |
| 158 | $scope.cisternas[i].disabled = true; | 169 | $scope.cisternas[i].disabled = true; |
| 159 | continue; | 170 | continue; |
| 160 | } | 171 | } |
| 161 | if($scope.cisternas[i].cisternaCarga && | 172 | if($scope.cisternas[i].cisternaCarga && |
| 162 | $scope.cisternas[i].cisternaCarga.idProducto && | 173 | $scope.cisternas[i].cisternaCarga.idProducto && |
| 163 | $scope.articuloSeleccionado.idArticulo !== | 174 | $scope.articuloSeleccionado.idArticulo !== |
| 164 | $scope.cisternas[i].cisternaCarga.idProducto) | 175 | $scope.cisternas[i].cisternaCarga.idProducto) |
| 165 | { | 176 | { |
| 166 | $scope.cisternas[i].disabled = true; | 177 | $scope.cisternas[i].disabled = true; |
| 167 | continue; | 178 | continue; |
| 168 | } | 179 | } |
| 169 | $scope.cisternas[i].disabled = false; | 180 | $scope.cisternas[i].disabled = false; |
| 170 | } | 181 | } |
| 171 | }; | 182 | }; |
| 172 | $scope.rellenarInput = function(input) { | 183 | $scope.rellenarInput = function(input) { |
| 173 | if(!$scope.articuloSeleccionado) return; | 184 | if(!$scope.articuloSeleccionado) return; |
| 174 | if($scope.articuloSeleccionado.cantidad - | 185 | if($scope.articuloSeleccionado.cantidad - |
| 175 | $scope.articuloSeleccionado.cantidadCargada === 0) { | 186 | $scope.articuloSeleccionado.cantidadCargada === 0) { |
| 176 | return input; | 187 | return input; |
| 177 | } | 188 | } |
| 178 | if(!input) input = 0; | 189 | if(!input) input = 0; |
| 179 | input = parseFloat(input); | 190 | input = parseFloat(input); |
| 180 | input += parseFloat($scope.articuloSeleccionado.cantidad - | 191 | input += parseFloat($scope.articuloSeleccionado.cantidad - |
| 181 | $scope.articuloSeleccionado.cantidadCargada); | 192 | $scope.articuloSeleccionado.cantidadCargada); |
| 182 | return input; | 193 | return input; |
| 183 | }; | 194 | }; |
| 184 | $scope.distribucionDisponible = function() { | 195 | $scope.distribucionDisponible = function() { |
| 185 | if(!$scope.articuloSeleccionado || $scope.articuloSeleccionado.cantidad - | 196 | if(!$scope.articuloSeleccionado || $scope.articuloSeleccionado.cantidad - |
| 186 | $scope.articuloSeleccionado.cantidadCargada !== 0 || | 197 | $scope.articuloSeleccionado.cantidadCargada !== 0 || |
| 187 | !$scope.tieneArticulosPendientes()) { | 198 | !$scope.tieneArticulosPendientes()) { |
| 188 | return false; | 199 | return false; |
| 189 | } | 200 | } |
| 190 | return true; | 201 | return true; |
| 191 | }; | 202 | }; |
| 192 | $scope.tieneArticulosPendientes = function() { | 203 | $scope.tieneArticulosPendientes = function() { |
| 193 | var algunValorNegativo = $scope.aCargar.filter(function(p) { | 204 | var algunValorNegativo = $scope.aCargar.filter(function(p) { |
| 194 | return p < 0; | 205 | return p < 0; |
| 195 | }); | 206 | }); |
| 196 | if(algunValorNegativo.length) { | 207 | if(algunValorNegativo.length) { |
| 197 | return false; | 208 | return false; |
| 198 | } | 209 | } |
| 199 | var articulosDescargados = $scope.articulos.filter(function(filter) { | 210 | var articulosDescargados = $scope.articulos.filter(function(filter) { |
| 200 | return filter.cargado === true; | 211 | return filter.cargado === true; |
| 201 | }); | 212 | }); |
| 202 | if(articulosDescargados.length === $scope.articulos.length) { | 213 | if(articulosDescargados.length === $scope.articulos.length) { |
| 203 | $scope.aCargar = []; | 214 | $scope.aCargar = []; |
| 204 | return false; | 215 | return false; |
| 205 | } | 216 | } |
| 206 | return true; | 217 | return true; |
src/js/service.js
| 1 | angular.module('focaLogisticaPedidoRuta') | 1 | angular.module('focaLogisticaPedidoRuta') |
| 2 | .factory( | 2 | .factory( |
| 3 | 'focaLogisticaPedidoRutaService', [ | 3 | 'focaLogisticaPedidoRutaService', [ |
| 4 | '$http', | 4 | '$http', |
| 5 | '$cookies', | 5 | '$cookies', |
| 6 | 'API_ENDPOINT', | 6 | 'API_ENDPOINT', |
| 7 | '$filter', | 7 | '$filter', |
| 8 | function($http, $cookies, API_ENDPOINT, $filter) { | 8 | function($http, $cookies, API_ENDPOINT, $filter) { |
| 9 | var url = API_ENDPOINT.URL; | ||
| 9 | return { | 10 | return { |
| 10 | idUsuario: $cookies.get('idUsuario'), | 11 | idUsuario: $cookies.get('idUsuario'), |
| 11 | obtenerActividad: function(parametros) { | 12 | obtenerActividad: function(parametros) { |
| 12 | return $http.post(API_ENDPOINT.URL + '/seguimiento/filtros', parametros); | 13 | return $http.post(url + '/seguimiento/filtros', parametros); |
| 13 | }, | 14 | }, |
| 14 | obtenerVehiculoById: function(idVehiculo) { | 15 | obtenerVehiculoById: function(idVehiculo) { |
| 15 | return $http.get(API_ENDPOINT.URL + '/vehiculo/' + idVehiculo); | 16 | return $http.get(url + '/vehiculo/' + idVehiculo); |
| 16 | }, | 17 | }, |
| 17 | obtenerRemitoById: function(idRemito) { | 18 | obtenerRemitoById: function(idRemito) { |
| 18 | return $http.get(API_ENDPOINT.URL + '/remito/obtener/' + idRemito); | 19 | return $http.get(url + '/remito/obtener/' + idRemito); |
| 19 | }, | 20 | }, |
| 20 | guardarCisternas: function(cisterna, idRemito) { | 21 | guardarCisternas: function(cisterna, idRemito) { |
| 21 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar/cargar/' + | 22 | return $http.post(url + '/cisterna/guardar/cargar/' + |
| 22 | this.idUsuario + '/' + idRemito,cisterna); | 23 | this.idUsuario + '/' + idRemito,cisterna); |
| 23 | }, | 24 | }, |
| 24 | numeroHojaRuta: function() { | 25 | numeroHojaRuta: function() { |
| 25 | return $http.get(API_ENDPOINT.URL + '/hoja-ruta/numero-siguiente'); | 26 | return $http.get(url + '/hoja-ruta/numero-siguiente'); |
| 26 | }, | 27 | }, |
| 27 | getRemitos: function(idVehiculo) { | 28 | getRemitos: function(idVehiculo) { |
| 28 | return $http.get(API_ENDPOINT.URL + '/remito/sin-hoja-ruta/' +idVehiculo); | 29 | return $http.get(url + '/remito/sin-hoja-ruta/' +idVehiculo); |
| 29 | }, | 30 | }, |
| 30 | crearHojaRuta: function(hojaRuta) { | 31 | cerrarDistribuicion: function(remitos) { |
| 31 | return $http.post(API_ENDPOINT.URL + '/hoja-ruta', hojaRuta); | 32 | return $http.post(url + '/vehiculo/cierre-distribuicion', remitos); |
| 32 | }, | 33 | }, |
| 33 | desasociarRemitos: function(remitos, idVehiculo, sinRemitos) { | 34 | desasociarRemitos: function(remitos, idVehiculo, sinRemitos) { |
| 34 | var idsRemitos = []; | 35 | var idsRemitos = []; |
| 35 | for (var i = 0; i < remitos.length; i++) { | 36 | for (var i = 0; i < remitos.length; i++) { |
| 36 | idsRemitos.push(remitos[i].id); | 37 | idsRemitos.push(remitos[i].id); |
| 37 | } | 38 | } |
| 38 | return $http.post(API_ENDPOINT.URL + '/vehiculo/desasociar-remitos', | 39 | return $http.post(url + '/vehiculo/desasociar-remitos', |
| 39 | { | 40 | { |
| 40 | idsRemitos: idsRemitos, | 41 | idsRemitos: idsRemitos, |
| 41 | idVehiculo: idVehiculo, | 42 | idVehiculo: idVehiculo, |
| 42 | vehiculoSinRemitos: sinRemitos | 43 | vehiculoSinRemitos: sinRemitos |
| 43 | }); | 44 | }); |
| 44 | }, | 45 | }, |
| 45 | obtenerRemitosDeCarga: function(remitos) { | 46 | obtenerRemitosDeCarga: function(remitos) { |
| 46 | var remitosRes = []; | 47 | var remitosRes = []; |
| 47 | for(var i = 0; i < remitos.cisternas.length; i++) { | 48 | for(var i = 0; i < remitos.cisternas.length; i++) { |
| 48 | procesoCistena(remitos.cisternas[i], this.fecha.toISOString()); | 49 | procesoCistena(remitos.cisternas[i], this.fecha.toISOString()); |
| 49 | } | 50 | } |
| 50 | function procesoCistena(cisterna, fecha) { | 51 | function procesoCistena(cisterna, fecha) { |
| 51 | for(var j = 0; j < cisterna.cisternasCarga.length; j++) { | 52 | for(var j = 0; j < cisterna.cisternasCarga.length; j++) { |
| 52 | for(var k = 0; k < cisterna.cisternasCarga[j].cisternaMovimientos | 53 | for(var k = 0; k < cisterna.cisternasCarga[j].cisternaMovimientos |
| 53 | .length; k++) | 54 | .length; k++) |
| 54 | { | 55 | { |
| 55 | if(cisterna.cisternasCarga[j].fechaReparto.substring(0, 10) === | 56 | if(cisterna.cisternasCarga[j].fechaReparto.substring(0, 10) === |
| 56 | fecha.substring(0, 10)) | 57 | fecha.substring(0, 10) && !cisterna.cisternasCarga[j] |
| 58 | .confirmado) | ||
| 57 | { | 59 | { |
| 58 | procesoMovimiento(cisterna.cisternasCarga[j] | 60 | procesoMovimiento(cisterna.cisternasCarga[j] |
| 59 | .cisternaMovimientos[k]); | 61 | .cisternaMovimientos[k]); |
| 60 | } | 62 | } |
| 61 | } | 63 | } |
| 62 | } | 64 | } |
| 63 | } | 65 | } |
| 64 | function procesoMovimiento(movimiento) { | 66 | function procesoMovimiento(movimiento) { |
| 65 | if(!movimiento.anulado && movimiento.remito && | 67 | if(!movimiento.anulado && movimiento.remito && |
| 66 | !movimiento.remito.idHojaRuta) { | 68 | !movimiento.remito.idHojaRuta) { |
| 67 | var remito = movimiento.remito; | 69 | var remito = movimiento.remito; |
| 68 | var yaEstaCargado = $filter('filter')(remitosRes, {id: remito.id}); | 70 | var yaEstaCargado = $filter('filter')(remitosRes, {id: remito.id}); |
| 69 | if(!yaEstaCargado.length && movimiento.metodo === 'carga') { | 71 | if(!yaEstaCargado.length && movimiento.metodo === 'carga') { |
| 70 | remitosRes.push(remito); | 72 | remitosRes.push(remito); |
| 71 | } | 73 | } |
| 72 | } | 74 | } |
| 73 | } | 75 | } |
| 74 | return remitosRes; | 76 | return remitosRes; |
| 75 | }, | 77 | }, |
| 76 | getVehiculosByIdUsuario: function() { | 78 | getVehiculosByIdUsuario: function() { |
| 77 | return $http.get(API_ENDPOINT.URL + '/vehiculo/usuario/' + this.idUsuario); | 79 | return $http.get(url + '/vehiculo/usuario/' + this.idUsuario); |
| 78 | }, | 80 | }, |
| 79 | obtenerCisternasPorFecha: function(idVehiculo) { | 81 | obtenerCisternasPorFecha: function(idVehiculo) { |
| 80 | return $http.post(API_ENDPOINT.URL + '/cisterna/listar/fecha', | 82 | return $http.post(url + '/cisterna/listar/fecha', |
| 81 | {idVehiculo: idVehiculo, fechaReparto: this.fecha}); | 83 | {idVehiculo: idVehiculo, fechaReparto: this.fecha}); |
| 82 | }, | 84 | }, |
| 83 | getUnidadesByFecha: function() { | 85 | getUnidadesByFecha: function() { |
| 84 | return $http.post(API_ENDPOINT.URL + '/vehiculo/listar/fecha', | 86 | return $http.post(url + '/vehiculo/listar/fecha', |
| 85 | {fecha: this.fecha}); | 87 | {fecha: this.fecha}); |
| 86 | }, | 88 | }, |
| 87 | setFechaReparto: function(fechaReparto) { | 89 | setFechaReparto: function(fechaReparto) { |
| 88 | this.fecha = fechaReparto; | 90 | this.fecha = fechaReparto; |
| 89 | } | 91 | }, |
| 90 | }; | 92 | }; |
| 91 | }]); | 93 | }]); |
| 92 | 94 |
src/views/foca-logistica-pedido-ruta.html
| 1 | <div class="foca-logistica-pedido-ruta" id="scope"> | 1 | <div class="foca-logistica-pedido-ruta" id="scope"> |
| 2 | <div class="row"> | 2 | <div class="row"> |
| 3 | <foca-cabecera-facturador | 3 | <foca-cabecera-facturador |
| 4 | titulo="titulo" | 4 | titulo="titulo" |
| 5 | fecha="now" | 5 | fecha="now" |
| 6 | class="mb-0 col-lg-12" | 6 | class="mb-0 col-lg-12" |
| 7 | ></foca-cabecera-facturador> | 7 | ></foca-cabecera-facturador> |
| 8 | </div> | 8 | </div> |
| 9 | <div class="row px-5 py-2 botonera-secundaria"> | 9 | <div class="row px-5 py-2 botonera-secundaria"> |
| 10 | <div class="col-12"> | 10 | <div class="col-12"> |
| 11 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> | 11 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> |
| 12 | </div> | 12 | </div> |
| 13 | </div> | 13 | </div> |
| 14 | <div class="row"> | 14 | <div class="row"> |
| 15 | <div class="offset-1 col-9"> | 15 | <div class="offset-1 col-9"> |
| 16 | <foca-logistica | 16 | <foca-logistica |
| 17 | latitud="-32.89214159952345" | 17 | latitud="-32.89214159952345" |
| 18 | longitud="-68.84572999101856" | 18 | longitud="-68.84572999101856" |
| 19 | zoom="14" | 19 | zoom="14" |
| 20 | marcadores="marcadores" | 20 | marcadores="marcadores" |
| 21 | parametros= "datosBuscados" | 21 | parametros= "datosBuscados" |
| 22 | /> | 22 | /> |
| 23 | </div> | 23 | </div> |
| 24 | <div class="col-2 pl-0"> | 24 | <div class="col-2 pl-0"> |
| 25 | <strong>Filtros: </strong> | 25 | <strong>Filtros: </strong> |
| 26 | <br> | 26 | <br> |
| 27 | <span>Fecha Desde</span> | 27 | <span>Fecha Desde</span> |
| 28 | <input | 28 | <input |
| 29 | type="text" | 29 | type="text" |
| 30 | readonly | 30 | readonly |
| 31 | ng-model="fechaDesde" | 31 | ng-model="fechaDesde" |
| 32 | class="form-control form-control-sm" | 32 | class="form-control form-control-sm" |
| 33 | uib-datepicker-popup="dd/MM/yyyy" | 33 | uib-datepicker-popup="dd/MM/yyyy" |
| 34 | show-button-bar="false" | 34 | show-button-bar="false" |
| 35 | is-open="fechaDesdeOpen" | 35 | is-open="fechaDesdeOpen" |
| 36 | on-open-focus="false" | 36 | on-open-focus="false" |
| 37 | ng-focus="fechaDesdeOpen = true" | 37 | ng-focus="fechaDesdeOpen = true" |
| 38 | ng-change="search()" | 38 | ng-change="search()" |
| 39 | /> | 39 | /> |
| 40 | <span>Fecha Hasta</span> | 40 | <span>Fecha Hasta</span> |
| 41 | <input | 41 | <input |
| 42 | type="text" | 42 | type="text" |
| 43 | readonly | 43 | readonly |
| 44 | ng-model="fechaHasta" | 44 | ng-model="fechaHasta" |
| 45 | class="form-control form-control-sm" | 45 | class="form-control form-control-sm" |
| 46 | uib-datepicker-popup="dd/MM/yyyy" | 46 | uib-datepicker-popup="dd/MM/yyyy" |
| 47 | show-button-bar="false" | 47 | show-button-bar="false" |
| 48 | is-open="fechaHastaOpen" | 48 | is-open="fechaHastaOpen" |
| 49 | on-open-focus="false" | 49 | on-open-focus="false" |
| 50 | ng-focus="fechaHastaOpen = true" | 50 | ng-focus="fechaHastaOpen = true" |
| 51 | ng-change="search()" | 51 | ng-change="search()" |
| 52 | /> | 52 | /> |
| 53 | <!-- TODO: descomentar cuando se quite definitivamente --> | ||
| 54 | <!-- <button | ||
| 55 | type="button" | ||
| 56 | ng-class="{'active': idVendedor == 0}" | ||
| 57 | class="btn col-12 my-1" | ||
| 58 | ng-click="general()" | ||
| 59 | >General</button> | ||
| 60 | <button | ||
| 61 | type="button" | ||
| 62 | ng-class="{'active': idVendedor != 0}" | ||
| 63 | class="btn col-12 my-1" | ||
| 64 | ng-click="individual()" | ||
| 65 | >Individual</button> | ||
| 66 | <div class="form-group" ng-show="idVendedor == -1"> | ||
| 67 | <input | ||
| 68 | type="text" | ||
| 69 | placeholder="Vendedor" | ||
| 70 | class="form-control" | ||
| 71 | ng-model="idVendedorInput" | ||
| 72 | ng-keypress="search($event.keyCode)" | ||
| 73 | foca-focus="idVendedor == -1" | ||
| 74 | > | ||
| 75 | </div> --> | ||
| 76 | <div class="custom-control custom-radio"> | 53 | <div class="custom-control custom-radio"> |
| 77 | <input | 54 | <input |
| 78 | type="radio" | 55 | type="radio" |
| 79 | class="custom-control-input" | 56 | class="custom-control-input" |
| 80 | id="idTodos" | 57 | id="idTodos" |
| 81 | name="filtro" | 58 | name="filtro" |
| 82 | ng-model="filtroEstado" | 59 | ng-model="filtroEstado" |
| 83 | ng-change="search()" | 60 | ng-change="search()" |
| 84 | checked> | 61 | checked> |
| 85 | <label class="custom-control-label pb-3" for="idTodos"></label> | 62 | <label class="custom-control-label pb-3" for="idTodos"></label> |
| 86 | <img src="img/marker-icon-grey.png"> | 63 | <img src="img/marker-icon-grey.png"> |
| 87 | <strong>Todos</strong> | 64 | <strong>Todos</strong> |
| 88 | </div> | 65 | </div> |
| 89 | <div class="custom-control custom-radio"> | 66 | <div class="custom-control custom-radio"> |
| 90 | <input | 67 | <input |
| 91 | type="radio" | 68 | type="radio" |
| 92 | class="custom-control-input" | 69 | class="custom-control-input" |
| 93 | id="idSinAsignar" | 70 | id="idSinAsignar" |
| 94 | name="filtro" | 71 | name="filtro" |
| 95 | ng-model="filtroEstado" | 72 | ng-model="filtroEstado" |
| 96 | ng-change="search()" | 73 | ng-change="search()" |
| 97 | ng-value="false"> | 74 | ng-value="false"> |
| 98 | <label class="custom-control-label pb-3" for="idSinAsignar"></label> | 75 | <label class="custom-control-label pb-3" for="idSinAsignar"></label> |
| 99 | <img src="img/marker-icon-green.png"> | 76 | <img src="img/marker-icon-green.png"> |
| 100 | <strong>Sin asignar</strong> | 77 | <strong>Sin asignar</strong> |
| 101 | </div> | 78 | </div> |
| 102 | <div class="custom-control custom-radio"> | 79 | <div class="custom-control custom-radio"> |
| 103 | <input | 80 | <input |
| 104 | type="radio" | 81 | type="radio" |
| 105 | class="custom-control-input" | 82 | class="custom-control-input" |
| 106 | id="idAsignado" | 83 | id="idAsignado" |
| 107 | name="filtro" | 84 | name="filtro" |
| 108 | ng-model="filtroEstado" | 85 | ng-model="filtroEstado" |
| 109 | ng-change="search()" | 86 | ng-change="search()" |
| 110 | ng-value="true"> | 87 | ng-value="true"> |
| 111 | <label class="custom-control-label pb-3" for="idAsignado"></label> | 88 | <label class="custom-control-label pb-3" for="idAsignado"></label> |
| 112 | <img src="img/marker-icon-red.png"> | 89 | <img src="img/marker-icon-red.png"> |
| 113 | <strong>Asignado</strong> | 90 | <strong>Asignado</strong> |
| 114 | </div> | 91 | </div> |
| 115 | </div> | 92 | </div> |
| 116 | <div class="row"> | 93 | <div class="row"> |
| 117 | <div | 94 | <div |
| 118 | class="container col-auto" | 95 | class="container col-auto" |
| 119 | ng-repeat="vehiculo in vehiculos" | 96 | ng-repeat="vehiculo in vehiculos" |
| 120 | ng-click="mostrarDetalleVehiculo(vehiculo)" | 97 | ng-click="mostrarDetalleVehiculo(vehiculo)" |
| 121 | > | 98 | > |
| 122 | <div> | 99 | <div> |
| 123 | <div class="col-md-3 col-sm-6"> | 100 | <div class="col-md-3 col-sm-6"> |
| 124 | <div class="progress-circle" ng-class="{'arrastrando': arrastrando}"> | 101 | <div class="progress-circle" ng-class="{'arrastrando': arrastrando}"> |
| 125 | <span class="progress-left"> | 102 | <span class="progress-left"> |
| 126 | <span class="progress-bar"></span> | 103 | <span class="progress-bar"></span> |
| 127 | </span> | 104 | </span> |
| 128 | <span class="progress-right"> | 105 | <span class="progress-right"> |
| 129 | <span class="progress-bar"></span> | 106 | <span class="progress-bar"></span> |
| 130 | </span> | 107 | </span> |
| 131 | <div class="progress-value">{{vehiculo.codigo}}</div> | 108 | <div class="progress-value">{{vehiculo.codigo}}</div> |
| 132 | </div> | 109 | </div> |
| 133 | </div> | 110 | </div> |
| 134 | <div class="row ml-2"> | 111 | <div class="row ml-2"> |
| 135 | <div class="col-3 position-absolute"> | 112 | <div class="col-3 position-absolute"> |
| 136 | <img | 113 | <img |
| 137 | src="img/hojaRutaVolante.png" | 114 | src="img/hojaRutaVolante.png" |
| 138 | width="100%"> | 115 | width="100%"> |
| 139 | </div> | 116 | </div> |
| 140 | <div class="col-3" | 117 | <div class="col-3" |
| 141 | uib-tooltip="Cerrar distribuición" | 118 | uib-tooltip="Cerrar distribuición" |
| 142 | ng-click="hacerHojaRuta(vehiculo)"></div> | 119 | ng-click="hacerHojaRuta(vehiculo)"></div> |
| 143 | <div class="col-3"> | 120 | <div class="col-3"> |
| 144 | <i | 121 | <i |
| 145 | class="fa fa-eye fa-2x" | 122 | class="fa fa-eye fa-2x" |
| 146 | uib-tooltip="Ver cisternas" | 123 | uib-tooltip="Ver cisternas" |
| 147 | ng-click="cargar(vehiculo.id, -1)"> | 124 | ng-click="cargar(vehiculo.id, -1)"> |
| 148 | </i> | 125 | </i> |
| 149 | </div> | 126 | </div> |
| 150 | <div class="col-3 ml-2"> | 127 | <div class="col-3 ml-2"> |
| 151 | <i | 128 | <i |
| 152 | class="fa fa-trash fa-2x" | 129 | class="fa fa-trash fa-2x" |
| 153 | uib-tooltip="Eliminar vehiculo" | 130 | uib-tooltip="Eliminar vehiculo" |
| 154 | ng-click="quitarVehiculo(vehiculo)"></i> | 131 | ng-click="quitarVehiculo(vehiculo)"></i> |
| 155 | </div> | 132 | </div> |
| 156 | </div> | 133 | </div> |
| 157 | <div | 134 | <div |
| 158 | class="ml-1 border border-dark text-center" | 135 | class="ml-1 border border-dark text-center" |
| 159 | ng-show="arrastrando" | 136 | ng-show="arrastrando" |
| 160 | id="{{vehiculo.id}}" | 137 | id="{{vehiculo.id}}" |
| 161 | ondrop="drop(event)" | 138 | ondrop="drop(event)" |
| 162 | ondragover="allowDrop(event)" | 139 | ondragover="allowDrop(event)" |
| 163 | >Soltar acá</div> | 140 | >Soltar acá</div> |
| 164 | </div> | 141 | </div> |
| 165 | </div> | 142 | </div> |
| 166 | </div> | 143 | </div> |
| 167 | </div> | 144 | </div> |
| 168 | </div> | 145 | </div> |
| 169 | 146 |
src/views/foca-modal-cerrar-vehiculo.html
| 1 | <div class="modal-header"> | 1 | <div class="modal-header"> |
| 2 | <h5>En desarrollo</h5> | 2 | <h5>En desarrollo</h5> |
| 3 | <h4>Cerrar distribución vehículo</h4> | 3 | <h4>Cerrar distribución vehículo</h4> |
| 4 | <div class="row"> | 4 | <div class="row"> |
| 5 | <div class="col-6 row"> | 5 | <div class="col-6 row"> |
| 6 | <label class="col-3 mt-2">Fecha:</label> | 6 | <label class="col-3 mt-2">Fecha:</label> |
| 7 | <input | 7 | <input |
| 8 | type="text" | 8 | type="text" |
| 9 | readonly | 9 | readonly |
| 10 | ng-model="now" | 10 | ng-model="now" |
| 11 | uib-datepicker-popup="dd/MM/yyyy" | 11 | uib-datepicker-popup="dd/MM/yyyy" |
| 12 | show-button-bar="false" | 12 | show-button-bar="false" |
| 13 | is-open="datepickerOpen" | 13 | is-open="datepickerOpen" |
| 14 | on-open-focus="false" | 14 | on-open-focus="false" |
| 15 | ng-focus="datepickerOpen = true" | 15 | ng-focus="datepickerOpen = true" |
| 16 | class="form-control col-8"/> | 16 | class="form-control col-8"/> |
| 17 | </div> | 17 | </div> |
| 18 | </div> | 18 | </div> |
| 19 | </div> | 19 | </div> |
| 20 | <div class="modal-body"> | 20 | <div class="modal-body"> |
| 21 | <form class="row" name="formHojaRuta"> | 21 | <form class="row" name="formHojaRuta"> |
| 22 | 22 | ||
| 23 | <div class="col-2"> | 23 | <div class="col-2"> |
| 24 | <label>Transportista</label> | 24 | <label>Transportista</label> |
| 25 | </div> | 25 | </div> |
| 26 | <div class="col-4"> | 26 | <div class="col-4"> |
| 27 | <input | 27 | <input |
| 28 | class="form-control" | 28 | class="form-control" |
| 29 | readonly | 29 | readonly |
| 30 | ng-value="vehiculo.transportista.COD + ' ' + vehiculo.transportista.NOM" | 30 | ng-value="vehiculo.transportista.COD + ' ' + vehiculo.transportista.NOM" |
| 31 | > | 31 | > |
| 32 | </div> | 32 | </div> |
| 33 | <div class="col-2 form-group"> | 33 | <div class="col-2 form-group"> |
| 34 | <label>Unidad</label> | 34 | <label>Unidad</label> |
| 35 | </div> | 35 | </div> |
| 36 | <div class="col-4"> | 36 | <div class="col-4"> |
| 37 | <input | 37 | <input |
| 38 | class="form-control" | 38 | class="form-control" |
| 39 | readonly | 39 | readonly |
| 40 | ng-model="vehiculo.tractor" | 40 | ng-model="vehiculo.tractor" |
| 41 | > | 41 | > |
| 42 | </div> | 42 | </div> |
| 43 | </form> | 43 | </form> |
| 44 | <strong>Remitos:</strong> | 44 | <strong>Remitos:</strong> |
| 45 | <table class="table"> | 45 | <table class="table"> |
| 46 | <thead> | 46 | <thead> |
| 47 | <tr> | 47 | <tr> |
| 48 | <th>Remito Nº</th> | 48 | <th>Remito Nº</th> |
| 49 | <th>Cliente</th> | 49 | <th>Cliente</th> |
| 50 | <th>Domicilio de entrega</th> | 50 | <th>Domicilio de entrega</th> |
| 51 | <th>Eliminar</th> | ||
| 51 | </tr> | 52 | </tr> |
| 52 | </thead> | 53 | </thead> |
| 53 | <tbody> | 54 | <tbody> |
| 54 | <tr ng-show="!remitos.length"> | 55 | <tr ng-show="!remitos.length"> |
| 55 | <td colspan="3"> | 56 | <td colspan="3"> |
| 56 | No se han encontrado remitos. | 57 | No se han encontrado remitos. |
| 57 | </td> | 58 | </td> |
| 58 | </tr> | 59 | </tr> |
| 59 | <tr ng-repeat="remito in remitos"> | 60 | <tr ng-repeat="remito in remitos"> |
| 60 | <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td> | 61 | <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td> |
| 61 | <td ng-bind="remito.nombreCliente"></td> | 62 | <td ng-bind="remito.nombreCliente"></td> |
| 62 | <td ng-bind="remito.domicilioStamp"></td> | 63 | <td ng-bind="remito.domicilioStamp"></td> |
| 63 | <td> | 64 | <td> |
| 64 | <div class="custom-control custom-checkbox"> | 65 | <div class="custom-control custom-checkbox"> |
| 65 | <input | 66 | <input |
| 66 | type="checkbox" | 67 | type="checkbox" |
| 67 | ng-model="remito.checked" | 68 | ng-model="remito.checked" |
| 68 | class="custom-control-input" | 69 | class="custom-control-input" |
| 69 | id="{{remito.id}}"> | 70 | id="{{remito.id}}"> |
| 70 | <label class="custom-control-label" for="{{remito.id}}"></label> | 71 | <label class="custom-control-label" for="{{remito.id}}"></label> |
| 71 | </div> | 72 | </div> |
| 72 | </td> | 73 | </td> |
| 73 | </tr> | 74 | </tr> |
| 74 | </tbody> | 75 | </tbody> |
| 75 | </table> | 76 | </table> |
| 76 | </div> | 77 | </div> |
| 77 | <div class="modal-footer py-1"> | 78 | <div class="modal-footer py-1"> |
| 78 | <button | 79 | <button |
| 79 | class="btn btn-sm btn-danger" | 80 | class="btn btn-sm btn-danger" |
| 80 | type="button" | 81 | type="button" |
| 81 | ng-click="eliminarRemitos()" | 82 | ng-click="eliminarRemitos()" |
| 82 | ng-disabled="minimoUnoChecked()">Eliminar</button> | 83 | ng-disabled="minimoUnoChecked()">Eliminar</button> |
| 83 | <button | 84 | <button |
| 84 | class="btn btn-sm btn-secondary" | 85 | class="btn btn-sm btn-secondary" |
| 85 | ladda="cargando" | 86 | ladda="cargando" |
| 86 | type="button" | 87 | type="button" |
| 87 | ng-click="cancelar()">Cancelar</button> | 88 | ng-click="cancelar()">Cancelar</button> |
| 88 | <button | 89 | <button |
| 89 | class="btn btn-sm btn-primary" | 90 | class="btn btn-sm btn-primary" |
| 90 | ladda="cargando" | 91 | ladda="cargando" |
| 91 | type="button" | 92 | type="button" |
| 92 | ng-disabled="!formHojaRuta.$valid || !remitos.length || true" | 93 | ng-disabled="!formHojaRuta.$valid || !remitos.length" |
| 93 | ng-click="aceptar()">Cerrar distribución</button> | 94 | ng-click="aceptar()">Cerrar distribución</button> |
| 94 | </div> | 95 | </div> |
| 95 | 96 |