Commit 34f75fc292c48d366056c1336cf83edcbf28721d

Authored by Marcelo Puebla
Exists in master

Merge branch 'develop' of http://git.focasoftware.com/npm/foca-crear-remito

... ... @@ -9,15 +9,23 @@ const pump = require('pump');
9 9 const jshint = require('gulp-jshint');
10 10 const replace = require('gulp-replace');
11 11 const connect = require('gulp-connect');
  12 +const header = require('gulp-header');
  13 +const footer = require('gulp-footer');
  14 +const gulpSequence = require('gulp-sequence');
12 15  
13 16 var paths = {
14 17 srcJS: 'src/js/*.js',
15 18 srcViews: 'src/views/*.html',
  19 + specs: 'spec/*.js',
16 20 tmp: 'tmp',
17 21 dist: 'dist/'
18 22 };
19 23  
20   -gulp.task('templates', ['clean'], function() {
  24 +gulp.task('uglify', function(callback) {
  25 + gulpSequence('clean', ['templates', 'uglify-spec'], 'uglify-app')(callback);
  26 +});
  27 +
  28 +gulp.task('templates', function() {
21 29 return pump(
22 30 [
23 31 gulp.src(paths.srcViews),
... ... @@ -31,7 +39,7 @@ gulp.task('templates', ['clean'], function() {
31 39 );
32 40 });
33 41  
34   -gulp.task('uglify', ['templates'], function() {
  42 +gulp.task('uglify-app', function() {
35 43 return pump(
36 44 [
37 45 gulp.src([
... ... @@ -48,15 +56,27 @@ gulp.task('uglify', ['templates'], function() {
48 56 );
49 57 });
50 58  
  59 +gulp.task('uglify-spec', function() {
  60 + return pump(
  61 + [
  62 + gulp.src(paths.specs),
  63 + concat('foca-crear-remito.spec.js'),
  64 + replace('src/views/', ''),
  65 + header("describe('Módulo foca-crear-remito', function() { \n"),
  66 + footer("});"),
  67 + gulp.dest(paths.dist)
  68 + ]
  69 + );
  70 +});
  71 +
51 72 gulp.task('clean', function() {
52   - return gulp.src(['tmp', 'dist'], {read: false})
53   - .pipe(clean());
  73 + return gulp.src(['tmp', 'dist'], {read: false}).pipe(clean());
54 74 });
55 75  
56 76 gulp.task('pre-commit', function() {
57 77 return pump(
58 78 [
59   - gulp.src(paths.srcJS),
  79 + gulp.src([paths.srcJS, paths.specs]),
60 80 jshint('.jshintrc'),
61 81 jshint.reporter('default'),
62 82 jshint.reporter('fail')
... ... @@ -65,7 +85,7 @@ gulp.task('pre-commit', function() {
65 85  
66 86 gulp.start('uglify');
67 87 });
68   -
  88 +
69 89 gulp.task('webserver', function() {
70 90 pump [
71 91 connect.server({port: 3300, host: '0.0.0.0'})
spec/controllerSpec.js
... ... @@ -0,0 +1,1522 @@
  1 +describe('Controlador modulo crear remito', function() {
  2 +
  3 + var $controller;
  4 +
  5 + beforeEach(function() {
  6 +
  7 + module('focaCrearRemito');
  8 +
  9 + inject(function(_$controller_) {
  10 + $controller = _$controller_;
  11 + });
  12 + });
  13 +
  14 + describe('Controlador remitoController', function() {
  15 +
  16 + var timeout;
  17 +
  18 + beforeEach(function() {
  19 +
  20 + inject(function($timeout) {
  21 + timeout = $timeout;
  22 + });
  23 + });
  24 +
  25 + it('Existe el controlador remitoController', function() {
  26 +
  27 + //act
  28 + var controlador = $controller('remitoController', {
  29 + $scope: {
  30 + $broadcast: function() { },
  31 + $watch: function() { }
  32 + },
  33 + $uibModal: {},
  34 + $location: {},
  35 + $filter: {},
  36 + crearRemitoService: {
  37 + getBotonera: function() { },
  38 + getCotizacionByIdMoneda: function() {
  39 + return {
  40 + then: function() { }
  41 + };
  42 + },
  43 + getNumeroRemito: function() {
  44 + return {
  45 + then: function() { }
  46 + };
  47 + }
  48 + },
  49 + $timeout: timeout,
  50 + focaModalService: {},
  51 + remitoBusinessService: {},
  52 + $rootScope: {
  53 + $on: function() { }
  54 + },
  55 + focaBotoneraLateralService: {},
  56 + $localStorage: {}
  57 + });
  58 +
  59 + //assert
  60 + expect(typeof controlador).toEqual('object');
  61 +
  62 + });
  63 +
  64 + it('seleccionarNotaPedido levanta modal', function() {
  65 +
  66 + //arrange
  67 + var scope = {
  68 + $broadcast: function() { },
  69 + $watch: function() { }
  70 + };
  71 + var uibModal = {
  72 + open: function() { }
  73 + };
  74 +
  75 + $controller('remitoController', {
  76 + $scope: scope,
  77 + $uibModal: uibModal,
  78 + $location: {},
  79 + $filter: {},
  80 + crearRemitoService: {
  81 + getBotonera: function() { },
  82 + getCotizacionByIdMoneda: function() {
  83 + return {
  84 + then: function() { }
  85 + };
  86 + },
  87 + getNumeroRemito: function() {
  88 + return {
  89 + then: function() { }
  90 + };
  91 + }
  92 + },
  93 + $timeout: timeout,
  94 + focaModalService: {},
  95 + remitoBusinessService: {},
  96 + $rootScope: {
  97 + $on: function() { }
  98 + },
  99 + focaBotoneraLateralService: {},
  100 + $localStorage: {}
  101 + });
  102 +
  103 + //act
  104 + spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } });
  105 + spyOn(scope, 'seleccionarNotaPedido');
  106 + scope.seleccionarNotaPedido();
  107 +
  108 + //assert
  109 + expect(scope.seleccionarNotaPedido).toHaveBeenCalled();
  110 +
  111 + });
  112 +
  113 + it('seleccionarRemito levanta modal', function() {
  114 +
  115 + //arrange
  116 + var scope = {
  117 + $broadcast: function() { },
  118 + $watch: function() { }
  119 + };
  120 + var uibModal = {
  121 + open: function() { }
  122 + };
  123 +
  124 + $controller('remitoController', {
  125 + $scope: scope,
  126 + $uibModal: uibModal,
  127 + $location: {},
  128 + $filter: {},
  129 + crearRemitoService: {
  130 + getBotonera: function() { },
  131 + getCotizacionByIdMoneda: function() {
  132 + return {
  133 + then: function() { }
  134 + };
  135 + },
  136 + getNumeroRemito: function() {
  137 + return {
  138 + then: function() { }
  139 + };
  140 + }
  141 + },
  142 + $timeout: timeout,
  143 + focaModalService: {},
  144 + remitoBusinessService: {},
  145 + $rootScope: {
  146 + $on: function() { }
  147 + },
  148 + focaBotoneraLateralService: {},
  149 + $localStorage: {}
  150 + });
  151 +
  152 + //act
  153 + spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } });
  154 + spyOn(scope, 'seleccionarRemito');
  155 + scope.seleccionarRemito();
  156 +
  157 + //assert
  158 + expect(scope.seleccionarRemito).toHaveBeenCalled();
  159 +
  160 + });
  161 +
  162 + it('crearRemito muestra alerta cuando no se eligió vendedor', function() {
  163 +
  164 + //arrange
  165 + var scope = {
  166 + $broadcast: function() { },
  167 + $watch: function() { }
  168 + };
  169 + var focaModalService = {
  170 + alert: function() { }
  171 + };
  172 +
  173 + $controller('remitoController', {
  174 + $scope: scope,
  175 + $uibModal: {},
  176 + $location: {},
  177 + $filter: {},
  178 + crearRemitoService: {
  179 + getBotonera: function() { },
  180 + getCotizacionByIdMoneda: function() {
  181 + return {
  182 + then: function() { }
  183 + };
  184 + },
  185 + getNumeroRemito: function() {
  186 + return {
  187 + then: function() { }
  188 + };
  189 + }
  190 + },
  191 + $timeout: timeout,
  192 + focaModalService: focaModalService,
  193 + remitoBusinessService: {},
  194 + $rootScope: {
  195 + $on: function() { }
  196 + },
  197 + focaBotoneraLateralService: {},
  198 + $localStorage: {}
  199 + });
  200 +
  201 + //act
  202 + spyOn(focaModalService, 'alert');
  203 + scope.crearRemito();
  204 +
  205 + //assert
  206 + expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Vendedor');
  207 +
  208 + });
  209 +
  210 + it('crearRemito muestra alerta cuando no se eligió cliente', function() {
  211 +
  212 + //arrange
  213 + var scope = {
  214 + $broadcast: function() { },
  215 + $watch: function() { }
  216 + };
  217 + var focaModalService = {
  218 + alert: function() { }
  219 + };
  220 +
  221 + $controller('remitoController', {
  222 + $scope: scope,
  223 + $uibModal: {},
  224 + $location: {},
  225 + $filter: {},
  226 + crearRemitoService: {
  227 + getBotonera: function() { },
  228 + getCotizacionByIdMoneda: function() {
  229 + return {
  230 + then: function() { }
  231 + };
  232 + },
  233 + getNumeroRemito: function() {
  234 + return {
  235 + then: function() { }
  236 + };
  237 + }
  238 + },
  239 + $timeout: timeout,
  240 + focaModalService: focaModalService,
  241 + remitoBusinessService: {},
  242 + $rootScope: {
  243 + $on: function() { }
  244 + },
  245 + focaBotoneraLateralService: {},
  246 + $localStorage: {}
  247 + });
  248 +
  249 + scope.remito = {
  250 + vendedor: { NUM: true },
  251 + cliente: {}
  252 + };
  253 +
  254 + //act
  255 + spyOn(focaModalService, 'alert');
  256 + scope.crearRemito();
  257 +
  258 + //assert
  259 + expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Cliente');
  260 +
  261 + });
  262 +
  263 + it('crearRemito muestra alerta cuando no se eligió Proveedor', function() {
  264 +
  265 + //arrange
  266 + var scope = {
  267 + $broadcast: function() { },
  268 + $watch: function() { }
  269 + };
  270 + var focaModalService = {
  271 + alert: function() { }
  272 + };
  273 +
  274 + $controller('remitoController', {
  275 + $scope: scope,
  276 + $uibModal: {},
  277 + $location: {},
  278 + $filter: {},
  279 + crearRemitoService: {
  280 + getBotonera: function() { },
  281 + getCotizacionByIdMoneda: function() {
  282 + return {
  283 + then: function() { }
  284 + };
  285 + },
  286 + getNumeroRemito: function() {
  287 + return {
  288 + then: function() { }
  289 + };
  290 + }
  291 + },
  292 + $timeout: timeout,
  293 + focaModalService: focaModalService,
  294 + remitoBusinessService: {},
  295 + $rootScope: {
  296 + $on: function() { }
  297 + },
  298 + focaBotoneraLateralService: {},
  299 + $localStorage: {}
  300 + });
  301 +
  302 + scope.remito = {
  303 + vendedor: { NUM: true },
  304 + cliente: { COD: true }
  305 + };
  306 +
  307 + //act
  308 + spyOn(focaModalService, 'alert');
  309 + scope.crearRemito();
  310 +
  311 + //assert
  312 + expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Proveedor');
  313 +
  314 + });
  315 +
  316 + it('crearRemito muestra alerta cuando no se eligió moneda', function() {
  317 +
  318 + //arrange
  319 + var scope = {
  320 + $broadcast: function() { },
  321 + $watch: function() { }
  322 + };
  323 + var focaModalService = {
  324 + alert: function() { }
  325 + };
  326 +
  327 + $controller('remitoController', {
  328 + $scope: scope,
  329 + $uibModal: {},
  330 + $location: {},
  331 + $filter: {},
  332 + crearRemitoService: {
  333 + getBotonera: function() { },
  334 + getCotizacionByIdMoneda: function() {
  335 + return {
  336 + then: function() { }
  337 + };
  338 + },
  339 + getNumeroRemito: function() {
  340 + return {
  341 + then: function() { }
  342 + };
  343 + }
  344 + },
  345 + $timeout: timeout,
  346 + focaModalService: focaModalService,
  347 + remitoBusinessService: {},
  348 + $rootScope: {
  349 + $on: function() { }
  350 + },
  351 + focaBotoneraLateralService: {},
  352 + $localStorage: {}
  353 + });
  354 +
  355 + scope.remito = {
  356 + vendedor: { NUM: true },
  357 + cliente: { COD: true },
  358 + proveedor: {},
  359 + cotizacion: { moneda: {} }
  360 + };
  361 +
  362 + //act
  363 + spyOn(focaModalService, 'alert');
  364 + scope.crearRemito();
  365 +
  366 + //assert
  367 + expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Moneda');
  368 +
  369 + });
  370 +
  371 + it('crearRemito muestra alerta cuando no se eligió Cotización', function() {
  372 +
  373 + //arrange
  374 + var scope = {
  375 + $broadcast: function() { },
  376 + $watch: function() { }
  377 + };
  378 + var focaModalService = {
  379 + alert: function() { }
  380 + };
  381 +
  382 + $controller('remitoController', {
  383 + $scope: scope,
  384 + $uibModal: {},
  385 + $location: {},
  386 + $filter: {},
  387 + crearRemitoService: {
  388 + getBotonera: function() { },
  389 + getCotizacionByIdMoneda: function() {
  390 + return {
  391 + then: function() { }
  392 + };
  393 + },
  394 + getNumeroRemito: function() {
  395 + return {
  396 + then: function() { }
  397 + };
  398 + }
  399 + },
  400 + $timeout: timeout,
  401 + focaModalService: focaModalService,
  402 + remitoBusinessService: {},
  403 + $rootScope: {
  404 + $on: function() { }
  405 + },
  406 + focaBotoneraLateralService: {},
  407 + $localStorage: {}
  408 + });
  409 +
  410 + scope.remito = {
  411 + vendedor: { NUM: true },
  412 + cliente: { COD: true },
  413 + proveedor: {},
  414 + cotizacion: { moneda: { id: true } }
  415 + };
  416 +
  417 + //act
  418 + spyOn(focaModalService, 'alert');
  419 + scope.crearRemito();
  420 +
  421 + //assert
  422 + expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Cotización');
  423 +
  424 + });
  425 +
  426 + it('crearRemito muestra alerta cuando no se eligió flete', function() {
  427 +
  428 + //arrange
  429 + var scope = {
  430 + $broadcast: function() { },
  431 + $watch: function() { }
  432 + };
  433 + var focaModalService = {
  434 + alert: function() { }
  435 + };
  436 +
  437 + $controller('remitoController', {
  438 + $scope: scope,
  439 + $uibModal: {},
  440 + $location: {},
  441 + $filter: {},
  442 + crearRemitoService: {
  443 + getBotonera: function() { },
  444 + getCotizacionByIdMoneda: function() {
  445 + return {
  446 + then: function() { }
  447 + };
  448 + },
  449 + getNumeroRemito: function() {
  450 + return {
  451 + then: function() { }
  452 + };
  453 + }
  454 + },
  455 + $timeout: timeout,
  456 + focaModalService: focaModalService,
  457 + remitoBusinessService: {},
  458 + $rootScope: {
  459 + $on: function() { }
  460 + },
  461 + focaBotoneraLateralService: {},
  462 + $localStorage: {}
  463 + });
  464 +
  465 + scope.remito = {
  466 + vendedor: { NUM: true },
  467 + cliente: { COD: true },
  468 + proveedor: {},
  469 + cotizacion: {
  470 + moneda: { id: true },
  471 + ID: true
  472 + }
  473 + };
  474 +
  475 + //act
  476 + spyOn(focaModalService, 'alert');
  477 + scope.crearRemito();
  478 +
  479 + //assert
  480 + expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Flete');
  481 +
  482 + });
  483 +
  484 + it('crearRemito muestra alerta cuando no se eligió articulos', function() {
  485 +
  486 + //arrange
  487 + var scope = {
  488 + $broadcast: function() { },
  489 + $watch: function() { }
  490 + };
  491 + var focaModalService = {
  492 + alert: function() { }
  493 + };
  494 +
  495 + $controller('remitoController', {
  496 + $scope: scope,
  497 + $uibModal: {},
  498 + $location: {},
  499 + $filter: {},
  500 + crearRemitoService: {
  501 + getBotonera: function() { },
  502 + getCotizacionByIdMoneda: function() {
  503 + return {
  504 + then: function() { }
  505 + };
  506 + },
  507 + getNumeroRemito: function() {
  508 + return {
  509 + then: function() { }
  510 + };
  511 + }
  512 + },
  513 + $timeout: timeout,
  514 + focaModalService: focaModalService,
  515 + remitoBusinessService: {},
  516 + $rootScope: {
  517 + $on: function() { }
  518 + },
  519 + focaBotoneraLateralService: {},
  520 + $localStorage: {}
  521 + });
  522 +
  523 + scope.remito = {
  524 + vendedor: { NUM: true },
  525 + cliente: { COD: true },
  526 + proveedor: {},
  527 + cotizacion: {
  528 + moneda: { id: true },
  529 + ID: true
  530 + },
  531 + flete: true,
  532 + articulosRemito: []
  533 + };
  534 +
  535 + //act
  536 + spyOn(focaModalService, 'alert');
  537 + scope.crearRemito();
  538 +
  539 + //assert
  540 + expect(focaModalService.alert).toHaveBeenCalledWith('Debe cargar al menos un articulo');
  541 +
  542 + });
  543 +
  544 + it('crearRemito llama a startGuardar', function() {
  545 +
  546 + //arrange
  547 + var scope = {
  548 + $broadcast: function() { },
  549 + $watch: function() { }
  550 + };
  551 + var focaBotoneraLateralService = {
  552 + startGuardar: function() { }
  553 + };
  554 +
  555 + $controller('remitoController', {
  556 + $scope: scope,
  557 + $uibModal: {},
  558 + $location: {},
  559 + $filter: {},
  560 + crearRemitoService: {
  561 + getBotonera: function() { },
  562 + getCotizacionByIdMoneda: function() {
  563 + return {
  564 + then: function() { }
  565 + };
  566 + },
  567 + getNumeroRemito: function() {
  568 + return {
  569 + then: function() { }
  570 + };
  571 + },
  572 + crearRemito: function() {
  573 + return {
  574 + then: function() { }
  575 + };
  576 + }
  577 + },
  578 + $timeout: timeout,
  579 + focaModalService: {},
  580 + remitoBusinessService: {},
  581 + $rootScope: {
  582 + $on: function() { }
  583 + },
  584 + focaBotoneraLateralService: focaBotoneraLateralService,
  585 + $localStorage: {}
  586 + });
  587 +
  588 + scope.remito = {
  589 + vendedor: { NUM: true },
  590 + cliente: { COD: true },
  591 + proveedor: {},
  592 + cotizacion: {
  593 + moneda: { id: true },
  594 + ID: true
  595 + },
  596 + flete: true,
  597 + articulosRemito: [ 1 ]
  598 + };
  599 +
  600 + //act
  601 + spyOn(focaBotoneraLateralService, 'startGuardar');
  602 + scope.crearRemito();
  603 +
  604 + //assert
  605 + expect(focaBotoneraLateralService.startGuardar).toHaveBeenCalled();
  606 +
  607 + });
  608 +
  609 + it('crearRemito llama a endGuardar y abre modal', function(done) {
  610 +
  611 + //arrange
  612 + var scope = {
  613 + $broadcast: function() { },
  614 + $watch: function() { }
  615 + };
  616 + var focaBotoneraLateralService = {
  617 + startGuardar: function() { },
  618 + endGuardar: function() { }
  619 + };
  620 + var uibModal = {
  621 + open: function() { }
  622 + };
  623 + var crearRemitoService = {
  624 + getBotonera: function() { },
  625 + getCotizacionByIdMoneda: function() {
  626 + return {
  627 + then: function() { }
  628 + };
  629 + },
  630 + getNumeroRemito: function() {
  631 + return {
  632 + then: function() { }
  633 + };
  634 + },
  635 + crearRemito: function() { }
  636 + };
  637 +
  638 + $controller('remitoController', {
  639 + $scope: scope,
  640 + $uibModal: uibModal,
  641 + $location: {},
  642 + $filter: {},
  643 + crearRemitoService: crearRemitoService,
  644 + $timeout: timeout,
  645 + focaModalService: {},
  646 + remitoBusinessService: {
  647 + addArticulos: function() { }
  648 + },
  649 + $rootScope: {
  650 + $on: function() { }
  651 + },
  652 + focaBotoneraLateralService: focaBotoneraLateralService,
  653 + $localStorage: {}
  654 + });
  655 +
  656 + scope.remito = {
  657 + vendedor: { NUM: true },
  658 + cliente: { COD: true },
  659 + proveedor: {},
  660 + cotizacion: {
  661 + moneda: { id: true },
  662 + ID: true
  663 + },
  664 + flete: true,
  665 + articulosRemito: [1]
  666 + };
  667 + var promiseRespond = Promise.resolve({ data: {} });
  668 +
  669 + //act
  670 + spyOn(crearRemitoService, 'crearRemito').and.returnValue(promiseRespond);
  671 + spyOn(focaBotoneraLateralService, 'endGuardar');
  672 + spyOn(uibModal, 'open');
  673 + scope.crearRemito();
  674 +
  675 + //assert
  676 + promiseRespond.then(function() {
  677 +
  678 + expect(focaBotoneraLateralService.endGuardar).toHaveBeenCalled();
  679 + done();
  680 + });
  681 + });
  682 +
  683 + it('seleccionarProductos abre modal', function() {
  684 +
  685 + //arrange
  686 + var scope = {
  687 + $broadcast: function() { },
  688 + $watch: function() { }
  689 + };
  690 + var uibModal = {
  691 + open: function() { }
  692 + };
  693 +
  694 + $controller('remitoController', {
  695 + $scope: scope,
  696 + $uibModal: uibModal,
  697 + $location: {},
  698 + $filter: {},
  699 + crearRemitoService: {
  700 + getBotonera: function() {},
  701 + getCotizacionByIdMoneda: function() {
  702 + return {
  703 + then: function() {}
  704 + };
  705 + },
  706 + getNumeroRemito: function() {
  707 + return {
  708 + then: function() {}
  709 + };
  710 + }
  711 + },
  712 + $timeout: timeout,
  713 + focaModalService: {},
  714 + remitoBusinessService: {
  715 + addArticulos: function() { }
  716 + },
  717 + $rootScope: {
  718 + $on: function() { }
  719 + },
  720 + focaBotoneraLateralService: {},
  721 + $localStorage: {}
  722 + });
  723 +
  724 + scope.remito = {
  725 + cotizacion: {
  726 + moneda: { },
  727 + },
  728 + };
  729 + scope.idLista = true;
  730 +
  731 + //act
  732 + spyOn(uibModal, 'open').and.returnValue({ result: { then: function() {} } });
  733 + scope.seleccionarProductos();
  734 +
  735 + //assert
  736 + expect(uibModal.open).toHaveBeenCalled();
  737 + });
  738 +
  739 + it('seleccionarProductos abre alerta si no se eligió lista', function() {
  740 +
  741 + //arrange
  742 + var scope = {
  743 + $broadcast: function() { },
  744 + $watch: function() { }
  745 + };
  746 + var focaModalService = {
  747 + alert: function() { }
  748 + };
  749 +
  750 + $controller('remitoController', {
  751 + $scope: scope,
  752 + $uibModal: {},
  753 + $location: {},
  754 + $filter: {},
  755 + crearRemitoService: {
  756 + getBotonera: function() {},
  757 + getCotizacionByIdMoneda: function() {
  758 + return {
  759 + then: function() {}
  760 + };
  761 + },
  762 + getNumeroRemito: function() {
  763 + return {
  764 + then: function() {}
  765 + };
  766 + }
  767 + },
  768 + $timeout: timeout,
  769 + focaModalService: focaModalService,
  770 + remitoBusinessService: {
  771 + addArticulos: function() { }
  772 + },
  773 + $rootScope: {
  774 + $on: function() { }
  775 + },
  776 + focaBotoneraLateralService: {},
  777 + $localStorage: {}
  778 + });
  779 +
  780 + //act
  781 + spyOn(focaModalService, 'alert');
  782 + scope.seleccionarProductos();
  783 +
  784 + //assert
  785 + expect(focaModalService.alert)
  786 + .toHaveBeenCalledWith('Primero seleccione una lista de precio y condicion');
  787 + });
  788 +
  789 + it('seleccionarPuntosDeDescarga abre modal', function() {
  790 +
  791 + //arrange
  792 + var scope = {
  793 + $broadcast: function() { },
  794 + $watch: function() { }
  795 + };
  796 + var uibModal = {
  797 + open: function() { }
  798 + };
  799 +
  800 + $controller('remitoController', {
  801 + $scope: scope,
  802 + $uibModal: uibModal,
  803 + $location: {},
  804 + $filter: {},
  805 + crearRemitoService: {
  806 + getBotonera: function() {},
  807 + getCotizacionByIdMoneda: function() {
  808 + return {
  809 + then: function() {}
  810 + };
  811 + },
  812 + getNumeroRemito: function() {
  813 + return {
  814 + then: function() {}
  815 + };
  816 + }
  817 + },
  818 + $timeout: timeout,
  819 + focaModalService: {},
  820 + remitoBusinessService: {
  821 + addArticulos: function() { }
  822 + },
  823 + $rootScope: {
  824 + $on: function() { }
  825 + },
  826 + focaBotoneraLateralService: {},
  827 + $localStorage: {}
  828 + });
  829 + scope.remito = {
  830 + cliente: { COD: true },
  831 + domicilio: { id: true }
  832 + };
  833 +
  834 + //act
  835 + spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } });
  836 + scope.seleccionarPuntosDeDescarga();
  837 +
  838 + //assert
  839 + expect(uibModal.open).toHaveBeenCalled();
  840 + });
  841 +
  842 + it('seleccionarVendedor abre modal', function() {
  843 +
  844 + //arrange
  845 + var scope = {
  846 + $broadcast: function() { },
  847 + $watch: function() { }
  848 + };
  849 + var focaModalService = {
  850 + modal: function() { }
  851 + };
  852 +
  853 + $controller('remitoController', {
  854 + $scope: scope,
  855 + $uibModal: {},
  856 + $location: {},
  857 + $filter: {},
  858 + crearRemitoService: {
  859 + getBotonera: function() {},
  860 + getCotizacionByIdMoneda: function() {
  861 + return {
  862 + then: function() {}
  863 + };
  864 + },
  865 + getNumeroRemito: function() {
  866 + return {
  867 + then: function() {}
  868 + };
  869 + }
  870 + },
  871 + $timeout: timeout,
  872 + focaModalService: focaModalService,
  873 + remitoBusinessService: {
  874 + addArticulos: function() { }
  875 + },
  876 + $rootScope: {
  877 + $on: function() { }
  878 + },
  879 + focaBotoneraLateralService: {},
  880 + $localStorage: {}
  881 + });
  882 +
  883 + //act
  884 + spyOn(focaModalService, 'modal').and.returnValue({ then: function() { } });
  885 + scope.seleccionarVendedor();
  886 +
  887 + //assert
  888 + expect(focaModalService.modal).toHaveBeenCalled();
  889 + });
  890 +
  891 + it('seleccionarCliente abre modal', function() {
  892 +
  893 + //arrange
  894 + var scope = {
  895 + $broadcast: function() { },
  896 + $watch: function() { }
  897 + };
  898 + var uibModal = {
  899 + open: function() { }
  900 + };
  901 +
  902 + $controller('remitoController', {
  903 + $scope: scope,
  904 + $uibModal: uibModal,
  905 + $location: {},
  906 + $filter: {},
  907 + crearRemitoService: {
  908 + getBotonera: function() {},
  909 + getCotizacionByIdMoneda: function() {
  910 + return {
  911 + then: function() {}
  912 + };
  913 + },
  914 + getNumeroRemito: function() {
  915 + return {
  916 + then: function() {}
  917 + };
  918 + }
  919 + },
  920 + $timeout: timeout,
  921 + focaModalService: {},
  922 + remitoBusinessService: {
  923 + addArticulos: function() { }
  924 + },
  925 + $rootScope: {
  926 + $on: function() { }
  927 + },
  928 + focaBotoneraLateralService: {},
  929 + $localStorage: {}
  930 + });
  931 +
  932 + //act
  933 + spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } });
  934 + scope.seleccionarCliente(true);
  935 +
  936 + //assert
  937 + expect(uibModal.open).toHaveBeenCalled();
  938 + });
  939 +
  940 + it('seleccionarCliente setea cliente y llama a abrirModalDomicilios', function(done) {
  941 +
  942 + //arrange
  943 + var scope = {
  944 + $broadcast: function() { },
  945 + $watch: function() { }
  946 + };
  947 + var uibModal = {
  948 + open: function() { }
  949 + };
  950 +
  951 + $controller('remitoController', {
  952 + $scope: scope,
  953 + $uibModal: uibModal,
  954 + $location: {},
  955 + $filter: {},
  956 + crearRemitoService: {
  957 + getBotonera: function() {},
  958 + getCotizacionByIdMoneda: function() {
  959 + return {
  960 + then: function() {}
  961 + };
  962 + },
  963 + getNumeroRemito: function() {
  964 + return {
  965 + then: function() {}
  966 + };
  967 + }
  968 + },
  969 + $timeout: timeout,
  970 + focaModalService: {},
  971 + remitoBusinessService: {
  972 + addArticulos: function() { }
  973 + },
  974 + $rootScope: {
  975 + $on: function() { }
  976 + },
  977 + focaBotoneraLateralService: {},
  978 + $localStorage: {}
  979 + });
  980 + var response = 'test';
  981 + var promesa = { result: Promise.resolve(response) };
  982 +
  983 + //act
  984 + spyOn(uibModal, 'open').and.returnValue(promesa);
  985 + spyOn(scope, 'abrirModalDomicilios');
  986 + scope.seleccionarCliente(true);
  987 +
  988 + //assert
  989 + promesa.result.then(function() {
  990 + expect(scope.abrirModalDomicilios).toHaveBeenCalledWith(response);
  991 + expect(scope.cliente).toEqual(response);
  992 + done();
  993 + });
  994 + });
  995 +
  996 + it('seleccionarProveedor abre modal', function() {
  997 +
  998 + //arrange
  999 + var scope = {
  1000 + $broadcast: function() { },
  1001 + $watch: function() { }
  1002 + };
  1003 + var focaModalService = {
  1004 + modal: function() { }
  1005 + };
  1006 +
  1007 + $controller('remitoController', {
  1008 + $scope: scope,
  1009 + $uibModal: {},
  1010 + $location: {},
  1011 + $filter: {},
  1012 + crearRemitoService: {
  1013 + getBotonera: function() {},
  1014 + getCotizacionByIdMoneda: function() {
  1015 + return {
  1016 + then: function() {}
  1017 + };
  1018 + },
  1019 + getNumeroRemito: function() {
  1020 + return {
  1021 + then: function() {}
  1022 + };
  1023 + }
  1024 + },
  1025 + $timeout: timeout,
  1026 + focaModalService: focaModalService,
  1027 + remitoBusinessService: {
  1028 + addArticulos: function() { }
  1029 + },
  1030 + $rootScope: {
  1031 + $on: function() { }
  1032 + },
  1033 + focaBotoneraLateralService: {},
  1034 + $localStorage: {}
  1035 + });
  1036 +
  1037 + //act
  1038 + spyOn(focaModalService, 'modal').and.returnValue({ then: function() { } });
  1039 + scope.seleccionarProveedor();
  1040 +
  1041 + //assert
  1042 + expect(focaModalService.modal).toHaveBeenCalled();
  1043 + });
  1044 +
  1045 + it('seleccionarProveedor setea provedor y llama a callback', function(done) {
  1046 +
  1047 + //arrange
  1048 + var scope = {
  1049 + $broadcast: function() { },
  1050 + $watch: function() { }
  1051 + };
  1052 + var focaModalService = {
  1053 + modal: function() { }
  1054 + };
  1055 +
  1056 + $controller('remitoController', {
  1057 + $scope: scope,
  1058 + $uibModal: {},
  1059 + $location: {},
  1060 + $filter: function() {
  1061 + return function() { };
  1062 + },
  1063 + crearRemitoService: {
  1064 + getBotonera: function() {},
  1065 + getCotizacionByIdMoneda: function() {
  1066 + return {
  1067 + then: function() {}
  1068 + };
  1069 + },
  1070 + getNumeroRemito: function() {
  1071 + return {
  1072 + then: function() {}
  1073 + };
  1074 + }
  1075 + },
  1076 + $timeout: timeout,
  1077 + focaModalService: focaModalService,
  1078 + remitoBusinessService: {
  1079 + addArticulos: function() { }
  1080 + },
  1081 + $rootScope: {
  1082 + $on: function() { }
  1083 + },
  1084 + focaBotoneraLateralService: {},
  1085 + $localStorage: {}
  1086 + });
  1087 + var response = { COD: 1 };
  1088 + var promesa = Promise.resolve(response);
  1089 + window.callback = function() { };
  1090 +
  1091 + //act
  1092 + spyOn(focaModalService, 'modal').and.returnValue(promesa);
  1093 + spyOn(window, 'callback');
  1094 + scope.seleccionarProveedor(window.callback);
  1095 +
  1096 + //assert
  1097 + promesa.then(function() {
  1098 + expect(window.callback).toHaveBeenCalled();
  1099 + expect(scope.remito.proveedor).toBe(response);
  1100 + expect(scope.remito.idProveedor).toBe(response.COD);
  1101 + done();
  1102 + });
  1103 + });
  1104 +
  1105 + it('abrirModalDomicilios abre modal', function() {
  1106 +
  1107 + //arrange
  1108 + var scope = {
  1109 + $broadcast: function() { },
  1110 + $watch: function() { }
  1111 + };
  1112 + var uibModal = {
  1113 + open: function() { }
  1114 + };
  1115 +
  1116 + $controller('remitoController', {
  1117 + $scope: scope,
  1118 + $uibModal: uibModal,
  1119 + $location: {},
  1120 + $filter: {},
  1121 + crearRemitoService: {
  1122 + getBotonera: function() {},
  1123 + getCotizacionByIdMoneda: function() {
  1124 + return {
  1125 + then: function() {}
  1126 + };
  1127 + },
  1128 + getNumeroRemito: function() {
  1129 + return {
  1130 + then: function() {}
  1131 + };
  1132 + }
  1133 + },
  1134 + $timeout: timeout,
  1135 + focaModalService: {},
  1136 + remitoBusinessService: {
  1137 + addArticulos: function() { }
  1138 + },
  1139 + $rootScope: {
  1140 + $on: function() { }
  1141 + },
  1142 + focaBotoneraLateralService: {},
  1143 + $localStorage: {}
  1144 + });
  1145 +
  1146 + //act
  1147 + spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } });
  1148 + scope.abrirModalDomicilios();
  1149 +
  1150 + //assert
  1151 + expect(uibModal.open).toHaveBeenCalled();
  1152 +
  1153 + });
  1154 +
  1155 + it('getTotal devuelve correctamente', function() {
  1156 +
  1157 + //arrange
  1158 + var scope = {
  1159 + $broadcast: function() { },
  1160 + $watch: function() { }
  1161 + };
  1162 +
  1163 + $controller('remitoController', {
  1164 + $scope: scope,
  1165 + $uibModal: {},
  1166 + $location: {},
  1167 + $filter: {},
  1168 + crearRemitoService: {
  1169 + getBotonera: function() {},
  1170 + getCotizacionByIdMoneda: function() {
  1171 + return {
  1172 + then: function() {}
  1173 + };
  1174 + },
  1175 + getNumeroRemito: function() {
  1176 + return {
  1177 + then: function() {}
  1178 + };
  1179 + }
  1180 + },
  1181 + $timeout: timeout,
  1182 + focaModalService: {},
  1183 + remitoBusinessService: {
  1184 + addArticulos: function() { }
  1185 + },
  1186 + $rootScope: {
  1187 + $on: function() { }
  1188 + },
  1189 + focaBotoneraLateralService: {},
  1190 + $localStorage: {}
  1191 + });
  1192 + scope.remito = {
  1193 + articulosRemito: [
  1194 + {
  1195 + precio: 100,
  1196 + cantidad: 3
  1197 + }
  1198 + ]
  1199 + };
  1200 +
  1201 + //act
  1202 + var result = scope.getTotal();
  1203 +
  1204 + //assert
  1205 + expect(result).toEqual(300);
  1206 +
  1207 + });
  1208 +
  1209 + it('getSubTotal devuelve correctamente', function() {
  1210 +
  1211 + //arrange
  1212 + var scope = {
  1213 + $broadcast: function() { },
  1214 + $watch: function() { }
  1215 + };
  1216 +
  1217 + $controller('remitoController', {
  1218 + $scope: scope,
  1219 + $uibModal: {},
  1220 + $location: {},
  1221 + $filter: {},
  1222 + crearRemitoService: {
  1223 + getBotonera: function() {},
  1224 + getCotizacionByIdMoneda: function() {
  1225 + return {
  1226 + then: function() {}
  1227 + };
  1228 + },
  1229 + getNumeroRemito: function() {
  1230 + return {
  1231 + then: function() {}
  1232 + };
  1233 + }
  1234 + },
  1235 + $timeout: timeout,
  1236 + focaModalService: {},
  1237 + remitoBusinessService: {
  1238 + addArticulos: function() { }
  1239 + },
  1240 + $rootScope: {
  1241 + $on: function() { }
  1242 + },
  1243 + focaBotoneraLateralService: {},
  1244 + $localStorage: {}
  1245 + });
  1246 + scope.articuloACargar = {
  1247 + precio: 200,
  1248 + cantidad: 4
  1249 + };
  1250 +
  1251 + //act
  1252 + var result = scope.getSubTotal();
  1253 +
  1254 + //assert
  1255 + expect(result).toEqual(800);
  1256 +
  1257 + });
  1258 +
  1259 + it('seleccionarPreciosYCondiciones muestra alerta sino se eligió cliente', function() {
  1260 +
  1261 + //arrange
  1262 + var scope = {
  1263 + $broadcast: function() { },
  1264 + $watch: function() { }
  1265 + };
  1266 + var focaModalService = {
  1267 + alert: function() {}
  1268 + };
  1269 +
  1270 + $controller('remitoController', {
  1271 + $scope: scope,
  1272 + $uibModal: {},
  1273 + $location: {},
  1274 + $filter: {},
  1275 + crearRemitoService: {
  1276 + getBotonera: function() {},
  1277 + getCotizacionByIdMoneda: function() {
  1278 + return {
  1279 + then: function() {}
  1280 + };
  1281 + },
  1282 + getNumeroRemito: function() {
  1283 + return {
  1284 + then: function() {}
  1285 + };
  1286 + }
  1287 + },
  1288 + $timeout: timeout,
  1289 + focaModalService: focaModalService,
  1290 + remitoBusinessService: {
  1291 + addArticulos: function() { }
  1292 + },
  1293 + $rootScope: {
  1294 + $on: function() { }
  1295 + },
  1296 + focaBotoneraLateralService: {},
  1297 + $localStorage: {}
  1298 + });
  1299 +
  1300 + //act
  1301 + spyOn(focaModalService, 'alert');
  1302 + scope.seleccionarPreciosYCondiciones();
  1303 +
  1304 + //assert
  1305 + expect(focaModalService.alert).toHaveBeenCalledWith('Primero seleccione un cliente');
  1306 +
  1307 + });
  1308 +
  1309 + it('seleccionarPreciosYCondiciones abre modal', function() {
  1310 +
  1311 + //arrange
  1312 + var scope = {
  1313 + $broadcast: function() { },
  1314 + $watch: function() { }
  1315 + };
  1316 + var uibModal = {
  1317 + open: function() {}
  1318 + };
  1319 +
  1320 + $controller('remitoController', {
  1321 + $scope: scope,
  1322 + $uibModal: uibModal,
  1323 + $location: {},
  1324 + $filter: {},
  1325 + crearRemitoService: {
  1326 + getBotonera: function() {},
  1327 + getCotizacionByIdMoneda: function() {
  1328 + return {
  1329 + then: function() {}
  1330 + };
  1331 + },
  1332 + getNumeroRemito: function() {
  1333 + return {
  1334 + then: function() {}
  1335 + };
  1336 + }
  1337 + },
  1338 + $timeout: timeout,
  1339 + focaModalService: {},
  1340 + remitoBusinessService: {
  1341 + addArticulos: function() { }
  1342 + },
  1343 + $rootScope: {
  1344 + $on: function() { }
  1345 + },
  1346 + focaBotoneraLateralService: {},
  1347 + $localStorage: {}
  1348 + });
  1349 + scope.remito = {
  1350 + cliente: { COD: true }
  1351 + };
  1352 +
  1353 + //act
  1354 + spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } });
  1355 + scope.seleccionarPreciosYCondiciones();
  1356 +
  1357 + //assert
  1358 + expect(uibModal.open).toHaveBeenCalled();
  1359 +
  1360 + });
  1361 +
  1362 + it('seleccionarMoneda abre modal y llama a cotizacion', function(done) {
  1363 +
  1364 + //arrange
  1365 + var scope = {
  1366 + $broadcast: function() { },
  1367 + $watch: function() { }
  1368 + };
  1369 + var focaModalService = {
  1370 + modal: function() {}
  1371 + };
  1372 + var uibModal = {
  1373 + open: function() {
  1374 + return {
  1375 + result: {
  1376 + then: function() {}
  1377 + }
  1378 + };
  1379 + }
  1380 + };
  1381 +
  1382 + $controller('remitoController', {
  1383 + $scope: scope,
  1384 + $uibModal: uibModal,
  1385 + $location: {},
  1386 + $filter: {},
  1387 + crearRemitoService: {
  1388 + getBotonera: function() {},
  1389 + getCotizacionByIdMoneda: function() {
  1390 + return {
  1391 + then: function() {}
  1392 + };
  1393 + },
  1394 + getNumeroRemito: function() {
  1395 + return {
  1396 + then: function() {}
  1397 + };
  1398 + }
  1399 + },
  1400 + $timeout: timeout,
  1401 + focaModalService: focaModalService,
  1402 + remitoBusinessService: {
  1403 + addArticulos: function() { }
  1404 + },
  1405 + $rootScope: {
  1406 + $on: function() { }
  1407 + },
  1408 + focaBotoneraLateralService: {},
  1409 + $localStorage: {}
  1410 + });
  1411 + var promesa = Promise.resolve('test');
  1412 +
  1413 + //act
  1414 + spyOn(focaModalService, 'modal').and.returnValue(promesa);
  1415 + scope.seleccionarMoneda();
  1416 +
  1417 + //assert
  1418 + promesa.then(function() {
  1419 + expect(focaModalService.modal).toHaveBeenCalled();
  1420 + done();
  1421 + });
  1422 + });
  1423 +
  1424 + it('seleccionarObservaciones levanta prompt', function() {
  1425 +
  1426 + //arrange
  1427 + var scope = {
  1428 + $broadcast: function() { },
  1429 + $watch: function() { }
  1430 + };
  1431 + var focaModalService = {
  1432 + prompt: function() {}
  1433 + };
  1434 +
  1435 + $controller('remitoController', {
  1436 + $scope: scope,
  1437 + $uibModal: {},
  1438 + $location: {},
  1439 + $filter: {},
  1440 + crearRemitoService: {
  1441 + getBotonera: function() {},
  1442 + getCotizacionByIdMoneda: function() {
  1443 + return {
  1444 + then: function() {}
  1445 + };
  1446 + },
  1447 + getNumeroRemito: function() {
  1448 + return {
  1449 + then: function() {}
  1450 + };
  1451 + }
  1452 + },
  1453 + $timeout: timeout,
  1454 + focaModalService: focaModalService,
  1455 + remitoBusinessService: {
  1456 + addArticulos: function() { }
  1457 + },
  1458 + $rootScope: {
  1459 + $on: function() { }
  1460 + },
  1461 + focaBotoneraLateralService: {},
  1462 + $localStorage: {}
  1463 + });
  1464 +
  1465 + //act
  1466 + spyOn(focaModalService, 'prompt').and.returnValue({ then: function() { } });
  1467 + scope.seleccionarObservaciones();
  1468 +
  1469 + //assert
  1470 + expect(focaModalService.prompt).toHaveBeenCalled();
  1471 + });
  1472 +
  1473 + it('abrirModalCotizacion abre modal', function() {
  1474 +
  1475 + //arrange
  1476 + var scope = {
  1477 + $broadcast: function() { },
  1478 + $watch: function() { }
  1479 + };
  1480 + var uibModal = {
  1481 + open: function() {}
  1482 + };
  1483 +
  1484 + $controller('remitoController', {
  1485 + $scope: scope,
  1486 + $uibModal: uibModal,
  1487 + $location: {},
  1488 + $filter: {},
  1489 + crearRemitoService: {
  1490 + getBotonera: function() {},
  1491 + getCotizacionByIdMoneda: function() {
  1492 + return {
  1493 + then: function() {}
  1494 + };
  1495 + },
  1496 + getNumeroRemito: function() {
  1497 + return {
  1498 + then: function() {}
  1499 + };
  1500 + }
  1501 + },
  1502 + $timeout: timeout,
  1503 + focaModalService: {},
  1504 + remitoBusinessService: {
  1505 + addArticulos: function() { }
  1506 + },
  1507 + $rootScope: {
  1508 + $on: function() { }
  1509 + },
  1510 + focaBotoneraLateralService: {},
  1511 + $localStorage: {}
  1512 + });
  1513 +
  1514 + //act
  1515 + spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } });
  1516 + scope.abrirModalCotizacion();
  1517 +
  1518 + //assert
  1519 + expect(uibModal.open).toHaveBeenCalled();
  1520 + });
  1521 + });
  1522 +});
