Commit 570d9fce9b555939a331e6de6755408db322c373

Authored by Jose Pinto
Exists in master

Merge remote-tracking branch 'upstream/develop'

spec/controllerSpec.js
1 describe('Controladores abm precios condiciones', function() { 1 describe('Controladores abm precios condiciones', function() {
2 2
3 var $controller; 3 var $controller;
4 var timeout; 4 var timeout;
5 5
6 beforeEach(function() { 6 beforeEach(function() {
7 module('focaAbmPreciosCondiciones'); 7 module('focaAbmPreciosCondiciones');
8 inject(function(_$controller_) { 8 inject(function(_$controller_) {
9 $controller = _$controller_; 9 $controller = _$controller_;
10 }); 10 });
11 }); 11 });
12 12
13 beforeEach(function() { 13 beforeEach(function() {
14 inject(function($timeout) { 14 inject(function($timeout) {
15 timeout = $timeout; 15 timeout = $timeout;
16 }); 16 });
17 }); 17 });
18 18
19 describe('Controlador focaAbmPreciosCondiciones', function() { 19 describe('Controlador focaAbmPreciosCondiciones', function() {
20 20
21 it('Existe el controlador', function() { 21 it('Existe el controlador', function() {
22 //act 22 //act
23 var controlador = $controller('focaAbmPreciosCondicionesController', { 23 var controlador = $controller('focaAbmPreciosCondicionesController', {
24 $scope: {}, 24 $scope: {},
25 focaAbmPreciosCondicionesService: {}, 25 focaAbmPreciosCondicionesService: {},
26 $location: {}, 26 $location: {},
27 focaModalService: {}, 27 focaModalService: {},
28 $localStorage: {},
28 focaBotoneraLateralService: {}, 29 focaBotoneraLateralService: {},
29 $timeout: timeout 30 $timeout: timeout
30 }); 31 });
31 32
32 //assert 33 //assert
33 expect(typeof controlador).toEqual('object'); 34 expect(typeof controlador).toEqual('object');
34 }); 35 });
35 36
36 it('$scope.editar lleva a la ruta correcta', function() { 37 it('$scope.editar lleva a la ruta correcta', function() {
37 inject(function($location) { 38 inject(function($location) {
38 //arrange 39 //arrange
39 var scope = {}; 40 var scope = {};
40 var paramFake = 1; 41 var paramFake = 1;
41 $controller('focaAbmPreciosCondicionesController', { 42 $controller('focaAbmPreciosCondicionesController', {
42 $scope: scope, 43 $scope: scope,
43 focaAbmPreciosCondicionesService: {}, 44 focaAbmPreciosCondicionesService: {},
44 $location: $location, 45 $location: $location,
46 $localStorage: {},
45 focaModalService: {}, 47 focaModalService: {},
46 focaBotoneraLateralService: {}, 48 focaBotoneraLateralService: {},
47 $timeout: timeout 49 $timeout: timeout
48 }); 50 });
49 51
50 52
51 //act 53 //act
52 scope.editar(paramFake); 54 scope.editar(paramFake);
53 55
54 //assert 56 //assert
55 expect($location.url()).toEqual('/precio-condicion/' + paramFake); 57 expect($location.url()).toEqual('/precio-condicion/' + paramFake);
56 }); 58 });
57 }); 59 });
58 60
59 it('$scope.solicitarConfirmacion levanta modal confirm', function() { 61 it('$scope.solicitarConfirmacion levanta modal confirm', function() {
60 //arrange 62 //arrange
61 var scope = {}; 63 var scope = {};
62 var paramFake = 1; 64 var paramFake = 1;
63 var focaModalService = { 65 var focaModalService = {
64 confirm: function() { } 66 confirm: function() { }
65 }; 67 };
66 $controller('focaAbmPreciosCondicionesController', { 68 $controller('focaAbmPreciosCondicionesController', {
67 $scope: scope, 69 $scope: scope,
68 focaAbmPreciosCondicionesService: {}, 70 focaAbmPreciosCondicionesService: {},
69 $location: {}, 71 $location: {},
72 $localStorage: {},
70 focaModalService: focaModalService, 73 focaModalService: focaModalService,
71 focaBotoneraLateralService: {}, 74 focaBotoneraLateralService: {},
72 $timeout: timeout 75 $timeout: timeout
73 }); 76 });
74 77
75 //act 78 //act
76 spyOn(focaModalService, 'confirm').and.returnValue({ then: function() { }}); 79 spyOn(focaModalService, 'confirm').and.returnValue({ then: function() { }});
77 scope.solicitarConfirmacion(paramFake); 80 scope.solicitarConfirmacion(paramFake);
78 81
79 //assert 82 //assert
80 expect(focaModalService.confirm).toHaveBeenCalled(); 83 expect(focaModalService.confirm).toHaveBeenCalled();
81 }); 84 });
82 85
83 it('$scope.solicitarConfirmacion elimina al confirmar ok', function(done) { 86 it('$scope.solicitarConfirmacion elimina al confirmar ok', function(done) {
84 //arrange 87 //arrange
85 var scope = {}; 88 var scope = {};
86 var paramFake = 1; 89 var paramFake = 1;
87 var focaModalService = { 90 var focaModalService = {
88 confirm: function() { } 91 confirm: function() { }
89 }; 92 };
90 var focaAbmPreciosCondicionesService = { 93 var focaAbmPreciosCondicionesService = {
91 borrarPrecioCondicion: function() { } 94 borrarPrecioCondicion: function() { }
92 }; 95 };
93 $controller('focaAbmPreciosCondicionesController', { 96 $controller('focaAbmPreciosCondicionesController', {
94 $scope: scope, 97 $scope: scope,
95 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService, 98 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService,
96 $location: {}, 99 $location: {},
100 $localStorage: {},
97 focaModalService: focaModalService, 101 focaModalService: focaModalService,
98 focaBotoneraLateralService: {}, 102 focaBotoneraLateralService: {},
99 $timeout: timeout 103 $timeout: timeout
100 }); 104 });
101 var promesaConfirm = Promise.resolve(true); 105 var promesaConfirm = Promise.resolve(true);
102 scope.preciosCondiciones = []; 106 scope.preciosCondiciones = [];
103 107
104 //act 108 //act
105 spyOn(focaModalService, 'confirm').and.returnValue(promesaConfirm); 109 spyOn(focaModalService, 'confirm').and.returnValue(promesaConfirm);
106 spyOn(focaAbmPreciosCondicionesService, 'borrarPrecioCondicion'); 110 spyOn(focaAbmPreciosCondicionesService, 'borrarPrecioCondicion');
107 scope.solicitarConfirmacion(paramFake); 111 scope.solicitarConfirmacion(paramFake);
108 112
109 //assert 113 //assert
110 promesaConfirm.then(function() { 114 promesaConfirm.then(function() {
111 expect(focaAbmPreciosCondicionesService.borrarPrecioCondicion).toHaveBeenCalled(); 115 expect(focaAbmPreciosCondicionesService.borrarPrecioCondicion).toHaveBeenCalled();
112 done(); 116 done();
113 }); 117 });
114 }); 118 });
115 119
116 it('$scope.buscar llama a obtenerPreciosCondiciones', function() { 120 it('$scope.buscar llama a obtenerPreciosCondiciones', function() {
117 //arrange 121 //arrange
118 var scope = {}; 122 var scope = {};
119 var focaAbmPreciosCondicionesService = { 123 var focaAbmPreciosCondicionesService = {
120 obtenerPreciosCondiciones: function() { } 124 obtenerPreciosCondiciones: function() { }
121 }; 125 };
122 $controller('focaAbmPreciosCondicionesController', { 126 $controller('focaAbmPreciosCondicionesController', {
123 $scope: scope, 127 $scope: scope,
124 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService, 128 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService,
125 $location: {}, 129 $location: {},
130 $localStorage: {},
126 focaModalService: {}, 131 focaModalService: {},
127 focaBotoneraLateralService: {}, 132 focaBotoneraLateralService: {},
128 $timeout: timeout 133 $timeout: timeout
129 }); 134 });
130 135
131 //act 136 //act
132 spyOn(focaAbmPreciosCondicionesService, 'obtenerPreciosCondiciones') 137 spyOn(focaAbmPreciosCondicionesService, 'obtenerPreciosCondiciones')
133 .and.returnValue({ then: function() { }}); 138 .and.returnValue({ then: function() { }});
134 scope.buscar(13); 139 scope.buscar(13);
135 140
136 //assert 141 //assert
137 expect(focaAbmPreciosCondicionesService.obtenerPreciosCondiciones).toHaveBeenCalled(); 142 expect(focaAbmPreciosCondicionesService.obtenerPreciosCondiciones).toHaveBeenCalled();
138 }); 143 });
139 }); 144 });
140 145
141 describe('Controlador focaAbmPrecioCondicionController', function() { 146 describe('Controlador focaAbmPrecioCondicionController', function() {
142 147
143 it('Existe el controlador focaAbmPrecioCondicionController', function() { 148 it('Existe el controlador focaAbmPrecioCondicionController', function() {
144 //act 149 //act
145 var controlador = $controller('focaAbmPrecioCondicionController', { 150 var controlador = $controller('focaAbmPrecioCondicionController', {
146 $scope: {}, 151 $scope: {
152 $watch: function(){}
153 },
147 focaAbmPreciosCondicionesService: { 154 focaAbmPreciosCondicionesService: {
148 obtenerPrecioCondicion: function() { 155 obtenerPrecioCondicion: function() {
149 return { 156 return {
150 then: function() { } 157 then: function() { }
151 }; 158 };
152 } 159 }
153 }, 160 },
154 focaBotoneraLateralService: {}, 161 focaBotoneraLateralService: {},
155 $routeParams: {}, 162 $routeParams: {},
156 $location: {}, 163 $location: {},
157 focaModalService: {}, 164 focaModalService: {},
158 $timeout: timeout, 165 $timeout: timeout,
159 $uibModal: {}, 166 $uibModal: {},
167 $localStorage: {},
160 $window: {} 168 $window: {}
161 }); 169 });
162 170
163 //assert 171 //assert
164 expect(typeof controlador).toEqual('object'); 172 expect(typeof controlador).toEqual('object');
165 }); 173 });
166 174
167 it('La funcion $scope.cancelar lleva a la ruta correcta', function() { 175 it('La funcion $scope.cancelar lleva a la ruta correcta', function() {
168 inject(function($location) { 176 inject(function($location) {
169 //arrange 177 //arrange
170 var scope = {}; 178 var scope = {
179 $watch: function() {},
180 salir: function() {},
181 formPrecioCondicion: ''
182 };
171 $controller('focaAbmPrecioCondicionController', { 183 $controller('focaAbmPrecioCondicionController', {
172 $scope: scope, 184 $scope: scope,
173 focaAbmPreciosCondicionesService: { 185 focaAbmPreciosCondicionesService: {
174 obtenerPrecioCondicion: function() { 186 obtenerPrecioCondicion: function() {
175 return { 187 return {
176 then: function() { } 188 then: function() { }
177 }; 189 };
178 } 190 }
179 }, 191 },
180 focaBotoneraLateralService: {}, 192 focaBotoneraLateralService: {},
181 $routeParams: {}, 193 $routeParams: {},
182 $location: $location, 194 $location: $location,
195 $localStorage: {},
183 focaModalService: {}, 196 focaModalService: {},
184 $timeout: timeout, 197 $timeout: timeout,
185 $uibModal: {}, 198 $uibModal: {},
186 $window: {} 199 $window: {}
187 }); 200 });
188 201
189 //act 202 //act
190 scope.cancelar(); 203 scope.salir();
191 204
192 //assert 205 //assert
193 expect($location.url()).toEqual('/precio-condicion'); 206 expect($location.url()).toEqual('/precio-condicion');
194 }); 207 });
195 }); 208 });
196 209
197 it('La funcion $scope.guardar llama a servicio.guardarPrecioCondicion', function() { 210 it('La funcion $scope.guardar llama a servicio.guardarPrecioCondicion', function() {
198 inject(function($location) { 211 inject(function($location) {
199 //arrange 212 //arrange
200 var scope = {}; 213 var scope = {
214 $watch: function() { }
215 };
201 var focaAbmPreciosCondicionesService = { 216 var focaAbmPreciosCondicionesService = {
202 obtenerPrecioCondicion: function() { 217 obtenerPrecioCondicion: function() {
203 return { 218 return {
204 then: function() { } 219 then: function() { }
205 }; 220 };
206 }, 221 },
207 guardarPrecioCondicion: function() { } 222 guardarPrecioCondicion: function() { }
208 }; 223 };
209 var window = { 224 var window = {
210 location: { 225 location: {
211 assign: function() { } 226 assign: function() { }
212 } 227 }
213 }; 228 };
214 $controller('focaAbmPrecioCondicionController', { 229 $controller('focaAbmPrecioCondicionController', {
215 $scope: scope, 230 $scope: scope,
216 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService, 231 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService,
217 focaBotoneraLateralService: {}, 232 focaBotoneraLateralService: {},
218 $routeParams: {}, 233 $routeParams: {},
219 $location: $location, 234 $location: $location,
220 focaModalService: {}, 235 focaModalService: {
236 alert: function() {}
237 },
221 $timeout: timeout, 238 $timeout: timeout,
222 $uibModal: {}, 239 $uibModal: {},
240 $localStorage: {},
223 $window: window 241 $window: window
224 }); 242 });
225 var promesaGuardarPrecioCondicion = Promise.resolve(true); 243 var promesaGuardarPrecioCondicion = Promise.resolve(true);
226 scope.precioCondicion = { listaPrecio: {} }; 244 scope.precioCondicion = {
245 listaPrecio: {},
246 nombre: true,
247 descripcion: true,
248 idListaPrecio: true
249 };
227 250
228 //act 251 //act
229 //spyOn(window, 'location').and.returnValue({ assign: function() {} }); 252 //spyOn(window, 'location').and.returnValue({ assign: function() {} });
230 spyOn(focaAbmPreciosCondicionesService, 'guardarPrecioCondicion') 253 spyOn(focaAbmPreciosCondicionesService, 'guardarPrecioCondicion')
231 .and.returnValue(promesaGuardarPrecioCondicion); 254 .and.returnValue(promesaGuardarPrecioCondicion);
232 scope.guardar(); 255 scope.guardar();
233 256
234 //assert 257 //assert
235 expect(focaAbmPreciosCondicionesService.guardarPrecioCondicion).toHaveBeenCalled(); 258 expect(focaAbmPreciosCondicionesService.guardarPrecioCondicion).toHaveBeenCalled();
236 }); 259 });
237 }); 260 });
238 261
239 it('La funcion $scope.solicitarConfirmacionPlazoPago levanta modal confirm', function() { 262 it('La funcion $scope.solicitarConfirmacionPlazoPago levanta modal confirm', function() {
240 //act 263 //act
241 var scope = {}; 264 var scope = {
265 $watch: function() {}
266 };
242 var focaModalService = { 267 var focaModalService = {
243 confirm: function() { } 268 confirm: function() { }
244 }; 269 };
245 $controller('focaAbmPrecioCondicionController', { 270 $controller('focaAbmPrecioCondicionController', {
246 $scope: scope, 271 $scope: scope,
247 focaAbmPreciosCondicionesService: { 272 focaAbmPreciosCondicionesService: {
248 obtenerPrecioCondicion: function() { 273 obtenerPrecioCondicion: function() {
249 return { 274 return {
250 then:function() { } 275 then:function() { }
251 }; 276 };
252 } 277 }
253 }, 278 },
254 focaBotoneraLateralService: {}, 279 focaBotoneraLateralService: {},
255 $routeParams: {}, 280 $routeParams: {},
256 $location: {}, 281 $location: {},
257 focaModalService: focaModalService, 282 focaModalService: focaModalService,
258 $timeout: timeout, 283 $timeout: timeout,
259 $uibModal: {}, 284 $uibModal: {},
285 $localStorage: {},
260 $window: {} 286 $window: {}
261 }); 287 });
262 288
263 //act 289 //act
264 spyOn(focaModalService, 'confirm') 290 spyOn(focaModalService, 'confirm')
265 .and.returnValue({ then: function() {} }); 291 .and.returnValue({ then: function() {} });
266 scope.solicitarConfirmacionPlazoPago({ data: 'test' }); 292 scope.solicitarConfirmacionPlazoPago({ data: 'test' });
267 293
268 //assert 294 //assert
269 expect(focaModalService.confirm).toHaveBeenCalled(); 295 expect(focaModalService.confirm).toHaveBeenCalled();
270 }); 296 });
271 297
272 it('La funcion $scope.solicitarConfirmacionPlazoPago borra al dar ok', function(done) { 298 it('La funcion $scope.solicitarConfirmacionPlazoPago borra al dar ok', function(done) {
273 //act 299 //act
274 var scope = {}; 300 var scope = {
301 $watch: function() { }
302 };
275 var focaModalService = { 303 var focaModalService = {
276 confirm: function() { } 304 confirm: function() { }
277 }; 305 };
278 var focaAbmPreciosCondicionesService = { 306 var focaAbmPreciosCondicionesService = {
279 obtenerPrecioCondicion: function() { 307 obtenerPrecioCondicion: function() {
280 return { 308 return {
281 then:function() { } 309 then:function() { }
282 }; 310 };
283 }, 311 },
284 borrarPlazoPago: function() { } 312 borrarPlazoPago: function() { }
285 }; 313 };
286 $controller('focaAbmPrecioCondicionController', { 314 $controller('focaAbmPrecioCondicionController', {
287 $scope: scope, 315 $scope: scope,
288 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService, 316 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService,
289 focaBotoneraLateralService: {}, 317 focaBotoneraLateralService: {},
290 $routeParams: {}, 318 $routeParams: {},
291 $location: {}, 319 $location: {},
292 focaModalService: focaModalService, 320 focaModalService: focaModalService,
293 $timeout: timeout, 321 $timeout: timeout,
322 $localStorage: {},
294 $uibModal: {}, 323 $uibModal: {},
295 $window: {} 324 $window: {}
296 }); 325 });
297 var promesaConfirm = Promise.resolve(true); 326 var promesaConfirm = Promise.resolve(true);
298 scope.precioCondicion = { 327 scope.precioCondicion = {
299 plazos: [] 328 plazos: []
300 }; 329 };
301 330
302 //act 331 //act
303 spyOn(focaModalService, 'confirm').and.returnValue(promesaConfirm); 332 spyOn(focaModalService, 'confirm').and.returnValue(promesaConfirm);
304 spyOn(focaAbmPreciosCondicionesService, 'borrarPlazoPago'); 333 spyOn(focaAbmPreciosCondicionesService, 'borrarPlazoPago');
305 scope.solicitarConfirmacionPlazoPago({ data: 'test' }); 334 scope.solicitarConfirmacionPlazoPago({ data: 'test' });
306 335
307 //assert 336 //assert
308 promesaConfirm.then(function() { 337 promesaConfirm.then(function() {
309 expect(focaAbmPreciosCondicionesService.borrarPlazoPago).toHaveBeenCalled(); 338 expect(focaAbmPreciosCondicionesService.borrarPlazoPago).toHaveBeenCalled();
310 done(); 339 done();
311 }); 340 });
312 }); 341 });
313 342
314 it('La funcion $scope.seleccionarListaPrecio levanta modal', function() { 343 it('La funcion $scope.seleccionarListaPrecio levanta modal', function() {
315 //arrange 344 //arrange
316 var scope = {}; 345 var scope = {
346 $watch: function() {}
347 };
317 var uibModal = { 348 var uibModal = {
318 open: function() { } 349 open: function() { }
319 }; 350 };
320 var focaAbmPreciosCondicionesService = { 351 var focaAbmPreciosCondicionesService = {
321 obtenerPrecioCondicion: function() { 352 obtenerPrecioCondicion: function() {
322 return { 353 return {
323 then:function() { } 354 then:function() { }
324 }; 355 };
325 } 356 }
326 }; 357 };
327 $controller('focaAbmPrecioCondicionController', { 358 $controller('focaAbmPrecioCondicionController', {
328 $scope: scope, 359 $scope: scope,
329 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService, 360 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService,
330 focaBotoneraLateralService: {}, 361 focaBotoneraLateralService: {},
331 $routeParams: {}, 362 $routeParams: {},
332 $location: {}, 363 $location: {},
333 focaModalService: {}, 364 focaModalService: {},
334 $timeout: timeout, 365 $timeout: timeout,
335 $uibModal: uibModal, 366 $uibModal: uibModal,
367 $localStorage: {},
336 $window: {} 368 $window: {}
337 }); 369 });
338 370
339 //act 371 //act
340 spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } }); 372 spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } });
341 scope.seleccionarListaPrecio(13); 373 scope.seleccionarListaPrecio(13);
342 374
343 //assert 375 //assert
344 expect(uibModal.open).toHaveBeenCalled(); 376 expect(uibModal.open).toHaveBeenCalled();
345 }); 377 });
346 378
347 it('La funcion $scope.verProductosListaPrecio levanta modal', function() { 379 it('La funcion $scope.verProductosListaPrecio levanta modal', function() {
348 //arrange 380 //arrange
349 var scope = {}; 381 var scope = {
382 $watch: function() {}
383 };
350 var uibModal = { 384 var uibModal = {
351 open: function() { } 385 open: function() { }
352 }; 386 };
353 var focaAbmPreciosCondicionesService = { 387 var focaAbmPreciosCondicionesService = {
354 obtenerPrecioCondicion: function() { 388 obtenerPrecioCondicion: function() {
355 return { 389 return {
356 then:function() { } 390 then:function() { }
357 }; 391 };
358 } 392 }
359 }; 393 };
360 $controller('focaAbmPrecioCondicionController', { 394 $controller('focaAbmPrecioCondicionController', {
361 $scope: scope, 395 $scope: scope,
362 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService, 396 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService,
363 focaBotoneraLateralService: {}, 397 focaBotoneraLateralService: {},
364 $routeParams: {}, 398 $routeParams: {},
365 $location: {}, 399 $location: {},
366 focaModalService: {}, 400 focaModalService: {},
367 $timeout: timeout, 401 $timeout: timeout,
368 $uibModal: uibModal, 402 $uibModal: uibModal,
403 $localStorage: {},
369 $window: {} 404 $window: {}
370 }); 405 });
371 scope.precioCondicion = { 406 scope.precioCondicion = {
372 listaPrecio: {} 407 listaPrecio: {}
373 }; 408 };
374 //act 409 //act
375 spyOn(uibModal, 'open'); 410 spyOn(uibModal, 'open');
376 scope.verProductosListaPrecio(); 411 scope.verProductosListaPrecio();
377 412
378 //assert 413 //assert
379 expect(uibModal.open).toHaveBeenCalled(); 414 expect(uibModal.open).toHaveBeenCalled();
380 }); 415 });
381 416
382 it('la función next suma uno a $scope.focused', function() { 417 it('la función next suma uno a $scope.focused', function() {
383 //arrange 418 //arrange
384 var scope = {}; 419 var scope = {
420 $watch: function() {}
421 };
385 var focaAbmPreciosCondicionesService = { 422 var focaAbmPreciosCondicionesService = {
386 obtenerPrecioCondicion: function() { 423 obtenerPrecioCondicion: function() {
387 return { 424 return {
388 then:function() { } 425 then:function() { }
389 }; 426 };
390 } 427 }
391 }; 428 };
392 $controller('focaAbmPrecioCondicionController', { 429 $controller('focaAbmPrecioCondicionController', {
393 $scope: scope, 430 $scope: scope,
394 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService, 431 focaAbmPreciosCondicionesService: focaAbmPreciosCondicionesService,
395 focaBotoneraLateralService: {}, 432 focaBotoneraLateralService: {},
396 $routeParams: {}, 433 $routeParams: {},
397 $location: {}, 434 $location: {},
398 focaModalService: {}, 435 focaModalService: {},
399 $timeout: timeout, 436 $timeout: timeout,
400 $uibModal: {}, 437 $uibModal: {},
438 $localStorage: {},
401 $window: {} 439 $window: {}
402 }); 440 });
403 441
404 //act 442 //act
405 var esperado = scope.focused + 1; 443 var esperado = scope.focused + 1;
406 scope.next(13); 444 scope.next(13);
407 445
408 //assert 446 //assert
409 expect(scope.focused).toEqual(esperado); 447 expect(scope.focused).toEqual(esperado);
410 }); 448 });
411 }); 449 });
412 }); 450 });
413 451
src/js/controller.js
1 angular.module('focaAbmPreciosCondiciones') 1 angular.module('focaAbmPreciosCondiciones')
2 .controller('focaAbmPreciosCondicionesController', [ 2 .controller('focaAbmPreciosCondicionesController', [
3 '$scope', 'focaAbmPreciosCondicionesService', '$location', 3 '$scope', 'focaAbmPreciosCondicionesService', '$location',
4 'focaModalService', 'focaBotoneraLateralService', '$timeout', 4 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$localStorage',
5 function($scope, focaAbmPreciosCondicionesService, $location, 5 function($scope, focaAbmPreciosCondicionesService, $location,
6 focaModalService, focaBotoneraLateralService, $timeout) { 6 focaModalService, focaBotoneraLateralService, $timeout, $localStorage) {
7 7
8 $scope.focusSearch = false; 8 $scope.focusSearch = false;
9 $scope.filters = ''; 9 $scope.filters = '';
10 $scope.now = new Date(); 10 $scope.now = new Date();
11 $timeout(function() { 11 $timeout(function() {
12 focaBotoneraLateralService.showSalir(true); 12 focaBotoneraLateralService.showSalir(true);
13 focaBotoneraLateralService.showPausar(false); 13 focaBotoneraLateralService.showPausar(false);
14 focaBotoneraLateralService.showCancelar(false);
14 focaBotoneraLateralService.showCancelar(false); 15 focaBotoneraLateralService.showGuardar(false);
15 focaBotoneraLateralService.showGuardar(false); 16
16 $scope.focusSearch = true; 17 $scope.focusSearch = true;
17 }, 3000); 18 });
18 $scope.editar = function(id) { 19
19 $location.path('/precio-condicion/' + id); 20 $scope.filters = '';
20 }; 21 $scope.now = new Date();
21 $scope.solicitarConfirmacion = function(precioCondicion) { 22 $scope.editar = function(id) {
22 focaModalService.confirm('¿Está seguro que desea borrar el precio condición' + 23 $location.path('/precio-condicion/' + id);
23 precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then( 24 };
24 function(data) { 25 $scope.solicitarConfirmacion = function(precioCondicion) {
25 if (data) { 26 focaModalService.confirm('¿Está seguro que desea borrar el precio condición' +
26 focaAbmPreciosCondicionesService 27 precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then(
27 .borrarPrecioCondicion(precioCondicion.id); 28 function(data) {
28 $scope.preciosCondiciones.splice( 29 if (data) {
29 $scope.preciosCondiciones.indexOf(precioCondicion), 1 30 focaAbmPreciosCondicionesService
30 ); 31 .borrarPrecioCondicion(precioCondicion.id);
31 } 32 $scope.preciosCondiciones.splice(
32 } 33 $scope.preciosCondiciones.indexOf(precioCondicion), 1
33 ); 34 );
34 }; 35 }
35 36 }
36 $scope.buscar = function(key) { 37 );
37 if(key === 13){ 38 };
38 focaAbmPreciosCondicionesService 39
39 .obtenerPreciosCondiciones($scope.filters) 40 $scope.buscar = function(key) {
40 .then(function(datos) { 41 if(key === 13){
41 $scope.preciosCondiciones = datos.data; 42 focaAbmPreciosCondicionesService
42 $scope.preciosCondiciones.forEach(function(precioCondicion) { 43 .obtenerPreciosCondiciones($scope.filters)
43 precioCondicion.plazoPago.sort(function(a, b) { 44 .then(function(datos) {
44 return a.dias- b.dias; 45 $scope.preciosCondiciones = datos.data;
45 }); 46 $scope.preciosCondiciones.forEach(function(precioCondicion) {
46 }); 47 precioCondicion.plazoPago.sort(function(a, b) {
47 }); 48 return a.dias- b.dias;
49 });
50 });
51 });
52 }
53 };
54
48 } 55 if ($localStorage.precioCondicion) {
49 }; 56 var precioCondicion = JSON.parse($localStorage.precioCondicion);
50 } 57 if (!precioCondicion.id) { precioCondicion.id = 0; }
51 ]) 58 $location.path('/precio-condicion/' + precioCondicion.id);
52 .controller('focaAbmPrecioCondicionController', [ 59 }
53 '$scope', 'focaAbmPreciosCondicionesService', 'focaBotoneraLateralService', 60 }
54 '$routeParams', '$location', 'focaModalService', '$timeout', '$uibModal', '$window', 61 ])
55 function( 62 .controller('focaAbmPrecioCondicionController', [
56 $scope, focaAbmPreciosCondicionesService, focaBotoneraLateralService,
57 $routeParams, $location, focaModalService, $timeout, $uibModal, $window 63 '$scope', 'focaAbmPreciosCondicionesService', 'focaBotoneraLateralService',
58 ) { 64 '$routeParams', '$location', 'focaModalService', '$timeout', '$uibModal', '$window', '$localStorage', '$filter',
59 $scope.focused = 1; 65 function(
60 $scope.plazosAEliminar = []; 66 $scope, focaAbmPreciosCondicionesService, focaBotoneraLateralService,
61 $scope.mostrarPlazos = $routeParams.id > 0; 67 $routeParams, $location, focaModalService, $timeout, $uibModal, $window, $localStorage, $filter) {
62 $scope.now = new Date(); 68 $scope.focused = 1;
63 $scope.listaPrecioLabel = ''; 69 $scope.plazosAEliminar = [];
64 focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) 70 $scope.mostrarPlazos = $routeParams.id > 0;
65 .then(function(datos) { 71 $scope.now = new Date();
66 $scope.precioCondicion = { 72 $scope.listaPrecioLabel = '';
67 id: 0, 73 focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id)
68 codigo: '', 74 .then(function(datos) {
69 nombre: '', 75 $scope.precioCondicion = {
70 descripcion: '', 76 id: 0,
71 idListaPrecio: 0, 77 codigo: '',
72 vigencia: new Date() 78 nombre: '',
73 }; 79 descripcion: '',
74 if(datos.data.id) { 80 idListaPrecio: 0,
75 $scope.precioCondicion = datos.data; 81 vigencia: new Date()
76 $scope.listaPrecioLabel = datos.data.listaPrecio.ID.trim() + 82 };
77 ' - ' + datos.data.listaPrecio.DES; 83 if (datos.data.id) {
78 $scope.$broadcast('addCabecera', { 84 $scope.precioCondicion = datos.data;
79 label: 'Precio y condición:', 85 $scope.listaPrecioLabel = datos.data.listaPrecio.ID.trim() +
80 valor: datos.data.nombre 86 ' - ' + datos.data.listaPrecio.DES;
81 }); 87 $scope.$broadcast('addCabecera', {
82 focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) 88 label: 'Precio y condición:',
83 .then(function(datos) { 89 valor: datos.data.nombre
84 $scope.precioCondicion.plazos = datos.data; 90 });
85 $scope.precioCondicion.plazos.sort(function(a, b) { 91 focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id)
86 return a.dias- b.dias; 92 .then(function(datos) {
87 }); 93 $scope.precioCondicion.plazos = datos.data;
88 $scope.plazoACargar = 94 $scope.precioCondicion.plazos.sort(function(a, b) {
89 { 95 return a.dias- b.dias;
90 item: datos.data.length + 1 96 });
91 }; 97 $scope.plazoACargar =
92 }); 98 {
93 } 99 item: datos.data.length + 1
100 };
101 });
94 }); 102 }
95 103 });
96 $timeout(function() { 104
97 focaBotoneraLateralService.showSalir(false); 105 $timeout(function() {getLSPrecioC();});
98 focaBotoneraLateralService.showPausar(true); 106
107 $timeout(function() {
99 focaBotoneraLateralService.showCancelar(true); 108 focaBotoneraLateralService.showSalir(false);
100 focaBotoneraLateralService.showGuardar(true, $scope.guardar); 109 focaBotoneraLateralService.showPausar(true);
101 }); 110 focaBotoneraLateralService.showCancelar(false);
102 111 focaBotoneraLateralService.showGuardar(true, $scope.guardar);
112 focaBotoneraLateralService.addCustomButton('Salir', $scope.salir);
113 });
114
115 $scope.salir = function() {
116
117 if ($scope.formPrecioCondicion.$pristine == false) {
118 focaModalService.confirm(
119 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
120 ).then(function(data) {
121 if (data) {
122 $location.path('/precio-condicion');
103 $scope.cancelar = function() { 123 }
104 $location.path('/precio-condicion'); 124 });
125 } else {
126 $location.path('/precio-condicion');
127 }
128 };
129 $scope.guardar = function() {
130
131 if (!$scope.precioCondicion.nombre) {
132 focaModalService.alert('Ingrese nombre');
133 return;
134 } else if (!$scope.precioCondicion.descripcion) {
135 focaModalService.alert('Ingrese descripcion');
136 return;
105 }; 137 } else if (!$scope.precioCondicion.idListaPrecio) {
106 $scope.guardar = function() { 138 focaModalService.alert('Seleccione precio');
107 var promises = []; 139 return;
108 var precioCondicion = $scope.precioCondicion; 140 }
109 precioCondicion.idListaPrecio = precioCondicion.listaPrecio.ID; 141
110 delete precioCondicion.listaPrecio; 142 var promises = [];
111 if($scope.mostrarPlazos) { 143 var precioCondicion = $scope.precioCondicion;
112 promises.push( 144 precioCondicion.idListaPrecio = precioCondicion.listaPrecio.ID;
113 focaAbmPreciosCondicionesService 145 delete precioCondicion.listaPrecio;
114 .guardarPlazosPago($scope.precioCondicion.plazos) 146 if ($scope.mostrarPlazos) {
115 ); 147 promises.push(
116 $scope.plazosAEliminar.forEach(function(id) { 148 focaAbmPreciosCondicionesService
117 promises.push( 149 .guardarPlazosPago($scope.precioCondicion.plazos)
118 focaAbmPreciosCondicionesService 150 );
119 .borrarPlazoPago(id) 151 $scope.plazosAEliminar.forEach(function(id) {
120 ); 152 promises.push(
121 }); 153 focaAbmPreciosCondicionesService
122 } 154 .borrarPlazoPago(id)
123 promises.push( 155 );
124 focaAbmPreciosCondicionesService 156 });
125 .guardarPrecioCondicion(precioCondicion) 157 }
126 ); 158 promises.push(
127 159 focaAbmPreciosCondicionesService
128 Promise.all(promises).then(function() { 160 .guardarPrecioCondicion(precioCondicion)
129 $timeout(function() { 161 );
130 $location.path('/precio-condicion'); 162
131 }, 0); 163 Promise.all(promises).then(function() {
132 }, function(err){ 164 $timeout(function() {
133 console.error(err); 165 $location.path('/precio-condicion');
134 }); 166 }, 0);
135 }; 167 }, function(err){
136 168 console.error(err);
137 $scope.agregarPlazo = function(key) { 169 });
138 if(key === 13) { 170 };
139 if(!$scope.plazoACargar.dias && $scope.plazoACargar.dias !== 0) { 171
140 focaModalService.alert('Ingrese cantidad de días'); 172 $scope.agregarPlazo = function(key) {
141 return; 173 if (key === 13) {
142 } 174 if (!$scope.plazoACargar.dias && $scope.plazoACargar.dias !== 0) {
143 var tieneEseDia = $scope.precioCondicion.plazos.filter(function(a) { 175 focaModalService.alert('Ingrese cantidad de días');
144 return a.dias === $scope.plazoACargar.dias; 176 return;
145 }); 177 }
146 if(tieneEseDia.length > 0) { 178 var tieneEseDia = $scope.precioCondicion.plazos.filter(function(a) {
147 focaModalService.alert('Ya ha ingresado un plazo con esos días'); 179 return a.dias === $scope.plazoACargar.dias;
148 return; 180 });
149 } 181 if (tieneEseDia.length > 0) {
150 $scope.plazoACargar.idPreciosCondiciones = $scope.precioCondicion.id; 182 focaModalService.alert('Ya ha ingresado un plazo con esos días');
151 $scope.plazoACargar.activo = true; 183 return;
152 $scope.precioCondicion.plazos.push($scope.plazoACargar); 184 }
153 $scope.plazoACargar = 185 $scope.plazoACargar.idPreciosCondiciones = $scope.precioCondicion.id;
154 { 186 $scope.plazoACargar.activo = true;
155 item: $scope.precioCondicion.plazos.length + 1 187 $scope.precioCondicion.plazos.push($scope.plazoACargar);
156 }; 188 $scope.plazoACargar =
157 } 189 {
158 }; 190 item: $scope.precioCondicion.plazos.length + 1
159 $scope.quitarPlazo = function(key) { 191 };
160 if($scope.precioCondicion.plazos[key].id) 192 }
161 $scope.plazosAEliminar.push($scope.precioCondicion.plazos[key].id); 193 };
162 194 $scope.quitarPlazo = function(key) {
163 $scope.precioCondicion.plazos.splice(key, 1); 195 if ($scope.precioCondicion.plazos[key].id)
164 $scope.plazoACargar = 196 $scope.plazosAEliminar.push($scope.precioCondicion.plazos[key].id);
165 { 197
166 item: $scope.precioCondicion.plazos.length + 1 198 $scope.precioCondicion.plazos.splice(key, 1);
167 }; 199 $scope.plazoACargar =
168 }; 200 {
169 $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { 201 item: $scope.precioCondicion.plazos.length + 1
170 focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' + 202 };
171 plazoPago.item + ' ' + plazoPago.dias + ' ?').then( 203 };
172 function(confirm) { 204 $scope.solicitarConfirmacionPlazoPago = function(plazoPago) {
173 if (confirm) { 205 focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' +
174 focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); 206 plazoPago.item + ' ' + plazoPago.dias + ' ?').then(
175 $scope.precioCondicion.plazos.splice( 207 function(confirm) {
176 $scope.precioCondicion.plazos.indexOf(plazoPago), 1 208 if (confirm) {
177 ); 209 focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id);
178 } 210 $scope.precioCondicion.plazos.splice(
179 } 211 $scope.precioCondicion.plazos.indexOf(plazoPago), 1
180 ); 212 );
181 }; 213 }
182 214 }
183 $scope.seleccionarListaPrecio = function(key) { 215 );
184 if(key === 13){ 216 };
185 var modalInstance = $uibModal.open( 217
186 { 218 $scope.seleccionarListaPrecio = function(key) {
187 ariaLabelledBy: 'Busqueda de Listas de precio', 219 if (key === 13){
188 templateUrl: 'modal-lista-precio.html', 220 var modalInstance = $uibModal.open(
189 controller: 'focaModalListaPrecioCtrl', 221 {
190 size: 'lg' 222 ariaLabelledBy: 'Busqueda de Listas de precio',
191 } 223 templateUrl: 'modal-lista-precio.html',
224 controller: 'focaModalListaPrecioCtrl',
192 ); 225 size: 'lg'
193 modalInstance.result.then(function(listaPrecio) { 226 }
194 $scope.precioCondicion.listaPrecio = listaPrecio; 227 );
195 $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES; 228 modalInstance.result.then(function(listaPrecio) {
196 $scope.focused = 4; 229 $scope.precioCondicion.idListaPrecio = listaPrecio.ID;
197 }); 230 $scope.precioCondicion.listaPrecio = listaPrecio;
198 } 231 $scope.listaPrecioLabel = listaPrecio.ID + ' - ' + listaPrecio.DES;
199 }; 232 $scope.focused = 4;
200 233 });
201 $scope.verProductosListaPrecio = function() { 234 }
202 $uibModal.open( 235 };
203 { 236
204 ariaLabelledBy: 'Busqueda de Productos', 237 $scope.verProductosListaPrecio = function() {
205 templateUrl: 'modal-busqueda-productos.html', 238 $uibModal.open(
206 controller: 'modalBusquedaProductosCtrl', 239 {
207 resolve: { 240 ariaLabelledBy: 'Busqueda de Productos',
208 parametroProducto: { 241 templateUrl: 'modal-busqueda-productos.html',
209 idLista: $scope.precioCondicion.listaPrecio.ID, 242 controller: 'modalBusquedaProductosCtrl',
210 cotizacion: 1, 243 resolve: {
211 simbolo: '$', 244 parametroProducto: {
212 soloMostrar: true 245 idLista: $scope.precioCondicion.listaPrecio.ID,
213 } 246 cotizacion: 1,
214 }, 247 simbolo: '$',
215 size: 'md' 248 soloMostrar: true
216 } 249 }
217 ); 250 },
218 }; 251 size: 'md'
219 252 }
220 $scope.next = function(key) { 253 );
254 };
255
256 $scope.next = function(key) {
257 if (key === 13) $scope.focused++;
258 };
259
260 //watch
261 $scope.$watch('precioCondicion', function(newValue) {
262 focaBotoneraLateralService.setPausarData({
263 label: 'precioCondicion',
264 val: newValue
265 });
266 }, true);
267
268 function setearPrecioCondicion(precioCondicion) {
269 $scope.precioCondicion = precioCondicion;
270 $scope.$broadcast('addCabecera', {
271 label: 'Precio y Condicion:',
272 valor: $filter('rellenarDigitos')(precioCondicion.id)
273 });
274 }
275
276 function getLSPrecioC() {
277 var precioCondicion = JSON.parse($localStorage.precioCondicion || null);
278
221 if(key === 13) $scope.focused++; 279 if (precioCondicion) {
222 }; 280 setearPrecioCondicion(precioCondicion);
223 } 281 delete $localStorage.precioCondicion;
224 ]); 282 }
225 283 }
284 }
285 ]);
src/views/foca-abm-precios-condiciones-item.html
1 <div class="row"> 1 <div class="row">
2 <foca-cabecera-facturador 2 <foca-cabecera-facturador
3 titulo="'Precios y condiciones'" 3 titulo="'Precios y condiciones'"
4 fecha="now" 4 fecha="now"
5 class="mb-0 col-lg-12" 5 class="mb-0 col-lg-12"
6 ></foca-cabecera-facturador> 6 ></foca-cabecera-facturador>
7 </div> 7 </div>
8 <div class="row"> 8 <div class="row">
9 <form class="col-md-10"> 9 <form class= "col-md-10" name="formPrecioCondicion">
10 <input type="hidden" name="id" ng-model="precioCondicion.id" /> 10 <input type="hidden" name="id" ng-model="precioCondicion.id" />
11 <div class="row mb-3"> 11 <div class="row mb-3">
12 <label class="col-sm-2 col-form-label">Código</label> 12 <label class="col-sm-2 col-form-label">Código</label>
13 <input 13 <input
14 class="form-control col-sm-4" 14 class="form-control col-sm-4"
15 type="text" 15 type="text"
16 name="codigo" 16 name="codigo"
17 ng-value="precioCondicion.id | rellenarDigitos: 4: 0" 17 ng-value="precioCondicion.id | rellenarDigitos: 4: 0"
18 autocomplete="off" 18 autocomplete="off"
19 readonly 19 readonly
20 /> 20 />
21 <label class="col-sm-2 col-form-label">Nombre</label> 21 <label class="col-sm-2 col-form-label">Nombre</label>
22 <input 22 <input
23 class="form-control col-sm-4" 23 class="form-control col-sm-4"
24 type="text" 24 type="text"
25 name="nombre" 25 name="nombre"
26 ng-model="precioCondicion.nombre" 26 ng-model="precioCondicion.nombre"
27 autocomplete="off" 27 autocomplete="off"
28 foca-focus="focused == 1" 28 foca-focus="focused == 1"
29 ng-focus="focused = 1" 29 ng-focus="focused = 1"
30 ng-keypress="next($event.keyCode)" 30 ng-keypress="next($event.keyCode)"
31 teclado-virtual 31 teclado-virtual
32 /> 32 />
33 </div> 33 </div>
34 <div class="form-group row"> 34 <div class="form-group row">
35 <label class="col-sm-2 col-form-label">Descripción</label> 35 <label class="col-sm-2 col-form-label">Descripción</label>
36 <input 36 <input
37 class="form-control col-sm-10" 37 class="form-control col-sm-10"
38 type="text" 38 type="text"
39 name="nombre" 39 name="nombre"
40 ng-model="precioCondicion.descripcion" 40 ng-model="precioCondicion.descripcion"
41 autocomplete="off" 41 autocomplete="off"
42 foca-focus="focused == 2" 42 foca-focus="focused == 2"
43 ng-focus="focused = 2" 43 ng-focus="focused = 2"
44 ng-keypress="next($event.keyCode)" 44 ng-keypress="next($event.keyCode)"
45 teclado-virtual 45 teclado-virtual
46 /> 46 />
47 </div> 47 </div>
48 <div class="row"> 48 <div class="row">
49 <label class="col-sm-2 col-form-label">Lista de precios</label> 49 <label class="col-sm-2 col-form-label">Lista de precios</label>
50 <div class="col-sm-4 input-group p-0"> 50 <div class="col-sm-4 input-group p-0">
51 <input 51 <input
52 ng-model="listaPrecioLabel" 52 ng-model="listaPrecioLabel"
53 class="form-control" 53 class="form-control"
54 foca-focus="focused == 3" 54 foca-focus="focused == 3"
55 ng-focus="focused = 3" 55 ng-focus="focused = 3"
56 ng-keypress="seleccionarListaPrecio($event.keyCode)" 56 ng-keypress="seleccionarListaPrecio($event.keyCode)"
57 readonly 57 readonly
58 /> 58 />
59 <div class="input-group-append"> 59 <div class="input-group-append">
60 <button 60 <button
61 class="btn btn-outline-secondary form-control" 61 class="btn btn-outline-secondary form-control"
62 title="Ver productos" 62 title="Ver productos"
63 type="button" 63 type="button"
64 ng-click="verProductosListaPrecio()" 64 ng-click="verProductosListaPrecio()"
65 ng-show="precioCondicion.listaPrecio" 65 ng-show="precioCondicion.listaPrecio"
66 > 66 >
67 <i class="fa fa-eye" aria-hidden="true"></i> 67 <i class="fa fa-eye" aria-hidden="true"></i>
68 </button> 68 </button>
69 <button 69 <button
70 ladda="searchLoading" 70 ladda="searchLoading"
71 class="btn btn-outline-secondary form-control" 71 class="btn btn-outline-secondary form-control"
72 title="Buscar" 72 title="Buscar"
73 type="button" 73 type="button"
74 ng-click="seleccionarListaPrecio(13)" 74 ng-click="seleccionarListaPrecio(13)"
75 > 75 >
76 <i class="fa fa-search" aria-hidden="true"></i> 76 <i class="fa fa-search" aria-hidden="true"></i>
77 </button> 77 </button>
78 </div> 78 </div>
79 </div> 79 </div>
80 <label class="col-sm-2 col-form-label" ng-show="mostrarPlazos">Plazos</label> 80 <label class="col-sm-2 col-form-label" ng-show="mostrarPlazos">Plazos</label>
81 <div class="col-sm-4 p-0" ng-show="mostrarPlazos"> 81 <div class="col-sm-4 p-0" ng-show="mostrarPlazos">
82 <div class="input-group p-0"> 82 <div class="input-group p-0">
83 <input 83 <input
84 type="number" 84 type="number"
85 class="form-control text-right" 85 class="form-control text-right"
86 min="0" 86 min="0"
87 ng-model="plazoACargar.dias" 87 ng-model="plazoACargar.dias"
88 ng-keypress="agregarPlazo($event.keyCode)" 88 ng-keypress="agregarPlazo($event.keyCode)"
89 foca-focus="focused == 4" 89 foca-focus="focused == 4"
90 ng-focus="focused = 4" 90 ng-focus="focused = 4"
91 placeholder="Días" 91 placeholder="Días"
92 teclado-virtual 92 teclado-virtual
93 /> 93 />
94 <div class="input-group-append"> 94 <div class="input-group-append">
95 <button 95 <button
96 class="btn btn-outline-secondary form-control" 96 class="btn btn-outline-secondary form-control"
97 title="Agregar" 97 title="Agregar"
98 type="button" 98 type="button"
99 ng-click="agregarPlazo(13)" 99 ng-click="agregarPlazo(13)"
100 > 100 >
101 <i class="fa fa-save" aria-hidden="true"></i> 101 <i class="fa fa-save" aria-hidden="true"></i>
102 </button> 102 </button>
103 </div> 103 </div>
104 </div> 104 </div>
105 <table class="table table-striped table-sm"> 105 <table class="table table-striped table-sm">
106 <tbody> 106 <tbody>
107 <tr ng-repeat="(key, plazo) in precioCondicion.plazos"> 107 <tr ng-repeat="(key, plazo) in precioCondicion.plazos">
108 <td class="text-right" > 108 <td class="text-right" >
109 <span ng-bind="plazo.dias + ' días'"></span> 109 <span ng-bind="plazo.dias + ' días'"></span>
110 <button 110 <button
111 type="button" 111 type="button"
112 title="Eliminar" 112 title="Eliminar"
113 class="btn btn-outline-secondary ml-1" 113 class="btn btn-outline-secondary ml-1"
114 ng-click="quitarPlazo(key)" 114 ng-click="quitarPlazo(key)"
115 > 115 >
116 <i class="fa fa-trash"></i> 116 <i class="fa fa-trash"></i>
117 </button> 117 </button>
118 </td> 118 </td>
119 </tr> 119 </tr>
120 </tbody> 120 </tbody>
121 </table> 121 </table>
122 </div> 122 </div>
123 </div> 123 </div>
124 </form> 124 </form>
125 </div> 125 </div>
126 126