Commit e10102e20c825a4c36378dc8a18497ed7de75302
1 parent
92cd7d0d02
Exists in
master
se agrega articulos al final de la lista
Showing
2 changed files
with
65 additions
and
45 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -382,7 +382,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
382 | 382 | return; |
383 | 383 | } |
384 | 384 | delete $scope.articuloACargar.sectorCodigo; |
385 | - $scope.articulosTabla.unshift($scope.articuloACargar); | |
385 | + $scope.articulosTabla.push($scope.articuloACargar); | |
386 | 386 | $scope.cargando = true; |
387 | 387 | } |
388 | 388 | }; |
src/views/nota-pedido.html
... | ... | @@ -50,12 +50,13 @@ |
50 | 50 | <table class="table table-striped table-sm table-dark tabla-articulos"> |
51 | 51 | <thead> |
52 | 52 | <tr> |
53 | - <th>Código</th> | |
54 | - <th>Descripción</th> | |
55 | - <th class="text-right">Cantidad</th> | |
56 | - <th class="text-right">Precio Unitario</th> | |
57 | - <th class="text-right">SubTotal</th> | |
58 | - <th class="text-right"> | |
53 | + <th class="tabla-articulo-numero">#</th> | |
54 | + <th class="tabla-articulo-codigo">Código</th> | |
55 | + <th class="tabla-articulo-descripcion">Descripción</th> | |
56 | + <th class="tabla-articulo-cantidad text-right">Cantidad</th> | |
57 | + <th class="tabla-articulo-precio text-right">Precio Unitario</th> | |
58 | + <th class="tabla-articulo-subtotal text-right">SubTotal</th> | |
59 | + <th class="tabla-articulo-boton text-right"> | |
59 | 60 | <button |
60 | 61 | class="btn btn-outline-secondary selectable" |
61 | 62 | ng-click="show = !show; masMenos()" |
... | ... | @@ -76,44 +77,14 @@ |
76 | 77 | </tr> |
77 | 78 | </thead> |
78 | 79 | <tbody class="tabla-articulos-body"> |
79 | - <tr ng-show="!cargando"> | |
80 | - <td><input | |
81 | - class="form-control" | |
82 | - ng-model="articuloACargar.sectorCodigo" | |
83 | - readonly></td> | |
84 | - <td><input | |
85 | - class="form-control" | |
86 | - ng-model="articuloACargar.descripcion" | |
87 | - readonly></td> | |
88 | - <td class="text-right"><input | |
89 | - class="form-control" | |
90 | - type="number" | |
91 | - min="1" | |
92 | - ng-model="articuloACargar.cantidad" | |
93 | - foca-focus="!cargando" | |
94 | - esc-key="resetFilter()" | |
95 | - ng-keypress="agregarATabla($event.keyCode)"></td> | |
96 | - <td class="text-right"><input | |
97 | - class="form-control" | |
98 | - ng-value="articuloACargar.precio | currency: '$'" | |
99 | - readonly></td> | |
100 | - <td class="text-right"><input | |
101 | - class="form-control" | |
102 | - ng-value="getSubTotal() | currency: '$'" | |
103 | - readonly></td> | |
104 | - <td class="text-right"><button | |
105 | - class="btn btn-outline-secondary btn-sm" | |
106 | - ng-click="agregarATabla(13)"> | |
107 | - <i class="fa fa-save"></i> | |
108 | - </button></td> | |
109 | - </tr> | |
110 | 80 | <tr |
111 | 81 | ng-repeat="(key, articulo) in articulosTabla" |
112 | - ng-show="show || key == 0" | |
82 | + ng-show="show || key == (articulosTabla.length - 1)" | |
113 | 83 | > |
114 | - <td ng-bind="articulo.sector + '-' + articulo.codigo"></td> | |
115 | - <td ng-bind="articulo.descripcion"></td> | |
116 | - <td class="text-right"><input | |
84 | + <td class="tabla-articulo-numero" ng-bind="key + 1"></td> | |
85 | + <td class="tabla-articulo-codigo" ng-bind="articulo.sector + '-' + articulo.codigo"></td> | |
86 | + <td class="tabla-articulo-descripcion" ng-bind="articulo.descripcion"></td> | |
87 | + <td class="tabla-articulo-cantidad text-right"><input | |
117 | 88 | ng-show="articulo.edit" |
118 | 89 | ng-model="articulo.cantidad" |
119 | 90 | class="form-control" |
... | ... | @@ -130,12 +101,12 @@ |
130 | 101 | ng-bind="articulo.cantidad"> |
131 | 102 | </i> |
132 | 103 | </td> |
133 | - <td class="text-right" ng-bind="articulo.precio | currency: '$'"></td> | |
104 | + <td class="tabla-articulo-precio text-right" ng-bind="articulo.precio | currency: '$'"></td> | |
134 | 105 | <td |
135 | - class="text-right" | |
106 | + class="tabla-articulo-subtotal text-right" | |
136 | 107 | ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> |
137 | 108 | </td> |
138 | - <td class="text-right"> | |
109 | + <td class="tabla-articulo-boton text-right"> | |
139 | 110 | <button |
140 | 111 | class="btn btn-outline-secondary btn-sm" |
141 | 112 | ng-click="quitarArticulo(key)" |
... | ... | @@ -146,6 +117,55 @@ |
146 | 117 | </tr> |
147 | 118 | </tbody> |
148 | 119 | <tfoot> |
120 | + <tr ng-show="!cargando"> | |
121 | + <td class="tabla-articulo-numero align-middle" ng-bind="articulosTabla.length + 1"></td> | |
122 | + <td class="tabla-articulo-codigo"> | |
123 | + <input | |
124 | + class="form-control" | |
125 | + ng-model="articuloACargar.sectorCodigo" | |
126 | + readonly | |
127 | + > | |
128 | + </td> | |
129 | + <td class="tabla-articulo-descripcion"> | |
130 | + <input | |
131 | + class="form-control" | |
132 | + ng-model="articuloACargar.descripcion" | |
133 | + readonly | |
134 | + > | |
135 | + </td> | |
136 | + <td class="tabla-articulo-cantidad text-right"> | |
137 | + <input | |
138 | + class="form-control" | |
139 | + type="number" | |
140 | + min="1" | |
141 | + ng-model="articuloACargar.cantidad" | |
142 | + foca-focus="!cargando" | |
143 | + esc-key="resetFilter()" | |
144 | + ng-keypress="agregarATabla($event.keyCode)" | |
145 | + > | |
146 | + </td> | |
147 | + <td class="tabla-articulo-precio text-right"> | |
148 | + <input | |
149 | + class="form-control" | |
150 | + ng-value="articuloACargar.precio | currency: '$'" | |
151 | + readonly | |
152 | + > | |
153 | + </td> | |
154 | + <td class="tabla-articulo-subtotal text-right"> | |
155 | + <input | |
156 | + class="form-control" | |
157 | + ng-value="getSubTotal() | currency: '$'" | |
158 | + readonly | |
159 | + ></td> | |
160 | + <td class="tabla-articulo-boton text-right"> | |
161 | + <button | |
162 | + class="btn btn-outline-secondary btn-sm" | |
163 | + ng-click="agregarATabla(13)" | |
164 | + > | |
165 | + <i class="fa fa-save"></i> | |
166 | + </button> | |
167 | + </td> | |
168 | + </tr> | |
149 | 169 | <tr ng-show="cargando"> |
150 | 170 | <td colspan="6"> |
151 | 171 | <input |