Commit a0dc6692896162ca73aeaeed96c40891780f451f
Exists in
master
Merge branch 'develop' into 'master'
Develop See merge request !67
Showing
4 changed files
Show diff stats
package.json
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | "description": "foca-crear-hoja-ruta", |
5 | 5 | "main": "index.js", |
6 | 6 | "scripts": { |
7 | + "refresh" : "gulp uglify && cp tmp/foca-crear-hoja-ruta.js ../wrapper-demo/node_modules/foca-crear-hoja-ruta/dist/foca-crear-hoja-ruta.min.js", | |
7 | 8 | "test": "test.html", |
8 | 9 | "compile": "gulp uglify", |
9 | 10 | "gulp-pre-commit": "gulp pre-commit", |
src/js/controller.js
... | ... | @@ -15,6 +15,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
15 | 15 | function ($scope, $uibModal, $location, $filter, $timeout, |
16 | 16 | focaCrearHojaRutaService, focaModalService, focaBotoneraLateralService, |
17 | 17 | focaLoginSrv, $localStorage, hojaRutaBusinessService, $cookies) { |
18 | + | |
18 | 19 | config(); |
19 | 20 | |
20 | 21 | function config() { |
... | ... | @@ -47,13 +48,13 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
47 | 48 | |
48 | 49 | var parametros = JSON.parse(res.data[0].jsonText); |
49 | 50 | |
50 | - $timeout(function () { | |
51 | + $timeout(function () { | |
51 | 52 | getLSBotoneraPrincipal(); |
52 | 53 | }); |
53 | 54 | |
54 | 55 | if ($localStorage.data) { |
55 | - $timeout(function () { | |
56 | - getLSHojaRuta(); | |
56 | + $timeout(function () { | |
57 | + getLSHojaRuta(); | |
57 | 58 | }); |
58 | 59 | |
59 | 60 | } else { |
... | ... | @@ -98,14 +99,15 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
98 | 99 | $scope.inicial = angular.copy($scope.hojaRuta); |
99 | 100 | } |
100 | 101 | |
101 | - $scope.$watchGroup(['hojaRuta','precargado','cargaRemito','remitoAbierto'], function(newValues) { | |
102 | - focaBotoneraLateralService.setPausarData( | |
103 | - { | |
104 | - label: 'data', | |
105 | - val: newValues | |
106 | - } | |
107 | - ); | |
108 | - }); | |
102 | + $scope.$watchGroup(['hojaRuta', 'precargado', 'cargaRemito', 'remitoAbierto'], | |
103 | + function (newValues) { | |
104 | + focaBotoneraLateralService.setPausarData( | |
105 | + { | |
106 | + label: 'data', | |
107 | + val: newValues | |
108 | + } | |
109 | + ); | |
110 | + }); | |
109 | 111 | |
110 | 112 | $scope.seleccionarRemitoAbierto = function () { |
111 | 113 | $scope.remitoAbierto = true; |
... | ... | @@ -270,7 +272,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
270 | 272 | |
271 | 273 | function getImporte(propiedad) { |
272 | 274 | var importe = 0; |
273 | - | |
275 | + | |
274 | 276 | $scope.articulos.forEach(function (articulo) { |
275 | 277 | |
276 | 278 | if (articulo[propiedad]) { |
... | ... | @@ -327,6 +329,9 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
327 | 329 | estado: 0, |
328 | 330 | destinoVenta: 0,//TODO |
329 | 331 | operacionTipo: 0, //TODO |
332 | + flete: false, | |
333 | + fob: false, | |
334 | + bomba: false, | |
330 | 335 | }, |
331 | 336 | notaPedido: { |
332 | 337 | id: 0 |
... | ... | @@ -346,17 +351,17 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
346 | 351 | idVehiculo: $scope.hojaRuta.vehiculo.id |
347 | 352 | }, data.data.id); |
348 | 353 | $scope.remito.numeroRemito = data.data.numero; |
349 | - | |
354 | + | |
350 | 355 | // if ($scope.remito.remitoPuntoDescarga.length > 0) { |
351 | 356 | // remitoBusinessService.addPuntosDescarga(data.data.id, |
352 | 357 | // $scope.remito.remitoPuntoDescarga); |
353 | 358 | // } |
354 | - | |
359 | + | |
355 | 360 | hojaRutaBusinessService.addArticulos($scope.articulosRecibidos, |
356 | 361 | data.data.id, $scope.hojaRuta.cotizacion.VENDEDOR); |
357 | 362 | |
358 | 363 | guardarHojaRuta(data.data.id); |
359 | - | |
364 | + | |
360 | 365 | }, function (error) { |
361 | 366 | focaModalService.alert( |
362 | 367 | error.data || 'Hubo un error al crear el remito'); |
... | ... | @@ -367,7 +372,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
367 | 372 | ); |
368 | 373 | |
369 | 374 | function guardarHojaRuta(idRemito) { |
370 | - | |
375 | + | |
371 | 376 | var save2 = { |
372 | 377 | hojaRuta: { |
373 | 378 | id: 0, |
... | ... | @@ -383,7 +388,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
383 | 388 | estado: 0, |
384 | 389 | abierta: 1 |
385 | 390 | }, |
386 | - remitos: [{id: idRemito}] | |
391 | + remitos: [{ id: idRemito }] | |
387 | 392 | }; |
388 | 393 | |
389 | 394 | save2.hojaRuta = angular |
... | ... | @@ -391,7 +396,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
391 | 396 | focaCrearHojaRutaService.crearHojaRuta(save2).then( |
392 | 397 | function (data) { |
393 | 398 | var remitoNumero; |
394 | - data.data.remitos.forEach(function(idRemitos) { | |
399 | + data.data.remitos.forEach(function (idRemitos) { | |
395 | 400 | remitoNumero = idRemitos; |
396 | 401 | }); |
397 | 402 | focaModalService.alert( |
... | ... | @@ -400,43 +405,43 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
400 | 405 | $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8) + |
401 | 406 | '\nRemito Abierto Nยบ: ' + |
402 | 407 | $filter('rellenarDigitos')(remitoNumero.sucursal, 4) + '-' + |
403 | - $filter('rellenarDigitos')(remitoNumero.numeroRemito,8) | |
404 | - ); | |
405 | - | |
406 | - config(); | |
407 | - }, | |
408 | - function (error) { | |
409 | - | |
410 | - focaModalService | |
408 | + $filter('rellenarDigitos')(remitoNumero.numeroRemito, 8) | |
409 | + ); | |
410 | + | |
411 | + config(); | |
412 | + }, | |
413 | + function (error) { | |
414 | + | |
415 | + focaModalService | |
411 | 416 | .alert('Hubo un error al crear la hoja de ruta'); |
412 | 417 | |
413 | - console.info(error); | |
414 | - } | |
415 | - ); | |
416 | - } | |
418 | + console.info(error); | |
419 | + } | |
420 | + ); | |
421 | + } | |
417 | 422 | } |
418 | 423 | } |
419 | 424 | |
420 | 425 | $scope.seleccionarCliente = function () { |
421 | - var modalInstance = $uibModal.open( | |
422 | - { | |
423 | - ariaLabelledBy: 'Busqueda de Cliente', | |
424 | - templateUrl: 'foca-busqueda-cliente-modal.html', | |
425 | - controller: 'focaBusquedaClienteModalController', | |
426 | - resolve: { | |
427 | - vendedor: function () { return null; }, | |
428 | - cobrador: function () { return null; } | |
429 | - }, | |
430 | - size: 'lg' | |
431 | - } | |
432 | - ); | |
433 | - modalInstance.result.then( | |
434 | - function (cliente) { | |
435 | - $scope.abrirModalDomicilios(cliente); | |
436 | - $scope.cliente = cliente; | |
437 | - }, function () { | |
438 | - } | |
439 | - ); | |
426 | + var modalInstance = $uibModal.open( | |
427 | + { | |
428 | + ariaLabelledBy: 'Busqueda de Cliente', | |
429 | + templateUrl: 'foca-busqueda-cliente-modal.html', | |
430 | + controller: 'focaBusquedaClienteModalController', | |
431 | + resolve: { | |
432 | + vendedor: function () { return null; }, | |
433 | + cobrador: function () { return null; } | |
434 | + }, | |
435 | + size: 'lg' | |
436 | + } | |
437 | + ); | |
438 | + modalInstance.result.then( | |
439 | + function (cliente) { | |
440 | + $scope.abrirModalDomicilios(cliente); | |
441 | + $scope.cliente = cliente; | |
442 | + }, function () { | |
443 | + } | |
444 | + ); | |
440 | 445 | }; |
441 | 446 | |
442 | 447 | $scope.abrirModalDomicilios = function (cliente) { |
... | ... | @@ -471,7 +476,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
471 | 476 | $scope.$broadcast('addCabecera', { |
472 | 477 | label: 'Vendedor:', |
473 | 478 | valor: $filter('rellenarDigitos')($scope.hojaRuta.vendedor |
474 | - .NUM, 3) +' - ' + $scope.hojaRuta.vendedor.NOM | |
479 | + .NUM, 3) + ' - ' + $scope.hojaRuta.vendedor.NOM | |
475 | 480 | }); |
476 | 481 | } |
477 | 482 | var domicilioStamp = |
... | ... | @@ -536,9 +541,9 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
536 | 541 | } |
537 | 542 | ); |
538 | 543 | modalInstance.result.then( |
539 | - function(puntosDescarga) { | |
544 | + function (puntosDescarga) { | |
540 | 545 | |
541 | - puntosDescarga.forEach(function(punto) { | |
546 | + puntosDescarga.forEach(function (punto) { | |
542 | 547 | $scope.hojaRuta.remitoPuntoDescarga.push( |
543 | 548 | { |
544 | 549 | puntoDescarga: punto |
... | ... | @@ -607,7 +612,9 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
607 | 612 | focaModalService.alert( |
608 | 613 | 'Hoja ruta creada Nยบ: ' + |
609 | 614 | $filter('rellenarDigitos')(data.data.sucursal, 4) + '-' + |
610 | - $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8) | |
615 | + $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8) + ' ' + | |
616 | + $filter('date')($scope.hojaRuta.fechaReparto, 'dd/MM/yyyy') + '-' + | |
617 | + $scope.hojaRuta.orden | |
611 | 618 | ); |
612 | 619 | |
613 | 620 | config(); |
... | ... | @@ -620,43 +627,43 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
620 | 627 | }; |
621 | 628 | |
622 | 629 | $scope.seleccionarProveedor = function () { |
623 | - var parametrosModal = { | |
624 | - titulo: 'Bรบsqueda de Proveedor', | |
625 | - query: '/proveedor', | |
626 | - columnas: [ | |
627 | - { | |
628 | - nombre: 'Cรณdigo', | |
629 | - propiedad: 'COD', | |
630 | - filtro: { | |
631 | - nombre: 'rellenarDigitos', | |
632 | - parametro: 5 | |
633 | - } | |
634 | - }, | |
635 | - { | |
636 | - nombre: 'Nombre', | |
637 | - propiedad: 'NOM' | |
638 | - }, | |
639 | - { | |
640 | - nombre: 'CUIT', | |
641 | - propiedad: 'CUIT' | |
630 | + var parametrosModal = { | |
631 | + titulo: 'Bรบsqueda de Proveedor', | |
632 | + query: '/proveedor', | |
633 | + columnas: [ | |
634 | + { | |
635 | + nombre: 'Cรณdigo', | |
636 | + propiedad: 'COD', | |
637 | + filtro: { | |
638 | + nombre: 'rellenarDigitos', | |
639 | + parametro: 5 | |
642 | 640 | } |
643 | - ], | |
644 | - tipo: 'POST', | |
645 | - json: { razonCuitCod: '' } | |
646 | - }; | |
647 | - focaModalService.modal(parametrosModal).then( | |
648 | - function (proveedor) { | |
649 | - $filter('filter')($scope.botonera, { | |
650 | - label: 'Proveedor', | |
651 | - })[0].checked = true; | |
641 | + }, | |
642 | + { | |
643 | + nombre: 'Nombre', | |
644 | + propiedad: 'NOM' | |
645 | + }, | |
646 | + { | |
647 | + nombre: 'CUIT', | |
648 | + propiedad: 'CUIT' | |
649 | + } | |
650 | + ], | |
651 | + tipo: 'POST', | |
652 | + json: { razonCuitCod: '' } | |
653 | + }; | |
654 | + focaModalService.modal(parametrosModal).then( | |
655 | + function (proveedor) { | |
656 | + $filter('filter')($scope.botonera, { | |
657 | + label: 'Proveedor', | |
658 | + })[0].checked = true; | |
652 | 659 | |
653 | - $scope.$broadcast('addCabecera', { | |
654 | - label: 'Proveedor:', | |
655 | - valor: proveedor.COD + ' - ' + proveedor.NOM | |
656 | - }); | |
657 | - $scope.hojaRuta.proveedor = proveedor; | |
658 | - }, function () { } | |
659 | - ); | |
660 | + $scope.$broadcast('addCabecera', { | |
661 | + label: 'Proveedor:', | |
662 | + valor: proveedor.COD + ' - ' + proveedor.NOM | |
663 | + }); | |
664 | + $scope.hojaRuta.proveedor = proveedor; | |
665 | + }, function () { } | |
666 | + ); | |
660 | 667 | }; |
661 | 668 | |
662 | 669 | $scope.seleccionarTransportista = function () { |
... | ... | @@ -776,7 +783,9 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
776 | 783 | }; |
777 | 784 | |
778 | 785 | $scope.seleccionarRemitos = function () { |
786 | + | |
779 | 787 | if (eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; |
788 | + | |
780 | 789 | var modalInstance = $uibModal.open( |
781 | 790 | { |
782 | 791 | ariaLabelledBy: 'Busqueda de Remito', |
... | ... | @@ -786,8 +795,8 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
786 | 795 | resolve: { usadoPor: function () { return 'hojaRuta'; } } |
787 | 796 | } |
788 | 797 | ); |
789 | - modalInstance.result.then( | |
790 | - function (remito) { | |
798 | + modalInstance.result | |
799 | + .then(function (remito) { | |
791 | 800 | // TODO: borrar cuando no se use definitivamente |
792 | 801 | // for (var i = $scope.hojaRuta.remitosTabla.length - 1; i >= 0; i--) { |
793 | 802 | // if ($scope.hojaRuta.remitosTabla[i].id === remito.id) { |
... | ... | @@ -820,19 +829,20 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
820 | 829 | |
821 | 830 | // remito.litros = litros; |
822 | 831 | // $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; |
823 | - $scope.cargarCisterna(remito.id).then(function () { | |
824 | - $scope.hojaRuta.remitosTabla.push(remito); | |
825 | - $filter('filter')($scope.botonera, { | |
826 | - label: 'Remitos', | |
827 | - })[0].checked = true; | |
832 | + $scope.cargarCisterna(remito.id) | |
833 | + .then(function () { | |
834 | + $scope.hojaRuta.remitosTabla.push(remito); | |
835 | + $filter('filter')($scope.botonera, { | |
836 | + label: 'Remitos', | |
837 | + })[0].checked = true; | |
828 | 838 | |
829 | - }, function (error) { | |
830 | - error.then($scope.seleccionarRemitos); | |
831 | - }); | |
832 | - }, function () { | |
833 | - // funcion ejecutada cuando se cancela el modal | |
834 | - } | |
835 | - ); | |
839 | + }) | |
840 | + .catch(function (error) { | |
841 | + console.error(error); | |
842 | + $scope.seleccionarRemitos(); | |
843 | + }); | |
844 | + }) | |
845 | + .catch(function (e) { console.error(e); }); | |
836 | 846 | }; |
837 | 847 | |
838 | 848 | $scope.seleccionarVehiculosPrecargados = function () { |
... | ... | @@ -851,7 +861,8 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
851 | 861 | resolve: { |
852 | 862 | idVehiculo: function () { return $scope.hojaRuta.vehiculo.id; }, |
853 | 863 | idRemito: function () { return idRemito; }, |
854 | - fechaReparto: function () { return $scope.hojaRuta.fechaReparto; } | |
864 | + fechaReparto: function () { return $scope.hojaRuta.fechaReparto; }, | |
865 | + orden: function () { return $scope.hojaRuta.orden; } | |
855 | 866 | } |
856 | 867 | } |
857 | 868 | ); |
... | ... | @@ -962,31 +973,36 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
962 | 973 | }; |
963 | 974 | |
964 | 975 | $scope.mostrarDetalle = function (hojasRutas) { |
965 | - var modalInstance =$uibModal.open( | |
976 | + var modalInstance = $uibModal.open( | |
966 | 977 | { |
967 | 978 | ariaLabelledBy: '', |
968 | 979 | templateUrl: 'modal-detalle-carga.html', |
969 | 980 | controller: 'focaModalDetalleController', |
970 | 981 | resolve: { |
971 | - hojasRutas: function () { return hojasRutas; } | |
982 | + parametrosModal: function () { | |
983 | + return { | |
984 | + hojasRutas: hojasRutas, | |
985 | + orden: $scope.hojaRuta.orden | |
986 | + }; | |
987 | + } | |
972 | 988 | }, |
973 | 989 | size: 'lg', |
974 | 990 | backdrop: false |
975 | 991 | } |
976 | 992 | ); |
977 | - return modalInstance.result.then(function (res) { | |
978 | - res.cisternas.forEach( function (cisterna) { | |
979 | - $scope.cisternaCargas.push(cisterna.cisternaCarga); | |
980 | - }); | |
981 | - $scope.cisternaMovimientos = res.movimientos; | |
982 | - $scope.articulosRecibidos = res.articulos; | |
983 | - $scope.articulos = res.articulos; | |
984 | - $filter('filter')($scope.botonera, { | |
985 | - label: 'Detalle de Carga', | |
986 | - })[0].checked = true; | |
987 | - }, function () { | |
988 | - //se ejecuta cuando se cancela el modal | |
989 | - }); | |
993 | + return modalInstance.result | |
994 | + .then(function (res) { | |
995 | + res.cisternas.forEach(function (cisterna) { | |
996 | + $scope.cisternaCargas.push(cisterna.cisternaCarga); | |
997 | + }); | |
998 | + $scope.cisternaMovimientos = res.movimientos; | |
999 | + $scope.articulosRecibidos = res.articulos; | |
1000 | + $scope.articulos = res.articulos; | |
1001 | + $filter('filter')($scope.botonera, { | |
1002 | + label: 'Detalle de Carga', | |
1003 | + })[0].checked = true; | |
1004 | + }) | |
1005 | + .catch(function (e) { console.error(e); }); | |
990 | 1006 | }; |
991 | 1007 | |
992 | 1008 | function elegirFecha() { |
... | ... | @@ -1034,6 +1050,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
1034 | 1050 | } |
1035 | 1051 | |
1036 | 1052 | function modalVehiculos(preCargados) { |
1053 | + | |
1037 | 1054 | var parametrosModal = {}; |
1038 | 1055 | if (preCargados) { |
1039 | 1056 | parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' + |
... | ... | @@ -1057,6 +1074,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
1057 | 1074 | nombre: 'Semi' |
1058 | 1075 | } |
1059 | 1076 | ]; |
1077 | + | |
1060 | 1078 | focaModalService.modal(parametrosModal).then(function (vehiculo) { |
1061 | 1079 | if (!preCargados && vehiculoEnUso(vehiculo)) return; |
1062 | 1080 | $scope.hojaRuta.vehiculo = vehiculo; |
... | ... | @@ -1095,6 +1113,13 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
1095 | 1113 | $scope.hojaRuta.remitosTabla = res.data; |
1096 | 1114 | }); |
1097 | 1115 | } |
1116 | + | |
1117 | + focaCrearHojaRutaService | |
1118 | + .getNumeroOrden(vehiculo.id, $scope.hojaRuta.fechaReparto) | |
1119 | + .then(function (res) { | |
1120 | + $scope.hojaRuta.orden = res.data; | |
1121 | + }); | |
1122 | + | |
1098 | 1123 | $scope.$broadcast('addCabecera', { |
1099 | 1124 | label: 'Tractor:', |
1100 | 1125 | valor: vehiculo.tractor |
... | ... | @@ -1226,7 +1251,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
1226 | 1251 | function getLSHojaRuta() { |
1227 | 1252 | if ($localStorage.data === undefined) return; |
1228 | 1253 | |
1229 | - var hojaRuta = (JSON.parse($localStorage.data))[0] || null; | |
1254 | + var hojaRuta = (JSON.parse($localStorage.data))[0] || null; | |
1230 | 1255 | if (hojaRuta) { |
1231 | 1256 | setearHojaRuta(hojaRuta); |
1232 | 1257 | delete $localStorage.data; |
... | ... | @@ -1252,7 +1277,8 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
1252 | 1277 | label: 'Precargados' |
1253 | 1278 | })[0].checked = $scope.precargado; |
1254 | 1279 | $scope.botonera = focaCrearHojaRutaService.getBotonFecha(); |
1255 | - Array.prototype.push.apply($scope.botonera,focaCrearHojaRutaService.getBotoneraPrecargado()); | |
1280 | + Array.prototype.push.apply($scope.botonera, | |
1281 | + focaCrearHojaRutaService.getBotoneraPrecargado()); | |
1256 | 1282 | } |
1257 | 1283 | if (cargaRemito) { |
1258 | 1284 | $scope.cargaRemito = cargaRemito; |
... | ... | @@ -1260,7 +1286,8 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
1260 | 1286 | label: 'Cargar Remitos' |
1261 | 1287 | })[0].checked = $scope.cargaRemito; |
1262 | 1288 | $scope.botonera = focaCrearHojaRutaService.getBotonFecha(); |
1263 | - Array.prototype.push.apply($scope.botonera,focaCrearHojaRutaService.getBotoneraCargarRemito()); | |
1289 | + Array.prototype.push.apply($scope.botonera, | |
1290 | + focaCrearHojaRutaService.getBotoneraCargarRemito()); | |
1264 | 1291 | } |
1265 | 1292 | } |
1266 | 1293 |
src/js/controllerDetalles.js
1 | 1 | angular.module('focaCrearHojaRuta') |
2 | 2 | .controller('focaModalDetalleController', [ |
3 | 3 | '$scope', '$timeout', '$uibModalInstance', 'focaModalService', |
4 | - 'focaCrearHojaRutaService', 'hojasRutas', | |
4 | + 'focaCrearHojaRutaService', 'parametrosModal', | |
5 | 5 | function ($scope, $timeout, $uibModalInstance, focaModalService, |
6 | - focaCrearHojaRutaService, hojasRutas) { | |
6 | + focaCrearHojaRutaService, parametrosModal) { | |
7 | 7 | |
8 | 8 | $scope.mostrar = false; |
9 | + $scope.orden = parametrosModal.orden; | |
9 | 10 | $scope.articulos = []; |
10 | 11 | $scope.cisternaMovimientos = []; |
11 | 12 | |
12 | 13 | init(); |
13 | 14 | function init() { |
14 | - $scope.hojasRutas = hojasRutas; | |
15 | + $scope.hojasRutas = parametrosModal.hojasRutas; | |
15 | 16 | |
16 | 17 | $scope.hojasRutas.vehiculo.cisternas = $scope.hojasRutas.vehiculo.cisternas.filter( |
17 | 18 | function (cisterna) { |
... | ... | @@ -98,19 +99,20 @@ angular.module('focaCrearHojaRuta') |
98 | 99 | |
99 | 100 | var fechaReparto = $scope.hojasRutas.fechaReparto; |
100 | 101 | |
101 | - var filtroCisternaCarga = cisterna.cisternasCarga.filter(function(carga) { | |
102 | - return carga.fechaReparto === fechaReparto; | |
103 | - }); | |
102 | + // var filtroCisternaCarga = cisterna.cisternasCarga.filter(function(carga) { | |
103 | + // return carga.fechaReparto === fechaReparto; | |
104 | + // }); | |
104 | 105 | |
105 | - if (filtroCisternaCarga.length) { | |
106 | - cisterna.cisternaCarga = filtroCisternaCarga[0]; | |
107 | - } else { | |
106 | + // if (filtroCisternaCarga.length) { | |
107 | + // cisterna.cisternaCarga = filtroCisternaCarga[0]; | |
108 | + // } else { | |
108 | 109 | cisterna.cisternaCarga = { |
109 | 110 | confirmado: null, |
110 | 111 | fechaReparto: fechaReparto, |
111 | 112 | idCisterna: cisterna.id, |
113 | + orden: $scope.orden | |
112 | 114 | }; |
113 | - } | |
115 | + // } | |
114 | 116 | |
115 | 117 | //cargar |
116 | 118 | if (cisterna.cisternaCarga.cantidad) { |
src/js/service.js
... | ... | @@ -247,6 +247,10 @@ angular.module('focaCrearHojaRuta') |
247 | 247 | crearArticulosParaRemito: function(articuloRemito) { |
248 | 248 | return $http.post(route + '/articulos/remito', |
249 | 249 | {articuloRemito: articuloRemito}); |
250 | + }, | |
251 | + getNumeroOrden: function(idVehiculo, fecha) { | |
252 | + return $http.get(route + '/hoja-ruta/obtener/numero-orden/' + | |
253 | + idVehiculo + '/' + fecha.toISOString().slice(0, 10)); | |
250 | 254 | } |
251 | 255 | }; |
252 | 256 | }]); |