Commit a0042a4f2efecf6ef0103967d85d9888de6b1e8f

Authored by Eric Fernandez
1 parent 6a06288d8c
Exists in master

cargar remitos

confeccionar hoja ruta
1 { 1 {
2 /* 2 /*
3 * ENVIRONMENTS 3 * ENVIRONMENTS
4 * ================= 4 * =================
5 */ 5 */
6 6
7 // Define globals exposed by modern browsers. 7 // Define globals exposed by modern browsers.
8 "browser": true, 8 "browser": true,
9 9
10 // Define globals exposed by jQuery. 10 // Define globals exposed by jQuery.
11 "jquery": true, 11 "jquery": true,
12 12
13 // Define globals exposed by Node.js. 13 // Define globals exposed by Node.js.
14 "node": true, 14 "node": true,
15 15
16 // Allow ES6. 16 // Allow ES6.
17 "esversion": 6, 17 "esversion": 6,
18 18
19 /* 19 /*
20 * ENFORCING OPTIONS 20 * ENFORCING OPTIONS
21 * ================= 21 * =================
22 */ 22 */
23 23
24 // Force all variable names to use either camelCase style or UPPER_CASE 24 // Force all variable names to use either camelCase style or UPPER_CASE
25 // with underscores. 25 // with underscores.
26 "camelcase": true, 26 "camelcase": true,
27 27
28 // Prohibit use of == and != in favor of === and !==. 28 // Prohibit use of == and != in favor of === and !==.
29 "eqeqeq": true, 29 "eqeqeq": true,
30 30
31 // Enforce tab width of 2 spaces. 31 // Enforce tab width of 2 spaces.
32 "indent": 4, 32 "indent": 4,
33 33
34 // Prohibit use of a variable before it is defined. 34 // Prohibit use of a variable before it is defined.
35 "latedef": false, 35 "latedef": false,
36 36
37 // Enforce line length to 100 characters 37 // Enforce line length to 100 characters
38 "maxlen": 100, 38 "maxlen": 100,
39 39
40 // Require capitalized names for constructor functions. 40 // Require capitalized names for constructor functions.
41 "newcap": true, 41 "newcap": true,
42 42
43 // Enforce use of single quotation marks for strings. 43 // Enforce use of single quotation marks for strings.
44 "quotmark": "single", 44 "quotmark": "single",
45 45
46 // Enforce placing 'use strict' at the top function scope 46 // Enforce placing 'use strict' at the top function scope
47 "strict": false, 47 "strict": false,
48 48
49 // Prohibit use of explicitly undeclared variables. 49 // Prohibit use of explicitly undeclared variables.
50 "undef": true, 50 "undef": true,
51 51
52 // Warn when variables are defined but never used. 52 // Warn when variables are defined but never used.
53 "unused": true, 53 "unused": false,
54 54
55 // Para que funcione en angular 55 // Para que funcione en angular
56 "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe", "L"], 56 "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe", "L"],
57 /* 57 /*
58 * RELAXING OPTIONS 58 * RELAXING OPTIONS
59 * ================= 59 * =================
60 */ 60 */
61 61
62 // Suppress warnings about == null comparisons. 62 // Suppress warnings about == null comparisons.
63 "eqnull": true 63 "eqnull": true
64 } 64 }
65 65
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',
4 function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter, 4 function($scope, focaLogisticaPedidoRutaService, $location, $uibModal, $filter,
5 focaModalService, focaBotoneraLateralService 5 focaModalService, focaBotoneraLateralService
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.idUsuario = 0;
16 $scope.marcadores = []; 16 $scope.marcadores = [];
17 $scope.vehiculos = []; 17 $scope.vehiculos = [];
18 var idsRemitos = [];
18 getSeguimiento(); 19 getSeguimiento();
19 $scope.arrastrando = false; 20 $scope.arrastrando = false;
20 $scope.general = function() { 21 $scope.general = function() {
21 $scope.idUsuario = 0; 22 $scope.idUsuario = 0;
22 getSeguimiento(); 23 getSeguimiento();
23 }; 24 };
24 25
25 //SETEO BOTONERA LATERAL 26 //SETEO BOTONERA LATERAL
26 focaBotoneraLateralService.showSalir(true); 27 focaBotoneraLateralService.showSalir(true);
27 focaBotoneraLateralService.showPausar(false); 28 focaBotoneraLateralService.showPausar(false);
28 focaBotoneraLateralService.showGuardar(false); 29 focaBotoneraLateralService.showGuardar(false);
29 30
30 $scope.general = function() { 31 $scope.general = function() {
31 $scope.idUsuario = 0; 32 $scope.idUsuario = 0;
32 getSeguimiento(); 33 getSeguimiento();
33 $scope.$broadcast('removeCabecera', cabecera); 34 $scope.$broadcast('removeCabecera', cabecera);
34 $scope.$broadcast('addCabecera',{ 35 $scope.$broadcast('addCabecera',{
35 label: 'General', 36 label: 'General',
36 valor: '' 37 valor: ''
37 }); 38 });
38 }; 39 };
39 40
40 $scope.cargar = function(id, punto) { 41 $scope.cargar = function(idVehiculo, punto) {
41 var idRemito = JSON.parse(punto).notaPedido.remito.id; 42 var idRemito = JSON.parse(punto).notaPedido.remito.id;
42 var modalInstance = $uibModal.open( 43 var modalInstance = $uibModal.open(
43 { 44 {
44 ariaLabelledBy: 'Busqueda de Vehiculo', 45 ariaLabelledBy: 'Busqueda de Vehiculo',
45 templateUrl: 'foca-detalle-vehiculo.html', 46 templateUrl: 'foca-detalle-vehiculo.html',
46 controller: 'focaDetalleVehiculo', 47 controller: 'focaDetalleVehiculo',
47 size: 'lg', 48 size: 'lg',
48 resolve: { 49 resolve: {
49 idVehiculo: function() {return id;}, 50 idVehiculo: function() {return idVehiculo;},
50 idRemito: function() {return idRemito;} 51 idRemito: function() {return idRemito;}
51 } 52 }
52 } 53 }
53 ); 54 );
54 modalInstance.result.then(function() { 55 modalInstance.result.then(function(idRemito) {
56 idsRemitos.push(idRemito);
55 }, function() { 57 }, function() {
56 }); 58 });
57 }; 59 };
58 60
59 $scope.quitarVehiculo = function(vehiculo) { 61 $scope.quitarVehiculo = function(vehiculo) {
60 focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' + 62 focaModalService.confirm('Esta seguro que desea eliminar el vehículo ' +
61 vehiculo.codigo + '?').then(function() { 63 vehiculo.codigo + '?').then(function() {
62 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); 64 $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1);
63 }); 65 });
64 }; 66 };
65 67
66 $scope.informacionVehiculo = function(vehiculo) { 68 $scope.hacerHojaRuta = function(vehiculo) {
67 focaModalService.alert('EN DESARROLLO : \n información del vehículo ' + 69 var modalInstance = $uibModal.open(
68 JSON.stringify(vehiculo)); 70 {
71 ariaLabelledBy: 'Creación hoja ruta',
72 templateUrl: 'foca-modal-crear-hoja-ruta.html',
73 controller: 'focaModalCrearHojaRuta',
74 size: 'lg',
75 resolve: {
76 idVehiculo: function() {return vehiculo.id;},
77 idsRemitos: function() {return idsRemitos;}
78 }
79 }
80 );
81 modalInstance.result.then(function() {
82
83 }, function() {
84 //usar cuando se cancela el modal
85 });
69 }; 86 };
70 87
71 $scope.arrastra = function() { 88 $scope.arrastra = function() {
72 $scope.arrastrando = true; 89 $scope.arrastrando = true;
73 $scope.$digest(); 90 $scope.$digest();
74 }; 91 };
75 92
76 $scope.noArrastra = function() { 93 $scope.noArrastra = function() {
77 $scope.arrastrando = false; 94 $scope.arrastrando = false;
78 $scope.$digest(); 95 $scope.$digest();
79 }; 96 };
80 97
81 $scope.individual = function() { 98 $scope.individual = function() {
82 $scope.idUsuario = -1; 99 $scope.idUsuario = -1;
83 }; 100 };
84 101
85 $scope.mostrarDetalle = function() { 102 $scope.mostrarDetalle = function() {
86 $scope.detalle = true; 103 $scope.detalle = true;
87 }; 104 };
88 105
89 $scope.salir = function() { 106 $scope.salir = function() {
90 $location.path('/'); 107 $location.path('/');
91 }; 108 };
92 109
93 $scope.search = function(key) { 110 $scope.search = function(key) {
94 if (key === 13) { 111 if (key === 13) {
95 $scope.idUsuario = $scope.idUsuarioInput; 112 $scope.idUsuario = $scope.idUsuarioInput;
96 getSeguimiento(); 113 getSeguimiento();
97 $scope.$broadcast('removeCabecera', 'General'); 114 $scope.$broadcast('removeCabecera', 'General');
98 $scope.$broadcast('addCabecera', { 115 $scope.$broadcast('addCabecera', {
99 label: cabecera, 116 label: cabecera,
100 valor: $scope.idUsuarioInput 117 valor: $scope.idUsuarioInput
101 }); 118 });
102 } 119 }
103 }; 120 };
104 121
105 $scope.fecha = function() { 122 $scope.fecha = function() {
106 getSeguimiento(); 123 getSeguimiento();
107 }; 124 };
108 125
109 $scope.seleccionarVehiculo = function() { 126 $scope.seleccionarVehiculo = function() {
110 var modalInstance = $uibModal.open( 127 var modalInstance = $uibModal.open(
111 { 128 {
112 ariaLabelledBy: 'Busqueda de Vehiculo', 129 ariaLabelledBy: 'Busqueda de Vehiculo',
113 templateUrl: 'modal-vehiculo.html', 130 templateUrl: 'modal-vehiculo.html',
114 controller: 'focaModalVehiculoController', 131 controller: 'focaModalVehiculoController',
115 size: 'lg' 132 size: 'lg'
116 } 133 }
117 ); 134 );
118 135
119 modalInstance.result.then( 136 modalInstance.result.then(
120 function(vehiculo) { 137 function(vehiculo) {
121 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id}); 138 var existe = $filter('filter')($scope.vehiculos, {id: vehiculo.id});
122 if(existe.length) { 139 if(existe.length) {
123 focaModalService.alert('El vehiculo que intenta cargar ya ha sido cargado'); 140 focaModalService.alert('El vehiculo que intenta cargar ya ha sido cargado');
124 return; 141 return;
125 } 142 }
143 if(!vehiculo.cisternas.length) {
144 focaModalService.alert('El vehiculo no tiene cisternas');
145 return;
146 }
126 $scope.vehiculos.push(vehiculo); 147 $scope.vehiculos.push(vehiculo);
127 }, function() { 148 }, function() {
128 // funcion ejecutada cuando se cancela el modal 149 // funcion ejecutada cuando se cancela el modal
129 } 150 }
130 ); 151 );
131 }; 152 };
132 153
133 function getSeguimiento() { 154 function getSeguimiento() {
134 var now = $scope.now; 155 var now = $scope.now;
135 var desde = new Date(new Date(now.setHours(0)).setMinutes(0)); 156 var desde = new Date(new Date(now.setHours(0)).setMinutes(0));
136 desde = desde.setDate(desde.getDate() - 1); 157 desde = desde.setDate(desde.getDate() - 1);
137 desde = new Date(desde); 158 desde = new Date(desde);
138 var datos = { 159 var datos = {
139 actividad: $scope.actividad, 160 actividad: $scope.actividad,
140 idUsuario: $scope.idUsuario, 161 idUsuario: $scope.idUsuario,
141 fechaDesde: desde, 162 fechaDesde: desde,
142 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59)) 163 fechaHasta: new Date(new Date(now.setHours(23)).setMinutes(59))
143 }; 164 };
144 165
145 $scope.datosBuscados = { 166 $scope.datosBuscados = {
146 actividad: $scope.actividad, 167 actividad: $scope.actividad,
147 individual: $scope.idUsuario !== 0 ? true : false 168 individual: $scope.idUsuario !== 0 ? true : false
148 }; 169 };
149 170
150 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) { 171 focaLogisticaPedidoRutaService.obtenerActividad(datos).then(function(datos) {
151 $scope.marcadores = datos.data; 172 $scope.marcadores = datos.data;
152 }); 173 });
153 } 174 }
154 } 175 }
155 ]); 176 ]);
156 177
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 $scope.articulos = []; 14 $scope.articulos = [];
14 $scope.vehiculo = {}; 15 $scope.vehiculo = {};
15 $scope.remito = {}; 16 $scope.remito = {};
17 $scope.aCargar = [];
18 var cisternaMovimientos = [];
16 focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then( 19 focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then(
17 function(res) { 20 function(res) {
18 $scope.vehiculo = res.data; 21 $scope.vehiculo = res.data;
19 } 22 }
20 ); 23 );
21 focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito).then( 24 focaLogisticaPedidoRutaService.obtenerRemitoById(idRemito).then(
22 function(res) { 25 function(res) {
23 $scope.remito = res.data; 26 $scope.remito = res.data;
24 $scope.articulos = res.data.articulosRemito; 27 $scope.articulos = res.data.articulosRemito;
25 } 28 }
26 ); 29 );
27 $scope.aCargar = [];
28 $scope.aceptar = function() { 30 $scope.aceptar = function() {
29 $uibModalInstance.close(); 31 $scope.cargando = true;
32 var cisternaCargas = [];
33 for (var i = 0; i < $scope.vehiculo.cisternas.length; i++) {
34 delete $scope.vehiculo.cisternas[i].cisternaCarga.articulo;
35 cisternaCargas.push($scope.vehiculo.cisternas[i].cisternaCarga);
36 }
37 var cisterna = {
38 cisternaMovimientos: cisternaMovimientos,
39 cisternaCargas: cisternaCargas
40 };
41 focaLogisticaPedidoRutaService.guardarCisternas(cisterna).then(function() {
42 focaModalService.alert('Cisternas cargadas con éxito').then(function() {
43 $scope.cargando = false;
44 $uibModalInstance.close(idRemito);
45 });
46 });
30 }; 47 };
31 48
32 $scope.cancelar = function() { 49 $scope.cancelar = function() {
33 $uibModalInstance.close(); 50 $uibModalInstance.close();
34 }; 51 };
35 52
36 $scope.cargarACisternas = function(vehiculo) { 53 $scope.cargarACisternas = function(vehiculo) {
37 for(var i = 0; i < vehiculo.cisternas.length; i++) { 54 for(var i = 0; i < vehiculo.cisternas.length; i++) {
38 var cisterna = vehiculo.cisternas[i]; 55 var cisterna = vehiculo.cisternas[i];
39 var aCargar = parseFloat($scope.aCargar[i]); 56 var aCargar = parseFloat($scope.aCargar[i]);
57 //validaciones
40 if(!aCargar) { 58 if(!aCargar) {
41 continue; 59 continue;
42 } 60 }
43 if(aCargar > cisterna.disponible) { 61 if(aCargar > cisterna.disponible) {
44 focaModalService.alert('La cantidad cargada supera la capacidad de la' + 62 focaModalService.alert('La cantidad cargada supera la capacidad de la' +
45 'cisterna ' + cisterna.codigo); 63 'cisterna ' + cisterna.codigo);
46 return; 64 return;
47 } 65 }
66 //cargar
48 if(cisterna.cisternaCarga.cantidad) { 67 if(cisterna.cisternaCarga.cantidad) {
49 cisterna.cisternaCarga.cantidad += aCargar; 68 cisterna.cisternaCarga.cantidad += aCargar;
50 }else { 69 }else {
51 cisterna.cisternaCarga.cantidad = aCargar; 70 cisterna.cisternaCarga.cantidad = aCargar;
52 cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo; 71 cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo;
53 } 72 }
54 cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad; 73 cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad;
55 74
56 cisterna.cisternaCarga.articulo = { 75 cisterna.cisternaCarga.articulo = {
57 DetArt: $scope.articuloSeleccionado.descripcion 76 DetArt: $scope.articuloSeleccionado.descripcion
58 }; 77 };
59 $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0] 78 $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0]
60 .cargado = true; 79 .cargado = true;
61 80
62 $scope.calcularPorcentaje(cisterna); 81 $scope.calcularPorcentaje(cisterna);
82 //Guardar
83 var now = new Date();
84 var cisternaMovimiento = {
85 fecha: now.toISOString().slice(0, 19).replace('T', ' '),
86 cantidad: aCargar,
87 metodo: 'carga',
88 idCisternaCarga: cisterna.cisternaCarga.id
89 };
90 cisternaMovimientos.push(cisternaMovimiento);
63 } 91 }
64 var articuloSiguiente = $scope.articulos.filter( 92 var articuloSiguiente = $scope.articulos.filter(
65 function(filter) { 93 function(filter) {
66 return filter.cargado !== true; 94 return filter.cargado !== true;
67 } 95 }
68 ); 96 );
69 if(articuloSiguiente.length > 0) { 97 if(articuloSiguiente.length > 0) {
70 $scope.cambioArticulo(articuloSiguiente[0]); 98 $scope.cambioArticulo(articuloSiguiente[0]);
71 } 99 }
72 $scope.aCargar = []; 100 $scope.aCargar = [];
73 }; 101 };
74 $scope.calcularPorcentaje = function(cisterna) { 102 $scope.calcularPorcentaje = function(cisterna) {
75 if(!cisterna.cisternaCarga.cantidad) { 103 if(!cisterna.cisternaCarga.cantidad) {
76 cisterna.cisternaCarga.cantidad = 0; 104 cisterna.cisternaCarga.cantidad = 0;
77 } 105 }
78 var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / 106 var porcentaje = (cisterna.cisternaCarga.cantidad * 100 /
79 cisterna.capacidad) + '%'; 107 cisterna.capacidad) + '%';
80 var elementHtml = document.getElementById(cisterna.id); 108 var elementHtml = document.getElementById(cisterna.id);
81 if(elementHtml) { 109 if(elementHtml) {
82 elementHtml.style.width = porcentaje; 110 elementHtml.style.width = porcentaje;
83 } 111 }
84 }; 112 };
85 $scope.cambioArticulo = function(articulo) { 113 $scope.cambioArticulo = function(articulo) {
86 articulo.checked = true; 114 articulo.checked = true;
87 $scope.articuloSeleccionado = articulo; 115 $scope.articuloSeleccionado = articulo;
88 }; 116 };
89 $scope.actualizarArticulo = function () { 117 $scope.actualizarArticulo = function () {
90 $scope.articuloSeleccionado.cantidadCargada = 0; 118 $scope.articuloSeleccionado.cantidadCargada = 0;
91 for (var i = 0; i < $scope.aCargar.length; i++) { 119 for (var i = 0; i < $scope.aCargar.length; i++) {
92 $scope.articuloSeleccionado.cantidadCargada += 120 $scope.articuloSeleccionado.cantidadCargada +=
93 parseFloat($scope.aCargar[i]) || 0; 121 parseFloat($scope.aCargar[i]) || 0;
94 } 122 }
95 }; 123 };
96 $scope.tieneArticulosPendientes = function() { 124 $scope.tieneArticulosPendientes = function() {
97 var articulosDescargados = $scope.articulos.filter(function(filter) { 125 var articulosDescargados = $scope.articulos.filter(function(filter) {
98 return filter.cargado === true; 126 return filter.cargado === true;
99 }); 127 });
100 if(articulosDescargados.length === $scope.articulos.length) { 128 if(articulosDescargados.length === $scope.articulos.length) {
101 return false; 129 return false;
102 } 130 }
103 return true; 131 return true;
104 }; 132 };
105 }]); 133 }]);
src/js/controllerHojaRuta.js
File was created 1 angular.module('focaLogisticaPedidoRuta')
2 .controller('focaModalCrearHojaRuta', [
3 '$scope',
4 '$uibModalInstance',
5 '$uibModal',
6 'focaLogisticaPedidoRutaService',
7 'idVehiculo',
8 'idsRemitos',
9 function($scope, $uibModalInstance, $uibModal, focaLogisticaPedidoRutaService,
10 idVehiculo, idsRemitos) {
11 $scope.vehiculo = {};
12 $scope.remitos = [];
13 focaLogisticaPedidoRutaService.obtenerVehiculoById(idVehiculo).then(function(res) {
14 $scope.vehiculo = res.data;
15 });
16 for (var i = 0; i < idsRemitos.length; i++) {
17 focaLogisticaPedidoRutaService.obtenerRemitoById(idsRemitos[i])
18 .then(cargarRemito);
19 }
20 function cargarRemito(res) {
21 $scope.remitos.push(res.data);
22 }
23 focaLogisticaPedidoRutaService.numeroHojaRuta().then(function(res) {
24 $scope.sucursal = res.data.sucursal;
25 $scope.numero = res.data.numeroHojaRuta;
26 });
27 $scope.cancelar = function() {
28 $uibModalInstance.close();
29 };
30 $scope.aceptar = function() {
31 $uibModalInstance.close();
32 };
33 $scope.seleccionarChofer = function() {
34 var modalInstance = $uibModal.open(
35 {
36 ariaLabelledBy: 'Busqueda de Chofer',
37 templateUrl: 'modal-chofer.html',
38 controller: 'focaModalChoferController',
39 size: 'lg'
40 }
41 );
42
43 modalInstance.result.then(
44 function(chofer) {
45 $scope.chofer = chofer;
46 }, function() {
47 // funcion ejecutada cuando se cancela el modal
48 }
49 );
50 };
51 }]);
1 angular.module('focaLogisticaPedidoRuta') 1 angular.module('focaLogisticaPedidoRuta')
2 .service( 2 .service(
3 'focaLogisticaPedidoRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT 3 'focaLogisticaPedidoRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT
4 ) { 4 ) {
5 return { 5 return {
6 obtenerActividad: function(parametros) { 6 obtenerActividad: function(parametros) {
7 return $http.post(API_ENDPOINT.URL + '/seguimiento/filtros', parametros); 7 return $http.post(API_ENDPOINT.URL + '/seguimiento/filtros', parametros);
8 }, 8 },
9 obtenerVehiculoById: function(idVehiculo) { 9 obtenerVehiculoById: function(idVehiculo) {
10 return $http.get(API_ENDPOINT.URL + '/vehiculo/' + idVehiculo); 10 return $http.get(API_ENDPOINT.URL + '/vehiculo/' + idVehiculo);
11 }, 11 },
12 obtenerRemitoById: function(idRemito) { 12 obtenerRemitoById: function(idRemito) {
13 return $http.get(API_ENDPOINT.URL + '/remito/obtener/' + idRemito); 13 return $http.get(API_ENDPOINT.URL + '/remito/obtener/' + idRemito);
14 },
15 guardarCisternas: function(cisterna) {
16 return $http.post(API_ENDPOINT.URL + '/cisterna/guardar/cargar', cisterna);
17 },
18 numeroHojaRuta: function() {
19 return $http.get(API_ENDPOINT.URL + '/hoja-ruta/numero-siguiente');
14 } 20 }
15 }; 21 };
16 }]); 22 }]);
17 23
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 <!-- TODO: quitar llaves {{}} y usar ng-bind --> 3 Vehículo <strong ng-bind="vehiculo.tractor"></strong>
4 <h4>-EN DESARROLLO</h4> 4 Transportista <strong ng-bind="vehiculo.transportista.NOM"></strong>
5 <br>
5 Remito Nº 6 Remito Nº
6 <strong ng-bind="remito.numeroRemito"></strong> 7 <strong ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></strong>
7 , Cliente 8 , Cliente
8 <strong ng-bind="remito.nombreCliente"></strong> 9 <strong ng-bind="remito.nombreCliente"></strong>
9 , Domicilio 10 , Domicilio
10 <strong ng-bind="remito.domicilioStamp"></strong> 11 <strong ng-bind="remito.domicilioStamp"></strong>
11 </div> 12 </div>
12 <div class="modal-body"> 13 <div class="modal-body">
13 <div> 14 <div>
14 <div class="col-12" ng-repeat="(key, articulo) in articulos"> 15 <table class="table table-sm">
15 <input 16 <thead>
16 type="radio" 17 <tr>
17 name="articuloRadio" 18 <th></th>
18 id="{{articulo.id}}" 19 <th>Articulo</th>
19 ng-checked="articulo.checked" 20 <th>Total</th>
20 ng-disabled="articulo.cargado" 21 <th>Cargado</th>
21 ng-click="cambioArticulo(articulo)" 22 <th>Pendiente</th>
22 > 23 </tr>
23 <span>Articulo: {{articulo.descripcion}},</span> 24 </thead>
24 <span>Total: {{articulo.cantidad}},</span> 25 <tbody>
25 <span>Cantidad Cargada: {{articulo.cantidadCargada || 0}},</span> 26 <tr ng-repeat="(key, articulo) in articulos">
26 <span>Pendiente: {{articulo.cantidad - articulo.cantidadCargada}} </span> 27 <td><input
27 </div> 28 type="radio"
28 <strong class="col-12" ng-bind="vehiculo.tractor"></strong> 29 name="articuloRadio"
29 <strong class="col-12">Cisternas:</strong> 30 id="{{articulo.id}}"
30 <div class="form-group row input-group" ng-repeat="(key, cisterna) in vehiculo.cisternas"> 31 ng-checked="articulo.checked"
31 <div class="col-1 mt-2"> 32 ng-disabled="articulo.cargado"
32 <strong>{{cisterna.codigo}}</strong> 33 ng-click="cambioArticulo(articulo)"
33 </div> 34 ></td>
34 <input 35 <td ng-bind="articulo.descripcion"></td>
35 class="form-control col-2 mr-3" 36 <td ng-bind="articulo.cantidad"></td>
36 foca-tipo-input 37 <td ng-bind="articulo.cantidadCargada || 0"></td>
37 foca-teclado 38 <td ng-bind="articulo.cantidad - articulo.cantidadCargada"></td>
38 placeholder="A cargar..." 39 </tr>
39 ng-model="aCargar[key]" 40 </tbody>
40 ng-disabled="(articuloSeleccionado.idArticulo !== cisterna.cisternaCarga.idProducto && 41 </table>
41 cisterna.cisternaCarga.idProducto) || !tieneArticulosPendientes()" 42 <table class="table table-sm">
42 ng-change="actualizarArticulo()" 43 <thead>
43 > 44 <tr>
44 <div class="progress foca-alto-progress col-4 pl-0 pr-0 mt-1"> 45 <th>Cisterna</th>
45 <strong class="col-12 mt-1 text-center position-absolute" 46 <th>Cantidad asignada</th>
46 >{{cisterna.cisternaCarga.cantidad || 0}} / {{cisterna.capacidad}}</strong> 47 <th>Estado</th>
47 <div 48 <th>Articulo cargado</th>
48 id="{{cisterna.id}}" 49 </tr>
49 class="progress-bar" 50 </thead>
50 role="progressbar" 51 <tbody>
51 aria-valuemin="0" 52 <tr ng-repeat="(key, cisterna) in vehiculo.cisternas">
52 aria-valuemax="{{cisterna.capacidad}}" 53 <td ng-bind="cisterna.codigo"></td>
53 ng-style="{'width':'{{calcularPorcentaje(cisterna)}}'}"> 54 <td><input
54 </div> 55 class="form-control"
55 </div> 56 foca-tipo-input
56 <div class="col-4 mt-2"> 57 foca-teclado
57 <strong>{{cisterna.cisternaCarga.articulo.DetArt || 'Sin articulo'}}</strong> 58 placeholder="A cargar..."
58 </div> 59 ng-model="aCargar[key]"
59 <!--TODO: descomentar cuando se use--> 60 ng-disabled="(articuloSeleccionado.idArticulo !== cisterna.cisternaCarga.idProducto &&
60 <!-- <div class="col-1 mt-1"> 61 cisterna.cisternaCarga.idProducto) || !tieneArticulosPendientes()"
61 <i class="fa fa-info" uib-tooltip="Información cisterna"></i> 62 ng-change="actualizarArticulo()"
62 </div> --> 63 >
63 </div> 64 </td>
65 <td colspan="2"><div class="progress foca-alto-progress pl-0 pr-0 mt-1">
66 <strong
67 class="mt-2 col-3 text-center position-absolute"
68 ng-bind="(cisterna.cisternaCarga.cantidad || 0) + '/' + (cisterna.capacidad)">
69 </strong>
70 <div
71 id="{{cisterna.id}}"
72 class="progress-bar"
73 role="progressbar"
74 aria-valuemin="0"
75 aria-valuemax="{{cisterna.capacidad}}"
76 ng-style="{'width':'{{calcularPorcentaje(cisterna)}}'}">
77 </div>
78 </div>
79 </td>
80 <td ng-bind="cisterna.cisternaCarga.articulo.DetArt || 'Sin articulo'"></td>
81 </tr>
82 </tbody>
83 </table>
64 <div class="col-12 aling-end"> 84 <div class="col-12 aling-end">
65 <button 85 <button
66 class="form-control" 86 class="form-control btn btn-success"
87 ladda="cargando"
88 data-spinner-color="#FF0000"
67 type="button" 89 type="button"
68 ng-disabled="!articuloSeleccionado || articuloSeleccionado.cantidad - 90 ng-disabled="!articuloSeleccionado || articuloSeleccionado.cantidad -
69 articuloSeleccionado.cantidadCargada !== 0 || !tieneArticulosPendientes()" 91 articuloSeleccionado.cantidadCargada !== 0 || !tieneArticulosPendientes()"
92 ng-class="{'btn-light': !articuloSeleccionado || articuloSeleccionado.cantidad -
93 articuloSeleccionado.cantidadCargada !== 0 || !tieneArticulosPendientes()}"
70 ng-click="cargarACisternas(vehiculo)"> 94 ng-click="cargarACisternas(vehiculo)">
71 Cargar cisternas 95 Aplicar distribución de cargas
72 </button> 96 </button>
73 </div> 97 </div>
74 </div> 98 </div>
75 </div> 99 </div>
76 <div class="modal-footer py-1"> 100 <div class="modal-footer py-1">
77 <button 101 <button
78 class="btn btn-sm btn-secondary" 102 class="btn btn-sm btn-secondary"
103 ladda="cargando"
79 type="button" 104 type="button"
80 ng-click="cancelar()">Cancelar</button> 105 ng-click="cancelar()">Cancelar</button>
81 <button 106 <button
82 class="btn btn-sm btn-primary" 107 class="btn btn-sm btn-primary"
108 ladda="cargando"
83 type="button" 109 type="button"
84 ng-click="aceptar()" 110 ng-click="aceptar()"
85 ng-disabled="tieneArticulosPendientes()">Cargar</button> 111 ng-disabled="tieneArticulosPendientes()">Cargar</button>
86 </div> 112 </div>
87 113
src/views/foca-logistica-pedido-ruta.html
1 <div class="foca-logistica-pedido-ruta" id="test"> 1 <div class="foca-logistica-pedido-ruta" id="test">
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
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': idUsuario == 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': idUsuario != 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="idUsuario == -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="idUsuarioInput"
51 ng-keypress="search($event.keyCode)" 51 ng-keypress="search($event.keyCode)"
52 foca-focus="idUsuario == -1" 52 foca-focus="idUsuario == -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 blue" 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"> 74 <div class="row px-4">
75 <div class="text-left col-6"> 75 <div class="text-left col-6 ml-1 position-absolute">
76 <i 76 <img
77 class="fa fa-info fa-2x" 77 src="img/hojaRutaVolante.png"
78 uib-tooltip="Ver información del vehículo" 78 width="34%"
79 ng-click="informacionVehiculo(vehiculo)"></i> 79 uib-tooltip="Confeccionar hoja de ruta"
80 ng-click="hacerHojaRuta(vehiculo)">
80 </div> 81 </div>
81 <div class="text-right col-6"> 82 <div class="text-right ml-5 col-6 position-absolute">
82 <i 83 <i
83 class="fa fa-trash fa-2x" 84 class="fa fa-trash fa-2x"
84 uib-tooltip="Eliminar vehiculo" 85 uib-tooltip="Eliminar vehiculo"
85 ng-click="quitarVehiculo(vehiculo)"></i> 86 ng-click="quitarVehiculo(vehiculo)"></i>
86 </div> 87 </div>
87 </div> 88 </div>
88 <div 89 <div
89 class="col-12 border border-dark text-center" 90 class="col-12 mt-5 border border-dark text-center"
90 ng-show="arrastrando" 91 ng-show="arrastrando"
91 id="{{vehiculo.id}}" 92 id="{{vehiculo.id}}"
92 ondrop="drop(event)" 93 ondrop="drop(event)"
93 ondragover="allowDrop(event)" 94 ondragover="allowDrop(event)"
94 >Soltar acá</div> 95 >Soltar acá</div>
95 </div> 96 </div>
96 </div> 97 </div>
97 </div> 98 </div>
98 </div> 99 </div>
99 </div> 100 </div>
100 101
src/views/foca-modal-crear-hoja-ruta.html
File was created 1 <div class="modal-header">
2 <h4>-en desarrollo</h4>
3 <h4>Confeccionar hoja de ruta</h4>
4 Hoja de ruta Nº <strong ng-bind="[numero, sucursal] | comprobante"></strong>
5 <br>
6 </div>
7 <div class="modal-body">
8 <form class="row" name="formHojaRuta">
9
10
11 <div class="col-2 form-group">
12 <label>Vehículo</label>
13 </div>
14 <div class="col-4">
15 <input
16 class="form-control"
17 readonly
18 ng-model="vehiculo.tractor"
19 >
20 </div>
21 <div class="col-2">
22 <label>Transportista</label>
23 </div>
24 <div class="col-4">
25 <input
26 class="form-control"
27 readonly
28 ng-model="vehiculo.transportista.NOM"
29 >
30 </div>
31 <div class="col-2 form-group">
32 <label>Chofer</label>
33 </div>
34 <div class="col-4 input-group">
35 <input
36 class="form-control"
37 ng-model="chofer.nombre"
38 ng-click="seleccionarChofer()"
39 ng-required="true"
40 >
41 <div class="input-group-append">
42 <button
43 class="brn btn-outline-secondary form-control"
44 ng-click="seleccionarChofer()"
45 ><i class="fa fa-search"></i>
46 </button>
47 </div>
48 </div>
49 <div class="col-2">
50 <label>Tarifa</label>
51 </div>
52 <div class="col-4">
53 <input
54 class="form-control"
55 ng-model="tarifaFlete"
56 ng-required="true"
57 foca-teclado
58 foca-tipo-input
59 >
60 </div>
61 </form>
62 <strong>Remitos:</strong>
63 <table class="table">
64 <thead>
65 <tr>
66 <th>Remito Nº</th>
67 <th>Cliente</th>
68 <th>Domicilio</th>
69 </tr>
70 </thead>
71 <tbody>
72 <tr ng-repeat="remito in remitos">
73 <td ng-bind="[remito.numeroRemito, remito.sucursal] | comprobante"></td>
74 <td ng-bind="remito.nombreCliente"></td>
75 <td ng-bind="remito.domicilioStamp"></td>
76 </tr>
77 <!-- <tr>
78 <td>Remito ejemplo</td>
79 <td>Domicilio ejemplo</td>
80 </tr> -->
81 </tbody>
82 </table>
83 </div>
84 <div class="modal-footer py-1">
85 <button
86 class="btn btn-sm btn-secondary"
87 ladda="cargando"
88 type="button"
89 ng-click="cancelar()">Cancelar</button>
90 <button
91 class="btn btn-sm btn-primary"
92 ladda="cargando"
93 type="button"
94 ng-disabled="!formHojaRuta.$valid"
95 ng-click="aceptar()">Crear hoja ruta</button>
96 </div>
97