Commit c46beb118786ea7bc12d7628f9798a6bb612f56c
Exists in
master
Merge branch 'master' into 'develop'
Master See merge request !45
Showing
4 changed files
Show diff stats
package.json
1 | { | 1 | { |
2 | "name": "foca-abm-vehiculo", | 2 | "name": "foca-abm-vehiculo", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Abm de vehiculo", | 4 | "description": "Abm de vehiculo", |
5 | "main": "index.html", | 5 | "main": "index.html", |
6 | "scripts": { | 6 | "scripts": { |
7 | "test": "test.html", | 7 | "test": "test.html", |
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 install -D angular bootstrap ui-bootstrap4 font-awesome jquery gulp gulp-connect jasmine-core pre-commit gulp-angular-templatecache gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify-es gulp-uglify gulp-clean jshint pump git+http://git.focasoftware.com/npm/foca-modal.git" | 11 | "install-dev": "npm install -D angular bootstrap ui-bootstrap4 font-awesome jquery gulp gulp-connect jasmine-core pre-commit gulp-angular-templatecache gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify-es gulp-uglify gulp-clean jshint pump git+http://git.focasoftware.com/npm/foca-modal.git" |
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-abm-vehiculo.git" | 18 | "url": "http://git.focasoftware.com/npm/foca-abm-vehiculo.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.8", |
39 | "angular-mocks": "^1.7.8", | 39 | "angular-mocks": "^1.7.8", |
40 | "angular-route": "^1.7.7", | 40 | "angular-route": "^1.7.8", |
41 | "bootstrap": "^4.1.3", | 41 | "bootstrap": "^4.1.3", |
42 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", | 42 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", |
43 | "font-awesome": "^4.7.0", | 43 | "font-awesome": "^4.7.0", |
44 | "gulp": "^3.9.1", | 44 | "gulp": "^3.9.1", |
45 | "gulp-angular-templatecache": "^2.2.5", | 45 | "gulp-angular-templatecache": "^2.2.7", |
46 | "gulp-clean": "^0.4.0", | 46 | "gulp-clean": "^0.4.0", |
47 | "gulp-connect": "^5.6.1", | 47 | "gulp-connect": "^5.6.1", |
48 | "gulp-footer": "^2.0.2", | 48 | "gulp-footer": "^2.0.2", |
49 | "gulp-header": "^2.0.7", | 49 | "gulp-header": "^2.0.7", |
50 | "gulp-htmlmin": "^5.0.1", | 50 | "gulp-htmlmin": "^5.0.1", |
51 | "gulp-jshint": "^2.1.0", | 51 | "gulp-jshint": "^2.1.0", |
52 | "gulp-rename": "^1.4.0", | 52 | "gulp-rename": "^1.4.0", |
53 | "gulp-replace": "^1.0.0", | 53 | "gulp-replace": "^1.0.0", |
54 | "gulp-uglify": "^3.0.1", | 54 | "gulp-uglify": "^3.0.1", |
55 | "gulp-uglify-es": "^1.0.4", | 55 | "gulp-uglify-es": "^1.0.4", |
56 | "jasmine": "^3.3.1", | 56 | "jasmine": "^3.4.0", |
57 | "jasmine-core": "^3.3.0", | 57 | "jasmine-core": "^3.4.0", |
58 | "jquery": "^3.3.1", | 58 | "jquery": "^3.4.1", |
59 | "jshint": "^2.9.6", | 59 | "jshint": "^2.10.2", |
60 | "pre-commit": "^1.2.2", | 60 | "pre-commit": "^1.2.2", |
61 | "pump": "^3.0.0", | 61 | "pump": "^3.0.0", |
62 | "ui-bootstrap4": "^3.0.5" | 62 | "ui-bootstrap4": "^3.0.5" |
63 | } | 63 | } |
64 | } | 64 | } |
65 | 65 |
src/js/controller.js
1 | angular.module('focaAbmVehiculo') | 1 | angular.module('focaAbmVehiculo') |
2 | .controller('focaAbmVehiculosController', [ | 2 | .controller('focaAbmVehiculosController', [ |
3 | '$scope', 'focaAbmVehiculoService', '$location', 'focaModalService', | 3 | '$scope', 'focaAbmVehiculoService', '$location', 'focaModalService', |
4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', '$localStorage', | 4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', '$localStorage', |
5 | function ($scope, focaAbmVehiculoService, $location, focaModalService, | 5 | function ($scope, focaAbmVehiculoService, $location, focaModalService, |
6 | $uibModal, focaBotoneraLateralService, $timeout, $localStorage) { | 6 | $uibModal, focaBotoneraLateralService, $timeout, $localStorage) { |
7 | 7 | ||
8 | $scope.now = new Date(); | 8 | $scope.now = new Date(); |
9 | $scope.botonera = [{ | 9 | $scope.botonera = [{ |
10 | label: 'Transportista', | 10 | label: 'Transportista', |
11 | image: 'cliente.png' | 11 | image: 'cliente.png' |
12 | }]; | 12 | }]; |
13 | 13 | ||
14 | focaAbmVehiculoService.cleanCisternas(); | 14 | focaAbmVehiculoService.cleanCisternas(); |
15 | 15 | ||
16 | //SETEO BOTONERA LATERAL | 16 | //SETEO BOTONERA LATERAL |
17 | focaBotoneraLateralService.showSalir(false); | 17 | focaBotoneraLateralService.showSalir(false); |
18 | focaBotoneraLateralService.showPausar(false); | 18 | focaBotoneraLateralService.showPausar(false); |
19 | focaBotoneraLateralService.showCancelar(false); | 19 | focaBotoneraLateralService.showCancelar(false); |
20 | focaBotoneraLateralService.showGuardar(false); | 20 | focaBotoneraLateralService.showGuardar(false); |
21 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 21 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
22 | 22 | ||
23 | if (focaAbmVehiculoService.transportistaSeleccionado.COD) { | 23 | if (focaAbmVehiculoService.transportistaSeleccionado.COD) { |
24 | elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); | 24 | elegirTransportista(focaAbmVehiculoService.transportistaSeleccionado); |
25 | } | 25 | } |
26 | $scope.editar = function (id) { | 26 | $scope.editar = function (id) { |
27 | $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); | 27 | $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); |
28 | }; | 28 | }; |
29 | |||
29 | $scope.solicitarConfirmacion = function (vehiculo) { | 30 | $scope.solicitarConfirmacion = function (vehiculo) { |
30 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + | 31 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + |
31 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( | 32 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( |
32 | function (data) { | 33 | function (data) { |
33 | if (data) { | 34 | if (data) { |
34 | focaAbmVehiculoService.deleteVehiculo(vehiculo.id); | 35 | focaAbmVehiculoService.deleteVehiculo(vehiculo.id); |
35 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | 36 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); |
36 | } | 37 | } |
37 | } | 38 | } |
38 | ); | 39 | ); |
39 | }; | 40 | }; |
40 | $scope.seleccionarTransportista = function () { | 41 | $scope.seleccionarTransportista = function () { |
41 | var parametrosModal = { | 42 | var parametrosModal = { |
42 | titulo: 'Búsqueda de Transportista', | 43 | titulo: 'Búsqueda de Transportista', |
43 | query: '/transportista', | 44 | query: '/transportista', |
44 | columnas: [ | 45 | columnas: [ |
45 | { | 46 | { |
46 | nombre: 'Código', | 47 | nombre: 'Código', |
47 | propiedad: 'COD' | 48 | propiedad: 'COD' |
48 | }, | 49 | }, |
49 | { | 50 | { |
50 | nombre: 'Nombre', | 51 | nombre: 'Nombre', |
51 | propiedad: 'NOM' | 52 | propiedad: 'NOM' |
52 | }, | 53 | }, |
53 | { | 54 | { |
54 | nombre: 'CUIT', | 55 | nombre: 'CUIT', |
55 | propiedad: 'CUIT' | 56 | propiedad: 'CUIT' |
56 | } | 57 | } |
57 | ] | 58 | ] |
58 | }; | 59 | }; |
59 | focaModalService.modal(parametrosModal).then( | 60 | focaModalService.modal(parametrosModal).then( |
60 | function (transportista) { | 61 | function (transportista) { |
61 | elegirTransportista(transportista); | 62 | elegirTransportista(transportista); |
62 | focaAbmVehiculoService.transportistaSeleccionado = transportista; | 63 | focaAbmVehiculoService.transportistaSeleccionado = transportista; |
63 | }, function () { | 64 | }, function () { |
64 | 65 | ||
65 | } | 66 | } |
66 | ); | 67 | ); |
67 | }; | 68 | }; |
68 | function elegirTransportista(transportista) { | 69 | function elegirTransportista(transportista) { |
69 | var codigo = ('00000' + transportista.COD).slice(-5); | 70 | var codigo = ('00000' + transportista.COD).slice(-5); |
70 | $scope.idTransportista = transportista.COD; | 71 | $scope.idTransportista = transportista.COD; |
71 | $scope.filtros = transportista.NOM.trim(); | 72 | $scope.filtros = transportista.NOM.trim(); |
72 | $timeout(function () { | 73 | $timeout(function () { |
73 | $scope.$broadcast('addCabecera', { | 74 | $scope.$broadcast('addCabecera', { |
74 | label: 'Transportista:', | 75 | label: 'Transportista:', |
75 | valor: codigo + ' - ' + transportista.NOM | 76 | valor: codigo + ' - ' + transportista.NOM |
76 | }); | 77 | }); |
77 | }); | 78 | }); |
78 | buscar(transportista.COD); | 79 | buscar(transportista.COD); |
79 | } | 80 | } |
80 | 81 | ||
81 | function buscar(idTransportista) { | 82 | function buscar(idTransportista) { |
82 | focaAbmVehiculoService | 83 | focaAbmVehiculoService |
83 | .getVehiculosPorTransportista(idTransportista) | 84 | .getVehiculosPorTransportista(idTransportista) |
84 | .then(function (datos) { | 85 | .then(function (datos) { |
85 | $scope.vehiculos = datos.data; | 86 | $scope.vehiculos = datos.data; |
86 | }); | 87 | }); |
87 | } | 88 | } |
88 | function salir() { | 89 | function salir() { |
89 | focaAbmVehiculoService.transportistaSeleccionado = {}; | 90 | focaAbmVehiculoService.transportistaSeleccionado = {}; |
90 | $location.path('/'); | 91 | $location.path('/'); |
91 | } | 92 | } |
92 | } | 93 | } |
93 | ]) | 94 | ]) |
94 | .controller('focaAbmVehiculoController', [ | 95 | .controller('focaAbmVehiculoController', [ |
95 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', | 96 | '$scope', 'focaAbmVehiculoService', '$routeParams', '$location', '$uibModal', |
96 | 'focaModalService', '$timeout', 'focaBotoneraLateralService', '$localStorage', '$filter', | 97 | 'focaModalService', '$timeout', 'focaBotoneraLateralService', '$localStorage', '$filter', |
97 | function ($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, | 98 | function ($scope, focaAbmVehiculoService, $routeParams, $location, $uibModal, |
98 | focaModalService, $timeout, focaBotoneraLateralService, $localStorage, $filter) { | 99 | focaModalService, $timeout, focaBotoneraLateralService, $localStorage, $filter) { |
99 | $scope.nuevo = $routeParams.idVehiculo === '0' ? true : false; | 100 | $scope.nuevo = $routeParams.idVehiculo === '0' ? true : false; |
100 | $scope.nuevoCisterna = ($routeParams.idx > -1) ? false : true; | 101 | $scope.nuevoCisterna = ($routeParams.idx > -1) ? false : true; |
101 | $scope.now = new Date(); | 102 | $scope.now = new Date(); |
102 | $scope.focused = 1; | 103 | $scope.focused = 1; |
103 | $scope.creando = false; | 104 | $scope.creando = false; |
104 | $scope.crear = false; | 105 | $scope.crear = false; |
105 | $scope.transportistaStamp = ''; | 106 | $scope.transportistaStamp = ''; |
106 | $scope.cisternas = []; | 107 | $scope.cisternas = []; |
107 | 108 | ||
108 | $timeout(function () { | 109 | $timeout(function () { |
109 | focaBotoneraLateralService.showSalir(false); | 110 | focaBotoneraLateralService.showSalir(false); |
110 | focaBotoneraLateralService.showPausar(true); | 111 | focaBotoneraLateralService.showPausar(true); |
111 | focaBotoneraLateralService.showCancelar(false); | 112 | focaBotoneraLateralService.showCancelar(false); |
112 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | 113 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); |
113 | focaBotoneraLateralService.addCustomButton('Salir', $scope.salir); | 114 | focaBotoneraLateralService.addCustomButton('Salir', $scope.salir); |
114 | }); | 115 | }); |
115 | 116 | ||
116 | if ($scope.nuevo) { | 117 | if ($scope.nuevo) { |
117 | focaAbmVehiculoService | 118 | focaAbmVehiculoService |
118 | .getTransportistaPorId($routeParams.idTransportista) | 119 | .getTransportistaPorId($routeParams.idTransportista) |
119 | .then(function (res) { | 120 | .then(function (res) { |
120 | var codigo = ('00000' + res.data.COD).slice(-5); | 121 | var codigo = ('00000' + res.data[0].COD).slice(-5); |
121 | $scope.vehiculo.idTransportista = res.data.COD; | 122 | $scope.vehiculo.idTransportista = res.data[0].COD; |
122 | $scope.vehiculo.transportista = res.data; | 123 | $scope.vehiculo.transportista = res.data; |
123 | $scope.$broadcast('addCabecera', { | 124 | $scope.$broadcast('addCabecera', { |
124 | label: 'Transportista:', | 125 | label: 'Transportista:', |
125 | valor: codigo + ' - ' + res.data.NOM | 126 | valor: codigo + ' - ' + res.data[0].ALI |
126 | }); | 127 | }); |
127 | }); | 128 | }); |
128 | } | 129 | } |
129 | $scope.vehiculo = {}; | 130 | $scope.vehiculo = {}; |
130 | 131 | ||
131 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function (res) { | 132 | focaAbmVehiculoService.getVehiculo($routeParams.idVehiculo).then(function (res) { |
132 | 133 | ||
133 | if (res.data) { | 134 | if (res.data) { |
134 | var vehiculoSeteado = getLSVehiculo(); | 135 | var vehiculoSeteado = getLSVehiculo(); |
135 | if (vehiculoSeteado === false) { | 136 | if (vehiculoSeteado === false) { |
136 | $scope.transportistaStamp = ('00000' + res.data.transportista.COD).slice(-5); | 137 | $scope.transportistaStamp = ('00000' + res.data.transportista.COD).slice(-5); |
137 | $scope.transportistaStamp += ' - ' + res.data.transportista.NOM; | 138 | $scope.transportistaStamp += ' - ' + res.data.transportista.NOM; |
138 | 139 | ||
139 | $scope.vehiculo = res.data; | 140 | $scope.vehiculo = res.data; |
140 | $scope.$broadcast('addCabecera', { | 141 | $scope.$broadcast('addCabecera', { |
141 | label: 'Transportista:', | 142 | label: 'Transportista:', |
142 | valor: $scope.transportistaStamp | 143 | valor: $scope.transportistaStamp |
143 | }); | 144 | }); |
144 | $scope.$broadcast('addCabecera', { | 145 | $scope.$broadcast('addCabecera', { |
145 | label: 'Unidad:', | 146 | label: 'Unidad:', |
146 | valor: res.data.codigo | 147 | valor: res.data.codigo |
147 | }); | 148 | }); |
148 | } | 149 | } |
149 | 150 | ||
150 | focaAbmVehiculoService | 151 | focaAbmVehiculoService |
151 | .getCisternas($routeParams.idVehiculo) | 152 | .getCisternas($routeParams.idVehiculo) |
152 | .then(function (res) { | 153 | .then(function (res) { |
153 | $scope.cisternas = res; | 154 | $scope.cisternas = res; |
154 | $scope.$apply(); | 155 | $scope.$apply(); |
155 | }); | 156 | }); |
156 | } | 157 | } |
157 | }); | 158 | }); |
158 | 159 | ||
159 | $scope.next = function (key) { | 160 | $scope.next = function (key) { |
160 | if (key === 13) $scope.focused++; | 161 | if (key === 13) $scope.focused++; |
161 | }; | 162 | }; |
162 | 163 | ||
163 | $scope.salir = function () { | 164 | $scope.salir = function () { |
164 | if (!$scope.formVehiculo.$pristine && focaAbmVehiculoService.cisternasPristine) { | 165 | if (!$scope.formVehiculo.$pristine && focaAbmVehiculoService.cisternasPristine) { |
165 | focaModalService.confirm( | 166 | focaModalService.confirm( |
166 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 167 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
167 | ).then(function (data) { | 168 | ).then(function (data) { |
168 | if (data) { | 169 | if (data) { |
169 | $location.path('/vehiculo'); | 170 | $location.path('/vehiculo'); |
170 | } | 171 | } |
171 | }); | 172 | }); |
172 | } else { | 173 | } else { |
173 | $location.path('/vehiculo'); | 174 | $location.path('/vehiculo'); |
174 | } | 175 | } |
175 | }; | 176 | }; |
176 | 177 | ||
177 | $scope.editar = function (cisterna) { | 178 | $scope.editar = function (cisterna) { |
178 | $scope.cisternas.forEach(function (cisterna) { | 179 | $scope.cisternas.forEach(function (cisterna) { |
179 | cisterna.editando = false; | 180 | cisterna.editando = false; |
180 | $scope.crear = true; | 181 | $scope.crear = true; |
181 | }); | 182 | }); |
182 | cisterna.editando = true; | 183 | cisterna.editando = true; |
183 | $scope.inicial = angular.copy(cisterna); | 184 | $scope.inicial = angular.copy(cisterna); |
184 | }; | 185 | }; |
185 | 186 | ||
186 | $scope.volver = function (cisterna, key) { | 187 | $scope.volver = function (cisterna, key) { |
187 | if (cisterna.id === undefined || !$scope.crear) { | 188 | if (cisterna.id === undefined || !$scope.crear) { |
188 | $scope.cisternas.shift(cisterna); | 189 | $scope.cisternas.shift(cisterna); |
189 | $scope.crear = false; | 190 | $scope.crear = false; |
190 | return; | 191 | return; |
191 | } | 192 | } |
192 | if (cisterna.id !== undefined) { | 193 | if (cisterna.id !== undefined) { |
193 | $scope.cisternas[key] = $scope.inicial; | 194 | $scope.cisternas[key] = $scope.inicial; |
194 | $scope.cisternas[key].editando = false; | 195 | $scope.cisternas[key].editando = false; |
195 | } | 196 | } |
196 | $scope.crear = false; | 197 | $scope.crear = false; |
197 | }; | 198 | }; |
198 | 199 | ||
199 | $scope.crearCisterna = function () { | 200 | $scope.crearCisterna = function () { |
200 | var cisterna = { | 201 | var cisterna = { |
201 | codigo: '', | 202 | codigo: '', |
202 | capacidad: '', | 203 | capacidad: '', |
203 | idUnidadMedida: 0, | 204 | idUnidadMedida: 0, |
204 | unidadMedida: {}, | 205 | unidadMedida: {}, |
205 | editando: true, | 206 | editando: true, |
206 | }; | 207 | }; |
207 | $scope.cisternas.unshift(cisterna); | 208 | $scope.cisternas.unshift(cisterna); |
208 | $scope.crear = true; | 209 | $scope.crear = true; |
209 | }; | 210 | }; |
210 | 211 | ||
211 | $scope.seleccionarUnidadMedida = function (cisterna) { | 212 | $scope.seleccionarUnidadMedida = function (cisterna) { |
212 | var modalInstance = $uibModal.open( | 213 | var modalInstance = $uibModal.open( |
213 | { | 214 | { |
214 | ariaLabelledBy: 'Busqueda de Unidades de medida', | 215 | ariaLabelledBy: 'Busqueda de Unidades de medida', |
215 | templateUrl: 'modal-unidad-medida.html', | 216 | templateUrl: 'modal-unidad-medida.html', |
216 | controller: 'focaModalUnidadMedidaCtrl', | 217 | controller: 'focaModalUnidadMedidaCtrl', |
217 | size: 'lg' | 218 | size: 'lg' |
218 | } | 219 | } |
219 | ); | 220 | ); |
220 | modalInstance.result.then(function (unidaMedida) { | 221 | modalInstance.result.then(function (unidaMedida) { |
221 | cisterna.idUnidadMedida = unidaMedida.ID; | 222 | cisterna.idUnidadMedida = unidaMedida.ID; |
222 | cisterna.unidadMedida = unidaMedida; | 223 | cisterna.unidadMedida = unidaMedida; |
223 | }); | 224 | }); |
224 | }; | 225 | }; |
225 | 226 | ||
226 | $scope.guardar = function (key) { | 227 | $scope.guardar = function (key) { |
227 | key = (typeof key === 'undefined') ? 13 : key; | 228 | key = (typeof key === 'undefined') ? 13 : key; |
228 | 229 | ||
229 | if (key === 13) { | 230 | if (key === 13) { |
230 | 231 | ||
231 | if ($scope.formVehiculo.$pristine && focaAbmVehiculoService.cisternasPristine) { | 232 | if ($scope.formVehiculo.$pristine && focaAbmVehiculoService.cisternasPristine) { |
232 | $scope.salir(); | 233 | $scope.salir(); |
233 | return; | 234 | return; |
234 | } | 235 | } |
235 | $scope.cisternas.forEach(function (cisterna) { | 236 | $scope.cisternas.forEach(function (cisterna) { |
236 | if (cisterna.id === 0) cisterna.id = undefined; | 237 | if (cisterna.id === 0) cisterna.id = undefined; |
237 | }); | 238 | }); |
238 | 239 | ||
239 | if (!$scope.vehiculo.codigo) { | 240 | if (!$scope.vehiculo.codigo) { |
240 | focaModalService.alert('Ingrese unidad'); | 241 | focaModalService.alert('Ingrese unidad'); |
241 | return; | 242 | return; |
242 | } else if (!$scope.vehiculo.tractor) { | 243 | } else if (!$scope.vehiculo.tractor) { |
243 | focaModalService.alert('Ingrese dominio tractor'); | 244 | focaModalService.alert('Ingrese dominio tractor'); |
244 | return; | 245 | return; |
245 | } else if (!$scope.vehiculo.semi) { | 246 | } else if (!$scope.vehiculo.semi) { |
246 | focaModalService.alert('Ingrese dominio semi'); | 247 | focaModalService.alert('Ingrese dominio semi'); |
247 | return; | 248 | return; |
248 | } else if (!$scope.vehiculo.capacidad) { | 249 | } else if (!$scope.vehiculo.capacidad) { |
249 | focaModalService.alert('Ingrese capacidad total'); | 250 | focaModalService.alert('Ingrese capacidad total'); |
250 | return; | 251 | return; |
251 | } | 252 | } |
252 | //Valida si existe numero de unidad | 253 | //Valida si existe numero de unidad |
253 | if (!validaTotalCargas() && !$scope.nuevo) { | 254 | if (!validaTotalCargas() && !$scope.nuevo) { |
254 | focaModalService.alert('La suma de las capacidades de las cisternas' + | 255 | focaModalService.alert('La suma de las capacidades de las cisternas' + |
255 | ' debe ser igual a la capacidad total del vehículo'); | 256 | ' debe ser igual a la capacidad total del vehículo'); |
256 | return; | 257 | return; |
257 | } | 258 | } |
258 | 259 | ||
259 | validaCodigoUnidad().then(function () { | 260 | validaCodigoUnidad().then(function () { |
260 | delete $scope.vehiculo.transportista; | 261 | delete $scope.vehiculo.transportista; |
261 | delete $scope.vehiculo.cisternas; | 262 | delete $scope.vehiculo.cisternas; |
262 | focaAbmVehiculoService.guardarVehiculo($scope.vehiculo) | 263 | focaAbmVehiculoService.guardarVehiculo($scope.vehiculo) |
263 | .then(function (res) { | 264 | .then(function (res) { |
264 | if ($scope.nuevo) { | 265 | if ($scope.nuevo) { |
265 | $location.path('/vehiculo/' + res.data.id + | 266 | $location.path('/vehiculo/' + res.data.id + |
266 | '/' + res.data.idTransportista); | 267 | '/' + res.data.idTransportista); |
267 | } else { | 268 | } else { |
268 | guardarCisternas($scope.cisternas).then(function () { | 269 | guardarCisternas($scope.cisternas).then(function () { |
269 | $location.path('/vehiculo'); | 270 | $location.path('/vehiculo'); |
270 | }); | 271 | }); |
271 | } | 272 | } |
272 | }); | 273 | }); |
273 | }, function () { | 274 | }, function () { |
274 | focaModalService.alert('Código de unidad existente'); | 275 | focaModalService.alert('Código de unidad existente'); |
275 | }); | 276 | }); |
276 | } | 277 | } |
277 | }; | 278 | }; |
278 | //Agregar propiedades de cisterna | 279 | //Agregar propiedades de cisterna |
279 | $scope.$watch('vehiculo', function (newValue) { | 280 | $scope.$watch('vehiculo', function (newValue) { |
280 | focaBotoneraLateralService.setPausarData({ | 281 | focaBotoneraLateralService.setPausarData({ |
281 | label: 'vehiculo', | 282 | label: 'vehiculo', |
282 | val: { | 283 | val: { |
283 | codigo: newValue.codigo, | 284 | codigo: newValue.codigo, |
284 | tractor: newValue.tractor, | 285 | tractor: newValue.tractor, |
285 | semi: newValue.semi, | 286 | semi: newValue.semi, |
286 | capacidad: newValue.capacidad, | 287 | capacidad: newValue.capacidad, |
287 | idVehiculo: newValue.idVehiculo, | 288 | idVehiculo: newValue.idVehiculo, |
288 | idTransportista: newValue.idTransportista | 289 | idTransportista: newValue.idTransportista |
289 | } | 290 | } |
290 | }); | 291 | }); |
291 | }, true); | 292 | }, true); |
292 | 293 | ||
293 | function getLSVehiculo() { | 294 | function getLSVehiculo() { |
294 | var vehiculo = JSON.parse($localStorage.vehiculo || null); | 295 | var vehiculo = JSON.parse($localStorage.vehiculo || null); |
295 | if (vehiculo) { | 296 | if (vehiculo) { |
296 | setearVehiculo(vehiculo); | 297 | setearVehiculo(vehiculo); |
297 | delete $localStorage.vehiculo; | 298 | delete $localStorage.vehiculo; |
298 | return true; | 299 | return true; |
299 | } | 300 | } |
300 | return false; | 301 | return false; |
301 | } | 302 | } |
302 | 303 | ||
303 | function setearVehiculo(vehiculo) { | 304 | function setearVehiculo(vehiculo) { |
304 | $scope.vehiculo = vehiculo; | 305 | $scope.vehiculo = vehiculo; |
305 | $scope.$broadcast('addCabecera', { | 306 | $scope.$broadcast('addCabecera', { |
306 | label: 'Vehiculo:', | 307 | label: 'Vehiculo:', |
307 | valor: $filter('rellenarDigitos')(vehiculo.codigo) + ' - ' | 308 | valor: $filter('rellenarDigitos')(vehiculo.codigo) + ' - ' |
308 | }); | 309 | }); |
309 | } | 310 | } |
310 | 311 | ||
311 | $scope.solicitarConfirmacionTabla = function (cisterna) { | 312 | $scope.solicitarConfirmacionTabla = function (cisterna) { |
312 | focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' + cisterna.id + ' ' + cisterna.codigo + ' ?') | 313 | focaModalService.confirm('¿Está seguro que desea borrar la cisterna ' + cisterna.id + ' ' + cisterna.codigo + ' ?') |
313 | .then(function (data) { | 314 | .then(function (data) { |
314 | if (data) { | 315 | if (data) { |
315 | cisterna.desactivado = true; | 316 | cisterna.desactivado = true; |
316 | } | 317 | } |
317 | }); | 318 | }); |
318 | return; | 319 | return; |
319 | }; | 320 | }; |
320 | 321 | ||
321 | function validaCodigoUnidad() { | 322 | function validaCodigoUnidad() { |
322 | return new Promise(function (resolve, reject) { | 323 | return new Promise(function (resolve, reject) { |
323 | focaAbmVehiculoService | 324 | focaAbmVehiculoService |
324 | .getVehiculosPorTransportista(parseInt($routeParams.idTransportista)) | 325 | .getVehiculosPorTransportista(parseInt($routeParams.idTransportista)) |
325 | .then(function (res) { | 326 | .then(function (res) { |
326 | //Valida si existe numero de unidad | 327 | //Valida si existe numero de unidad |
327 | var existe = res.data.filter(function (vehiculo) { | 328 | var existe = res.data.filter(function (vehiculo) { |
328 | return vehiculo.codigo === $scope.vehiculo.codigo && | 329 | return vehiculo.codigo === $scope.vehiculo.codigo && |
329 | vehiculo.id !== $scope.vehiculo.id; | 330 | vehiculo.id !== $scope.vehiculo.id; |
330 | }); | 331 | }); |
331 | 332 | ||
332 | if (existe.length) { | 333 | if (existe.length) { |
333 | reject(existe); | 334 | reject(existe); |
334 | } else { | 335 | } else { |
335 | resolve(); | 336 | resolve(); |
336 | } | 337 | } |
337 | }); | 338 | }); |
338 | }); | 339 | }); |
339 | } | 340 | } |
340 | 341 | ||
341 | function validaTotalCargas() { | 342 | function validaTotalCargas() { |
342 | var total = 0; | 343 | var total = 0; |
343 | $scope.cisternas.forEach(function (cisterna) { | 344 | $scope.cisternas.forEach(function (cisterna) { |
344 | if (!cisterna.desactivado) { | 345 | if (!cisterna.desactivado) { |
345 | total += parseInt(cisterna.capacidad); | 346 | total += parseInt(cisterna.capacidad); |
346 | } | 347 | } |
347 | }); | 348 | }); |
348 | return $scope.vehiculo.capacidad >= total; | 349 | return $scope.vehiculo.capacidad >= total; |
349 | } | 350 | } |
350 | function guardarCisternas() { | 351 | function guardarCisternas() { |
351 | var cisternas = $scope.cisternas.map(function (cisterna) { | 352 | var cisternas = $scope.cisternas.map(function (cisterna) { |
352 | return { | 353 | return { |
353 | id: cisterna.id, | 354 | id: cisterna.id, |
354 | capacidad: parseFloat(cisterna.capacidad), | 355 | capacidad: parseFloat(cisterna.capacidad), |
355 | codigo: cisterna.codigo, | 356 | codigo: cisterna.codigo, |
356 | idUnidadMedida: cisterna.idUnidadMedida, | 357 | idUnidadMedida: cisterna.idUnidadMedida, |
357 | idVehiculo: $routeParams.idVehiculo, | 358 | idVehiculo: $routeParams.idVehiculo, |
358 | desactivado: cisterna.desactivado | 359 | desactivado: cisterna.desactivado |
359 | }; | 360 | }; |
360 | }); | 361 | }); |
361 | 362 | ||
362 | return focaAbmVehiculoService.guardarCisternas(cisternas); | 363 | return focaAbmVehiculoService.guardarCisternas(cisternas); |
363 | } | 364 | } |
364 | 365 | ||
365 | $scope.agregarCisterna = function (cisterna) { | 366 | $scope.agregarCisterna = function (cisterna) { |
366 | if (!cisterna) { | 367 | if (!cisterna) { |
367 | focaModalService.alert('Ingrese valores'); | 368 | focaModalService.alert('Ingrese valores'); |
368 | return; | 369 | return; |
369 | } else if (!cisterna.codigo) { | 370 | } else if (!cisterna.codigo) { |
370 | focaModalService.alert('Ingrese codigo de cisterna'); | 371 | focaModalService.alert('Ingrese codigo de cisterna'); |
371 | return; | 372 | return; |
372 | } else if (!cisterna.capacidad) { | 373 | } else if (!cisterna.capacidad) { |
373 | focaModalService.alert('Ingrese capacidad'); | 374 | focaModalService.alert('Ingrese capacidad'); |
374 | return; | 375 | return; |
375 | } else if (!cisterna.idUnidadMedida) { | 376 | } else if (!cisterna.idUnidadMedida) { |
376 | focaModalService.alert('Ingrese unidad de medida'); | 377 | focaModalService.alert('Ingrese unidad de medida'); |
377 | return; | 378 | return; |
378 | } else if (cisterna.id === undefined) { | 379 | } else if (cisterna.id === undefined) { |
379 | cisterna.id = 0; | 380 | cisterna.id = 0; |
380 | } | 381 | } |
381 | 382 | ||
382 | validaCodigo(cisterna); | 383 | validaCodigo(cisterna); |
383 | }; | 384 | }; |
384 | 385 | ||
385 | if ($routeParams.idx !== -1) { | 386 | if ($routeParams.idx !== -1) { |
386 | $scope.cisterna = [$routeParams.idx]; | 387 | $scope.cisterna = [$routeParams.idx]; |
387 | focaAbmVehiculoService | 388 | focaAbmVehiculoService |
388 | .getCisternas($routeParams.idVehiculo) | 389 | .getCisternas($routeParams.idVehiculo) |
389 | .then(function (res) { | 390 | .then(function (res) { |
390 | $scope.cisterna = res[$routeParams.idx]; | 391 | $scope.cisterna = res[$routeParams.idx]; |
391 | }); | 392 | }); |
392 | } | 393 | } |
393 | 394 | ||
394 | function validaCodigo(cisterna) { | 395 | function validaCodigo(cisterna) { |
395 | focaAbmVehiculoService | 396 | focaAbmVehiculoService |
396 | .getCisternas($routeParams.idVehiculo) | 397 | .getCisternas($routeParams.idVehiculo) |
397 | .then(function (res) { | 398 | .then(function (res) { |
398 | var cisternas = res; | 399 | var cisternas = res; |
399 | var totalCargado = 0; | 400 | var totalCargado = 0; |
400 | 401 | ||
401 | for (var i = 0; i < cisternas.length; i++) { | 402 | for (var i = 0; i < cisternas.length; i++) { |
402 | //SI EL CODIGO YA EXISTE | 403 | //SI EL CODIGO YA EXISTE |
403 | if (cisternas[i].codigo === cisterna.codigo && | 404 | if (cisternas[i].codigo === cisterna.codigo && |
404 | i !== $routeParams.idx && | 405 | i !== $routeParams.idx && |
405 | cisternas[i].desactivado === false && | 406 | cisternas[i].desactivado === false && |
406 | cisternas[i].id !== cisterna.id | 407 | cisternas[i].id !== cisterna.id |
407 | ) { | 408 | ) { |
408 | focaModalService.alert('Código de cisterna existente'); | 409 | focaModalService.alert('Código de cisterna existente'); |
409 | cisterna.editando = true; | 410 | cisterna.editando = true; |
410 | return; | 411 | return; |
411 | } | 412 | } |
412 | if (i !== $routeParams.idx && | 413 | if (i !== $routeParams.idx && |
413 | !cisternas[i].desactivado) { | 414 | !cisternas[i].desactivado) { |
414 | totalCargado += cisternas[i].capacidad; | 415 | totalCargado += cisternas[i].capacidad; |
415 | } | 416 | } |
416 | } | 417 | } |
417 | $timeout(function () { | 418 | $timeout(function () { |
418 | cisterna.editando = false; | 419 | cisterna.editando = false; |
419 | $scope.crear = false; | 420 | $scope.crear = false; |
420 | }); | 421 | }); |
421 | }); | 422 | }); |
422 | } | 423 | } |
423 | } | 424 | } |
424 | ]); | 425 | ]); |
425 | 426 |
src/views/foca-abm-vehiculos-item.html
1 | <div class="row"> | 1 | <div class="row"> |
2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
3 | titulo="'Vehículo'" | 3 | titulo="'Vehículo'" |
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 | <form name="formVehiculo" class="px-3"> | 10 | <form name="formVehiculo" class="px-3"> |
11 | <input type="hidden" name="id" ng-model="sector.id" /> | 11 | <input type="hidden" name="id" ng-model="sector.id" /> |
12 | <div class="row mt-3"> | 12 | <div class="row mt-3"> |
13 | <div class="form-group d-flex mb-2 col-md-6"> | 13 | <div class="form-group d-flex mb-2 col-md-6"> |
14 | <label class="col-form-label col-md-4">Unidad</label> | 14 | <label class="col-form-label col-md-4">Unidad</label> |
15 | <div class="input-group col-md-8 pl-0"> | 15 | <div class="input-group col-md-8 pl-0"> |
16 | <input | 16 | <input |
17 | class="form-control" | 17 | class="form-control" |
18 | type="text" | 18 | type="text" |
19 | teclado-virtual | 19 | teclado-virtual |
20 | ng-model="vehiculo.codigo" | 20 | ng-model="vehiculo.codigo" |
21 | foca-focus="focused == 1" | 21 | foca-focus="focused == 1" |
22 | ng-focus="focused = 1" | 22 | ng-focus="focused = 1" |
23 | ng-keypress="next($event.keyCode)" | 23 | ng-keypress="next($event.keyCode)" |
24 | ng-disabled="!nuevo" | 24 | ng-disabled="!nuevo" |
25 | /> | 25 | /> |
26 | </div> | 26 | </div> |
27 | </div> | 27 | </div> |
28 | <div class="form-group d-flex mb-2 col-md-6"> | 28 | <div class="form-group d-flex mb-2 col-md-6"> |
29 | <label class="col-form-label col-md-4">Dominio tractor</label> | 29 | <label class="col-form-label col-md-4">Dominio tractor</label> |
30 | <div class="input-group col-md-8 pl-0"> | 30 | <div class="input-group col-md-8 pl-0"> |
31 | <input | 31 | <input |
32 | class="form-control" | 32 | class="form-control" |
33 | type="text" | 33 | type="text" |
34 | teclado-virtual | 34 | teclado-virtual |
35 | ng-model="vehiculo.tractor" | 35 | ng-model="vehiculo.tractor" |
36 | ng-required="true" | 36 | ng-required="true" |
37 | foca-focus="focused == 2" | 37 | foca-focus="focused == 2" |
38 | ng-focus="focused = 2" | 38 | ng-focus="focused = 2" |
39 | ng-keypress="next($event.keyCode)" | 39 | ng-keypress="next($event.keyCode)" |
40 | /> | 40 | /> |
41 | </div> | 41 | </div> |
42 | </div> | 42 | </div> |
43 | <div class="form-group d-flex mb-2 col-md-6"> | 43 | <div class="form-group d-flex mb-2 col-md-6"> |
44 | <label class="col-form-label col-md-4">Dominio semi</label> | 44 | <label class="col-form-label col-md-4">Dominio semi</label> |
45 | <div class="input-group col-md-8 pl-0"> | 45 | <div class="input-group col-md-8 pl-0"> |
46 | <input | 46 | <input |
47 | class="form-control" | 47 | class="form-control" |
48 | type="text" | 48 | type="text" |
49 | teclado-virtual | 49 | teclado-virtual |
50 | ng-model="vehiculo.semi" | 50 | ng-model="vehiculo.semi" |
51 | ng-required="true" | 51 | ng-required="true" |
52 | foca-focus="focused == 3" | 52 | foca-focus="focused == 3" |
53 | ng-focus="focused = 3" | 53 | ng-focus="focused = 3" |
54 | ng-keypress="next($event.keyCode)" | 54 | ng-keypress="next($event.keyCode)" |
55 | /> | 55 | /> |
56 | </div> | 56 | </div> |
57 | </div> | 57 | </div> |
58 | <div class="form-group d-flex mb-2 col-md-6"> | 58 | <div class="form-group d-flex mb-2 col-md-6"> |
59 | <label class="col-form-label col-md-4">Capacidad total</label> | 59 | <label class="col-form-label col-md-4">Capacidad total</label> |
60 | <div class="input-group col-md-8 pl-0"> | 60 | <div class="input-group col-md-8 pl-0"> |
61 | <input | 61 | <input |
62 | class="form-control" | 62 | class="form-control" |
63 | type="text" | 63 | type="text" |
64 | teclado-virtual | 64 | teclado-virtual |
65 | ng-model="vehiculo.capacidad" | 65 | ng-model="vehiculo.capacidad" |
66 | ng-required="true" | 66 | ng-required="true" |
67 | foca-focus="focused == 4" | 67 | foca-focus="focused == 4" |
68 | ng-focus="focused = 4" | 68 | ng-focus="focused = 4" |
69 | ng-keypress="guardar($event.keyCode)" | 69 | ng-keypress="guardar($event.keyCode)" |
70 | /> | 70 | /> |
71 | </div> | 71 | </div> |
72 | </div> | 72 | </div> |
73 | </div> | 73 | </div> |
74 | </form> | 74 | </form> |
75 | <div ng-show="!nuevo"> | 75 | <div ng-show="!nuevo"> |
76 | <h5 class="pl-4 table-title">Cisternas</h5> | 76 | <h5 class="pl-4 table-title">Cisternas</h5> |
77 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0" > | 77 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0" > |
78 | <thead> | 78 | <thead> |
79 | <tr> | 79 | <tr> |
80 | <th class="text-center px-4">Código</th> | 80 | <th class="text-center px-4">Código</th> |
81 | <th class="text-center">Capacidad</th> | 81 | <th class="text-center">Capacidad</th> |
82 | <th class="text-center">Unidad de Medida</th> | 82 | <th class="text-center">Unidad de Medida</th> |
83 | <th class="text-center"> | 83 | <th class="text-center"> |
84 | <button | 84 | <button |
85 | class="btn btn-outline-debo boton-accion" | 85 | class="btn btn-outline-debo boton-accion" |
86 | title="Agregar" | 86 | title="Agregar Cisterna" |
87 | ng-click="crearCisterna()" | 87 | ng-click="crearCisterna()" |
88 | ng-disabled="crear"> | 88 | ng-disabled="crear"> |
89 | <i class="fa fa-plus"></i> | 89 | <i class="fa fa-plus"></i> |
90 | </button> | 90 | </button> |
91 | </th> | 91 | </th> |
92 | </tr> | 92 | </tr> |
93 | </thead> | 93 | </thead> |
94 | <tbody> | 94 | <tbody> |
95 | <tr ng-show="creando"> | 95 | <tr ng-show="creando"> |
96 | <td align="center"> | 96 | <td align="center"> |
97 | <input | 97 | <input |
98 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" | 98 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" |
99 | ng-model="cisterna.codigo" | 99 | ng-model="cisterna.codigo" |
100 | ng-keypress="next($event.keyCode)" | 100 | ng-keypress="next($event.keyCode)" |
101 | foca-focus="focused == 1" | 101 | foca-focus="focused == 1" |
102 | ng-focus="focused = 1" | 102 | ng-focus="focused = 1" |
103 | ng-disabled="!nuevoCisterna" | 103 | ng-disabled="!nuevoCisterna" |
104 | teclado-virtual | 104 | teclado-virtual |
105 | > | 105 | > |
106 | </td> | 106 | </td> |
107 | <td align="center"> | 107 | <td align="center"> |
108 | <input | 108 | <input |
109 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" | 109 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" |
110 | teclado-virtual | 110 | teclado-virtual |
111 | foca-tipo-input | 111 | foca-tipo-input |
112 | ng-model="cisterna.capacidad" | 112 | ng-model="cisterna.capacidad" |
113 | ng-required="true" | 113 | ng-required="true" |
114 | ng-keypress="next($event.keyCode)" | 114 | ng-keypress="next($event.keyCode)" |
115 | foca-focus="focused == 2" | 115 | foca-focus="focused == 2" |
116 | ng-focus="focused = 2" | 116 | ng-focus="focused = 2" |
117 | > | 117 | > |
118 | </td> | 118 | </td> |
119 | <td align="center"> | 119 | <td align="center"> |
120 | <div class="input-group"> | 120 | <div class="input-group"> |
121 | <input | 121 | <input |
122 | ng-model="cisterna.unidadMedida.NOM" | 122 | ng-model="cisterna.unidadMedida.NOM" |
123 | class="form-control" | 123 | class="form-control" |
124 | readonly | 124 | readonly |
125 | /> | 125 | /> |
126 | <div class="input-group-append"> | 126 | <div class="input-group-append"> |
127 | <button | 127 | <button |
128 | ladda="searchLoading" | 128 | ladda="searchLoading" |
129 | class="btn btn-outline-secondary form-control" | 129 | class="btn btn-outline-secondary form-control" |
130 | type="button" | 130 | type="button" |
131 | ng-click="seleccionarUnidadMedida()" | 131 | ng-click="seleccionarUnidadMedida()" |
132 | foca-focus="focused == 3" | 132 | foca-focus="focused == 3" |
133 | > | 133 | > |
134 | <i class="fa fa-search" aria-hidden="true"></i> | 134 | <i class="fa fa-search" aria-hidden="true"></i> |
135 | </button> | 135 | </button> |
136 | </div> | 136 | </div> |
137 | </div> | 137 | </div> |
138 | </td> | 138 | </td> |
139 | <td align="center"> | 139 | <td align="center"> |
140 | <button | 140 | <button |
141 | class="btn btn-outline-dark boton-accion" | 141 | class="btn btn-outline-dark boton-accion" |
142 | ng-click="agregarCisterna()" | 142 | ng-click="agregarCisterna()" |
143 | > | 143 | > |
144 | <i class="fa fa-save"></i> | 144 | <i class="fa fa-save"></i> |
145 | </button> | 145 | </button> |
146 | </td> | 146 | </td> |
147 | </tr> | 147 | </tr> |
148 | 148 | ||
149 | <tr ng-repeat="(key, cisterna) in cisternas | filter:filtros" ng-hide="cisterna.desactivado"> | 149 | <tr ng-repeat="(key, cisterna) in cisternas | filter:filtros" ng-hide="cisterna.desactivado"> |
150 | <td ng-bind="cisterna.codigo" class="text-center" ng-hide="cisterna.editando"></td> | 150 | <td ng-bind="cisterna.codigo" class="text-center" ng-hide="cisterna.editando"></td> |
151 | <td align="center" ng-show="cisterna.editando"> | 151 | <td align="center" ng-show="cisterna.editando"> |
152 | <input | 152 | <input |
153 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" | 153 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" |
154 | ng-model="cisterna.codigo" | 154 | ng-model="cisterna.codigo" |
155 | ng-keypress="next($event.keyCode)" | 155 | ng-keypress="next($event.keyCode)" |
156 | foca-focus="focused == 1" | 156 | foca-focus="focused == 1" |
157 | ng-focus="focused = 1" | 157 | ng-focus="focused = 1" |
158 | teclado-virtual | 158 | teclado-virtual |
159 | esc-key="volver(cisterna, key)" | 159 | esc-key="volver(cisterna, key)" |
160 | > | 160 | > |
161 | </td> | 161 | </td> |
162 | <td ng-bind="cisterna.capacidad" class="text-center" ng-hide="cisterna.editando"></td> | 162 | <td ng-bind="cisterna.capacidad" class="text-center" ng-hide="cisterna.editando"></td> |
163 | <td align="center" ng-show="cisterna.editando" > | 163 | <td align="center" ng-show="cisterna.editando" > |
164 | <input | 164 | <input |
165 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" | 165 | class="form-control text-uppercase foca-input ng-not-empty ng-valid ng-valid-required ng-touched" |
166 | teclado-virtual | 166 | teclado-virtual |
167 | foca-tipo-input | 167 | foca-tipo-input |
168 | ng-model="cisterna.capacidad" | 168 | ng-model="cisterna.capacidad" |
169 | ng-required="true" | 169 | ng-required="true" |
170 | ng-keypress="next($event.keyCode)" | 170 | ng-keypress="next($event.keyCode)" |
171 | foca-focus="focused == 2" | 171 | foca-focus="focused == 2" |
172 | ng-focus="focused = 2" | 172 | ng-focus="focused = 2" |
173 | esc-key="volver(cisterna, key)" | 173 | esc-key="volver(cisterna, key)" |
174 | > | 174 | > |
175 | </td> | 175 | </td> |
176 | <td ng-bind="cisterna.unidadMedida.NOM" class="text-center" ng-hide="cisterna.editando"></td> | 176 | <td ng-bind="cisterna.unidadMedida.NOM" class="text-center" ng-hide="cisterna.editando"></td> |
177 | <td align="center" ng-show="cisterna.editando"> | 177 | <td align="center" ng-show="cisterna.editando"> |
178 | <div class="input-group"> | 178 | <div class="input-group"> |
179 | <input | 179 | <input |
180 | ng-model="cisterna.unidadMedida.NOM" | 180 | ng-model="cisterna.unidadMedida.NOM" |
181 | class="form-control" | 181 | class="form-control" |
182 | readonly | 182 | readonly |
183 | esc-key="volver(cisterna, key)" | 183 | esc-key="volver(cisterna, key)" |
184 | /> | 184 | /> |
185 | <div class="input-group-append"> | 185 | <div class="input-group-append"> |
186 | <button | 186 | <button |
187 | ladda="searchLoading" | 187 | ladda="searchLoading" |
188 | class="btn btn-outline-secondary form-control" | 188 | class="btn btn-outline-secondary form-control" |
189 | type="button" | 189 | type="button" |
190 | ng-click="seleccionarUnidadMedida(cisterna)" | 190 | ng-click="seleccionarUnidadMedida(cisterna)" |
191 | foca-focus="focused == 3" | 191 | foca-focus="focused == 3" |
192 | > | 192 | > |
193 | <i class="fa fa-search" aria-hidden="true"></i> | 193 | <i class="fa fa-search" aria-hidden="true"></i> |
194 | </button> | 194 | </button> |
195 | </div> | 195 | </div> |
196 | </div> | 196 | </div> |
197 | </td> | 197 | </td> |
198 | <td class="text-center" ng-hide="cisterna.editando"> | 198 | <td class="text-center" ng-hide="cisterna.editando"> |
199 | <button | 199 | <button |
200 | class="btn btn-outline-dark boton-accion" | 200 | class="btn btn-outline-dark boton-accion" |
201 | title="Editar" | 201 | title="Editar" |
202 | ng-click="editar(cisterna)" | 202 | ng-click="editar(cisterna)" |
203 | > | 203 | > |
204 | <i class="fa fa-pencil"></i> | 204 | <i class="fa fa-pencil"></i> |
205 | </button> | 205 | </button> |
206 | <button | 206 | <button |
207 | class="btn btn-outline-dark boton-accion" | 207 | class="btn btn-outline-dark boton-accion" |
208 | title="Eliminar" | 208 | title="Eliminar" |
209 | ng-click="solicitarConfirmacionTabla(cisterna, $index)" | 209 | ng-click="solicitarConfirmacionTabla(cisterna, $index)" |
210 | > | 210 | > |
211 | <i class="fa fa-trash"></i> | 211 | <i class="fa fa-trash"></i> |
212 | </button> | 212 | </button> |
213 | </td> | 213 | </td> |
214 | <td align="center" ng-show="cisterna.editando" > | 214 | <td align="center" ng-show="cisterna.editando" > |
215 | <button | 215 | <button |
216 | class="btn btn-outline-dark boton-accion" | 216 | class="btn btn-outline-dark boton-accion" |
217 | ng-click="agregarCisterna(cisterna)" | 217 | ng-click="agregarCisterna(cisterna)" |
218 | > | 218 | > |
219 | <i class="fa fa-save"></i> | 219 | <i class="fa fa-save"></i> |
220 | </button> | 220 | </button> |
221 | <button | 221 | <button |
222 | class="btn btn-outline-dark boton-accion" | 222 | class="btn btn-outline-dark boton-accion" |
223 | ng-click="volver(cisterna, key)" | 223 | ng-click="volver(cisterna, key)" |
224 | > | 224 | > |
225 | <i class="fa fa-undo" aria-hidden="true"></i> | 225 | <i class="fa fa-undo" aria-hidden="true"></i> |
226 | </button> | 226 | </button> |
227 | </td> | 227 | </td> |
228 | </tr> | 228 | </tr> |
229 | 229 | ||
230 | <tr ng-repeat="(key, cisterna) in cisternas" ng-show="false"> | 230 | <tr ng-repeat="(key, cisterna) in cisternas" ng-show="false"> |
231 | </tr> | 231 | </tr> |
232 | 232 | ||
233 | </body> | 233 | </body> |
234 | </table> | 234 | </table> |
235 | </div> | 235 | </div> |
236 | </div> | 236 | </div> |
237 | </div> | 237 | </div> |
238 | 238 |
src/views/foca-abm-vehiculos-listado.html
1 | <div class="row"> | 1 | <div class="row"> |
2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
3 | titulo="'Vehículos'" | 3 | titulo="'Vehículos'" |
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" max="6" class="row"></foca-botonera-facturador> | 12 | <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | <!-- <div class="col-6 form-group"> | 15 | <!-- <div class="col-6 form-group"> |
16 | <input seleccionarTransportista() | 16 | <input seleccionarTransportista() |
17 | type="text" | 17 | type="text" |
18 | teclado-virtual | 18 | teclado-virtual |
19 | class="form-control form-control-sm" | 19 | class="form-control form-control-sm" |
20 | placeholder="Búsqueda" | 20 | placeholder="Búsqueda" |
21 | ng-model="filtros" | 21 | ng-model="filtros" |
22 | /> | 22 | /> |
23 | </div> --> | 23 | </div> --> |
24 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> | 24 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> |
25 | <thead> | 25 | <thead> |
26 | <tr> | 26 | <tr> |
27 | <th class="text-center">Unidad</th> | 27 | <th class="text-center">Unidad</th> |
28 | <th>Dominio Tractor</th> | 28 | <th>Dominio Tractor</th> |
29 | <th>Dominio Semi</th> | 29 | <th>Dominio Semi</th> |
30 | <th class="text-right">Capacidad</th> | 30 | <th class="text-right">Capacidad</th> |
31 | <th class="text-center"> | 31 | <th class="text-center"> |
32 | <button | 32 | <button |
33 | ng-disabled="!idTransportista" | 33 | ng-disabled="!idTransportista" |
34 | class="btn btn-outline-debo boton-accion" | 34 | class="btn btn-outline-debo boton-accion" |
35 | title="Agregar" | 35 | title="Agregar Vehículo" |
36 | ng-click="editar(0)" | 36 | ng-click="editar(0)" |
37 | ><i class="fa fa-plus"></i> | 37 | ><i class="fa fa-plus"></i> |
38 | </button> | 38 | </button> |
39 | </th> | 39 | </th> |
40 | </tr> | 40 | </tr> |
41 | </thead> | 41 | </thead> |
42 | <tbody> | 42 | <tbody> |
43 | <tr ng-repeat="vehiculo in vehiculos | filter:filtros"> | 43 | <tr ng-repeat="vehiculo in vehiculos | filter:filtros"> |
44 | <td ng-bind="vehiculo.codigo" class="text-center"></td> | 44 | <td ng-bind="vehiculo.codigo" class="text-center"></td> |
45 | <td ng-bind="vehiculo.tractor"></td> | 45 | <td ng-bind="vehiculo.tractor"></td> |
46 | <td ng-bind="vehiculo.semi"></td> | 46 | <td ng-bind="vehiculo.semi"></td> |
47 | <td ng-bind="vehiculo.capacidad" class="text-right"></td> | 47 | <td ng-bind="vehiculo.capacidad" class="text-right"></td> |
48 | <td class="text-center"> | 48 | <td class="text-center"> |
49 | <button | 49 | <button |
50 | class="btn btn-outline-dark boton-accion" | 50 | class="btn btn-outline-dark boton-accion" |
51 | title="Editar" | 51 | title="Editar" |
52 | ng-click="editar(vehiculo.id)" | 52 | ng-click="editar(vehiculo.id)" |
53 | > | 53 | > |
54 | <i class="fa fa-pencil"></i> | 54 | <i class="fa fa-pencil"></i> |
55 | </button> | 55 | </button> |
56 | <button | 56 | <button |
57 | class="btn btn-outline-dark boton-accion" | 57 | class="btn btn-outline-dark boton-accion" |
58 | title="Eliminar" | 58 | title="Eliminar" |
59 | ng-click="solicitarConfirmacion(vehiculo)" | 59 | ng-click="solicitarConfirmacion(vehiculo)" |
60 | > | 60 | > |
61 | <i class="fa fa-trash"></i> | 61 | <i class="fa fa-trash"></i> |
62 | </button> | 62 | </button> |
63 | </td> | 63 | </td> |
64 | </tr> | 64 | </tr> |
65 | </body> | 65 | </body> |
66 | </table> | 66 | </table> |
67 | </div> | 67 | </div> |
68 | </div> | 68 | </div> |
69 | 69 |