... ... @@ -18,7 +18,7 @@ describe('Servicios modulo crear remito', function() {
18 18 servicio = _crearRemitoService_;
19 19 httpBackend = $httpBackend;
20 20 });
21   - })
  21 + });
22 22  
23 23 it('existe el servicio crearRemitoService', function() {
24 24  
... ... @@ -83,7 +83,6 @@ describe('Servicios modulo crear remito', function() {
83 83 it('función setRemito setea correctamente', function() {
84 84  
85 85 //arrange
86   - var result;
87 86 var fakeParam = 1;
88 87  
89 88 //act
src/js/businessService.js
... ... @@ -7,7 +7,8 @@ angular.module('focaCrearRemito')
7 7 for(var i = 0; i < articulosRemito.length; i++) {
8 8 delete articulosRemito[i].editCantidad;
9 9 delete articulosRemito[i].editPrecio;
10   - articulosRemito[i].idRemito = idRemito;
  10 + articulosRemito[i].idRemito = articulosRemito[i].idRemito !== -1 ?
  11 + idRemito : articulosRemito[i].idRemito;
11 12 articulosRemito[i].precio = articulosRemito[i].precio * cotizacion;
12 13 delete articulosRemito[i].idNotaPedido;
13 14 crearRemitoService.crearArticulosParaRemito(articulosRemito[i]);
src/js/controller.js
... ... @@ -33,6 +33,8 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
33 33 );
34 34 $scope.inicial.cotizacion = $scope.remito.cotizacion;
35 35 $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion);
  36 +
  37 + $timeout(function() { getLSRemito(); });
36 38 });
37 39  
38 40 //SETEO BOTONERA LATERAL
... ... @@ -44,7 +46,6 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
44 46 });
45 47  
46 48 init();
47   - $timeout(function() {getLSRemito();});
48 49 }
49 50  
50 51 function init() {
... ... @@ -159,13 +160,6 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
159 160 }
160 161 ];
161 162  
162   - if (notaPedido.observaciones) {
163   - cabeceras.push({
164   - label: 'Observaciones:',
165   - valor: notaPedido.observaciones
166   - });
167   - }
168   -
169 163 function valorPrecioCondicion() {
170 164 if (notaPedido.idPrecioCondicion > 0) {
171 165 return notaPedido.precioCondicion.nombre;
... ... @@ -196,15 +190,14 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
196 190  
197 191 for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) {
198 192 notaPedido.articulosNotaPedido[i].id = 0;
  193 + notaPedido.articulosNotaPedido[i].idRemito = 0;
199 194 }
200 195  
201 196 $scope.remito.articulosRemito = notaPedido.articulosNotaPedido;
202   - remitoBusinessService.calcularArticulos($scope.remito.articulosRemito,
203   - notaPedido.cotizacion.VENDEDOR);
204 197  
205 198 if (notaPedido.idPrecioCondicion > 0) {
206 199 $scope.idLista = notaPedido.precioCondicion.idListaPrecio;
207   - }else {
  200 + } else {
208 201 $scope.idLista = -1;
209 202 }
210 203  
... ... @@ -247,19 +240,16 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
247 240 focaModalService.alert('Ingrese Proveedor');
248 241 return;
249 242 } else if (!$scope.remito.cotizacion.moneda.id &&
250   - !$scope.remito.cotizacion.moneda.ID)
251   - {
  243 + !$scope.remito.cotizacion.moneda.ID){
252 244 focaModalService.alert('Ingrese Moneda');
253 245 return;
254 246 } else if (!$scope.remito.cotizacion.ID) {
255 247 focaModalService.alert('Ingrese Cotización');
256 248 return;
257   - } else if (
258   - $scope.remito.flete === undefined || $scope.remito.flete === null)
259   - {
  249 + } else if ($scope.remito.flete === undefined || $scope.remito.flete === null){
260 250 focaModalService.alert('Ingrese Flete');
261 251 return;
262   - } else if ($scope.remito.articulosRemito.length === 0) {
  252 + } else if ($scope.articulosFiltro().length === 0) {
263 253 focaModalService.alert('Debe cargar al menos un articulo');
264 254 return;
265 255 }
... ... @@ -307,20 +297,32 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
307 297 domicilioStamp: $scope.remito.domicilioStamp,
308 298 estado: 0,//TODO
309 299 destinoVenta: 0,//TODO
310   - operacionTipo: 0//TODO
  300 + operacionTipo: 0, //TODO
  301 + observaciones: $scope.remito.observaciones,
  302 + numeroRemito: parseInt($scope.comprobante),
  303 + sucursal: parseInt($scope.puntoVenta)
