Commit 28d144ab4e6c6684847c957b81446a6e9c7e76d1
1 parent
3e9bc33af9
Exists in
master
rellenar no supera lo máximo
Showing
2 changed files
with
5 additions
and
2 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaModalDetalleCisternas') | 1 | angular.module('focaModalDetalleCisternas') |
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 | 'focaModalDetalleCisternasService', | 9 | 'focaModalDetalleCisternasService', |
10 | 'fechaReparto', | 10 | 'fechaReparto', |
11 | function($scope, $uibModalInstance, idVehiculo, idRemito, focaModalService, $filter, | 11 | function($scope, $uibModalInstance, idVehiculo, idRemito, focaModalService, $filter, |
12 | focaModalDetalleCisternasService, fechaReparto | 12 | focaModalDetalleCisternasService, fechaReparto |
13 | ) { | 13 | ) { |
14 | //seteo variables | 14 | //seteo variables |
15 | $scope.cargandoDatos = true; | 15 | $scope.cargandoDatos = true; |
16 | $scope.idRemito = idRemito; | 16 | $scope.idRemito = idRemito; |
17 | $scope.articulos = []; | 17 | $scope.articulos = []; |
18 | $scope.vehiculo = {}; | 18 | $scope.vehiculo = {}; |
19 | $scope.cisternas = []; | 19 | $scope.cisternas = []; |
20 | $scope.cisternasCarga = []; | 20 | $scope.cisternasCarga = []; |
21 | $scope.remito = {}; | 21 | $scope.remito = {}; |
22 | $scope.aCargar = []; | 22 | $scope.aCargar = []; |
23 | var cisternaMovimientos = []; | 23 | var cisternaMovimientos = []; |
24 | var promesaRemito; | 24 | var promesaRemito; |
25 | 25 | ||
26 | if(fechaReparto) { | 26 | if(fechaReparto) { |
27 | focaModalDetalleCisternasService.fecha = fechaReparto; | 27 | focaModalDetalleCisternasService.fecha = fechaReparto; |
28 | } | 28 | } |
29 | var promesaVehiculo = focaModalDetalleCisternasService.obtenerVehiculoById(idVehiculo); | 29 | var promesaVehiculo = focaModalDetalleCisternasService.obtenerVehiculoById(idVehiculo); |
30 | var promesaCisternas = focaModalDetalleCisternasService | 30 | var promesaCisternas = focaModalDetalleCisternasService |
31 | .obtenerCisternasPorFecha(idVehiculo); | 31 | .obtenerCisternasPorFecha(idVehiculo); |
32 | if(idRemito !== -1) { | 32 | if(idRemito !== -1) { |
33 | promesaRemito = focaModalDetalleCisternasService.obtenerRemitoById(idRemito); | 33 | promesaRemito = focaModalDetalleCisternasService.obtenerRemitoById(idRemito); |
34 | } | 34 | } |
35 | Promise.all([promesaVehiculo, promesaCisternas, promesaRemito]).then(function(res) { | 35 | Promise.all([promesaVehiculo, promesaCisternas, promesaRemito]).then(function(res) { |
36 | $scope.cargandoDatos = false; | 36 | $scope.cargandoDatos = false; |
37 | $scope.vehiculo = res[0].data; | 37 | $scope.vehiculo = res[0].data; |
38 | $scope.cisternas = res[1].data; | 38 | $scope.cisternas = res[1].data; |
39 | if(!$scope.cisternas.length) { | 39 | if(!$scope.cisternas.length) { |
40 | focaModalService.alert('El vehículo no tiene cisternas'); | 40 | focaModalService.alert('El vehículo no tiene cisternas'); |
41 | $uibModalInstance.dismiss(); | 41 | $uibModalInstance.dismiss(); |
42 | return; | 42 | return; |
43 | } | 43 | } |
44 | if(!res[2]) { | 44 | if(!res[2]) { |
45 | $scope.$digest(); | 45 | $scope.$digest(); |
46 | return; | 46 | return; |
47 | } | 47 | } |
48 | $scope.remito = res[2].data; | 48 | $scope.remito = res[2].data; |
49 | if($scope.remito.idUsuarioProceso) { | 49 | if($scope.remito.idUsuarioProceso) { |
50 | focaModalService.alert('Remito ya asignado'); | 50 | focaModalService.alert('Remito ya asignado'); |
51 | $uibModalInstance.close(); | 51 | $uibModalInstance.close(); |
52 | } | 52 | } |
53 | $scope.articulos = $scope.remito.articulosRemito; | 53 | $scope.articulos = $scope.remito.articulosRemito; |
54 | if(!$scope.articulos.length) { | 54 | if(!$scope.articulos.length) { |
55 | focaModalService.alert('El remito no tiene articulos'); | 55 | focaModalService.alert('El remito no tiene articulos'); |
56 | $uibModalInstance.dismiss(); | 56 | $uibModalInstance.dismiss(); |
57 | return; | 57 | return; |
58 | } | 58 | } |
59 | $scope.seleccionarArticulo($scope.articulos[0]); | 59 | $scope.seleccionarArticulo($scope.articulos[0]); |
60 | var tieneUsuario = $scope.cisternas.filter(function(cisterna) { | 60 | var tieneUsuario = $scope.cisternas.filter(function(cisterna) { |
61 | if(cisterna.cisternaCarga && cisterna.cisternaCarga.idUsuarioProceso) { | 61 | if(cisterna.cisternaCarga && cisterna.cisternaCarga.idUsuarioProceso) { |
62 | return cisterna.cisternaCarga.idUsuarioProceso !== | 62 | return cisterna.cisternaCarga.idUsuarioProceso !== |
63 | focaModalDetalleCisternasService.idUsuario; | 63 | focaModalDetalleCisternasService.idUsuario; |
64 | } | 64 | } |
65 | }); | 65 | }); |
66 | if(tieneUsuario.length) { | 66 | if(tieneUsuario.length) { |
67 | focaModalService.alert('Otro usario esta usando este vehículo'); | 67 | focaModalService.alert('Otro usario esta usando este vehículo'); |
68 | $uibModalInstance.close(); | 68 | $uibModalInstance.close(); |
69 | } | 69 | } |
70 | $scope.$digest(); | 70 | $scope.$digest(); |
71 | }); | 71 | }); |
72 | $scope.aceptar = function() { | 72 | $scope.aceptar = function() { |
73 | $scope.cargando = true; | 73 | $scope.cargando = true; |
74 | for(var i = 0; i < $scope.cisternasCarga.length; i++) { | 74 | for(var i = 0; i < $scope.cisternasCarga.length; i++) { |
75 | $scope.cisternasCarga[i].idUsuarioProceso = | 75 | $scope.cisternasCarga[i].idUsuarioProceso = |
76 | focaModalDetalleCisternasService.idUsuario; | 76 | focaModalDetalleCisternasService.idUsuario; |
77 | delete $scope.cisternasCarga[i].articulo; | 77 | delete $scope.cisternasCarga[i].articulo; |
78 | } | 78 | } |
79 | var cisterna = { | 79 | var cisterna = { |
80 | cisternaMovimientos: cisternaMovimientos, | 80 | cisternaMovimientos: cisternaMovimientos, |
81 | cisternaCargas: $scope.cisternasCarga, | 81 | cisternaCargas: $scope.cisternasCarga, |
82 | idVehiculo: $scope.vehiculo.id, | 82 | idVehiculo: $scope.vehiculo.id, |
83 | fechaReparto: focaModalDetalleCisternasService.fecha | 83 | fechaReparto: focaModalDetalleCisternasService.fecha |
84 | }; | 84 | }; |
85 | if(!focaModalDetalleCisternasService.idUsuario) { | 85 | if(!focaModalDetalleCisternasService.idUsuario) { |
86 | focaModalService.alert('No logeado como vendedor'); | 86 | focaModalService.alert('No logeado como vendedor'); |
87 | $scope.cargando = false; | 87 | $scope.cargando = false; |
88 | return; | 88 | return; |
89 | } | 89 | } |
90 | focaModalDetalleCisternasService.guardarCisternas(cisterna, $scope.remito.id) | 90 | focaModalDetalleCisternasService.guardarCisternas(cisterna, $scope.remito.id) |
91 | .then(function() { | 91 | .then(function() { |
92 | focaModalService.alert('Cisternas cargadas con éxito').then(function() { | 92 | focaModalService.alert('Cisternas cargadas con éxito').then(function() { |
93 | $scope.cargando = false; | 93 | $scope.cargando = false; |
94 | $uibModalInstance.close(); | 94 | $uibModalInstance.close(); |
95 | }); | 95 | }); |
96 | }).catch(function(error) { | 96 | }).catch(function(error) { |
97 | $scope.cargando = false; | 97 | $scope.cargando = false; |
98 | $uibModalInstance.close(); | 98 | $uibModalInstance.close(); |
99 | if (error.status === 403) { | 99 | if (error.status === 403) { |
100 | focaModalService.alert('ERROR: ' + error.data); | 100 | focaModalService.alert('ERROR: ' + error.data); |
101 | return; | 101 | return; |
102 | } | 102 | } |
103 | focaModalService.alert('Hubo un error al cargar las cisternas'); | 103 | focaModalService.alert('Hubo un error al cargar las cisternas'); |
104 | }); | 104 | }); |
105 | }; | 105 | }; |
106 | $scope.cancelar = function() { | 106 | $scope.cancelar = function() { |
107 | $uibModalInstance.dismiss(); | 107 | $uibModalInstance.dismiss(); |
108 | }; | 108 | }; |
109 | $scope.cargarACisternas = function() { | 109 | $scope.cargarACisternas = function() { |
110 | for(var i = 0; i < $scope.cisternas.length; i++) { | 110 | for(var i = 0; i < $scope.cisternas.length; i++) { |
111 | var cisterna = $scope.cisternas[i]; | 111 | var cisterna = $scope.cisternas[i]; |
112 | var aCargar = parseFloat($scope.aCargar[i]); | 112 | var aCargar = parseFloat($scope.aCargar[i]); |
113 | var fechaReparto = focaModalDetalleCisternasService.fecha; | 113 | var fechaReparto = focaModalDetalleCisternasService.fecha; |
114 | //validaciones | 114 | //validaciones |
115 | if(!aCargar) { | 115 | if(!aCargar) { |
116 | continue; | 116 | continue; |
117 | } | 117 | } |
118 | //cargar | 118 | //cargar |
119 | if(cisterna.cisternaCarga.cantidad) { | 119 | if(cisterna.cisternaCarga.cantidad) { |
120 | cisterna.cisternaCarga.cantidad += aCargar; | 120 | cisterna.cisternaCarga.cantidad += aCargar; |
121 | }else { | 121 | }else { |
122 | cisterna.cisternaCarga.cantidad = aCargar; | 122 | cisterna.cisternaCarga.cantidad = aCargar; |
123 | cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo; | 123 | cisterna.cisternaCarga.idProducto = $scope.articuloSeleccionado.idArticulo; |
124 | } | 124 | } |
125 | cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad; | 125 | cisterna.disponible = cisterna.capacidad - cisterna.cisternaCarga.cantidad; |
126 | 126 | ||
127 | cisterna.cisternaCarga.articulo = { | 127 | cisterna.cisternaCarga.articulo = { |
128 | DetArt: $scope.articuloSeleccionado.descripcion | 128 | DetArt: $scope.articuloSeleccionado.descripcion |
129 | }; | 129 | }; |
130 | $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0] | 130 | $filter('filter')($scope.articulos, {id: $scope.articuloSeleccionado.id})[0] |
131 | .cargado = true; | 131 | .cargado = true; |
132 | 132 | ||
133 | $scope.calcularPorcentaje(cisterna); | 133 | $scope.calcularPorcentaje(cisterna); |
134 | //Guardar | 134 | //Guardar |
135 | var now = new Date(); | 135 | var now = new Date(); |
136 | var cisternaMovimiento = { | 136 | var cisternaMovimiento = { |
137 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), | 137 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), |
138 | cantidad: aCargar, | 138 | cantidad: aCargar, |
139 | metodo: 'carga', | 139 | metodo: 'carga', |
140 | idCisternaCarga: cisterna.cisternaCarga.id, | 140 | idCisternaCarga: cisterna.cisternaCarga.id, |
141 | idRemito: $scope.remito.id | 141 | idRemito: $scope.remito.id |
142 | }; | 142 | }; |
143 | cisterna.cisternaCarga.fechaReparto = fechaReparto; | 143 | cisterna.cisternaCarga.fechaReparto = fechaReparto; |
144 | cisterna.cisternaCarga.idCisterna = cisterna.id; | 144 | cisterna.cisternaCarga.idCisterna = cisterna.id; |
145 | $scope.cisternasCarga.push(cisterna.cisternaCarga); | 145 | $scope.cisternasCarga.push(cisterna.cisternaCarga); |
146 | cisternaMovimientos.push(cisternaMovimiento); | 146 | cisternaMovimientos.push(cisternaMovimiento); |
147 | } | 147 | } |
148 | var articuloSiguiente = $scope.articulos.filter( | 148 | var articuloSiguiente = $scope.articulos.filter( |
149 | function(filter) { | 149 | function(filter) { |
150 | return filter.cargado !== true; | 150 | return filter.cargado !== true; |
151 | } | 151 | } |
152 | ); | 152 | ); |
153 | if(articuloSiguiente.length > 0) { | 153 | if(articuloSiguiente.length > 0) { |
154 | $scope.seleccionarArticulo(articuloSiguiente[0]); | 154 | $scope.seleccionarArticulo(articuloSiguiente[0]); |
155 | } | 155 | } |
156 | }; | 156 | }; |
157 | $scope.calcularPorcentaje = function(cisterna) { | 157 | $scope.calcularPorcentaje = function(cisterna) { |
158 | if(!cisterna.cisternaCarga) { | 158 | if(!cisterna.cisternaCarga) { |
159 | cisterna.cisternaCarga = { | 159 | cisterna.cisternaCarga = { |
160 | cantidad: 0 | 160 | cantidad: 0 |
161 | }; | 161 | }; |
162 | } | 162 | } |
163 | var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / | 163 | var porcentaje = (cisterna.cisternaCarga.cantidad * 100 / |
164 | cisterna.capacidad) + '%'; | 164 | cisterna.capacidad) + '%'; |
165 | var elementHtml = document.getElementById(cisterna.id); | 165 | var elementHtml = document.getElementById(cisterna.id); |
166 | if(elementHtml) { | 166 | if(elementHtml) { |
167 | elementHtml.style.width = porcentaje; | 167 | elementHtml.style.width = porcentaje; |
168 | } | 168 | } |
169 | }; | 169 | }; |
170 | $scope.seleccionarArticulo = function(articulo) { | 170 | $scope.seleccionarArticulo = function(articulo) { |
171 | $scope.articuloSeleccionado = articulo; | 171 | $scope.articuloSeleccionado = articulo; |
172 | $scope.cisternaDisponible(); | 172 | $scope.cisternaDisponible(); |
173 | $scope.autoCompletar(); | 173 | $scope.autoCompletar(); |
174 | $scope.actualizarArticulo(); | 174 | $scope.actualizarArticulo(); |
175 | }; | 175 | }; |
176 | $scope.actualizarArticulo = function() { | 176 | $scope.actualizarArticulo = function() { |
177 | $scope.articuloSeleccionado.cantidadCargada = 0; | 177 | $scope.articuloSeleccionado.cantidadCargada = 0; |
178 | for(var i = 0; i < $scope.aCargar.length; i++) { | 178 | for(var i = 0; i < $scope.aCargar.length; i++) { |
179 | $scope.articuloSeleccionado.cantidadCargada += | 179 | $scope.articuloSeleccionado.cantidadCargada += |
180 | parseFloat($scope.aCargar[i]) || 0; | 180 | parseFloat($scope.aCargar[i]) || 0; |
181 | } | 181 | } |
182 | }; | 182 | }; |
183 | $scope.autoCompletar = function() { | 183 | $scope.autoCompletar = function() { |
184 | for(var i = 0; i < $scope.cisternas.length; i++) { | 184 | for(var i = 0; i < $scope.cisternas.length; i++) { |
185 | if($scope.cisternas[i].disabled) { | 185 | if($scope.cisternas[i].disabled) { |
186 | continue; | 186 | continue; |
187 | } | 187 | } |
188 | var aCargar = $scope.articuloSeleccionado.cantidad - | 188 | var aCargar = $scope.articuloSeleccionado.cantidad - |
189 | ($scope.articuloSeleccionado.cantidadCargada || 0); | 189 | ($scope.articuloSeleccionado.cantidadCargada || 0); |
190 | if(aCargar > $scope.cisternas[i].disponible) { | 190 | if(aCargar > $scope.cisternas[i].disponible) { |
191 | aCargar = $scope.cisternas[i].disponible; | 191 | aCargar = $scope.cisternas[i].disponible; |
192 | } | 192 | } |
193 | if(aCargar) { | 193 | if(aCargar) { |
194 | $scope.aCargar[i] = aCargar; | 194 | $scope.aCargar[i] = aCargar; |
195 | $scope.actualizarArticulo(); | 195 | $scope.actualizarArticulo(); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | }; | 198 | }; |
199 | $scope.cisternaDisponible = function() { | 199 | $scope.cisternaDisponible = function() { |
200 | for(var i = 0; i < $scope.cisternas.length; i++) { | 200 | for(var i = 0; i < $scope.cisternas.length; i++) { |
201 | //Puede meter un porcentaje del total | 201 | //Puede meter un porcentaje del total |
202 | // if($scope.articuloSeleccionado.cantidad > $scope.cisternas[i].disponible) { | 202 | // if($scope.articuloSeleccionado.cantidad > $scope.cisternas[i].disponible) { |
203 | // $scope.cisternas[i].disabled = true; | 203 | // $scope.cisternas[i].disabled = true; |
204 | // continue; | 204 | // continue; |
205 | // } | 205 | // } |
206 | if($scope.cisternas[i].cisternaCarga && | 206 | if($scope.cisternas[i].cisternaCarga && |
207 | $scope.cisternas[i].cisternaCarga.idProducto && | 207 | $scope.cisternas[i].cisternaCarga.idProducto && |
208 | $scope.articuloSeleccionado.idArticulo !== | 208 | $scope.articuloSeleccionado.idArticulo !== |
209 | $scope.cisternas[i].cisternaCarga.idProducto) | 209 | $scope.cisternas[i].cisternaCarga.idProducto) |
210 | { | 210 | { |
211 | $scope.cisternas[i].disabled = true; | 211 | $scope.cisternas[i].disabled = true; |
212 | continue; | 212 | continue; |
213 | } | 213 | } |
214 | $scope.cisternas[i].disabled = false; | 214 | $scope.cisternas[i].disabled = false; |
215 | } | 215 | } |
216 | }; | 216 | }; |
217 | $scope.rellenarInput = function(input) { | 217 | $scope.rellenarInput = function(input, cisterna) { |
218 | if(!$scope.articuloSeleccionado) return; | 218 | if(!$scope.articuloSeleccionado) return; |
219 | if($scope.articuloSeleccionado.cantidad - | 219 | if($scope.articuloSeleccionado.cantidad - |
220 | $scope.articuloSeleccionado.cantidadCargada === 0) { | 220 | $scope.articuloSeleccionado.cantidadCargada === 0) { |
221 | return input; | 221 | return input; |
222 | } | 222 | } |
223 | if(!input) input = 0; | 223 | if(!input) input = 0; |
224 | input = parseFloat(input); | 224 | input = parseFloat(input); |
225 | input += parseFloat($scope.articuloSeleccionado.cantidad - | 225 | input += parseFloat($scope.articuloSeleccionado.cantidad - |
226 | $scope.articuloSeleccionado.cantidadCargada); | 226 | $scope.articuloSeleccionado.cantidadCargada); |
227 | if(input > cisterna.disponible) { | ||
228 | input = cisterna.disponible; | ||
229 | } | ||
227 | return input; | 230 | return input; |
228 | }; | 231 | }; |
229 | $scope.distribucionDisponible = function() { | 232 | $scope.distribucionDisponible = function() { |
230 | if(!$scope.articuloSeleccionado || $scope.articuloSeleccionado.cantidad - | 233 | if(!$scope.articuloSeleccionado || $scope.articuloSeleccionado.cantidad - |
231 | $scope.articuloSeleccionado.cantidadCargada !== 0 || | 234 | $scope.articuloSeleccionado.cantidadCargada !== 0 || |
232 | !$scope.tieneArticulosPendientes()) { | 235 | !$scope.tieneArticulosPendientes()) { |
233 | return false; | 236 | return false; |
234 | } | 237 | } |
235 | for(var i = 0; i < $scope.cisternas.length; i++) { | 238 | for(var i = 0; i < $scope.cisternas.length; i++) { |
236 | if($scope.aCargar[i] > $scope.cisternas[i].disponible) { | 239 | if($scope.aCargar[i] > $scope.cisternas[i].disponible) { |
237 | return false; | 240 | return false; |
238 | } | 241 | } |
239 | } | 242 | } |
240 | return true; | 243 | return true; |
241 | }; | 244 | }; |
242 | $scope.tieneArticulosPendientes = function() { | 245 | $scope.tieneArticulosPendientes = function() { |
243 | var algunValorNegativo = $scope.aCargar.filter(function(p) { | 246 | var algunValorNegativo = $scope.aCargar.filter(function(p) { |
244 | return p < 0; | 247 | return p < 0; |
245 | }); | 248 | }); |
246 | if(algunValorNegativo.length) { | 249 | if(algunValorNegativo.length) { |
247 | return false; | 250 | return false; |
248 | } | 251 | } |
249 | var articulosDescargados = $scope.articulos.filter(function(filter) { | 252 | var articulosDescargados = $scope.articulos.filter(function(filter) { |
250 | return filter.cargado === true; | 253 | return filter.cargado === true; |
251 | }); | 254 | }); |
252 | if(articulosDescargados.length === $scope.articulos.length) { | 255 | if(articulosDescargados.length === $scope.articulos.length) { |
253 | $scope.aCargar = []; | 256 | $scope.aCargar = []; |
254 | return false; | 257 | return false; |
255 | } | 258 | } |
256 | return true; | 259 | return true; |
257 | }; | 260 | }; |
258 | }]); | 261 | }]); |
259 | 262 |
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 | Transportista | 3 | Transportista |
4 | <strong ng-bind="vehiculo.transportista.COD"></strong> | 4 | <strong ng-bind="vehiculo.transportista.COD"></strong> |
5 | <strong ng-bind="vehiculo.transportista.NOM"></strong> | 5 | <strong ng-bind="vehiculo.transportista.NOM"></strong> |
6 | Unidad <strong ng-bind="vehiculo.codigo"></strong> | 6 | Unidad <strong ng-bind="vehiculo.codigo"></strong> |
7 | Tractor <strong ng-bind="vehiculo.tractor"></strong> | 7 | Tractor <strong ng-bind="vehiculo.tractor"></strong> |
8 | <br> | 8 | <br> |
9 | <div ng-show="idRemito !== -1"> | 9 | <div ng-show="idRemito !== -1"> |
10 | <span>Remito Nº</span> | 10 | <span>Remito Nº</span> |
11 | <strong ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></strong> | 11 | <strong ng-bind="[remito.sucursal, remito.numeroRemito] | comprobante"></strong> |
12 | <span>, Fecha</span> | 12 | <span>, Fecha</span> |
13 | <strong ng-bind="remito.fechaRemito | date: 'dd/MM/yyyy HH:mm'"></strong> | 13 | <strong ng-bind="remito.fechaRemito | date: 'dd/MM/yyyy HH:mm'"></strong> |
14 | <span>, Cliente</span> | 14 | <span>, Cliente</span> |
15 | <strong ng-bind="remito.nombreCliente"></strong> | 15 | <strong ng-bind="remito.nombreCliente"></strong> |
16 | <span>, Domicilio entrega</span> | 16 | <span>, Domicilio entrega</span> |
17 | <strong ng-bind="remito.domicilioStamp"></strong> | 17 | <strong ng-bind="remito.domicilioStamp"></strong> |
18 | </div> | 18 | </div> |
19 | </div> | 19 | </div> |
20 | <div class="modal-body"> | 20 | <div class="modal-body"> |
21 | <div> | 21 | <div> |
22 | <table class="table table-sm" ng-show="idRemito !== -1"> | 22 | <table class="table table-sm" ng-show="idRemito !== -1"> |
23 | <thead> | 23 | <thead> |
24 | <tr> | 24 | <tr> |
25 | <th></th> | 25 | <th></th> |
26 | <th>Articulo</th> | 26 | <th>Articulo</th> |
27 | <th>Cantidad</th> | 27 | <th>Cantidad</th> |
28 | <th>Cargado</th> | 28 | <th>Cargado</th> |
29 | <th>Resta asignar</th> | 29 | <th>Resta asignar</th> |
30 | </tr> | 30 | </tr> |
31 | </thead> | 31 | </thead> |
32 | <tbody> | 32 | <tbody> |
33 | <tr ng-repeat="(key, articulo) in articulos"> | 33 | <tr ng-repeat="(key, articulo) in articulos"> |
34 | <td><input | 34 | <td><input |
35 | type="radio" | 35 | type="radio" |
36 | name="articuloRadio" | 36 | name="articuloRadio" |
37 | id="{{'articulo' + articulo.id}}" | 37 | id="{{'articulo' + articulo.id}}" |
38 | ng-checked="articuloSeleccionado.id === articulo.id" | 38 | ng-checked="articuloSeleccionado.id === articulo.id" |
39 | ng-disabled="articulo.cargado" | 39 | ng-disabled="articulo.cargado" |
40 | ng-click="seleccionarArticulo(articulo)" | 40 | ng-click="seleccionarArticulo(articulo)" |
41 | ></td> | 41 | ></td> |
42 | <td ng-bind="articulo.descripcion"></td> | 42 | <td ng-bind="articulo.descripcion"></td> |
43 | <td ng-bind="articulo.cantidad"></td> | 43 | <td ng-bind="articulo.cantidad"></td> |
44 | <td ng-bind="articulo.cantidadCargada || 0"></td> | 44 | <td ng-bind="articulo.cantidadCargada || 0"></td> |
45 | <td ng-bind="articulo.cantidad - articulo.cantidadCargada"></td> | 45 | <td ng-bind="articulo.cantidad - articulo.cantidadCargada"></td> |
46 | </tr> | 46 | </tr> |
47 | </tbody> | 47 | </tbody> |
48 | </table> | 48 | </table> |
49 | <table class="table table-sm" ladda="cargandoDatos" data-spinner-color="#FF0000"> | 49 | <table class="table table-sm" ladda="cargandoDatos" data-spinner-color="#FF0000"> |
50 | <thead> | 50 | <thead> |
51 | <tr> | 51 | <tr> |
52 | <th width="10%">Cisterna</th> | 52 | <th width="10%">Cisterna</th> |
53 | <th>Capacidad</th> | 53 | <th>Capacidad</th> |
54 | <th>Articulo cargado</th> | 54 | <th>Articulo cargado</th> |
55 | <th width="20%">Asignado</th> | 55 | <th width="20%">Asignado</th> |
56 | <th>Cargado / Capacidad Disponible</th> | 56 | <th>Cargado / Capacidad Disponible</th> |
57 | </tr> | 57 | </tr> |
58 | </thead> | 58 | </thead> |
59 | <tbody> | 59 | <tbody> |
60 | <tr ng-repeat="(key, cisterna) in cisternas"> | 60 | <tr ng-repeat="(key, cisterna) in cisternas"> |
61 | <td class="py-3" ng-bind="cisterna.codigo"></td> | 61 | <td class="py-3" ng-bind="cisterna.codigo"></td> |
62 | <td class="py-3" ng-bind="cisterna.capacidad"></td> | 62 | <td class="py-3" ng-bind="cisterna.capacidad"></td> |
63 | <td class="py-3" ng-bind="cisterna.cisternaCarga.articulo.DetArt || 'Sin asignar'"></td> | 63 | <td class="py-3" ng-bind="cisterna.cisternaCarga.articulo.DetArt || 'Sin asignar'"></td> |
64 | <td ng-if="idRemito != -1"> | 64 | <td ng-if="idRemito != -1"> |
65 | <input | 65 | <input |
66 | class="form-control" | 66 | class="form-control" |
67 | foca-tipo-input | 67 | foca-tipo-input |
68 | foca-teclado | 68 | foca-teclado |
69 | placeholder="A cargar..." | 69 | placeholder="A cargar..." |
70 | ng-model="aCargar[key]" | 70 | ng-model="aCargar[key]" |
71 | ng-disabled="cisterna.disabled || !tieneArticulosPendientes()" | 71 | ng-disabled="cisterna.disabled || !tieneArticulosPendientes()" |
72 | ng-focus="aCargar[key] = rellenarInput(aCargar[key]); actualizarArticulo()" | 72 | ng-focus="aCargar[key] = rellenarInput(aCargar[key], cisterna); actualizarArticulo()" |
73 | ng-change="actualizarArticulo()" | 73 | ng-change="actualizarArticulo()" |
74 | > | 74 | > |
75 | </td> | 75 | </td> |
76 | <td ng-if="idRemito == -1"> | 76 | <td ng-if="idRemito == -1"> |
77 | <input | 77 | <input |
78 | class="form-control" | 78 | class="form-control" |
79 | placeholder="A cargar..." | 79 | placeholder="A cargar..." |
80 | readonly> | 80 | readonly> |
81 | </td> | 81 | </td> |
82 | <td><div class="progress foca-alto-progress pl-0 pr-0 mt-1"> | 82 | <td><div class="progress foca-alto-progress pl-0 pr-0 mt-1"> |
83 | <strong | 83 | <strong |
84 | class="mt-2 col-4 text-center position-absolute" | 84 | class="mt-2 col-4 text-center position-absolute" |
85 | ng-bind="(cisterna.cisternaCarga.cantidad || 0) + '/' + | 85 | ng-bind="(cisterna.cisternaCarga.cantidad || 0) + '/' + |
86 | (cisterna.capacidad - cisterna.cisternaCarga.cantidad)"> | 86 | (cisterna.capacidad - cisterna.cisternaCarga.cantidad)"> |
87 | </strong> | 87 | </strong> |
88 | <div | 88 | <div |
89 | id="{{cisterna.id}}" | 89 | id="{{cisterna.id}}" |
90 | class="progress-bar" | 90 | class="progress-bar" |
91 | role="progressbar" | 91 | role="progressbar" |
92 | aria-valuemin="0" | 92 | aria-valuemin="0" |
93 | aria-valuemax="{{cisterna.capacidad}}" | 93 | aria-valuemax="{{cisterna.capacidad}}" |
94 | ng-style="{'width':'{{calcularPorcentaje(cisterna)}}'}"> | 94 | ng-style="{'width':'{{calcularPorcentaje(cisterna)}}'}"> |
95 | </div> | 95 | </div> |
96 | </div> | 96 | </div> |
97 | </td> | 97 | </td> |
98 | </tr> | 98 | </tr> |
99 | </tbody> | 99 | </tbody> |
100 | </table> | 100 | </table> |
101 | <div class="col-12"> | 101 | <div class="col-12"> |
102 | <button | 102 | <button |
103 | class="form-control btn btn-success" | 103 | class="form-control btn btn-success" |
104 | ladda="cargando" | 104 | ladda="cargando" |
105 | data-spinner-color="#FF0000" | 105 | data-spinner-color="#FF0000" |
106 | type="button" | 106 | type="button" |
107 | ng-disabled="!distribucionDisponible()" | 107 | ng-disabled="!distribucionDisponible()" |
108 | ng-class="{'btn-light': !distribucionDisponible()}" | 108 | ng-class="{'btn-light': !distribucionDisponible()}" |
109 | ng-click="cargarACisternas(vehiculo)" | 109 | ng-click="cargarACisternas(vehiculo)" |
110 | foca-focus="distribucionDisponible()"> | 110 | foca-focus="distribucionDisponible()"> |
111 | Aplicar distribución de cargas | 111 | Aplicar distribución de cargas |
112 | </button> | 112 | </button> |
113 | </div> | 113 | </div> |
114 | </div> | 114 | </div> |
115 | </div> | 115 | </div> |
116 | <div class="modal-footer py-1"> | 116 | <div class="modal-footer py-1"> |
117 | <button | 117 | <button |
118 | class="btn btn-sm btn-secondary" | 118 | class="btn btn-sm btn-secondary" |
119 | ladda="cargando" | 119 | ladda="cargando" |
120 | type="button" | 120 | type="button" |
121 | ng-click="cancelar()">Cancelar</button> | 121 | ng-click="cancelar()">Cancelar</button> |
122 | <button | 122 | <button |
123 | class="btn btn-sm btn-primary" | 123 | class="btn btn-sm btn-primary" |
124 | ladda="cargando" | 124 | ladda="cargando" |
125 | type="button" | 125 | type="button" |
126 | ng-click="aceptar()" | 126 | ng-click="aceptar()" |
127 | ng-disabled="tieneArticulosPendientes() || idRemito === -1" | 127 | ng-disabled="tieneArticulosPendientes() || idRemito === -1" |
128 | foca-focus="!tieneArticulosPendientes() && idRemito !== -1">Cargar</button> | 128 | foca-focus="!tieneArticulosPendientes() && idRemito !== -1">Cargar</button> |
129 | </div> | 129 | </div> |
130 | 130 |