Commit e9ecb6896474811013d820b719a981800dd80121
1 parent
362e627157
Exists in
master
cambio ingreso articulo
Showing
2 changed files
with
54 additions
and
46 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -114,14 +114,16 @@ angular.module('focaCrearNotaPedido') |
114 | 114 | var newArt = |
115 | 115 | { |
116 | 116 | id: 0, |
117 | - codigo: producto.FiltroSectorCodigo, | |
117 | + codigo: producto.codigo, | |
118 | + sector: producto.sector, | |
119 | + descripcion: producto.descripcion, | |
118 | 120 | item: $scope.articulosTabla.length + 1, |
119 | 121 | nombre: producto.descripcion, |
120 | - precio: producto.precio, | |
122 | + precio: producto.precio.toFixed(2), | |
121 | 123 | costoUnitario: producto.costo, |
122 | 124 | cantidad: 1 |
123 | 125 | }; |
124 | - $scope.articulosTabla.unshift(newArt); | |
126 | + $scope.articuloACargar = newArt; | |
125 | 127 | }, function() { |
126 | 128 | // funcion ejecutada cuando se cancela el modal |
127 | 129 | } |
... | ... | @@ -223,6 +225,7 @@ angular.module('focaCrearNotaPedido') |
223 | 225 | modalInstance.result.then( |
224 | 226 | function(precioCondicion) { |
225 | 227 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; |
228 | + idLista = precioCondicion.idListaPrecio; | |
226 | 229 | }, function() { |
227 | 230 | |
228 | 231 | } |
... | ... | @@ -248,6 +251,12 @@ angular.module('focaCrearNotaPedido') |
248 | 251 | ); |
249 | 252 | } |
250 | 253 | }; |
254 | + $scope.agregarATabla = function(key) { | |
255 | + if(key === 13) { | |
256 | + $scope.articulosTabla.unshift($scope.articuloACargar); | |
257 | + $scope.articuloACargar = undefined; | |
258 | + } | |
259 | + }; | |
251 | 260 | } |
252 | 261 | ] |
253 | 262 | ) |
src/views/nota-pedido.html
... | ... | @@ -139,13 +139,12 @@ |
139 | 139 | <tr> |
140 | 140 | <th>Sector</th> |
141 | 141 | <th>Código</th> |
142 | - <th>Descripción</th> | |
143 | - <th>Cantidad</th> | |
142 | + <th>Descripción</th> | |
144 | 143 | <th>Precio Unitario</th> |
144 | + <th>Cantidad</th> | |
145 | 145 | <th>SubTotal</th> |
146 | - <th></th> | |
147 | 146 | <th> |
148 | - <button class="btn btn-outline-secondary selectable" style="float: right;" ng-click="show = !show"> | |
147 | + <button class="btn btn-outline-secondary selectable" style="float: right;" ng-click="show = !show; masMenos()" > | |
149 | 148 | <i class="fa fa-chevron-down" ng-hide="show" aria-hidden="true"></i> |
150 | 149 | <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i> |
151 | 150 | </button> |
... | ... | @@ -153,51 +152,51 @@ |
153 | 152 | </tr> |
154 | 153 | </thead> |
155 | 154 | <tbody> |
156 | - <tr> | |
155 | + <tr ng-show="!articuloACargar"> | |
157 | 156 | <td colspan="2"><input class="form-control" readonly ng-click="seleccionarArticulo()"></td> |
158 | 157 | <td></td> |
159 | 158 | <td></td> |
160 | 159 | <td></td> |
161 | 160 | <td></td> |
162 | 161 | <td></td> |
163 | - <td></td> | |
164 | 162 | </tr> |
165 | - <tr> | |
166 | - <td>1</td> | |
167 | - <td>1</td> | |
168 | - <td>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...</td> | |
169 | - <td>{{10000 | number: 2}}</td> | |
170 | - <td>{{1000000000 | currency:'$'}}</td> | |
171 | - <td>{{1000000000 | currency:'$'}}</td> | |
172 | - <td></td> | |
173 | - <td class="text-center"> | |
174 | - <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo()"> | |
175 | - <i class="fa fa-trash"></i> | |
176 | - </button> | |
177 | - </td> | |
163 | + <tr ng-show="articuloACargar"> | |
164 | + <td><input | |
165 | + class="form-control" | |
166 | + ng-model="articuloACargar.sector" | |
167 | + readonly></td> | |
168 | + <td><input | |
169 | + class="form-control" | |
170 | + ng-model="articuloACargar.codigo" | |
171 | + readonly></td> | |
172 | + <td><input | |
173 | + class="form-control" | |
174 | + ng-model="articuloACargar.descripcion" | |
175 | + readonly></td> | |
176 | + <td><input | |
177 | + class="form-control" | |
178 | + ng-model="articuloACargar.precio" | |
179 | + readonly></td> | |
180 | + <td><input | |
181 | + class="form-control" | |
182 | + type="number" | |
183 | + min="1" | |
184 | + value="1" | |
185 | + ng-model="articuloACargar.cantidad" | |
186 | + foca-focus="articuloACargar.cantidad == 1" | |
187 | + ng-keypress="agregarATabla($event.keyCode)"></td> | |
188 | + <td><input | |
189 | + class="form-control" | |
190 | + ng-model="(articuloACargar.precio * articuloACargar.cantidad)" | |
191 | + readonly></td> | |
178 | 192 | </tr> |
179 | - <tr ng-show="show"> | |
180 | - <td>1</td> | |
181 | - <td>2</td> | |
182 | - <td>Lorem Ipsum</td> | |
183 | - <td>1</td> | |
184 | - <td>{{1000000000 | currency:'U$D'}}</td> | |
185 | - <td>{{10 | currency:'$'}}</td> | |
186 | - <td></td> | |
187 | - <td class="text-center"> | |
188 | - <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo()"> | |
189 | - <i class="fa fa-trash"></i> | |
190 | - </button> | |
191 | - </td> | |
192 | - </tr> | |
193 | - <tr ng-show="show"> | |
194 | - <td>1</td> | |
195 | - <td>2</td> | |
196 | - <td>Lorem Ipsum</td> | |
197 | - <td>1</td> | |
198 | - <td>{{10 | currency:'$'}}</td> | |
199 | - <td>{{10 | currency:'$'}}</td> | |
200 | - <td></td> | |
193 | + <tr ng-repeat="(key, articulo) in articulosTabla" ng-show="show || key == 0"> | |
194 | + <td ng-bind="articulo.sector"></td> | |
195 | + <td ng-bind="articulo.codigo"></td> | |
196 | + <td ng-bind="articulo.descripcion"></td> | |
197 | + <td ng-bind="articulo.precio | currency:'$'"></td> | |
198 | + <td><input ng-model="articulo.cantidad" class="form-control" type="number" min="1" value="1"></td> | |
199 | + <td ng-bind="(articulo.precio * articulo.cantidad)"></td> | |
201 | 200 | <td class="text-center"> |
202 | 201 | <button class="btn btn-outline-secondary btn-sm" ng-click="quitarArticulo()"> |
203 | 202 | <i class="fa fa-trash"></i> |
... | ... | @@ -207,8 +206,8 @@ |
207 | 206 | </tbody> |
208 | 207 | <tfoot> |
209 | 208 | <tr class="table-secondary"> |
210 | - <td colspan="5"><b>Cantidad Items:</b> 3</td> | |
211 | - <td colspan="3">{{30 | currency:'$'}}</td> | |
209 | + <td colspan="5"><b>Cantidad Items:</b> <a ng-bind="articulosTabla.length"></a> </td> | |
210 | + <td colspan="3">{{getSubTotal(articulosTabla[0].item) | currency:'$'}}</td> | |
212 | 211 | </tr> |
213 | 212 | </tfoot> |
214 | 213 | </table> |