Commit 14154ecf70826acff58da0b6948d36d9dff3876a
1 parent
7d68d24ce9
Exists in
master
boton pausar funcionando
Showing
3 changed files
with
106 additions
and
36 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', | 1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', |
2 | [ | 2 | [ |
3 | '$scope', | 3 | '$scope', |
4 | '$uibModal', | 4 | '$uibModal', |
5 | '$location', | 5 | '$location', |
6 | '$filter', | 6 | '$filter', |
7 | '$timeout', | 7 | '$timeout', |
8 | 'focaCrearHojaRutaService', | 8 | 'focaCrearHojaRutaService', |
9 | 'focaModalService', | 9 | 'focaModalService', |
10 | 'focaBotoneraLateralService', | 10 | 'focaBotoneraLateralService', |
11 | 'focaLoginService', | 11 | 'focaLoginService', |
12 | '$localStorage', | ||
12 | function($scope, $uibModal, $location, $filter, $timeout, | 13 | function($scope, $uibModal, $location, $filter, $timeout, |
13 | focaCrearHojaRutaService, focaModalService, focaBotoneraLateralService, | 14 | focaCrearHojaRutaService, focaModalService, focaBotoneraLateralService, |
14 | focaLoginSrv) | 15 | focaLoginSrv, $localStorage) |
15 | { | 16 | { |
16 | config(); | 17 | config(); |
17 | 18 | ||
18 | function config() { | 19 | function config() { |
19 | $scope.botonera = focaCrearHojaRutaService.getBotonera(); | 20 | $scope.botonera = focaCrearHojaRutaService.getBotonera(); |
20 | $scope.datepickerAbierto = false; | 21 | $scope.datepickerAbierto = false; |
21 | $scope.show = false; | 22 | $scope.show = false; |
22 | $scope.cargando = true; | 23 | $scope.cargando = true; |
23 | $scope.now = new Date(); | 24 | $scope.now = new Date(); |
24 | $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); | 25 | $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); |
25 | $scope.comprobante = $filter('rellenarDigitos')(0, 8); | 26 | $scope.comprobante = $filter('rellenarDigitos')(0, 8); |
26 | 27 | ||
27 | //SETEO BOTONERA LATERAL | 28 | //SETEO BOTONERA LATERAL |
28 | $timeout(function() { | 29 | $timeout(function() { |
29 | focaBotoneraLateralService.showSalir(false); | 30 | focaBotoneraLateralService.showSalir(false); |
30 | focaBotoneraLateralService.showPausar(true); | 31 | focaBotoneraLateralService.showPausar(true); |
31 | focaBotoneraLateralService.showGuardar(true, $scope.crearHojaRuta); | 32 | focaBotoneraLateralService.showGuardar(true, $scope.crearHojaRuta); |
32 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 33 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
33 | }); | 34 | }); |
34 | 35 | ||
35 | init(); | 36 | init(); |
37 | $timeout(function() {getLSHojaRuta();}); | ||
36 | } | 38 | } |
37 | 39 | ||
38 | function init() { | 40 | function init() { |
39 | $scope.$broadcast('cleanCabecera'); | 41 | $scope.$broadcast('cleanCabecera'); |
40 | 42 | ||
41 | $scope.hojaRuta = { | 43 | $scope.hojaRuta = { |
42 | fecha: new Date(), | 44 | fecha: new Date(), |
43 | litros: 0, | 45 | litros: 0, |
44 | chofer: {}, | 46 | chofer: {}, |
45 | vehiculo: { | 47 | vehiculo: { |
46 | capacidad: 0 | 48 | capacidad: 0 |
47 | }, | 49 | }, |
48 | transportista: {}, | 50 | transportista: {}, |
49 | tarifario: { | 51 | tarifario: { |
50 | costo: null | 52 | costo: null |
51 | } | 53 | }, |
54 | remitosTabla: [] | ||
52 | }; | 55 | }; |
53 | 56 | ||
54 | $scope.remitosTabla = []; | ||
55 | $scope.idLista = undefined; | 57 | $scope.idLista = undefined; |
56 | 58 | ||
57 | focaCrearHojaRutaService.getNumeroHojaRuta().then( | 59 | focaCrearHojaRutaService.getNumeroHojaRuta().then( |
58 | function(res) { | 60 | function(res) { |
59 | $scope.puntoVenta = $filter('rellenarDigitos')(res.data.sucursal, 4); | 61 | $scope.puntoVenta = $filter('rellenarDigitos')(res.data.sucursal, 4); |
60 | $scope.comprobante = $filter('rellenarDigitos')(res.data.numeroHojaRuta, 8); | 62 | $scope.comprobante = $filter('rellenarDigitos')(res.data.numeroHojaRuta, 8); |
61 | }, | 63 | }, |
62 | function(err) { | 64 | function(err) { |
63 | focaModalService.alert('La terminal no esta configurada correctamente'); | 65 | focaModalService.alert('La terminal no esta configurada correctamente'); |
64 | console.info(err); | 66 | console.info(err); |
65 | } | 67 | } |
66 | ); | 68 | ); |
67 | 69 | ||
68 | $scope.inicial = { | 70 | $scope.inicial = angular.copy($scope.hojaRuta); |
69 | hojaRuta: angular.copy($scope.hojaRuta), | ||
70 | remitosTabla: angular.copy($scope.remitosTabla), | ||
71 | idLista: angular.copy($scope.idLista) | ||
72 | }; | ||
73 | } | 71 | } |
74 | 72 | ||
73 | $scope.$watch('hojaRuta', function(newValue, oldValue) { | ||
74 | focaBotoneraLateralService.setPausarData({ | ||
75 | label: 'hojaRuta', | ||
76 | val: newValue | ||
77 | }); | ||
78 | }, true); | ||
79 | |||
75 | $scope.crearHojaRuta = function() { | 80 | $scope.crearHojaRuta = function() { |
76 | if(!$scope.remitosTabla.length) { | 81 | if(!$scope.hojaRuta.remitosTabla.length) { |
77 | focaModalService.alert('Ingrese Remitos'); | 82 | focaModalService.alert('Ingrese Remitos'); |
78 | return; | 83 | return; |
79 | } | 84 | } |
80 | if(!$scope.hojaRuta.chofer.id) { | 85 | if(!$scope.hojaRuta.chofer.id) { |
81 | focaModalService.alert('Ingrese Chofer'); | 86 | focaModalService.alert('Ingrese Chofer'); |
82 | return; | 87 | return; |
83 | } | 88 | } |
84 | if(!$scope.hojaRuta.vehiculo.id) { | 89 | if(!$scope.hojaRuta.vehiculo.id) { |
85 | focaModalService.alert('Ingrese Vehiculo'); | 90 | focaModalService.alert('Ingrese Vehiculo'); |
86 | return; | 91 | return; |
87 | } | 92 | } |
88 | if(!$scope.hojaRuta.transportista.COD) { | 93 | if(!$scope.hojaRuta.transportista.COD) { |
89 | focaModalService.alert('Ingrese Transportista'); | 94 | focaModalService.alert('Ingrese Transportista'); |
90 | return; | 95 | return; |
91 | } | 96 | } |
92 | if(!$scope.hojaRuta.tarifario.costo) { | 97 | if(!$scope.hojaRuta.tarifario.costo) { |
93 | focaModalService.alert('Ingrese Tarifario'); | 98 | focaModalService.alert('Ingrese Tarifario'); |
94 | return; | 99 | return; |
95 | } | 100 | } |
96 | if(!$scope.hojaRuta.datosExtra) { | 101 | if(!$scope.hojaRuta.datosExtra) { |
97 | focaModalService.alert('Ingrese Datos extra'); | 102 | focaModalService.alert('Ingrese Datos extra'); |
98 | return; | 103 | return; |
99 | } | 104 | } |
100 | var date = new Date(); | 105 | var date = new Date(); |
101 | var save = { | 106 | var save = { |
102 | hojaRuta: { | 107 | hojaRuta: { |
103 | id: 0, | 108 | id: 0, |
104 | fechaCreacion: new Date(date.getTime()).toISOString().slice(0, 19) | 109 | fechaCreacion: new Date(date.getTime()).toISOString().slice(0, 19) |
105 | .replace('T', ' '), | 110 | .replace('T', ' '), |
106 | idTransportista: $scope.hojaRuta.transportista.COD, | 111 | idTransportista: $scope.hojaRuta.transportista.COD, |
107 | idChofer: $scope.hojaRuta.chofer.id, | 112 | idChofer: $scope.hojaRuta.chofer.id, |
108 | idVehiculo: $scope.hojaRuta.vehiculo.id, | 113 | idVehiculo: $scope.hojaRuta.vehiculo.id, |
109 | tarifaFlete: $scope.hojaRuta.tarifario.costo, | 114 | tarifaFlete: $scope.hojaRuta.tarifario.costo, |
110 | fechaReparto: $scope.fechaReparto.toISOString().substring(0, 10), | 115 | fechaReparto: new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10), |
111 | estado: 0 | 116 | estado: 0 |
112 | }, | 117 | }, |
113 | remitos: $scope.remitosTabla | 118 | remitos: $scope.hojaRuta.remitosTabla |
114 | }; | 119 | }; |
115 | save.hojaRuta = angular.extend({}, save.hojaRuta, $scope.hojaRuta.datosExtra); | 120 | save.hojaRuta = angular.extend({}, save.hojaRuta, $scope.hojaRuta.datosExtra); |
116 | focaCrearHojaRutaService.crearHojaRuta(save).then( | 121 | focaCrearHojaRutaService.crearHojaRuta(save).then( |
117 | function(data) { | 122 | function(data) { |
118 | focaModalService.alert( | 123 | focaModalService.alert( |
119 | 'Hoja ruta creada Nº: ' + | 124 | 'Hoja ruta creada Nº: ' + |
120 | $filter('rellenarDigitos')(data.data.sucursal, 4) + '-' + | 125 | $filter('rellenarDigitos')(data.data.sucursal, 4) + '-' + |
121 | $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8) | 126 | $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8) |
122 | ); | 127 | ); |
123 | 128 | ||
124 | init(); | 129 | init(); |
125 | }, | 130 | }, |
126 | function(error) { | 131 | function(error) { |
127 | focaModalService.alert('Hubo un error al crear la hoja de ruta'); | 132 | focaModalService.alert('Hubo un error al crear la hoja de ruta'); |
128 | console.info(error); | 133 | console.info(error); |
129 | } | 134 | } |
130 | ); | 135 | ); |
131 | }; | 136 | }; |
132 | 137 | ||
133 | $scope.seleccionarTransportista = function() { | 138 | $scope.seleccionarTransportista = function() { |
134 | if(eligioPreConfirmado()) return; | 139 | if(eligioPreConfirmado()) return; |
135 | var parametrosModal = { | 140 | var parametrosModal = { |
136 | titulo: 'Búsqueda de transportista', | 141 | titulo: 'Búsqueda de transportista', |
137 | query: '/transportista', | 142 | query: '/transportista', |
138 | columnas: [ | 143 | columnas: [ |
139 | { | 144 | { |
140 | nombre: 'Código', | 145 | nombre: 'Código', |
141 | propiedad: 'COD' | 146 | propiedad: 'COD' |
142 | }, | 147 | }, |
143 | { | 148 | { |
144 | nombre: 'Nombre', | 149 | nombre: 'Nombre', |
145 | propiedad: 'NOM' | 150 | propiedad: 'NOM' |
146 | }, | 151 | }, |
147 | { | 152 | { |
148 | nombre: 'CUIT', | 153 | nombre: 'CUIT', |
149 | propiedad: 'CUIT' | 154 | propiedad: 'CUIT' |
150 | } | 155 | } |
151 | ] | 156 | ] |
152 | }; | 157 | }; |
153 | focaModalService.modal(parametrosModal).then( | 158 | focaModalService.modal(parametrosModal).then( |
154 | function(proveedor) { | 159 | function(proveedor) { |
155 | $scope.hojaRuta.transportista = proveedor; | 160 | $scope.hojaRuta.transportista = proveedor; |
156 | $scope.$broadcast('addCabecera', { | 161 | $scope.$broadcast('addCabecera', { |
157 | label: 'Transportista:', | 162 | label: 'Transportista:', |
158 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | 163 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + |
159 | proveedor.NOM | 164 | proveedor.NOM |
160 | }); | 165 | }); |
161 | }, function() { | 166 | }, function() { |
162 | 167 | ||
163 | } | 168 | } |
164 | ); | 169 | ); |
165 | }; | 170 | }; |
166 | 171 | ||
167 | $scope.seleccionarChofer = function() { | 172 | $scope.seleccionarChofer = function() { |
168 | var parametrosModal = { | 173 | var parametrosModal = { |
169 | titulo: 'Búsqueda de Chofer', | 174 | titulo: 'Búsqueda de Chofer', |
170 | query: '/chofer', | 175 | query: '/chofer', |
171 | columnas: [ | 176 | columnas: [ |
172 | { | 177 | { |
173 | propiedad: 'id', | 178 | propiedad: 'id', |
174 | nombre: 'Código', | 179 | nombre: 'Código', |
175 | filtro: { | 180 | filtro: { |
176 | nombre: 'rellenarDigitos', | 181 | nombre: 'rellenarDigitos', |
177 | parametro: 3 | 182 | parametro: 3 |
178 | } | 183 | } |
179 | }, | 184 | }, |
180 | { | 185 | { |
181 | propiedad: 'nombre', | 186 | propiedad: 'nombre', |
182 | nombre: 'Nombre' | 187 | nombre: 'Nombre' |
183 | }, | 188 | }, |
184 | { | 189 | { |
185 | propiedad: 'dni', | 190 | propiedad: 'dni', |
186 | nombre: 'DNI' | 191 | nombre: 'DNI' |
187 | }, | 192 | }, |
188 | { | 193 | { |
189 | propiedad: 'telefono', | 194 | propiedad: 'telefono', |
190 | nombre: 'Teléfono' | 195 | nombre: 'Teléfono' |
191 | } | 196 | } |
192 | ] | 197 | ] |
193 | }; | 198 | }; |
194 | focaModalService.modal(parametrosModal).then( | 199 | focaModalService.modal(parametrosModal).then( |
195 | function(chofer) { | 200 | function(chofer) { |
196 | $scope.hojaRuta.chofer = chofer; | 201 | $scope.hojaRuta.chofer = chofer; |
197 | $scope.$broadcast('addCabecera', { | 202 | $scope.$broadcast('addCabecera', { |
198 | label: 'Chofer:', | 203 | label: 'Chofer:', |
199 | valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' +chofer.nombre | 204 | valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' +chofer.nombre |
200 | }); | 205 | }); |
201 | }, function() { | 206 | }, function() { |
202 | // funcion ejecutada cuando se cancela el modal | 207 | // funcion ejecutada cuando se cancela el modal |
203 | } | 208 | } |
204 | ); | 209 | ); |
205 | }; | 210 | }; |
206 | 211 | ||
207 | $scope.seleccionarVehiculo = function() { | 212 | $scope.seleccionarVehiculo = function() { |
208 | if(!eligioFecha() || eligioPreConfirmado()) return; | 213 | if(!eligioFecha() || eligioPreConfirmado()) return; |
209 | modalVehiculos(); | 214 | modalVehiculos(); |
210 | }; | 215 | }; |
211 | 216 | ||
212 | $scope.seleccionarTarifario = function() { | 217 | $scope.seleccionarTarifario = function() { |
213 | var modalInstance = $uibModal.open( | 218 | var modalInstance = $uibModal.open( |
214 | { | 219 | { |
215 | ariaLabelledBy: 'Busqueda de Tarifario', | 220 | ariaLabelledBy: 'Busqueda de Tarifario', |
216 | templateUrl: 'modal-tarifa-flete.html', | 221 | templateUrl: 'modal-tarifa-flete.html', |
217 | controller: 'focaModalTarifaFleteController', | 222 | controller: 'focaModalTarifaFleteController', |
218 | size: 'lg', | 223 | size: 'lg', |
219 | resolve: { | 224 | resolve: { |
220 | parametrosTarifaFlete: function() { | 225 | parametrosTarifaFlete: function() { |
221 | return $scope.hojaRuta.tarifario.costo; | 226 | return $scope.hojaRuta.tarifario.costo; |
222 | } | 227 | } |
223 | } | 228 | } |
224 | } | 229 | } |
225 | ); | 230 | ); |
226 | 231 | ||
227 | modalInstance.result.then( | 232 | modalInstance.result.then( |
228 | function(tarifario) { | 233 | function(tarifario) { |
229 | $scope.hojaRuta.tarifario = tarifario; | 234 | $scope.hojaRuta.tarifario = tarifario; |
230 | $scope.$broadcast('addCabecera', { | 235 | $scope.$broadcast('addCabecera', { |
231 | label: 'Tarifario:', | 236 | label: 'Tarifario:', |
232 | valor: tarifario.costo | 237 | valor: tarifario.costo |
233 | }); | 238 | }); |
234 | }, function() { | 239 | }, function() { |
235 | // funcion ejecutada cuando se cancela el modal | 240 | // funcion ejecutada cuando se cancela el modal |
236 | } | 241 | } |
237 | ); | 242 | ); |
238 | }; | 243 | }; |
239 | 244 | ||
240 | $scope.seleccionarRemitos = function() { | 245 | $scope.seleccionarRemitos = function() { |
241 | if(eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; | 246 | if(eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; |
242 | var modalInstance = $uibModal.open( | 247 | var modalInstance = $uibModal.open( |
243 | { | 248 | { |
244 | ariaLabelledBy: 'Busqueda de Remito', | 249 | ariaLabelledBy: 'Busqueda de Remito', |
245 | templateUrl: 'foca-modal-remito.html', | 250 | templateUrl: 'foca-modal-remito.html', |
246 | controller: 'focaModalRemitoController', | 251 | controller: 'focaModalRemitoController', |
247 | size: 'lg', | 252 | size: 'lg', |
248 | resolve: {usadoPor: function() {return 'hojaRuta';}} | 253 | resolve: {usadoPor: function() {return 'hojaRuta';}} |
249 | } | 254 | } |
250 | ); | 255 | ); |
251 | modalInstance.result.then( | 256 | modalInstance.result.then( |
252 | function(remito) { | 257 | function(remito) { |
253 | // TODO: borrar cuando no se use definitivamente | 258 | // TODO: borrar cuando no se use definitivamente |
254 | // for (var i = $scope.remitosTabla.length - 1; i >= 0; i--) { | 259 | // for (var i = $scope.hojaRuta.remitosTabla.length - 1; i >= 0; i--) { |
255 | // if ($scope.remitosTabla[i].id === remito.id) { | 260 | // if ($scope.hojaRuta.remitosTabla[i].id === remito.id) { |
256 | // focaModalService.alert('Remito ya incluido'); | 261 | // focaModalService.alert('Remito ya incluido'); |
257 | // return; | 262 | // return; |
258 | // } | 263 | // } |
259 | // } | 264 | // } |
260 | 265 | ||
261 | // var litros = 0; | 266 | // var litros = 0; |
262 | // for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { | 267 | // for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { |
263 | // litros = litros + parseFloat(remito.articulosRemito[j].cantidad); | 268 | // litros = litros + parseFloat(remito.articulosRemito[j].cantidad); |
264 | // } | 269 | // } |
265 | 270 | ||
266 | // if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { | 271 | // if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { |
267 | // focaModalService.alert( | 272 | // focaModalService.alert( |
268 | // 'Debe ingresar toda la información para el transporte' | 273 | // 'Debe ingresar toda la información para el transporte' |
269 | // ); | 274 | // ); |
270 | // return; | 275 | // return; |
271 | // } | 276 | // } |
272 | 277 | ||
273 | //if($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) | 278 | //if($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) |
274 | // { | 279 | // { |
275 | // var litrostotales = litros; | 280 | // var litrostotales = litros; |
276 | // litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; | 281 | // litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; |
277 | // focaModalService.alert( | 282 | // focaModalService.alert( |
278 | // 'La carga excede la capacidad disponible del vehiculo. ' + | 283 | // 'La carga excede la capacidad disponible del vehiculo. ' + |
279 | // 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' | 284 | // 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' |
280 | // ); | 285 | // ); |
281 | // } | 286 | // } |
282 | 287 | ||
283 | // remito.litros = litros; | 288 | // remito.litros = litros; |
284 | // $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; | 289 | // $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; |
285 | $scope.cargarCisterna(remito.id).then(function() { | 290 | $scope.cargarCisterna(remito.id).then(function() { |
286 | $scope.remitosTabla.push(remito); | 291 | $scope.hojaRuta.remitosTabla.push(remito); |
287 | $scope.seleccionarRemitos(); | 292 | $scope.seleccionarRemitos(); |
288 | }, function() { | 293 | }, function() { |
289 | $scope.seleccionarRemitos(); | 294 | $scope.seleccionarRemitos(); |
290 | }); | 295 | }); |
291 | }, function() { | 296 | }, function() { |
292 | // funcion ejecutada cuando se cancela el modal | 297 | // funcion ejecutada cuando se cancela el modal |
293 | } | 298 | } |
294 | ); | 299 | ); |
295 | }; | 300 | }; |
296 | 301 | ||
297 | $scope.seleccionarVehiculosPrecargados = function() { | 302 | $scope.seleccionarVehiculosPrecargados = function() { |
298 | if(!eligioFecha()) return; | 303 | if(!eligioFecha()) return; |
299 | modalVehiculos(true); | 304 | modalVehiculos(true); |
300 | }; | 305 | }; |
301 | 306 | ||
302 | $scope.cargarCisterna = function(idRemito) { | 307 | $scope.cargarCisterna = function(idRemito) { |
303 | if(!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return; | 308 | if(!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return; |
304 | var modalInstance = $uibModal.open( | 309 | var modalInstance = $uibModal.open( |
305 | { | 310 | { |
306 | ariaLabelledBy: 'Busqueda de Vehiculo', | 311 | ariaLabelledBy: 'Busqueda de Vehiculo', |
307 | templateUrl: 'foca-detalle-vehiculo.html', | 312 | templateUrl: 'foca-detalle-vehiculo.html', |
308 | controller: 'focaDetalleVehiculo', | 313 | controller: 'focaDetalleVehiculo', |
309 | size: 'lg', | 314 | size: 'lg', |
310 | resolve: { | 315 | resolve: { |
311 | idVehiculo: function() {return $scope.hojaRuta.vehiculo.id;}, | 316 | idVehiculo: function() {return $scope.hojaRuta.vehiculo.id;}, |
312 | idRemito: function() {return idRemito;}, | 317 | idRemito: function() {return idRemito;}, |
313 | fechaReparto: function() {return $scope.fechaReparto;} | 318 | fechaReparto: function() {return $scope.hojaRuta.fechaReparto;} |
314 | } | 319 | } |
315 | } | 320 | } |
316 | ); | 321 | ); |
317 | return modalInstance.result; | 322 | return modalInstance.result; |
318 | }; | 323 | }; |
319 | 324 | ||
320 | $scope.seleccionarFechaEntrega = function() { | 325 | $scope.seleccionarFechaEntrega = function() { |
321 | if(!$scope.fechaReparto) { | 326 | if(!$scope.hojaRuta.fechaReparto) { |
322 | elegirFecha(); | 327 | elegirFecha(); |
323 | return; | 328 | return; |
324 | } | 329 | } |
325 | focaModalService | 330 | focaModalService |
326 | .confirm('Si cambia la fecha se perderán los datos actuales') | 331 | .confirm('Si cambia la fecha se perderán los datos actuales') |
327 | .then(function() { | 332 | .then(function() { |
328 | elegirFecha(); | 333 | elegirFecha(); |
329 | }, function() { | 334 | }, function() { |
330 | return ; | 335 | return ; |
331 | }); | 336 | }); |
332 | }; | 337 | }; |
333 | 338 | ||
334 | $scope.seleccionarDatosExtra = function() { | 339 | $scope.seleccionarDatosExtra = function() { |
335 | var datosHojaRuta = $scope.hojaRuta.datosExtra; | 340 | var datosHojaRuta = $scope.hojaRuta.datosExtra; |
336 | var modalInstance = $uibModal.open( | 341 | var modalInstance = $uibModal.open( |
337 | { | 342 | { |
338 | templateUrl: 'foca-modal-datos-hoja-ruta.html', | 343 | templateUrl: 'foca-modal-datos-hoja-ruta.html', |
339 | controller: 'focaModalDatosHojaRutaCtrl', | 344 | controller: 'focaModalDatosHojaRutaCtrl', |
340 | size: 'lg', | 345 | size: 'lg', |
341 | resolve: { | 346 | resolve: { |
342 | parametrosDatos: function() { | 347 | parametrosDatos: function() { |
343 | return { | 348 | return { |
344 | datosHojaRuta: datosHojaRuta | 349 | datosHojaRuta: datosHojaRuta |
345 | }; | 350 | }; |
346 | } | 351 | } |
347 | } | 352 | } |
348 | } | 353 | } |
349 | ); | 354 | ); |
350 | return modalInstance.result.then(function(datosExtra) { | 355 | return modalInstance.result.then(function(datosExtra) { |
351 | $scope.hojaRuta.datosExtra = datosExtra; | 356 | $scope.hojaRuta.datosExtra = datosExtra; |
352 | }, function() { | 357 | }, function() { |
353 | //se ejecuta cuando se cancela el modal | 358 | //se ejecuta cuando se cancela el modal |
354 | }); | 359 | }); |
355 | }; | 360 | }; |
356 | 361 | ||
357 | $scope.desasociarRemito = function(key, idRemito) { | 362 | $scope.desasociarRemito = function(key, idRemito) { |
358 | var idsRemito = [idRemito]; | 363 | var idsRemito = [idRemito]; |
359 | focaModalService.confirm('¿Está seguro que desea desasociar este remito del' + | 364 | focaModalService.confirm('¿Está seguro que desea desasociar este remito del' + |
360 | ' vehículo?').then(function() { | 365 | ' vehículo?').then(function() { |
361 | focaCrearHojaRutaService.desasociarRemitos(idsRemito, | 366 | focaCrearHojaRutaService.desasociarRemitos(idsRemito, |
362 | $scope.hojaRuta.vehiculo.id, $scope.remitosTabla.length <= 1).then( | 367 | $scope.hojaRuta.vehiculo.id, $scope.hojaRuta.remitosTabla.length <= 1).then( |
363 | function() { | 368 | function() { |
364 | $scope.remitosTabla.splice(key, 1); | 369 | $scope.hojaRuta.remitosTabla.splice(key, 1); |
365 | focaModalService.alert('Remito desasociado con éxito'); | 370 | focaModalService.alert('Remito desasociado con éxito'); |
366 | } | 371 | } |
367 | ); | 372 | ); |
368 | }); | 373 | }); |
369 | }; | 374 | }; |
370 | 375 | ||
371 | function elegirFecha() { | 376 | function elegirFecha() { |
372 | focaModalService.modalFecha('Fecha de entrega').then(function(fecha) { | 377 | focaModalService.modalFecha('Fecha de entrega').then(function(fecha) { |
373 | $scope.$broadcast('addCabecera', { | 378 | $scope.$broadcast('addCabecera', { |
374 | label: 'Fecha de entrega:', | 379 | label: 'Fecha de entrega:', |
375 | valor: fecha.toLocaleDateString() | 380 | valor: fecha.toLocaleDateString() |
376 | }); | 381 | }); |
377 | $scope.fechaReparto = fecha; | 382 | $scope.hojaRuta.fechaReparto = fecha; |
378 | }); | 383 | }); |
379 | } | 384 | } |
380 | 385 | ||
381 | function eligioPreConfirmado() { | 386 | function eligioPreConfirmado() { |
382 | if($scope.eligioPreConfirmado) { | 387 | if($scope.eligioPreConfirmado) { |
383 | focaModalService.alert('No puede elegir si eligió un vehiculo pre cargado'); | 388 | focaModalService.alert('No puede elegir si eligió un vehiculo pre cargado'); |
384 | return true; | 389 | return true; |
385 | } | 390 | } |
386 | return false; | 391 | return false; |
387 | } | 392 | } |
388 | 393 | ||
389 | function eligioFecha() { | 394 | function eligioFecha() { |
390 | if(!$scope.fechaReparto) { | 395 | if(!$scope.hojaRuta.fechaReparto) { |
391 | focaModalService.alert('Primero seleccione fecha de reparto'); | 396 | focaModalService.alert('Primero seleccione fecha de reparto'); |
392 | return false; | 397 | return false; |
393 | } | 398 | } |
394 | return true; | 399 | return true; |
395 | } | 400 | } |
396 | 401 | ||
397 | function eligioVehiculo() { | 402 | function eligioVehiculo() { |
398 | if(!$scope.hojaRuta.vehiculo.id) { | 403 | if(!$scope.hojaRuta.vehiculo.id) { |
399 | focaModalService.alert('Primero seleccione vehiculo'); | 404 | focaModalService.alert('Primero seleccione vehiculo'); |
400 | return false; | 405 | return false; |
401 | } | 406 | } |
402 | return true; | 407 | return true; |
403 | } | 408 | } |
404 | 409 | ||
405 | function modalVehiculos(preCargados) { | 410 | function modalVehiculos(preCargados) { |
406 | var parametrosModal = {}; | 411 | var parametrosModal = {}; |
407 | if(preCargados) { | 412 | if(preCargados) { |
408 | parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' + | 413 | parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' + |
409 | $scope.fechaReparto.toISOString().substring(0, 10); | 414 | new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10); |
410 | parametrosModal.titulo = 'Búsqueda de vehiculos pre confirmados'; | 415 | parametrosModal.titulo = 'Búsqueda de vehiculos pre confirmados'; |
411 | }else { | 416 | }else { |
412 | parametrosModal.query = '/vehiculo'; | 417 | parametrosModal.query = '/vehiculo'; |
413 | parametrosModal.titulo = 'Búsqueda de vehículos'; | 418 | parametrosModal.titulo = 'Búsqueda de vehículos'; |
414 | } | 419 | } |
415 | parametrosModal.columnas = [ | 420 | parametrosModal.columnas = [ |
416 | { | 421 | { |
417 | propiedad: 'codigo', | 422 | propiedad: 'codigo', |
418 | nombre: 'Código' | 423 | nombre: 'Código' |
419 | }, | 424 | }, |
420 | { | 425 | { |
421 | propiedad: 'tractor', | 426 | propiedad: 'tractor', |
422 | nombre: 'tractor' | 427 | nombre: 'tractor' |
423 | }, | 428 | }, |
424 | { | 429 | { |
425 | propiedad: 'semi', | 430 | propiedad: 'semi', |
426 | nombre: 'Semi' | 431 | nombre: 'Semi' |
427 | } | 432 | } |
428 | ]; | 433 | ]; |
429 | focaModalService.modal(parametrosModal).then(function(vehiculo) { | 434 | focaModalService.modal(parametrosModal).then(function(vehiculo) { |
430 | if(!preCargados && vehiculoEnUso(vehiculo)) return; | 435 | if(!preCargados && vehiculoEnUso(vehiculo)) return; |
431 | $scope.hojaRuta.vehiculo = vehiculo; | 436 | $scope.hojaRuta.vehiculo = vehiculo; |
432 | $scope.hojaRuta.transportista = vehiculo.transportista; | 437 | $scope.hojaRuta.transportista = vehiculo.transportista; |
433 | if(preCargados) { | 438 | if(preCargados) { |
434 | $scope.eligioPreConfirmado = true; | 439 | $scope.eligioPreConfirmado = true; |
435 | $scope.hojaRuta.vehiculo = vehiculo; | 440 | $scope.hojaRuta.vehiculo = vehiculo; |
436 | $scope.$broadcast('addCabecera', { | 441 | $scope.$broadcast('addCabecera', { |
437 | label: 'Transportista:', | 442 | label: 'Transportista:', |
438 | valor: $filter('rellenarDigitos')(vehiculo.transportista.COD, 5) + | 443 | valor: $filter('rellenarDigitos')(vehiculo.transportista.COD, 5) + |
439 | ' - ' + vehiculo.transportista.NOM | 444 | ' - ' + vehiculo.transportista.NOM |
440 | }); | 445 | }); |
441 | focaCrearHojaRutaService | 446 | focaCrearHojaRutaService |
442 | .getRemitosByIdVehiculo(vehiculo.id, $scope.fechaReparto) | 447 | .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto) |
443 | .then(function(res) { | 448 | .then(function(res) { |
444 | $scope.remitosTabla = res.data; | 449 | $scope.hojaRuta.remitosTabla = res.data; |
445 | }); | 450 | }); |
446 | }else { | 451 | }else { |
447 | focaCrearHojaRutaService | 452 | focaCrearHojaRutaService |
448 | .getRemitosByIdVehiculo(vehiculo.id, $scope.fechaReparto, true) | 453 | .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto, true) |
449 | .then(function(res) { | 454 | .then(function(res) { |
450 | $scope.remitosTabla = res.data; | 455 | $scope.hojaRuta.remitosTabla = res.data; |
451 | }); | 456 | }); |
452 | } | 457 | } |
453 | $scope.$broadcast('addCabecera', { | 458 | $scope.$broadcast('addCabecera', { |
454 | label: 'Tractor:', | 459 | label: 'Tractor:', |
455 | valor: vehiculo.tractor | 460 | valor: vehiculo.tractor |
456 | }); | 461 | }); |
457 | $scope.$broadcast('addCabecera', { | 462 | $scope.$broadcast('addCabecera', { |
458 | label: 'Semi:', | 463 | label: 'Semi:', |
459 | valor: vehiculo.semi | 464 | valor: vehiculo.semi |
460 | }); | 465 | }); |
461 | $scope.$broadcast('addCabecera', { | 466 | $scope.$broadcast('addCabecera', { |
462 | label: 'Capacidad:', | 467 | label: 'Capacidad:', |
463 | valor: vehiculo.capacidad | 468 | valor: vehiculo.capacidad |
464 | }); | 469 | }); |
465 | }); | 470 | }); |
466 | } | 471 | } |
467 | 472 | ||
468 | function vehiculoEnUso(vehiculo) { | 473 | function vehiculoEnUso(vehiculo) { |
469 | var idUsuario = focaLoginSrv.getLoginData().vendedorCobrador; | 474 | var idUsuario = focaLoginSrv.getLoginData().vendedorCobrador; |
470 | for(var i = 0; i < vehiculo.cisternas.length; i++) { | 475 | for(var i = 0; i < vehiculo.cisternas.length; i++) { |
471 | for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { | 476 | for(var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { |
472 | var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; | 477 | var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; |
473 | if(cisternaCarga.fechaReparto.substring(0, 10) === $scope.fechaReparto | 478 | if(cisternaCarga.fechaReparto.substring(0, 10) === |
474 | .toISOString().substring(0, 10) && cisternaCarga.idUsuarioProceso && | 479 | new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10) && |
480 | cisternaCarga.idUsuarioProceso && | ||
475 | cisternaCarga.idUsuarioProceso !== idUsuario) | 481 | cisternaCarga.idUsuarioProceso !== idUsuario) |
476 | { | 482 | { |
477 | focaModalService.alert('El vehículo está siendo usado por otro' + | 483 | focaModalService.alert('El vehículo está siendo usado por otro' + |
478 | ' usuario'); | 484 | ' usuario'); |
479 | return true; | 485 | return true; |
480 | } | 486 | } |
481 | } | 487 | } |
482 | } | 488 | } |
483 | return false; | 489 | return false; |
484 | } | 490 | } |
485 | 491 | ||
486 | function salir() { | 492 | function salir() { |
487 | var confirmacion = false; | 493 | var confirmacion = false; |
488 | 494 | ||
489 | angular.forEach($scope.inicial, function(valor, key) { | 495 | if (!angular.equals($scope.hojaRuta, $scope.inicial)) { |
490 | if (!angular.equals($scope[key], $scope.inicial[key])) { | 496 | confirmacion = true; |
491 | confirmacion = true; | 497 | } |
492 | } | ||
493 | }); | ||
494 | 498 | ||
495 | if (confirmacion) { | 499 | if (confirmacion) { |
496 | focaModalService.confirm( | 500 | focaModalService.confirm( |
497 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 501 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
498 | ).then(function(data) { | 502 | ).then(function(data) { |
499 | if (data) { | 503 | if (data) { |
500 | $location.path('/'); | 504 | $location.path('/'); |
501 | } | 505 | } |
502 | }); | 506 | }); |
503 | } else { | 507 | } else { |
504 | $location.path('/'); | 508 | $location.path('/'); |
505 | } | 509 | } |
506 | } | 510 | } |
511 | |||
512 | function setearHojaRuta(hojaRuta) { | ||
513 | $scope.$broadcast('cleanCabecera'); | ||
514 | |||
515 | var cabeceras = []; | ||
516 | if (hojaRuta.fechaReparto) { | ||
517 | cabeceras.push({ | ||
518 | label: 'Fecha de entrega:', | ||
519 | valor: $filter('date')(hojaRuta.fechaReparto, 'dd/MM/yyyy') | ||
520 | }); | ||
521 | } | ||
522 | if (hojaRuta.transportista.COD) { | ||
523 | cabeceras.push({ | ||
524 | label: 'Transportista:', | ||
525 | valor: $filter('rellenarDigitos')(hojaRuta.transportista.COD, 5) + ' - ' + | ||
526 | hojaRuta.transportista.NOM | ||
527 | }); | ||
528 | } | ||
529 | if (hojaRuta.chofer.id) { | ||
530 | cabeceras.push({ | ||
531 | label: 'Chofer:', | ||
532 | valor: $filter('rellenarDigitos')(hojaRuta.chofer.id, 3) + | ||
533 | ' - ' + hojaRuta.chofer.nombre | ||
534 | }); | ||
535 | } | ||
536 | if (hojaRuta.vehiculo.id) { | ||
537 | cabeceras.push({ | ||
538 | label: 'Tractor:', | ||
539 | valor: hojaRuta.vehiculo.tractor | ||
540 | }); | ||
541 | cabeceras.push({ | ||
542 | label: 'Semi:', | ||
543 | valor: hojaRuta.vehiculo.semi | ||
544 | }); | ||
545 | cabeceras.push({ | ||
546 | label: 'Capacidad:', | ||
547 | valor: hojaRuta.vehiculo.capacidad | ||
548 | }); | ||
549 | } | ||
550 | if (hojaRuta.tarifario.costo) { | ||
551 | cabeceras.push({ | ||
552 | label: 'Tarifario:', | ||
553 | valor: hojaRuta.tarifario.costo | ||
554 | }); | ||
555 | } | ||
556 | |||
557 | addArrayCabecera(cabeceras); | ||
558 | $scope.hojaRuta = hojaRuta; | ||
559 | } | ||
560 | |||
561 | function getLSHojaRuta() { | ||
562 | var hojaRuta = JSON.parse($localStorage.hojaRuta || null); | ||
563 | if (hojaRuta) { | ||
564 | setearHojaRuta(hojaRuta); | ||
565 | delete $localStorage.hojaRuta; | ||
566 | } | ||
567 | } | ||
568 | function addArrayCabecera(array) { | ||
569 | for(var i = 0; i < array.length; i++) { | ||
570 | $scope.$broadcast('addCabecera', { | ||
571 | label: array[i].label, |
src/js/service.js
1 | angular.module('focaCrearHojaRuta') | 1 | angular.module('focaCrearHojaRuta') |
2 | .service('focaCrearHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | 2 | .service('focaCrearHojaRutaService', ['$http', 'API_ENDPOINT', |
3 | function($http, API_ENDPOINT) { | ||
3 | var route = API_ENDPOINT.URL; | 4 | var route = API_ENDPOINT.URL; |
4 | return { | 5 | return { |
5 | crearHojaRuta: function(hojaRuta) { | 6 | crearHojaRuta: function(hojaRuta) { |
6 | return $http.post(route + '/hoja-ruta', hojaRuta); | 7 | return $http.post(route + '/hoja-ruta', hojaRuta); |
7 | }, | 8 | }, |
8 | obtenerHojaRuta: function() { | 9 | obtenerHojaRuta: function() { |
9 | return $http.get(route +'/hoja-ruta'); | 10 | return $http.get(route +'/hoja-ruta'); |
10 | }, | 11 | }, |
11 | setHojaRuta: function(hojaRuta) { | 12 | setHojaRuta: function(hojaRuta) { |
12 | this.hojaRuta = hojaRuta; | 13 | this.hojaRuta = hojaRuta; |
13 | }, | 14 | }, |
14 | clearHojaRuta: function() { | 15 | clearHojaRuta: function() { |
15 | this.hojaRuta = undefined; | 16 | this.hojaRuta = undefined; |
16 | }, | 17 | }, |
17 | getHojaRuta: function() { | 18 | getHojaRuta: function() { |
18 | return this.hojaRuta; | 19 | return this.hojaRuta; |
19 | }, | 20 | }, |
20 | getArticulosByIdHojaRuta: function(id) { | 21 | getArticulosByIdHojaRuta: function(id) { |
21 | return $http.get(route+'/articulos/hoja-ruta/'+id); | 22 | return $http.get(route+'/articulos/hoja-ruta/'+id); |
22 | }, | 23 | }, |
23 | crearArticulosParaHojaRuta: function(articuloHojaRuta) { | 24 | crearArticulosParaHojaRuta: function(articuloHojaRuta) { |
24 | return $http.post(route + '/articulos/hoja-ruta', | 25 | return $http.post(route + '/articulos/hoja-ruta', |
25 | {articuloHojaRuta: articuloHojaRuta}); | 26 | {articuloHojaRuta: articuloHojaRuta}); |
26 | }, | 27 | }, |
27 | getDomiciliosByIdHojaRuta: function(id) { | 28 | getDomiciliosByIdHojaRuta: function(id) { |
28 | return $http.get(route +'/hoja-ruta/' + id + '/domicilios'); | 29 | return $http.get(route +'/hoja-ruta/' + id + '/domicilios'); |
29 | }, | 30 | }, |
30 | getDomiciliosByIdCliente: function(id) { | 31 | getDomiciliosByIdCliente: function(id) { |
31 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 32 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) |
32 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 33 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); |
33 | }, | 34 | }, |
34 | getPrecioCondicion: function() { | 35 | getPrecioCondicion: function() { |
35 | return $http.get(route + '/precio-condicion'); | 36 | return $http.get(route + '/precio-condicion'); |
36 | }, | 37 | }, |
37 | getPrecioCondicionById: function(id) { | 38 | getPrecioCondicionById: function(id) { |
38 | return $http.get(route + '/precio-condicion/' + id); | 39 | return $http.get(route + '/precio-condicion/' + id); |
39 | }, | 40 | }, |
40 | getPlazoPagoByPrecioCondicion: function(id) { | 41 | getPlazoPagoByPrecioCondicion: function(id) { |
41 | return $http.get(route + '/plazo-pago/precio-condicion/' + id); | 42 | return $http.get(route + '/plazo-pago/precio-condicion/' + id); |
42 | }, | 43 | }, |
43 | crearFlete: function(flete) { | 44 | crearFlete: function(flete) { |
44 | return $http.post(route + '/flete', {flete : flete}); | 45 | return $http.post(route + '/flete', {flete : flete}); |
45 | }, | 46 | }, |
46 | crearPlazosParaHojaRuta: function(plazos) { | 47 | crearPlazosParaHojaRuta: function(plazos) { |
47 | return $http.post(route + '/plazo-pago/hoja-ruta', plazos); | 48 | return $http.post(route + '/plazo-pago/hoja-ruta', plazos); |
48 | }, | 49 | }, |
49 | getCotizacionByIdMoneda: function(id) { | 50 | getCotizacionByIdMoneda: function(id) { |
50 | return $http.get(route + '/moneda/' + id); | 51 | return $http.get(route + '/moneda/' + id); |
51 | }, | 52 | }, |
52 | crearEstadoParaHojaRuta: function(estado) { | 53 | crearEstadoParaHojaRuta: function(estado) { |
53 | return $http.post(route + '/estado', {estado: estado}); | 54 | return $http.post(route + '/estado', {estado: estado}); |
54 | }, | 55 | }, |
55 | getNumeroHojaRuta: function() { | 56 | getNumeroHojaRuta: function() { |
56 | return $http.get(route + '/hoja-ruta/numero-siguiente'); | 57 | return $http.get(route + '/hoja-ruta/numero-siguiente'); |
57 | }, | 58 | }, |
58 | getRemitosByIdVehiculo: function(idVehiculo, fechaReparto, sinConfirmar) { | 59 | getRemitosByIdVehiculo: function(idVehiculo, fechaReparto, sinConfirmar) { |
59 | var noCofirmados = sinConfirmar ? '/sinConfirmar' : ''; | 60 | var noCofirmados = sinConfirmar ? '/sinConfirmar' : ''; |
60 | return $http.get(route + '/vehiculo/obtener/remitos/' + | 61 | return $http.get(route + '/vehiculo/obtener/remitos/' + |
61 | idVehiculo + '/' + fechaReparto.toISOString().substring(0, 10) + noCofirmados); | 62 | idVehiculo + '/' + fechaReparto.toISOString().substring(0, 10) + noCofirmados); |
62 | }, | 63 | }, |
63 | desasociarRemitos: function(idsRemitos, idVehiculo, sinRemitos) { | 64 | desasociarRemitos: function(idsRemitos, idVehiculo, sinRemitos) { |
64 | return $http.post(route + '/vehiculo/desasociar-remitos', | 65 | return $http.post(route + '/vehiculo/desasociar-remitos', |
65 | { | 66 | { |
66 | idsRemitos: idsRemitos, | 67 | idsRemitos: idsRemitos, |
67 | idVehiculo: idVehiculo, | 68 | idVehiculo: idVehiculo, |
68 | vehiculoSinRemitos: sinRemitos | 69 | vehiculoSinRemitos: sinRemitos |
69 | }); | 70 | }); |
70 | }, | 71 | }, |
71 | getBotonera: function() { | 72 | getBotonera: function() { |
72 | return [ | 73 | return [ |
73 | { | 74 | { |
74 | label: 'Fecha Entrega', | 75 | label: 'Fecha Entrega', |
75 | image: 'fechaDeReparto.png' | 76 | image: 'fechaDeReparto.png' |
76 | }, | 77 | }, |
77 | { | 78 | { |
78 | label: 'Transportista', | 79 | label: 'Transportista', |
79 | image: 'transportista.png' | 80 | image: 'transportista.png' |
80 | }, | 81 | }, |
81 | { | 82 | { |
82 | label: 'Chofer', | 83 | label: 'Chofer', |
83 | image: 'chofer.png' | 84 | image: 'chofer.png' |
84 | }, | 85 | }, |
85 | { | 86 | { |
86 | label: 'Vehiculo', | 87 | label: 'Vehiculo', |
87 | image: 'vehiculos.png' | 88 | image: 'vehiculos.png' |
88 | }, | 89 | }, |
89 | { | 90 | { |
90 | label: 'Tarifario', | 91 | label: 'Tarifario', |
91 | image: 'tarifario.png' | 92 | image: 'tarifario.png' |
92 | }, | 93 | }, |
93 | { | 94 | { |
94 | label: 'Remitos', | 95 | label: 'Remitos', |
95 | image: 'remito.png' | 96 | image: 'remito.png' |
96 | }, | 97 | }, |
97 | { | 98 | { |
98 | label: 'Vehiculos precargados', | 99 | label: 'Vehiculos precargados', |
99 | image: 'vehiculos.png' | 100 | image: 'vehiculos.png' |
100 | }, | 101 | }, |
101 | { | 102 | { |
102 | label: 'Datos extra', | 103 | label: 'Datos extra', |
103 | image: 'tarifario.png' | 104 | image: 'tarifario.png' |
104 | } | 105 | } |
105 | ]; | 106 | ]; |
106 | } | 107 | } |
107 | }; | 108 | }; |
108 | }]); | 109 | }]); |
109 | 110 |
src/views/hoja-ruta.html
1 | <div class="crear-hoja-ruta foca-crear row"> | 1 | <div class="crear-hoja-ruta foca-crear row"> |
2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
3 | titulo="'Hoja de ruta'" | 3 | titulo="'Hoja de ruta'" |
4 | numero="puntoVenta + '-' + comprobante" | 4 | numero="puntoVenta + '-' + comprobante" |
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 class="col-lg-12"> | 8 | <div class="col-lg-12"> |
9 | <div class="row mt-4"> | 9 | <div class="row mt-4"> |
10 | <div class="col-12 col-md-10 border border-light rounded"> | 10 | <div class="col-12 col-md-10 border border-light rounded"> |
11 | <div class="row px-5 py-2 botonera-secundaria"> | 11 | <div class="row px-5 py-2 botonera-secundaria"> |
12 | <div class="col-12"> | 12 | <div class="col-12"> |
13 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> | 13 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> |
14 | </div> | 14 | </div> |
15 | </div> | 15 | </div> |
16 | <!-- PC --> | 16 | <!-- PC --> |
17 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 17 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
18 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 18 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
19 | <thead> | 19 | <thead> |
20 | <tr class="d-flex"> | 20 | <tr class="d-flex"> |
21 | <th class="col-auto">#</th> | 21 | <th class="col-auto">#</th> |
22 | <th class="col-2">Remito</th> | 22 | <th class="col-2">Remito</th> |
23 | <th class="col">Cliente</th> | 23 | <th class="col">Cliente</th> |
24 | <th class="col">Dirección</th> | 24 | <th class="col">Dirección</th> |
25 | <th class="col-auto"> | 25 | <th class="col-auto"> |
26 | <button | 26 | <button |
27 | class="btn btn-outline-light selectable" | 27 | class="btn btn-outline-light selectable" |
28 | ng-click="show = !show; masMenos()" | 28 | ng-click="show = !show; masMenos()" |
29 | > | 29 | > |
30 | <i | 30 | <i |
31 | class="fa fa-chevron-down" | 31 | class="fa fa-chevron-down" |
32 | ng-show="show" | 32 | ng-show="show" |
33 | aria-hidden="true" | 33 | aria-hidden="true" |
34 | > | 34 | > |
35 | </i> | 35 | </i> |
36 | <i | 36 | <i |
37 | class="fa fa-chevron-up" | 37 | class="fa fa-chevron-up" |
38 | ng-hide="show" | 38 | ng-hide="show" |
39 | aria-hidden="true"> | 39 | aria-hidden="true"> |
40 | </i> | 40 | </i> |
41 | </button> | 41 | </button> |
42 | </th> | 42 | </th> |
43 | </th> | 43 | </th> |
44 | </tr> | 44 | </tr> |
45 | </thead> | 45 | </thead> |
46 | <tbody class="tabla-articulo-body"> | 46 | <tbody class="tabla-articulo-body"> |
47 | <tr | 47 | <tr |
48 | ng-repeat="(key, remito) in remitosTabla" | 48 | ng-repeat="(key, remito) in hojaRuta.remitosTabla" |
49 | class="d-flex" | 49 | class="d-flex" |
50 | ng-show="show || key == remitosTabla.length - 1" | 50 | ng-show="show || key == hojaRuta.remitosTabla.length - 1" |
51 | > | 51 | > |
52 | <td ng-bind="key + 1" class="col-auto"></td> | 52 | <td ng-bind="key + 1" class="col-auto"></td> |
53 | <td | 53 | <td |
54 | class="col-2" | 54 | class="col-2" |
55 | ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" | 55 | ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" |
56 | ></td> | 56 | ></td> |
57 | <th class="col" ng-bind="remito.nombreCliente"></th> | 57 | <th class="col" ng-bind="remito.nombreCliente"></th> |
58 | <th class="col" ng-bind="remito.domicilioStamp"></th> | 58 | <th class="col" ng-bind="remito.domicilioStamp"></th> |
59 | <td class="text-center col-auto"> | 59 | <td class="text-center col-auto"> |
60 | <button | 60 | <button |
61 | class="btn btn-outline-light" | 61 | class="btn btn-outline-light" |
62 | ng-click="desasociarRemito(key, remito.id)" | 62 | ng-click="desasociarRemito(key, remito.id)" |
63 | > | 63 | > |
64 | <i class="fa fa-trash"></i> | 64 | <i class="fa fa-trash"></i> |
65 | </button> | 65 | </button> |
66 | </td> | 66 | </td> |
67 | </tr> | 67 | </tr> |
68 | </tbody> | 68 | </tbody> |
69 | <tfoot> | 69 | <tfoot> |
70 | <tr class="d-flex"> | 70 | <tr class="d-flex"> |
71 | <td class="col-auto px-1"> | 71 | <td class="col-auto px-1"> |
72 | <strong>Remitos:</strong> | 72 | <strong>Remitos:</strong> |
73 | <a ng-bind="remitosTabla.length"></a> | 73 | <a ng-bind="hojaRuta.remitosTabla.length"></a> |
74 | </td> | 74 | </td> |
75 | <td class="col"></td> | 75 | <td class="col"></td> |
76 | <td class="col-auto px-1"> | 76 | <td class="col-auto px-1"> |
77 | <strong>Cantidad:</strong> | 77 | <strong>Cantidad:</strong> |
78 | <a ng-bind="hojaRuta.litros"></a> | 78 | <a ng-bind="hojaRuta.litros"></a> |
79 | </td> | 79 | </td> |
80 | </tr> | 80 | </tr> |
81 | </tfoot> | 81 | </tfoot> |
82 | </table> | 82 | </table> |
83 | </div> | 83 | </div> |
84 | </div> | 84 | </div> |
85 | </div> | 85 | </div> |
86 | </div> | 86 | </div> |
87 | </div> | 87 | </div> |
88 | 88 |