Commit 10ff3c6922d7a12790e5b279cc2a78132e569bf5
Exists in
master
Merge branch 'master' into 'master'
Master(mpuebla) See merge request !8
Showing
2 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -16,11 +16,11 @@ angular.module('focaModalDescarga') |
16 | 16 | focaModalDetalleHojaRutaService, focaSeguimientoService, crearRemitoService) { |
17 | 17 | |
18 | 18 | //#region variables |
19 | - console.log(remito); | |
20 | 19 | $scope.remito = {}; |
21 | 20 | $scope.remito = remito; |
22 | 21 | $scope.nroRecibo = 0; |
23 | 22 | $scope.cisternas = remito.cisternas; |
23 | + $scope.nroSucursal = "00" + remito.sucursal; | |
24 | 24 | $scope.nroRemito; |
25 | 25 | $scope.articulos = []; |
26 | 26 | //#endregion |
... | ... | @@ -46,12 +46,7 @@ angular.module('focaModalDescarga') |
46 | 46 | focaModalService.alert("No has seleccionado cliente"); |
47 | 47 | return; |
48 | 48 | } |
49 | - if (!validarDescarga()) { | |
50 | - focaModalService.alert("Cantidad de descarga ingresada erronea"); | |
51 | - return; | |
52 | - } | |
53 | - if (!$scope.nroRecibo) { | |
54 | - focaModalService.alert("No ingresaste nro de recibo"); | |
49 | + if (validarDescarga()) { | |
55 | 50 | return; |
56 | 51 | } |
57 | 52 | //#region OBJETO REMITO |
... | ... | @@ -102,10 +97,9 @@ angular.module('focaModalDescarga') |
102 | 97 | operacionTipo: 0, //TODO |
103 | 98 | idHojaRuta: $scope.remito.idHojaRuta |
104 | 99 | } |
105 | - //#endregionc | |
100 | + //#endregion | |
106 | 101 | focaModalDescargasService.crearRemito({ remito: remito, notaPedido: { id: 0 } }) |
107 | 102 | .then(function (res) { |
108 | - console.log(res); | |
109 | 103 | remitoId = res.data.id |
110 | 104 | descargar(remitoId); |
111 | 105 | focaModalDescargasService. |
... | ... | @@ -137,12 +131,6 @@ angular.module('focaModalDescarga') |
137 | 131 | var cisternaCargas = []; |
138 | 132 | var cisternaCarga = $scope.cisternas[i].cisternaCarga; |
139 | 133 | if (!descarga) continue; |
140 | - // if (descarga > cisternaCarga.cantidad) { | |
141 | - // focaModalService.alert('La cantidad a descargar no debe ser ' + | |
142 | - // 'mayor a la cantidad de la cisterna'); | |
143 | - // $scope.cargando = false; | |
144 | - // return; | |
145 | - // } | |
146 | 134 | cisternaCarga.cantidad -= descarga; |
147 | 135 | |
148 | 136 | //Guardar |
... | ... | @@ -197,15 +185,17 @@ angular.module('focaModalDescarga') |
197 | 185 | return importe; |
198 | 186 | }; |
199 | 187 | function validarDescarga() { |
200 | - hasDisponible = $scope.cisternas.find(function (cisterna) { | |
201 | - return parseInt(cisterna.cisternaCarga.descargar) >= 0 && | |
202 | - parseInt(cisterna.cisternaCarga.descargar) <= | |
203 | - cisterna.cisternaCarga.cantidad | |
204 | - }); | |
205 | - return hasDisponible; | |
188 | + for (var i = 0; i < $scope.cisternas.length; i++) { | |
189 | + if (parseInt($scope.cisternas[i].cisternaCarga.descargar) > | |
190 | + $scope.cisternas[i].cisternaCarga.cantidad || | |
191 | + parseInt($scope.cisternas[i].cisternaCarga.descargar) < 0) { | |
192 | + focaModalService.alert("Cantidad de descarga ingresada erronea"); | |
193 | + return true; | |
194 | + } | |
195 | + } | |
196 | + return false; | |
206 | 197 | }; |
207 | 198 | $scope.seleccionarCliente = function () { |
208 | - | |
209 | 199 | var modalInstance = $uibModal.open( |
210 | 200 | { |
211 | 201 | ariaLabelledBy: 'Busqueda de Cliente', |
src/views/foca-modal-descarga.html
... | ... | @@ -35,40 +35,41 @@ |
35 | 35 | <div class="col-9 align-self-center mt-1"> |
36 | 36 | <label ng-bind="remito.cliente.DOM"></label> |
37 | 37 | </div> |
38 | - <!-- <div class="col-3 pl-1"> | |
39 | - <strong>Punto descarga</strong> | |
40 | - </div> | |
41 | - <div class="col-9"> | |
42 | - <label>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Fugiat facilis commodi dolore aperiam dolor quaerat, sit earum vero iste itaque aspernatur qui nisi id repudiandae error architecto inventore vel temporibus.</label> | |
43 | - </div> --> | |
44 | 38 | <div class="col-3 align-self-center px-1 mt-1"> |
45 | 39 | <strong>Remito Nº</strong> |
46 | 40 | </div> |
47 | - <div class="col-9 mt-1"> | |
41 | + <div class="col-3 pr-0 mt-1"> | |
48 | 42 | <input |
49 | - type="text" class="form-control form-control-sm" | |
50 | - ng-model="nroRemito" readonly> | |
43 | + type="text" class="text-center form-control form-control-sm" | |
44 | + ng-model="nroSucursal" readonly> | |
51 | 45 | </div> |
52 | - <div class="col-12 mt-3"> | |
46 | + <div class="col-6 mt-1"> | |
47 | + <input | |
48 | + type="number" class="text-center form-control form-control-sm" | |
49 | + ng-model="remito.numeroRemito"> | |
50 | + </div> | |
51 | + <div class="col-12 mt-3 p-0"> | |
53 | 52 | <table class="table"> |
54 | 53 | <thead> |
55 | 54 | <tr> |
56 | 55 | <th>Cisterna</th> |
57 | - <th>Articulo</th> | |
58 | - <th>Disponibles</th> | |
56 | + <th>Articulo/Disponibles</th> | |
59 | 57 | <th>Descargar</th> |
60 | 58 | </tr> |
61 | 59 | </thead> |
62 | 60 | <tbody> |
63 | 61 | <tr ng-repeat="cisterna in cisternas"> |
64 | - <td ng-bind="cisterna.codigo"></td> | |
65 | - <td ng-bind="cisterna.cisternaCarga.articulo.DetArt"></td> | |
66 | - <td ng-bind="cisterna.cisternaCarga.cantidad"></td> | |
62 | + <td class="text-center" ng-bind="cisterna.codigo"></td> | |
63 | + <td class="text-center"> | |
64 | + {{cisterna.cisternaCarga.articulo.DetArt}}<br> | |
65 | + {{cisterna.cisternaCarga.cantidad}} | |
66 | + </td> | |
67 | 67 | <td> |
68 | 68 | <input |
69 | - ng-init="cisterna.cisternaCarga.descargar = cisterna.cisternaCarga.cantidad" | |
69 | + ng-init="cisterna.cisternaCarga.descargar = | |
70 | + cisterna.cisternaCarga.cantidad" | |
70 | 71 | ng-model="cisterna.cisternaCarga.descargar" |
71 | - type="text" class="form-control col-12"> | |
72 | + type="number" class="text-center form-control col-12"> | |
72 | 73 | </td> |
73 | 74 | </tr> |
74 | 75 | </tbody> |
... | ... | @@ -78,7 +79,9 @@ |
78 | 79 | <strong>Nº Recibo</strong> |
79 | 80 | </div> |
80 | 81 | <div class="col-9"> |
81 | - <input ng-model="nroRecibo" class="form-control" type="text" placeholder="Nº de recibo"> | |
82 | + <input | |
83 | + ng-model="nroRecibo" class="form-control" | |
84 | + type="number" placeholder="Nº de recibo"> | |
82 | 85 | </div> |
83 | 86 | </div> |
84 | 87 | </div> |