Commit dfec27a773e8d15ed434e8e6e4db093f68e73d25

Authored by Jose Pinto
1 parent c29a9a6525
Exists in master and in 1 other branch develop

agrego valor disponible, boton grafico

1 angular.module('focaEstadoCisternas', ['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']); 1 angular.module('focaEstadoCisternas', [
2 'ngRoute',
3 'focaModal',
4 'ui.bootstrap',
5 'focaBotoneraLateral'
6 ]);
2 7
src/js/controller.js
1 angular.module('focaEstadoCisternas') 1 angular.module('focaEstadoCisternas')
2 .controller('focaEstadoCisternasController', [ 2 .controller('focaEstadoCisternasController', [
3 '$scope', 'focaEstadoCisternasService', '$location', 'focaModalService', 3 '$scope', 'focaEstadoCisternasService', 'focaModalService',
4 '$uibModal', 'focaBotoneraLateralService', '$timeout', 4 '$uibModal', 'focaBotoneraLateralService', '$timeout',
5 function($scope, focaEstadoCisternasService, $location, focaModalService, 5 function($scope, focaEstadoCisternasService, focaModalService,
6 $uibModal, focaBotoneraLateralService, $timeout) { 6 $uibModal, focaBotoneraLateralService, $timeout) {
7 7
8 $scope.now = new Date(); 8 $scope.now = new Date();
9 $scope.fecha = new Date(); 9 $scope.fecha = new Date();
10 $scope.cisternas = []; 10 $scope.cisternas = [];
11 $scope.botonera = [{ 11 $scope.botonera = focaEstadoCisternasService.getBotonera();
12 label: 'Transportista',
13 image: 'transportista.png'
14 },
15 {
16 label: 'Vehiculo',
17 image: 'vehiculos.png'
18 },
19 {
20 label: 'Fecha',
21 image: 'fechaDeReparto.png'
22 }];
23 12
24 //SETEO BOTONERA LATERAL 13 //SETEO BOTONERA LATERAL
25 focaBotoneraLateralService.showSalir(true); 14 focaBotoneraLateralService.showSalir(true);
26 focaBotoneraLateralService.showPausar(false); 15 focaBotoneraLateralService.showPausar(false);
27 focaBotoneraLateralService.showCancelar(false); 16 focaBotoneraLateralService.showCancelar(false);
28 focaBotoneraLateralService.showGuardar(false); 17 focaBotoneraLateralService.showGuardar(false);
29 18
30 $timeout(function() { 19 $timeout(function() {
31 $scope.$broadcast('addCabecera', { 20 $scope.$broadcast('addCabecera', {
32 label: 'Fecha:', 21 label: 'Fecha:',
33 valor: $scope.fecha.toLocaleDateString() 22 valor: $scope.fecha.toLocaleDateString()
34 }); 23 });
35 }); 24 });
36 25
37 $scope.seleccionarTransportista = function() { 26 $scope.seleccionarTransportista = function() {
38 var modalInstance = $uibModal.open( 27 var modalInstance = $uibModal.open(
39 { 28 {
40 ariaLabelledBy: 'Busqueda de Transportista', 29 ariaLabelledBy: 'Busqueda de Transportista',
41 templateUrl: 'modal-proveedor.html', 30 templateUrl: 'modal-proveedor.html',
42 controller: 'focaModalProveedorCtrl', 31 controller: 'focaModalProveedorCtrl',
43 size: 'lg', 32 size: 'lg',
44 resolve: { 33 resolve: {
45 transportista: function() { 34 transportista: function() {
46 return true; 35 return true;
47 } 36 }
48 } 37 }
49 } 38 }
50 ); 39 );
51 modalInstance.result.then( 40 modalInstance.result.then(
52 function(transportista) { 41 function(transportista) {
53 elegirTransportista(transportista); 42 elegirTransportista(transportista);
54 }, function() { 43 }, function() {
55 44
56 } 45 }
57 ); 46 );
58 }; 47 };
59 48
60 $scope.seleccionarVehiculo = function() { 49 $scope.seleccionarVehiculo = function() {
61 if(!$scope.idTransportista) { 50 if(!$scope.idTransportista) {
62 focaModalService.alert('Primero seleccione un transportista'); 51 focaModalService.alert('Primero seleccione un transportista');
63 return; 52 return;
64 } 53 }
65 var query = '/vehiculo/transportista/' + $scope.idTransportista; 54 var query = '/vehiculo/transportista/' + $scope.idTransportista;
66 var columnas = { 55 var columnas = {
67 nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], 56 nombre: ['Código', 'tractor', 'Semi', 'Capacidad'],
68 propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] 57 propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas']
69 }; 58 };
70 var titulo = 'Búsqueda de vehículos'; 59 var titulo = 'Búsqueda de vehículos';
71 60
72 focaModalService.modal(columnas, query, titulo).then( 61 focaModalService.modal(columnas, query, titulo).then(
73 function(vehiculo) { 62 function(vehiculo) {
74 $scope.$broadcast('addCabecera', { 63 $scope.$broadcast('addCabecera', {
75 label: 'Vehículo:', 64 label: 'Vehículo:',
76 valor: vehiculo.codigo 65 valor: vehiculo.codigo
77 }); 66 });
78 $scope.cisternas = vehiculo.cisternas; 67 $scope.cisternas = vehiculo.cisternas;
79 getEstadosCisternas($scope.cisternas); 68 getEstadosCisternas($scope.cisternas);
80 }, function() { 69 }, function() {
81 // funcion ejecutada cuando se cancela el modal 70 // funcion ejecutada cuando se cancela el modal
82 }); 71 });
83 }; 72 };
84 73
85 $scope.seleccionarFecha = function() { 74 $scope.seleccionarFecha = function() {
86 focaModalService.modalFecha('Fecha').then(function(fecha) { 75 focaModalService.modalFecha('Fecha').then(function(fecha) {
87 $scope.$broadcast('addCabecera', { 76 $scope.$broadcast('addCabecera', {
88 label: 'Fecha:', 77 label: 'Fecha:',
89 valor: fecha.toLocaleDateString() 78 valor: fecha.toLocaleDateString()
90 }); 79 });
91 $scope.fecha = fecha; 80 $scope.fecha = fecha;
92 if($scope.cisternas) 81 if($scope.cisternas)
93 getEstadosCisternas($scope.cisternas); 82 getEstadosCisternas($scope.cisternas);
94 }); 83 });
95 }; 84 };
96 85
86 $scope.seleccionarGrafico = function() {
87 if(!$scope.cisternas.length){
88 focaModalService.alert('Primero seleccione un vehículo');
89 return;
90 }
91 $uibModal.open(
92 {
93 ariaLabelledBy: 'Grafico de cisternas',
94 templateUrl: 'modal-grafico-cisternas.html',
95 controller: 'focaModalGraficoCisternasController',
96 size: 'md',
97 resolve:{
98 filters: {
99 cisternas: $scope.cisternas
100 }
101 }
102 }
103 );
104 };
105
97 function elegirTransportista(transportista) { 106 function elegirTransportista(transportista) {
98 var codigo = ('00000' + transportista.COD).slice(-5); 107 var codigo = ('00000' + transportista.COD).slice(-5);
99 $scope.idTransportista = transportista.COD; 108 $scope.idTransportista = transportista.COD;
100 $scope.filtros = transportista.NOM.trim(); 109 $scope.filtros = transportista.NOM.trim();
101 $scope.$broadcast('addCabecera', { 110 $scope.$broadcast('addCabecera', {
102 label: 'Transportista:', 111 label: 'Transportista:',
103 valor: codigo + ' - ' + transportista.NOM 112 valor: codigo + ' - ' + transportista.NOM
104 }); 113 });
105 } 114 }
106 115
107 function getEstadosCisternas(cisternas) { 116 function getEstadosCisternas(cisternas) {
1 angular.module('focaEstadoCisternas') 1 angular.module('focaEstadoCisternas')
2 .factory('focaEstadoCisternasService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .factory('focaEstadoCisternasService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 return { 3 return {
4 getVehiculos: function() { 4 getVehiculos: function() {
5 return $http.get(API_ENDPOINT.URL + '/vehiculo'); 5 return $http.get(API_ENDPOINT.URL + '/vehiculo');
6 }, 6 },
7 getTransportistas: function() { 7 getTransportistas: function() {
8 return $http.get(API_ENDPOINT.URL + '/transportista'); 8 return $http.get(API_ENDPOINT.URL + '/transportista');
9 }, 9 },
10 getCisternadoPorVehiculo: function(idVehiculo) { 10 getCisternadoPorVehiculo: function(idVehiculo) {
11 return $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo); 11 return $http.get(API_ENDPOINT.URL + '/cisterna/listar/' + idVehiculo);
12 }, 12 },
13 getCisterna: function(id) { 13 getCisterna: function(id) {
14 return $http.get(API_ENDPOINT.URL + '/cisterna/obtener/' + id); 14 return $http.get(API_ENDPOINT.URL + '/cisterna/obtener/' + id);
15 }, 15 },
16 guardarCisterna: function(cisterna) { 16 guardarCisterna: function(cisterna) {
17 return $http.post(API_ENDPOINT.URL + '/cisterna/guardar', {cisterna: cisterna}); 17 return $http.post(API_ENDPOINT.URL + '/cisterna/guardar', {cisterna: cisterna});
18 }, 18 },
19 deleteCisterna: function(id) { 19 deleteCisterna: function(id) {
20 return $http.delete(API_ENDPOINT.URL + '/cisterna/borrar/' + id); 20 return $http.delete(API_ENDPOINT.URL + '/cisterna/borrar/' + id);
21 }, 21 },
22 getVehiculosPorTransportista: function(id) { 22 getVehiculosPorTransportista: function(id) {
23 return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id); 23 return $http.get(API_ENDPOINT.URL + '/vehiculo/transportista/' + id);
24 }, 24 },
25 getEstadoCisterna: function(id, fecha) { 25 getEstadoCisterna: function(id, fecha) {
26 return $http.post(API_ENDPOINT.URL + '/cisterna/stock', 26 return $http.post(API_ENDPOINT.URL + '/cisterna/stock',
27 {idCisterna: id, fecha: fecha}); 27 {idCisterna: id, fecha: fecha});
28 },
29 getBotonera: function() {
30 return [
31 {
32 label: 'Transportista',
33 image: 'transportista.png'
34 },
35 {
36 label: 'Vehiculo',
37 image: 'vehiculos.png'
38 },
39 {
40 label: 'Fecha',
41 image: 'fechaDeReparto.png'
42 },
43 {
44 label: 'Grafico',
45 image: 'fechaDeReparto.png'
46 }
47 ];
28 } 48 }
29 }; 49 };
30 }]); 50 }]);
31 51
src/views/foca-estado-cisterna.html
1 <div class="row"> 1 <div class="row">
2 <foca-cabecera-facturador 2 <foca-cabecera-facturador
3 titulo="'Estado de cisternas'" 3 titulo="'Estado de cisternas'"
4 fecha="now" 4 fecha="now"
5 class="mb-0 col-lg-12" 5 class="mb-0 col-lg-12"
6 ></foca-cabecera-facturador> 6 ></foca-cabecera-facturador>
7 </div> 7 </div>
8 <div class="row"> 8 <div class="row">
9 <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> 9 <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded">
10 <div class="row px-5 py-2 botonera-secundaria"> 10 <div class="row px-5 py-2 botonera-secundaria">
11 <div class="col-12"> 11 <div class="col-12">
12 <foca-botonera-facturador botones="botonera" extra="3" class="row"> 12 <foca-botonera-facturador botones="botonera" extra="2" class="row">
13 </foca-botonera-facturador> 13 </foca-botonera-facturador>
14 </div> 14 </div>
15 </div> 15 </div>
16 <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> 16 <table class="table table-default table-hover table-sm table-abm table-striped mb-0">
17 <thead> 17 <thead>
18 <tr> 18 <tr>
19 <th>Código</th> 19 <th>Código</th>
20 <th>Capacidad total</th> 20 <th>Capacidad total</th>
21 <th>Carga</th> 21 <th>Carga</th>
22 <th>Disponible</th>
22 <th>Producto</th> 23 <th>Producto</th>
23 </tr> 24 </tr>
24 </thead> 25 </thead>
25 <tbody> 26 <tbody>
26 <tr ng-repeat="cisterna in cisternas"> 27 <tr ng-repeat="cisterna in cisternas">
27 <td ng-bind="cisterna.codigo"></td> 28 <td ng-bind="cisterna.codigo"></td>
28 <td ng-bind="cisterna.capacidad + ' ' + cisterna.unidadMedida.NOM"></td> 29 <td ng-bind="cisterna.capacidad + ' ' + cisterna.unidadMedida.NOM"></td>
29 <td ng-bind="cisterna.estado.cantidad"></td> 30 <td ng-bind="cisterna.estado.cantidad"></td>
31 <td ng-bind="cisterna.capacidad - cisterna.estado.cantidad"></td>
30 <td ng-bind="(cisterna.estado.producto) ? cisterna.estado.producto.DetArt : '-'"></td> 32 <td ng-bind="(cisterna.estado.producto) ? cisterna.estado.producto.DetArt : '-'"></td>
31 </tr> 33 </tr>
32 </body> 34 </body>
33 </table> 35 </table>
34 </div> 36 </div>
35 </div> 37 </div>
36 38