Commit 41d9bb98c31d97d24dc93fc0abc3a13feb67da48
1 parent
512dca211f
Exists in
master
desarrollo
Showing
9 changed files
with
163 additions
and
75 deletions
Show diff stats
src/js/arrastrar.js
1 | function allowDrop(ev) { | 1 | function allowDrop(ev) { |
2 | ev.preventDefault(); | 2 | ev.preventDefault(); |
3 | } | 3 | } |
4 | function drag(ev, marcador) { | 4 | function drag(ev, marcador) { |
5 | marcador = JSON.stringify(marcador); | 5 | marcador = JSON.stringify(marcador); |
6 | ev.dataTransfer.setData('marcador', marcador); | 6 | ev.dataTransfer.setData('marcador', marcador); |
7 | var elementoDom = document.getElementById('test'); | 7 | var elementoDom = document.getElementById('scope'); |
8 | var scope = angular.element(elementoDom).scope(); | 8 | var scope = angular.element(elementoDom).scope(); |
9 | scope.arrastra(); | 9 | scope.arrastra(); |
10 | } | 10 | } |
11 | function drop(ev) { | 11 | function drop(ev) { |
12 | ev.preventDefault(); | 12 | ev.preventDefault(); |
13 | var data = ev.dataTransfer.getData('marcador'); | 13 | var data = ev.dataTransfer.getData('marcador'); |
14 | var elementoDom = document.getElementById(ev.target.id); | 14 | var elementoDom = document.getElementById(ev.target.id); |
15 | var elementoAngular = angular.element(elementoDom); | 15 | var elementoAngular = angular.element(elementoDom); |
16 | var elementoScope = elementoAngular.scope(); | 16 | var elementoScope = elementoAngular.scope(); |
17 | elementoScope.cargar(ev.target.id, data); | 17 | elementoScope.cargar(ev.target.id, data); |
18 | elementoScope.$digest(); | 18 | elementoScope.$digest(); |
19 | } | 19 | } |
20 | function dropEnd() { | 20 | function dropEnd() { |
21 | console.log('drop'); | 21 | var elementoDom = document.getElementById('scope'); |
22 | var elementoDom = document.getElementById('test'); | ||
23 | var scope = angular.element(elementoDom).scope(); | 22 | var scope = angular.element(elementoDom).scope(); |
24 | scope.noArrastra(); | 23 | scope.noArrastra(); |
25 | } | 24 | } |
26 | 25 |
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', | 3 | 'focaModalService', 'focaBotoneraLateralService', '$cookies', |
4 | function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter, | 4 | function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter, |
5 | focaModalService, focaBotoneraLateralService | 5 | focaModalService, focaBotoneraLateralService, $cookies |
6 | ) { | 6 | ) { |
7 | $scope.now = new Date(); | 7 | $scope.now = new Date(); |
8 | $scope.actividad = 'Logistica'; | 8 | $scope.actividad = 'Logistica'; |
9 | 9 | ||
10 | //Datos Pantalla | 10 | //Datos Pantalla |
11 | $scope.titulo = 'Logistica de Pedidos'; | 11 | $scope.titulo = 'Logistica de Pedidos'; |
12 | $scope.botonera = ['Vehiculo']; | 12 | $scope.botonera = ['Vehiculo']; |
13 | var cabecera = ''; | 13 | var cabecera = ''; |
14 | 14 | ||
15 | $scope.idUsuario = 0; | 15 | $scope.idVendedor = 0; |
16 | $scope.marcadores = []; | 16 | $scope.marcadores = []; |
17 | $scope.vehiculos = []; | 17 | $scope.vehiculos = []; |
18 | var idsRemitos = []; | ||
19 | getSeguimiento(); | 18 | getSeguimiento(); |
20 | $scope.arrastrando = false; | 19 | $scope.arrastrando = false; |
21 | $scope.general = function() { | 20 | $scope.general = function() { |
22 | $scope.idUsuario = 0; | 21 | $scope.idVendedor = 0; |
23 | getSeguimiento(); | 22 | getSeguimiento(); |
24 | }; | 23 | }; |
25 | 24 | ||
26 | //SETEO BOTONERA LATERAL | 25 | //SETEO BOTONERA LATERAL |
27 | focaBotoneraLateralService.showSalir(true); | 26 | focaBotoneraLateralService.showSalir(true); |
28 | focaBotoneraLateralService.showPausar(false); | 27 | focaBotoneraLateralService.showPausar(false); |
29 | focaBotoneraLateralService.showGuardar(false); | 28 | focaBotoneraLateralService.showGuardar(false); |
30 | 29 | ||
30 | |||
31 | $scope.general = function() { | 31 | $scope.general = function() { |
32 | $scope.idUsuario = 0; | 32 | $scope.idVendedor = 0; |
33 | getSeguimiento(); | 33 | getSeguimiento(); |
34 | $scope.$broadcast('removeCabecera', cabecera); | 34 | $scope.$broadcast('removeCabecera', cabecera); |
35 | $scope.$broadcast('addCabecera',{ | 35 | $scope.$broadcast('addCabecera',{ |
36 | label: 'General', | 36 | label: 'General', |
37 | valor: '' | 37 | valor: '' |
38 | }); | 38 | }); |
39 | }; | 39 | }; |
40 | 40 | ||
41 | $scope.cargar = function(idVehiculo, punto) { | 41 | $scope.cargar = function(idVehiculo, punto) { |
42 | var idRemito = JSON.parse(punto).notaPedido.remito.id; | 42 | var idRemito = JSON.parse(punto).notaPedido.remito.id; |
43 | var modalInstance = $uibModal.open( | 43 | var modalInstance = $uibModal.open( |
44 | { | 44 | { |
45 | ariaLabelledBy: 'Busqueda de Vehiculo', | 45 | ariaLabelledBy: 'Busqueda de Vehiculo', |
46 | templateUrl: 'foca-detalle-vehiculo.html', | 46 | templateUrl: 'foca-detalle-vehiculo.html', |
47 | controller: 'focaDetalleVehiculo', | 47 | controller: 'focaDetalleVehiculo', |
48 | size: 'lg', | 48 | size: 'lg', |
49 | resolve: { | 49 | resolve: { |
50 | idVehiculo: function() {return idVehiculo;}, | 50 | idVehiculo: function() {return idVehiculo;}, |
51 | idRemito: function() {return idRemito;} | 51 | idRemito: function() {return idRemito;} |
52 | } | 52 | } |
53 | } | 53 | } |
54 | ); | 54 | ); |
55 | modalInstance.result.then(function(idRemito) { | 55 | modalInstance.result.then(function() { |
56 | idsRemitos.push(idRemito); | ||
57 | }, function() { | 56 | }, function() { |
58 | }); | 57 | }); |
59 | }; | 58 | }; |
60 | 59 | ||
61 | $scope.quitarVehiculo = function(vehiculo) { | 60 | $scope.quitarVehiculo = function(vehiculo) { |
62 | focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + | 61 | focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + |
63 | vehiculo.codigo + '?').then(function() { | 62 | vehiculo.codigo + '?').then(function() { |
64 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | 63 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
65 | }); | 64 | }); |
66 | }; | 65 | }; |
67 | 66 | ||
68 | $scope.hacerHojaRuta = function(vehiculo) { | 67 | $scope.hacerHojaRuta = function(vehiculo) { |
69 | var modalInstance = $uibModal.open( | 68 | var modalInstance = $uibModal.open( |
70 | { | 69 | { |
71 | ariaLabelledBy: 'Creación hoja ruta', | 70 | ariaLabelledBy: 'Creación hoja ruta', |
72 | templateUrl: 'foca-modal-crear-hoja-ruta.html', | 71 | templateUrl: 'foca-modal-crear-hoja-ruta.html', |
73 | controller: 'focaModalCrearHojaRuta', | 72 | controller: 'focaModalCrearHojaRuta', |
74 | size: 'lg', | 73 | size: 'lg', |
75 | resolve: { | 74 | resolve: { |
76 | idVehiculo: function() {return vehiculo.id;}, | 75 | idVehiculo: function() {return vehiculo.id;} |
77 | idsRemitos: function() {return idsRemitos;} | ||
78 | } | 76 | } |
79 | } | 77 | } |
80 | ); | 78 | ); |
81 | modalInstance.result.then(function() { | 79 | modalInstance.result.then(function() { |
82 | 80 | ||
83 | }, function() { | 81 | }, function() { |
84 | //usar cuando se cancela el modal | 82 | //usar cuando se cancela el modal |
85 | }); | 83 | }); |
86 | }; | 84 | }; |
87 | 85 | ||
88 | $scope.arrastra = function() { | 86 | $scope.arrastra = function() { |
89 | $scope.arrastrando = true; | 87 | $scope.arrastrando = true; |
90 | $scope.$digest(); | 88 | $scope.$digest(); |
91 | }; | 89 | }; |
92 | 90 | ||
93 | $scope.noArrastra = function() { | 91 | $scope.noArrastra = function() { |
94 | $scope.arrastrando = false; | 92 | $scope.arrastrando = false; |
95 | $scope.$digest(); | 93 | $scope.$digest(); |
96 | }; | 94 | }; |
97 | 95 | ||
98 | $scope.individual = function() { | 96 | $scope.individual = function() { |
99 | $scope.idUsuario = -1; | 97 | $scope.idVendedor = -1; |
100 | }; | 98 | }; |
101 | 99 | ||
102 | $scope.mostrarDetalle = function() { | 100 | $scope.mostrarDetalle = function() { |
103 | $scope.detalle = true; | 101 | $scope.detalle = true; |
104 | }; | 102 | }; |
105 | 103 | ||
106 | $scope.salir = function() { | 104 | $scope.salir = function() { |
107 | $location.path('/'); | 105 | $location.path('/'); |
108 | }; | 106 | }; |
109 | 107 | ||
110 | $scope.search = function(key) { | 108 | $scope.search = function(key) { |
111 | if (key === 13) { | 109 | if (key === 13) { |
112 | $scope.idUsuario = $scope.idUsuarioInput; | 110 | $scope.idVendedor = $scope.idVendedorInput; |
113 | getSeguimiento(); | 111 | getSeguimiento(); |
114 | $scope.$broadcast('removeCabecera', 'General'); | 112 | $scope.$broadcast('removeCabecera', 'General'); |
115 | $scope.$broadcast('addCabecera', { | 113 | $scope.$broadcast('addCabecera', { |
116 | label: cabecera, | 114 | label: cabecera, |
117 | valor: $scope.idUsuarioInput | 115 | valor: $scope.idVendedorInput |
118 | }); | 116 | }); |
119 | } | 117 | } |
120 | }; | 118 | }; |
121 | 119 | ||
122 | $scope.fecha = function() { | 120 | $scope.fecha = function() { |
123 | getSeguimiento(); | 121 | getSeguimiento(); |
124 | }; | 122 | }; |
125 | 123 | ||
126 | $scope.seleccionarVehiculo = function() { | 124 | $scope.seleccionarVehiculo = function() { |
127 | var modalInstance = $uibModal.open( | 125 | var modalInstance = $uibModal.open( |
128 | { | 126 | { |
129 | ariaLabelledBy: 'Busqueda de Vehiculo', | 127 | ariaLabelledBy: 'Busqueda de Vehiculo', |
130 | templateUrl: 'modal-vehiculo.html', | 128 | templateUrl: 'modal-vehiculo.html', |
131 | controller: 'focaModalVehiculoController', | 129 | controller: 'focaModalVehiculoController', |
132 | size: 'lg' | 130 | size: 'lg' |
133 | } | 131 | } |
134 | ); | 132 | ); |
135 | 133 | ||
136 | modalInstance.result.then( | 134 | modalInstance.result.then( |
137 | function(vehiculo) { | 135 | function(vehiculo) { |
138 | var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); | 136 | var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); |
139 | if(existe.length) { | 137 | if(existe.length) { |
140 | focaModalService.alert('El vehiculo que intenta cargar ya ha sido cargado'); | 138 | focaModalService.alert('El vehiculo que intenta cargar ya ha sido cargado'); |
141 | return; | 139 | return; |
142 | } | 140 | } |
143 | if(!vehiculo.cisternas.length) { | 141 | if(!vehiculo.cisternas.length) { |
144 | focaModalService.alert('El vehiculo no tiene cisternas'); | 142 | focaModalService.alert('El vehiculo no tiene cisternas'); |
145 | return; | 143 | return; |
146 | } | 144 | } |
147 | $scope.vehiculos.push(vehiculo); | 145 | $scope.vehiculos.push(vehiculo); |
148 | }, function() { | 146 | }, function() { |
149 | // funcion ejecutada cuando se cancela el modal | 147 | // funcion ejecutada cuando se cancela el modal |
150 | } | 148 | } |
151 | ); | 149 | ); |
152 | }; | 150 | }; |
153 | 151 | ||
154 | function getSeguimiento() { | 152 | function getSeguimiento() { |
155 | var now = $scope.now; | 153 | var now = $scope.now; |
156 | var desde = new Date(new Date(now.setHours(0)).setMinutes(0)); | 154 | var desde = new Date(new Date(now.setHours(0)).setMinutes(0)); |
157 | desde = desde.setDate(desde.getDate() - 1); | 155 | desde = desde.setDate(desde.getDate() - 1); |
158 | desde = new Date(desde); | 156 | desde = new Date(desde); |
159 | var datos = { | 157 | var datos = { |
160 | actividad: $scope.actividad, | 158 | actividad: $scope.actividad, |
161 | idUsuario: $scope.idUsuario, | 159 | idUsuario: $scope.idVendedor, |
162 | fechaDesde: desde, | 160 | fechaDesde: desde, |
163 | fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)) | 161 | fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)) |
164 | }; | 162 | }; |
165 | 163 | ||
166 | $scope.datosBuscados = { | 164 | $scope.datosBuscados = { |
167 | actividad: $scope.actividad, | 165 | actividad: $scope.actividad, |
168 | individual: $scope.idUsuario !== 0 ? true : false | 166 | individual: $scope.idVendedor !== 0 ? true : false |
169 | }; | 167 | }; |
170 | 168 | ||
171 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { | 169 | focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { |
172 | $scope.marcadores = datos.data; | 170 | $scope.marcadores = datos.data; |
173 | }); | 171 | }); |
174 | } | 172 | } |
175 | } | 173 | } |
176 | ]); | 174 | ]); |
src/js/controllerDetalleVehiculo.js
1 | angular.module('focaLogisticaPedidoRuta') | 1 | angular.module('focaLogisticaPedidoRuta') |
2 | .controller('focaDetalleVehiculo', | 2 | .controller('focaDetalleVehiculo', |
3 | ['$scope', | 3 | ['$scope', |
4 | '$uibModalInstance', | 4 | '$uibModalInstance', |
5 | 'idVehiculo', | 5 | 'idVehiculo', |
6 | 'idRemito', | 6 | 'idRemito', |
7 | 'focaModalService', | 7 | 'focaModalService', |
8 | '$filter', | 8 | '$filter', |
9 | 'focaLogisticaPedidoRutaService', | 9 | 'focaLogisticaPedidoRutaService', |
10 | function($scope, $uibModalInstance, idVehiculo, idRemito, focaModalService, $filter, | 10 | function($scope, $uibModalInstance, idVehiculo, idRemito, focaModalService, $filter, |
11 | focaLogisticaPedidoRutaService | 11 | focaLogisticaPedidoRutaService |
12 | ) { | 12 | ) { |
13 | //seteo variables | 13 | //seteo variables |
14 | $scope.articulos = []; | 14 | $scope.articulos = []; |
15 | $scope.vehiculo = {}; | 15 | $scope.vehiculo = {}; |
16 | $scope.remito = {}; | 16 | $scope.remito = {}; |
17 | $scope.aCargar = []; | 17 | $scope.aCargar = []; |
18 | var cisternaMovimientos = []; | 18 | var cisternaMovimientos = []; |
19 | focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then( | 19 | focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then( |
20 | function(res) { | 20 | function(res) { |
21 | $scope.vehiculo = res.data; | 21 | $scope.vehiculo = res.data; |
22 | } | 22 | } |
23 | ); | 23 | ); |
24 | focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito).then( | 24 | focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito).then( |
25 | function(res) { | 25 | function(res) { |
26 | $scope.remito = res.data; | 26 | $scope.remito = res.data; |
27 | if($scope.remito.idUsuarioProceso !== focaLogisticaPedidoRutaService.idUsuario) | ||
28 | { | ||
29 | focaModalService.alert('El remito esta siendo cargado por otro usario'); | ||
30 | $uibModalInstance.close(); | ||
31 | } | ||
27 | $scope.articulos = res.data.articulosRemito; | 32 | $scope.articulos = res.data.articulosRemito; |
28 | } | 33 | } |
29 | ); | 34 | ); |
30 | $scope.aceptar = function() { | 35 | $scope.aceptar = function() { |
31 | $scope.cargando = true; | 36 | $scope.cargando = true; |
32 | var cisternaCargas = []; | 37 | var cisternaCargas = []; |
33 | for (var i = 0; i < $scope.vehiculo.cisternas.length; i++) { | 38 | for (var i = 0; i < $scope.vehiculo.cisternas.length; i++) { |
34 | delete $scope.vehiculo.cisternas[i].cisternaCarga.articulo; | 39 | delete $scope.vehiculo.cisternas[i].cisternaCarga.articulo; |
35 | cisternaCargas.push($scope.vehiculo.cisternas[i].cisternaCarga); | 40 | cisternaCargas.push($scope.vehiculo.cisternas[i].cisternaCarga); |
36 | } | 41 | } |
37 | var cisterna = { | 42 | var cisterna = { |
38 | cisternaMovimientos: cisternaMovimientos, | 43 | cisternaMovimientos: cisternaMovimientos, |
39 | cisternaCargas: cisternaCargas | 44 | cisternaCargas: cisternaCargas, |
45 | idVehiculo: $scope.vehiculo.id | ||
40 | }; | 46 | }; |
41 | focaLogisticaPedidoRutaService.guardarCisternas(cisterna).then(function() { | 47 | focaLogisticaPedidoRutaService.guardarCisternas(cisterna, $scope.remito.id) |
42 | focaModalService.alert('Cisternas cargadas con éxito').then(function() { | 48 | .then(function() { |
49 | focaModalService.alert('Cisternas cargadas con éxito').then(function() { | ||
50 | $scope.cargando = false; | ||
51 | $uibModalInstance.close(); | ||
52 | }); | ||
53 | }).catch(function(error) { | ||
43 | $scope.cargando = false; | 54 | $scope.cargando = false; |
44 | $uibModalInstance.close(idRemito); | 55 | $uibModalInstance.close(); |
45 | }); | 56 | if (error.status === 403.1) { |
57 | focaModalService.alert('ERROR: El vehículo esta en uso'); | ||
58 | } | ||
59 | if(error.status === 403.2) { | ||
60 | focaModalService.alert('ERROR: Otro usario ya cargó este remito'); | ||
61 | return; | ||
62 | } | ||
63 | focaModalService.alert('Hubo un error al cargar las cisternas'); | ||
46 | }); | 64 | }); |
47 | }; | 65 | }; |
48 | 66 | ||
49 | $scope.cancelar = function() { | 67 | $scope.cancelar = function() { |
50 | $uibModalInstance.close(); | 68 | $uibModalInstance.close(); |
51 | }; | 69 | }; |
52 | 70 | ||
53 | $scope.cargarACisternas = function(vehiculo) { | 71 | $scope.cargarACisternas = function(vehiculo) { |
54 | for(var i = 0; i < vehiculo.cisternas.length; i++) { | 72 | for(var i = 0; i < vehiculo.cisternas.length; i++) { |
55 | var cisterna = vehiculo.cisternas[i]; | 73 | var cisterna = vehiculo.cisternas[i]; |
56 | var aCargar = parseFloat($scope.aCargar[i]); | 74 | var aCargar = parseFloat($scope.aCargar[i]); |
57 | //validaciones | 75 | //validaciones |
58 | if(!aCargar) { | 76 | if(!aCargar) { |
59 | continue; | 77 | continue; |
60 | } | 78 | } |
61 | if(aCargar > cisterna.disponible) { | 79 | if(aCargar > cisterna.disponible) { |
62 | focaModalService.alert('La cantidad cargada supera la capacidad de la' + | 80 | focaModalService.alert('La cantidad cargada supera la capacidad de la' + |
63 | 'cisterna ' + cisterna.codigo); | 81 | 'cisterna ' + cisterna.codigo); |
64 | return; | 82 | return; |
65 | } | 83 | } |
66 | //cargar | 84 | //cargar |
67 | if(cisterna.cisternaCarga.cantidad) { | 85 | if(cisterna.cisternaCarga.cantidad) { |
68 | cisterna.cisternaCarga.cantidad += aCargar; | 86 | cisterna.cisternaCarga.cantidad += aCargar; |
69 | }else { | 87 | }else { |
70 | cisterna.cisternaCarga.cantidad = aCargar; | 88 | cisterna.cisternaCarga.cantidad = aCargar; |
71 | cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo; | 89 | cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo; |
72 | } | 90 | } |
73 | cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad; | 91 | cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad; |
74 | 92 | ||
75 | cisterna.cisternaCarga.articulo = { | 93 | cisterna.cisternaCarga.articulo = { |
76 | DetArt: $scope.articuloSeleccionado.descripcion | 94 | DetArt: $scope.articuloSeleccionado.descripcion |
77 | }; | 95 | }; |
78 | $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0] | 96 | $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0] |
79 | .cargado = true; | 97 | .cargado = true; |
80 | 98 | ||
81 | $scope.calcularPorcentaje(cisterna); | 99 | $scope.calcularPorcentaje(cisterna); |
82 | //Guardar | 100 | //Guardar |
83 | var now = new Date(); | 101 | var now = new Date(); |
84 | var cisternaMovimiento = { | 102 | var cisternaMovimiento = { |
85 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), | 103 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), |
86 | cantidad: aCargar, | 104 | cantidad: aCargar, |
87 | metodo: 'carga', | 105 | metodo: 'carga', |
88 | idCisternaCarga: cisterna.cisternaCarga.id | 106 | idCisternaCarga: cisterna.cisternaCarga.id, |
107 | idRemito: $scope.remito.id | ||
89 | }; | 108 | }; |
90 | cisternaMovimientos.push(cisternaMovimiento); | 109 | cisternaMovimientos.push(cisternaMovimiento); |
91 | } | 110 | } |
92 | var articuloSiguiente = $scope.articulos.filter( | 111 | var articuloSiguiente = $scope.articulos.filter( |
93 | function(filter) { | 112 | function(filter) { |
94 | return filter.cargado !== true; | 113 | return filter.cargado !== true; |
95 | } | 114 | } |
96 | ); | 115 | ); |
97 | if(articuloSiguiente.length > 0) { | 116 | if(articuloSiguiente.length > 0) { |
98 | $scope.cambioArticulo(articuloSiguiente[0]); | 117 | $scope.cambioArticulo(articuloSiguiente[0]); |
99 | } | 118 | } |
100 | $scope.aCargar = []; | 119 | $scope.aCargar = []; |
101 | }; | 120 | }; |
102 | $scope.calcularPorcentaje = function(cisterna) { | 121 | $scope.calcularPorcentaje = function(cisterna) { |
103 | if(!cisterna.cisternaCarga.cantidad) { | 122 | if(!cisterna.cisternaCarga.cantidad) { |
104 | cisterna.cisternaCarga.cantidad = 0; | 123 | cisterna.cisternaCarga.cantidad = 0; |
105 | } | 124 | } |
106 | var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / | 125 | var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / |
107 | cisterna.capacidad) + '%'; | 126 | cisterna.capacidad) + '%'; |
108 | var elementHtml = document.getElementById(cisterna.id); | 127 | var elementHtml = document.getElementById(cisterna.id); |
109 | if(elementHtml) { | 128 | if(elementHtml) { |
110 | elementHtml.style.width = porcentaje; | 129 | elementHtml.style.width = porcentaje; |
111 | } | 130 | } |
112 | }; | 131 | }; |
113 | $scope.cambioArticulo = function(articulo) { | 132 | $scope.cambioArticulo = function(articulo) { |
114 | articulo.checked = true; | 133 | articulo.checked = true; |
115 | $scope.articuloSeleccionado = articulo; | 134 | $scope.articuloSeleccionado = articulo; |
116 | }; | 135 | }; |
117 | $scope.actualizarArticulo = function () { | 136 | $scope.actualizarArticulo = function () { |
118 | $scope.articuloSeleccionado.cantidadCargada = 0; | 137 | $scope.articuloSeleccionado.cantidadCargada = 0; |
119 | for (var i = 0; i < $scope.aCargar.length; i++) { | 138 | for (var i = 0; i < $scope.aCargar.length; i++) { |
120 | $scope.articuloSeleccionado.cantidadCargada += | 139 | $scope.articuloSeleccionado.cantidadCargada += |
121 | parseFloat($scope.aCargar[i]) || 0; | 140 | parseFloat($scope.aCargar[i]) || 0; |
122 | } | 141 | } |
123 | }; | 142 | }; |
124 | $scope.tieneArticulosPendientes = function() { | 143 | $scope.tieneArticulosPendientes = function() { |
125 | var articulosDescargados = $scope.articulos.filter(function(filter) { | 144 | var articulosDescargados = $scope.articulos.filter(function(filter) { |
126 | return filter.cargado === true; | 145 | return filter.cargado === true; |
127 | }); | 146 | }); |
128 | if(articulosDescargados.length === $scope.articulos.length) { | 147 | if(articulosDescargados.length === $scope.articulos.length) { |
129 | return false; | 148 | return false; |
130 | } | 149 | } |
131 | return true; | 150 | return true; |
132 | }; | 151 | }; |
133 | }]); | 152 | }]); |
134 | 153 |
src/js/controllerHojaRuta.js
1 | angular.module('focaLogisticaPedidoRuta') | 1 | angular.module('focaLogisticaPedidoRuta') |
2 | .controller('focaModalCrearHojaRuta', [ | 2 | .controller('focaModalCrearHojaRuta', [ |
3 | '$scope', | 3 | '$scope', |
4 | '$uibModalInstance', | 4 | '$uibModalInstance', |
5 | '$uibModal', | 5 | '$uibModal', |
6 | 'focaLogisticaPedidoRutaService', | 6 | 'focaLogisticaPedidoRutaService', |
7 | 'idVehiculo', | 7 | 'idVehiculo', |
8 | 'idsRemitos', | 8 | 'focaModalService', |
9 | '$filter', | ||
9 | function($scope, $uibModalInstance, $uibModal, focaLogisticaPedidoRutaService, | 10 | function($scope, $uibModalInstance, $uibModal, focaLogisticaPedidoRutaService, |
10 | idVehiculo, idsRemitos) { | 11 | idVehiculo, focaModalService, $filter) { |
11 | $scope.vehiculo = {}; | 12 | $scope.vehiculo = {}; |
12 | $scope.remitos = []; | 13 | $scope.remitos = []; |
14 | $scope.now = new Date(); | ||
13 | focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then(function(res) { | 15 | focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then(function(res) { |
14 | $scope.vehiculo = res.data; | 16 | $scope.vehiculo = res.data; |
15 | }); | 17 | }); |
16 | for (var i = 0; i < idsRemitos.length; i++) { | 18 | //TODO: refactor código esta rre feo |
17 | focaLogisticaPedidoRutaService.obtenerRemitoById(idsRemitos[i]) | 19 | focaLogisticaPedidoRutaService.getRemitos(idVehiculo).then(function(res) { |
18 | .then(cargarRemito); | 20 | for (var i = 0; i < res.data.cisternas.length; i++) { |
19 | } | 21 | for (var j = 0; j < res.data.cisternas[i].cisternaCarga.cisternaMovimientos.length; |
20 | function cargarRemito(res) { | 22 | j++) { |
21 | $scope.remitos.push(res.data); | 23 | if(!!res.data.cisternas[i].cisternaCarga.cisternaMovimientos[j].remito && |
22 | } | 24 | !res.data.cisternas[i].cisternaCarga.cisternaMovimientos[j].remito |
25 | .idHojaRuta) { | ||
26 | var remito = res.data.cisternas[i].cisternaCarga | ||
27 | .cisternaMovimientos[j].remito; | ||
28 | var yaEstaCargado = $filter('filter')($scope.remitos, {id: remito.id}); | ||
29 | if(!yaEstaCargado.length && | ||
30 | res.data.cisternas[i].cisternaCarga.cisternaMovimientos[j].metodo === | ||
31 | 'carga') { | ||
32 | $scope.remitos.push(remito); | ||
33 | } | ||
34 | } | ||
35 | } | ||
36 | } | ||
37 | }); | ||
23 | focaLogisticaPedidoRutaService.numeroHojaRuta().then(function(res) { | 38 | focaLogisticaPedidoRutaService.numeroHojaRuta().then(function(res) { |
24 | $scope.sucursal = res.data.sucursal; | 39 | $scope.sucursal = res.data.sucursal; |
25 | $scope.numero = res.data.numeroHojaRuta; | 40 | $scope.numero = res.data.numeroHojaRuta; |
26 | }); | 41 | }); |
27 | $scope.cancelar = function() { | 42 | $scope.cancelar = function() { |
28 | $uibModalInstance.close(); | 43 | $uibModalInstance.close(); |
29 | }; | 44 | }; |
30 | $scope.aceptar = function() { | 45 | $scope.aceptar = function() { |
31 | $uibModalInstance.close(); | 46 | var save = { |
47 | hojaRuta: { | ||
48 | id: 0, | ||
49 | fechaCreacion: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | ||
50 | idTransportista: $scope.vehiculo.idTransportista, | ||
51 | idChofer: $scope.chofer.id, | ||
52 | idVehiculo: $scope.vehiculo.id, | ||
53 | tarifaFlete: $scope.tarifaFlete | ||
54 | }, | ||
55 | remitos: $scope.remitos, | ||
56 | idVehiculo: $scope.vehiculo.id | ||
57 | }; | ||
58 | focaLogisticaPedidoRutaService.crearHojaRuta(save).then(function() { | ||
59 | $uibModalInstance.close(); | ||
60 | focaModalService.alert('Hoja de ruta guardada con éxito'); | ||
61 | }); | ||
32 | }; | 62 | }; |
33 | $scope.seleccionarChofer = function() { | 63 | $scope.seleccionarChofer = function() { |
34 | var modalInstance = $uibModal.open( | 64 | var modalInstance = $uibModal.open( |
35 | { | 65 | { |
36 | ariaLabelledBy: 'Busqueda de Chofer', | 66 | ariaLabelledBy: 'Busqueda de Chofer', |
37 | templateUrl: 'modal-chofer.html', | 67 | templateUrl: 'modal-chofer.html', |
38 | controller: 'focaModalChoferController', | 68 | controller: 'focaModalChoferController', |
39 | size: 'lg' | 69 | size: 'lg' |
40 | } | 70 | } |
41 | ); | 71 | ); |
42 | 72 | ||
43 | modalInstance.result.then( | 73 | modalInstance.result.then( |
44 | function(chofer) { | 74 | function(chofer) { |
45 | $scope.chofer = chofer; | 75 | $scope.chofer = chofer; |
46 | }, function() { | 76 | }, function() { |
47 | // funcion ejecutada cuando se cancela el modal | 77 | // funcion ejecutada cuando se cancela el modal |
48 | } | 78 | } |
49 | ); | 79 | ); |
50 | }; | 80 | }; |
51 | }]); | 81 | }]); |
52 | 82 |
src/js/osm-directive.js
1 | angular.module('focaLogisticaPedidoRuta').directive('foca', function() { | 1 | angular.module('focaLogisticaPedidoRuta').directive('focaLogistica', function() { |
2 | return { | 2 | return { |
3 | restrict: 'E', | 3 | restrict: 'E', |
4 | link: function(scope, el, attrs) { | 4 | link: function(scope, el, attrs) { |
5 | var contenedor = document.createElement('div'); | 5 | var contenedor = document.createElement('div'); |
6 | el.append(contenedor); | 6 | el.append(contenedor); |
7 | scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom); | 7 | scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom); |
8 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); | 8 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); |
9 | }, | 9 | }, |
10 | controller: ['$scope', '$filter', function($scope, $filter) { | 10 | controller: ['$scope', '$filter', function($scope, $filter) { |
11 | $scope.markers = []; | 11 | $scope.markers = []; |
12 | $scope.$watch('marcadores', function() { | 12 | $scope.$watch('marcadores', function() { |
13 | for(var i in $scope.markers) { | 13 | for(var i in $scope.markers) { |
14 | $scope.map.removeLayer($scope.markers[i]); | 14 | $scope.map.removeLayer($scope.markers[i]); |
15 | } | 15 | } |
16 | $scope.markers = []; | 16 | $scope.markers = []; |
17 | 17 | ||
18 | angular.forEach($scope.marcadores, function(marcador) { | 18 | angular.forEach($scope.marcadores, function(marcador) { |
19 | var observacion = | 19 | var observacion = |
20 | 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' + | 20 | 'Vendedor: ' + marcador.notaPedido.idVendedor + ' - ' + |
21 | ( | 21 | ( |
22 | marcador.notaPedido.vendedor ? | 22 | marcador.notaPedido.vendedor ? |
23 | marcador.notaPedido.vendedor.NomVen : | 23 | marcador.notaPedido.vendedor.NomVen : |
24 | '' | 24 | '' |
25 | ) + '<br/>'; | 25 | ) + '<br/>'; |
26 | observacion += 'Fecha: ' + | 26 | observacion += 'Fecha: ' + |
27 | $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + | 27 | $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') + ' ' + |
28 | marcador.fecha.slice(11,19) + '<br/>'; | 28 | marcador.fecha.slice(11,19) + '<br/>'; |
29 | observacion += 'Nº: ' + $filter('comprobante')([ | 29 | observacion += 'Nº: ' + $filter('comprobante')([ |
30 | marcador.notaPedido.sucursal, | 30 | marcador.notaPedido.remito.sucursal, |
31 | marcador.notaPedido.numeroNotaPedido | 31 | marcador.notaPedido.remito.numeroRemito |
32 | ]) + '<br/>'; | 32 | ]) + '<br/>'; |
33 | observacion += 'Cliente: ' + | 33 | observacion += 'Cliente: ' + |
34 | marcador.notaPedido.cliente.NOM + '<br/>'; | 34 | marcador.notaPedido.cliente.NOM + '<br/>'; |
35 | 35 | ||
36 | if($scope.parametros.individual) { | 36 | if($scope.parametros.individual) { |
37 | observacion += | 37 | observacion += |
38 | 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$'); | 38 | 'Total: ' + $filter('currency')(marcador.notaPedido.total, '$'); |
39 | observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion; | 39 | observacion = 'Orden: ' + marcador.orden + '<br/>' + observacion; |
40 | 40 | ||
41 | if(marcador.distancia) { | 41 | if(marcador.distancia) { |
42 | observacion += '<br/>Distancia a casa central: ' + | 42 | observacion += '<br/>Distancia a casa central: ' + |
43 | marcador.distancia + 'km'; | 43 | marcador.distancia + 'km'; |
44 | } | 44 | } |
45 | }else { | 45 | }else { |
46 | observacion += 'Cantidad de nota de pedido: ' + | 46 | observacion += 'Cantidad de nota de remitos: ' + |
47 | marcador.cantidad + '<br/>'; | 47 | marcador.cantidad + '<br/>'; |
48 | observacion += 'Total Vendido: ' + | 48 | observacion += 'Total Vendido: ' + |
49 | $filter('currency')(marcador.total, '$'); | 49 | $filter('currency')(marcador.total, '$'); |
50 | } | 50 | } |
51 | observacion += '<br/>'; | 51 | observacion += '<br/>'; |
52 | observacion += '<i class="fa fa-map-marker fa-3x" aria-hidden="true"'+ | 52 | observacion += '<i class="fa fa-map-marker fa-3x" aria-hidden="true"'+ |
53 | 'class="form-control" ondragend="dropEnd()" ondragstart=\'drag(event, '+ | 53 | 'class="form-control" ondragend="dropEnd()" ondragstart=\'drag(event, '+ |
54 | JSON.stringify(marcador)+')\' draggable="true"></i>(Arrastrar icono)'; | 54 | JSON.stringify(marcador)+')\' draggable="true"></i>(Arrastrar icono)'; |
55 | var icon; | ||
56 | if(marcador.notaPedido.remito.idUsuarioProceso) { | ||
57 | //Asignado AZUL | ||
58 | icon = new L.Icon({ | ||
59 | iconUrl: 'img/marker-icon-2x-blue.png', | ||
60 | shadowUrl: 'img/marker-shadow.png', | ||
61 | iconSize: [25, 41], | ||
62 | iconAnchor: [12, 41], | ||
63 | popupAnchor: [1, -34], | ||
64 | shadowSize: [41, 41] | ||
65 | }); | ||
66 | }else { | ||
67 | //Sin asignar ROJO | ||
68 | icon = new L.Icon({ | ||
69 | iconUrl: 'img/marker-icon-2x-red.png', | ||
70 | shadowUrl: 'img/marker-shadow.png', | ||
71 | iconSize: [25, 41], | ||
72 | iconAnchor: [12, 41], | ||
73 | popupAnchor: [1, -34], | ||
74 | shadowSize: [41, 41] | ||
75 | }); | ||
76 | } | ||
55 | $scope.markers.push( | 77 | $scope.markers.push( |
56 | L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map) | 78 | L.marker([marcador.latitud, marcador.longitud], {icon: icon}) |
79 | .addTo($scope.map) | ||
57 | .bindPopup(observacion) | 80 | .bindPopup(observacion) |
58 | ); | 81 | ); |
59 | 82 | ||
60 | $scope.markers[0].openPopup(); | 83 | $scope.markers[0].openPopup(); |
61 | }); | 84 | }); |
62 | }); | 85 | }); |
63 | }], | 86 | }], |
64 | scope: { | 87 | scope: { |
65 | latitud: '=', | 88 | latitud: '=', |
66 | longitud: '=', | 89 | longitud: '=', |
67 | zoom: '=', | 90 | zoom: '=', |
68 | marcadores: '=', | 91 | marcadores: '=', |
69 | parametros: '=' | 92 | parametros: '=' |
70 | } | 93 | } |
71 | }; | 94 | }; |
72 | }); | 95 | }); |
73 | 96 |
src/js/service.js
1 | angular.module('focaLogisticaPedidoRuta') | 1 | angular.module('focaLogisticaPedidoRuta') |
2 | .service( | 2 | .service( |
3 | 'focaLogisticaPedidoRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT | 3 | 'focaLogisticaPedidoRutaService', [ |
4 | ) { | 4 | '$http', |
5 | return { | 5 | '$cookies', |
6 | obtenerActividad: function(parametros) { | 6 | 'API_ENDPOINT', |
7 | return $http.post(API_ENDPOINT.URL + '/seguimiento/filtros', parametros); | 7 | function($http, $cookies, API_ENDPOINT) { |
8 | }, | 8 | return { |
9 | obtenerVehiculoById: function(idVehiculo) { | 9 | idUsuario: $cookies.get('idUsuario'), |
10 | return $http.get(API_ENDPOINT.URL + '/vehiculo/' + idVehiculo); | 10 | obtenerActividad: function(parametros) { |
11 | }, | 11 | return $http.post(API_ENDPOINT.URL + '/seguimiento/filtros', parametros); |
12 | obtenerRemitoById: function(idRemito) { | 12 | }, |
13 | return $http.get(API_ENDPOINT.URL + '/remito/obtener/' + idRemito); | 13 | obtenerVehiculoById: function(idVehiculo) { |
14 | }, | 14 | return $http.get(API_ENDPOINT.URL + '/vehiculo/' + idVehiculo); |
15 | guardarCisternas: function(cisterna) { | 15 | }, |
16 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar/cargar', cisterna); | 16 | obtenerRemitoById: function(idRemito) { |
17 | }, | 17 | return $http.get(API_ENDPOINT.URL + '/remito/obtener/' + idRemito); |
18 | numeroHojaRuta: function() { | 18 | }, |
19 | return $http.get(API_ENDPOINT.URL + '/hoja-ruta/numero-siguiente'); | 19 | guardarCisternas: function(cisterna, idRemito) { |
20 | } | 20 | return $http.post(API_ENDPOINT.URL + '/cisterna/guardar/cargar/' + |
21 | }; | 21 | this.idUsuario + '/' + idRemito,cisterna); |
22 | }, | ||
23 | numeroHojaRuta: function() { | ||
24 | return $http.get(API_ENDPOINT.URL + '/hoja-ruta/numero-siguiente'); | ||
25 | }, | ||
26 | getRemitos: function(idVehiculo) { | ||
27 | return $http.get(API_ENDPOINT.URL + '/remito/sin-hoja-ruta/' +idVehiculo); | ||
28 | }, | ||
29 | crearHojaRuta: function(hojaRuta) { | ||
30 | return $http.post(API_ENDPOINT.URL + '/hoja-ruta', hojaRuta); | ||
31 | } | ||
32 | }; | ||
22 | }]); | 33 | }]); |
23 | 34 |
src/views/foca-detalle-vehiculo.html
1 | <div class="modal-header"> | 1 | <div class="modal-header"> |
2 | <h4>Detalle de carga</h4> | 2 | <h4>Detalle de carga</h4> |
3 | Vehículo <strong ng-bind="vehiculo.tractor"></strong> | 3 | Vehículo <strong ng-bind="vehiculo.tractor"></strong> |
4 | Transportista <strong ng-bind="vehiculo.transportista.NOM"></strong> | 4 | Transportista <strong ng-bind="vehiculo.transportista.NOM"></strong> |
5 | <br> | 5 | <br> |
6 | Remito Nº | 6 | Remito Nº |
7 | <strong ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></strong> | 7 | <strong ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></strong> |
8 | , Cliente | 8 | , Cliente |
9 | <strong ng-bind="remito.nombreCliente"></strong> | 9 | <strong ng-bind="remito.nombreCliente"></strong> |
10 | , Domicilio | 10 | , Domicilio |
11 | <strong ng-bind="remito.domicilioStamp"></strong> | 11 | <strong ng-bind="remito.domicilioStamp"></strong> |
12 | </div> | 12 | </div> |
13 | <div class="modal-body"> | 13 | <div class="modal-body"> |
14 | <div> | 14 | <div> |
15 | <table class="table table-sm"> | 15 | <table class="table table-sm"> |
16 | <thead> | 16 | <thead> |
17 | <tr> | 17 | <tr> |
18 | <th></th> | 18 | <th></th> |
19 | <th>Articulo</th> | 19 | <th>Articulo</th> |
20 | <th>Total</th> | 20 | <th>Total</th> |
21 | <th>Cargado</th> | 21 | <th>Cargado</th> |
22 | <th>Pendiente</th> | 22 | <th>Pendiente</th> |
23 | </tr> | 23 | </tr> |
24 | </thead> | 24 | </thead> |
25 | <tbody> | 25 | <tbody> |
26 | <tr ng-repeat="(key, articulo) in articulos"> | 26 | <tr ng-repeat="(key, articulo) in articulos"> |
27 | <td><input | 27 | <td><input |
28 | type="radio" | 28 | type="radio" |
29 | name="articuloRadio" | 29 | name="articuloRadio" |
30 | id="{{articulo.id}}" | 30 | id="{{articulo.id}}" |
31 | ng-checked="articulo.checked" | 31 | ng-checked="articulo.checked" |
32 | ng-disabled="articulo.cargado" | 32 | ng-disabled="articulo.cargado" |
33 | ng-click="cambioArticulo(articulo)" | 33 | ng-click="cambioArticulo(articulo)" |
34 | ></td> | 34 | ></td> |
35 | <td ng-bind="articulo.descripcion"></td> | 35 | <td ng-bind="articulo.descripcion"></td> |
36 | <td ng-bind="articulo.cantidad"></td> | 36 | <td ng-bind="articulo.cantidad"></td> |
37 | <td ng-bind="articulo.cantidadCargada || 0"></td> | 37 | <td ng-bind="articulo.cantidadCargada || 0"></td> |
38 | <td ng-bind="articulo.cantidad - articulo.cantidadCargada"></td> | 38 | <td ng-bind="articulo.cantidad - articulo.cantidadCargada"></td> |
39 | </tr> | 39 | </tr> |
40 | </tbody> | 40 | </tbody> |
41 | </table> | 41 | </table> |
42 | <table class="table table-sm"> | 42 | <table class="table table-sm"> |
43 | <thead> | 43 | <thead> |
44 | <tr> | 44 | <tr> |
45 | <th>Cisterna</th> | 45 | <th>Cisterna</th> |
46 | <th>Cantidad asignada</th> | 46 | <th>Cantidad asignada</th> |
47 | <th>Estado</th> | 47 | <th>Estado</th> |
48 | <th>Articulo cargado</th> | 48 | <th>Articulo cargado</th> |
49 | </tr> | 49 | </tr> |
50 | </thead> | 50 | </thead> |
51 | <tbody> | 51 | <tbody> |
52 | <tr ng-repeat="(key, cisterna) in vehiculo.cisternas"> | 52 | <tr ng-repeat="(key, cisterna) in vehiculo.cisternas"> |
53 | <td ng-bind="cisterna.codigo"></td> | 53 | <td ng-bind="cisterna.codigo"></td> |
54 | <td><input | 54 | <td><input |
55 | class="form-control" | 55 | class="form-control" |
56 | foca-tipo-input | 56 | foca-tipo-input |
57 | foca-teclado | 57 | foca-teclado |
58 | placeholder="A cargar..." | 58 | placeholder="A cargar..." |
59 | ng-model="aCargar[key]" | 59 | ng-model="aCargar[key]" |
60 | ng-disabled="(articuloSeleccionado.idArticulo !== cisterna.cisternaCarga.idProducto && | 60 | ng-disabled="(articuloSeleccionado.idArticulo !== cisterna.cisternaCarga.idProducto && |
61 | cisterna.cisternaCarga.idProducto) || !tieneArticulosPendientes()" | 61 | cisterna.cisternaCarga.idProducto) || !tieneArticulosPendientes() |
62 | || articuloSeleccionado.cantidad > cisterna.disponible" | ||
62 | ng-change="actualizarArticulo()" | 63 | ng-change="actualizarArticulo()" |
63 | > | 64 | > |
64 | </td> | 65 | </td> |
65 | <td colspan="2"><div class="progress foca-alto-progress pl-0 pr-0 mt-1"> | 66 | <td colspan="2"><div class="progress foca-alto-progress pl-0 pr-0 mt-1"> |
66 | <strong | 67 | <strong |
67 | class="mt-2 col-3 text-center position-absolute" | 68 | class="mt-2 col-3 text-center position-absolute" |
68 | ng-bind="(cisterna.cisternaCarga.cantidad || 0) + '/' + (cisterna.capacidad)"> | 69 | ng-bind="(cisterna.cisternaCarga.cantidad || 0) + '/' + (cisterna.capacidad)"> |
69 | </strong> | 70 | </strong> |
70 | <div | 71 | <div |
71 | id="{{cisterna.id}}" | 72 | id="{{cisterna.id}}" |
72 | class="progress-bar" | 73 | class="progress-bar" |
73 | role="progressbar" | 74 | role="progressbar" |
74 | aria-valuemin="0" | 75 | aria-valuemin="0" |
75 | aria-valuemax="{{cisterna.capacidad}}" | 76 | aria-valuemax="{{cisterna.capacidad}}" |
76 | ng-style="{'width':'{{calcularPorcentaje(cisterna)}}'}"> | 77 | ng-style="{'width':'{{calcularPorcentaje(cisterna)}}'}"> |
77 | </div> | 78 | </div> |
78 | </div> | 79 | </div> |
79 | </td> | 80 | </td> |
80 | <td ng-bind="cisterna.cisternaCarga.articulo.DetArt || 'Sin articulo'"></td> | 81 | <td ng-bind="cisterna.cisternaCarga.articulo.DetArt || 'Sin articulo'"></td> |
81 | </tr> | 82 | </tr> |
82 | </tbody> | 83 | </tbody> |
83 | </table> | 84 | </table> |
84 | <div class="col-12 aling-end"> | 85 | <div class="col-12 aling-end"> |
85 | <button | 86 | <button |
86 | class="form-control btn btn-success" | 87 | class="form-control btn btn-success" |
87 | ladda="cargando" | 88 | ladda="cargando" |
88 | data-spinner-color="#FF0000" | 89 | data-spinner-color="#FF0000" |
89 | type="button" | 90 | type="button" |
90 | ng-disabled="!articuloSeleccionado || articuloSeleccionado.cantidad - | 91 | ng-disabled="!articuloSeleccionado || articuloSeleccionado.cantidad - |
91 | articuloSeleccionado.cantidadCargada !== 0 || !tieneArticulosPendientes()" | 92 | articuloSeleccionado.cantidadCargada !== 0 || !tieneArticulosPendientes()" |
92 | ng-class="{'btn-light': !articuloSeleccionado || articuloSeleccionado.cantidad - | 93 | ng-class="{'btn-light': !articuloSeleccionado || articuloSeleccionado.cantidad - |
93 | articuloSeleccionado.cantidadCargada !== 0 || !tieneArticulosPendientes()}" | 94 | articuloSeleccionado.cantidadCargada !== 0 || !tieneArticulosPendientes()}" |
94 | ng-click="cargarACisternas(vehiculo)"> | 95 | ng-click="cargarACisternas(vehiculo)"> |
95 | Aplicar distribución de cargas | 96 | Aplicar distribución de cargas |
96 | </button> | 97 | </button> |
97 | </div> | 98 | </div> |
98 | </div> | 99 | </div> |
99 | </div> | 100 | </div> |
100 | <div class="modal-footer py-1"> | 101 | <div class="modal-footer py-1"> |
101 | <button | 102 | <button |
102 | class="btn btn-sm btn-secondary" | 103 | class="btn btn-sm btn-secondary" |
103 | ladda="cargando" | 104 | ladda="cargando" |
104 | type="button" | 105 | type="button" |
105 | ng-click="cancelar()">Cancelar</button> | 106 | ng-click="cancelar()">Cancelar</button> |
106 | <button | 107 | <button |
107 | class="btn btn-sm btn-primary" | 108 | class="btn btn-sm btn-primary" |
108 | ladda="cargando" | 109 | ladda="cargando" |
109 | type="button" | 110 | type="button" |
110 | ng-click="aceptar()" | 111 | ng-click="aceptar()" |
111 | ng-disabled="tieneArticulosPendientes()">Cargar</button> | 112 | ng-disabled="tieneArticulosPendientes()">Cargar</button> |
112 | </div> | 113 | </div> |
113 | 114 |
src/views/foca-logistica-pedido-ruta.html
1 | <div class="foca-logistica-pedido-ruta" id="test"> | 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="5" class="row"></foca-botonera-facturador> | 11 | <foca-botonera-facturador botones="botonera" extra="5" 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 | 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 | <input | 25 | <input |
26 | type="date" | 26 | type="date" |
27 | ng-model="now" | 27 | ng-model="now" |
28 | class="btn col-12 my-1" | 28 | class="btn col-12 my-1" |
29 | foca-focus="true" | 29 | foca-focus="true" |
30 | ng-blur="fecha()" | 30 | ng-blur="fecha()" |
31 | hasta-hoy | 31 | hasta-hoy |
32 | /> | 32 | /> |
33 | <button | 33 | <button |
34 | type="button" | 34 | type="button" |
35 | ng-class="{'active': idUsuario == 0}" | 35 | ng-class="{'active': idVendedor == 0}" |
36 | class="btn col-12 my-1" | 36 | class="btn col-12 my-1" |
37 | ng-click="general()" | 37 | ng-click="general()" |
38 | >General</button> | 38 | >General</button> |
39 | <button | 39 | <button |
40 | type="button" | 40 | type="button" |
41 | ng-class="{'active': idUsuario != 0}" | 41 | ng-class="{'active': idVendedor != 0}" |
42 | class="btn col-12 my-1" | 42 | class="btn col-12 my-1" |
43 | ng-click="individual()" | 43 | ng-click="individual()" |
44 | >Individual</button> | 44 | >Individual</button> |
45 | <div class="form-group" ng-show="idUsuario == -1"> | 45 | <div class="form-group" ng-show="idVendedor == -1"> |
46 | <input | 46 | <input |
47 | type="text" | 47 | type="text" |
48 | placeholder="Vendedor" | 48 | placeholder="Vendedor" |
49 | class="form-control" | 49 | class="form-control" |
50 | ng-model="idUsuarioInput" | 50 | ng-model="idVendedorInput" |
51 | ng-keypress="search($event.keyCode)" | 51 | ng-keypress="search($event.keyCode)" |
52 | foca-focus="idUsuario == -1" | 52 | foca-focus="idVendedor == -1" |
53 | > | 53 | > |
54 | </div> | 54 | </div> |
55 | </div> | 55 | </div> |
56 | <div class="row"> | 56 | <div class="row"> |
57 | <div | 57 | <div |
58 | class="container col-auto" | 58 | class="container col-auto" |
59 | ng-repeat="vehiculo in vehiculos" | 59 | ng-repeat="vehiculo in vehiculos" |
60 | ng-click="mostrarDetalleVehiculo(vehiculo)" | 60 | ng-click="mostrarDetalleVehiculo(vehiculo)" |
61 | > | 61 | > |
62 | <div> | 62 | <div> |
63 | <div class="col-md-3 col-sm-6"> | 63 | <div class="col-md-3 col-sm-6"> |
64 | <div class="progress-circle" ng-class="{'arrastrando': arrastrando}"> | 64 | <div class="progress-circle" ng-class="{'arrastrando': arrastrando}"> |
65 | <span class="progress-left"> | 65 | <span class="progress-left"> |
66 | <span class="progress-bar"></span> | 66 | <span class="progress-bar"></span> |
67 | </span> | 67 | </span> |
68 | <span class="progress-right"> | 68 | <span class="progress-right"> |
69 | <span class="progress-bar"></span> | 69 | <span class="progress-bar"></span> |
70 | </span> | 70 | </span> |
71 | <div class="progress-value">{{vehiculo.codigo}}</div> | 71 | <div class="progress-value">{{vehiculo.codigo}}</div> |
72 | </div> | 72 | </div> |
73 | </div> | 73 | </div> |
74 | <div class="row px-4"> | 74 | <div class="row px-4"> |
75 | <div class="text-left col-6 ml-1 position-absolute"> | 75 | <div class="text-left col-6 ml-1 position-absolute"> |
76 | <img | 76 | <img |
77 | src="img/hojaRutaVolante.png" | 77 | src="img/hojaRutaVolante.png" |
78 | width="34%" | 78 | width="34%" |
79 | uib-tooltip="Confeccionar hoja de ruta" | 79 | uib-tooltip="Confeccionar hoja de ruta" |
80 | ng-click="hacerHojaRuta(vehiculo)"> | 80 | ng-click="hacerHojaRuta(vehiculo)"> |
81 | </div> | 81 | </div> |
82 | <div class="text-right ml-5 col-6 position-absolute"> | 82 | <div class="text-right ml-5 col-6 position-absolute"> |
83 | <i | 83 | <i |
84 | class="fa fa-trash fa-2x" | 84 | class="fa fa-trash fa-2x" |
85 | uib-tooltip="Eliminar vehiculo" | 85 | uib-tooltip="Eliminar vehiculo" |
86 | ng-click="quitarVehiculo(vehiculo)"></i> | 86 | ng-click="quitarVehiculo(vehiculo)"></i> |
87 | </div> | 87 | </div> |
88 | </div> | 88 | </div> |
89 | <div | 89 | <div |
90 | class="col-12 mt-5 border border-dark text-center" | 90 | class="col-12 mt-5 border border-dark text-center" |
91 | ng-show="arrastrando" | 91 | ng-show="arrastrando" |
92 | id="{{vehiculo.id}}" | 92 | id="{{vehiculo.id}}" |
93 | ondrop="drop(event)" | 93 | ondrop="drop(event)" |
94 | ondragover="allowDrop(event)" | 94 | ondragover="allowDrop(event)" |
95 | >Soltar acá</div> | 95 | >Soltar acá</div> |
96 | </div> | 96 | </div> |
97 | </div> | 97 | </div> |
98 | </div> | 98 | </div> |
99 | </div> | 99 | </div> |
100 | </div> | 100 | </div> |
101 | 101 |
src/views/foca-modal-crear-hoja-ruta.html
1 | <div class="modal-header"> | 1 | <div class="modal-header"> |
2 | <h4>-en desarrollo</h4> | 2 | <h4>-en desarrollo</h4> |
3 | <h4>Confeccionar hoja de ruta</h4> | 3 | <h4>Confeccionar hoja de ruta</h4> |
4 | Hoja de ruta Nº <strong ng-bind="[numero, sucursal] | comprobante"></strong> | 4 | Hoja de ruta Nº <strong ng-bind="[numero, sucursal] | comprobante"></strong> |
5 | Fecha: | ||
6 | <input | ||
7 | type="date" | ||
8 | ng-model="now" | ||
9 | class="form-control form-control-sm col-3 float-right" | ||
10 | /> | ||
5 | <br> | 11 | <br> |
6 | </div> | 12 | </div> |
7 | <div class="modal-body"> | 13 | <div class="modal-body"> |
8 | <form class="row" name="formHojaRuta"> | 14 | <form class="row" name="formHojaRuta"> |
9 | 15 | ||
10 | 16 | ||
11 | <div class="col-2 form-group"> | 17 | <div class="col-2 form-group"> |
12 | <label>Vehículo</label> | 18 | <label>Vehículo</label> |
13 | </div> | 19 | </div> |
14 | <div class="col-4"> | 20 | <div class="col-4"> |
15 | <input | 21 | <input |
16 | class="form-control" | 22 | class="form-control" |
17 | readonly | 23 | readonly |
18 | ng-model="vehiculo.tractor" | 24 | ng-model="vehiculo.tractor" |
19 | > | 25 | > |
20 | </div> | 26 | </div> |
21 | <div class="col-2"> | 27 | <div class="col-2"> |
22 | <label>Transportista</label> | 28 | <label>Transportista</label> |
23 | </div> | 29 | </div> |
24 | <div class="col-4"> | 30 | <div class="col-4"> |
25 | <input | 31 | <input |
26 | class="form-control" | 32 | class="form-control" |
27 | readonly | 33 | readonly |
28 | ng-model="vehiculo.transportista.NOM" | 34 | ng-model="vehiculo.transportista.NOM" |
29 | > | 35 | > |
30 | </div> | 36 | </div> |
31 | <div class="col-2 form-group"> | 37 | <div class="col-2 form-group"> |
32 | <label>Chofer</label> | 38 | <label>Chofer</label> |
33 | </div> | 39 | </div> |
34 | <div class="col-4 input-group"> | 40 | <div class="col-4 input-group"> |
35 | <input | 41 | <input |
36 | class="form-control" | 42 | class="form-control" |
37 | ng-model="chofer.nombre" | 43 | ng-model="chofer.nombre" |
38 | ng-click="seleccionarChofer()" | 44 | ng-click="seleccionarChofer()" |
39 | ng-required="true" | 45 | ng-required="true" |
40 | > | 46 | > |
41 | <div class="input-group-append"> | 47 | <div class="input-group-append"> |
42 | <button | 48 | <button |
43 | class="brn btn-outline-secondary form-control" | 49 | class="brn btn-outline-secondary form-control" |
44 | ng-click="seleccionarChofer()" | 50 | ng-click="seleccionarChofer()" |
45 | ><i class="fa fa-search"></i> | 51 | ><i class="fa fa-search"></i> |
46 | </button> | 52 | </button> |
47 | </div> | 53 | </div> |
48 | </div> | 54 | </div> |
49 | <div class="col-2"> | 55 | <div class="col-2"> |
50 | <label>Tarifa</label> | 56 | <label>Tarifa</label> |
51 | </div> | 57 | </div> |
52 | <div class="col-4"> | 58 | <div class="col-4"> |
53 | <input | 59 | <input |
54 | class="form-control" | 60 | class="form-control" |
55 | ng-model="tarifaFlete" | 61 | ng-model="tarifaFlete" |
56 | ng-required="true" | 62 | ng-required="true" |
57 | foca-teclado | 63 | foca-teclado |
58 | foca-tipo-input | 64 | foca-tipo-input |
59 | > | 65 | > |
60 | </div> | 66 | </div> |
61 | </form> | 67 | </form> |
62 | <strong>Remitos:</strong> | 68 | <strong>Remitos:</strong> |
63 | <table class="table"> | 69 | <table class="table"> |
64 | <thead> | 70 | <thead> |
65 | <tr> | 71 | <tr> |
66 | <th>Remito Nº</th> | 72 | <th>Remito Nº</th> |
67 | <th>Cliente</th> | 73 | <th>Cliente</th> |
68 | <th>Domicilio</th> | 74 | <th>Domicilio</th> |
69 | </tr> | 75 | </tr> |
70 | </thead> | 76 | </thead> |
71 | <tbody> | 77 | <tbody> |
78 | <tr ng-show="!remitos.length"> | ||
79 | <td colspan="3"> | ||
80 | No se han encontrado remitos. | ||
81 | </td> | ||
82 | </tr> | ||
72 | <tr ng-repeat="remito in remitos"> | 83 | <tr ng-repeat="remito in remitos"> |
73 | <td ng-bind="[remito.numeroRemito, remito.sucursal] | comprobante"></td> | 84 | <td ng-bind="[remito.numeroRemito, remito.sucursal] | comprobante"></td> |
74 | <td ng-bind="remito.nombreCliente"></td> | 85 | <td ng-bind="remito.nombreCliente"></td> |
75 | <td ng-bind="remito.domicilioStamp"></td> | 86 | <td ng-bind="remito.domicilioStamp"></td> |
76 | </tr> | 87 | </tr> |
77 | <!-- <tr> | ||
78 | <td>Remito ejemplo</td> | ||
79 | <td>Domicilio ejemplo</td> | ||
80 | </tr> --> | ||
81 | </tbody> | 88 | </tbody> |
82 | </table> | 89 | </table> |
83 | </div> | 90 | </div> |
84 | <div class="modal-footer py-1"> | 91 | <div class="modal-footer py-1"> |
85 | <button | 92 | <button |
86 | class="btn btn-sm btn-secondary" | 93 | class="btn btn-sm btn-secondary" |
87 | ladda="cargando" | 94 | ladda="cargando" |
88 | type="button" | 95 | type="button" |
89 | ng-click="cancelar()">Cancelar</button> | 96 | ng-click="cancelar()">Cancelar</button> |
90 | <button | 97 | <button |
91 | class="btn btn-sm btn-primary" | 98 | class="btn btn-sm btn-primary" |
92 | ladda="cargando" | 99 | ladda="cargando" |
93 | type="button" | 100 | type="button" |