Commit 88a160b5b9ef39abaa394981a15193b5e45e717b

Authored by Nicolás Guarnieri
1 parent d836dbc78a
Exists in master

arreglos para cerrar hoja ruta

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: 'Vehículo', 12 label: 'Vehículo',
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: 'fechaDeReparto.png' 17 image: 'fechaDeReparto.png'
18 }; 18 };
19 $scope.botonera = [fecha, transportista]; 19 $scope.botonera = [fecha, transportista];
20 var cabecera = ''; 20 var cabecera = '';
21 $scope.now = new Date(); 21 $scope.now = new Date();
22 $scope.idVendedor = 0; 22 $scope.idVendedor = 0;
23 $scope.marcadores = []; 23 $scope.marcadores = [];
24 $scope.vehiculos = []; 24 $scope.vehiculos = [];
25 getSeguimiento(); 25 getSeguimiento();
26 $scope.arrastrando = false; 26 $scope.arrastrando = false;
27 $scope.general = function() { 27 $scope.general = function() {
28 $scope.idVendedor = 0; 28 $scope.idVendedor = 0;
29 getSeguimiento(); 29 getSeguimiento();
30 }; 30 };
31 31
32 //SETEO BOTONERA LATERAL 32 //SETEO BOTONERA LATERAL
33 focaBotoneraLateralService.showSalir(true); 33 focaBotoneraLateralService.showSalir(true);
34 focaBotoneraLateralService.showPausar(false); 34 focaBotoneraLateralService.showPausar(false);
35 focaBotoneraLateralService.showGuardar(false); 35 focaBotoneraLateralService.showGuardar(false);
36 36
37
38
39 $scope.general = function() { 37 $scope.general = function() {
40 $scope.idVendedor = 0; 38 $scope.idVendedor = 0;
41 getSeguimiento(); 39 getSeguimiento();
42 $scope.$broadcast('removeCabecera', cabecera); 40 $scope.$broadcast('removeCabecera', cabecera);
43 $scope.$broadcast('addCabecera', { 41 $scope.$broadcast('addCabecera', {
44 label: 'General', 42 label: 'General',
45 valor: '' 43 valor: ''
46 }); 44 });
47 }; 45 };
48 46
49 $scope.cargar = function(idVehiculo, punto) { 47 $scope.cargar = function(idVehiculo, punto) {
50 if(!eligioFecha()) return; 48 if(!eligioFecha()) return;
51 var idRemito; 49 var idRemito;
52 if(punto === -1) { 50 if(punto === -1) {
53 idRemito = -1; 51 idRemito = -1;
54 }else { 52 }else {
55 idRemito = JSON.parse(punto).notaPedido.remito.id; 53 idRemito = JSON.parse(punto).notaPedido.remito.id;
56 } 54 }
57 var modalInstance = $uibModal.open( 55 var modalInstance = $uibModal.open(
58 { 56 {
59 ariaLabelledBy: 'Busqueda de Vehiculo', 57 ariaLabelledBy: 'Busqueda de Vehiculo',
60 templateUrl: 'foca-detalle-vehiculo.html', 58 templateUrl: 'foca-detalle-vehiculo.html',
61 controller: 'focaDetalleVehiculo', 59 controller: 'focaDetalleVehiculo',
62 size: 'lg', 60 size: 'lg',
63 resolve: { 61 resolve: {
64 idVehiculo: function() {return idVehiculo;}, 62 idVehiculo: function() {return idVehiculo;},
65 idRemito: function() {return idRemito;}, 63 idRemito: function() {return idRemito;},
66 fechaReparto: function() {return $scope.fechaReparto;} 64 fechaReparto: function() {return $scope.fechaReparto;}
67 } 65 }
68 } 66 }
69 ); 67 );
70 modalInstance.result.then(function() { 68 modalInstance.result.then(function() {
71 }, function() { 69 }, function() {
72 }); 70 });
73 }; 71 };
74 72
75 $scope.quitarVehiculo = function(vehiculo) { 73 $scope.quitarVehiculo = function(vehiculo) {
76 if(!eligioFecha() || vehiculoEnUso(vehiculo)) return; 74 if(!eligioFecha() || vehiculoEnUso(vehiculo)) return;
75
77 focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + 76 focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' +
78 vehiculo.codigo + '?').then(function() { 77 vehiculo.codigo + ' de ' + vehiculo.transportista.NOM + '?').then(function() {
79 eliminarVehiculo(vehiculo); 78 eliminarVehiculo(vehiculo);
80 }); 79 });
81 }; 80 };
82 81
83 $scope.hacerHojaRuta = function(vehiculo) { 82 $scope.hacerHojaRuta = function(vehiculo, cerrar) {
84 if(!eligioFecha() || vehiculoEnUso(vehiculo)) return; 83 if(!eligioFecha() || vehiculoEnUso(vehiculo)) return;
85 var modalInstance = $uibModal.open( 84 var modalInstance = $uibModal.open(
86 { 85 {
87 ariaLabelledBy: 'Creación hoja ruta', 86 ariaLabelledBy: 'Creación hoja ruta',
88 templateUrl: 'foca-modal-cerrar-vehiculo.html', 87 templateUrl: 'foca-modal-cerrar-vehiculo.html',
89 controller: 'focaModalCerrarVehiculo', 88 controller: 'focaModalCerrarVehiculo',
90 size: 'lg', 89 size: 'lg',
91 resolve: { 90 resolve: {
92 idVehiculo: function() {return vehiculo.id;}, 91 idVehiculo: function() {return vehiculo.id;},
93 fechaReparto: function() {return $scope.fechaReparto;} 92 fechaReparto: function() {return $scope.fechaReparto;},
93 cerrar: function() {return cerrar;}
94 } 94 }
95 } 95 }
96 ); 96 );
97 modalInstance.result.then(function() { 97 modalInstance.result.then(function() {
98 98
99 }, function() { 99 }, function() {
100 //usar cuando se cancela el modal 100 //usar cuando se cancela el modal
101 }); 101 });
102 }; 102 };
103 103
104 $scope.arrastra = function() { 104 $scope.arrastra = function() {
105 $scope.arrastrando = true; 105 $scope.arrastrando = true;
106 $scope.$digest(); 106 $scope.$digest();
107 }; 107 };
108 108
109 $scope.noArrastra = function() { 109 $scope.noArrastra = function() {
110 $scope.arrastrando = false; 110 $scope.arrastrando = false;
111 $scope.$digest(); 111 $scope.$digest();
112 }; 112 };
113 113
114 $scope.individual = function() { 114 $scope.individual = function() {
115 $scope.idVendedor = -1; 115 $scope.idVendedor = -1;
116 }; 116 };
117 117
118 $scope.mostrarDetalle = function() { 118 $scope.mostrarDetalle = function() {
119 $scope.detalle = true; 119 $scope.detalle = true;
120 }; 120 };
121 121
122 $scope.salir = function() { 122 $scope.salir = function() {
123 $location.path('/'); 123 $location.path('/');
124 }; 124 };
125 125
126 $scope.search = function() { 126 $scope.search = function() {
127 getSeguimiento(); 127 getSeguimiento();
128 }; 128 };
129 129
130 $scope.fecha = function() { 130 $scope.fecha = function() {
131 getSeguimiento(); 131 getSeguimiento();
132 }; 132 };
133 133
134 $scope.seleccionarVehículo = function() { 134 $scope.seleccionarVehículo = function() {
135 var modalInstance = $uibModal.open( 135 var modalInstance = $uibModal.open(
136 { 136 {
137 ariaLabelledBy: 'Busqueda de Transportista', 137 ariaLabelledBy: 'Busqueda de Transportista',
138 templateUrl: 'modal-proveedor.html', 138 templateUrl: 'modal-proveedor.html',
139 controller: 'focaModalProveedorCtrl', 139 controller: 'focaModalProveedorCtrl',
140 size: 'lg', 140 size: 'lg',
141 resolve: { 141 resolve: {
142 transportista: function() { 142 transportista: function() {
143 return true; 143 return true;
144 } 144 }
145 } 145 }
146 } 146 }
147 ); 147 );
148 modalInstance.result.then(function(transportista) { 148 modalInstance.result.then(function(transportista) {
149 $scope.selectVehiculo(transportista.COD); 149 $scope.selectVehiculo(transportista.COD);
150 }); 150 });
151 }; 151 };
152 152
153 $scope.selectVehiculo = function(idTransportista) { 153 $scope.selectVehiculo = function(idTransportista) {
154 var query = '/vehiculo/transportista/' + idTransportista; 154 var query = '/vehiculo/transportista/' + idTransportista;
155 var columnas = { 155 var columnas = {
156 nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], 156 nombre: ['Código', 'tractor', 'Semi', 'Capacidad'],
157 propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] 157 propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas']
158 }; 158 };
159 var titulo = 'Búsqueda de vehiculos'; 159 var titulo = 'Búsqueda de vehiculos';
160 focaModalService.modal(columnas, query, titulo).then( 160 focaModalService.modal(columnas, query, titulo).then(
161 function(vehiculo) { 161 function(vehiculo) {
162 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); 162 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id});
163 if(existe.length) { 163 if(existe.length) {
164 focaModalService.alert('El vehiculo ya ha sido cargado'); 164 focaModalService.alert('El vehiculo ya ha sido cargado');
165 return; 165 return;
166 } 166 }
167 if(!vehiculo.cisternas.length) { 167 if(!vehiculo.cisternas.length) {
168 focaModalService.alert('El vehiculo no tiene cisternas'); 168 focaModalService.alert('El vehiculo no tiene cisternas');
169 return; 169 return;
170 } 170 }
171 $scope.vehiculos.push(vehiculo); 171 $scope.vehiculos.push(vehiculo);
172 }, function() { 172 }, function() {
173 // funcion ejecutada cuando se cancela el modal 173 // funcion ejecutada cuando se cancela el modal
174 }); 174 });
175 }; 175 };
176 176
177 $scope.seleccionarFechaReparto = function() { 177 $scope.seleccionarFechaReparto = function() {
178 focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { 178 focaModalService.modalFecha('Fecha de reparto').then(function(fecha) {
179 $scope.$broadcast('addCabecera',{ 179 $scope.$broadcast('addCabecera',{
180 label: 'Fecha:', 180 label: 'Fecha:',
181 valor: fecha.toLocaleDateString() 181 valor: fecha.toLocaleDateString()
182 }); 182 });
183 $scope.fechaReparto = fecha; 183 $scope.fechaReparto = fecha;
184 focaLogisticaPedidoRutaService.setFechaReparto(fecha); 184 focaLogisticaPedidoRutaService.setFechaReparto(fecha);
185 focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) { 185 focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) {
186 $scope.vehiculos = res.data; 186 $scope.vehiculos = res.data;
187 }); 187 });
188 }); 188 });
189 }; 189 };
190 190
191 function getSeguimiento() { 191 function getSeguimiento() {
192 var desde = new Date('1900/01/01'); 192 var desde = new Date('1900/01/01');
193 var hasta = new Date('2099/01/01'); 193 var hasta = new Date('2099/01/01');
194 if($scope.fechaDesde) { 194 if($scope.fechaDesde) {
195 var fechaDesde = $scope.fechaDesde; 195 var fechaDesde = $scope.fechaDesde;
196 desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); 196 desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0));
197 desde = new Date(desde); 197 desde = new Date(desde);
198 } 198 }
199 if($scope.fechaHasta) { 199 if($scope.fechaHasta) {
200 var fechaHasta = $scope.fechaHasta; 200 var fechaHasta = $scope.fechaHasta;
201 hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); 201 hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0));
202 hasta = hasta.setDate(hasta.getDate() + 1); 202 hasta = hasta.setDate(hasta.getDate() + 1);
203 hasta = new Date(hasta); 203 hasta = new Date(hasta);
204 } 204 }
205 var datos = { 205 var datos = {
206 actividad: $scope.actividad, 206 actividad: $scope.actividad,
207 idUsuario: $scope.idVendedor, 207 idUsuario: $scope.idVendedor,
208 fechaDesde: desde, 208 fechaDesde: desde,
209 fechaHasta: hasta, 209 fechaHasta: hasta,
210 asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? 210 asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ?
211 false : undefined) 211 false : undefined)
212 }; 212 };
213 213
214 $scope.datosBuscados = { 214 $scope.datosBuscados = {
215 actividad: $scope.actividad, 215 actividad: $scope.actividad,
216 individual: $scope.idVendedor ? true : false 216 individual: $scope.idVendedor ? true : false
217 }; 217 };
218 218
219 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { 219 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) {
220 if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { 220 if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) {
221 $scope.marcadores = datos.data; 221 $scope.marcadores = datos.data;
222 } 222 }
223 }); 223 });
224 } 224 }
225 225
226 function eliminarVehiculo(vehiculo) { 226 function eliminarVehiculo(vehiculo) {
227 focaLogisticaPedidoRutaService.getRemitos(vehiculo.id).then(function(res) { 227 focaLogisticaPedidoRutaService.getRemitos(vehiculo.id).then(function(res) {
228 if(!focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data).length) { 228 if(!focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data).length) {
229 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); 229 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1);
230 }else { 230 }else {
231 focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + 231 focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' +
232 'tiene remitos asociados').then(function() { 232 'tiene remitos asociados').then(function() {
233 $scope.hacerHojaRuta(vehiculo); 233 $scope.hacerHojaRuta(vehiculo, true);
234 }); 234 });
235 } 235 }
236 }); 236 });
237 } 237 }
238 238
239 function eligioFecha() { 239 function eligioFecha() {
240 if(!$scope.fechaReparto) { 240 if(!$scope.fechaReparto) {
241 focaModalService.alert('Primero seleccione fecha de reparto'); 241 focaModalService.alert('Primero seleccione fecha de reparto');
242 return false; 242 return false;
243 } 243 }
244 return true; 244 return true;
245 } 245 }
246 246
247 function vehiculoEnUso(vehiculo) { 247 function vehiculoEnUso(vehiculo) {
248 var idUsuario = focaLogisticaPedidoRutaService.idUsuario; 248 var idUsuario = focaLogisticaPedidoRutaService.idUsuario;
249 for(var i = 0; i < vehiculo.cisternas.length; i++) { 249 for(var i = 0; i < vehiculo.cisternas.length; i++) {
250 for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { 250 for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) {
251 var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; 251 var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j];
252 if(cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto 252 if(cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto
253 .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso && 253 .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso &&
254 cisternaCarga.idUsuarioProceso !== idUsuario) 254 cisternaCarga.idUsuarioProceso !== idUsuario)
255 { 255 {
256 focaModalService.alert('El vehículo está siendo usado por otro usuario'); 256 focaModalService.alert('El vehículo está siendo usado por otro usuario');
257 return true; 257 return true;
258 } 258 }
259 } 259 }
260 } 260 }
261 return false; 261 return false;
262 } 262 }
263 // TODO: descomentar en produccion 263 // TODO: descomentar en produccion
264 // $interval(function() { 264 // $interval(function() {
265 // getSeguimiento(); 265 // getSeguimiento();
266 // }, 5000); 266 // }, 5000);
267 } 267 }
src/js/controllerCerrarVehiculo.js
1 angular.module('focaLogisticaPedidoRuta') 1 angular.module('focaLogisticaPedidoRuta')
2 .controller('focaModalCerrarVehiculo', [ 2 .controller('focaModalCerrarVehiculo', [
3 '$scope', 3 '$scope',
4 '$uibModalInstance', 4 '$uibModalInstance',
5 '$uibModal', 5 '$uibModal',
6 'focaLogisticaPedidoRutaService', 6 'focaLogisticaPedidoRutaService',
7 'idVehiculo', 7 'idVehiculo',
8 'focaModalService', 8 'focaModalService',
9 '$filter', 9 '$filter',
10 'fechaReparto', 10 'fechaReparto',
11 'cerrar',
11 function($scope, $uibModalInstance, $uibModal, focaLogisticaPedidoRutaService, 12 function($scope, $uibModalInstance, $uibModal, focaLogisticaPedidoRutaService,
12 idVehiculo, focaModalService, $filter, fechaReparto) { 13 idVehiculo, focaModalService, $filter, fechaReparto, cerrar) {
14 $scope.cerrar = cerrar;
13 $scope.vehiculo = {}; 15 $scope.vehiculo = {};
14 $scope.remitos = []; 16 $scope.remitos = [];
15 $scope.now = fechaReparto; 17 $scope.now = fechaReparto;
16 focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then(function(res) { 18 focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then(function(res) {
17 $scope.vehiculo = res.data; 19 $scope.vehiculo = res.data;
18 }); 20 });
19 focaLogisticaPedidoRutaService.getRemitos(idVehiculo).then(function(res) { 21 focaLogisticaPedidoRutaService.getRemitos(idVehiculo).then(function(res) {
20 $scope.remitos = focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data); 22 $scope.remitos = focaLogisticaPedidoRutaService.obtenerRemitosDeCarga(res.data);
21 }); 23 });
22 focaLogisticaPedidoRutaService.numeroHojaRuta().then(function(res) { 24 focaLogisticaPedidoRutaService.numeroHojaRuta().then(function(res) {
23 $scope.sucursal = res.data.sucursal; 25 $scope.sucursal = res.data.sucursal;
24 $scope.numero = res.data.numeroHojaRuta; 26 $scope.numero = res.data.numeroHojaRuta;
25 }); 27 });
26 $scope.cancelar = function() { 28 $scope.cancelar = function() {
27 $uibModalInstance.close(); 29 $uibModalInstance.close();
28 }; 30 };
29 $scope.aceptar = function() { 31 $scope.aceptar = function() {
30 var idsRemito = []; 32 var idsRemito = [];
31 $scope.remitos.forEach(function(remito) { 33 $scope.remitos.forEach(function(remito) {
32 idsRemito.push(remito.id); 34 idsRemito.push(remito.id);
33 }); 35 });
34 var cierreDistribuicion = { 36 var cierreDistribuicion = {
35 idsRemito: idsRemito, 37 idsRemito: idsRemito,
36 fechaReparto: focaLogisticaPedidoRutaService.fecha 38 fechaReparto: focaLogisticaPedidoRutaService.fecha
37 }; 39 };
38 focaLogisticaPedidoRutaService.cerrarDistribuicion(cierreDistribuicion) 40 focaLogisticaPedidoRutaService.cerrarDistribuicion(cierreDistribuicion)
39 .then(function() { 41 .then(function() {
40 focaModalService.alert('Vehículo cerrado con éxito'); 42 focaModalService.alert('Vehículo cerrado con éxito');
41 } 43 }
42 ); 44 );
43 }; 45 };
44 $scope.seleccionarChofer = function() { 46 $scope.seleccionarChofer = function() {
45 var modalInstance = $uibModal.open( 47 var modalInstance = $uibModal.open(
46 { 48 {
47 ariaLabelledBy: 'Busqueda de Chofer', 49 ariaLabelledBy: 'Busqueda de Chofer',
48 templateUrl: 'modal-chofer.html', 50 templateUrl: 'modal-chofer.html',
49 controller: 'focaModalChoferController', 51 controller: 'focaModalChoferController',
50 size: 'lg' 52 size: 'lg'
51 } 53 }
52 ); 54 );
53 55
54 modalInstance.result.then( 56 modalInstance.result.then(
55 function(chofer) { 57 function(chofer) {
56 $scope.chofer = chofer; 58 $scope.chofer = chofer;
57 }, function() { 59 }, function() {
58 // funcion ejecutada cuando se cancela el modal 60 // funcion ejecutada cuando se cancela el modal
59 } 61 }
60 ); 62 );
61 }; 63 };
62 $scope.eliminarRemitos = function() { 64 $scope.eliminarRemitos = function() {
63 var remitosDel = $filter('filter')($scope.remitos, {checked: true}); 65 var remitosDel = $filter('filter')($scope.remitos, {checked: true});
64 focaModalService.alert('¿Seguro que desea desasociar estos remitos del vehículo?') 66 focaModalService.alert('¿Seguro que desea desasociar estos remitos del vehículo?')
65 .then(function() { 67 .then(function() {
66 eliminarRemitos(remitosDel); 68 eliminarRemitos(remitosDel);
67 } 69 }
68 ); 70 );
69 }; 71 };
70 $scope.minimoUnoChecked = function() { 72 $scope.minimoUnoChecked = function() {
71 var remitosChequeados = $filter('filter')($scope.remitos, {checked: true}); 73 var remitosChequeados = $filter('filter')($scope.remitos, {checked: true});
72 return !remitosChequeados.length; 74 return !remitosChequeados.length;
73 }; 75 };
74 function eliminarRemitos(remitosDel) { 76 function eliminarRemitos(remitosDel) {
75 var nuevosRemitos = $filter('filter')($scope.remitos, {checked: !true}); 77 var nuevosRemitos = $filter('filter')($scope.remitos, {checked: !true});
76 focaLogisticaPedidoRutaService.desasociarRemitos(remitosDel, $scope.vehiculo.id, 78 focaLogisticaPedidoRutaService.desasociarRemitos(remitosDel, $scope.vehiculo.id,
77 nuevosRemitos ? true : false).then(function() { 79 nuevosRemitos ? true : false).then(function() {
78 focaModalService.alert('Remitos desasociados con éxito');
79 $scope.remitos = nuevosRemitos; 80 $scope.remitos = nuevosRemitos;
80 }); 81 });
81 } 82 }
82 }]); 83 }]);
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 position-relative"> 9 <div class="row px-5 py-2 botonera-secundaria position-relative">
10 <div class="col-10"> 10 <div class="col-10">
11 <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> 11 <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador>
12 </div> 12 </div>
13 <div class="col-2 pl-0 position-absolute right-0"> 13 <div class="col-2 pl-0 position-absolute right-0">
14 <strong>Filtros: </strong> 14 <strong>Filtros: </strong>
15 <br> 15 <br>
16 <span>Fecha Desde</span> 16 <span>Fecha Desde</span>
17 <input 17 <input
18 type="text" 18 type="text"
19 readonly 19 readonly
20 ng-model="fechaDesde" 20 ng-model="fechaDesde"
21 class="form-control form-control-sm" 21 class="form-control form-control-sm"
22 uib-datepicker-popup="dd/MM/yyyy" 22 uib-datepicker-popup="dd/MM/yyyy"
23 show-button-bar="false" 23 show-button-bar="false"
24 is-open="fechaDesdeOpen" 24 is-open="fechaDesdeOpen"
25 on-open-focus="false" 25 on-open-focus="false"
26 ng-focus="fechaDesdeOpen = true" 26 ng-focus="fechaDesdeOpen = true"
27 ng-change="search()" 27 ng-change="search()"
28 /> 28 />
29 <span>Fecha Hasta</span> 29 <span>Fecha Hasta</span>
30 <input 30 <input
31 type="text" 31 type="text"
32 readonly 32 readonly
33 ng-model="fechaHasta" 33 ng-model="fechaHasta"
34 class="form-control form-control-sm" 34 class="form-control form-control-sm"
35 uib-datepicker-popup="dd/MM/yyyy" 35 uib-datepicker-popup="dd/MM/yyyy"
36 show-button-bar="false" 36 show-button-bar="false"
37 is-open="fechaHastaOpen" 37 is-open="fechaHastaOpen"
38 on-open-focus="false" 38 on-open-focus="false"
39 ng-focus="fechaHastaOpen = true" 39 ng-focus="fechaHastaOpen = true"
40 ng-change="search()" 40 ng-change="search()"
41 /> 41 />
42 <div class="custom-control custom-radio"> 42 <div class="custom-control custom-radio">
43 <input 43 <input
44 type="radio" 44 type="radio"
45 class="custom-control-input" 45 class="custom-control-input"
46 id="idTodos" 46 id="idTodos"
47 name="filtro" 47 name="filtro"
48 ng-model="filtroEstado" 48 ng-model="filtroEstado"
49 ng-change="search()" 49 ng-change="search()"
50 checked> 50 checked>
51 <label class="custom-control-label pb-3" for="idTodos"></label> 51 <label class="custom-control-label pb-3" for="idTodos"></label>
52 <img src="img/marker-icon-grey.png"> 52 <img src="img/marker-icon-grey.png">
53 <strong>Todos</strong> 53 <strong>Todos</strong>
54 </div> 54 </div>
55 <div class="custom-control custom-radio"> 55 <div class="custom-control custom-radio">
56 <input 56 <input
57 type="radio" 57 type="radio"
58 class="custom-control-input" 58 class="custom-control-input"
59 id="idSinAsignar" 59 id="idSinAsignar"
60 name="filtro" 60 name="filtro"
61 ng-model="filtroEstado" 61 ng-model="filtroEstado"
62 ng-change="search()" 62 ng-change="search()"
63 ng-value="false"> 63 ng-value="false">
64 <label class="custom-control-label pb-3" for="idSinAsignar"></label> 64 <label class="custom-control-label pb-3" for="idSinAsignar"></label>
65 <img src="img/marker-icon-green.png"> 65 <img src="img/marker-icon-green.png">
66 <strong>Sin asignar</strong> 66 <strong>Sin asignar</strong>
67 </div> 67 </div>
68 <div class="custom-control custom-radio"> 68 <div class="custom-control custom-radio">
69 <input 69 <input
70 type="radio" 70 type="radio"
71 class="custom-control-input" 71 class="custom-control-input"
72 id="idAsignado" 72 id="idAsignado"
73 name="filtro" 73 name="filtro"
74 ng-model="filtroEstado" 74 ng-model="filtroEstado"
75 ng-change="search()" 75 ng-change="search()"
76 ng-value="true"> 76 ng-value="true">
77 <label class="custom-control-label pb-3" for="idAsignado"></label> 77 <label class="custom-control-label pb-3" for="idAsignado"></label>
78 <img src="img/marker-icon-red.png"> 78 <img src="img/marker-icon-red.png">
79 <strong>Asignado</strong> 79 <strong>Asignado</strong>
80 </div> 80 </div>
81 </div> 81 </div>
82 </div> 82 </div>
83 <div class="row px-5"> 83 <div class="row px-5">
84 <div class="col-10"> 84 <div class="col-10">
85 <foca-logistica 85 <foca-logistica
86 latitud="-32.89214159952345" 86 latitud="-32.89214159952345"
87 longitud="-68.84572999101856" 87 longitud="-68.84572999101856"
88 zoom="14" 88 zoom="14"
89 marcadores="marcadores" 89 marcadores="marcadores"
90 parametros= "datosBuscados" 90 parametros= "datosBuscados"
91 /> 91 />
92 </div> 92 </div>
93 <div class="row"> 93 <div class="row">
94 <div 94 <div
95 class="container col-auto" 95 class="container col-auto"
96 ng-repeat="vehiculo in vehiculos" 96 ng-repeat="vehiculo in vehiculos"
97 ng-click="mostrarDetalleVehiculo(vehiculo)" 97 ng-click="mostrarDetalleVehiculo(vehiculo)"
98 > 98 >
99 <div> 99 <div>
100 <div class="col-md-3 col-sm-6"> 100 <div class="col-md-3 col-sm-6">
101 <div class="progress-circle" ng-class="{'arrastrando': arrastrando}"> 101 <div class="progress-circle" ng-class="{'arrastrando': arrastrando}">
102 <span class="progress-left"> 102 <span class="progress-left">
103 <span class="progress-bar"></span> 103 <span class="progress-bar"></span>
104 </span> 104 </span>
105 <span class="progress-right"> 105 <span class="progress-right">
106 <span class="progress-bar"></span> 106 <span class="progress-bar"></span>
107 </span> 107 </span>
108 <div class="progress-value">{{vehiculo.codigo}}</div> 108 <div class="progress-value">{{vehiculo.codigo}}</div>
109 </div> 109 </div>
110 </div> 110 </div>
111 <div class="row ml-2"> 111 <div class="row ml-2">
112 <div class="col-3 position-absolute"> 112 <div class="col-3 position-absolute">
113 <img 113 <img
114 src="img/hojaRutaVolante.png" 114 src="img/hojaRutaVolante.png"
115 width="100%"> 115 width="100%">
116 </div> 116 </div>
117 <div class="col-3" 117 <div class="col-3"
118 uib-tooltip="Cerrar distribuición" 118 uib-tooltip="Cerrar distribuición"
119 ng-click="hacerHojaRuta(vehiculo)"></div> 119 ng-click="hacerHojaRuta(vehiculo, false)"></div>
120 <div class="col-3"> 120 <div class="col-3">
121 <i 121 <i
122 class="fa fa-eye fa-2x" 122 class="fa fa-eye fa-2x"
123 uib-tooltip="Ver cisternas" 123 uib-tooltip="Ver cisternas"
124 ng-click="cargar(vehiculo.id, -1)"> 124 ng-click="cargar(vehiculo.id, -1)">
125 </i> 125 </i>
126 </div> 126 </div>
127 <div class="col-3 ml-2"> 127 <div class="col-3 ml-2">
128 <i 128 <i
129 class="fa fa-trash fa-2x" 129 class="fa fa-trash fa-2x"
130 uib-tooltip="Eliminar vehiculo" 130 uib-tooltip="Eliminar vehiculo"
131 ng-click="quitarVehiculo(vehiculo)"></i> 131 ng-click="quitarVehiculo(vehiculo)"></i>
132 </div> 132 </div>
133 </div> 133 </div>
134 <div 134 <div
135 class="ml-1 border border-dark text-center" 135 class="ml-1 border border-dark text-center"
136 ng-show="arrastrando" 136 ng-show="arrastrando"
137 id="{{vehiculo.id}}" 137 id="{{vehiculo.id}}"
138 ondrop="drop(event)" 138 ondrop="drop(event)"
139 ondragover="allowDrop(event)" 139 ondragover="allowDrop(event)"
140 >Soltar acá</div> 140 >Soltar acá</div>
141 </div> 141 </div>
142 </div> 142 </div>
143 </div> 143 </div>
144 </div> 144 </div>
145 </div> 145 </div>
146 146
src/views/foca-modal-cerrar-vehiculo.html
1 <div class="modal-header"> 1 <div class="modal-header">
2 <h4>Cerrar distribución vehículo</h4> 2 <h4>Cerrar distribución vehículo</h4>
3 <div class="row"> 3 <div class="row">
4 <div class="col-6 row"> 4 <div class="col-6 row">
5 <label class="col-3 mt-2">Fecha:</label> 5 <label class="col-3 mt-2">Fecha:</label>
6 <input 6 <input
7 type="text" 7 type="text"
8 readonly 8 readonly
9 ng-model="now" 9 ng-model="now"
10 uib-datepicker-popup="dd/MM/yyyy" 10 uib-datepicker-popup="dd/MM/yyyy"
11 show-button-bar="false" 11 show-button-bar="false"
12 is-open="datepickerOpen" 12 is-open="datepickerOpen"
13 on-open-focus="false" 13 on-open-focus="false"
14 class="form-control col-8"/> 14 class="form-control col-8"/>
15 </div> 15 </div>
16 </div> 16 </div>
17 </div> 17 </div>
18 <div class="modal-body"> 18 <div class="modal-body">
19 <form class="row" name="formHojaRuta"> 19 <form class="row" name="formHojaRuta">
20 20
21 <div class="col-2"> 21 <div class="col-2">
22 <label>Transportista</label> 22 <label>Transportista</label>
23 </div> 23 </div>
24 <div class="col-4"> 24 <div class="col-4">
25 <input 25 <input
26 class="form-control" 26 class="form-control"
27 readonly 27 readonly
28 ng-value="vehiculo.transportista.COD + ' ' + vehiculo.transportista.NOM" 28 ng-value="vehiculo.transportista.COD + ' ' + vehiculo.transportista.NOM"
29 > 29 >
30 </div> 30 </div>
31 <div class="col-2 form-group"> 31 <div class="col-2 form-group">
32 <label>Unidad</label> 32 <label>Unidad</label>
33 </div> 33 </div>
34 <div class="col-4"> 34 <div class="col-4">
35 <input 35 <input
36 class="form-control" 36 class="form-control"
37 readonly 37 readonly
38 ng-model="vehiculo.tractor" 38 ng-model="vehiculo.codigo"
39 > 39 >
40 </div> 40 </div>
41 </form> 41 </form>
42 <strong>Remitos:</strong> 42 <strong>Remitos:</strong>
43 <table class="table"> 43 <table class="table">
44 <thead> 44 <thead>
45 <tr> 45 <tr>
46 <th>Remito Nº</th> 46 <th>Remito Nº</th>
47 <th>Cliente</th> 47 <th>Cliente</th>
48 <th>Domicilio de entrega</th> 48 <th>Domicilio de entrega</th>
49 <th>Eliminar</th> 49 <th ng-if="cerrar">Eliminar</th>
50 </tr> 50 </tr>
51 </thead> 51 </thead>
52 <tbody> 52 <tbody>
53 <tr ng-show="!remitos.length"> 53 <tr ng-show="!remitos.length">
54 <td colspan="3"> 54 <td colspan="3">
55 No se han encontrado remitos. 55 No se han encontrado remitos.
56 </td> 56 </td>
57 </tr> 57 </tr>
58 <tr ng-repeat="remito in remitos"> 58 <tr ng-repeat="remito in remitos">
59 <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td> 59 <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td>
60 <td ng-bind="remito.nombreCliente"></td> 60 <td ng-bind="remito.nombreCliente"></td>
61 <td ng-bind="remito.domicilioStamp"></td> 61 <td ng-bind="remito.domicilioStamp"></td>
62 <td> 62 <td ng-if="cerrar">
63 <div class="custom-control custom-checkbox"> 63 <div class="custom-control custom-checkbox">
64 <input 64 <input
65 type="checkbox" 65 type="checkbox"
66 ng-model="remito.checked" 66 ng-model="remito.checked"
67 class="custom-control-input" 67 class="custom-control-input"
68 id="{{remito.id}}"> 68 id="{{remito.id}}">
69 <label class="custom-control-label" for="{{remito.id}}"></label> 69 <label class="custom-control-label" for="{{remito.id}}"></label>
70 </div> 70 </div>
71 </td> 71 </td>
72 </tr> 72 </tr>
73 </tbody> 73 </tbody>
74 </table> 74 </table>
75 </div> 75 </div>
76 <div class="modal-footer py-1"> 76 <div class="modal-footer py-1">
77 <button 77 <button
78 class="btn btn-sm btn-danger"
79 type="button"
80 ng-click="eliminarRemitos()"
81 ng-disabled="minimoUnoChecked()">Eliminar</button>
82 <button
83 class="btn btn-sm btn-secondary" 78 class="btn btn-sm btn-secondary"
84 ladda="cargando" 79 ladda="cargando"
85 type="button" 80 type="button"
86 ng-click="cancelar()">Cancelar</button> 81 ng-click="cancelar()"
82 >Cancelar</button>
83 <button
84 class="btn btn-sm btn-danger"
85 type="button"
86 ng-click="eliminarRemitos()"
87 ng-disabled="minimoUnoChecked()"
88 ng-if="cerrar"
89 >Eliminar</button>
87 <button 90 <button
88 class="btn btn-sm btn-primary" 91 class="btn btn-sm btn-primary"
89 ladda="cargando" 92 ladda="cargando"
90 type="button" 93 type="button"
91 ng-disabled="!formHojaRuta.$valid || !remitos.length" 94 ng-disabled="!formHojaRuta.$valid || !remitos.length"