Commit 3c53f4cc0e3c039238a812f3720e71ccff4c1e6e
1 parent
81e4b37a46
Exists in
master
agrego foca-botonera-facturador
Showing
5 changed files
with
192 additions
and
211 deletions
Show diff stats
index.html
| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | <script src="vendor/cordovaGeolocationModule.min.js"></script> |
| 21 | 21 | |
| 22 | 22 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> |
| 23 | + <script src="node_modules/foca-botonera-facturador/dist/foca-botonera-facturador.min.js"></script> | |
| 23 | 24 | <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script> |
| 24 | 25 | <script src="node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script> |
| 25 | 26 | <script src="node_modules/foca-modal-proveedor/dist/foca-modal-proveedor.min.js"></script> |
package.json
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | "compile": "gulp uglify", |
| 9 | 9 | "gulp-pre-commit": "gulp pre-commit", |
| 10 | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
| 11 | - "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" | |
| 11 | + "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" | |
| 12 | 12 | }, |
| 13 | 13 | "pre-commit": [ |
| 14 | 14 | "gulp-pre-commit" |
| ... | ... | @@ -20,36 +20,37 @@ |
| 20 | 20 | "author": "Foca Software", |
| 21 | 21 | "license": "ISC", |
| 22 | 22 | "peerDependencies": { |
| 23 | - "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | |
| 24 | - "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | |
| 25 | - "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", | |
| 26 | - "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | |
| 27 | - "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", | |
| 28 | - "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", | |
| 29 | - "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", | |
| 30 | - "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", | |
| 31 | - "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | |
| 32 | - "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | |
| 33 | - "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | |
| 34 | - "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" | |
| 23 | + "foca-botonera-facturador": "git+http://git.focasoftware.com/npm/foca-botonera-facturador.git", | |
| 24 | + "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git", | |
| 25 | + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | |
| 26 | + "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", | |
| 27 | + "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git", | |
| 28 | + "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git", | |
| 29 | + "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git", | |
| 30 | + "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git", | |
| 31 | + "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git", | |
| 32 | + "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git", | |
| 33 | + "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git", | |
| 34 | + "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git", | |
| 35 | + "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git" | |
| 35 | 36 | }, |
| 36 | 37 | "devDependencies": { |
| 37 | 38 | "angular": "^1.7.5", |
| 38 | 39 | "angular-ladda": "^0.4.3", |
| 39 | 40 | "angular-route": "^1.7.5", |
| 40 | 41 | "bootstrap": "^4.1.3", |
| 41 | - "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | |
| 42 | - "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | |
| 43 | - "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", | |
| 44 | - "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | |
| 45 | - "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", | |
| 46 | - "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", | |
| 47 | - "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", | |
| 48 | - "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", | |
| 49 | - "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | |
| 50 | - "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | |
| 51 | - "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | |
| 52 | - "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", | |
| 42 | + "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git", | |
| 43 | + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | |
| 44 | + "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", | |
| 45 | + "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git", | |
| 46 | + "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git", | |
| 47 | + "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git", | |
| 48 | + "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git", | |
| 49 | + "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git", | |
| 50 | + "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git", | |
| 51 | + "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git", | |
| 52 | + "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git", | |
| 53 | + "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git", | |
| 53 | 54 | "font-awesome": "^4.7.0", |
| 54 | 55 | "gulp": "^3.9.1", |
| 55 | 56 | "gulp-angular-templatecache": "^2.2.5", |
src/js/controller.js
| ... | ... | @@ -6,29 +6,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 6 | 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, |
| 7 | 7 | notaPedidoBusinessService, $rootScope, focaSeguimientoService) |
| 8 | 8 | { |
| 9 | - $scope.botonera = [ | |
| 10 | - {texto: 'Vendedor', imagen: '../img/abmPrecios.png', accion: function() { | |
| 11 | - validarNotaRemitada($scope.seleccionarVendedor);}}, | |
| 12 | - {texto: 'Cliente', imagen: '../img/abmPrecios.png', accion: function() { | |
| 13 | - validarNotaRemitada($scope.seleccionarCliente);}}, | |
| 14 | - {texto: 'Proveedor', imagen: '../img/abmPrecios.png', accion: function() { | |
| 15 | - validarNotaRemitada($scope.seleccionarProveedor);}}, | |
| 16 | - {texto: 'Moneda', imagen: '../img/abmPrecios.png', accion: function() { | |
| 17 | - validarNotaRemitada($scope.abrirModalMoneda);}}, | |
| 18 | - {texto: 'Precios y condiciones', imagen: '../img/abmPrecios.png', | |
| 19 | - accion: function() { | |
| 20 | - validarNotaRemitada($scope.abrirModalListaPrecio);}}, | |
| 21 | - {texto: 'Flete', imagen: '../img/abmPrecios.png', accion: function() { | |
| 22 | - validarNotaRemitada($scope.abrirModalFlete);}}, | |
| 23 | - {texto: 'Productos', imagen: '../img/abmPrecios.png', accion: function() { | |
| 24 | - $scope.seleccionarArticulo(); | |
| 25 | - }}, | |
| 26 | - {texto: '', accion: function() {}}, | |
| 27 | - {texto: '', accion: function() {}}, | |
| 28 | - {texto: '', accion: function() {}}, | |
| 29 | - {texto: '', accion: function() {}}, | |
| 30 | - {texto: '', accion: function() {}} | |
| 31 | - ]; | |
| 9 | + | |
| 10 | + $scope.botonera = crearNotaPedidoService.getBotonera(); | |
| 32 | 11 | |
| 33 | 12 | $scope.isNumber = angular.isNumber; |
| 34 | 13 | $scope.datepickerAbierto = false; |
| ... | ... | @@ -304,7 +283,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 304 | 283 | ); |
| 305 | 284 | }; |
| 306 | 285 | |
| 307 | - $scope.seleccionarArticulo = function() { | |
| 286 | + $scope.seleccionarProductos = function() { | |
| 308 | 287 | if ($scope.idLista === undefined) { |
| 309 | 288 | focaModalService.alert( |
| 310 | 289 | 'Primero seleccione una lista de precio y condicion'); |
| ... | ... | @@ -359,65 +338,70 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 359 | 338 | }; |
| 360 | 339 | |
| 361 | 340 | $scope.seleccionarVendedor = function() { |
| 362 | - var modalInstance = $uibModal.open( | |
| 363 | - { | |
| 364 | - ariaLabelledBy: 'Busqueda de Vendedores', | |
| 365 | - templateUrl: 'modal-vendedores.html', | |
| 366 | - controller: 'modalVendedoresCtrl', | |
| 367 | - size: 'lg' | |
| 368 | - } | |
| 369 | - ); | |
| 370 | - modalInstance.result.then( | |
| 371 | - function(vendedor) { | |
| 372 | - addCabecera('Vendedor:', vendedor.NomVen); | |
| 373 | - $scope.notaPedido.vendedor = vendedor; | |
| 374 | - }, function() { | |
| 375 | - | |
| 376 | - } | |
| 377 | - ); | |
| 341 | + if(validarNotaRemitada()) { | |
| 342 | + var modalInstance = $uibModal.open( | |
| 343 | + { | |
| 344 | + ariaLabelledBy: 'Busqueda de Vendedores', | |
| 345 | + templateUrl: 'modal-vendedores.html', | |
| 346 | + controller: 'modalVendedoresCtrl', | |
| 347 | + size: 'lg' | |
| 348 | + } | |
| 349 | + ); | |
| 350 | + modalInstance.result.then( | |
| 351 | + function(vendedor) { | |
| 352 | + addCabecera('Vendedor:', vendedor.NomVen); | |
| 353 | + $scope.notaPedido.vendedor = vendedor; | |
| 354 | + }, function() { | |
| 355 | + | |
| 356 | + } | |
| 357 | + ); | |
| 358 | + } | |
| 378 | 359 | }; |
| 379 | 360 | |
| 380 | 361 | $scope.seleccionarProveedor = function() { |
| 381 | - var modalInstance = $uibModal.open( | |
| 382 | - { | |
| 383 | - ariaLabelledBy: 'Busqueda de Proveedor', | |
| 384 | - templateUrl: 'modal-proveedor.html', | |
| 385 | - controller: 'focaModalProveedorCtrl', | |
| 386 | - size: 'lg', | |
| 387 | - resolve: { | |
| 388 | - transportista: function() { | |
| 389 | - return false; | |
| 362 | + if(validarNotaRemitada()) { | |
| 363 | + var modalInstance = $uibModal.open( | |
| 364 | + { | |
| 365 | + ariaLabelledBy: 'Busqueda de Proveedor', | |
| 366 | + templateUrl: 'modal-proveedor.html', | |
| 367 | + controller: 'focaModalProveedorCtrl', | |
| 368 | + size: 'lg', | |
| 369 | + resolve: { | |
| 370 | + transportista: function() { | |
| 371 | + return false; | |
| 372 | + } | |
| 390 | 373 | } |
| 391 | 374 | } |
| 392 | - } | |
| 393 | - ); | |
| 394 | - modalInstance.result.then( | |
| 395 | - function(proveedor) { | |
| 396 | - $scope.notaPedido.proveedor = proveedor; | |
| 397 | - addCabecera('Proveedor:', proveedor.NOM); | |
| 398 | - }, function() { | |
| 399 | - | |
| 400 | - } | |
| 401 | - ); | |
| 375 | + ); | |
| 376 | + modalInstance.result.then( | |
| 377 | + function(proveedor) { | |
| 378 | + $scope.notaPedido.proveedor = proveedor; | |
| 379 | + addCabecera('Proveedor:', proveedor.NOM); | |
| 380 | + }, function() { | |
| 381 | + | |
| 382 | + } | |
| 383 | + ); | |
| 384 | + } | |
| 402 | 385 | }; |
| 403 | 386 | |
| 404 | 387 | $scope.seleccionarCliente = function() { |
| 405 | - | |
| 406 | - var modalInstance = $uibModal.open( | |
| 407 | - { | |
| 408 | - ariaLabelledBy: 'Busqueda de Cliente', | |
| 409 | - templateUrl: 'foca-busqueda-cliente-modal.html', | |
| 410 | - controller: 'focaBusquedaClienteModalController', | |
| 411 | - size: 'lg' | |
| 412 | - } | |
| 413 | - ); | |
| 414 | - modalInstance.result.then( | |
| 415 | - function(cliente) { | |
| 416 | - $scope.abrirModalDomicilios(cliente); | |
| 417 | - }, function() { | |
| 418 | - | |
| 419 | - } | |
| 420 | - ); | |
| 388 | + if(validarNotaRemitada()) { | |
| 389 | + var modalInstance = $uibModal.open( | |
| 390 | + { | |
| 391 | + ariaLabelledBy: 'Busqueda de Cliente', | |
| 392 | + templateUrl: 'foca-busqueda-cliente-modal.html', | |
| 393 | + controller: 'focaBusquedaClienteModalController', | |
| 394 | + size: 'lg' | |
| 395 | + } | |
| 396 | + ); | |
| 397 | + modalInstance.result.then( | |
| 398 | + function(cliente) { | |
| 399 | + $scope.abrirModalDomicilios(cliente); | |
| 400 | + }, function() { | |
| 401 | + | |
| 402 | + } | |
| 403 | + ); | |
| 404 | + } | |
| 421 | 405 | }; |
| 422 | 406 | |
| 423 | 407 | $scope.abrirModalDomicilios = function(cliente) { |
| ... | ... | @@ -466,104 +450,110 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 466 | 450 | } |
| 467 | 451 | }; |
| 468 | 452 | |
| 469 | - $scope.abrirModalListaPrecio = function() { | |
| 470 | - var modalInstance = $uibModal.open( | |
| 471 | - { | |
| 472 | - ariaLabelledBy: 'Busqueda de Precio Condiciรณn', | |
| 473 | - templateUrl: 'modal-precio-condicion.html', | |
| 474 | - controller: 'focaModalPrecioCondicionController', | |
| 475 | - size: 'lg' | |
| 476 | - } | |
| 477 | - ); | |
| 478 | - modalInstance.result.then( | |
| 479 | - function(precioCondicion) { | |
| 480 | - var cabecera = ''; | |
| 481 | - var plazosConcat = ''; | |
| 482 | - if(!Array.isArray(precioCondicion)) { | |
| 483 | - $scope.notaPedido.idPrecioCondicion = precioCondicion.id; | |
| 484 | - $scope.plazosPagos = precioCondicion.plazoPago; | |
| 485 | - $scope.idLista = precioCondicion.idListaPrecio; | |
| 486 | - for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | |
| 487 | - plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | |
| 488 | - } | |
| 489 | - cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | |
| 490 | - } else { //Cuando se ingresan los plazos manualmente | |
| 491 | - $scope.notaPedido.idPrecioCondicion = 0; | |
| 492 | - $scope.idLista = -1; //-1, el modal productos busca todos los productos | |
| 493 | - $scope.plazosPagos = precioCondicion; | |
| 494 | - for(var j = 0; j < precioCondicion.length; j++) { | |
| 495 | - plazosConcat += precioCondicion[j].dias + ' '; | |
| 453 | + $scope.seleccionarPreciosYCondiciones = function() { | |
| 454 | + if(validarNotaRemitada()) { | |
| 455 | + var modalInstance = $uibModal.open( | |
| 456 | + { | |
| 457 | + ariaLabelledBy: 'Busqueda de Precio Condiciรณn', | |
| 458 | + templateUrl: 'modal-precio-condicion.html', | |
| 459 | + controller: 'focaModalPrecioCondicionController', | |
| 460 | + size: 'lg' | |
| 461 | + } | |
| 462 | + ); | |
| 463 | + modalInstance.result.then( | |
| 464 | + function(precioCondicion) { | |
| 465 | + var cabecera = ''; | |
| 466 | + var plazosConcat = ''; | |
| 467 | + if(!Array.isArray(precioCondicion)) { | |
| 468 | + $scope.notaPedido.idPrecioCondicion = precioCondicion.id; | |
| 469 | + $scope.plazosPagos = precioCondicion.plazoPago; | |
| 470 | + $scope.idLista = precioCondicion.idListaPrecio; | |
| 471 | + for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | |
| 472 | + plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | |
| 473 | + } | |
| 474 | + cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | |
| 475 | + } else { //Cuando se ingresan los plazos manualmente | |
| 476 | + $scope.notaPedido.idPrecioCondicion = 0; | |
| 477 | + $scope.idLista = -1; //-1, el modal productos busca todos los productos | |
| 478 | + $scope.plazosPagos = precioCondicion; | |
| 479 | + for(var j = 0; j < precioCondicion.length; j++) { | |
| 480 | + plazosConcat += precioCondicion[j].dias + ' '; | |
| 481 | + } | |
| 482 | + cabecera = 'Ingreso manual ' + plazosConcat.trim(); | |
| 496 | 483 | } |
| 497 | - cabecera = 'Ingreso manual ' + plazosConcat.trim(); | |
| 484 | + $scope.articulosTabla = []; | |
| 485 | + addCabecera('Precios y condiciones:', cabecera); | |
| 486 | + }, function() { | |
| 487 | + | |
| 498 | 488 | } |
| 499 | - $scope.articulosTabla = []; | |
| 500 | - addCabecera('Precios y condiciones:', cabecera); | |
| 501 | - }, function() { | |
| 502 | - | |
| 503 | - } | |
| 504 | - ); | |
| 489 | + ); | |
| 490 | + } | |
| 505 | 491 | }; |
| 506 | 492 | |
| 507 | - $scope.abrirModalFlete = function() { | |
| 508 | - var modalInstance = $uibModal.open( | |
| 509 | - { | |
| 510 | - ariaLabelledBy: 'Busqueda de Flete', | |
| 511 | - templateUrl: 'modal-flete.html', | |
| 512 | - controller: 'focaModalFleteController', | |
| 513 | - size: 'lg', | |
| 514 | - resolve: { | |
| 515 | - parametrosFlete: | |
| 516 | - function() { | |
| 517 | - return { | |
| 518 | - flete: $scope.notaPedido.fob ? 'FOB' : | |
| 519 | - ( $scope.notaPedido.flete ? '1' : | |
| 520 | - ($scope.notaPedido.flete === undefined ? null : '0')), | |
| 521 | - bomba: $scope.notaPedido.bomba ? '1' : | |
| 522 | - ($scope.notaPedido.bomba === undefined ? null : '0'), | |
| 523 | - kilometros: $scope.notaPedido.kilometros | |
| 524 | - }; | |
| 525 | - } | |
| 493 | + $scope.seleccionarFlete = function() { | |
| 494 | + if(validarNotaRemitada()) { | |
| 495 | + var modalInstance = $uibModal.open( | |
| 496 | + { | |
| 497 | + ariaLabelledBy: 'Busqueda de Flete', | |
| 498 | + templateUrl: 'modal-flete.html', | |
| 499 | + controller: 'focaModalFleteController', | |
| 500 | + size: 'lg', | |
| 501 | + resolve: { | |
| 502 | + parametrosFlete: | |
| 503 | + function() { | |
| 504 | + return { | |
| 505 | + flete: $scope.notaPedido.fob ? 'FOB' : | |
| 506 | + ( $scope.notaPedido.flete ? '1' : | |
| 507 | + ($scope.notaPedido.flete === undefined ? null : '0')), | |
| 508 | + bomba: $scope.notaPedido.bomba ? '1' : | |
| 509 | + ($scope.notaPedido.bomba === undefined ? null : '0'), | |
| 510 | + kilometros: $scope.notaPedido.kilometros | |
| 511 | + }; | |
| 512 | + } | |
| 513 | + } | |
| 526 | 514 | } |
| 527 | - } | |
| 528 | - ); | |
| 529 | - modalInstance.result.then( | |
| 530 | - function(datos) { | |
| 531 | - $scope.notaPedido.flete = datos.flete; | |
| 532 | - $scope.notaPedido.fob = datos.FOB; | |
| 533 | - $scope.notaPedido.bomba = datos.bomba; | |
| 534 | - $scope.notaPedido.kilometros = datos.kilometros; | |
| 535 | - addCabecera('Flete:', datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No')); | |
| 536 | - if(datos.flete) { | |
| 537 | - addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | |
| 538 | - addCabecera('Kilometros:', datos.kilometros); | |
| 539 | - } else { | |
| 540 | - removeCabecera('Bomba:'); | |
| 541 | - removeCabecera('Kilometros:'); | |
| 542 | - $scope.notaPedido.bomba = false; | |
| 543 | - $scope.notaPedido.kilometros = null; | |
| 515 | + ); | |
| 516 | + modalInstance.result.then( | |
| 517 | + function(datos) { | |
| 518 | + $scope.notaPedido.flete = datos.flete; | |
| 519 | + $scope.notaPedido.fob = datos.FOB; | |
| 520 | + $scope.notaPedido.bomba = datos.bomba; | |
| 521 | + $scope.notaPedido.kilometros = datos.kilometros; | |
| 522 | + addCabecera('Flete:', datos.FOB ? 'FOB' : (datos.flete ? 'Si' : 'No')); | |
| 523 | + if(datos.flete) { | |
| 524 | + addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | |
| 525 | + addCabecera('Kilometros:', datos.kilometros); | |
| 526 | + } else { | |
| 527 | + removeCabecera('Bomba:'); | |
| 528 | + removeCabecera('Kilometros:'); | |
| 529 | + $scope.notaPedido.bomba = false; | |
| 530 | + $scope.notaPedido.kilometros = null; | |
| 531 | + } | |
| 532 | + }, function() { | |
| 533 | + | |
| 544 | 534 | } |
| 545 | - }, function() { | |
| 546 | - | |
| 547 | - } | |
| 548 | - ); | |
| 535 | + ); | |
| 536 | + } | |
| 549 | 537 | }; |
| 550 | 538 | |
| 551 | - $scope.abrirModalMoneda = function() { | |
| 552 | - var modalInstance = $uibModal.open( | |
| 553 | - { | |
| 554 | - ariaLabelledBy: 'Busqueda de Moneda', | |
| 555 | - templateUrl: 'modal-moneda.html', | |
| 556 | - controller: 'focaModalMonedaController', | |
| 557 | - size: 'lg' | |
| 558 | - } | |
| 559 | - ); | |
| 560 | - modalInstance.result.then( | |
| 561 | - function(moneda) { | |
| 562 | - $scope.abrirModalCotizacion(moneda); | |
| 563 | - }, function() { | |
| 564 | - | |
| 565 | - } | |
| 566 | - ); | |
| 539 | + $scope.seleccionarMoneda = function() { | |
| 540 | + if(validarNotaRemitada()) { | |
| 541 | + var modalInstance = $uibModal.open( | |
| 542 | + { | |
| 543 | + ariaLabelledBy: 'Busqueda de Moneda', | |
| 544 | + templateUrl: 'modal-moneda.html', | |
| 545 | + controller: 'focaModalMonedaController', | |
| 546 | + size: 'lg' | |
| 547 | + } | |
| 548 | + ); | |
| 549 | + modalInstance.result.then( | |
| 550 | + function(moneda) { | |
| 551 | + $scope.abrirModalCotizacion(moneda); | |
| 552 | + }, function() { | |
| 553 | + | |
| 554 | + } | |
| 555 | + ); | |
| 556 | + } | |
| 567 | 557 | }; |
| 568 | 558 | |
| 569 | 559 | $scope.abrirModalCotizacion = function(moneda) { |
| ... | ... | @@ -705,12 +695,12 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 705 | 695 | return relleno; |
| 706 | 696 | } |
| 707 | 697 | |
| 708 | - function validarNotaRemitada(funcion) { | |
| 709 | - if($scope.notaPedido.idRemito) { | |
| 698 | + function validarNotaRemitada() { | |
| 699 | + if(!$scope.notaPedido.idRemito) { | |
| 700 | + return true; | |
| 701 | + }else{ | |
| 710 | 702 | focaModalService.alert('No se puede editar una nota de pedido remitada'); |
| 711 | - } | |
| 712 | - else { | |
| 713 | - funcion(); | |
| 703 | + return false; | |
| 714 | 704 | } |
| 715 | 705 | } |
| 716 | 706 | } |
src/js/service.js
| ... | ... | @@ -54,6 +54,10 @@ angular.module('focaCrearNotaPedido') |
| 54 | 54 | }, |
| 55 | 55 | getNumeroNotaPedido: function() { |
| 56 | 56 | return $http.get(route + '/nota-pedido/numero-siguiente'); |
| 57 | + }, | |
| 58 | + getBotonera: function() { | |
| 59 | + return ['Vendedor', 'Cliente', 'Proveedor', 'Moneda', | |
| 60 | + 'Precios y condiciones', 'Flete', 'Productos']; | |
| 57 | 61 | } |
| 58 | 62 | }; |
| 59 | 63 | }]); |
src/views/nota-pedido.html
| ... | ... | @@ -82,22 +82,7 @@ |
| 82 | 82 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> |
| 83 | 83 | <div class="row px-5 py-2 botonera-secundaria"> |
| 84 | 84 | <div class="col-12"> |
| 85 | - <div class="row"> | |
| 86 | - <div | |
| 87 | - class="col-6 col-sm-2 px-1 py-1 m-auto m-md-0" | |
| 88 | - ng-repeat="boton in botonera" | |
| 89 | - ng-class="{'d-none d-md-grid': boton.texto == ''}"> | |
| 90 | - <button | |
| 91 | - type="button" | |
| 92 | - class="btn btn-default btn-block btn-xs text-center py-1 rounded border border-light" | |
| 93 | - ng-click="boton.accion()" | |
| 94 | - ng-class="{'d-sm-block h-100': boton.texto == ''}" | |
| 95 | - > | |
| 96 | - <img src="{{boton.imagen}}" alt="" ng-if="boton.imagen"> | |
| 97 | - <span>{{boton.texto}}</span> | |
| 98 | - </button> | |
| 99 | - </div> | |
| 100 | - </div> | |
| 85 | + <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> | |
| 101 | 86 | </div> |
| 102 | 87 | </div> |
| 103 | 88 | <!-- PC --> |