Commit 959b1c854c42ab25c5a6975962a0cbc45f075ede
1 parent
b39c3ddb88
Exists in
master
cantidad descargada
Showing
2 changed files
with
35 additions
and
21 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -29,9 +29,9 @@ angular.module('focaModalDetalleHojaRuta') |
29 | 29 | } |
30 | 30 | |
31 | 31 | $scope.cambio = function (articulo) { |
32 | - if (!$scope.articuloSeleccionado.descargado) { | |
33 | - $scope.articuloSeleccionado.cantidadDescargada = 0; | |
34 | - } | |
32 | + // if (!$scope.articuloSeleccionado.descargado) { | |
33 | + // $scope.articuloSeleccionado.cantidadDescargada = 0; | |
34 | + // } | |
35 | 35 | $scope.aDescargar = []; |
36 | 36 | $scope.articuloSeleccionado = articulo; |
37 | 37 | }; |
... | ... | @@ -63,7 +63,9 @@ angular.module('focaModalDetalleHojaRuta') |
63 | 63 | $scope.cargando = false; |
64 | 64 | return; |
65 | 65 | } |
66 | + | |
66 | 67 | cisternaCarga.cantidad -= descarga; |
68 | + $scope.articuloSeleccionado.cantidadDescargada += descarga; | |
67 | 69 | |
68 | 70 | //Guardar |
69 | 71 | var now = new Date(); |
... | ... | @@ -142,17 +144,30 @@ angular.module('focaModalDetalleHojaRuta') |
142 | 144 | $uibModalInstance.dismiss('cancel'); |
143 | 145 | }; |
144 | 146 | $scope.distribucionDisponible = function () { |
145 | - return $scope.articuloSeleccionado.cantidadDescargada && | |
146 | - $scope.articuloSeleccionado.cantidadDescargada <= | |
147 | - $scope.articuloSeleccionado.cantidad; | |
148 | - }; | |
149 | - $scope.actualizarArticulo = function () { | |
150 | - $scope.articuloSeleccionado.cantidadDescargada = 0; | |
151 | - for (var i = 0; i < $scope.aDescargar.length; i++) { | |
152 | - $scope.articuloSeleccionado.cantidadDescargada += | |
153 | - parseFloat($scope.aDescargar[i]) || 0; | |
154 | - } | |
147 | + | |
148 | + return $scope.cisternas.filter(function (cisterna, index) { | |
149 | + | |
150 | + return $scope.aDescargar[index] ? $scope.aDescargar[index] > | |
151 | + cisterna.cisternaCarga.cantidad : cisterna; | |
152 | + | |
153 | + }).length; | |
154 | + | |
155 | 155 | }; |
156 | + // $scope.actualizarArticulo = function () { | |
157 | + // // $scope.articuloSeleccionado.cantidadDescargada = 0; | |
158 | + // for (var i = 0; i < $scope.aDescargar.length; i++) { | |
159 | + | |
160 | + // var aRestar = parseInt($scope.aDescargar[i].toString() | |
161 | + // .slice(0, $scope.aDescargar[i].toString().length - 1)); | |
162 | + | |
163 | + // if (aRestar && aRestar != $scope.aDescargar[i]) { | |
164 | + // $scope.articuloSeleccionado.cantidadDescargada -= aRestar; | |
165 | + // } | |
166 | + | |
167 | + // $scope.articuloSeleccionado.cantidadDescargada += | |
168 | + // parseFloat($scope.aDescargar[i]) || 0; | |
169 | + // } | |
170 | + // }; | |
156 | 171 | $scope.actualizarPuntoDescarga = function () { |
157 | 172 | var modalInstance = $uibModal.open( |
158 | 173 | { |
src/views/modal-detalle-hoja-ruta.html
... | ... | @@ -49,17 +49,17 @@ |
49 | 49 | </table> |
50 | 50 | </div> |
51 | 51 | </div> |
52 | - <div class="col py-3"> | |
52 | + <div class="col py-3"> | |
53 | 53 | <strong>Articulo a descargar</strong> |
54 | 54 | <table class="table table-sm mt-2"> |
55 | 55 | <thead> |
56 | 56 | <tr> |
57 | 57 | <th></th> |
58 | - <th>Articulo</th> | |
59 | - <th>Total</th> | |
60 | - <th>Descargado</th> | |
61 | - </tr> | |
62 | - </thead> | |
58 | + <th>Articulo</th> | |
59 | + <th>Total</th> | |
60 | + <th>Descargado</th> | |
61 | + </tr> | |
62 | + </thead> | |
63 | 63 | <tbody> |
64 | 64 | <tr ng-repeat="(key, articulo) in remito.articulosRemito"> |
65 | 65 | <td class="pt-2"> |
... | ... | @@ -95,7 +95,6 @@ |
95 | 95 | class="form-control form-control-sm" |
96 | 96 | type="number" |
97 | 97 | ng-model="aDescargar[key]" |
98 | - ng-change="actualizarArticulo()" | |
99 | 98 | foca-focus="articuloSeleccionado.idArticulo == cisterna.cisternaCarga.idProducto" |
100 | 99 | ng-disabled="articuloSeleccionado.idArticulo != cisterna.cisternaCarga.idProducto |
101 | 100 | || readonly"/></td> |
... | ... | @@ -134,7 +133,7 @@ |
134 | 133 | ladda="cargando" |
135 | 134 | data-spinner-color="#FF0000" |
136 | 135 | type="button" |
137 | - ng-disabled="!distribucionDisponible() || !numeroRecibo" | |
136 | + ng-disabled="distribucionDisponible() || !numeroRecibo" | |
138 | 137 | ng-click="descargar(13)"> |
139 | 138 | Descargar |
140 | 139 | </button> |