Commit a42e3b4bda7b652379f792ba763d272318397c33

Authored by Eric Fernandez
Exists in master and in 2 other branches develop, lab

Merge branch 'master' into 'master'

Master(efernandez)

See merge request !19
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: 'abmChofer.png'
18 }; 18 };
19 $scope.botonera = [transportista, fecha]; 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 // TODO: obtener vehiculos con remitos cargados para esa fecha que no han sido confirmados 37
38 // focaLogisticaPedidoRutaService.getVehiculosByIdUsuario().then(function(res) {
39 // $scope.vehiculos = res.data;
40 // });
41 38
42 $scope.general = function() { 39 $scope.general = function() {
43 $scope.idVendedor = 0; 40 $scope.idVendedor = 0;
44 getSeguimiento(); 41 getSeguimiento();
45 $scope.$broadcast('removeCabecera', cabecera); 42 $scope.$broadcast('removeCabecera', cabecera);
46 $scope.$broadcast('addCabecera',{ 43 $scope.$broadcast('addCabecera',{
47 label: 'General', 44 label: 'General',
48 valor: '' 45 valor: ''
49 }); 46 });
50 }; 47 };
51 48
52 $scope.cargar = function(idVehiculo, punto) { 49 $scope.cargar = function(idVehiculo, punto) {
53 if(!$scope.fechaReparto) { 50 if(!$scope.fechaReparto) {
54 focaModalService.alert('elija primero una fecha de reparto'); 51 focaModalService.alert('Primero seleccione fecha de reparto');
55 return; 52 return;
56 } 53 }
57 var idRemito; 54 var idRemito;
58 if(punto === -1) { 55 if(punto === -1) {
59 idRemito = -1; 56 idRemito = -1;
60 }else { 57 }else {
61 idRemito = JSON.parse(punto).notaPedido.remito.id; 58 idRemito = JSON.parse(punto).notaPedido.remito.id;
62 } 59 }
63 var modalInstance = $uibModal.open( 60 var modalInstance = $uibModal.open(
64 { 61 {
65 ariaLabelledBy: 'Busqueda de Vehiculo', 62 ariaLabelledBy: 'Busqueda de Vehiculo',
66 templateUrl: 'foca-detalle-vehiculo.html', 63 templateUrl: 'foca-detalle-vehiculo.html',
67 controller: 'focaDetalleVehiculo', 64 controller: 'focaDetalleVehiculo',
68 size: 'lg', 65 size: 'lg',
69 resolve: { 66 resolve: {
70 idVehiculo: function() {return idVehiculo;}, 67 idVehiculo: function() {return idVehiculo;},
71 idRemito: function() {return idRemito;}, 68 idRemito: function() {return idRemito;},
72 fechaReparto: function() {return $scope.fechaReparto;} 69 fechaReparto: function() {return $scope.fechaReparto;}
73 } 70 }
74 } 71 }
75 ); 72 );
76 modalInstance.result.then(function() { 73 modalInstance.result.then(function() {
77 }, function() { 74 }, function() {
78 }); 75 });
79 }; 76 };
80 77
81 $scope.quitarVehiculo = function(vehiculo) { 78 $scope.quitarVehiculo = function(vehiculo) {
82 focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + 79 focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' +
83 vehiculo.codigo + '?').then(function() { 80 vehiculo.codigo + '?').then(function() {
84 eliminarVehiculo(vehiculo); 81 eliminarVehiculo(vehiculo);
85 }); 82 });
86 }; 83 };
87 84
88 $scope.hacerHojaRuta = function(vehiculo) { 85 $scope.hacerHojaRuta = function(vehiculo) {
86 if(!$scope.fechaReparto) {
87 focaModalService.alert('Primero seleccione fecha de reparto');
88 return;
89 }
89 var modalInstance = $uibModal.open( 90 var modalInstance = $uibModal.open(
90 { 91 {
91 ariaLabelledBy: 'Creación hoja ruta', 92 ariaLabelledBy: 'Creación hoja ruta',
92 templateUrl: 'foca-modal-crear-hoja-ruta.html', 93 templateUrl: 'foca-modal-crear-hoja-ruta.html',
93 controller: 'focaModalCrearHojaRuta', 94 controller: 'focaModalCrearHojaRuta',
94 size: 'lg', 95 size: 'lg',
95 resolve: { 96 resolve: {
96 idVehiculo: function() {return vehiculo.id;} 97 idVehiculo: function() {return vehiculo.id;}
97 } 98 }
98 } 99 }
99 ); 100 );
100 modalInstance.result.then(function() { 101 modalInstance.result.then(function() {
101 102
102 }, function() { 103 }, function() {
103 //usar cuando se cancela el modal 104 //usar cuando se cancela el modal
104 }); 105 });
105 }; 106 };
106 107
107 $scope.arrastra = function() { 108 $scope.arrastra = function() {
108 $scope.arrastrando = true; 109 $scope.arrastrando = true;
109 $scope.$digest(); 110 $scope.$digest();
110 }; 111 };
111 112
112 $scope.noArrastra = function() { 113 $scope.noArrastra = function() {
113 $scope.arrastrando = false; 114 $scope.arrastrando = false;
114 $scope.$digest(); 115 $scope.$digest();
115 }; 116 };
116 117
117 $scope.individual = function() { 118 $scope.individual = function() {
118 $scope.idVendedor = -1; 119 $scope.idVendedor = -1;
119 }; 120 };
120 121
121 $scope.mostrarDetalle = function() { 122 $scope.mostrarDetalle = function() {
122 $scope.detalle = true; 123 $scope.detalle = true;
123 }; 124 };
124 125
125 $scope.salir = function() { 126 $scope.salir = function() {
126 $location.path('/'); 127 $location.path('/');
127 }; 128 };
128 129
129 $scope.search = function() { 130 $scope.search = function() {
130 getSeguimiento(); 131 getSeguimiento();
131 }; 132 };
132 133
133 $scope.fecha = function() { 134 $scope.fecha = function() {
134 getSeguimiento(); 135 getSeguimiento();
135 }; 136 };
136 137
137 $scope.seleccionarUnidad = function() { 138 $scope.seleccionarUnidad = function() {
138 var modalInstance = $uibModal.open( 139 var modalInstance = $uibModal.open(
139 { 140 {
140 ariaLabelledBy: 'Busqueda de Transportista', 141 ariaLabelledBy: 'Busqueda de Transportista',
141 templateUrl: 'modal-proveedor.html', 142 templateUrl: 'modal-proveedor.html',
142 controller: 'focaModalProveedorCtrl', 143 controller: 'focaModalProveedorCtrl',
143 size: 'lg', 144 size: 'lg',
144 resolve: { 145 resolve: {
145 transportista: function() { 146 transportista: function() {
146 return true; 147 return true;
147 } 148 }
148 } 149 }
149 } 150 }
150 ); 151 );
151 modalInstance.result.then(function(transportista) { 152 modalInstance.result.then(function(transportista) {
152 $scope.seleccionarVehiculo(transportista.COD); 153 $scope.seleccionarVehiculo(transportista.COD);
153 }); 154 });
154 }; 155 };
155 156
156 $scope.seleccionarVehiculo = function(idTransportista) { 157 $scope.seleccionarVehiculo = function(idTransportista) {
157 var query = '/vehiculo/transportista/' + idTransportista; 158 var query = '/vehiculo/transportista/' + idTransportista;
158 var columnas = { 159 var columnas = {
159 nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], 160 nombre: ['Código', 'tractor', 'Semi', 'Capacidad'],
160 propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] 161 propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas']
161 }; 162 };
162 var titulo = 'Búsqueda de vehiculos'; 163 var titulo = 'Búsqueda de vehiculos';
163 focaModalService.modal(columnas, query, titulo).then( 164 focaModalService.modal(columnas, query, titulo).then(
164 function(vehiculo) { 165 function(vehiculo) {
165 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); 166 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id});
166 if(existe.length) { 167 if(existe.length) {
167 focaModalService.alert('El vehiculo ya ha sido cargado'); 168 focaModalService.alert('El vehiculo ya ha sido cargado');
168 return; 169 return;
169 } 170 }
170 if(!vehiculo.cisternas.length) { 171 if(!vehiculo.cisternas.length) {
171 focaModalService.alert('El vehiculo no tiene cisternas'); 172 focaModalService.alert('El vehiculo no tiene cisternas');
172 return; 173 return;
173 } 174 }
174 $scope.vehiculos.push(vehiculo); 175 $scope.vehiculos.push(vehiculo);
175 }, function() { 176 }, function() {
176 // funcion ejecutada cuando se cancela el modal 177 // funcion ejecutada cuando se cancela el modal
177 }); 178 });
178 }; 179 };
179 180
180 $scope.seleccionarFechaReparto = function() { 181 $scope.seleccionarFechaReparto = function() {
181 focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { 182 focaModalService.modalFecha('Fecha de reparto').then(function(fecha) {
182 $scope.$broadcast('addCabecera',{ 183 $scope.$broadcast('addCabecera',{
183 label: 'Fecha:', 184 label: 'Fecha:',
184 valor: fecha.toLocaleDateString() 185 valor: fecha.toLocaleDateString()
185 }); 186 });
186 $scope.fechaReparto = fecha; 187 $scope.fechaReparto = fecha;
188 focaLogisticaPedidoRutaService.setFechaReparto(fecha);
189 focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) {
190 $scope.vehiculos = res.data;
191 });
187 }); 192 });
188 }; 193 };
189 194
190 function getSeguimiento() { 195 function getSeguimiento() {
191 var desde = new Date('1900/01/01'); 196 var desde = new Date('1900/01/01');
192 var hasta = new Date('2099/01/01'); 197 var hasta = new Date('2099/01/01');
193 if($scope.fechaDesde) { 198 if($scope.fechaDesde) {
194 var fechaDesde = $scope.fechaDesde; 199 var fechaDesde = $scope.fechaDesde;
195 desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); 200 desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0));
196 desde = new Date(desde); 201 desde = new Date(desde);
197 } 202 }
198 if($scope.fechaHasta) { 203 if($scope.fechaHasta) {
199 var fechaHasta = $scope.fechaHasta; 204 var fechaHasta = $scope.fechaHasta;
200 hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); 205 hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0));
201 hasta = hasta.setDate(hasta.getDate() + 1); 206 hasta = hasta.setDate(hasta.getDate() + 1);
202 hasta = new Date(hasta); 207 hasta = new Date(hasta);
203 } 208 }
204 var datos = { 209 var datos = {
205 actividad: $scope.actividad, 210 actividad: $scope.actividad,
206 idUsuario: $scope.idVendedor, 211 idUsuario: $scope.idVendedor,
207 fechaDesde: desde, 212 fechaDesde: desde,
208 fechaHasta: hasta, 213 fechaHasta: hasta,
209 asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? 214 asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ?
210 false : undefined) 215 false : undefined)
211 }; 216 };
212 217
213 $scope.datosBuscados = { 218 $scope.datosBuscados = {
214 actividad: $scope.actividad, 219 actividad: $scope.actividad,
215 individual: $scope.idVendedor ? true : false 220 individual: $scope.idVendedor ? true : false
216 }; 221 };
217 222
218 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { 223 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) {
219 if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { 224 if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) {
220 $scope.marcadores = datos.data; 225 $scope.marcadores = datos.data;
221 } 226 }
222 }); 227 });
223 } 228 }
224 229
225 function eliminarVehiculo(vehiculo) { 230 function eliminarVehiculo(vehiculo) {
226 focaLogisticaPedidoRutaService.getRemitos(vehiculo.id).then(function(res) { 231 focaLogisticaPedidoRutaService.getRemitos(vehiculo.id).then(function(res) {
227 if(!focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data).length) { 232 if(!focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data).length) {
228 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); 233 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1);
229 }else { 234 }else {
230 focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + 235 focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' +
231 'tiene remitos asociados').then(function() { 236 'tiene remitos asociados').then(function() {
232 $scope.hacerHojaRuta(vehiculo); 237 $scope.hacerHojaRuta(vehiculo);
233 }); 238 });
234 } 239 }
235 }); 240 });
236 } 241 }
237 $interval(function() { 242 $interval(function() {
238 getSeguimiento(); 243 getSeguimiento();
239 }, 5000); 244 }, 5000);
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 'fechaReparto',
11 function($scope, $uibModalInstance, idVehiculo, idRemito, focaModalService, $filter, 10 function($scope, $uibModalInstance, idVehiculo, idRemito, focaModalService, $filter,
12 focaLogisticaPedidoRutaService, fechaReparto 11 focaLogisticaPedidoRutaService
13 ) { 12 ) {
14 //seteo variables 13 //seteo variables
15 $scope.cargandoDatos = true; 14 $scope.cargandoDatos = true;
16 $scope.idRemito = idRemito; 15 $scope.idRemito = idRemito;
17 $scope.articulos = []; 16 $scope.articulos = [];
18 $scope.vehiculo = {}; 17 $scope.vehiculo = {};
19 $scope.cisternas = []; 18 $scope.cisternas = [];
20 $scope.cisternasCarga = []; 19 $scope.cisternasCarga = [];
21 $scope.remito = {}; 20 $scope.remito = {};
22 $scope.aCargar = []; 21 $scope.aCargar = [];
23 var cisternaMovimientos = []; 22 var cisternaMovimientos = [];
24 var promesaRemito; 23 var promesaRemito;
25 var promesaVehiculo = focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo); 24 var promesaVehiculo = focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo);
26 var promesaCisternas = focaLogisticaPedidoRutaService 25 var promesaCisternas = focaLogisticaPedidoRutaService
27 .obtenerCisternasPorFecha(idVehiculo, fechaReparto); 26 .obtenerCisternasPorFecha(idVehiculo);
28 if(idRemito !== -1) { 27 if(idRemito !== -1) {
29 promesaRemito = focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito); 28 promesaRemito = focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito);
30 } 29 }
31 Promise.all([promesaVehiculo, promesaCisternas, promesaRemito]).then(function(res) { 30 Promise.all([promesaVehiculo, promesaCisternas, promesaRemito]).then(function(res) {
32 $scope.cargandoDatos = false; 31 $scope.cargandoDatos = false;
33 $scope.vehiculo = res[0].data; 32 $scope.vehiculo = res[0].data;
34 $scope.cisternas = res[1].data; 33 $scope.cisternas = res[1].data;
35 if(!res[2]) return; 34 if(!res[2]) return;
36 $scope.remito = res[2].data; 35 $scope.remito = res[2].data;
37 if($scope.remito.idUsuarioProceso) { 36 if($scope.remito.idUsuarioProceso) {
38 focaModalService.alert('Remito ya asignado'); 37 focaModalService.alert('Remito ya asignado');
39 $uibModalInstance.close(); 38 $uibModalInstance.close();
40 } 39 }
41 $scope.articulos = $scope.remito.articulosRemito; 40 $scope.articulos = $scope.remito.articulosRemito;
42 $scope.seleccionarArticulo($scope.articulos[0]); 41 $scope.seleccionarArticulo($scope.articulos[0]);
43 }); 42 });
44 $scope.aceptar = function() { 43 $scope.aceptar = function() {
45 $scope.cargando = true; 44 $scope.cargando = true;
46 for(var i = 0; i < $scope.cisternasCarga.length; i++) { 45 for(var i = 0; i < $scope.cisternasCarga.length; i++) {
47 delete $scope.cisternasCarga[i].articulo; 46 delete $scope.cisternasCarga[i].articulo;
48 } 47 }
49 var cisterna = { 48 var cisterna = {
50 cisternaMovimientos: cisternaMovimientos, 49 cisternaMovimientos: cisternaMovimientos,
51 cisternaCargas: $scope.cisternasCarga, 50 cisternaCargas: $scope.cisternasCarga,
52 idVehiculo: $scope.vehiculo.id 51 idVehiculo: $scope.vehiculo.id
53 }; 52 };
54 focaLogisticaPedidoRutaService.guardarCisternas(cisterna, $scope.remito.id) 53 focaLogisticaPedidoRutaService.guardarCisternas(cisterna, $scope.remito.id)
55 .then(function() { 54 .then(function() {
56 focaModalService.alert('Cisternas cargadas con éxito').then(function() { 55 focaModalService.alert('Cisternas cargadas con éxito').then(function() {
57 $scope.cargando = false; 56 $scope.cargando = false;
58 $uibModalInstance.close(); 57 $uibModalInstance.close();
59 }); 58 });
60 }).catch(function(error) { 59 }).catch(function(error) {
61 $scope.cargando = false; 60 $scope.cargando = false;
62 $uibModalInstance.close(); 61 $uibModalInstance.close();
63 if (error.status === 403.1) { 62 if (error.status === 403.1) {
64 focaModalService.alert('ERROR: El vehículo esta en uso'); 63 focaModalService.alert('ERROR: El vehículo esta en uso');
65 } 64 }
66 if(error.status === 403.2) { 65 if(error.status === 403.2) {
67 focaModalService.alert('ERROR: Otro usario ya cargó este remito'); 66 focaModalService.alert('ERROR: Otro usario ya cargó este remito');
68 return; 67 return;
69 } 68 }
70 focaModalService.alert('Hubo un error al cargar las cisternas'); 69 focaModalService.alert('Hubo un error al cargar las cisternas');
71 }); 70 });
72 }; 71 };
73 $scope.cancelar = function() { 72 $scope.cancelar = function() {
74 $uibModalInstance.close(); 73 $uibModalInstance.close();
75 }; 74 };
76 $scope.cargarACisternas = function() { 75 $scope.cargarACisternas = function() {
77 for(var i = 0; i < $scope.cisternas.length; i++) { 76 for(var i = 0; i < $scope.cisternas.length; i++) {
78 var cisterna = $scope.cisternas[i]; 77 var cisterna = $scope.cisternas[i];
79 var aCargar = parseFloat($scope.aCargar[i]); 78 var aCargar = parseFloat($scope.aCargar[i]);
79 var fechaReparto = focaLogisticaPedidoRutaService.fecha;
80 //validaciones 80 //validaciones
81 if(!aCargar) { 81 if(!aCargar) {
82 continue; 82 continue;
83 } 83 }
84 //cargar 84 //cargar
85 if(cisterna.cisternaCarga.cantidad) { 85 if(cisterna.cisternaCarga.cantidad) {
86 cisterna.cisternaCarga.cantidad += aCargar; 86 cisterna.cisternaCarga.cantidad += aCargar;
87 }else { 87 }else {
88 cisterna.cisternaCarga.cantidad = aCargar; 88 cisterna.cisternaCarga.cantidad = aCargar;
89 cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo; 89 cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo;
90 } 90 }
91 cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad; 91 cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad;
92 92
93 cisterna.cisternaCarga.articulo = { 93 cisterna.cisternaCarga.articulo = {
94 DetArt: $scope.articuloSeleccionado.descripcion 94 DetArt: $scope.articuloSeleccionado.descripcion
95 }; 95 };
96 $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0] 96 $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0]
97 .cargado = true; 97 .cargado = true;
98 98
99 $scope.calcularPorcentaje(cisterna); 99 $scope.calcularPorcentaje(cisterna);
100 //Guardar 100 //Guardar
101 var now = new Date(); 101 var now = new Date();
102 var cisternaMovimiento = { 102 var cisternaMovimiento = {
103 fecha: now.toISOString().slice(0, 19).replace('T', ' '), 103 fecha: now.toISOString().slice(0, 19).replace('T', ' '),
104 cantidad: aCargar, 104 cantidad: aCargar,
105 metodo: 'carga', 105 metodo: 'carga',
106 idCisternaCarga: cisterna.cisternaCarga.id, 106 idCisternaCarga: cisterna.cisternaCarga.id,
107 idRemito: $scope.remito.id 107 idRemito: $scope.remito.id
108 }; 108 };
109 cisterna.cisternaCarga.fechaReparto = fechaReparto; 109 cisterna.cisternaCarga.fechaReparto = fechaReparto;
110 cisterna.cisternaCarga.idCisterna = cisterna.id; 110 cisterna.cisternaCarga.idCisterna = cisterna.id;
111 $scope.cisternasCarga.push(cisterna.cisternaCarga); 111 $scope.cisternasCarga.push(cisterna.cisternaCarga);
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.seleccionarArticulo(articuloSiguiente[0]); 120 $scope.seleccionarArticulo(articuloSiguiente[0]);
121 } 121 }
122 }; 122 };
123 $scope.calcularPorcentaje = function(cisterna) { 123 $scope.calcularPorcentaje = function(cisterna) {
124 if(!cisterna.cisternaCarga.cantidad) { 124 if(!cisterna.cisternaCarga) {
125 cisterna.cisternaCarga.cantidad = 0; 125 cisterna.cisternaCarga = {
126 cantidad: 0
127 };
126 } 128 }
127 var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / 129 var porcentaje = (cisterna.cisternaCarga.cantidad * 100 /
128 cisterna.capacidad) + '%'; 130 cisterna.capacidad) + '%';
129 var elementHtml = document.getElementById(cisterna.id); 131 var elementHtml = document.getElementById(cisterna.id);
130 if(elementHtml) { 132 if(elementHtml) {
131 elementHtml.style.width = porcentaje; 133 elementHtml.style.width = porcentaje;
132 } 134 }
133 }; 135 };
134 $scope.seleccionarArticulo = function(articulo) { 136 $scope.seleccionarArticulo = function(articulo) {
135 $scope.articuloSeleccionado = articulo; 137 $scope.articuloSeleccionado = articulo;
136 $scope.cisternaDisponible(); 138 $scope.cisternaDisponible();
137 $scope.autoCompletar(); 139 $scope.autoCompletar();
138 $scope.actualizarArticulo(); 140 $scope.actualizarArticulo();
139 }; 141 };
140 $scope.actualizarArticulo = function () { 142 $scope.actualizarArticulo = function () {
141 $scope.articuloSeleccionado.cantidadCargada = 0; 143 $scope.articuloSeleccionado.cantidadCargada = 0;
142 for (var i = 0; i < $scope.aCargar.length; i++) { 144 for (var i = 0; i < $scope.aCargar.length; i++) {
143 $scope.articuloSeleccionado.cantidadCargada += 145 $scope.articuloSeleccionado.cantidadCargada +=
144 parseFloat($scope.aCargar[i]) || 0; 146 parseFloat($scope.aCargar[i]) || 0;
145 } 147 }
146 }; 148 };
147 $scope.autoCompletar = function() { 149 $scope.autoCompletar = function() {
148 $scope.aCargar = []; 150 $scope.aCargar = [];
149 var disponible = $filter('filter')($scope.cisternas, {disabled: false}); 151 var disponible = $filter('filter')($scope.cisternas, {disabled: false});
150 var index = $scope.cisternas.indexOf(disponible[0]); 152 var index = $scope.cisternas.indexOf(disponible[0]);
151 $scope.aCargar[index] = $scope.articuloSeleccionado.cantidad; 153 $scope.aCargar[index] = $scope.articuloSeleccionado.cantidad;
152 }; 154 };
153 $scope.cisternaDisponible = function() { 155 $scope.cisternaDisponible = function() {
154 for(var i = 0; i < $scope.cisternas.length; i++) { 156 for(var i = 0; i < $scope.cisternas.length; i++) {
155 if($scope.articuloSeleccionado.cantidad > $scope.cisternas[i].disponible) { 157 if($scope.articuloSeleccionado.cantidad > $scope.cisternas[i].disponible) {
156 $scope.cisternas[i].disabled = true; 158 $scope.cisternas[i].disabled = true;
157 continue; 159 continue;
158 } 160 }
159 if($scope.cisternas[i].cisternaCarga.idProducto && 161 if($scope.cisternas[i].cisternaCarga &&
162 $scope.cisternas[i].cisternaCarga.idProducto &&
160 $scope.articuloSeleccionado.idArticulo !== 163 $scope.articuloSeleccionado.idArticulo !==
161 $scope.cisternas[i].cisternaCarga.idProducto) 164 $scope.cisternas[i].cisternaCarga.idProducto)
162 { 165 {
163 $scope.cisternas[i].disabled = true; 166 $scope.cisternas[i].disabled = true;
164 continue; 167 continue;
165 } 168 }
166 $scope.cisternas[i].disabled = false; 169 $scope.cisternas[i].disabled = false;
167 } 170 }
168 }; 171 };
169 $scope.rellenarInput = function(input) { 172 $scope.rellenarInput = function(input) {
170 if(!$scope.articuloSeleccionado) return; 173 if(!$scope.articuloSeleccionado) return;
171 if($scope.articuloSeleccionado.cantidad - 174 if($scope.articuloSeleccionado.cantidad -
172 $scope.articuloSeleccionado.cantidadCargada === 0) { 175 $scope.articuloSeleccionado.cantidadCargada === 0) {
173 return input; 176 return input;
174 } 177 }
175 if(!input) input = 0; 178 if(!input) input = 0;
176 input = parseFloat(input); 179 input = parseFloat(input);
177 input += parseFloat($scope.articuloSeleccionado.cantidad - 180 input += parseFloat($scope.articuloSeleccionado.cantidad -
178 $scope.articuloSeleccionado.cantidadCargada); 181 $scope.articuloSeleccionado.cantidadCargada);
179 return input; 182 return input;
180 }; 183 };
181 $scope.distribucionDisponible = function() { 184 $scope.distribucionDisponible = function() {
182 if(!$scope.articuloSeleccionado || $scope.articuloSeleccionado.cantidad - 185 if(!$scope.articuloSeleccionado || $scope.articuloSeleccionado.cantidad -
183 $scope.articuloSeleccionado.cantidadCargada !== 0 || 186 $scope.articuloSeleccionado.cantidadCargada !== 0 ||
184 !$scope.tieneArticulosPendientes()) { 187 !$scope.tieneArticulosPendientes()) {
185 return false; 188 return false;
186 } 189 }
187 return true; 190 return true;
188 }; 191 };
189 $scope.tieneArticulosPendientes = function() { 192 $scope.tieneArticulosPendientes = function() {
190 var algunValorNegativo = $scope.aCargar.filter(function(p) { 193 var algunValorNegativo = $scope.aCargar.filter(function(p) {
191 return p < 0; 194 return p < 0;
192 }); 195 });
193 if(algunValorNegativo.length) { 196 if(algunValorNegativo.length) {
194 return false; 197 return false;
195 } 198 }
196 var articulosDescargados = $scope.articulos.filter(function(filter) { 199 var articulosDescargados = $scope.articulos.filter(function(filter) {
197 return filter.cargado === true; 200 return filter.cargado === true;
198 }); 201 });
199 if(articulosDescargados.length === $scope.articulos.length) { 202 if(articulosDescargados.length === $scope.articulos.length) {
200 $scope.aCargar = []; 203 $scope.aCargar = [];
201 return false; 204 return false;
202 } 205 }
203 return true; 206 return true;
204 }; 207 };
205 }]); 208 }]);
1 angular.module('focaLogisticaPedidoRuta') 1 angular.module('focaLogisticaPedidoRuta')
2 .service( 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 return { 9 return {
10 idUsuario: $cookies.get('idUsuario'), 10 idUsuario: $cookies.get('idUsuario'),
11 obtenerActividad: function(parametros) { 11 obtenerActividad: function(parametros) {
12 return $http.post(API_ENDPOINT.URL + '/seguimiento/filtros', parametros); 12 return $http.post(API_ENDPOINT.URL + '/seguimiento/filtros', parametros);
13 }, 13 },
14 obtenerVehiculoById: function(idVehiculo) { 14 obtenerVehiculoById: function(idVehiculo) {
15 return $http.get(API_ENDPOINT.URL + '/vehiculo/' + idVehiculo); 15 return $http.get(API_ENDPOINT.URL + '/vehiculo/' + idVehiculo);
16 }, 16 },
17 obtenerRemitoById: function(idRemito) { 17 obtenerRemitoById: function(idRemito) {
18 return $http.get(API_ENDPOINT.URL + '/remito/obtener/' + idRemito); 18 return $http.get(API_ENDPOINT.URL + '/remito/obtener/' + idRemito);
19 }, 19 },
20 guardarCisternas: function(cisterna, idRemito) { 20 guardarCisternas: function(cisterna, idRemito) {
21 return $http.post(API_ENDPOINT.URL + '/cisterna/guardar/cargar/' + 21 return $http.post(API_ENDPOINT.URL + '/cisterna/guardar/cargar/' +
22 this.idUsuario + '/' + idRemito,cisterna); 22 this.idUsuario + '/' + idRemito,cisterna);
23 }, 23 },
24 numeroHojaRuta: function() { 24 numeroHojaRuta: function() {
25 return $http.get(API_ENDPOINT.URL + '/hoja-ruta/numero-siguiente'); 25 return $http.get(API_ENDPOINT.URL + '/hoja-ruta/numero-siguiente');
26 }, 26 },
27 getRemitos: function(idVehiculo) { 27 getRemitos: function(idVehiculo) {
28 return $http.get(API_ENDPOINT.URL + '/remito/sin-hoja-ruta/' +idVehiculo); 28 return $http.get(API_ENDPOINT.URL + '/remito/sin-hoja-ruta/' +idVehiculo);
29 }, 29 },
30 crearHojaRuta: function(hojaRuta) { 30 crearHojaRuta: function(hojaRuta) {
31 return $http.post(API_ENDPOINT.URL + '/hoja-ruta', hojaRuta); 31 return $http.post(API_ENDPOINT.URL + '/hoja-ruta', hojaRuta);
32 }, 32 },
33 desasociarRemitos: function(remitos, idVehiculo, sinRemitos) { 33 desasociarRemitos: function(remitos, idVehiculo, sinRemitos) {
34 var idsRemitos = []; 34 var idsRemitos = [];
35 for (var i = 0; i < remitos.length; i++) { 35 for (var i = 0; i < remitos.length; i++) {
36 idsRemitos.push(remitos[i].id); 36 idsRemitos.push(remitos[i].id);
37 } 37 }
38 return $http.post(API_ENDPOINT.URL + '/vehiculo/desasociar-remitos', 38 return $http.post(API_ENDPOINT.URL + '/vehiculo/desasociar-remitos',
39 { 39 {
40 idsRemitos: idsRemitos, 40 idsRemitos: idsRemitos,
41 idVehiculo: idVehiculo, 41 idVehiculo: idVehiculo,
42 vehiculoSinRemitos: sinRemitos 42 vehiculoSinRemitos: sinRemitos
43 }); 43 });
44 }, 44 },
45 obtenerRemitosDeCarga: function(remitos) { 45 obtenerRemitosDeCarga: function(remitos) {
46 var remitosRes = []; 46 var remitosRes = [];
47 for(var i = 0; i < remitos.cisternas.length; i++) { 47 for(var i = 0; i < remitos.cisternas.length; i++) {
48 procesoCistena(remitos.cisternas[i]); 48 procesoCistena(remitos.cisternas[i], this.fecha.toISOString());
49 } 49 }
50 function procesoCistena(cisterna) { 50 function procesoCistena(cisterna, fecha) {
51 for(var j = 0; j < cisterna.cisternaCarga.cisternaMovimientos.length; 51 for(var j = 0; j < cisterna.cisternasCarga.length; j++) {
52 j++) { 52 for(var k = 0; k < cisterna.cisternasCarga[j].cisternaMovimientos
53 procesoMovimiento( 53 .length; k++)
54 cisterna.cisternaCarga.cisternaMovimientos[j]); 54 {
55 if(cisterna.cisternasCarga[j].fechaReparto.substring(0, 10) ===
56 fecha.substring(0, 10))
57 {
58 procesoMovimiento(cisterna.cisternasCarga[j]
59 .cisternaMovimientos[k]);
60 }
61 }
55 } 62 }
56 } 63 }
57 function procesoMovimiento(movimiento) { 64 function procesoMovimiento(movimiento) {
58 if(!movimiento.anulado && movimiento.remito && 65 if(!movimiento.anulado && movimiento.remito &&
59 !movimiento.remito.idHojaRuta) { 66 !movimiento.remito.idHojaRuta) {
60 var remito = movimiento.remito; 67 var remito = movimiento.remito;
61 var yaEstaCargado = $filter('filter')(remitosRes, {id: remito.id}); 68 var yaEstaCargado = $filter('filter')(remitosRes, {id: remito.id});
62 if(!yaEstaCargado.length && movimiento.metodo === 'carga') { 69 if(!yaEstaCargado.length && movimiento.metodo === 'carga') {
63 remitosRes.push(remito); 70 remitosRes.push(remito);
64 } 71 }
65 } 72 }
66 } 73 }
67 return remitosRes; 74 return remitosRes;
68 }, 75 },
69 getVehiculosByIdUsuario: function() { 76 getVehiculosByIdUsuario: function() {
70 return $http.get(API_ENDPOINT.URL + '/vehiculo/usuario/' + this.idUsuario); 77 return $http.get(API_ENDPOINT.URL + '/vehiculo/usuario/' + this.idUsuario);
71 }, 78 },
72 obtenerCisternasPorFecha: function(idVehiculo, fecha) { 79 obtenerCisternasPorFecha: function(idVehiculo) {
73 return $http.post(API_ENDPOINT.URL + '/cisterna/listar/fecha', 80 return $http.post(API_ENDPOINT.URL + '/cisterna/listar/fecha',
74 {idVehiculo: idVehiculo, fechaReparto: fecha}); 81 {idVehiculo: idVehiculo, fechaReparto: this.fecha});
82 },
83 getUnidadesByFecha: function() {
84 return $http.post(API_ENDPOINT.URL + '/vehiculo/listar/fecha',
85 {fecha: this.fecha});
86 },
87 setFechaReparto: function(fechaReparto) {
88 this.fecha = fechaReparto;
75 } 89 }
76 }; 90 };
77 }]); 91 }]);
78 92
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 --> 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="Confirmar 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
src/views/foca-modal-crear-hoja-ruta.html
1 <div class="modal-header"> 1 <div class="modal-header">
2 <h5>En desarrollo</h5> 2 <h5>En desarrollo</h5>
3 <h4>Confirmar hoja de ruta</h4> 3 <h4>Confirmar hoja de ruta</h4>
4 <div class="row"> 4 <div class="row">
5 <!-- <div class="col-6"> 5 <!-- <div class="col-6">
6 <span>Hoja de ruta Nº </span> 6 <span>Hoja de ruta Nº </span>
7 <strong ng-bind="[sucursal, numero] | comprobante"></strong> 7 <strong ng-bind="[sucursal, numero] | comprobante"></strong>
8 </div> --> 8 </div> -->
9 <div class="col-6 row"> 9 <div class="col-6 row">
10 <label class="col-3 mt-2">Fecha:</label> 10 <label class="col-3 mt-2">Fecha:</label>
11 <input 11 <input
12 type="text" 12 type="text"
13 readonly 13 readonly
14 ng-model="now" 14 ng-model="now"
15 uib-datepicker-popup="dd/MM/yyyy" 15 uib-datepicker-popup="dd/MM/yyyy"
16 show-button-bar="false" 16 show-button-bar="false"
17 is-open="datepickerOpen" 17 is-open="datepickerOpen"
18 on-open-focus="false" 18 on-open-focus="false"
19 ng-focus="datepickerOpen = true" 19 ng-focus="datepickerOpen = true"
20 datepicker-options="dateOptions" 20 datepicker-options="dateOptions"
21 class="form-control col-8"/> 21 class="form-control col-8"/>
22 </div> 22 </div>
23 </div> 23 </div>
24 </div> 24 </div>
25 <div class="modal-body"> 25 <div class="modal-body">
26 <form class="row" name="formHojaRuta"> 26 <form class="row" name="formHojaRuta">
27 27
28 <div class="col-2"> 28 <div class="col-2">
29 <label>Transportista</label> 29 <label>Transportista</label>
30 </div> 30 </div>
31 <div class="col-4"> 31 <div class="col-4">
32 <input 32 <input
33 class="form-control" 33 class="form-control"
34 readonly 34 readonly
35 ng-value="vehiculo.transportista.COD + ' ' + vehiculo.transportista.NOM" 35 ng-value="vehiculo.transportista.COD + ' ' + vehiculo.transportista.NOM"
36 > 36 >
37 </div> 37 </div>
38 <div class="col-2 form-group"> 38 <div class="col-2 form-group">
39 <label>Unidad</label> 39 <label>Unidad</label>
40 </div> 40 </div>
41 <div class="col-4"> 41 <div class="col-4">
42 <input 42 <input
43 class="form-control" 43 class="form-control"
44 readonly 44 readonly
45 ng-model="vehiculo.tractor" 45 ng-model="vehiculo.tractor"
46 > 46 >
47 </div> 47 </div>
48 </form> 48 </form>
49 <strong>Remitos:</strong> 49 <strong>Remitos:</strong>
50 <table class="table"> 50 <table class="table">
51 <thead> 51 <thead>
52 <tr> 52 <tr>
53 <th>Remito Nº</th> 53 <th>Remito Nº</th>
54 <th>Cliente</th> 54 <th>Cliente</th>
55 <th>Domicilio de entrega</th> 55 <th>Domicilio de entrega</th>
56 </tr> 56 </tr>
57 </thead> 57 </thead>
58 <tbody> 58 <tbody>
59 <tr ng-show="!remitos.length"> 59 <tr ng-show="!remitos.length">
60 <td colspan="3"> 60 <td colspan="3">
61 No se han encontrado remitos. 61 No se han encontrado remitos.
62 </td> 62 </td>
63 </tr> 63 </tr>
64 <tr ng-repeat="remito in remitos"> 64 <tr ng-repeat="remito in remitos">
65 <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td> 65 <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td>
66 <td ng-bind="remito.nombreCliente"></td> 66 <td ng-bind="remito.nombreCliente"></td>
67 <td ng-bind="remito.domicilioStamp"></td> 67 <td ng-bind="remito.domicilioStamp"></td>
68 <td> 68 <td>
69 <div class="custom-control custom-checkbox"> 69 <div class="custom-control custom-checkbox">
70 <input 70 <input
71 type="checkbox" 71 type="checkbox"
72 ng-model="remito.checked" 72 ng-model="remito.checked"
73 class="custom-control-input" 73 class="custom-control-input"
74 id="{{remito.id}}"> 74 id="{{remito.id}}">
75 <label class="custom-control-label" for="{{remito.id}}"></label> 75 <label class="custom-control-label" for="{{remito.id}}"></label>
76 </div> 76 </div>
77 </td> 77 </td>
78 </tr> 78 </tr>
79 </tbody> 79 </tbody>
80 </table> 80 </table>
81 </div> 81 </div>
82 <div class="modal-footer py-1"> 82 <div class="modal-footer py-1">
83 <button 83 <button
84 class="btn btn-sm btn-danger" 84 class="btn btn-sm btn-danger"
85 type="button" 85 type="button"
86 ng-click="eliminarRemitos()" 86 ng-click="eliminarRemitos()"
87 ng-disabled="minimoUnoChecked()">Eliminar</button> 87 ng-disabled="minimoUnoChecked()">Eliminar</button>
88 <button 88 <button
89 class="btn btn-sm btn-secondary" 89 class="btn btn-sm btn-secondary"
90 ladda="cargando" 90 ladda="cargando"
91 type="button" 91 type="button"
92 ng-click="cancelar()">Cancelar</button> 92 ng-click="cancelar()">Cancelar</button>
93 <button 93 <button
94 class="btn btn-sm btn-primary" 94 class="btn btn-sm btn-primary"
95 ladda="cargando" 95 ladda="cargando"
96 type="button" 96 type="button"
97 ng-disabled="!formHojaRuta.$valid || !remitos.length || true" 97 ng-disabled="!formHojaRuta.$valid || !remitos.length || true"
98 ng-click="aceptar()">Crear hoja ruta</button> 98 ng-click="aceptar()">Confirmar hoja ruta</button>
99 </div> 99 </div>
100 100