Commit 536013389cebad60c9b2b5ee23ffabb1002098c9
1 parent
fff86d0098
Exists in
master
Implementación parcial de cambios solicitados.
- Agregué botonera secundaria. - Quité elementos no usados.
Showing
3 changed files
with
135 additions
and
225 deletions
Show diff stats
src/js/controller.js
... | ... | @@ -2,6 +2,16 @@ angular.module('focaCrearNotaPedido') |
2 | 2 | .controller('notaPedidoCtrl', |
3 | 3 | ['$scope', '$uibModal', 'crearNotaPedidoService', 'focaModalService', |
4 | 4 | function($scope, $uibModal, crearNotaPedidoService, focaModalService) { |
5 | + $scope.botonera = [ | |
6 | + {texto: 'moneda', accion: function(){console.log('moneda');}}, | |
7 | + { | |
8 | + texto: 'precios y condiciones', | |
9 | + accion: function(){$scope.abrirModalListaPrecio();}}, | |
10 | + {texto: 'flete', accion: function(){$scope.abrirModalFlete();}}, | |
11 | + {texto: 'bomba', accion: function(){}}, | |
12 | + {texto: 'detalle', accion: function(){}}, | |
13 | + {texto: 'totales', accion: function(){}} | |
14 | + ]; | |
5 | 15 | $scope.show = false; |
6 | 16 | $scope.cargando = true; |
7 | 17 | $scope.dateOptions = { |
... | ... | @@ -15,7 +25,7 @@ angular.module('focaCrearNotaPedido') |
15 | 25 | }; |
16 | 26 | $scope.articulosTabla = []; |
17 | 27 | var idLista; |
18 | - var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | |
28 | + var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | |
19 | 29 | crearNotaPedidoService.getPrecioCondicion().then( |
20 | 30 | function(res) { |
21 | 31 | $scope.precioCondiciones = res.data; |
... | ... | @@ -41,7 +51,7 @@ angular.module('focaCrearNotaPedido') |
41 | 51 | // } |
42 | 52 | // ); |
43 | 53 | } else { |
44 | - $scope.notaPedido.fechaCarga = new Date(); | |
54 | + $scope.notaPedido.fechaCarga = new Date(); | |
45 | 55 | $scope.notaPedido.bomba = '0'; |
46 | 56 | $scope.notaPedido.flete = '0'; |
47 | 57 | idLista = undefined; |
... | ... | @@ -83,7 +93,7 @@ angular.module('focaCrearNotaPedido') |
83 | 93 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
84 | 94 | function(data) { |
85 | 95 | focaModalService.alert('Nota pedido creada'); |
86 | - if($scope.notaPedido.flete === 1) { | |
96 | + if($scope.notaPedido.flete === 1) { | |
87 | 97 | var flete = { |
88 | 98 | idNotaPedido: data.data.id, |
89 | 99 | idTransportista: $scope.notaPedido.fleteId, |
... | ... | @@ -221,7 +231,7 @@ angular.module('focaCrearNotaPedido') |
221 | 231 | ); |
222 | 232 | }; |
223 | 233 | $scope.getTotal = function() { |
224 | - var total = 0; | |
234 | + var total = 0; | |
225 | 235 | var arrayTempArticulos = $scope.articulosTabla; |
226 | 236 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
227 | 237 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
... | ... | @@ -231,7 +241,7 @@ angular.module('focaCrearNotaPedido') |
231 | 241 | $scope.getSubTotal = function() { |
232 | 242 | if($scope.articuloACargar) { |
233 | 243 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
234 | - } | |
244 | + } | |
235 | 245 | }; |
236 | 246 | $scope.abrirModalListaPrecio = function() { |
237 | 247 | var modalInstance = $uibModal.open( |
... | ... | @@ -253,27 +263,25 @@ angular.module('focaCrearNotaPedido') |
253 | 263 | ); |
254 | 264 | }; |
255 | 265 | $scope.abrirModalFlete = function() { |
256 | - if($scope.notaPedido.flete === '1') { | |
257 | - var modalInstance = $uibModal.open( | |
258 | - { | |
259 | - ariaLabelledBy: 'Busqueda de Flete', | |
260 | - templateUrl: 'modal-flete.html', | |
261 | - controller: 'focaModalFleteController', | |
262 | - size: 'lg' | |
263 | - } | |
264 | - ); | |
265 | - modalInstance.result.then( | |
266 | - function(flete) { | |
267 | - $scope.limpiarFlete(); | |
268 | - $scope.notaPedido.fleteNombre = flete.nombre; | |
269 | - $scope.notaPedido.fleteId = flete.id; | |
270 | - $scope.choferes = flete.chofer; | |
271 | - $scope.vehiculos = flete.vehiculo; | |
272 | - }, function() { | |
266 | + var modalInstance = $uibModal.open( | |
267 | + { | |
268 | + ariaLabelledBy: 'Busqueda de Flete', | |
269 | + templateUrl: 'modal-flete.html', | |
270 | + controller: 'focaModalFleteController', | |
271 | + size: 'lg' | |
272 | + } | |
273 | + ); | |
274 | + modalInstance.result.then( | |
275 | + function(flete) { | |
276 | + $scope.limpiarFlete(); | |
277 | + $scope.notaPedido.fleteNombre = flete.nombre; | |
278 | + $scope.notaPedido.fleteId = flete.id; | |
279 | + $scope.choferes = flete.chofer; | |
280 | + $scope.vehiculos = flete.vehiculo; | |
281 | + }, function() { | |
273 | 282 | |
274 | - } | |
275 | - ); | |
276 | - } | |
283 | + } | |
284 | + ); | |
277 | 285 | }; |
278 | 286 | $scope.agregarATabla = function(key) { |
279 | 287 | if(key === 13) { |
... | ... | @@ -287,7 +295,7 @@ angular.module('focaCrearNotaPedido') |
287 | 295 | $scope.cargando = true; |
288 | 296 | } |
289 | 297 | }; |
290 | - $scope.quitarArticulo = function(key) { | |
298 | + $scope.quitarArticulo = function(key) { | |
291 | 299 | $scope.articulosTabla.splice(key, 1); |
292 | 300 | }; |
293 | 301 | $scope.editarArticulo = function(key, articulo) { |
... | ... | @@ -329,7 +337,7 @@ angular.module('focaCrearNotaPedido') |
329 | 337 | }; |
330 | 338 | $scope.selectFocus = function($event) { |
331 | 339 | $event.target.select(); |
332 | - }; | |
340 | + }; | |
333 | 341 | } |
334 | 342 | ] |
335 | 343 | ) |
src/js/service.js
1 | 1 | angular.module('focaCrearNotaPedido') |
2 | - .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | |
2 | + .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | |
3 | 3 | var route = API_ENDPOINT.URL; |
4 | - return { | |
5 | - crearNotaPedido: function(notaPedido) { | |
6 | - return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); | |
4 | + return { | |
5 | + crearNotaPedido: function(notaPedido) { | |
6 | + return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); | |
7 | 7 | }, |
8 | 8 | obtenerNotaPedido: function() { |
9 | 9 | return $http.get(route +'/nota-pedido'); |
... | ... | @@ -43,5 +43,5 @@ angular.module('focaCrearNotaPedido') |
43 | 43 | crearFlete: function(flete) { |
44 | 44 | return $http.post(route + '/flete', {flete : flete}); |
45 | 45 | } |
46 | - }; | |
46 | + }; | |
47 | 47 | }]); |
src/views/nota-pedido.html
1 | 1 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> |
2 | 2 | <div class="row"> |
3 | - <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | |
4 | - <div class="row bg-secondary p-3"> | |
5 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
6 | - <div class="input-group"> | |
7 | - <input | |
8 | - type="text" | |
9 | - class="form-control" | |
10 | - uib-datepicker-popup="dd/MM/yyyy" | |
11 | - ng-model="notaPedido.fechaCarga" | |
12 | - is-open="popup1.opened" | |
13 | - datepicker-options="dateOptions" | |
14 | - close-text="Cerrar" | |
15 | - current-text="Hoy" | |
16 | - clear-text="Borrar" | |
17 | - alt-input-formats="altInputFormats" | |
18 | - ng-required="true" | |
19 | - /> | |
20 | - <span class="input-group-append"> | |
21 | - <button type="button" class="btn btn-default" ng-click="popup1.opened = true"> | |
22 | - <i class="fa fa-calendar"></i> | |
23 | - </button> | |
24 | - </span> | |
25 | - </div> | |
26 | - </div> | |
27 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
28 | - <div class="input-group"> | |
29 | - <input | |
30 | - class="form-control selectable" | |
31 | - type="text" | |
32 | - ng-model="notaPedido.cliente.nombre" | |
33 | - placeholder="Seleccione Cliente" | |
34 | - readonly="true" | |
35 | - ng-click="seleccionarCliente()" | |
36 | - ng-required="true" | |
37 | - foca-focus="true" | |
38 | - > | |
39 | - <span class="input-group-append"> | |
40 | - <button type="button" class="btn btn-default" ng-click="seleccionarCliente()"> | |
41 | - <i class="fa fa-search"></i> | |
42 | - </button> | |
43 | - </span> | |
44 | - </div> | |
45 | - </div> | |
46 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
47 | - <div class="input-group"> | |
48 | - <input | |
49 | - class="form-control" | |
50 | - type="text" | |
51 | - ng-model="notaPedido.vendedor.nombre" | |
52 | - placeholder="Seleccione Vendedor" | |
53 | - readonly="true" | |
54 | - > | |
55 | - <span class="input-group-append"> | |
56 | - <button type="button" class="btn btn-default" ng-click="seleccionarVendedor()"> | |
57 | - <i class="fa fa-search"></i> | |
58 | - </button> | |
59 | - </span> | |
60 | - </div> | |
61 | - </div> | |
62 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
63 | - <input | |
64 | - class="form-control selectable" | |
65 | - type="text" | |
66 | - ng-model="notaPedido.domicilio" | |
67 | - placeholder="Seleccione Domicilio" | |
68 | - typeahead-min-length="0" | |
69 | - uib-typeahead="domi as domi.dom for domi in domiciliosCliente" | |
70 | - > | |
71 | - </div> | |
72 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
73 | - <input | |
74 | - class="form-control selectable" | |
75 | - type="text" | |
76 | - readonly="true" | |
77 | - ng-model="notaPedido.precioCondicion" | |
78 | - ng-click="abrirModalListaPrecio()" | |
79 | - placeholder="Seleccione Lista de precio" | |
80 | - > | |
81 | - </div> | |
82 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
83 | - <label>Bomba</label> | |
84 | - <div class="form-check custom-radio custom-control-inline"> | |
85 | - <input | |
86 | - class="form-check-input" | |
87 | - type="radio" | |
88 | - name="radioBomba" | |
89 | - value="1" | |
90 | - ng-model="notaPedido.bomba"> | |
91 | - <label class="form-check-label">Si</label> | |
92 | - </div> | |
93 | - <div class="form-check custom-radio custom-control-inline"> | |
94 | - <input | |
95 | - class="form-check-input" | |
96 | - type="radio" | |
97 | - name="radioBomba" | |
98 | - value="0" | |
99 | - ng-model="notaPedido.bomba"> | |
100 | - <label class="form-check-label">No</label> | |
101 | - </div> | |
102 | - </div> | |
103 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
104 | - <label>Flete</label> | |
105 | - <div class="form-check custom-radio custom-control-inline"> | |
106 | - <input | |
107 | - ng-change="limpiarFlete()" | |
108 | - class="form-check-input" | |
109 | - type="radio" | |
110 | - name="radioFlete" | |
111 | - value="1" | |
112 | - ng-model="notaPedido.flete"> | |
113 | - <label class="form-check-label">Si</label> | |
3 | + <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> | |
4 | + <div class="row p-2 panel-informativo"> | |
5 | + <div class="col"> | |
6 | + <div class="row"> | |
7 | + <div class="form-group col-12 col-sm-6 col-md-4"> | |
8 | + <div class="input-group"> | |
9 | + <input | |
10 | + class="form-control form-control-sm selectable" | |
11 | + type="text" | |
12 | + ng-model="notaPedido.cliente.nombre" | |
13 | + placeholder="Seleccione Cliente" | |
14 | + readonly="true" | |
15 | + ng-click="seleccionarCliente()" | |
16 | + ng-required="true" | |
17 | + foca-focus="true" | |
18 | + > | |
19 | + <span class="input-group-append"> | |
20 | + <button | |
21 | + type="button" | |
22 | + class="btn btn-default" | |
23 | + ng-click="seleccionarCliente()" | |
24 | + > | |
25 | + <i class="fa fa-search"></i> | |
26 | + </button> | |
27 | + </span> | |
28 | + </div> | |
29 | + </div> | |
114 | 30 | </div> |
115 | - <div class="form-check custom-radio custom-control-inline"> | |
116 | - <input | |
117 | - class="form-check-input" | |
118 | - type="radio" | |
119 | - name="radioFlete" | |
120 | - value="0" | |
121 | - ng-model="notaPedido.flete"> | |
122 | - <label class="form-check-label">No</label> | |
31 | + <div class="row"> | |
32 | + <div class="form-group col-12 col-sm-6 col-md-4"> | |
33 | + <div class="input-group"> | |
34 | + <input | |
35 | + class="form-control form-control-sm" | |
36 | + type="text" | |
37 | + ng-model="notaPedido.vendedor.nombre" | |
38 | + placeholder="Seleccione Vendedor" | |
39 | + readonly="true" | |
40 | + > | |
41 | + <span class="input-group-append"> | |
42 | + <button | |
43 | + type="button" | |
44 | + class="btn btn-default" | |
45 | + ng-click="seleccionarVendedor()" | |
46 | + > | |
47 | + <i class="fa fa-search"></i> | |
48 | + </button> | |
49 | + </span> | |
50 | + </div> | |
51 | + </div> | |
123 | 52 | </div> |
124 | 53 | </div> |
125 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
126 | - <input | |
127 | - class="form-control selectable" | |
128 | - type="text" | |
129 | - readonly="true" | |
130 | - ng-show="notaPedido.flete == 1" | |
131 | - ng-model="notaPedido.fleteNombre" | |
132 | - ng-click="abrirModalFlete()" | |
133 | - placeholder="Seleccione Flete" | |
134 | - > | |
135 | - </div> | |
136 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
137 | - <input | |
138 | - class="form-control selectable" | |
139 | - type="text" | |
140 | - ng-show="notaPedido.flete == 1" | |
141 | - ng-model="notaPedido.chofer" | |
142 | - placeholder="Seleccione Chofer" | |
143 | - uib-typeahead="chofer as chofer.nombre for chofer in choferes" | |
144 | - typeahead-min-length="0" | |
145 | - > | |
146 | - </div> | |
147 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
148 | - <input | |
149 | - class="form-control selectable" | |
150 | - type="text" | |
151 | - ng-show="notaPedido.flete == 1" | |
152 | - ng-model="notaPedido.vehiculo" | |
153 | - placeholder="Seleccione Vehículo" | |
154 | - uib-typeahead="vehiculo as vehiculo.tractor for vehiculo in vehiculos" | |
155 | - typeahead-min-length="0" | |
156 | - > | |
157 | - </div> | |
158 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
159 | - <input | |
160 | - class="form-control selectable" | |
161 | - type="number" | |
162 | - step="0.01" | |
163 | - ng-show="notaPedido.flete == 1" | |
164 | - ng-model="notaPedido.costoUnitarioKmFlete" | |
165 | - placeholder="Costo por kilómetro" | |
166 | - > | |
167 | - </div> | |
168 | - <div class="form-group col-12 col-sm-6 col-md-4"> | |
169 | - <input | |
170 | - class="form-control selectable" | |
171 | - type="number" | |
172 | - step="0.1" | |
173 | - ng-show="notaPedido.flete == 1" | |
174 | - ng-model="notaPedido.kilometros" | |
175 | - placeholder="Kilómetros recorridos" | |
176 | - > | |
54 | + </div> | |
55 | + <div class="row p-2 botonera-secundaria"> | |
56 | + <div class=" col-12 col-sm-6 col-md-3 botonera" ng-repeat="boton in botonera"> | |
57 | + <button | |
58 | + type="button" | |
59 | + class="btn btn-default btn-block btn-sm" | |
60 | + ng-bind="boton.texto" | |
61 | + ng-click="boton.accion()" | |
62 | + ></button> | |
177 | 63 | </div> |
178 | 64 | </div> |
179 | 65 | </div> |
180 | - <div class="col-auto my-2"> | |
181 | - <button | |
182 | - ng-click="crearNotaPedido()" | |
183 | - type="submit" | |
184 | - title="Crear nota pedido" | |
185 | - class="btn btn-primary float-right"> | |
186 | - Guardar | |
187 | - </button> | |
188 | - </div> | |
189 | 66 | </div> |
190 | 67 | </form> |
191 | 68 | <div class="row"> |
... | ... | @@ -198,13 +75,22 @@ |
198 | 75 | <tr> |
199 | 76 | <th>Sector</th> |
200 | 77 | <th>Código</th> |
201 | - <th>Descripción</th> | |
78 | + <th>Descripción</th> | |
202 | 79 | <th>Precio Unitario</th> |
203 | 80 | <th>Cantidad</th> |
204 | 81 | <th>SubTotal</th> |
205 | 82 | <th> |
206 | - <button class="btn btn-outline-secondary selectable" style="float: right;" ng-click="show = !show; masMenos()" > | |
207 | - <i class="fa fa-chevron-down" ng-hide="show" aria-hidden="true"></i> | |
83 | + <button | |
84 | + class="btn btn-outline-secondary selectable" | |
85 | + style="float: right;" | |
86 | + ng-click="show = !show; masMenos()" | |
87 | + > | |
88 | + <i | |
89 | + class="fa fa-chevron-down" | |
90 | + ng-hide="show" | |
91 | + aria-hidden="true" | |
92 | + > | |
93 | + </i> | |
208 | 94 | <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i> |
209 | 95 | </button> |
210 | 96 | </th> |
... | ... | @@ -212,12 +98,13 @@ |
212 | 98 | </thead> |
213 | 99 | <tbody> |
214 | 100 | <tr ng-show="cargando"> |
215 | - <td colspan="2"><input | |
216 | - placeholder="Seleccione Articulo" | |
217 | - class="form-control" | |
218 | - readonly | |
219 | - ng-click="seleccionarArticulo()" | |
220 | - > | |
101 | + <td colspan="2"> | |
102 | + <input | |
103 | + placeholder="Seleccione Articulo" | |
104 | + class="form-control" | |
105 | + readonly | |
106 | + ng-click="seleccionarArticulo()" | |
107 | + /> | |
221 | 108 | </td> |
222 | 109 | <td></td> |
223 | 110 | <td></td> |
... | ... | @@ -251,7 +138,7 @@ |
251 | 138 | esc-key="resetFilter()" |
252 | 139 | ng-keypress="agregarATabla($event.keyCode)"></td> |
253 | 140 | <td><input |
254 | - class="form-control" | |
141 | + class="form-control" | |
255 | 142 | ng-value="getSubTotal() | currency:'$'" |
256 | 143 | readonly></td> |
257 | 144 | <td class="text-center"><button |
... | ... | @@ -265,7 +152,7 @@ |
265 | 152 | <td ng-bind="articulo.codigo"></td> |
266 | 153 | <td ng-bind="articulo.descripcion"></td> |
267 | 154 | <td ng-bind="articulo.precio | currency:'$'"></td> |
268 | - <td><input | |
155 | + <td><input | |
269 | 156 | ng-show="articulo.edit" |
270 | 157 | ng-model="articulo.cantidad" |
271 | 158 | class="form-control" |
... | ... | @@ -273,7 +160,7 @@ |
273 | 160 | min="1" |
274 | 161 | foca-focus="articulo.edit" |
275 | 162 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
276 | - ng-focus="selectFocus($event)" | |
163 | + ng-focus="selectFocus($event)" | |
277 | 164 | > |
278 | 165 | <i |
279 | 166 | class="selectable" |
... | ... | @@ -292,7 +179,11 @@ |
292 | 179 | </tbody> |
293 | 180 | <tfoot> |
294 | 181 | <tr class="table-secondary"> |
295 | - <td colspan="5"><b>Cantidad Items:</b> <a ng-bind="articulosTabla.length"></a> </td> | |
182 | + <td colspan="4"> | |
183 | + <strong>Cantidad Items:</strong> | |
184 | + <a ng-bind="articulosTabla.length"></a> | |
185 | + </td> | |
186 | + <td class="text-right"><strong>Total:</strong></td> | |
296 | 187 | <td colspan="3">{{getTotal() | currency:'$'}}</td> |
297 | 188 | </tr> |
298 | 189 | </tfoot> |
... | ... | @@ -300,6 +191,17 @@ |
300 | 191 | </div> |
301 | 192 | </div> |
302 | 193 | </div> |
194 | +<div class="row"> | |
195 | + <div class="col-auto my-2"> | |
196 | + <button | |
197 | + ng-click="crearNotaPedido()" | |
198 | + type="submit" | |
199 | + title="Crear nota pedido" | |
200 | + class="btn btn-primary float-right"> | |
201 | + Guardar | |
202 | + </button> | |
203 | + </div> | |
204 | +</div> | |
303 | 205 | |
304 | 206 | <!-- |
305 | 207 | <form name="formCrearNota"> |