Commit 44435d11ea49307b095fc6d3c718cbdeae6482ba

Authored by Nicolás Guarnieri
Exists in master

Merge branch 'master' into 'master'

Master

See merge request !38
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, transportista.NOM); 149 $scope.selectVehiculo(transportista.COD, transportista.NOM);
150 }); 150 });
151 }; 151 };
152 152
153 $scope.selectVehiculo = function(idTransportista, nombreTransportista) { 153 $scope.selectVehiculo = function(idTransportista, nombreTransportista) {
154 var parametrosModal = { 154 var parametrosModal = {
155 columnas: { 155 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 query: '/vehiculo/transportista/' + idTransportista, 159 query: '/vehiculo/transportista/' + idTransportista,
160 titulo: 'Búsqueda de vehiculos', 160 titulo: 'Búsqueda de vehiculos',
161 subTitulo: idTransportista + '-' + nombreTransportista 161 subTitulo: idTransportista + '-' + nombreTransportista
162 }; 162 };
163 focaModalService.modal(parametrosModal).then( 163 focaModalService.modal(parametrosModal).then(
164 function(vehiculo) { 164 function(vehiculo) {
165 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); 165 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id});
166 if(existe.length) { 166 if(existe.length) {
167 focaModalService.alert('El vehiculo ya ha sido cargado'); 167 focaModalService.alert('El vehiculo ya ha sido cargado');
168 return; 168 return;
169 } 169 }
170 if(!vehiculo.cisternas.length) { 170 if(!vehiculo.cisternas.length) {
171 focaModalService.alert('El vehiculo no tiene cisternas'); 171 focaModalService.alert('El vehiculo no tiene cisternas');
172 return; 172 return;
173 } 173 }
174 $scope.vehiculos.push(vehiculo); 174 $scope.vehiculos.push(vehiculo);
175 }, function() { 175 }, function() {
176 // funcion ejecutada cuando se cancela el modal 176 // funcion ejecutada cuando se cancela el modal
177 }); 177 });
178 }; 178 };
179 179
180 $scope.seleccionarFechaReparto = function() { 180 $scope.seleccionarFechaReparto = function() {
181 focaModalService.modalFecha('Fecha de reparto').then(function(fecha) { 181 focaModalService.modalFecha('Fecha de reparto').then(function(fecha) {
182 $scope.$broadcast('addCabecera',{ 182 $scope.$broadcast('addCabecera',{
183 label: 'Fecha:', 183 label: 'Fecha:',
184 valor: fecha.toLocaleDateString() 184 valor: fecha.toLocaleDateString()
185 }); 185 });
186 $scope.fechaReparto = fecha; 186 $scope.fechaReparto = fecha;
187 focaLogisticaPedidoRutaService.setFechaReparto(fecha); 187 focaLogisticaPedidoRutaService.setFechaReparto(fecha);
188 focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) { 188 focaLogisticaPedidoRutaService.getUnidadesByFecha(fecha).then(function(res) {
189 $scope.vehiculos = res.data; 189 $scope.vehiculos = res.data;
190 }); 190 });
191 }); 191 });
192 }; 192 };
193 193
194 function getSeguimiento() { 194 function getSeguimiento() {
195 var desde = new Date('1900/01/01'); 195 var desde = new Date('1900/01/01');
196 var hasta = new Date('2099/01/01'); 196 var hasta = new Date('2099/01/01');
197 if($scope.fechaDesde) { 197 if($scope.fechaDesde) {
198 var fechaDesde = $scope.fechaDesde; 198 var fechaDesde = $scope.fechaDesde;
199 desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0)); 199 desde = new Date(new Date(fechaDesde.setHours(0)).setMinutes(0));
200 desde = new Date(desde); 200 desde = new Date(desde);
201 } 201 }
202 if($scope.fechaHasta) { 202 if($scope.fechaHasta) {
203 var fechaHasta = $scope.fechaHasta; 203 var fechaHasta = $scope.fechaHasta;
204 hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0)); 204 hasta = new Date(new Date(fechaHasta.setHours(0)).setMinutes(0));
205 hasta = hasta.setDate(hasta.getDate() + 1); 205 hasta = hasta.setDate(hasta.getDate() + 1);
206 hasta = new Date(hasta); 206 hasta = new Date(hasta);
207 } 207 }
208 var datos = { 208 var datos = {
209 actividad: $scope.actividad, 209 actividad: $scope.actividad,
210 idUsuario: $scope.idVendedor, 210 idUsuario: $scope.idVendedor,
211 fechaDesde: desde, 211 fechaDesde: desde,
212 fechaHasta: hasta, 212 fechaHasta: hasta,
213 asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ? 213 asignacion: $scope.filtroEstado ? true : ($scope.filtroEstado !== undefined ?
214 false : undefined) 214 false : undefined)
215 }; 215 };
216 216
217 $scope.datosBuscados = { 217 $scope.datosBuscados = {
218 actividad: $scope.actividad, 218 actividad: $scope.actividad,
219 individual: $scope.idVendedor ? true : false 219 individual: $scope.idVendedor ? true : false
220 }; 220 };
221 221
222 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { 222 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) {
223 if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) { 223 if(JSON.stringify(datos.data) !== JSON.stringify($scope.marcadores)) {
224 $scope.marcadores = datos.data; 224 $scope.marcadores = datos.data;
225 } 225 }
226 }); 226 });
227 } 227 }
228 228
229 function eliminarVehiculo(vehiculo) { 229 function eliminarVehiculo(vehiculo) {
230 focaLogisticaPedidoRutaService.getRemitosByIdVehiculo(vehiculo.id).then(function(res) { 230 focaLogisticaPedidoRutaService.getRemitosByIdVehiculo(vehiculo.id).then(function(res) {
231 if(!res.data.length) { 231 if(!res.data.length) {
232 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); 232 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1);
233 }else { 233 }else {
234 focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' + 234 focaModalService.alert('No ha sido posible eliminar el vehiculo porque ' +
235 'tiene remitos asociados').then(function() { 235 'tiene remitos asociados').then(function() {
236 $scope.hacerHojaRuta(vehiculo); 236 $scope.hacerHojaRuta(vehiculo, true);
237 }); 237 });
238 } 238 }
239 }); 239 });
240 } 240 }
241 241
242 function eligioFecha() { 242 function eligioFecha() {
243 if(!$scope.fechaReparto) { 243 if(!$scope.fechaReparto) {
244 focaModalService.alert('Primero seleccione fecha de reparto'); 244 focaModalService.alert('Primero seleccione fecha de reparto');
245 return false; 245 return false;
246 } 246 }
247 return true; 247 return true;
248 } 248 }
249 249
250 function vehiculoEnUso(vehiculo) { 250 function vehiculoEnUso(vehiculo) {
251 var idUsuario = focaLogisticaPedidoRutaService.idUsuario; 251 var idUsuario = focaLogisticaPedidoRutaService.idUsuario;
252 for(var i = 0; i < vehiculo.cisternas.length; i++) { 252 for(var i = 0; i < vehiculo.cisternas.length; i++) {
253 for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { 253 for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) {
254 var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; 254 var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j];
255 if(cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto 255 if(cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto
256 .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso && 256 .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso &&
257 cisternaCarga.idUsuarioProceso !== idUsuario) 257 cisternaCarga.idUsuarioProceso !== idUsuario)
258 { 258 {
259 focaModalService.alert('El vehículo está siendo usado por otro usuario'); 259 focaModalService.alert('El vehículo está siendo usado por otro usuario');
260 return true; 260 return true;
261 } 261 }
262 } 262 }
263 } 263 }
264 return false; 264 return false;
265 } 265 }
266 $interval(function() { 266 $interval(function() {
267 getSeguimiento(); 267 getSeguimiento();
268 }, 5000); 268 }, 5000);
269 } 269 }
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.getRemitosByIdVehiculo(idVehiculo, 1, 1).then( 21 focaLogisticaPedidoRutaService.getRemitosByIdVehiculo(idVehiculo, 1, 1).then(
20 function(res) { 22 function(res) {
21 $scope.remitos = res.data; 23 $scope.remitos = res.data;
22 }); 24 });
23 focaLogisticaPedidoRutaService.numeroHojaRuta().then(function(res) { 25 focaLogisticaPedidoRutaService.numeroHojaRuta().then(function(res) {
24 $scope.sucursal = res.data.sucursal; 26 $scope.sucursal = res.data.sucursal;
25 $scope.numero = res.data.numeroHojaRuta; 27 $scope.numero = res.data.numeroHojaRuta;
26 }); 28 });
27 $scope.cancelar = function() { 29 $scope.cancelar = function() {
28 $uibModalInstance.close(); 30 $uibModalInstance.close();
29 }; 31 };
30 $scope.aceptar = function() { 32 $scope.aceptar = function() {
31 var idsRemito = []; 33 var idsRemito = [];
32 $scope.remitos.forEach(function(remito) { 34 $scope.remitos.forEach(function(remito) {
33 idsRemito.push(remito.id); 35 idsRemito.push(remito.id);
34 }); 36 });
35 var cierreDistribuicion = { 37 var cierreDistribuicion = {
36 idsRemito: idsRemito, 38 idsRemito: idsRemito,
37 fechaReparto: focaLogisticaPedidoRutaService.fecha 39 fechaReparto: focaLogisticaPedidoRutaService.fecha
38 }; 40 };
39 focaLogisticaPedidoRutaService.cerrarDistribuicion(cierreDistribuicion) 41 focaLogisticaPedidoRutaService.cerrarDistribuicion(cierreDistribuicion)
40 .then(function() { 42 .then(function() {
41 focaModalService.alert('Vehículo cerrado con éxito'); 43 focaModalService.alert('Vehículo cerrado con éxito');
42 } 44 }
43 ); 45 );
44 }; 46 };
45 $scope.seleccionarChofer = function() { 47 $scope.seleccionarChofer = function() {
46 var modalInstance = $uibModal.open( 48 var modalInstance = $uibModal.open(
47 { 49 {
48 ariaLabelledBy: 'Busqueda de Chofer', 50 ariaLabelledBy: 'Busqueda de Chofer',
49 templateUrl: 'modal-chofer.html', 51 templateUrl: 'modal-chofer.html',
50 controller: 'focaModalChoferController', 52 controller: 'focaModalChoferController',
51 size: 'lg' 53 size: 'lg'
52 } 54 }
53 ); 55 );
54 56
55 modalInstance.result.then( 57 modalInstance.result.then(
56 function(chofer) { 58 function(chofer) {
57 $scope.chofer = chofer; 59 $scope.chofer = chofer;
58 }, function() { 60 }, function() {
59 // funcion ejecutada cuando se cancela el modal 61 // funcion ejecutada cuando se cancela el modal
60 } 62 }
61 ); 63 );
62 }; 64 };
63 $scope.eliminarRemitos = function() { 65 $scope.eliminarRemitos = function() {
64 var remitosDel = $filter('filter')($scope.remitos, {checked: true}); 66 var remitosDel = $filter('filter')($scope.remitos, {checked: true});
65 focaModalService.alert('¿Seguro que desea desasociar estos remitos del vehículo?') 67 focaModalService.alert('¿Seguro que desea desasociar estos remitos del vehículo?')
66 .then(function() { 68 .then(function() {
67 eliminarRemitos(remitosDel); 69 eliminarRemitos(remitosDel);
68 } 70 }
69 ); 71 );
70 }; 72 };
71 $scope.minimoUnoChecked = function() { 73 $scope.minimoUnoChecked = function() {
72 var remitosChequeados = $filter('filter')($scope.remitos, {checked: true}); 74 var remitosChequeados = $filter('filter')($scope.remitos, {checked: true});
73 return !remitosChequeados.length; 75 return !remitosChequeados.length;
74 }; 76 };
75 function eliminarRemitos(remitosDel) { 77 function eliminarRemitos(remitosDel) {
76 var nuevosRemitos = $filter('filter')($scope.remitos, {checked: !true}); 78 var nuevosRemitos = $filter('filter')($scope.remitos, {checked: !true});
77 focaLogisticaPedidoRutaService.desasociarRemitos(remitosDel, $scope.vehiculo.id, 79 focaLogisticaPedidoRutaService.desasociarRemitos(remitosDel, $scope.vehiculo.id,
78 nuevosRemitos ? true : false).then(function() { 80 nuevosRemitos ? true : false).then(function() {
79 focaModalService.alert('Remitos desasociados con éxito');
80 $scope.remitos = nuevosRemitos; 81 $scope.remitos = nuevosRemitos;
81 }); 82 });
82 } 83 }
83 }]); 84 }]);
src/views/foca-modal-cerrar-vehiculo.html
1 <div class="modal-header"> 1 <div class="modal-header">
2 <h4>Confirmar distribución vehículo</h4> 2 <h4>Confirmar 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 49 <th ng-if="cerrar">Eliminar
50 <i 50 <i
51 class="fa fa-info" 51 class="fa fa-info"
52 uib-tooltip="Los remitos que no se pueden eliminar tienen asignada una hoja de ruta"> 52 uib-tooltip="Los remitos que no se pueden eliminar tienen asignada una hoja de ruta">
53 </i> 53 </i>
54 </th> 54 </th>
55 </tr> 55 </tr>
56 </thead> 56 </thead>
57 <tbody> 57 <tbody>
58 <tr ng-show="!remitos.length"> 58 <tr ng-show="!remitos.length">
59 <td colspan="3"> 59 <td colspan="3">
60 No se han encontrado remitos. 60 No se han encontrado remitos.
61 </td> 61 </td>
62 </tr> 62 </tr>
63 <tr ng-repeat="remito in remitos"> 63 <tr ng-repeat="remito in remitos">
64 <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td> 64 <td ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></td>
65 <td ng-bind="remito.nombreCliente"></td> 65 <td ng-bind="remito.nombreCliente"></td>
66 <td ng-bind="remito.domicilioStamp"></td> 66 <td ng-bind="remito.domicilioStamp"></td>
67 <td> 67 <td ng-if="cerrar">
68 <div class="custom-control custom-checkbox"> 68 <div class="custom-control custom-checkbox">
69 <input 69 <input
70 type="checkbox" 70 type="checkbox"
71 ng-model="remito.checked" 71 ng-model="remito.checked"
72 class="custom-control-input" 72 class="custom-control-input"
73 id="{{remito.id}}" 73 id="{{remito.id}}"
74 ng-disabled="remito.idHojaRuta"> 74 ng-disabled="remito.idHojaRuta">
75 <label class="custom-control-label" for="{{remito.id}}"></label> 75 <label class="custom-control-label" for="{{remito.id}}"></label>
76 </div> 76 </div>
77 </td> 77 </td>
78 </tr> 78 </tr>
79 </tbody> 79 </tbody>
80 </table> 80 </table>
81 </div> 81 </div>
82 <div class="modal-footer py-1"> 82 <div class="modal-footer py-1">
83 <button 83 <button
84 class="btn btn-sm btn-danger"
85 type="button"
86 ng-click="eliminarRemitos()"
87 ng-disabled="minimoUnoChecked()">Eliminar</button>
88 <button
89 class="btn btn-sm btn-secondary" 84 class="btn btn-sm btn-secondary"
90 ladda="cargando" 85 ladda="cargando"
91 type="button" 86 type="button"
92 ng-click="cancelar()">Cancelar</button> 87 ng-click="cancelar()"
88 >Cancelar</button>
89 <button
90 class="btn btn-sm btn-danger"
91 type="button"
92 ng-click="eliminarRemitos()"
93 ng-disabled="minimoUnoChecked()"
94 ng-if="cerrar"
95 >Eliminar</button>
93 <button 96 <button
94 class="btn btn-sm btn-primary" 97 class="btn btn-sm btn-primary"
95 ladda="cargando" 98 ladda="cargando"
96 type="button" 99 type="button"
97 ng-disabled="!formHojaRuta.$valid || !remitos.length" 100 ng-disabled="!formHojaRuta.$valid || !remitos.length"