Commit 27cba21f09b3cef2ae3c2c9aa532ab94b24b67a5
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !15
Showing
5 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: 'transportista', | 12 | label: 'Unidad', |
| 13 | image: 'abmChofer.png' | 13 | image: 'abmChofer.png' |
| 14 | }; | 14 | }; |
| 15 | $scope.botonera = [transportista]; | 15 | var fecha = { |
| 16 | label: 'Fecha Reparto', | ||
| 17 | image: 'abmChofer.png' | ||
| 18 | }; | ||
| 19 | $scope.botonera = [transportista, fecha]; | ||
| 16 | var cabecera = ''; | 20 | var cabecera = ''; |
| 17 | $scope.now = new Date(); | 21 | $scope.now = new Date(); |
| 18 | $scope.idVendedor = 0; | 22 | $scope.idVendedor = 0; |
| 19 | $scope.marcadores = []; | 23 | $scope.marcadores = []; |
| 20 | $scope.vehiculos = []; | 24 | $scope.vehiculos = []; |
| 21 | getSeguimiento(); | 25 | getSeguimiento(); |
| 22 | $scope.arrastrando = false; | 26 | $scope.arrastrando = false; |
| 23 | $scope.general = function() { | 27 | $scope.general = function() { |
| 24 | $scope.idVendedor = 0; | 28 | $scope.idVendedor = 0; |
| 25 | getSeguimiento(); | 29 | getSeguimiento(); |
| 26 | }; | 30 | }; |
| 27 | 31 | ||
| 28 | //SETEO BOTONERA LATERAL | 32 | //SETEO BOTONERA LATERAL |
| 29 | focaBotoneraLateralService.showSalir(true); | 33 | focaBotoneraLateralService.showSalir(true); |
| 30 | focaBotoneraLateralService.showPausar(false); | 34 | focaBotoneraLateralService.showPausar(false); |
| 31 | focaBotoneraLateralService.showGuardar(false); | 35 | focaBotoneraLateralService.showGuardar(false); |
| 32 | 36 | ||
| 33 | focaLogisticaPedidoRutaService.getVehiculosByIdUsuario().then(function(res) { | 37 | focaLogisticaPedidoRutaService.getVehiculosByIdUsuario().then(function(res) { |
| 34 | $scope.vehiculos = res.data; | 38 | $scope.vehiculos = res.data; |
| 35 | }); | 39 | }); |
| 36 | 40 | ||
| 37 | $scope.general = function() { | 41 | $scope.general = function() { |
| 38 | $scope.idVendedor = 0; | 42 | $scope.idVendedor = 0; |
| 39 | getSeguimiento(); | 43 | getSeguimiento(); |
| 40 | $scope.$broadcast('removeCabecera', cabecera); | 44 | $scope.$broadcast('removeCabecera', cabecera); |
| 41 | $scope.$broadcast('addCabecera',{ | 45 | $scope.$broadcast('addCabecera',{ |
| 42 | label: 'General', | 46 | label: 'General', |
| 43 | valor: '' | 47 | valor: '' |
| 44 | }); | 48 | }); |
| 45 | }; | 49 | }; |
| 46 | 50 | ||
| 47 | $scope.cargar = function(idVehiculo, punto) { | 51 | $scope.cargar = function(idVehiculo, punto) { |
| 48 | var idRemito; | 52 | var idRemito; |
| 49 | if(punto === -1) { | 53 | if(punto === -1) { |
| 50 | idRemito = -1; | 54 | idRemito = -1; |
| 51 | }else { | 55 | }else { |
| 52 | idRemito = JSON.parse(punto).notaPedido.remito.id; | 56 | idRemito = JSON.parse(punto).notaPedido.remito.id; |
| 53 | } | 57 | } |
| 54 | var modalInstance = $uibModal.open( | 58 | var modalInstance = $uibModal.open( |
| 55 | { | 59 | { |
| 56 | ariaLabelledBy: 'Busqueda de Vehiculo', | 60 | ariaLabelledBy: 'Busqueda de Vehiculo', |
| 57 | templateUrl: 'foca-detalle-vehiculo.html', | 61 | templateUrl: 'foca-detalle-vehiculo.html', |
| 58 | controller: 'focaDetalleVehiculo', | 62 | controller: 'focaDetalleVehiculo', |
| 59 | size: 'lg', | 63 | size: 'lg', |
| 60 | resolve: { | 64 | resolve: { |
| 61 | idVehiculo: function() {return idVehiculo;}, | 65 | idVehiculo: function() {return idVehiculo;}, |
| 62 | idRemito: function() {return idRemito;} | 66 | idRemito: function() {return idRemito;} |
| 63 | } | 67 | } |
| 64 | } | 68 | } |
| 65 | ); | 69 | ); |
| 66 | modalInstance.result.then(function() { | 70 | modalInstance.result.then(function() { |
| 67 | }, function() { | 71 | }, function() { |
| 68 | }); | 72 | }); |
| 69 | }; | 73 | }; |
| 70 | 74 | ||
| 71 | $scope.quitarVehiculo = function(vehiculo) { | 75 | $scope.quitarVehiculo = function(vehiculo) { |
| 72 | focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + | 76 | focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + |
| 73 | vehiculo.codigo + '?').then(function() { | 77 | vehiculo.codigo + '?').then(function() { |
| 74 | eliminarVehiculo(vehiculo); | 78 | eliminarVehiculo(vehiculo); |
| 75 | }); | 79 | }); |
| 76 | }; | 80 | }; |
| 77 | 81 | ||
| 78 | $scope.hacerHojaRuta = function(vehiculo) { | 82 | $scope.hacerHojaRuta = function(vehiculo) { |
| 79 | var modalInstance = $uibModal.open( | 83 | var modalInstance = $uibModal.open( |
| 80 | { | 84 | { |
| 81 | ariaLabelledBy: 'Creación hoja ruta', | 85 | ariaLabelledBy: 'Creación hoja ruta', |
| 82 | templateUrl: 'foca-modal-crear-hoja-ruta.html', | 86 | templateUrl: 'foca-modal-crear-hoja-ruta.html', |
| 83 | controller: 'focaModalCrearHojaRuta', | 87 | controller: 'focaModalCrearHojaRuta', |
| 84 | size: 'lg', | 88 | size: 'lg', |
| 85 | resolve: { | 89 | resolve: { |
| 86 | idVehiculo: function() {return vehiculo.id;} | 90 | idVehiculo: function() {return vehiculo.id;} |
| 87 | } | 91 | } |
| 88 | } | 92 | } |
| 89 | ); | 93 | ); |
| 90 | modalInstance.result.then(function() { | 94 | modalInstance.result.then(function() { |
| 91 | 95 | ||
| 92 | }, function() { | 96 | }, function() { |
| 93 | //usar cuando se cancela el modal | 97 | //usar cuando se cancela el modal |
| 94 | }); | 98 | }); |
| 95 | }; | 99 | }; |
| 96 | 100 | ||
| 97 | $scope.arrastra = function() { | 101 | $scope.arrastra = function() { |
| 98 | $scope.arrastrando = true; | 102 | $scope.arrastrando = true; |
| 99 | $scope.$digest(); | 103 | $scope.$digest(); |
| 100 | }; | 104 | }; |
| 101 | 105 | ||
| 102 | $scope.noArrastra = function() { | 106 | $scope.noArrastra = function() { |
| 103 | $scope.arrastrando = false; | 107 | $scope.arrastrando = false; |
| 104 | $scope.$digest(); | 108 | $scope.$digest(); |
| 105 | }; | 109 | }; |
| 106 | 110 | ||
| 107 | $scope.individual = function() { | 111 | $scope.individual = function() { |
| 108 | $scope.idVendedor = -1; | 112 | $scope.idVendedor = -1; |
| 109 | }; | 113 | }; |
| 110 | 114 | ||
| 111 | $scope.mostrarDetalle = function() { | 115 | $scope.mostrarDetalle = function() { |
| 112 | $scope.detalle = true; | 116 | $scope.detalle = true; |
| 113 | }; | 117 | }; |
| 114 | 118 | ||
| 115 | $scope.salir = function() { | 119 | $scope.salir = function() { |
| 116 | $location.path('/'); | 120 | $location.path('/'); |
| 117 | }; | 121 | }; |
| 118 | 122 | ||
| 119 | $scope.search = function() { | 123 | $scope.search = function() { |
| 120 | getSeguimiento(); | 124 | getSeguimiento(); |
| 121 | }; | 125 | }; |
| 122 | 126 | ||
| 123 | $scope.fecha = function() { | 127 | $scope.fecha = function() { |
| 124 | getSeguimiento(); | 128 | getSeguimiento(); |
| 125 | }; | 129 | }; |
| 126 | 130 | ||
| 127 | $scope.seleccionarTransportista = function() { | 131 | $scope.seleccionarUnidad = function() { |
| 128 | var modalInstance = $uibModal.open( | 132 | var modalInstance = $uibModal.open( |
| 129 | { | 133 | { |
| 130 | ariaLabelledBy: 'Busqueda de Transportista', | 134 | ariaLabelledBy: 'Busqueda de Transportista', |
| 131 | templateUrl: 'modal-proveedor.html', | 135 | templateUrl: 'modal-proveedor.html', |
| 132 | controller: 'focaModalProveedorCtrl', | 136 | controller: 'focaModalProveedorCtrl', |
| 133 | size: 'lg', | 137 | size: 'lg', |
| 134 | resolve: { | 138 | resolve: { |
| 135 | transportista: function() { | 139 | transportista: function() { |
| 136 | return true; | 140 | return true; |
| 137 | } | 141 | } |
| 138 | } | 142 | } |
| 139 | } | 143 | } |
| 140 | ); | 144 | ); |
| 141 | modalInstance.result.then(function(transportista) { | 145 | modalInstance.result.then(function(transportista) { |
| 142 | $scope.seleccionarVehiculo(transportista.COD); | 146 | $scope.seleccionarVehiculo(transportista.COD); |
| 143 | }); | 147 | }); |
| 144 | }; | 148 | }; |
| 145 | 149 | ||
| 146 | $scope.seleccionarVehiculo = function(idTransportista) { | 150 | $scope.seleccionarVehiculo = function(idTransportista) { |
| 147 | var query = '/vehiculo/transportista/' + idTransportista; | 151 | var query = '/vehiculo/transportista/' + idTransportista; |
| 148 | var columnas = { | 152 | var columnas = { |
| 149 | nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], | 153 | nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], |
| 150 | propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] | 154 | propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] |
| 151 | }; | 155 | }; |
| 152 | var titulo = 'Búsqueda de vehiculos'; | 156 | var titulo = 'Búsqueda de vehiculos'; |
| 153 | focaModalService.modal(columnas, query, titulo).then( | 157 | focaModalService.modal(columnas, query, titulo).then( |
| 154 | function(vehiculo) { | 158 | function(vehiculo) { |
| 155 | var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); | 159 | var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); |
| 156 | if(existe.length) { | 160 | if(existe.length) { |
| 157 | focaModalService.alert('El vehiculo ya ha sido cargado'); | 161 | focaModalService.alert('El vehiculo ya ha sido cargado'); |
| 158 | return; | 162 | return; |
| 159 | } | 163 | } |
| 160 | if(!vehiculo.cisternas.length) { | 164 | if(!vehiculo.cisternas.length) { |
| 161 | focaModalService.alert('El vehiculo no tiene cisternas'); | 165 | focaModalService.alert('El vehiculo no tiene cisternas'); |
| 162 | return; | 166 | return; |
| 163 | } | 167 | } |
| 164 | $scope.vehiculos.push(vehiculo); | 168 | $scope.vehiculos.push(vehiculo); |
| 165 | }, function() { | 169 | }, function() { |
| 166 | // funcion ejecutada cuando se cancela el modal | 170 | // funcion ejecutada cuando se cancela el modal |
| 167 | }); | 171 | }); |
| 168 | }; | 172 | }; |
| 169 | 173 | ||
| 174 | $scope.seleccionarFechaReparto = function() { | ||
| 175 | focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { | ||
| 176 | $scope.$broadcast('addCabecera',{ | ||
| 177 | label: 'Fecha:', | ||
| 178 | valor: fecha.toLocaleDateString() | ||
| 179 | }); | ||
| 180 | }); | ||
| 181 | }; | ||
| 182 | |||
| 170 | function getSeguimiento() { | 183 | function getSeguimiento() { |
| 171 | var desde = new Date('1900/01/01'); | 184 | var desde = new Date('1900/01/01'); |
| 172 | var hasta = new Date('2099/01/01'); | 185 | var hasta = new Date('2099/01/01'); |
| 173 | if($scope.fechaDesde) { | 186 | if($scope.fechaDesde) { |
| 174 | var fechaDesde = $scope.fechaDesde; | 187 | var fechaDesde = $scope.fechaDesde; |
| 175 | desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); | 188 | desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); |
| 176 | desde = new Date(desde); | 189 | desde = new Date(desde); |
| 177 | } | 190 | } |
| 178 | if($scope.fechaHasta) { | 191 | if($scope.fechaHasta) { |
| 179 | var fechaHasta = $scope.fechaHasta; | 192 | var fechaHasta = $scope.fechaHasta; |
| 180 | hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); | 193 | hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); |
| 181 | hasta = hasta.setDate(hasta.getDate() + 1); | 194 | hasta = hasta.setDate(hasta.getDate() + 1); |
| 182 | hasta = new Date(hasta); | 195 | hasta = new Date(hasta); |
| 183 | } | 196 | } |
| 184 | var datos = { | 197 | var datos = { |
| 185 | actividad: $scope.actividad, | 198 | actividad: $scope.actividad, |
| 186 | idUsuario: $scope.idVendedor, | 199 | idUsuario: $scope.idVendedor, |
| 187 | fechaDesde: desde, | 200 | fechaDesde: desde, |
| 188 | fechaHasta: hasta, | 201 | fechaHasta: hasta, |
| 189 | asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? | 202 | asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? |
| 190 | false : undefined) | 203 | false : undefined) |
| 191 | }; | 204 | }; |
| 192 | 205 | ||
| 193 | $scope.datosBuscados = { | 206 | $scope.datosBuscados = { |
| 194 | actividad: $scope.actividad, | 207 | actividad: $scope.actividad, |
| 195 | individual: $scope.idVendedor ? true : false | 208 | individual: $scope.idVendedor ? true : false |
| 196 | }; | 209 | }; |
| 197 | 210 | ||
| 198 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { | 211 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { |
| 199 | if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { | 212 | if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { |
| 200 | $scope.marcadores = datos.data; | 213 | $scope.marcadores = datos.data; |
| 201 | } | 214 | } |
| 202 | }); | 215 | }); |
| 203 | } | 216 | } |
| 204 | 217 | ||
| 205 | function eliminarVehiculo(vehiculo) { | 218 | function eliminarVehiculo(vehiculo) { |
| 206 | focaLogisticaPedidoRutaService.getRemitos(vehiculo.id).then(function(res) { | 219 | focaLogisticaPedidoRutaService.getRemitos(vehiculo.id).then(function(res) { |
| 207 | if(!focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data).length) { | 220 | if(!focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data).length) { |
| 208 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | 221 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
| 209 | }else { | 222 | }else { |
| 210 | focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + | 223 | focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + |
| 211 | 'tiene remitos asociados').then(function() { | 224 | 'tiene remitos asociados').then(function() { |
| 212 | $scope.hacerHojaRuta(vehiculo); | 225 | $scope.hacerHojaRuta(vehiculo); |
| 213 | }); | 226 | }); |
| 214 | } | 227 | } |
| 215 | }); | 228 | }); |
| 216 | } | 229 | } |
| 217 | $interval(function() { | 230 | $interval(function() { |
| 218 | getSeguimiento(); | 231 | getSeguimiento(); |
| 219 | }, 5000); | 232 | }, 5000); |
| 220 | } | 233 | } |
| 221 | ]); | 234 | ]); |
| 222 | 235 |
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.idRemito = idRemito; | 15 | $scope.idRemito = idRemito; |
| 15 | $scope.articulos = []; | 16 | $scope.articulos = []; |
| 16 | $scope.vehiculo = {}; | 17 | $scope.vehiculo = {}; |
| 17 | $scope.remito = {}; | 18 | $scope.remito = {}; |
| 18 | $scope.aCargar = []; | 19 | $scope.aCargar = []; |
| 19 | var cisternaMovimientos = []; | 20 | var cisternaMovimientos = []; |
| 20 | focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then( | 21 | var promesaVehiculo = focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo); |
| 21 | function(res) { | 22 | var promesaRemito; |
| 22 | $scope.vehiculo = res.data; | ||
| 23 | } | ||
| 24 | ); | ||
| 25 | if(idRemito !== -1) { | 23 | if(idRemito !== -1) { |
| 26 | focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito).then( | 24 | promesaRemito = focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito); |
| 27 | function(res) { | ||
| 28 | $scope.remito = res.data; | ||
| 29 | if($scope.remito.idUsuarioProceso) { | ||
| 30 | focaModalService.alert('Remito ya asignado'); | ||
| 31 | $uibModalInstance.close(); | ||
| 32 | } | ||
| 33 | $scope.articulos = res.data.articulosRemito; | ||
| 34 | $scope.cambioArticulo($scope.articulos[0]); | ||
| 35 | } | ||
| 36 | ); | ||
| 37 | } | 25 | } |
| 26 | Promise.all([promesaVehiculo, promesaRemito]).then(function(res) { | ||
| 27 | $scope.cargandoDatos = false; | ||
| 28 | $scope.vehiculo = res[0].data; | ||
| 29 | if(!res[1]) return; | ||
| 30 | $scope.remito = res[1].data; | ||
| 31 | if($scope.remito.idUsuarioProceso) { | ||
| 32 | focaModalService.alert('Remito ya asignado'); | ||
| 33 | $uibModalInstance.close(); | ||
| 34 | } | ||
| 35 | $scope.articulos = $scope.remito.articulosRemito; | ||
| 36 | $scope.cambioArticulo($scope.articulos[0]); | ||
| 37 | }); | ||
| 38 | $scope.aceptar = function() { | 38 | $scope.aceptar = function() { |
| 39 | $scope.cargando = true; | 39 | $scope.cargando = true; |
| 40 | var cisternaCargas = []; | 40 | var cisternaCargas = []; |
| 41 | for (var i = 0; i < $scope.vehiculo.cisternas.length; i++) { | 41 | for (var i = 0; i < $scope.vehiculo.cisternas.length; i++) { |
| 42 | delete $scope.vehiculo.cisternas[i].cisternaCarga.articulo; | 42 | delete $scope.vehiculo.cisternas[i].cisternaCarga.articulo; |
| 43 | cisternaCargas.push($scope.vehiculo.cisternas[i].cisternaCarga); | 43 | cisternaCargas.push($scope.vehiculo.cisternas[i].cisternaCarga); |
| 44 | } | 44 | } |
| 45 | var cisterna = { | 45 | var cisterna = { |
| 46 | cisternaMovimientos: cisternaMovimientos, | 46 | cisternaMovimientos: cisternaMovimientos, |
| 47 | cisternaCargas: cisternaCargas, | 47 | cisternaCargas: cisternaCargas, |
| 48 | idVehiculo: $scope.vehiculo.id | 48 | idVehiculo: $scope.vehiculo.id |
| 49 | }; | 49 | }; |
| 50 | focaLogisticaPedidoRutaService.guardarCisternas(cisterna, $scope.remito.id) | 50 | focaLogisticaPedidoRutaService.guardarCisternas(cisterna, $scope.remito.id) |
| 51 | .then(function() { | 51 | .then(function() { |
| 52 | focaModalService.alert('Cisternas cargadas con éxito').then(function() { | 52 | focaModalService.alert('Cisternas cargadas con éxito').then(function() { |
| 53 | $scope.cargando = false; | 53 | $scope.cargando = false; |
| 54 | $uibModalInstance.close(); | 54 | $uibModalInstance.close(); |
| 55 | }); | 55 | }); |
| 56 | }).catch(function(error) { | 56 | }).catch(function(error) { |
| 57 | $scope.cargando = false; | 57 | $scope.cargando = false; |
| 58 | $uibModalInstance.close(); | 58 | $uibModalInstance.close(); |
| 59 | if (error.status === 403.1) { | 59 | if (error.status === 403.1) { |
| 60 | focaModalService.alert('ERROR: El vehículo esta en uso'); | 60 | focaModalService.alert('ERROR: El vehículo esta en uso'); |
| 61 | } | 61 | } |
| 62 | if(error.status === 403.2) { | 62 | if(error.status === 403.2) { |
| 63 | focaModalService.alert('ERROR: Otro usario ya cargó este remito'); | 63 | focaModalService.alert('ERROR: Otro usario ya cargó este remito'); |
| 64 | return; | 64 | return; |
| 65 | } | 65 | } |
| 66 | focaModalService.alert('Hubo un error al cargar las cisternas'); | 66 | focaModalService.alert('Hubo un error al cargar las cisternas'); |
| 67 | }); | 67 | }); |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | $scope.cancelar = function() { | 70 | $scope.cancelar = function() { |
| 71 | $uibModalInstance.close(); | 71 | $uibModalInstance.close(); |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | $scope.cargarACisternas = function(vehiculo) { | 74 | $scope.cargarACisternas = function(vehiculo) { |
| 75 | for(var i = 0; i < vehiculo.cisternas.length; i++) { | 75 | for(var i = 0; i < vehiculo.cisternas.length; i++) { |
| 76 | var cisterna = vehiculo.cisternas[i]; | 76 | var cisterna = vehiculo.cisternas[i]; |
| 77 | var aCargar = parseFloat($scope.aCargar[i]); | 77 | var aCargar = parseFloat($scope.aCargar[i]); |
| 78 | //validaciones | 78 | //validaciones |
| 79 | if(!aCargar) { | 79 | if(!aCargar) { |
| 80 | continue; | 80 | continue; |
| 81 | } | 81 | } |
| 82 | if(aCargar > cisterna.disponible) { | 82 | if(aCargar > cisterna.disponible) { |
| 83 | focaModalService.alert('La cantidad cargada supera la capacidad de la' + | 83 | focaModalService.alert('La cantidad cargada supera la capacidad de la' + |
| 84 | 'cisterna ' + cisterna.codigo); | 84 | 'cisterna ' + cisterna.codigo); |
| 85 | return; | 85 | return; |
| 86 | } | 86 | } |
| 87 | //cargar | 87 | //cargar |
| 88 | if(cisterna.cisternaCarga.cantidad) { | 88 | if(cisterna.cisternaCarga.cantidad) { |
| 89 | cisterna.cisternaCarga.cantidad += aCargar; | 89 | cisterna.cisternaCarga.cantidad += aCargar; |
| 90 | }else { | 90 | }else { |
| 91 | cisterna.cisternaCarga.cantidad = aCargar; | 91 | cisterna.cisternaCarga.cantidad = aCargar; |
| 92 | cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo; | 92 | cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo; |
| 93 | } | 93 | } |
| 94 | cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad; | 94 | cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad; |
| 95 | 95 | ||
| 96 | cisterna.cisternaCarga.articulo = { | 96 | cisterna.cisternaCarga.articulo = { |
| 97 | DetArt: $scope.articuloSeleccionado.descripcion | 97 | DetArt: $scope.articuloSeleccionado.descripcion |
| 98 | }; | 98 | }; |
| 99 | $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0] | 99 | $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0] |
| 100 | .cargado = true; | 100 | .cargado = true; |
| 101 | 101 | ||
| 102 | $scope.calcularPorcentaje(cisterna); | 102 | $scope.calcularPorcentaje(cisterna); |
| 103 | //Guardar | 103 | //Guardar |
| 104 | var now = new Date(); | 104 | var now = new Date(); |
| 105 | var cisternaMovimiento = { | 105 | var cisternaMovimiento = { |
| 106 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), | 106 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), |
| 107 | cantidad: aCargar, | 107 | cantidad: aCargar, |
| 108 | metodo: 'carga', | 108 | metodo: 'carga', |
| 109 | idCisternaCarga: cisterna.cisternaCarga.id, | 109 | idCisternaCarga: cisterna.cisternaCarga.id, |
| 110 | idRemito: $scope.remito.id | 110 | idRemito: $scope.remito.id |
| 111 | }; | 111 | }; |
| 112 | cisternaMovimientos.push(cisternaMovimiento); | 112 | cisternaMovimientos.push(cisternaMovimiento); |
| 113 | } | 113 | } |
| 114 | var articuloSiguiente = $scope.articulos.filter( | 114 | var articuloSiguiente = $scope.articulos.filter( |
| 115 | function(filter) { | 115 | function(filter) { |
| 116 | return filter.cargado !== true; | 116 | return filter.cargado !== true; |
| 117 | } | 117 | } |
| 118 | ); | 118 | ); |
| 119 | if(articuloSiguiente.length > 0) { | 119 | if(articuloSiguiente.length > 0) { |
| 120 | $scope.cambioArticulo(articuloSiguiente[0]); | 120 | $scope.cambioArticulo(articuloSiguiente[0]); |
| 121 | } | 121 | } |
| 122 | $scope.aCargar = []; | 122 | $scope.aCargar = []; |
| 123 | }; | 123 | }; |
| 124 | $scope.calcularPorcentaje = function(cisterna) { | 124 | $scope.calcularPorcentaje = function(cisterna) { |
| 125 | if(!cisterna.cisternaCarga.cantidad) { | 125 | if(!cisterna.cisternaCarga.cantidad) { |
| 126 | cisterna.cisternaCarga.cantidad = 0; | 126 | cisterna.cisternaCarga.cantidad = 0; |
| 127 | } | 127 | } |
| 128 | var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / | 128 | var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / |
| 129 | cisterna.capacidad) + '%'; | 129 | cisterna.capacidad) + '%'; |
| 130 | var elementHtml = document.getElementById(cisterna.id); | 130 | var elementHtml = document.getElementById(cisterna.id); |
| 131 | if(elementHtml) { | 131 | if(elementHtml) { |
| 132 | elementHtml.style.width = porcentaje; | 132 | elementHtml.style.width = porcentaje; |
| 133 | } | 133 | } |
| 134 | }; | 134 | }; |
| 135 | $scope.cambioArticulo = function(articulo) { | 135 | $scope.cambioArticulo = function(articulo) { |
| 136 | articulo.checked = true; | 136 | $scope.aCargar = []; |
| 137 | $filter('filter')($scope.articulos, {id: articulo.id})[0].checked = true; | ||
| 137 | $scope.articuloSeleccionado = articulo; | 138 | $scope.articuloSeleccionado = articulo; |
| 139 | for(var i = 0; i < $scope.vehiculo.cisternas.length; i++) { | ||
| 140 | $scope.vehiculo.cisternas[i] = | ||
| 141 | $scope.cisternaDisabled($scope.vehiculo.cisternas[i]); | ||
| 142 | } | ||
| 143 | var disponible = $filter('filter')($scope.vehiculo.cisternas, {disabled: false}); | ||
| 144 | var index = $scope.vehiculo.cisternas.indexOf(disponible[0]); | ||
| 145 | $scope.aCargar[index] = $scope.articuloSeleccionado.cantidad; | ||
| 146 | $scope.actualizarArticulo(); | ||
| 138 | }; | 147 | }; |
| 139 | $scope.actualizarArticulo = function () { | 148 | $scope.actualizarArticulo = function () { |
| 140 | $scope.articuloSeleccionado.cantidadCargada = 0; | 149 | $scope.articuloSeleccionado.cantidadCargada = 0; |
| 141 | for (var i = 0; i < $scope.aCargar.length; i++) { | 150 | for (var i = 0; i < $scope.aCargar.length; i++) { |
| 142 | $scope.articuloSeleccionado.cantidadCargada += | 151 | $scope.articuloSeleccionado.cantidadCargada += |
| 143 | parseFloat($scope.aCargar[i]) || 0; | 152 | parseFloat($scope.aCargar[i]) || 0; |
| 144 | } | 153 | } |
| 145 | }; | 154 | }; |
| 155 | $scope.cisternaDisabled = function(cisterna) { | ||
| 156 | if(!$scope.articuloSeleccionado || ($scope.articuloSeleccionado.idArticulo !== | ||
| 157 | cisterna.cisternaCarga.idProducto && cisterna.cisternaCarga.idProducto) || | ||
| 158 | !$scope.tieneArticulosPendientes()|| $scope.articuloSeleccionado.cantidad > | ||
| 159 | cisterna.disponible) { | ||
| 160 | cisterna.disabled = true; | ||
| 161 | }else { | ||
| 162 | cisterna.disabled = false; | ||
| 163 | } | ||
| 164 | return cisterna; | ||
| 165 | }; | ||
| 166 | $scope.rellenarInput = function(input = 0) { | ||
| 167 | if(!$scope.articuloSeleccionado) return; | ||
| 168 | input = parseFloat(input); | ||
| 169 | if(input === $scope.articuloSeleccionado.cantidad || | ||
| 170 | $scope.articuloSeleccionado.cantidad - | ||
| 171 | $scope.articuloSeleccionado.cantidadCargada === 0) { | ||
| 172 | return input; | ||
| 173 | } | ||
| 174 | input += parseFloat($scope.articuloSeleccionado.cantidad - | ||
| 175 | $scope.articuloSeleccionado.cantidadCargada); | ||
| 176 | return input; | ||
| 177 | }; | ||
| 178 | $scope.distribucionDisponible = function() { | ||
| 179 | if(!$scope.articuloSeleccionado || $scope.articuloSeleccionado.cantidad - | ||
| 180 | $scope.articuloSeleccionado.cantidadCargada !== 0 || | ||
| 181 | !$scope.tieneArticulosPendientes()) { | ||
| 182 | return false; | ||
| 183 | } | ||
| 184 | return true; | ||
| 185 | }; | ||
| 146 | $scope.tieneArticulosPendientes = function() { | 186 | $scope.tieneArticulosPendientes = function() { |
| 187 | var algunValorNegativo = $scope.aCargar.filter(function(p) { | ||
| 188 | return p < 0; | ||
| 189 | }); |
src/js/osm-directive.js
| 1 | angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', function() { | 1 | angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', function() { |
| 2 | return { | 2 | return { |
| 3 | restrict: 'E', | 3 | restrict: 'E', |
| 4 | link: function(scope, el, attrs) { | 4 | link: function(scope, el, attrs) { |
| 5 | var contenedor = document.createElement('div'); | 5 | var contenedor = document.createElement('div'); |
| 6 | contenedor.className = 'border border-light rounded'; | 6 | contenedor.className = 'border border-light rounded'; |
| 7 | el.append(contenedor); | 7 | el.append(contenedor); |
| 8 | scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom); | 8 | scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom); |
| 9 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); | 9 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); |
| 10 | }, | 10 | }, |
| 11 | controller: ['$scope', '$filter', function($scope, $filter) { | 11 | controller: ['$scope', '$filter', function($scope, $filter) { |
| 12 | $scope.markers = []; | 12 | $scope.markers = []; |
| 13 | $scope.$watch('marcadores', function() { | 13 | $scope.$watch('marcadores', function() { |
| 14 | for(var i in $scope.markers) { | 14 | for(var i in $scope.markers) { |
| 15 | $scope.map.removeLayer($scope.markers[i]); | 15 | $scope.map.removeLayer($scope.markers[i]); |
| 16 | } | 16 | } |
| 17 | $scope.markers = []; | 17 | $scope.markers = []; |
| 18 | 18 | ||
| 19 | angular.forEach($scope.marcadores, function(marcador) { | 19 | angular.forEach($scope.marcadores, function(marcador) { |
| 20 | var observacion = | 20 | var observacion = |
| 21 | 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' + | 21 | 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' + |
| 22 | ( | 22 | ( |
| 23 | marcador.notaPedido.vendedor ? | 23 | marcador.notaPedido.vendedor ? |
| 24 | marcador.notaPedido.vendedor.NomVen : | 24 | marcador.notaPedido.vendedor.NomVen : |
| 25 | '' | 25 | '' |
| 26 | ) + '<br/>'; | 26 | ) + '<br/>'; |
| 27 | observacion += 'Fecha: ' + | 27 | observacion += 'Fecha: ' + |
| 28 | $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + | 28 | $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + |
| 29 | marcador.fecha.slice(11,19) + '<br/>'; | 29 | marcador.fecha.slice(11,19) + '<br/>'; |
| 30 | observacion += 'Remito Nº: ' + $filter('comprobante')([ | 30 | observacion += 'Remito Nº: ' + $filter('comprobante')([ |
| 31 | marcador.notaPedido.remito.sucursal, | 31 | marcador.notaPedido.remito.sucursal, |
| 32 | marcador.notaPedido.remito.numeroRemito | 32 | marcador.notaPedido.remito.numeroRemito |
| 33 | ]) + '<br/>'; | 33 | ]) + '<br/>'; |
| 34 | observacion += 'Cliente: ' + | 34 | observacion += 'Cliente: ' + |
| 35 | marcador.notaPedido.cliente.NOM + '<br/>'; | 35 | marcador.notaPedido.cliente.NOM + '<br/>'; |
| 36 | 36 | ||
| 37 | // if($scope.parametros.individual) { | 37 | // if($scope.parametros.individual) { |
| 38 | observacion += | 38 | observacion += |
| 39 | 'Total: ' + $filter('currency')(marcador.notaPedido.remito.total, '$'); | 39 | 'Total: ' + $filter('currency')(marcador.notaPedido.remito.total, '$'); |
| 40 | observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion; | 40 | observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion; |
| 41 | 41 | ||
| 42 | if(marcador.distancia) { | 42 | if(marcador.distancia) { |
| 43 | observacion += '<br/>Distancia a casa central: ' + | 43 | observacion += '<br/>Distancia a casa central: ' + |
| 44 | marcador.distancia + 'km'; | 44 | marcador.distancia + 'km'; |
| 45 | } | 45 | } |
| 46 | observacion += '<br/>'; | 46 | observacion += '<br/>'; |
| 47 | observacion += '<i class="fa fa-map-marker fa-3x" aria-hidden="true"'+ | 47 | observacion += '<i class="fa fa-map-marker fa-3x" aria-hidden="true"'+ |
| 48 | 'class="form-control" ondragend="dropEnd()" ondragstart=\'drag(event, '+ | 48 | 'class="form-control" ondragend="dropEnd()" ondragstart=\'drag(event, '+ |
| 49 | JSON.stringify(marcador)+')\' draggable="true"></i>(Arrastrar icono)'; | 49 | JSON.stringify(marcador)+')\' draggable="true"></i>(Arrastrar icono)'; |
| 50 | var icon; | 50 | var icon; |
| 51 | if(marcador.notaPedido.remito.idUsuarioProceso) { | 51 | if(marcador.notaPedido.remito.idUsuarioProceso) { |
| 52 | //Asignado ROJO | 52 | //Asignado ROJO |
| 53 | icon = new L.Icon({ | 53 | icon = new L.Icon({ |
| 54 | iconUrl: 'img/marker-icon-2x-red.png', | 54 | iconUrl: 'img/marker-icon-2x-red.png', |
| 55 | shadowUrl: 'img/marker-shadow.png', | 55 | shadowUrl: 'img/marker-shadow.png', |
| 56 | iconSize: [25, 41], | 56 | iconSize: [25, 41], |
| 57 | iconAnchor: [12, 41], | 57 | iconAnchor: [12, 41], |
| 58 | popupAnchor: [1, -34], | 58 | popupAnchor: [1, -34], |
| 59 | shadowSize: [41, 41] | 59 | shadowSize: [41, 41] |
| 60 | }); | 60 | }); |
| 61 | }else { | 61 | }else { |
| 62 | //Sin asignar VERDE | 62 | //Sin asignar VERDE |
| 63 | icon = new L.Icon({ | 63 | icon = new L.Icon({ |
| 64 | iconUrl: 'img/marker-icon-2x-green.png', | 64 | iconUrl: 'img/marker-icon-2x-green.png', |
| 65 | shadowUrl: 'img/marker-shadow.png', | 65 | shadowUrl: 'img/marker-shadow.png', |
| 66 | iconSize: [25, 41], | 66 | iconSize: [25, 41], |
| 67 | iconAnchor: [12, 41], | 67 | iconAnchor: [12, 41], |
| 68 | popupAnchor: [1, -34], | 68 | popupAnchor: [1, -34], |
| 69 | shadowSize: [41, 41] | 69 | shadowSize: [41, 41] |
| 70 | }); | 70 | }); |
| 71 | } | 71 | } |
| 72 | $scope.markers.push( | 72 | $scope.markers.push( |
| 73 | L.marker([marcador.latitud, marcador.longitud], {icon: icon}) | 73 | L.marker([marcador.latitud, marcador.longitud], {icon: icon}) |
| 74 | .addTo($scope.map) | 74 | .addTo($scope.map) |
| 75 | .bindPopup(observacion) | 75 | .bindPopup(observacion) |
| 76 | ); | 76 | ); |
| 77 | 77 | //abre marcador del primer punto | |
| 78 | $scope.markers[0].openPopup(); | 78 | //$scope.markers[0].openPopup(); |
| 79 | }); | 79 | }); |
| 80 | }); | 80 | }); |
| 81 | }], | 81 | }], |
| 82 | scope: { | 82 | scope: { |
| 83 | latitud: '=', | 83 | latitud: '=', |
| 84 | longitud: '=', | 84 | longitud: '=', |
| 85 | zoom: '=', | 85 | zoom: '=', |
| 86 | marcadores: '=', | 86 | marcadores: '=', |
| 87 | parametros: '=' | 87 | parametros: '=' |
| 88 | } | 88 | } |
| 89 | }; | 89 | }; |
| 90 | }); | 90 | }); |
| 91 | 91 |
src/views/foca-detalle-vehiculo.html
| 1 | <div class="modal-header"> | 1 | <div class="modal-header"> |
| 2 | <h4>Detalle de carga</h4> | 2 | <h4>Detalle de carga</h4> |
| 3 | Transportista <strong ng-bind="vehiculo.transportista.NOM"></strong> | 3 | Transportista |
| 4 | <strong ng-bind="vehiculo.transportista.COD"></strong> | ||
| 5 | <strong ng-bind="vehiculo.transportista.NOM"></strong> | ||
| 4 | Unidad <strong ng-bind="vehiculo.codigo"></strong> | 6 | Unidad <strong ng-bind="vehiculo.codigo"></strong> |
| 5 | Tractor <strong ng-bind="vehiculo.tractor"></strong> | 7 | Tractor <strong ng-bind="vehiculo.tractor"></strong> |
| 6 | <br> | 8 | <br> |
| 7 | <div ng-show="idRemito !== -1"> | 9 | <div ng-show="idRemito !== -1"> |
| 8 | <span>Remito Nº</span> | 10 | <span>Remito Nº</span> |
| 9 | <strong ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></strong> | 11 | <strong ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></strong> |
| 10 | <span>, Fecha</span> | 12 | <span>, Fecha</span> |
| 11 | <strong ng-bind="remito.fechaRemito | date: 'dd/MM/yyyy HH:mm'"></strong> | 13 | <strong ng-bind="remito.fechaRemito | date: 'dd/MM/yyyy HH:mm'"></strong> |
| 12 | <span>, Cliente</span> | 14 | <span>, Cliente</span> |
| 13 | <strong ng-bind="remito.nombreCliente"></strong> | 15 | <strong ng-bind="remito.nombreCliente"></strong> |
| 14 | <span>, Domicilio entrega</span> | 16 | <span>, Domicilio entrega</span> |
| 15 | <strong ng-bind="remito.domicilioStamp"></strong> | 17 | <strong ng-bind="remito.domicilioStamp"></strong> |
| 16 | </div> | 18 | </div> |
| 17 | </div> | 19 | </div> |
| 18 | <div class="modal-body"> | 20 | <div class="modal-body"> |
| 19 | <div> | 21 | <div> |
| 20 | <table class="table table-sm" ng-show="idRemito !== -1"> | 22 | <table class="table table-sm" ng-show="idRemito !== -1"> |
| 21 | <thead> | 23 | <thead> |
| 22 | <tr> | 24 | <tr> |
| 23 | <th></th> | 25 | <th></th> |
| 24 | <th>Articulo</th> | 26 | <th>Articulo</th> |
| 25 | <th>Total</th> | 27 | <th>Cantidad</th> |
| 26 | <th>Cargado</th> | 28 | <th>Cargado</th> |
| 27 | <th>Pendiente</th> | 29 | <th>Resta asignar</th> |
| 28 | </tr> | 30 | </tr> |
| 29 | </thead> | 31 | </thead> |
| 30 | <tbody> | 32 | <tbody> |
| 31 | <tr ng-repeat="(key, articulo) in articulos"> | 33 | <tr ng-repeat="(key, articulo) in articulos"> |
| 32 | <td><input | 34 | <td><input |
| 33 | type="radio" | 35 | type="radio" |
| 34 | name="articuloRadio" | 36 | name="articuloRadio" |
| 35 | id="{{'articulo' + articulo.id}}" | 37 | id="{{'articulo' + articulo.id}}" |
| 36 | ng-checked="articulo.checked" | 38 | ng-checked="articulo.checked" |
| 37 | ng-disabled="articulo.cargado" | 39 | ng-disabled="articulo.cargado" |
| 38 | ng-click="cambioArticulo(articulo)" | 40 | ng-click="cambioArticulo(articulo)" |
| 39 | ></td> | 41 | ></td> |
| 40 | <td ng-bind="articulo.descripcion"></td> | 42 | <td ng-bind="articulo.descripcion"></td> |
| 41 | <td ng-bind="articulo.cantidad"></td> | 43 | <td ng-bind="articulo.cantidad"></td> |
| 42 | <td ng-bind="articulo.cantidadCargada || 0"></td> | 44 | <td ng-bind="articulo.cantidadCargada || 0"></td> |
| 43 | <td ng-bind="articulo.cantidad - articulo.cantidadCargada"></td> | 45 | <td ng-bind="articulo.cantidad - articulo.cantidadCargada"></td> |
| 44 | </tr> | 46 | </tr> |
| 45 | </tbody> | 47 | </tbody> |
| 46 | </table> | 48 | </table> |
| 47 | <table class="table table-sm"> | 49 | <table class="table table-sm" ladda="cargandoDatos" data-spinner-color="#FF0000"> |
| 48 | <thead> | 50 | <thead> |
| 49 | <tr> | 51 | <tr> |
| 50 | <th width="10%">Cisterna</th> | 52 | <th width="10%">Cisterna</th> |
| 51 | <th width="20%">Cantidad asignada</th> | 53 | <th>Capacidad</th> |
| 52 | <th width="35%">Estado</th> | ||
| 53 | <th>Articulo cargado</th> | 54 | <th>Articulo cargado</th> |
| 55 | <th width="20%">Asignado</th> | ||
| 56 | <th>Cargado / Capacidad Disponible</th> | ||
| 54 | </tr> | 57 | </tr> |
| 55 | </thead> | 58 | </thead> |
| 56 | <tbody> | 59 | <tbody> |
| 57 | <tr ng-repeat="(key, cisterna) in vehiculo.cisternas"> | 60 | <tr ng-repeat="(key, cisterna) in vehiculo.cisternas"> |
| 58 | <td ng-bind="cisterna.codigo"></td> | 61 | <td class="py-3" ng-bind="cisterna.codigo"></td> |
| 59 | <td><input | 62 | <td class="py-3" ng-bind="cisterna.capacidad"></td> |
| 63 | <td class="py-3" ng-bind="cisterna.cisternaCarga.articulo.DetArt || 'Sin asignar'"></td> | ||
| 64 | <td ng-if="idRemito != -1"> | ||
| 65 | <input | ||
| 60 | class="form-control" | 66 | class="form-control" |
| 61 | foca-tipo-input | 67 | foca-tipo-input |
| 62 | foca-teclado | 68 | foca-teclado |
| 63 | placeholder="A cargar..." | 69 | placeholder="A cargar..." |
| 64 | ng-model="aCargar[key]" | 70 | ng-model="aCargar[key]" |
| 65 | ng-disabled="(articuloSeleccionado.idArticulo !== cisterna.cisternaCarga.idProducto && | 71 | ng-disabled="cisterna.disabled" |
| 66 | cisterna.cisternaCarga.idProducto) || !tieneArticulosPendientes() | 72 | ng-focus="aCargar[key] = rellenarInput(aCargar[key]); actualizarArticulo()" |
| 67 | || articuloSeleccionado.cantidad > cisterna.disponible" | ||
| 68 | ng-change="actualizarArticulo()" | 73 | ng-change="actualizarArticulo()" |
| 69 | > | 74 | > |
| 70 | </td> | 75 | </td> |
| 76 | <td ng-if="idRemito == -1"> | ||
| 77 | <input | ||
| 78 | class="form-control" | ||
| 79 | placeholder="A cargar..." | ||
| 80 | readonly> | ||
| 81 | </td> | ||
| 71 | <td><div class="progress foca-alto-progress pl-0 pr-0 mt-1"> | 82 | <td><div class="progress foca-alto-progress pl-0 pr-0 mt-1"> |
| 72 | <strong | 83 | <strong |
| 73 | class="mt-2 col-4 text-center position-absolute" | 84 | class="mt-2 col-4 text-center position-absolute" |
| 74 | ng-bind="(cisterna.cisternaCarga.cantidad || 0) + '/' + (cisterna.capacidad)"> | 85 | ng-bind="(cisterna.cisternaCarga.cantidad || 0) + '/' + |
| 86 | (cisterna.capacidad - cisterna.cisternaCarga.cantidad)"> | ||
| 75 | </strong> | 87 | </strong> |
| 76 | <div | 88 | <div |
| 77 | id="{{cisterna.id}}" | 89 | id="{{cisterna.id}}" |
| 78 | class="progress-bar" | 90 | class="progress-bar" |
| 79 | role="progressbar" | 91 | role="progressbar" |
| 80 | aria-valuemin="0" | 92 | aria-valuemin="0" |
| 81 | aria-valuemax="{{cisterna.capacidad}}" | 93 | aria-valuemax="{{cisterna.capacidad}}" |
| 82 | ng-style="{'width':'{{calcularPorcentaje(cisterna)}}'}"> | 94 | ng-style="{'width':'{{calcularPorcentaje(cisterna)}}'}"> |
| 83 | </div> | 95 | </div> |
| 84 | </div> | 96 | </div> |
| 85 | </td> | 97 | </td> |
| 86 | <td ng-bind="cisterna.cisternaCarga.articulo.DetArt || 'Sin asignar'"></td> | ||
| 87 | </tr> | 98 | </tr> |
| 88 | </tbody> | 99 | </tbody> |
| 89 | </table> | 100 | </table> |
| 90 | <div class="col-12 aling-end"> | 101 | <div class="col-12 aling-end"> |
| 91 | <button | 102 | <button |
| 92 | class="form-control btn btn-success" | 103 | class="form-control btn btn-success" |
| 93 | ladda="cargando" | 104 | ladda="cargando" |
| 94 | data-spinner-color="#FF0000" | 105 | data-spinner-color="#FF0000" |
| 95 | type="button" | 106 | type="button" |
| 96 | ng-disabled="!articuloSeleccionado || articuloSeleccionado.cantidad - | 107 | ng-disabled="!distribucionDisponible()" |
| 97 | articuloSeleccionado.cantidadCargada !== 0 || !tieneArticulosPendientes()" | 108 | ng-class="{'btn-light': !distribucionDisponible()}" |
| 98 | ng-class="{'btn-light': !articuloSeleccionado || articuloSeleccionado.cantidad - | 109 | ng-click="cargarACisternas(vehiculo)" |
| 99 | articuloSeleccionado.cantidadCargada !== 0 || !tieneArticulosPendientes()}" | 110 | foca-focus="distribucionDisponible()"> |
| 100 | ng-click="cargarACisternas(vehiculo)"> | ||
| 101 | Aplicar distribución de cargas | 111 | Aplicar distribución de cargas |
| 102 | </button> | 112 | </button> |
| 103 | </div> | 113 | </div> |
| 104 | </div> | 114 | </div> |
| 105 | </div> | 115 | </div> |
| 106 | <div class="modal-footer py-1"> | 116 | <div class="modal-footer py-1"> |
| 107 | <button | 117 | <button |
| 108 | class="btn btn-sm btn-secondary" | 118 | class="btn btn-sm btn-secondary" |
| 109 | ladda="cargando" | 119 | ladda="cargando" |
| 110 | type="button" | 120 | type="button" |
| 111 | ng-click="cancelar()">Cancelar</button> | 121 | ng-click="cancelar()">Cancelar</button> |
| 112 | <button | 122 | <button |
| 113 | class="btn btn-sm btn-primary" | 123 | class="btn btn-sm btn-primary" |
| 114 | ladda="cargando" | 124 | ladda="cargando" |
| 115 | type="button" | 125 | type="button" |
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="5" 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 --> | 53 | <!-- TODO: descomentar cuando se quite definitivamente --> |
| 54 | <!-- <button | 54 | <!-- <button |
| 55 | type="button" | 55 | type="button" |
| 56 | ng-class="{'active': idVendedor == 0}" | 56 | ng-class="{'active': idVendedor == 0}" |
| 57 | class="btn col-12 my-1" | 57 | class="btn col-12 my-1" |
| 58 | ng-click="general()" | 58 | ng-click="general()" |
| 59 | >General</button> | 59 | >General</button> |
| 60 | <button | 60 | <button |
| 61 | type="button" | 61 | type="button" |
| 62 | ng-class="{'active': idVendedor != 0}" | 62 | ng-class="{'active': idVendedor != 0}" |
| 63 | class="btn col-12 my-1" | 63 | class="btn col-12 my-1" |
| 64 | ng-click="individual()" | 64 | ng-click="individual()" |
| 65 | >Individual</button> | 65 | >Individual</button> |
| 66 | <div class="form-group" ng-show="idVendedor == -1"> | 66 | <div class="form-group" ng-show="idVendedor == -1"> |
| 67 | <input | 67 | <input |
| 68 | type="text" | 68 | type="text" |
| 69 | placeholder="Vendedor" | 69 | placeholder="Vendedor" |
| 70 | class="form-control" | 70 | class="form-control" |
| 71 | ng-model="idVendedorInput" | 71 | ng-model="idVendedorInput" |
| 72 | ng-keypress="search($event.keyCode)" | 72 | ng-keypress="search($event.keyCode)" |
| 73 | foca-focus="idVendedor == -1" | 73 | foca-focus="idVendedor == -1" |
| 74 | > | 74 | > |
| 75 | </div> --> | 75 | </div> --> |
| 76 | <div class="custom-control custom-radio"> | 76 | <div class="custom-control custom-radio"> |
| 77 | <input | 77 | <input |
| 78 | type="radio" | 78 | type="radio" |
| 79 | class="custom-control-input" | 79 | class="custom-control-input" |
| 80 | id="idTodos" | 80 | id="idTodos" |
| 81 | name="filtro" | 81 | name="filtro" |
| 82 | ng-model="filtroEstado" | 82 | ng-model="filtroEstado" |
| 83 | ng-change="search()" | 83 | ng-change="search()" |
| 84 | checked> | 84 | checked> |
| 85 | <label class="custom-control-label pb-3" for="idTodos"></label> | 85 | <label class="custom-control-label pb-3" for="idTodos"></label> |
| 86 | <img src="img/marker-icon-grey.png"> | 86 | <img src="img/marker-icon-grey.png"> |
| 87 | <strong>Todos</strong> | 87 | <strong>Todos</strong> |
| 88 | </div> | 88 | </div> |
| 89 | <div class="custom-control custom-radio"> | 89 | <div class="custom-control custom-radio"> |
| 90 | <input | 90 | <input |
| 91 | type="radio" | 91 | type="radio" |
| 92 | class="custom-control-input" | 92 | class="custom-control-input" |
| 93 | id="idSinAsignar" | 93 | id="idSinAsignar" |
| 94 | name="filtro" | 94 | name="filtro" |
| 95 | ng-model="filtroEstado" | 95 | ng-model="filtroEstado" |
| 96 | ng-change="search()" | 96 | ng-change="search()" |
| 97 | ng-value="false"> | 97 | ng-value="false"> |
| 98 | <label class="custom-control-label pb-3" for="idSinAsignar"></label> | 98 | <label class="custom-control-label pb-3" for="idSinAsignar"></label> |
| 99 | <img src="img/marker-icon-green.png"> | 99 | <img src="img/marker-icon-green.png"> |
| 100 | <strong>Sin asignar</strong> | 100 | <strong>Sin asignar</strong> |
| 101 | </div> | 101 | </div> |
| 102 | <div class="custom-control custom-radio"> | 102 | <div class="custom-control custom-radio"> |
| 103 | <input | 103 | <input |
| 104 | type="radio" | 104 | type="radio" |
| 105 | class="custom-control-input" | 105 | class="custom-control-input" |
| 106 | id="idAsignado" | 106 | id="idAsignado" |
| 107 | name="filtro" | 107 | name="filtro" |
| 108 | ng-model="filtroEstado" | 108 | ng-model="filtroEstado" |
| 109 | ng-change="search()" | 109 | ng-change="search()" |
| 110 | ng-value="true"> | 110 | ng-value="true"> |
| 111 | <label class="custom-control-label pb-3" for="idAsignado"></label> | 111 | <label class="custom-control-label pb-3" for="idAsignado"></label> |
| 112 | <img src="img/marker-icon-red.png"> | 112 | <img src="img/marker-icon-red.png"> |
| 113 | <strong>Asignado</strong> | 113 | <strong>Asignado</strong> |
| 114 | </div> | 114 | </div> |
| 115 | </div> | 115 | </div> |
| 116 | <div class="row"> | 116 | <div class="row"> |
| 117 | <div | 117 | <div |
| 118 | class="container col-auto" | 118 | class="container col-auto" |
| 119 | ng-repeat="vehiculo in vehiculos" | 119 | ng-repeat="vehiculo in vehiculos" |
| 120 | ng-click="mostrarDetalleVehiculo(vehiculo)" | 120 | ng-click="mostrarDetalleVehiculo(vehiculo)" |
| 121 | > | 121 | > |
| 122 | <div> | 122 | <div> |
| 123 | <div class="col-md-3 col-sm-6"> | 123 | <div class="col-md-3 col-sm-6"> |
| 124 | <div class="progress-circle" ng-class="{'arrastrando': arrastrando}"> | 124 | <div class="progress-circle" ng-class="{'arrastrando': arrastrando}"> |
| 125 | <span class="progress-left"> | 125 | <span class="progress-left"> |
| 126 | <span class="progress-bar"></span> | 126 | <span class="progress-bar"></span> |
| 127 | </span> | 127 | </span> |
| 128 | <span class="progress-right"> | 128 | <span class="progress-right"> |
| 129 | <span class="progress-bar"></span> | 129 | <span class="progress-bar"></span> |
| 130 | </span> | 130 | </span> |
| 131 | <div class="progress-value">{{vehiculo.codigo}}</div> | 131 | <div class="progress-value">{{vehiculo.codigo}}</div> |
| 132 | </div> | 132 | </div> |
| 133 | </div> | 133 | </div> |
| 134 | <div class="row ml-2"> | 134 | <div class="row ml-2"> |
| 135 | <div class="col-3 position-absolute"> | 135 | <div class="col-3 position-absolute"> |
| 136 | <img | 136 | <img |
| 137 | src="img/hojaRutaVolante.png" | 137 | src="img/hojaRutaVolante.png" |
| 138 | width="100%"> | 138 | width="100%"> |
| 139 | </div> | 139 | </div> |
| 140 | <div class="col-3" | 140 | <div class="col-3" |
| 141 | uib-tooltip="Confeccionar hoja de ruta" | 141 | uib-tooltip="Confeccionar hoja de ruta" |
| 142 | ng-click="hacerHojaRuta(vehiculo)"></div> | 142 | ng-click="hacerHojaRuta(vehiculo)"></div> |
| 143 | <div class="col-3"> | 143 | <div class="col-3"> |
| 144 | <i | 144 | <i |
| 145 | class="fa fa-eye fa-2x" | 145 | class="fa fa-eye fa-2x" |
| 146 | uib-tooltip="Ver cisternas" | 146 | uib-tooltip="Ver cisternas" |
| 147 | ng-click="cargar(vehiculo.id, -1)"> | 147 | ng-click="cargar(vehiculo.id, -1)"> |
| 148 | </i> | 148 | </i> |
| 149 | </div> | 149 | </div> |
| 150 | <div class="col-3 ml-2"> | 150 | <div class="col-3 ml-2"> |
| 151 | <i | 151 | <i |
| 152 | class="fa fa-trash fa-2x" | 152 | class="fa fa-trash fa-2x" |
| 153 | uib-tooltip="Eliminar vehiculo" | 153 | uib-tooltip="Eliminar vehiculo" |
| 154 | ng-click="quitarVehiculo(vehiculo)"></i> | 154 | ng-click="quitarVehiculo(vehiculo)"></i> |
| 155 | </div> | 155 | </div> |
| 156 | </div> | 156 | </div> |
| 157 | <div | 157 | <div |
| 158 | class="ml-1 border border-dark text-center" | 158 | class="ml-1 border border-dark text-center" |
| 159 | ng-show="arrastrando" | 159 | ng-show="arrastrando" |
| 160 | id="{{vehiculo.id}}" | 160 | id="{{vehiculo.id}}" |
| 161 | ondrop="drop(event)" | 161 | ondrop="drop(event)" |
| 162 | ondragover="allowDrop(event)" | 162 | ondragover="allowDrop(event)" |
| 163 | >Soltar acá</div> | 163 | >Soltar acá</div> |
| 164 | </div> | 164 | </div> |
| 165 | </div> | 165 | </div> |
| 166 | </div> | 166 | </div> |
| 167 | </div> | 167 | </div> |
| 168 | </div> | 168 | </div> |
| 169 | 169 |