diff --git a/index.html b/index.html index 6c50334..f492709 100644 --- a/index.html +++ b/index.html @@ -33,6 +33,7 @@ + diff --git a/package.json b/package.json index 29c0c57..731e116 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,12 @@ }, "devDependencies": { "angular": "^1.7.5", + "angular-cookies": "^1.7.5", "angular-ladda": "^0.4.3", "angular-route": "^1.7.5", "bootstrap": "^4.1.3", "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", + "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git", "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", @@ -46,7 +48,7 @@ "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", "font-awesome": "^4.7.0", "gulp": "^3.9.1", - "gulp-angular-templatecache": "^2.2.2", + "gulp-angular-templatecache": "^2.2.5", "gulp-clean": "^0.4.0", "gulp-concat": "^2.6.1", "gulp-connect": "^5.6.1", @@ -63,8 +65,6 @@ "ladda": "1.0.6", "pre-commit": "^1.2.2", "pump": "^3.0.0", - "ui-bootstrap4": "^3.0.5", - "angular-cookies": "^1.7.5", - "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git" + "ui-bootstrap4": "^3.0.5" } } diff --git a/src/js/app.js b/src/js/app.js index 43a8019..575a4e8 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -14,5 +14,6 @@ angular.module('focaCrearRemito', [ 'focaModalMoneda', 'focaModalCotizacion', 'focaConfiguracion', - 'angular-ladda' + 'angular-ladda', + 'focaModalNotaPedido' ]); diff --git a/src/js/controller.js b/src/js/controller.js index a3675de..17d9fcd 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -98,23 +98,78 @@ angular.module('focaCrearRemito') .controller('remitoController', } ); modalInstance.result.then( - function(producto) { - var newArt = - { - id: 0, - codigo: producto.codigo, - sector: producto.sector, - sectorCodigo: producto.sector + '-' + producto.codigo, - descripcion: producto.descripcion, - item: $scope.articulosTabla.length + 1, - nombre: producto.descripcion, - precio: parseFloat(producto.precio.toFixed(4)), - costoUnitario: producto.costo, - editCantidad: false, - editPrecio: false - }; - $scope.articuloACargar = newArt; - $scope.cargando = false; + function(notaPedido) { + //aƱado cabeceras + removeCabecera('Moneda:'); + removeCabecera('Fecha cotizacion:'); + removeCabecera('Cotizacion:'); + var cabeceras = [ + { + label: 'Moneda', + valor: notaPedido.cotizacion[0].moneda[0].DETALLE + }, + { + label: 'Fecha cotizacion', + valor: $filter('date')(notaPedido.cotizacion[0].FECHA, + 'dd/MM/yyyy') + }, + { + label: 'Cotizacion', + valor: notaPedido.cotizacion[0].VENDEDOR + }, + { + label: 'Cliente:', + valor: notaPedido.cliente[0].NOM + }, + { + label: 'Vendedor:', + valor: notaPedido.vendedor[0].NomVen + }, + { + label: 'Proveedor:', + valor: notaPedido.proveedor[0].NOM + }, + { + label: 'Flete:', + valor: notaPedido.flete === 1 ? 'Si' : 'No' + }, + { + label: 'FOB:', + valor: notaPedido.fob === 1 ? 'Si' : 'No' + }, + { + label: 'Precio condicion:', + valor: valorPrecioCondicion() + } + ]; + //TO DO CUANDO MOSTRAR PLAZOS + function valorPrecioCondicion() { + if(notaPedido.idPrecioCondicion > 0) { + return notaPedido.precioCondicion[0].nombre; + } else { + return 'Ingreso Manual'; + } + + } + + if(notaPedido.flete === 1) { + var cabeceraBomba = { + label: 'Bomba', + valor: notaPedido.bomba === 1 ? 'Si' : 'No' + }; + if(notaPedido.kilometros){ + var cabeceraKilometros = { + label: 'Kilometros', + valor: notaPedido.kilometros + }; + cabeceras.push(cabeceraKilometros); + } + cabeceras.push(cabeceraBomba); + } + $scope.articulosTabla = notaPedido.articulosNotaPedido; + $scope.remito = notaPedido; + addArrayCabecera(cabeceras); + }, function() { // funcion ejecutada cuando se cancela el modal } @@ -655,6 +710,11 @@ angular.module('focaCrearRemito') .controller('remitoController', $scope.salir = function() { $location.path('/'); }; + function addArrayCabecera(array) { + for(var i = 0; i < array.length; i++) { + addCabecera(array[i].label, array[i].valor); + } + } function addCabecera(label, valor) { var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);