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