Commit 51c4901ee0ddbec1fc52e37c895edf5e098d6027

Authored by Pablo Marco del Pont
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request modulos-npm/foca-crear-nota-pedido!35
... ... @@ -36,12 +36,12 @@
36 36 "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos",
37 37 "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git",
38 38 "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete",
39   - "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git",
40 39 "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git",
  40 + "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git",
41 41 "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git",
42 42 "font-awesome": "^4.7.0",
43 43 "gulp": "^3.9.1",
44   - "gulp-angular-templatecache": "2.2.2",
  44 + "gulp-angular-templatecache": "^2.2.2",
45 45 "gulp-clean": "^0.4.0",
46 46 "gulp-concat": "^2.6.1",
47 47 "gulp-connect": "^5.6.1",
... ... @@ -52,7 +52,7 @@
52 52 "gulp-sequence": "^1.0.0",
53 53 "gulp-uglify": "^3.0.1",
54 54 "gulp-uglify-es": "^1.0.4",
55   - "jasmine-core": "^3.2.1",
  55 + "jasmine-core": "^3.3.0",
56 56 "jquery": "^3.3.1",
57 57 "jshint": "^2.9.6",
58 58 "pre-commit": "^1.2.2",
src/js/controller.js
... ... @@ -101,7 +101,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
101 101 vendedor: $scope.notaPedido.vendedor.nombre,
102 102 idCliente: $scope.notaPedido.cliente.id,
103 103 domicilio: $scope.notaPedido.domicilio,
104   - precioCondicion: $scope.notaPedido.precioCondicion,
105 104 bomba: $scope.notaPedido.bomba,
106 105 flete: $scope.notaPedido.flete,
107 106 total: $scope.getTotal()
... ... @@ -301,11 +300,25 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
301 300 );
302 301 modalInstance.result.then(
303 302 function(precioCondicion) {
304   - $scope.notaPedido.precioCondicion = precioCondicion.nombre;
305   - idLista = precioCondicion.idListaPrecio;
  303 + var cabecera = '';
  304 + var plazosConcat = '';
  305 + if(!Array.isArray(precioCondicion)) {
  306 + $scope.plazosPagos = precioCondicion.plazoPago;
  307 + idLista = precioCondicion.idListaPrecio;
  308 + for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
  309 + plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
  310 + }
  311 + cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
  312 + } else { //Cuando se ingresan los plazos manualmente
  313 + idLista = -1; //-1, el modal productos busca todos los productos
  314 + $scope.notaPedido.plazoPago = precioCondicion;
  315 + for(var j = 0; j < precioCondicion.length; j++) {
  316 + plazosConcat += precioCondicion[j].dias + ' ';
  317 + }
  318 + cabecera = 'Ingreso manual ' + plazosConcat.trim();
  319 + }
306 320 $scope.articulosTabla = [];
307   -
308   - addCabecera('Precios y condiciones:', precioCondicion.nombre);
  321 + addCabecera('Precios y condiciones:', cabecera);
309 322 }, function() {
310 323  
311 324 }