Commit 1dbd7107ef959eea47d884f06bff60b829eb06e1
1 parent
9863e8cf12
Exists in
master
and in
1 other branch
ok max botonera-facturador, abrir modal transp al cancelar
Showing
2 changed files
with
5 additions
and
3 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaEstadoCisternas') | 1 | angular.module('focaEstadoCisternas') |
2 | .controller('focaEstadoCisternasController', [ | 2 | .controller('focaEstadoCisternasController', [ |
3 | '$scope', 'focaEstadoCisternasService', 'focaModalService', | 3 | '$scope', 'focaEstadoCisternasService', 'focaModalService', |
4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', | 4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', |
5 | function($scope, focaEstadoCisternasService, 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 = focaEstadoCisternasService.getBotonera(); | 11 | $scope.botonera = focaEstadoCisternasService.getBotonera(); |
12 | 12 | ||
13 | //SETEO BOTONERA LATERAL | 13 | //SETEO BOTONERA LATERAL |
14 | focaBotoneraLateralService.showSalir(true); | 14 | focaBotoneraLateralService.showSalir(true); |
15 | focaBotoneraLateralService.showPausar(false); | 15 | focaBotoneraLateralService.showPausar(false); |
16 | focaBotoneraLateralService.showCancelar(false); | 16 | focaBotoneraLateralService.showCancelar(false); |
17 | focaBotoneraLateralService.showGuardar(false); | 17 | focaBotoneraLateralService.showGuardar(false); |
18 | 18 | ||
19 | $timeout(function() { | 19 | $timeout(function() { |
20 | $scope.$broadcast('addCabecera', { | 20 | $scope.$broadcast('addCabecera', { |
21 | label: 'Fecha:', | 21 | label: 'Fecha:', |
22 | valor: $scope.fecha.toLocaleDateString() | 22 | valor: $scope.fecha.toLocaleDateString() |
23 | }); | 23 | }); |
24 | }); | 24 | }); |
25 | 25 | ||
26 | $scope.seleccionarTransportista = function() { | 26 | $scope.seleccionarTransportista = function() { |
27 | var modalInstance = $uibModal.open( | 27 | var modalInstance = $uibModal.open( |
28 | { | 28 | { |
29 | ariaLabelledBy: 'Busqueda de Transportista', | 29 | ariaLabelledBy: 'Busqueda de Transportista', |
30 | templateUrl: 'modal-proveedor.html', | 30 | templateUrl: 'modal-proveedor.html', |
31 | controller: 'focaModalProveedorCtrl', | 31 | controller: 'focaModalProveedorCtrl', |
32 | size: 'lg', | 32 | size: 'lg', |
33 | resolve: { | 33 | resolve: { |
34 | transportista: function() { | 34 | transportista: function() { |
35 | return true; | 35 | return true; |
36 | } | 36 | } |
37 | } | 37 | } |
38 | } | 38 | } |
39 | ); | 39 | ); |
40 | return modalInstance.result; | 40 | return modalInstance.result; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | $scope.seleccionarVehiculo = function() { | 43 | $scope.seleccionarVehiculo = function() { |
44 | $scope.seleccionarTransportista().then( | 44 | $scope.seleccionarTransportista().then( |
45 | function(transportista) { | 45 | function(transportista) { |
46 | elegirTransportista(transportista); | 46 | elegirTransportista(transportista); |
47 | 47 | ||
48 | var query = '/vehiculo/transportista/' + $scope.idTransportista; | 48 | var query = '/vehiculo/transportista/' + $scope.idTransportista; |
49 | var columnas = { | 49 | var columnas = { |
50 | nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], | 50 | nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], |
51 | propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] | 51 | propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] |
52 | }; | 52 | }; |
53 | var titulo = 'Búsqueda de vehículos'; | 53 | var titulo = 'Búsqueda de vehículos'; |
54 | 54 | ||
55 | focaModalService.modal(columnas, query, titulo).then( | 55 | focaModalService.modal(columnas, query, titulo).then( |
56 | function(vehiculo) { | 56 | function(vehiculo) { |
57 | $scope.$broadcast('addCabecera', { | 57 | $scope.$broadcast('addCabecera', { |
58 | label: 'Vehículo:', | 58 | label: 'Vehículo:', |
59 | valor: vehiculo.codigo | 59 | valor: vehiculo.codigo |
60 | }); | 60 | }); |
61 | $scope.cisternas = vehiculo.cisternas; | 61 | $scope.cisternas = vehiculo.cisternas; |
62 | getEstadosCisternas($scope.cisternas); | 62 | getEstadosCisternas($scope.cisternas); |
63 | }, function() {}); | 63 | }, function() { |
64 | }, function() {}); | 64 | $scope.seleccionarTransportista(); |
65 | }); | ||
66 | }); | ||
65 | }; | 67 | }; |
66 | 68 | ||
67 | $scope.seleccionarFechaEntrega = function() { | 69 | $scope.seleccionarFechaEntrega = function() { |
68 | focaModalService.modalFecha('Fecha').then(function(fecha) { | 70 | focaModalService.modalFecha('Fecha').then(function(fecha) { |
69 | $scope.$broadcast('addCabecera', { | 71 | $scope.$broadcast('addCabecera', { |
70 | label: 'Fecha:', | 72 | label: 'Fecha:', |
71 | valor: fecha.toLocaleDateString() | 73 | valor: fecha.toLocaleDateString() |
72 | }); | 74 | }); |
73 | $scope.fecha = fecha; | 75 | $scope.fecha = fecha; |
74 | if($scope.cisternas) | 76 | if($scope.cisternas) |
75 | getEstadosCisternas($scope.cisternas); | 77 | getEstadosCisternas($scope.cisternas); |
76 | }); | 78 | }); |
77 | }; | 79 | }; |
78 | 80 | ||
79 | $scope.seleccionarGrafico = function() { | 81 | $scope.seleccionarGrafico = function() { |
80 | if(!$scope.cisternas.length){ | 82 | if(!$scope.cisternas.length){ |
81 | focaModalService.alert('Primero seleccione un vehículo'); | 83 | focaModalService.alert('Primero seleccione un vehículo'); |
82 | return; | 84 | return; |
83 | } | 85 | } |
84 | $uibModal.open( | 86 | $uibModal.open( |
85 | { | 87 | { |
86 | ariaLabelledBy: 'Grafico de cisternas', | 88 | ariaLabelledBy: 'Grafico de cisternas', |
87 | templateUrl: 'modal-grafico-cisternas.html', | 89 | templateUrl: 'modal-grafico-cisternas.html', |
88 | controller: 'focaModalGraficoCisternasController', | 90 | controller: 'focaModalGraficoCisternasController', |
89 | size: 'md', | 91 | size: 'md', |
90 | resolve:{ | 92 | resolve:{ |
91 | filters: { | 93 | filters: { |
92 | cisternas: $scope.cisternas | 94 | cisternas: $scope.cisternas |
93 | } | 95 | } |
94 | } | 96 | } |
95 | } | 97 | } |
96 | ); | 98 | ); |
97 | }; | 99 | }; |
98 | 100 | ||
99 | function elegirTransportista(transportista) { | 101 | function elegirTransportista(transportista) { |
100 | var codigo = ('00000' + transportista.COD).slice(-5); | 102 | var codigo = ('00000' + transportista.COD).slice(-5); |
101 | $scope.idTransportista = transportista.COD; | 103 | $scope.idTransportista = transportista.COD; |
102 | $scope.filtros = transportista.NOM.trim(); | 104 | $scope.filtros = transportista.NOM.trim(); |
103 | $scope.$broadcast('addCabecera', { | 105 | $scope.$broadcast('addCabecera', { |
104 | label: 'Transportista:', | 106 | label: 'Transportista:', |
105 | valor: codigo + ' - ' + transportista.NOM | 107 | valor: codigo + ' - ' + transportista.NOM |
106 | }); | 108 | }); |
107 | } | 109 | } |
108 | 110 | ||
109 | function getEstadosCisternas(cisternas) { | 111 | function getEstadosCisternas(cisternas) { |
110 | cisternas.forEach(function(cisterna) { | 112 | cisternas.forEach(function(cisterna) { |
111 | focaEstadoCisternasService | 113 | focaEstadoCisternasService |
112 | .getEstadoCisterna(cisterna.id, $scope.fecha) | 114 | .getEstadoCisterna(cisterna.id, $scope.fecha) |
113 | .then(function(res) { | 115 | .then(function(res) { |
114 | cisterna.estado = res.data; | 116 | cisterna.estado = res.data; |
115 | }); | 117 | }); |
116 | }); | 118 | }); |
117 | } | 119 | } |
118 | } | 120 | } |
119 | ]); | 121 | ]); |
120 | 122 |
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" max="6" 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>Disponible</th> |
23 | <th>Producto</th> | 23 | <th>Producto</th> |
24 | </tr> | 24 | </tr> |
25 | </thead> | 25 | </thead> |
26 | <tbody> | 26 | <tbody> |
27 | <tr ng-repeat="cisterna in cisternas"> | 27 | <tr ng-repeat="cisterna in cisternas"> |
28 | <td ng-bind="cisterna.codigo"></td> | 28 | <td ng-bind="cisterna.codigo"></td> |
29 | <td ng-bind="cisterna.capacidad + ' ' + cisterna.unidadMedida.NOM"></td> | 29 | <td ng-bind="cisterna.capacidad + ' ' + cisterna.unidadMedida.NOM"></td> |
30 | <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> | 31 | <td ng-bind="cisterna.capacidad - cisterna.estado.cantidad"></td> |
32 | <td ng-bind="(cisterna.estado.producto) ? cisterna.estado.producto.DetArt : '-'"></td> | 32 | <td ng-bind="(cisterna.estado.producto) ? cisterna.estado.producto.DetArt : '-'"></td> |
33 | </tr> | 33 | </tr> |
34 | </body> | 34 | </body> |
35 | </table> | 35 | </table> |
36 | </div> | 36 | </div> |
37 | </div> | 37 | </div> |
38 | 38 |