diff --git a/gulpfile.js b/gulpfile.js index 43da736..eccaee4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -86,10 +86,14 @@ gulp.task('clean-post-install', function() { gulp.task('default', ['webserver']); gulp.task('watch', function() { - gulp.watch([paths.srcJS, paths.srcViews], ['copy']); + gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); }); -gulp.task('copy', ['uglify'], function(){ +gulp.task('copy', ['uglify'], function() { return gulp.src('dist/*.js') - .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist')); + .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist/')); +}); + +gulp.task('watchAndCopy', function() { + return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); }); diff --git a/src/js/controller.js b/src/js/controller.js index 96368e2..f1fda1e 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -7,6 +7,7 @@ angular.module('focaCrearRemito') .controller('remitoController', focaSeguimientoService, remitoBusinessService ) { $scope.botonera = [ + {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, @@ -15,7 +16,6 @@ angular.module('focaCrearRemito') .controller('remitoController', texto: 'Precios y condiciones', accion: function() {$scope.abrirModalListaPrecio();}}, {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, - {texto: '', accion: function() {}}, {texto: '', accion: function() {}} ]; $scope.datepickerAbierto = false; @@ -69,6 +69,84 @@ angular.module('focaCrearRemito') .controller('remitoController', $scope.precioCondiciones = res.data; } ); + $scope.seleccionarNotaPedido = function() { + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Nota de Pedido', + templateUrl: 'foca-modal-nota-pedido.html', + controller: 'focaModalNotaPedidoController', + resolve: { + parametroNotaPedido: { + idLista: $scope.idLista, + cotizacion: $scope.remito.cotizacion.COTIZACION, + simbolo: $scope.remito.moneda.simbolo + } + }, + size: 'lg' + } + ); + 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() { + // funcion ejecutada cuando se cancela el modal + } + ); + } + $scope.seleccionarRemito = function() { + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Remito', + templateUrl: 'foca-modal-remito.html', + controller: 'focaModalRemitoController', + resolve: { + parametroRemito: { + idLista: $scope.idLista, + cotizacion: $scope.remito.cotizacion.COTIZACION, + simbolo: $scope.remito.moneda.simbolo + } + }, + size: 'lg' + } + ); + 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() { + // funcion ejecutada cuando se cancela el modal + } + ); + } //La pantalla solo se usa para cargar remitos // if (remitoTemp !== undefined) { // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); diff --git a/src/views/remito.html b/src/views/remito.html index 700b9b5..0e321e4 100644 --- a/src/views/remito.html +++ b/src/views/remito.html @@ -14,7 +14,7 @@