Commit af8cfbe551086619beffbf5d632b2869f02966f5
1 parent
9b31d344c5
Exists in
master
boton pausar funcionando, arreglo error gulp
Showing
6 changed files
with
149 additions
and
56 deletions
Show diff stats
.gitignore
gulpfile.js
... | ... | @@ -11,6 +11,7 @@ const replace = require('gulp-replace'); |
11 | 11 | const connect = require('gulp-connect'); |
12 | 12 | const header = require('gulp-header'); |
13 | 13 | const footer = require('gulp-footer'); |
14 | +const gulpSequence = require('gulp-sequence'); | |
14 | 15 | |
15 | 16 | var paths = { |
16 | 17 | srcJS: 'src/js/*.js', |
... | ... | @@ -20,7 +21,9 @@ var paths = { |
20 | 21 | dist: 'dist/' |
21 | 22 | }; |
22 | 23 | |
23 | -gulp.task('templates', ['clean'], function() { | |
24 | +gulp.task('uglify', gulpSequence('clean', ['templates', 'uglify-spec'], 'uglify-app')); | |
25 | + | |
26 | +gulp.task('templates', function() { | |
24 | 27 | return pump( |
25 | 28 | [ |
26 | 29 | gulp.src(paths.srcViews), |
... | ... | @@ -34,7 +37,7 @@ gulp.task('templates', ['clean'], function() { |
34 | 37 | ); |
35 | 38 | }); |
36 | 39 | |
37 | -gulp.task('uglify', ['templates', 'uglify-spec'], function() { | |
40 | +gulp.task('uglify-app', function() { | |
38 | 41 | return pump( |
39 | 42 | [ |
40 | 43 | gulp.src([ |
package.json
spec/controllerSpec.js
... | ... | @@ -52,7 +52,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
52 | 52 | }, |
53 | 53 | focaSeguimientoService: {}, |
54 | 54 | APP: {}, |
55 | - focaLoginService: {} | |
55 | + focaLoginService: {}, | |
56 | + $localStorage: {}, | |
57 | + $watch: function() { } | |
56 | 58 | }); |
57 | 59 | var respuesta = { result: { then: function() { } } }; |
58 | 60 | |
... | ... | @@ -96,7 +98,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
96 | 98 | }, |
97 | 99 | focaSeguimientoService: {}, |
98 | 100 | APP: {}, |
99 | - focaLoginService: {} | |
101 | + focaLoginService: {}, | |
102 | + $localStorage: {}, | |
103 | + $watch: function() { } | |
100 | 104 | }); |
101 | 105 | var notaPedido = { |
102 | 106 | cotizacion: { |
... | ... | @@ -154,7 +158,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
154 | 158 | }, |
155 | 159 | focaSeguimientoService: {}, |
156 | 160 | APP: {}, |
157 | - focaLoginService: {} | |
161 | + focaLoginService: {}, | |
162 | + $localStorage: {}, | |
163 | + $watch: function() { } | |
158 | 164 | }); |
159 | 165 | |
160 | 166 | //act |
... | ... | @@ -196,7 +202,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
196 | 202 | }, |
197 | 203 | focaSeguimientoService: {}, |
198 | 204 | APP: {}, |
199 | - focaLoginService: {} | |
205 | + focaLoginService: {}, | |
206 | + $localStorage: {}, | |
207 | + $watch: function() { } | |
200 | 208 | }); |
201 | 209 | scope.idLista = true; |
202 | 210 | scope.notaPedido = { |
... | ... | @@ -244,7 +252,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
244 | 252 | }, |
245 | 253 | focaSeguimientoService: {}, |
246 | 254 | APP: {}, |
247 | - focaLoginService: {} | |
255 | + focaLoginService: {}, | |
256 | + $localStorage: {}, | |
257 | + $watch: function() { } | |
248 | 258 | }); |
249 | 259 | scope.idLista = true; |
250 | 260 | scope.notaPedido = { |
... | ... | @@ -289,7 +299,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
289 | 299 | }, |
290 | 300 | focaSeguimientoService: {}, |
291 | 301 | APP: {}, |
292 | - focaLoginService: {} | |
302 | + focaLoginService: {}, | |
303 | + $localStorage: {}, | |
304 | + $watch: function() { } | |
293 | 305 | }); |
294 | 306 | scope.idLista = true; |
295 | 307 | scope.notaPedido = { |
... | ... | @@ -335,7 +347,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
335 | 347 | }, |
336 | 348 | focaSeguimientoService: {}, |
337 | 349 | APP: {}, |
338 | - focaLoginService: {} | |
350 | + focaLoginService: {}, | |
351 | + $localStorage: {}, | |
352 | + $watch: function() { } | |
339 | 353 | }); |
340 | 354 | scope.idLista = true; |
341 | 355 | scope.notaPedido = { |
... | ... | @@ -386,7 +400,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
386 | 400 | }, |
387 | 401 | focaSeguimientoService: {}, |
388 | 402 | APP: {}, |
389 | - focaLoginService: {} | |
403 | + focaLoginService: {}, | |
404 | + $localStorage: {}, | |
405 | + $watch: function() { } | |
390 | 406 | }); |
391 | 407 | scope.idLista = true; |
392 | 408 | scope.notaPedido = { |
... | ... | @@ -433,7 +449,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
433 | 449 | }, |
434 | 450 | focaSeguimientoService: {}, |
435 | 451 | APP: {}, |
436 | - focaLoginService: {} | |
452 | + focaLoginService: {}, | |
453 | + $localStorage: {}, | |
454 | + $watch: function() { } | |
437 | 455 | }); |
438 | 456 | scope.idLista = true; |
439 | 457 | scope.notaPedido = { |
... | ... | @@ -486,7 +504,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
486 | 504 | }, |
487 | 505 | focaSeguimientoService: {}, |
488 | 506 | APP: {}, |
489 | - focaLoginService: {} | |
507 | + focaLoginService: {}, | |
508 | + $localStorage: {}, | |
509 | + $watch: function() { } | |
490 | 510 | }); |
491 | 511 | scope.notaPedido = {}; |
492 | 512 | |
... | ... | @@ -529,7 +549,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
529 | 549 | }, |
530 | 550 | focaSeguimientoService: {}, |
531 | 551 | APP: {}, |
532 | - focaLoginService: {} | |
552 | + focaLoginService: {}, | |
553 | + $localStorage: {}, | |
554 | + $watch: function() { } | |
533 | 555 | }); |
534 | 556 | |
535 | 557 | scope.notaPedido = {}; |
... | ... | @@ -579,7 +601,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
579 | 601 | }, |
580 | 602 | focaSeguimientoService: {}, |
581 | 603 | APP: {}, |
582 | - focaLoginService: {} | |
604 | + focaLoginService: {}, | |
605 | + $localStorage: {}, | |
606 | + $watch: function() { } | |
583 | 607 | }); |
584 | 608 | scope.notaPedido = { |
585 | 609 | vendedor: { NUM: false } |
... | ... | @@ -622,7 +646,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
622 | 646 | }, |
623 | 647 | focaSeguimientoService: {}, |
624 | 648 | APP: {}, |
625 | - focaLoginService: {} | |
649 | + focaLoginService: {}, | |
650 | + $localStorage: {}, | |
651 | + $watch: function() { } | |
626 | 652 | }); |
627 | 653 | scope.notaPedido = { |
628 | 654 | vendedor: { NUM: true } |
... | ... | @@ -668,7 +694,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
668 | 694 | }, |
669 | 695 | focaSeguimientoService: {}, |
670 | 696 | APP: {}, |
671 | - focaLoginService: {} | |
697 | + focaLoginService: {}, | |
698 | + $localStorage: {}, | |
699 | + $watch: function() { } | |
672 | 700 | }); |
673 | 701 | scope.idLista = true; |
674 | 702 | scope.notaPedido = { |
... | ... | @@ -719,7 +747,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
719 | 747 | }, |
720 | 748 | focaSeguimientoService: {}, |
721 | 749 | APP: {}, |
722 | - focaLoginService: {} | |
750 | + focaLoginService: {}, | |
751 | + $localStorage: {}, | |
752 | + $watch: function() { } | |
723 | 753 | }); |
724 | 754 | |
725 | 755 | var respuesta = { result: {then: function() { } } }; |
... | ... | @@ -767,7 +797,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
767 | 797 | }, |
768 | 798 | focaSeguimientoService: {}, |
769 | 799 | APP: {}, |
770 | - focaLoginService: {} | |
800 | + focaLoginService: {}, | |
801 | + $localStorage: {}, | |
802 | + $watch: function() { } | |
771 | 803 | }); |
772 | 804 | scope.idLista = true; |
773 | 805 | scope.notaPedido = { |
... | ... | @@ -823,7 +855,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
823 | 855 | }, |
824 | 856 | focaSeguimientoService: {}, |
825 | 857 | APP: {}, |
826 | - focaLoginService: {} | |
858 | + focaLoginService: {}, | |
859 | + $localStorage: {}, | |
860 | + $watch: function() { } | |
827 | 861 | }); |
828 | 862 | scope.idLista = true; |
829 | 863 | scope.notaPedido = { |
... | ... | @@ -866,7 +900,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
866 | 900 | }, |
867 | 901 | focaSeguimientoService: {}, |
868 | 902 | APP: {}, |
869 | - focaLoginService: {} | |
903 | + focaLoginService: {}, | |
904 | + $localStorage: {}, | |
905 | + $watch: function() { } | |
870 | 906 | }); |
871 | 907 | scope.idLista = true; |
872 | 908 | scope.notaPedido = { |
... | ... | @@ -912,7 +948,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
912 | 948 | }, |
913 | 949 | focaSeguimientoService: {}, |
914 | 950 | APP: {}, |
915 | - focaLoginService: {} | |
951 | + focaLoginService: {}, | |
952 | + $localStorage: {}, | |
953 | + $watch: function() { } | |
916 | 954 | }); |
917 | 955 | |
918 | 956 | scope.notaPedido = {}; |
... | ... | @@ -957,7 +995,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
957 | 995 | }, |
958 | 996 | focaSeguimientoService: {}, |
959 | 997 | APP: {}, |
960 | - focaLoginService: {} | |
998 | + focaLoginService: {}, | |
999 | + $localStorage: {}, | |
1000 | + $watch: function() { } | |
961 | 1001 | }); |
962 | 1002 | scope.idLista = true; |
963 | 1003 | scope.notaPedido = { |
... | ... | @@ -1010,7 +1050,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1010 | 1050 | }, |
1011 | 1051 | focaSeguimientoService: {}, |
1012 | 1052 | APP: {}, |
1013 | - focaLoginService: {} | |
1053 | + focaLoginService: {}, | |
1054 | + $localStorage: {}, | |
1055 | + $watch: function() { } | |
1014 | 1056 | }); |
1015 | 1057 | |
1016 | 1058 | scope.notaPedido = {}; |
... | ... | @@ -1055,7 +1097,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1055 | 1097 | }, |
1056 | 1098 | focaSeguimientoService: {}, |
1057 | 1099 | APP: {}, |
1058 | - focaLoginService: {} | |
1100 | + focaLoginService: {}, | |
1101 | + $localStorage: {}, | |
1102 | + $watch: function() { } | |
1059 | 1103 | }); |
1060 | 1104 | scope.idLista = true; |
1061 | 1105 | scope.notaPedido = { |
... | ... | @@ -1111,7 +1155,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1111 | 1155 | }, |
1112 | 1156 | focaSeguimientoService: {}, |
1113 | 1157 | APP: {}, |
1114 | - focaLoginService: {} | |
1158 | + focaLoginService: {}, | |
1159 | + $localStorage: {}, | |
1160 | + $watch: function() { } | |
1115 | 1161 | }); |
1116 | 1162 | scope.notaPedido = {}; |
1117 | 1163 | |
... | ... | @@ -1154,7 +1200,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1154 | 1200 | }, |
1155 | 1201 | focaSeguimientoService: {}, |
1156 | 1202 | APP: {}, |
1157 | - focaLoginService: {} | |
1203 | + focaLoginService: {}, | |
1204 | + $localStorage: {}, | |
1205 | + $watch: function() { } | |
1158 | 1206 | }); |
1159 | 1207 | |
1160 | 1208 | scope.notaPedido = {}; |
... | ... | @@ -1203,7 +1251,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1203 | 1251 | }, |
1204 | 1252 | focaSeguimientoService: {}, |
1205 | 1253 | APP: {}, |
1206 | - focaLoginService: {} | |
1254 | + focaLoginService: {}, | |
1255 | + $localStorage: {}, | |
1256 | + $watch: function() { } | |
1207 | 1257 | }); |
1208 | 1258 | var respuesta = { then: function() { } }; |
1209 | 1259 | scope.notaPedido = {}; |
... | ... | @@ -1246,7 +1296,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1246 | 1296 | }, |
1247 | 1297 | focaSeguimientoService: {}, |
1248 | 1298 | APP: {}, |
1249 | - focaLoginService: {} | |
1299 | + focaLoginService: {}, | |
1300 | + $localStorage: {}, | |
1301 | + $watch: function() { } | |
1250 | 1302 | }); |
1251 | 1303 | var respuesta = 'unit test'; |
1252 | 1304 | var promesa = Promise.resolve(respuesta); |
... | ... | @@ -1293,7 +1345,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1293 | 1345 | }, |
1294 | 1346 | focaSeguimientoService: {}, |
1295 | 1347 | APP: {}, |
1296 | - focaLoginService: {} | |
1348 | + focaLoginService: {}, | |
1349 | + $localStorage: {}, | |
1350 | + $watch: function() { } | |
1297 | 1351 | }); |
1298 | 1352 | |
1299 | 1353 | scope.notaPedido = {}; |
... | ... | @@ -1337,7 +1391,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1337 | 1391 | }, |
1338 | 1392 | focaSeguimientoService: {}, |
1339 | 1393 | APP: {}, |
1340 | - focaLoginService: {} | |
1394 | + focaLoginService: {}, | |
1395 | + $localStorage: {}, | |
1396 | + $watch: function() { } | |
1341 | 1397 | }); |
1342 | 1398 | |
1343 | 1399 | scope.notaPedido = {}; |
... | ... | @@ -1394,7 +1450,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1394 | 1450 | }, |
1395 | 1451 | focaSeguimientoService: {}, |
1396 | 1452 | APP: {}, |
1397 | - focaLoginService: {} | |
1453 | + focaLoginService: {}, | |
1454 | + $localStorage: {}, | |
1455 | + $watch: function() { } | |
1398 | 1456 | }); |
1399 | 1457 | scope.articuloACargar = {}; |
1400 | 1458 | |
... | ... | @@ -1436,7 +1494,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1436 | 1494 | }, |
1437 | 1495 | focaSeguimientoService: {}, |
1438 | 1496 | APP: {}, |
1439 | - focaLoginService: {} | |
1497 | + focaLoginService: {}, | |
1498 | + $localStorage: {}, | |
1499 | + $watch: function() { } | |
1440 | 1500 | }); |
1441 | 1501 | scope.articuloACargar = {}; |
1442 | 1502 | |
... | ... | @@ -1477,7 +1537,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
1477 | 1537 | }, |
1478 | 1538 | focaSeguimientoService: {}, |
1479 | 1539 | APP: {}, |
1480 | - focaLoginService: {} | |
1540 | + focaLoginService: {}, | |
1541 | + $localStorage: {}, | |
1542 | + $watch: function() { } | |
1481 | 1543 | }); |
1482 | 1544 | |
1483 | 1545 | //act |
spec/controllerSpecCrearPedido.js
... | ... | @@ -48,7 +48,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
48 | 48 | }, |
49 | 49 | focaSeguimientoService: {}, |
50 | 50 | APP: {}, |
51 | - focaLoginService: {} | |
51 | + focaLoginService: {}, | |
52 | + $localStorage: {}, | |
53 | + $watch: function() { } | |
52 | 54 | }); |
53 | 55 | |
54 | 56 | //expect |
... | ... | @@ -85,7 +87,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
85 | 87 | }, |
86 | 88 | focaSeguimientoService: {}, |
87 | 89 | APP: {}, |
88 | - focaLoginService: {} | |
90 | + focaLoginService: {}, | |
91 | + $localStorage: {}, | |
92 | + $watch: function() { } | |
89 | 93 | }); |
90 | 94 | |
91 | 95 | //act |
... | ... | @@ -131,7 +135,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
131 | 135 | }, |
132 | 136 | focaSeguimientoService: {}, |
133 | 137 | APP: {}, |
134 | - focaLoginService: {} | |
138 | + focaLoginService: {}, | |
139 | + $localStorage: {}, | |
140 | + $watch: function() { } | |
135 | 141 | }); |
136 | 142 | |
137 | 143 | scope.notaPedido = { |
... | ... | @@ -181,7 +187,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
181 | 187 | }, |
182 | 188 | focaSeguimientoService: {}, |
183 | 189 | APP: {}, |
184 | - focaLoginService: {} | |
190 | + focaLoginService: {}, | |
191 | + $localStorage: {}, | |
192 | + $watch: function() { } | |
185 | 193 | }); |
186 | 194 | |
187 | 195 | scope.notaPedido = { |
... | ... | @@ -234,7 +242,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
234 | 242 | }, |
235 | 243 | focaSeguimientoService: {}, |
236 | 244 | APP: {}, |
237 | - focaLoginService: {} | |
245 | + focaLoginService: {}, | |
246 | + $localStorage: {}, | |
247 | + $watch: function() { } | |
238 | 248 | }); |
239 | 249 | |
240 | 250 | scope.notaPedido = { |
... | ... | @@ -290,7 +300,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
290 | 300 | }, |
291 | 301 | focaSeguimientoService: {}, |
292 | 302 | APP: {}, |
293 | - focaLoginService: {} | |
303 | + focaLoginService: {}, | |
304 | + $localStorage: {}, | |
305 | + $watch: function() { } | |
294 | 306 | }); |
295 | 307 | |
296 | 308 | scope.notaPedido = { |
... | ... | @@ -349,7 +361,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
349 | 361 | }, |
350 | 362 | focaSeguimientoService: {}, |
351 | 363 | APP: {}, |
352 | - focaLoginService: {} | |
364 | + focaLoginService: {}, | |
365 | + $localStorage: {}, | |
366 | + $watch: function() { } | |
353 | 367 | }); |
354 | 368 | |
355 | 369 | scope.notaPedido = { |
... | ... | @@ -410,7 +424,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
410 | 424 | }, |
411 | 425 | focaSeguimientoService: {}, |
412 | 426 | APP: {}, |
413 | - focaLoginService: {} | |
427 | + focaLoginService: {}, | |
428 | + $localStorage: {}, | |
429 | + $watch: function() { } | |
414 | 430 | }); |
415 | 431 | |
416 | 432 | scope.notaPedido = { |
... | ... | @@ -472,7 +488,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
472 | 488 | }, |
473 | 489 | focaSeguimientoService: {}, |
474 | 490 | APP: {}, |
475 | - focaLoginService: {} | |
491 | + focaLoginService: {}, | |
492 | + $localStorage: {}, | |
493 | + $watch: function() { } | |
476 | 494 | }); |
477 | 495 | |
478 | 496 | scope.notaPedido = { |
... | ... | @@ -537,7 +555,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
537 | 555 | }, |
538 | 556 | focaSeguimientoService: {}, |
539 | 557 | APP: {}, |
540 | - focaLoginService: {} | |
558 | + focaLoginService: {}, | |
559 | + $localStorage: {}, | |
560 | + $watch: function() { } | |
541 | 561 | }); |
542 | 562 | |
543 | 563 | scope.notaPedido = { |
... | ... | @@ -607,7 +627,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
607 | 627 | }, |
608 | 628 | focaSeguimientoService: {}, |
609 | 629 | APP: {}, |
610 | - focaLoginService: {} | |
630 | + focaLoginService: {}, | |
631 | + $localStorage: {}, | |
632 | + $watch: function() { } | |
611 | 633 | }); |
612 | 634 | |
613 | 635 | scope.notaPedido = { |
... | ... | @@ -689,7 +711,9 @@ describe('Controladores módulo crear nota de pedido', function() { |
689 | 711 | }, |
690 | 712 | focaSeguimientoService: focaSeguimientoService, |
691 | 713 | APP: {}, |
692 | - focaLoginService: {} | |
714 | + focaLoginService: {}, | |
715 | + $localStorage: {}, | |
716 | + $watch: function() { } | |
693 | 717 | }); |
694 | 718 | |
695 | 719 | scope.notaPedido = { |
src/js/controller.js
... | ... | @@ -51,18 +51,18 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
51 | 51 | } |
52 | 52 | |
53 | 53 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
54 | - var monedaPorDefecto; | |
55 | 54 | crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { |
56 | - monedaPorDefecto = res.data[0]; | |
55 | + var monedaPorDefecto = res.data[0]; | |
57 | 56 | |
58 | - $scope.notaPedido.cotizacion = Object.assign( | |
59 | - {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0] | |
57 | + $scope.cotizacionPorDefecto = Object.assign( | |
58 | + {moneda: monedaPorDefecto}, | |
59 | + monedaPorDefecto.cotizaciones[0] | |
60 | 60 | ); |
61 | - $scope.inicial.cotizacion = $scope.notaPedido.cotizacion; | |
61 | + | |
62 | + init(); | |
63 | + getLSNotaPedido(); | |
62 | 64 | }); |
63 | 65 | |
64 | - init(); | |
65 | - $timeout(function() {getLSNotaPedido();}); | |
66 | 66 | |
67 | 67 | } |
68 | 68 | |
... | ... | @@ -76,7 +76,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
76 | 76 | domicilio: {dom: ''}, |
77 | 77 | vendedor: {}, |
78 | 78 | fechaCarga: new Date(), |
79 | - cotizacion: {} | |
79 | + cotizacion: $scope.cotizacionPorDefecto | |
80 | 80 | }; |
81 | 81 | |
82 | 82 | $scope.notaPedido.articulosNotaPedido = []; |
... | ... | @@ -502,9 +502,11 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
502 | 502 | |
503 | 503 | $scope.getTotal = function() { |
504 | 504 | var total = 0; |
505 | - var arrayTempArticulos = $scope.notaPedido.articulosNotaPedido; | |
506 | - for (var i = 0; i < arrayTempArticulos.length; i++) { | |
507 | - total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | |
505 | + if ($scope.notaPedido.articulosNotaPedido) { | |
506 | + var arrayTempArticulos = $scope.notaPedido.articulosNotaPedido; | |
507 | + for (var i = 0; i < arrayTempArticulos.length; i++) { | |
508 | + total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | |
509 | + } | |
508 | 510 | } |
509 | 511 | |
510 | 512 | return parseFloat(total.toFixed(2)); |