Commit 2ed71aa8da577fd94e117fabcb66b49cd78e6903

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

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