Commit 7c8f5850ff90f1537880ed5ff0ffee4f203a3a9a
1 parent
0bc4382d1a
Exists in
master
and in
2 other branches
hoja de ruta con orden
Showing
3 changed files
with
64 additions
and
33 deletions
Show diff stats
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() { |
... | ... | @@ -418,25 +419,25 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
418 | 419 | } |
419 | 420 | |
420 | 421 | $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 | - ); | |
422 | + var modalInstance = $uibModal.open( | |
423 | + { | |
424 | + ariaLabelledBy: 'Busqueda de Cliente', | |
425 | + templateUrl: 'foca-busqueda-cliente-modal.html', | |
426 | + controller: 'focaBusquedaClienteModalController', | |
427 | + resolve: { | |
428 | + vendedor: function () { return null; }, | |
429 | + cobrador: function () { return null; } | |
430 | + }, | |
431 | + size: 'lg' | |
432 | + } | |
433 | + ); | |
434 | + modalInstance.result.then( | |
435 | + function (cliente) { | |
436 | + $scope.abrirModalDomicilios(cliente); | |
437 | + $scope.cliente = cliente; | |
438 | + }, function () { | |
439 | + } | |
440 | + ); | |
440 | 441 | }; |
441 | 442 | |
442 | 443 | $scope.abrirModalDomicilios = function (cliente) { |
... | ... | @@ -607,7 +608,9 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
607 | 608 | focaModalService.alert( |
608 | 609 | 'Hoja ruta creada Nº: ' + |
609 | 610 | $filter('rellenarDigitos')(data.data.sucursal, 4) + '-' + |
610 | - $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8) | |
611 | + $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8) + ' ' + | |
612 | + $filter('date')($scope.hojaRuta.fechaReparto, 'dd/MM/yyyy') + '-' + | |
613 | + $scope.hojaRuta.orden | |
611 | 614 | ); |
612 | 615 | |
613 | 616 | config(); |
... | ... | @@ -776,7 +779,9 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
776 | 779 | }; |
777 | 780 | |
778 | 781 | $scope.seleccionarRemitos = function () { |
782 | + | |
779 | 783 | if (eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; |
784 | + | |
780 | 785 | var modalInstance = $uibModal.open( |
781 | 786 | { |
782 | 787 | ariaLabelledBy: 'Busqueda de Remito', |
... | ... | @@ -827,7 +832,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
827 | 832 | })[0].checked = true; |
828 | 833 | |
829 | 834 | }, function (error) { |
830 | - error.then($scope.seleccionarRemitos); | |
835 | + $scope.seleccionarRemitos(); | |
831 | 836 | }); |
832 | 837 | }, function () { |
833 | 838 | // funcion ejecutada cuando se cancela el modal |
... | ... | @@ -851,7 +856,8 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
851 | 856 | resolve: { |
852 | 857 | idVehiculo: function () { return $scope.hojaRuta.vehiculo.id; }, |
853 | 858 | idRemito: function () { return idRemito; }, |
854 | - fechaReparto: function () { return $scope.hojaRuta.fechaReparto; } | |
859 | + fechaReparto: function () { return $scope.hojaRuta.fechaReparto;}, | |
860 | + orden: function() { return $scope.hojaRuta.orden } | |
855 | 861 | } |
856 | 862 | } |
857 | 863 | ); |
... | ... | @@ -962,13 +968,19 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
962 | 968 | }; |
963 | 969 | |
964 | 970 | $scope.mostrarDetalle = function (hojasRutas) { |
971 | + | |
965 | 972 | var modalInstance =$uibModal.open( |
966 | 973 | { |
967 | 974 | ariaLabelledBy: '', |
968 | 975 | templateUrl: 'modal-detalle-carga.html', |
969 | 976 | controller: 'focaModalDetalleController', |
970 | 977 | resolve: { |
971 | - hojasRutas: function () { return hojasRutas; } | |
978 | + parametrosModal: function () { | |
979 | + return { | |
980 | + hojasRutas: hojasRutas, | |
981 | + orden: $scope.hojaRuta.orden | |
982 | + } | |
983 | + } | |
972 | 984 | }, |
973 | 985 | size: 'lg', |
974 | 986 | backdrop: false |
... | ... | @@ -1034,6 +1046,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
1034 | 1046 | } |
1035 | 1047 | |
1036 | 1048 | function modalVehiculos(preCargados) { |
1049 | + | |
1037 | 1050 | var parametrosModal = {}; |
1038 | 1051 | if (preCargados) { |
1039 | 1052 | parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' + |
... | ... | @@ -1057,6 +1070,7 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
1057 | 1070 | nombre: 'Semi' |
1058 | 1071 | } |
1059 | 1072 | ]; |
1073 | + | |
1060 | 1074 | focaModalService.modal(parametrosModal).then(function (vehiculo) { |
1061 | 1075 | if (!preCargados && vehiculoEnUso(vehiculo)) return; |
1062 | 1076 | $scope.hojaRuta.vehiculo = vehiculo; |
... | ... | @@ -1095,6 +1109,13 @@ angular.module('focaCrearHojaRuta').controller('hojaRutaCtrl', |
1095 | 1109 | $scope.hojaRuta.remitosTabla = res.data; |
1096 | 1110 | }); |
1097 | 1111 | } |
1112 | + | |
1113 | + focaCrearHojaRutaService | |
1114 | + .getNumeroOrden(vehiculo.id, $scope.hojaRuta.fechaReparto) | |
1115 | + .then(function(res) { | |
1116 | + $scope.hojaRuta.orden = res.data; | |
1117 | + }); | |
1118 | + | |
1098 | 1119 | $scope.$broadcast('addCabecera', { |
1099 | 1120 | label: 'Tractor:', |
1100 | 1121 | valor: vehiculo.tractor |
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,14 @@ angular.module('focaCrearHojaRuta') |
247 | 247 | crearArticulosParaRemito: function(articuloRemito) { |
248 | 248 | return $http.post(route + '/articulos/remito', |
249 | 249 | {articuloRemito: articuloRemito}); |
250 | + }, | |
251 | + obtenerCisternasPorFecha: function(idVehiculo, fecha) { | |
252 | + return $http.post(route + '/cisterna/listar/fecha', | |
253 | + {idVehiculo: idVehiculo, fechaReparto: fecha}); | |
254 | + }, | |
255 | + getNumeroOrden: function(idVehiculo, fecha) { | |
256 | + return $http.get(route + '/hoja-ruta/obtener/numero-orden/' + | |
257 | + idVehiculo + '/' + fecha.toISOString().slice(0, 10)); | |
250 | 258 | } |
251 | 259 | }; |
252 | 260 | }]); |