Commit c29a9a6525995f84134ec24830e0e7af5287fb71
1 parent
aeef216e5d
Exists in
master
and in
1 other branch
descripcion correcta, espacios ok
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
package.json
1 | { | 1 | { |
2 | "name": "foca-estado-cisternas", | 2 | "name": "foca-estado-cisternas", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Abm de vehiculo", | 4 | "description": "Estado de cisternas", |
5 | "main": "index.html", | 5 | "main": "index.html", |
6 | "scripts": { | 6 | "scripts": { |
7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
8 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
9 | "gulp-pre-commit": "gulp pre-commit", | 9 | "gulp-pre-commit": "gulp pre-commit", |
10 | "postinstall": "npm run compile && gulp clean-post-install", | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
11 | "install-dev": "npm i --ignore-scripts" | 11 | "install-dev": "npm i --ignore-scripts" |
12 | }, | 12 | }, |
13 | "pre-commit": [ | 13 | "pre-commit": [ |
14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
15 | ], | 15 | ], |
16 | "repository": { | 16 | "repository": { |
17 | "type": "git", | 17 | "type": "git", |
18 | "url": "http://git.focasoftware.com/npm/foca-estado-cisternas.git" | 18 | "url": "http://git.focasoftware.com/npm/foca-estado-cisternas.git" |
19 | }, | 19 | }, |
20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
21 | "license": "ISC", | 21 | "license": "ISC", |
22 | "peerDependencies": { | 22 | "peerDependencies": { |
23 | "angular": "^1.7.x", | 23 | "angular": "^1.7.x", |
24 | "angular-route": "^1.7.x", | 24 | "angular-route": "^1.7.x", |
25 | "bootstrap": "^4.1.x", | 25 | "bootstrap": "^4.1.x", |
26 | "jquery": "^3.3.x", | 26 | "jquery": "^3.3.x", |
27 | "font-awesome": "^4.7.x", | 27 | "font-awesome": "^4.7.x", |
28 | "gulp": "^3.9.x", | 28 | "gulp": "^3.9.x", |
29 | "gulp-concat": "2.6.x", | 29 | "gulp-concat": "2.6.x", |
30 | "gulp-jshint": "^2.1.x", | 30 | "gulp-jshint": "^2.1.x", |
31 | "gulp-rename": "^1.4.x", | 31 | "gulp-rename": "^1.4.x", |
32 | "gulp-replace": "^1.0.x", | 32 | "gulp-replace": "^1.0.x", |
33 | "gulp-uglify-es": "^1.0.x", | 33 | "gulp-uglify-es": "^1.0.x", |
34 | "jshint": "^2.9.x", | 34 | "jshint": "^2.9.x", |
35 | "pump": "^3.0.x" | 35 | "pump": "^3.0.x" |
36 | }, | 36 | }, |
37 | "devDependencies": { | 37 | "devDependencies": { |
38 | "angular": "^1.7.5", | 38 | "angular": "^1.7.5", |
39 | "angular-route": "^1.7.5", | 39 | "angular-route": "^1.7.5", |
40 | "bootstrap": "^4.1.3", | 40 | "bootstrap": "^4.1.3", |
41 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", | 41 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", |
42 | "font-awesome": "^4.7.0", | 42 | "font-awesome": "^4.7.0", |
43 | "gulp": "^3.9.1", | 43 | "gulp": "^3.9.1", |
44 | "gulp-angular-templatecache": "^2.2.5", | 44 | "gulp-angular-templatecache": "^2.2.5", |
45 | "gulp-clean": "^0.4.0", | 45 | "gulp-clean": "^0.4.0", |
46 | "gulp-connect": "^5.6.1", | 46 | "gulp-connect": "^5.6.1", |
47 | "gulp-htmlmin": "^5.0.1", | 47 | "gulp-htmlmin": "^5.0.1", |
48 | "gulp-jshint": "^2.1.0", | 48 | "gulp-jshint": "^2.1.0", |
49 | "gulp-rename": "^1.4.0", | 49 | "gulp-rename": "^1.4.0", |
50 | "gulp-replace": "^1.0.0", | 50 | "gulp-replace": "^1.0.0", |
51 | "gulp-uglify": "^3.0.1", | 51 | "gulp-uglify": "^3.0.1", |
52 | "gulp-uglify-es": "^1.0.4", | 52 | "gulp-uglify-es": "^1.0.4", |
53 | "jasmine-core": "^3.3.0", | 53 | "jasmine-core": "^3.3.0", |
54 | "jquery": "^3.3.1", | 54 | "jquery": "^3.3.1", |
55 | "jshint": "^2.9.6", | 55 | "jshint": "^2.9.6", |
56 | "pre-commit": "^1.2.2", | 56 | "pre-commit": "^1.2.2", |
57 | "pump": "^3.0.0", | 57 | "pump": "^3.0.0", |
58 | "ui-bootstrap4": "^3.0.5" | 58 | "ui-bootstrap4": "^3.0.5" |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 |
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', '$location', 'focaModalService', |
4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', | 4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', |
5 | function($scope, focaEstadoCisternasService, $location, focaModalService, | 5 | function($scope, focaEstadoCisternasService, $location, 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 = [{ |
12 | label: 'Transportista', | 12 | label: 'Transportista', |
13 | image: 'transportista.png' | 13 | image: 'transportista.png' |
14 | }, | 14 | }, |
15 | { | 15 | { |
16 | label: 'Vehiculo', | 16 | label: 'Vehiculo', |
17 | image: 'vehiculos.png' | 17 | image: 'vehiculos.png' |
18 | }, | 18 | }, |
19 | { | 19 | { |
20 | label: 'Fecha', | 20 | label: 'Fecha', |
21 | image: 'fechaDeReparto.png' | 21 | image: 'fechaDeReparto.png' |
22 | }]; | 22 | }]; |
23 | 23 | ||
24 | //SETEO BOTONERA LATERAL | 24 | //SETEO BOTONERA LATERAL |
25 | focaBotoneraLateralService.showSalir(true); | 25 | focaBotoneraLateralService.showSalir(true); |
26 | focaBotoneraLateralService.showPausar(false); | 26 | focaBotoneraLateralService.showPausar(false); |
27 | focaBotoneraLateralService.showCancelar(false); | 27 | focaBotoneraLateralService.showCancelar(false); |
28 | focaBotoneraLateralService.showGuardar(false); | 28 | focaBotoneraLateralService.showGuardar(false); |
29 | 29 | ||
30 | $timeout(function() { | 30 | $timeout(function() { |
31 | $scope.$broadcast('addCabecera',{ | 31 | $scope.$broadcast('addCabecera', { |
32 | label: 'Fecha:', | 32 | label: 'Fecha:', |
33 | valor: $scope.fecha.toLocaleDateString() | 33 | valor: $scope.fecha.toLocaleDateString() |
34 | }); | 34 | }); |
35 | }); | 35 | }); |
36 | 36 | ||
37 | $scope.seleccionarTransportista = function() { | 37 | $scope.seleccionarTransportista = function() { |
38 | var modalInstance = $uibModal.open( | 38 | var modalInstance = $uibModal.open( |
39 | { | 39 | { |
40 | ariaLabelledBy: 'Busqueda de Transportista', | 40 | ariaLabelledBy: 'Busqueda de Transportista', |
41 | templateUrl: 'modal-proveedor.html', | 41 | templateUrl: 'modal-proveedor.html', |
42 | controller: 'focaModalProveedorCtrl', | 42 | controller: 'focaModalProveedorCtrl', |
43 | size: 'lg', | 43 | size: 'lg', |
44 | resolve: { | 44 | resolve: { |
45 | transportista: function() { | 45 | transportista: function() { |
46 | return true; | 46 | return true; |
47 | } | 47 | } |
48 | } | 48 | } |
49 | } | 49 | } |
50 | ); | 50 | ); |
51 | modalInstance.result.then( | 51 | modalInstance.result.then( |
52 | function(transportista) { | 52 | function(transportista) { |
53 | elegirTransportista(transportista); | 53 | elegirTransportista(transportista); |
54 | }, function() { | 54 | }, function() { |
55 | 55 | ||
56 | } | 56 | } |
57 | ); | 57 | ); |
58 | }; | 58 | }; |
59 | 59 | ||
60 | $scope.seleccionarVehiculo = function() { | 60 | $scope.seleccionarVehiculo = function() { |
61 | if(!$scope.idTransportista){ | 61 | if(!$scope.idTransportista) { |
62 | focaModalService.alert('Primero seleccione un transportista'); | 62 | focaModalService.alert('Primero seleccione un transportista'); |
63 | return; | 63 | return; |
64 | } | 64 | } |
65 | var query = '/vehiculo/transportista/' + $scope.idTransportista; | 65 | var query = '/vehiculo/transportista/' + $scope.idTransportista; |
66 | var columnas = { | 66 | var columnas = { |
67 | nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], | 67 | nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], |
68 | propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] | 68 | propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] |
69 | }; | 69 | }; |
70 | var titulo = 'Búsqueda de vehículos'; | 70 | var titulo = 'Búsqueda de vehículos'; |
71 | 71 | ||
72 | focaModalService.modal(columnas, query, titulo).then( | 72 | focaModalService.modal(columnas, query, titulo).then( |
73 | function(vehiculo) { | 73 | function(vehiculo) { |
74 | $scope.$broadcast('addCabecera', { | 74 | $scope.$broadcast('addCabecera', { |
75 | label: 'Vehículo:', | 75 | label: 'Vehículo:', |
76 | valor: vehiculo.codigo | 76 | valor: vehiculo.codigo |
77 | }); | 77 | }); |
78 | $scope.cisternas = vehiculo.cisternas; | 78 | $scope.cisternas = vehiculo.cisternas; |
79 | getEstadosCisternas($scope.cisternas); | 79 | getEstadosCisternas($scope.cisternas); |
80 | }, function() { | 80 | }, function() { |
81 | // funcion ejecutada cuando se cancela el modal | 81 | // funcion ejecutada cuando se cancela el modal |
82 | }); | 82 | }); |
83 | }; | 83 | }; |
84 | 84 | ||
85 | $scope.seleccionarFecha = function() { | 85 | $scope.seleccionarFecha = function() { |
86 | focaModalService.modalFecha('Fecha').then(function(fecha) { | 86 | focaModalService.modalFecha('Fecha').then(function(fecha) { |
87 | $scope.$broadcast('addCabecera',{ | 87 | $scope.$broadcast('addCabecera', { |
88 | label: 'Fecha:', | 88 | label: 'Fecha:', |
89 | valor: fecha.toLocaleDateString() | 89 | valor: fecha.toLocaleDateString() |
90 | }); | 90 | }); |
91 | $scope.fecha = fecha; | 91 | $scope.fecha = fecha; |
92 | if($scope.cisternas) | 92 | if($scope.cisternas) |
93 | getEstadosCisternas($scope.cisternas); | 93 | getEstadosCisternas($scope.cisternas); |
94 | }); | 94 | }); |
95 | }; | 95 | }; |
96 | 96 | ||
97 | function elegirTransportista(transportista) { | 97 | function elegirTransportista(transportista) { |
98 | var codigo = ('00000' + transportista.COD).slice(-5); | 98 | var codigo = ('00000' + transportista.COD).slice(-5); |
99 | $scope.idTransportista = transportista.COD; | 99 | $scope.idTransportista = transportista.COD; |
100 | $scope.filtros = transportista.NOM.trim(); | 100 | $scope.filtros = transportista.NOM.trim(); |
101 | $scope.$broadcast('addCabecera', { | 101 | $scope.$broadcast('addCabecera', { |
102 | label: 'Transportista:', | 102 | label: 'Transportista:', |
103 | valor: codigo + ' - ' + transportista.NOM | 103 | valor: codigo + ' - ' + transportista.NOM |
104 | }); | 104 | }); |
105 | } | 105 | } |
106 | 106 | ||
107 | function getEstadosCisternas(cisternas) { | 107 | function getEstadosCisternas(cisternas) { |
108 | cisternas.forEach(function(cisterna) { | 108 | cisternas.forEach(function(cisterna) { |
109 | focaEstadoCisternasService | 109 | focaEstadoCisternasService |
110 | .getEstadoCisterna(cisterna.id, $scope.fecha) | 110 | .getEstadoCisterna(cisterna.id, $scope.fecha) |
111 | .then(function(res) { | 111 | .then(function(res) { |
112 | cisterna.estado = res.data; | 112 | cisterna.estado = res.data; |
113 | }); | 113 | }); |
114 | }); | 114 | }); |
115 | } | 115 | } |
116 | } | 116 | } |
117 | ]); | 117 | ]); |
118 | 118 |