311 304 },
312 305 notaPedido: $scope.notaPedido
313 306 };
314 307  
315 308 crearRemitoService.crearRemito(save).then(
316 309 function(data) {
317   - remitoBusinessService.addArticulos($scope.remito.articulosRemito,
318   - data.data.id, $scope.remito.cotizacion.COTIZACION);
319 310  
320 311 focaBotoneraLateralService.endGuardar(true);
321 312 $scope.saveLoading = false;
322 313  
323   - //TODO: updatear plazos
  314 + $scope.remito.id = data.data.id;
  315 + $scope.remito.numeroRemito = data.data.numero;
  316 +
  317 + remitoBusinessService.addArticulos($scope.remito.articulosRemito,
  318 + $scope.remito.id, $scope.remito.cotizacion.VENDEDOR);
  319 +
  320 + if(data.status === 500) {
  321 + focaModalService.alert(data.data);
  322 + return;
  323 + }
  324 +
  325 + // TODO: updatear plazos
324 326 if ($scope.remito.id === 0) {
325 327 var plazos = $scope.remito.remitoPlazo;
326 328  
... ... @@ -332,15 +334,19 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
332 334 crearRemitoService.crearPlazosParaRemito(json);
333 335 }
334 336 }
335   - abrirModalMail(data.data.id, $scope.remito.cliente, $filter('comprobante')([
336   - data.data.sucursal,
337   - data.data.numero
338   - ]));
  337 +
  338 + abrirModalMail($scope.remito.id,
  339 + $scope.remito.cliente,
  340 + $filter('comprobante')([
  341 + $scope.puntoVenta,
  342 + $scope.remito.numeroRemito
  343 + ])
  344 + );
339 345  
340 346 init();
341 347  
342 348 }, function(error) {
343   - focaModalService.alert('Hubo un error al crear el remito');
  349 + focaModalService.alert(error.data || 'Hubo un error al crear el remito');
344 350 focaBotoneraLateralService.endGuardar();
345 351 $scope.saveLoading = false;
346 352 console.info(error);
... ... @@ -362,8 +368,8 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
362 368 resolve: {
363 369 parametroProducto: {
364 370 idLista: $scope.idLista,
365   - cotizacion: $scope.remito.cotizacion.COTIZACION,
366   - simbolo: $scope.remito.cotizacion.moneda.simbolo
  371 + cotizacion: $scope.remito.cotizacion.VENDEDOR,
  372 + simbolo: $scope.remito.cotizacion.moneda.SIMBOLO
367 373 }
368 374 },
369 375 size: 'lg'
... ... @@ -374,6 +380,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
374 380 var newArt =
375 381 {
376 382 id: 0,
  383 + idRemito: 0,
377 384 codigo: producto.codigo,
378 385 sector: producto.sector,
379 386 sectorCodigo: producto.sector + '-' + producto.codigo,
... ... @@ -406,7 +413,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
406 413 if (!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) {
407 414 focaModalService.alert('Primero seleccione un cliente y un domicilio');
408 415 return;
409   - }else {
  416 + } else {
410 417 var modalInstance = $uibModal.open(
411 418 {
412 419 ariaLabelledBy: 'Búsqueda de Puntos de descarga',
... ... @@ -418,7 +425,8 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
418 425 idDomicilio: $scope.remito.domicilio.id,
419 426 idCliente: $scope.remito.cliente.COD,
420 427 articulos: $scope.remito.articulosRemito,
421   - puntosDescarga: $scope.remito.domicilio.puntosDescarga
  428 + puntosDescarga: $scope.remito.domicilio.puntosDescarga,
  429 + domicilio: $scope.remito.domicilio
422 430 }
423 431 }
424 432 }
... ... @@ -517,7 +525,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
517 525 }, ocultarVendedor);
518 526 };
519 527  
520   - $scope.seleccionarProveedor = function(callback) {
  528 + $scope.seleccionarProveedor = function() {
521 529 if (varlidarRemitoFacturado()) {
522 530 var parametrosModal = {
523 531 titulo: 'Búsqueda de Proveedor',
... ... @@ -545,15 +553,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
545 553 };
546 554 focaModalService.modal(parametrosModal).then(
547 555 function(proveedor) {
548   - $scope.remito.proveedor = proveedor;
549   - $scope.remito.idProveedor = proveedor.COD;
550   -
551   - $scope.$broadcast('addCabecera',{
552   - label: 'Proveedor:',
553   - valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' +
554   - proveedor.NOM
555   - });
556   - callback();
  556 + $scope.seleccionarFlete(proveedor);
557 557 }, function() { }
558 558 );
559 559 }
... ... @@ -583,12 +583,10 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
583 583 MOD: cliente.mod
584 584 };
585 585  
586   -
587 586 var domicilioStamp =
588 587 domicilio.Calle + ' ' + domicilio.Numero + ', ' +
589 588 domicilio.Localidad + ', ' + domicilio.Provincia;
590 589 $scope.remito.domicilioStamp = domicilioStamp;
591   -
592 590 $scope.$broadcast('addCabecera',{
593 591 label: 'Cliente:',
594 592 valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom
... ... @@ -601,7 +599,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
601 599 if (domicilio.verPuntos) {
602 600 delete $scope.remito.domicilio.verPuntos;
603 601 $scope.seleccionarPuntosDeDescarga();
604   - }else {
  602 + } else {
605 603 crearRemitoService
606 604 .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
607 605 .then(function(res) {
... ... @@ -615,20 +613,9 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
615 613 );
616 614 };
617 615  
618   - $scope.mostrarFichaCliente = function() {
619   - $uibModal.open(
620   - {
621   - ariaLabelledBy: 'Datos del Cliente',
622   - templateUrl: 'foca-crear-remito-ficha-cliente.html',
623   - controller: 'focaCrearRemitoFichaClienteController',
624   - size: 'lg'
625   - }
626   - );
627   - };
628   -
629 616 $scope.getTotal = function() {
630 617 var total = 0;
631   - var arrayTempArticulos = $scope.remito.articulosRemito;
  618 + var arrayTempArticulos = $scope.articulosFiltro();
632 619 for(var i = 0; i < arrayTempArticulos.length; i++) {
633 620 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
634 621 }
... ... @@ -673,10 +660,10 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
673 660 }
674 661 cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) +
675 662 ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim();
676   - }else { //Cuando se ingresan los plazos manualmente
  663 + } else { //Cuando se ingresan los plazos manualmente
677 664 $scope.remito.idPrecioCondicion = 0;
678 665 //-1, el modal productos busca todos los productos
679   - $scope.idLista = -1;
  666 + $scope.idLista = -1;
680 667 $scope.remito.remitoPlazo = precioCondicion;
681 668 for(var j = 0; j < precioCondicion.length; j++) {
682 669 plazosConcat += precioCondicion[j].dias + ' ';
... ... @@ -688,7 +675,6 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
688 675 label: 'Precios y condiciones:',
689 676 valor: cabecera
690 677 });
691   -
692 678 $scope.remito.precioCondicion = precioCondicion;
693 679 }, function() {
694 680  
... ... @@ -697,65 +683,71 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
697 683 }
698 684 };
699 685  
700   - $scope.seleccionarTransportista = function() {
701   - $scope.seleccionarProveedor(function() {
702   - if (varlidarRemitoFacturado()) {
703   - var modalInstance = $uibModal.open(
704   - {
705   - ariaLabelledBy: 'Busqueda de Flete',
706   - templateUrl: 'modal-flete.html',
707   - controller: 'focaModalFleteController',
708   - size: 'lg',
709   - resolve: {
710   - parametrosFlete:
711   - function() {
712   - return {
713   - flete: $scope.remito.flete ? '1' :
714   - ($scope.remito.fob ? 'FOB' :
715   - ($scope.remito.flete === undefined ?
716   - null : '0')),
717   - bomba: $scope.remito.bomba ? '1' :
718   - ($scope.remito.bomba === undefined ?
719   - null : '0'),
720   - kilometros: $scope.remito.kilometros
721   - };
722   - }
723   - }
  686 + $scope.seleccionarFlete = function(proveedor) {
  687 + if (varlidarRemitoFacturado()) {
  688 + var modalInstance = $uibModal.open(
  689 + {
  690 + ariaLabelledBy: 'Busqueda de Flete',
  691 + templateUrl: 'modal-flete.html',
  692 + controller: 'focaModalFleteController',
  693 + size: 'lg',
  694 + resolve: {
  695 + parametrosFlete:
  696 + function() {
  697 + return {
  698 + flete: $scope.remito.flete ? '1' :
  699 + ($scope.remito.fob ? 'FOB' :
  700 + ($scope.remito.flete === undefined ?
  701 + null : '0')),
  702 + bomba: $scope.remito.bomba ? '1' :
  703 + ($scope.remito.bomba === undefined ?
  704 + null : '0'),
  705 + kilometros: $scope.remito.kilometros
  706 + };
  707 + }
724 708 }
725   - );
726   - modalInstance.result.then(
727   - function(datos) {
728   - $scope.remito.flete = datos.flete;
729   - $scope.remito.fob = datos.FOB;
730   - $scope.remito.bomba = datos.bomba;
731   - $scope.remito.kilometros = datos.kilometros;
732   -
  709 + }
  710 + );
  711 + modalInstance.result.then(
  712 + function(datos) {
  713 +
  714 + $scope.remito.proveedor = proveedor;
  715 + $scope.remito.idProveedor = proveedor.COD;
  716 + $scope.$broadcast('addCabecera',{
  717 + label: 'Proveedor:',
  718 + valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' +
  719 + proveedor.NOM
  720 + });
  721 +
  722 + $scope.remito.flete = datos.flete;
  723 + $scope.remito.fob = datos.FOB;
  724 + $scope.remito.bomba = datos.bomba;
  725 + $scope.remito.kilometros = datos.kilometros;
  726 +
  727 + $scope.$broadcast('addCabecera',{
  728 + label: 'Flete:',
  729 + valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No')
  730 + });
  731 + if (datos.flete) {
733 732 $scope.$broadcast('addCabecera',{
734   - label: 'Flete:',
735   - valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No')
  733 + label: 'Bomba:',
  734 + valor: datos.bomba ? 'Si' : 'No'
736 735 });
737   - if (datos.flete) {
738   - $scope.$broadcast('addCabecera',{
739   - label: 'Bomba:',
740   - valor: datos.bomba ? 'Si' : 'No'
741   - });
742   - $scope.$broadcast('addCabecera',{
743   - label: 'Kilometros:',
744   - valor: datos.kilometros
745   - });
746   - } else {
747   - $scope.$broadcast('removeCabecera', 'Bomba:');
748   - $scope.$broadcast('removeCabecera', 'Kilometros:');
749   - $scope.remito.fob = false;
750   - $scope.remito.bomba = false;
751   - $scope.remito.kilometros = null;
752   - }
753   - }, function() {
754   - $scope.seleccionarTransportista();
  736 + $scope.$broadcast('addCabecera',{
  737 + label: 'Kilometros:',
  738 + valor: datos.kilometros
  739 + });
  740 + } else {
  741 + $scope.$broadcast('removeCabecera', 'Bomba:');
  742 + $scope.$broadcast('removeCabecera', 'Kilometros:');
  743 + $scope.remito.bomba = false;
  744 + $scope.remito.kilometros = null;
755 745 }
756   - );
757   - }
758   - });
  746 + }, function() {
  747 + $scope.seleccionarTransportista();
  748 + }
  749 + );
  750 + }
759 751 };
760 752  
761 753 $scope.seleccionarMoneda = function() {
... ... @@ -813,18 +805,18 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
813 805 var articulosTablaTemp = $scope.remito.articulosRemito;
814 806 for(var i = 0; i < articulosTablaTemp.length; i++) {
815 807 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
816   - $scope.remito.cotizacion.COTIZACION;
  808 + $scope.remito.cotizacion.VENDEDOR;
817 809 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
818   - cotizacion.COTIZACION;
  810 + cotizacion.VENDEDOR;
819 811 }
820 812 $scope.remito.articulosRemito = articulosTablaTemp;
821   - $scope.remito.cotizacion.moneda = moneda;
822 813 $scope.remito.cotizacion = cotizacion;
  814 + $scope.remito.cotizacion.moneda = moneda;
823 815 if (moneda.DETALLE === 'PESOS ARGENTINOS') {
824 816 $scope.$broadcast('removeCabecera', 'Moneda:');
825 817 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
826 818 $scope.$broadcast('removeCabecera', 'Cotizacion:');
827   - }else {
  819 + } else {
828 820 $scope.$broadcast('addCabecera',{
829 821 label: 'Moneda:',
830 822 valor: moneda.DETALLE
... ... @@ -835,7 +827,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
835 827 });
836 828 $scope.$broadcast('addCabecera',{
837 829 label: 'Cotizacion:',
838   - valor: $filter('number')(cotizacion.COTIZACION, '2')
  830 + valor: $filter('number')(cotizacion.VENDEDOR, '2')
839 831 });
840 832 }
841 833 }, function() {
... ... @@ -858,8 +850,16 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
858 850 }
859 851 };
860 852  
861   - $scope.quitarArticulo = function(key) {
862   - $scope.remito.articulosRemito.splice(key, 1);
  853 + $scope.quitarArticulo = function(articulo) {
  854 + articulo.idRemito = -1;
  855 + };
  856 +
  857 + $scope.articulosFiltro = function() {
  858 +
  859 + var result = $scope.remito.articulosRemito.filter(function(articulo) {
  860 + return articulo.idRemito >= 0;
  861 + });
  862 + return result;
863 863 };
864 864  
865 865 $scope.editarArticulo = function(key, articulo) {
... ... @@ -883,28 +883,6 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
883 883 }
884 884 };
885 885  
886   - $scope.limpiarFlete = function() {
887   - $scope.remito.fleteNombre = '';
888   - $scope.remito.chofer = '';
889   - $scope.remito.vehiculo = '';
890   - $scope.remito.kilometros = '';
891   - $scope.remito.costoUnitarioKmFlete = '';
892   - $scope.choferes = '';
893   - $scope.vehiculos = '';
894   - };
895   -
896   - $scope.limpiarPantalla = function() {
897   - $scope.limpiarFlete();
898   - $scope.remito.flete = '0';
899   - $scope.remito.bomba = '0';
900   - $scope.remito.precioCondicion = '';
901   - $scope.remito.articulosRemito = [];
902   - $scope.remito.vendedor.nombre = '';
903   - $scope.remito.cliente = {nombre: ''};
904   - $scope.remito.domicilio = {dom: ''};
905   - $scope.domiciliosCliente = [];
906   - };
907   -
908 886 $scope.resetFilter = function() {
909 887 $scope.articuloACargar = {};
910 888 $scope.cargando = true;
... ... @@ -940,7 +918,6 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
940 918 while (relleno.length < longitud) {
941 919 relleno = '0' + relleno;
942 920 }
943   -
944 921 return relleno;
945 922 }
946 923  
... ... @@ -977,7 +954,6 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
977 954 var boton = $scope.botonera.filter(function(botonObs) {
978 955 return botonObs.label === 'Observaciones';
979 956 });
980   -
981 957 boton[0].disable = !val;
982 958 }
983 959  
... ... @@ -989,7 +965,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
989 965  
990 966 var cabeceras = [];
991 967  
992   - if (remito.cotizacion.ID) {
  968 + if (remito.cotizacion.moneda.CODIGO_AFIP !== 'PES') {
993 969 cabeceras.push({
994 970 label: 'Moneda:',
995 971 valor: remito.cotizacion.moneda.DETALLE
... ... @@ -1030,11 +1006,11 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
1030 1006 ' - ' + remito.proveedor.NOM
1031 1007 });
1032 1008 }
1033   - if (remito.flete !== undefined) {
  1009 + if (remito.flete !== undefined && remito.fob !== undefined) {
1034 1010 cabeceras.push({
1035 1011 label: 'Flete:',
1036   - valor: remito.fob === 1 ? 'FOB' : (
1037   - remito.flete === 1 ? 'Si' : 'No')
  1012 + valor: remito.fob ? 'FOB' : (
  1013 + remito.flete ? 'Si' : 'No')
1038 1014 });
1039 1015 }
1040 1016 if (remito.remitoPlazo) {
... ... @@ -1044,7 +1020,6 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
1044 1020 remitoBusinessService.plazoToString(remito.remitoPlazo)
1045 1021 });
1046 1022 }
1047   -
1048 1023 function valorPrecioCondicion() {
1049 1024 if (remito.idPrecioCondicion > 0) {
1050 1025 return remito.precioCondicion.nombre;
... ... @@ -1052,7 +1027,6 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
1052 1027 return 'Ingreso Manual';
1053 1028 }
1054 1029 }
1055   -
1056 1030 if (remito.flete === 1) {
1057 1031 var cabeceraBomba = {
1058 1032 label: 'Bomba',
... ... @@ -1067,9 +1041,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
1067 1041 }
1068 1042 cabeceras.push(cabeceraBomba);
1069 1043 }
1070   - $scope.remito.articulosRemito = remito.articulosRemito;
1071   - remitoBusinessService.calcularArticulos($scope.remito.articulosRemito,
1072   - remito.cotizacion.VENDEDOR);
  1044 +
1073 1045 if (remito.idPrecioCondicion > 0) {
1074 1046 $scope.idLista = remito.precioCondicion.idListaPrecio;
1075 1047 } else {
... ... @@ -1119,7 +1091,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
1119 1091 .then(function(res) {
1120 1092 if (res === false) {
1121 1093 abrirModalMail(id);
1122   - focaModalService.alert('Descarga o envíe su remito ' +
  1094 + focaModalService.alert('Descarga o envíe su remito ' +
1123 1095 'antes de cerrar esta ventana');
1124 1096 }
1125 1097 });
... ... @@ -83,7 +83,7 @@ angular.module(&#39;focaCrearRemito&#39;)
83 83 image: 'cliente.png'
84 84 },
85 85 {
86   - label: 'Transportista',
  86 + label: 'Proveedor',
87 87 image: 'proveedor.png'
88 88 },
89 89 {
src/views/remito.html
... ... @@ -6,6 +6,12 @@
6 6 class="mb-0 col-lg-12"
7 7 busqueda="seleccionarRemito"
8 8 ></foca-cabecera-facturador>
  9 + <marquee
  10 + bgcolor="#FF9900"
  11 + behavior="scroll"
  12 + direction="left"
  13 + ng-bind="remito.observaciones"
  14 + ></marquee>
9 15 <div class="col-lg-12">
10 16 <div class="row mt-4">
11 17 <div class="col-12 col-md-10 col-lg-10 border border-light rounded">
... ... @@ -47,8 +53,8 @@
47 53 </thead>
48 54 <tbody class="tabla-articulo-body">
49 55 <tr
50   - ng-repeat="(key, articulo) in remito.articulosRemito"
51   - ng-show="show || key == (remito.articulosRemito.length - 1)"
  56 + ng-repeat="(key, articulo) in articulosFiltro()"
  57 + ng-show="show || key == (articulosFiltro().length - 1)"
52 58 class="d-flex"
53 59 >
54 60 <td ng-bind="key + 1"></td>
... ... @@ -106,7 +112,7 @@
106 112 <td class="text-center">
107 113 <button
108 114 class="btn btn-outline-light"
109   - ng-click="quitarArticulo(key)"
  115 + ng-click="quitarArticulo(articulo)"
110 116 >
111 117 <i class="fa fa-trash"></i>
112 118 </button>
... ... @@ -124,7 +130,7 @@
124 130 <tr ng-show="!cargando" class="d-flex">
125 131 <td
126 132 class="align-middle"
127   - ng-bind="remito.articulosRemito.length + 1"
  133 + ng-bind="articulosFiltro().length + 1"
128 134 ></td>
129 135 <td class="col">
130 136 <input
... ... @@ -189,13 +195,13 @@
189 195 <tr class="d-flex">
190 196 <td colspan="4" class="no-border-top">
191 197 <strong>Items:</strong>
192   - <a ng-bind="remito.articulosRemito.length"></a>
  198 + <a ng-bind="articulosFiltro().length"></a>
193 199 </td>
194 200 <td class="text-right ml-auto table-celda-total no-border-top">
195 201 <h3>Total:</h3>
196 202 </td>
197 203 <td class="table-celda-total text-right no-border-top" colspan="1">
198   - <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3>
  204 + <h3>{{getTotal() | currency: remito.cotizacion.moneda.SIMBOLO}}</h3>
199 205 </td>
200 206 <td class="text-right no-border-top">
201 207 <button
... ... @@ -209,183 +215,6 @@
209 215 </tfoot>
210 216 </table>
211 217 </div>
212   -
213   - <!-- MOBILE -->
214   - <div class="row d-sm-none">
215   - <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile">
216   - <thead>
217   - <tr class="d-flex">
218   - <th class="">#</th>
219   - <th class="col px-0">
220   - <div class="d-flex">
221   - <div class="col-4 px-1">Código</div>
222   - <div class="col-8 px-1">Descripción</div>
223   - </div>
224   - <div class="d-flex">
225   - <div class="col-3 px-1">Cantidad</div>
226   - <div class="col px-1 text-right">P. Uni.</div>
227   - <div class="col px-1 text-right">Subtotal</div>
228   - </div>
229   - </th>
230   - <th class="text-center tamaño-boton">
231   - &nbsp;
232   - </th>
233   - </tr>
234   - </thead>
235   - <tbody>
236   - <tr
237   - ng-repeat="(key, articulo) in remito.articulosRemito"
238   - ng-show="show || key == remito.articulosRemito.length - 1"
239   - >
240   - <td class="w-100 align-middle d-flex p-0">
241   - <div class="align-middle p-1">
242   - <span ng-bind="key+1" class="align-middle"></span>
243   - </div>
244   - <div class="col px-0">
245   - <div class="d-flex">
246   - <div class="col-4 px-1">
247   - <span
248   - ng-bind="articulo.sector + '-' + articulo.codigo"
249   - ></span>
250   - </div>
251   - <div class="col-8 px-1">
252   - <span
253   - ng-bind="'x' + articulo.cantidad"
254   - ng-hide="articulo.editCantidad"
255   - ></span>
256   - <i
257   - class="fa fa-pencil text-white-50"
258   - aria-hidden="true"
259   - ng-hide="articulo.editCantidad"
260   - ng-click="articulo.editCantidad = true"
261   - ></i>
262   - <input
263   - ng-show="articulo.editCantidad"
264   - ng-model="articulo.cantidad"
265   - class="form-control"
266   - foca-tipo-input
267   - min="1"
268   - step="0.001"
269   - foca-focus="articulo.editCantidad"
270   - ng-keypress="editarArticulo($event.keyCode, articulo)"
271   - ng-focus="selectFocus($event)"
272   - >
273   - </div>
274   - </div>
275   - <div class="d-flex">
276   - <div class="col-3 px-1">
277   - <span ng-bind="'x' + articulo.cantidad"></span>
278   - </div>
279   - <div class="col px-1 text-right">
280   - <span ng-bind="articulo.precio | currency: remito.moneda.SIMBOLO : 4"></span>
281   - </div>
282   - <div class="col px-1 text-right">
283   - <span
284   - ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.SIMBOLO"
285   - >
286   - </span>
287   - </div>
288   - </div>
289   - </div>
290   - <div class="align-middle p-1">
291   - <button
292   - class="btn btn-outline-light"
293   - ng-click="quitarArticulo(key)"
294   - >
295   - <i class="fa fa-trash"></i>
296   - </button>
297   - </div>
298   - </td>
299   - </tr>
300   - </tbody>
301   - <tfoot>
302   - <!-- CARGANDO ITEM -->
303   - <tr ng-show="!cargando" class="d-flex">
304   - <td
305   - class="align-middle p-1"
306   - ng-bind="remito.articulosRemito.length + 1"
307   - ></td>
308   - <td class="col p-0">
309   - <div class="d-flex">
310   - <div class="col-4 px-1">
311   - <span
312   - ng-bind="articuloACargar.sectorCodigo"
313   - ></span>
314   - </div>
315   - <div class="col-8 px-1">
316   - <span ng-bind="articuloACargar.descripcion"></span>
317   - </div>
318   - </div>
319   - <div class="d-flex">
320   - <div class="col-3 px-1 m-1">
321   - <input
322   - class="form-control p-1"
323   - foca-tipo-input
324   - min="1"
325   - ng-model="articuloACargar.cantidad"
326   - foca-focus="!cargando"
327   - ng-keypress="agregarATabla($event.keyCode)"
328   - style="height: auto; line-height: 1.1em"
329   - >
330   - </div>
331   - <div class="col px-1 text-right">
332   - <span ng-bind="articuloACargar.precio | currency: remito.moneda.SIMBOLO : 4"></span>
333   - </div>
334   - <div class="col px-1 text-right">
335   - <span
336   - ng-bind="getSubTotal() | currency: remito.moneda.SIMBOLO"
337   - >
338   - </span>
339   - </div>
340   - </div>
341   - </td>
342   - <td class="text-center align-middle">
343   - <button
344   - class="btn btn-outline-light"
345   - ng-click="agregarATabla(13)"
346   - >
347   - <i class="fa fa-save"></i>
348   - </button>
349   - </td>
350   - </tr>
351   - <!-- TOOGLE EXPANDIR -->
352   - <tr>
353   - <td class="col">
354   - <button
355   - class="btn btn-outline-light selectable w-100"
356   - ng-click="show = !show; masMenos()"
357   - ng-show="remito.articulosRemito.length > 0"
358   - >
359   - <i
360   - class="fa fa-chevron-down"
361   - ng-hide="show"
362   - aria-hidden="true"
363   - >
364   - </i>
365   - <i
366   - class="fa fa-chevron-up"
367   - ng-show="show"
368   - aria-hidden="true">
369   - </i>
370   - </button>
371   - </td>
372   - </tr>
373   - <!-- FOOTER -->
374   - <tr class="d-flex">
375   - <td class="align-middle no-border-top" colspan="2">
376   - <strong>Cantidad Items:</strong>
377   - <a ng-bind="remito.articulosRemito.length"></a>
378   - </td>
379   - <td class="text-right ml-auto table-celda-total no-border-top">
380   - <h3>Total:</h3>
381   - </td>
382   - <td class="table-celda-total text-right no-border-top">
383   - <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3>
384   - </td>
385   - </tr>
386   - </tfoot>
387   - </table>
388   - </div>
389 218 </div>
390 219 </div>
391 220 </div>