diff --git a/index.html b/index.html index fd948f1..6121328 100644 --- a/index.html +++ b/index.html @@ -20,6 +20,7 @@ + diff --git a/package.json b/package.json index 3873197..979f503 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "compile": "gulp uglify", "gulp-pre-commit": "gulp pre-commit", "postinstall": "npm run compile && gulp clean-post-install", - "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git git+https://debo.suite.repo/modulos-npm/foca-modal-flete git+https://debo.suite.repo/modulos-npm/foca-modal.git git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git" + "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+http://git.focasoftware.com/npm/foca-directivas.git git+http://git.focasoftware.com/npm/foca-modal-vendedores.git git+http://git.focasoftware.com/npm/foca-modal-proveedor.git git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git git+http://git.focasoftware.com/npm/foca-modal-flete.git git+http://git.focasoftware.com/npm/foca-modal.git git+http://git.focasoftware.com/npm/foca-modal-domicilio.git git+http://git.focasoftware.com/npm/foca-seguimiento.git git+http://git.focasoftware.com/npm/foca-modal-moneda.git git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git" }, "pre-commit": [ "gulp-pre-commit" @@ -20,36 +20,37 @@ "author": "Foca Software", "license": "ISC", "peerDependencies": { - "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.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", - "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", - "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", - "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", - "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", - "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", - "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", - "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", - "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" + "foca-botonera-facturador": "git+http://git.focasoftware.com/npm/foca-botonera-facturador.git", + "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git", + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", + "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", + "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git", + "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git", + "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git", + "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git", + "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git", + "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git", + "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git", + "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git", + "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git" }, "devDependencies": { "angular": "^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-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", - "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", - "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", - "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", - "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", - "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", - "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", - "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", - "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", + "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git", + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", + "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", + "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git", + "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git", + "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git", + "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git", + "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git", + "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git", + "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git", + "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git", + "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git", "font-awesome": "^4.7.0", "gulp": "^3.9.1", "gulp-angular-templatecache": "^2.2.5", diff --git a/src/js/controller.js b/src/js/controller.js index a941d0d..6e0d974 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -6,29 +6,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, notaPedidoBusinessService, $rootScope, focaSeguimientoService) { - $scope.botonera = [ - {texto: 'Vendedor', imagen: '../img/abmPrecios.png', accion: function() { - validarNotaRemitada($scope.seleccionarVendedor);}}, - {texto: 'Cliente', imagen: '../img/abmPrecios.png', accion: function() { - validarNotaRemitada($scope.seleccionarCliente);}}, - {texto: 'Proveedor', imagen: '../img/abmPrecios.png', accion: function() { - validarNotaRemitada($scope.seleccionarProveedor);}}, - {texto: 'Moneda', imagen: '../img/abmPrecios.png', accion: function() { - validarNotaRemitada($scope.abrirModalMoneda);}}, - {texto: 'Precios y condiciones', imagen: '../img/abmPrecios.png', - accion: function() { - validarNotaRemitada($scope.abrirModalListaPrecio);}}, - {texto: 'Flete', imagen: '../img/abmPrecios.png', accion: function() { - validarNotaRemitada($scope.abrirModalFlete);}}, - {texto: 'Productos', imagen: '../img/abmPrecios.png', accion: function() { - $scope.seleccionarArticulo(); - }}, - {texto: '', accion: function() {}}, - {texto: '', accion: function() {}}, - {texto: '', accion: function() {}}, - {texto: '', accion: function() {}}, - {texto: '', accion: function() {}} - ]; + + $scope.botonera = crearNotaPedidoService.getBotonera(); $scope.isNumber = angular.isNumber; $scope.datepickerAbierto = false; @@ -304,7 +283,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', ); }; - $scope.seleccionarArticulo = function() { + $scope.seleccionarProductos = function() { if ($scope.idLista === undefined) { focaModalService.alert( 'Primero seleccione una lista de precio y condicion'); @@ -359,65 +338,70 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', }; $scope.seleccionarVendedor = function() { - var modalInstance = $uibModal.open( - { - ariaLabelledBy: 'Busqueda de Vendedores', - templateUrl: 'modal-vendedores.html', - controller: 'modalVendedoresCtrl', - size: 'lg' - } - ); - modalInstance.result.then( - function(vendedor) { - addCabecera('Vendedor:', vendedor.NomVen); - $scope.notaPedido.vendedor = vendedor; - }, function() { - - } - ); + if(validarNotaRemitada()) { + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Vendedores', + templateUrl: 'modal-vendedores.html', + controller: 'modalVendedoresCtrl', + size: 'lg' + } + ); + modalInstance.result.then( + function(vendedor) { + addCabecera('Vendedor:', vendedor.NomVen); + $scope.notaPedido.vendedor = vendedor; + }, function() { + + } + ); + } }; $scope.seleccionarProveedor = function() { - var modalInstance = $uibModal.open( - { - ariaLabelledBy: 'Busqueda de Proveedor', - templateUrl: 'modal-proveedor.html', - controller: 'focaModalProveedorCtrl', - size: 'lg', - resolve: { - transportista: function() { - return false; + if(validarNotaRemitada()) { + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Proveedor', + templateUrl: 'modal-proveedor.html', + controller: 'focaModalProveedorCtrl', + size: 'lg', + resolve: { + transportista: function() { + return false; + } } } - } - ); - modalInstance.result.then( - function(proveedor) { - $scope.notaPedido.proveedor = proveedor; - addCabecera('Proveedor:', proveedor.NOM); - }, function() { - - } - ); + ); + modalInstance.result.then( + function(proveedor) { + $scope.notaPedido.proveedor = proveedor; + addCabecera('Proveedor:', proveedor.NOM); + }, function() { + + } + ); + } }; $scope.seleccionarCliente = function() { - - var modalInstance = $uibModal.open( - { - ariaLabelledBy: 'Busqueda de Cliente', - templateUrl: 'foca-busqueda-cliente-modal.html', - controller: 'focaBusquedaClienteModalController', - size: 'lg' - } - ); - modalInstance.result.then( - function(cliente) { - $scope.abrirModalDomicilios(cliente); - }, function() { - - } - ); + if(validarNotaRemitada()) { + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Cliente', + templateUrl: 'foca-busqueda-cliente-modal.html', + controller: 'focaBusquedaClienteModalController', + size: 'lg' + } + ); + modalInstance.result.then( + function(cliente) { + $scope.abrirModalDomicilios(cliente); + }, function() { + + } + ); + } }; $scope.abrirModalDomicilios = function(cliente) { @@ -466,104 +450,110 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', } }; - $scope.abrirModalListaPrecio = function() { - var modalInstance = $uibModal.open( - { - ariaLabelledBy: 'Busqueda de Precio Condición', - templateUrl: 'modal-precio-condicion.html', - controller: 'focaModalPrecioCondicionController', - size: 'lg' - } - ); - modalInstance.result.then( - function(precioCondicion) { - var cabecera = ''; - var plazosConcat = ''; - if(!Array.isArray(precioCondicion)) { - $scope.notaPedido.idPrecioCondicion = precioCondicion.id; - $scope.plazosPagos = precioCondicion.plazoPago; - $scope.idLista = precioCondicion.idListaPrecio; - for(var i = 0; i < precioCondicion.plazoPago.length; i++) { - plazosConcat += precioCondicion.plazoPago[i].dias + ' '; - } - cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); - } else { //Cuando se ingresan los plazos manualmente - $scope.notaPedido.idPrecioCondicion = 0; - $scope.idLista = -1; //-1, el modal productos busca todos los productos - $scope.plazosPagos = precioCondicion; - for(var j = 0; j < precioCondicion.length; j++) { - plazosConcat += precioCondicion[j].dias + ' '; + $scope.seleccionarPreciosYCondiciones = function() { + if(validarNotaRemitada()) { + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Precio Condición', + templateUrl: 'modal-precio-condicion.html', + controller: 'focaModalPrecioCondicionController', + size: 'lg' + } + ); + modalInstance.result.then( + function(precioCondicion) { + var cabecera = ''; + var plazosConcat = ''; + if(!Array.isArray(precioCondicion)) { + $scope.notaPedido.idPrecioCondicion = precioCondicion.id; + $scope.plazosPagos = precioCondicion.plazoPago; + $scope.idLista = precioCondicion.idListaPrecio; + for(var i = 0; i < precioCondicion.plazoPago.length; i++) { + plazosConcat += precioCondicion.plazoPago[i].dias + ' '; + } + cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); + } else { //Cuando se ingresan los plazos manualmente + $scope.notaPedido.idPrecioCondicion = 0; + $scope.idLista = -1; //-1, el modal productos busca todos los productos + $scope.plazosPagos = precioCondicion; + for(var j = 0; j < precioCondicion.length; j++) { + plazosConcat += precioCondicion[j].dias + ' '; + } + cabecera = 'Ingreso manual ' + plazosConcat.trim(); } - cabecera = 'Ingreso manual ' + plazosConcat.trim(); + $scope.articulosTabla = []; + addCabecera('Precios y condiciones:', cabecera); + }, function() { + } - $scope.articulosTabla = []; - addCabecera('Precios y condiciones:', cabecera); - }, function() { - - } - ); + ); + } }; - $scope.abrirModalFlete = function() { - var modalInstance = $uibModal.open( - { - ariaLabelledBy: 'Busqueda de Flete', - templateUrl: 'modal-flete.html', - controller: 'focaModalFleteController', - size: 'lg', - resolve: { - parametrosFlete: - function() { - return { - flete: $scope.notaPedido.fob ? 'FOB' : - ( $scope.notaPedido.flete ? '1' : - ($scope.notaPedido.flete === undefined ? null : '0')), - bomba: $scope.notaPedido.bomba ? '1' : - ($scope.notaPedido.bomba === undefined ? null : '0'), - kilometros: $scope.notaPedido.kilometros - }; - } + $scope.seleccionarFlete = function() { + if(validarNotaRemitada()) { + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Flete', + templateUrl: 'modal-flete.html', + controller: 'focaModalFleteController', + size: 'lg', + resolve: { + parametrosFlete: + function() { + return { + flete: $scope.notaPedido.fob ? 'FOB' : + ( $scope.notaPedido.flete ? '1' : + ($scope.notaPedido.flete === undefined ? null : '0')), + bomba: $scope.notaPedido.bomba ? '1' : + ($scope.notaPedido.bomba === undefined ? null : '0'), + kilometros: $scope.notaPedido.kilometros + }; + } + } } - } - ); - modalInstance.result.then( - function(datos) { - $scope.notaPedido.flete = datos.flete; - $scope.notaPedido.fob = datos.FOB; - $scope.notaPedido.bomba = datos.bomba; - $scope.notaPedido.kilometros = datos.kilometros; - addCabecera('Flete:', datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No')); - if(datos.flete) { - addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); - addCabecera('Kilometros:', datos.kilometros); - } else { - removeCabecera('Bomba:'); - removeCabecera('Kilometros:'); - $scope.notaPedido.bomba = false; - $scope.notaPedido.kilometros = null; + ); + modalInstance.result.then( + function(datos) { + $scope.notaPedido.flete = datos.flete; + $scope.notaPedido.fob = datos.FOB; + $scope.notaPedido.bomba = datos.bomba; + $scope.notaPedido.kilometros = datos.kilometros; + addCabecera('Flete:', datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No')); + if(datos.flete) { + addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); + addCabecera('Kilometros:', datos.kilometros); + } else { + removeCabecera('Bomba:'); + removeCabecera('Kilometros:'); + $scope.notaPedido.bomba = false; + $scope.notaPedido.kilometros = null; + } + }, function() { + } - }, function() { - - } - ); + ); + } }; - $scope.abrirModalMoneda = function() { - var modalInstance = $uibModal.open( - { - ariaLabelledBy: 'Busqueda de Moneda', - templateUrl: 'modal-moneda.html', - controller: 'focaModalMonedaController', - size: 'lg' - } - ); - modalInstance.result.then( - function(moneda) { - $scope.abrirModalCotizacion(moneda); - }, function() { - - } - ); + $scope.seleccionarMoneda = function() { + if(validarNotaRemitada()) { + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Moneda', + templateUrl: 'modal-moneda.html', + controller: 'focaModalMonedaController', + size: 'lg' + } + ); + modalInstance.result.then( + function(moneda) { + $scope.abrirModalCotizacion(moneda); + }, function() { + + } + ); + } }; $scope.abrirModalCotizacion = function(moneda) { @@ -705,12 +695,12 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', return relleno; } - function validarNotaRemitada(funcion) { - if($scope.notaPedido.idRemito) { + function validarNotaRemitada() { + if(!$scope.notaPedido.idRemito) { + return true; + }else{ focaModalService.alert('No se puede editar una nota de pedido remitada'); - } - else { - funcion(); + return false; } } } diff --git a/src/js/service.js b/src/js/service.js index df3020d..74b47af 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -54,6 +54,10 @@ angular.module('focaCrearNotaPedido') }, getNumeroNotaPedido: function() { return $http.get(route + '/nota-pedido/numero-siguiente'); + }, + getBotonera: function() { + return ['Vendedor', 'Cliente', 'Proveedor', 'Moneda', + 'Precios y condiciones', 'Flete', 'Productos']; } }; }]); diff --git a/src/views/nota-pedido.html b/src/views/nota-pedido.html index 6f5a357..4c8a79c 100644 --- a/src/views/nota-pedido.html +++ b/src/views/nota-pedido.html @@ -82,22 +82,7 @@