Commit 332683dd9f41b63bca52366f81f61b2fca6724d4

Authored by Jose Pinto
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

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