Commit 51c4901ee0ddbec1fc52e37c895edf5e098d6027
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master(efernandez) See merge request modulos-npm/foca-crear-nota-pedido!35
Showing
2 changed files
Show diff stats
package.json
| 1 | { | 1 | { |
| 2 | "name": "foca-crear-nota-pedido", | 2 | "name": "foca-crear-nota-pedido", |
| 3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
| 4 | "description": "Listado y ABM nota de pedidos", | 4 | "description": "Listado y ABM nota de pedidos", |
| 5 | "main": "index.js", | 5 | "main": "index.js", |
| 6 | "scripts": { | 6 | "scripts": { |
| 7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
| 8 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
| 9 | "gulp-pre-commit": "gulp pre-commit", | 9 | "gulp-pre-commit": "gulp pre-commit", |
| 10 | "postinstall": "npm run compile && gulp clean-post-install", | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
| 11 | "install-dev": "npm install -D jasmine-core pre-commit angular 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" | 11 | "install-dev": "npm install -D jasmine-core pre-commit angular 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" |
| 12 | }, | 12 | }, |
| 13 | "pre-commit": [ | 13 | "pre-commit": [ |
| 14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
| 15 | ], | 15 | ], |
| 16 | "repository": { | 16 | "repository": { |
| 17 | "type": "git", | 17 | "type": "git", |
| 18 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido.git" | 18 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido.git" |
| 19 | }, | 19 | }, |
| 20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
| 21 | "license": "ISC", | 21 | "license": "ISC", |
| 22 | "peerDependencies": { | 22 | "peerDependencies": { |
| 23 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | 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", | 24 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", |
| 25 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | 25 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", |
| 26 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | 26 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", |
| 27 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git" | 27 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git" |
| 28 | }, | 28 | }, |
| 29 | "devDependencies": { | 29 | "devDependencies": { |
| 30 | "angular": "^1.7.5", | 30 | "angular": "^1.7.5", |
| 31 | "angular-route": "^1.7.5", | 31 | "angular-route": "^1.7.5", |
| 32 | "bootstrap": "^4.1.3", | 32 | "bootstrap": "^4.1.3", |
| 33 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | 33 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", |
| 34 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | 34 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", |
| 35 | "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", | 35 | "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", |
| 36 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | 36 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", |
| 37 | "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", | 37 | "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", |
| 38 | "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", | 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 | "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | 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 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | 41 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", |
| 42 | "font-awesome": "^4.7.0", | 42 | "font-awesome": "^4.7.0", |
| 43 | "gulp": "^3.9.1", | 43 | "gulp": "^3.9.1", |
| 44 | "gulp-angular-templatecache": "2.2.2", | 44 | "gulp-angular-templatecache": "^2.2.2", |
| 45 | "gulp-clean": "^0.4.0", | 45 | "gulp-clean": "^0.4.0", |
| 46 | "gulp-concat": "^2.6.1", | 46 | "gulp-concat": "^2.6.1", |
| 47 | "gulp-connect": "^5.6.1", | 47 | "gulp-connect": "^5.6.1", |
| 48 | "gulp-htmlmin": "^5.0.1", | 48 | "gulp-htmlmin": "^5.0.1", |
| 49 | "gulp-jshint": "^2.1.0", | 49 | "gulp-jshint": "^2.1.0", |
| 50 | "gulp-rename": "^1.4.0", | 50 | "gulp-rename": "^1.4.0", |
| 51 | "gulp-replace": "^1.0.0", | 51 | "gulp-replace": "^1.0.0", |
| 52 | "gulp-sequence": "^1.0.0", | 52 | "gulp-sequence": "^1.0.0", |
| 53 | "gulp-uglify": "^3.0.1", | 53 | "gulp-uglify": "^3.0.1", |
| 54 | "gulp-uglify-es": "^1.0.4", | 54 | "gulp-uglify-es": "^1.0.4", |
| 55 | "jasmine-core": "^3.2.1", | 55 | "jasmine-core": "^3.3.0", |
| 56 | "jquery": "^3.3.1", | 56 | "jquery": "^3.3.1", |
| 57 | "jshint": "^2.9.6", | 57 | "jshint": "^2.9.6", |
| 58 | "pre-commit": "^1.2.2", | 58 | "pre-commit": "^1.2.2", |
| 59 | "pump": "^3.0.0", | 59 | "pump": "^3.0.0", |
| 60 | "ui-bootstrap4": "^3.0.5" | 60 | "ui-bootstrap4": "^3.0.5" |
| 61 | } | 61 | } |
| 62 | } | 62 | } |
src/js/controller.js
| 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 2 | [ | 2 | [ |
| 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', |
| 4 | 'focaModalService', | 4 | 'focaModalService', |
| 5 | function( | 5 | function( |
| 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService | 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService |
| 7 | ) { | 7 | ) { |
| 8 | $scope.botonera = [ | 8 | $scope.botonera = [ |
| 9 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 9 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
| 10 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 10 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
| 11 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | 11 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, |
| 12 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 12 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
| 13 | { | 13 | { |
| 14 | texto: 'Precios y condiciones', | 14 | texto: 'Precios y condiciones', |
| 15 | accion: function() {$scope.abrirModalListaPrecio();}}, | 15 | accion: function() {$scope.abrirModalListaPrecio();}}, |
| 16 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 16 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
| 17 | {texto: '', accion: function() {}}, | 17 | {texto: '', accion: function() {}}, |
| 18 | {texto: '', accion: function() {}} | 18 | {texto: '', accion: function() {}} |
| 19 | ]; | 19 | ]; |
| 20 | 20 | ||
| 21 | $scope.show = false; | 21 | $scope.show = false; |
| 22 | $scope.cargando = true; | 22 | $scope.cargando = true; |
| 23 | $scope.dateOptions = { | 23 | $scope.dateOptions = { |
| 24 | maxDate: new Date(), | 24 | maxDate: new Date(), |
| 25 | minDate: new Date(2010, 0, 1) | 25 | minDate: new Date(2010, 0, 1) |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | $scope.notaPedido = { | 28 | $scope.notaPedido = { |
| 29 | vendedor: {}, | 29 | vendedor: {}, |
| 30 | cliente: {}, | 30 | cliente: {}, |
| 31 | domicilio: {dom: ''}, | 31 | domicilio: {dom: ''}, |
| 32 | moneda: {detalle: ''} | 32 | moneda: {detalle: ''} |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | $scope.cabecera = []; | 35 | $scope.cabecera = []; |
| 36 | $scope.showCabecera = true; | 36 | $scope.showCabecera = true; |
| 37 | 37 | ||
| 38 | $scope.now = new Date(); | 38 | $scope.now = new Date(); |
| 39 | $scope.puntoVenta = Math.round(Math.random() * 10000); | 39 | $scope.puntoVenta = Math.round(Math.random() * 10000); |
| 40 | $scope.comprobante = Math.round(Math.random() * 1000000); | 40 | $scope.comprobante = Math.round(Math.random() * 1000000); |
| 41 | 41 | ||
| 42 | $scope.articulosTabla = []; | 42 | $scope.articulosTabla = []; |
| 43 | var idLista; | 43 | var idLista; |
| 44 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 44 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
| 45 | crearNotaPedidoService.getPrecioCondicion().then( | 45 | crearNotaPedidoService.getPrecioCondicion().then( |
| 46 | function(res) { | 46 | function(res) { |
| 47 | $scope.precioCondiciones = res.data; | 47 | $scope.precioCondiciones = res.data; |
| 48 | } | 48 | } |
| 49 | ); | 49 | ); |
| 50 | if (notaPedidoTemp !== undefined) { | 50 | if (notaPedidoTemp !== undefined) { |
| 51 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 51 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
| 52 | $scope.notaPedido = notaPedidoTemp; | 52 | $scope.notaPedido = notaPedidoTemp; |
| 53 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 53 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
| 54 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 54 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
| 55 | idLista = $scope.notaPedido.precioCondicion; | 55 | idLista = $scope.notaPedido.precioCondicion; |
| 56 | crearNotaPedidoService | 56 | crearNotaPedidoService |
| 57 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 57 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
| 58 | function(res) { | 58 | function(res) { |
| 59 | $scope.articulosTabla = res.data; | 59 | $scope.articulosTabla = res.data; |
| 60 | } | 60 | } |
| 61 | ); | 61 | ); |
| 62 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 62 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
| 63 | //(NO REQUERIDO EN ESTA VERSION) | 63 | //(NO REQUERIDO EN ESTA VERSION) |
| 64 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 64 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
| 65 | // function(res) { | 65 | // function(res) { |
| 66 | // $scope.notaPedido.domicilio = res.data; | 66 | // $scope.notaPedido.domicilio = res.data; |
| 67 | // } | 67 | // } |
| 68 | // ); | 68 | // ); |
| 69 | } else { | 69 | } else { |
| 70 | $scope.notaPedido.fechaCarga = new Date(); | 70 | $scope.notaPedido.fechaCarga = new Date(); |
| 71 | $scope.notaPedido.bomba = '0'; | 71 | $scope.notaPedido.bomba = '0'; |
| 72 | $scope.notaPedido.flete = '0'; | 72 | $scope.notaPedido.flete = '0'; |
| 73 | idLista = undefined; | 73 | idLista = undefined; |
| 74 | } | 74 | } |
| 75 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 75 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
| 76 | // $scope.addNewDom = function() { | 76 | // $scope.addNewDom = function() { |
| 77 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); | 77 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); |
| 78 | // }; | 78 | // }; |
| 79 | // $scope.removeNewChoice = function(choice) { | 79 | // $scope.removeNewChoice = function(choice) { |
| 80 | // if ($scope.notaPedido.domicilio.length > 1) { | 80 | // if ($scope.notaPedido.domicilio.length > 1) { |
| 81 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 81 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
| 82 | // function(c) { | 82 | // function(c) { |
| 83 | // return c.$$hashKey === choice.$$hashKey; | 83 | // return c.$$hashKey === choice.$$hashKey; |
| 84 | // } | 84 | // } |
| 85 | // ), 1); | 85 | // ), 1); |
| 86 | // } | 86 | // } |
| 87 | // }; | 87 | // }; |
| 88 | $scope.crearNotaPedido = function() { | 88 | $scope.crearNotaPedido = function() { |
| 89 | if($scope.articulosTabla.length === 0) { | 89 | if($scope.articulosTabla.length === 0) { |
| 90 | focaModalService.alert('Debe cargar almenos un articulo'); | 90 | focaModalService.alert('Debe cargar almenos un articulo'); |
| 91 | return; | 91 | return; |
| 92 | } | 92 | } |
| 93 | if($scope.notaPedido.domicilio.id === undefined) { | 93 | if($scope.notaPedido.domicilio.id === undefined) { |
| 94 | $scope.notaPedido.domicilio.id = 0; | 94 | $scope.notaPedido.domicilio.id = 0; |
| 95 | } | 95 | } |
| 96 | var date = new Date(); | 96 | var date = new Date(); |
| 97 | var notaPedido = { | 97 | var notaPedido = { |
| 98 | id: 0, | 98 | id: 0, |
| 99 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 99 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
| 100 | .toISOString().slice(0, 19).replace('T', ' '), | 100 | .toISOString().slice(0, 19).replace('T', ' '), |
| 101 | vendedor: $scope.notaPedido.vendedor.nombre, | 101 | vendedor: $scope.notaPedido.vendedor.nombre, |
| 102 | idCliente: $scope.notaPedido.cliente.id, | 102 | idCliente: $scope.notaPedido.cliente.id, |
| 103 | domicilio: $scope.notaPedido.domicilio, | 103 | domicilio: $scope.notaPedido.domicilio, |
| 104 | precioCondicion: $scope.notaPedido.precioCondicion, | ||
| 105 | bomba: $scope.notaPedido.bomba, | 104 | bomba: $scope.notaPedido.bomba, |
| 106 | flete: $scope.notaPedido.flete, | 105 | flete: $scope.notaPedido.flete, |
| 107 | total: $scope.getTotal() | 106 | total: $scope.getTotal() |
| 108 | }; | 107 | }; |
| 109 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 108 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
| 110 | function(data) { | 109 | function(data) { |
| 111 | focaModalService.alert('Nota pedido creada'); | 110 | focaModalService.alert('Nota pedido creada'); |
| 112 | if($scope.notaPedido.flete === 1) { | 111 | if($scope.notaPedido.flete === 1) { |
| 113 | var flete = { | 112 | var flete = { |
| 114 | idNotaPedido: data.data.id, | 113 | idNotaPedido: data.data.id, |
| 115 | idTransportista: $scope.notaPedido.fleteId, | 114 | idTransportista: $scope.notaPedido.fleteId, |
| 116 | idChofer: $scope.notaPedido.chofer.id, | 115 | idChofer: $scope.notaPedido.chofer.id, |
| 117 | idVehiculo: $scope.notaPedido.vehiculo.id, | 116 | idVehiculo: $scope.notaPedido.vehiculo.id, |
| 118 | kilometros: $scope.notaPedido.kilometros, | 117 | kilometros: $scope.notaPedido.kilometros, |
| 119 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | 118 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete |
| 120 | }; | 119 | }; |
| 121 | crearNotaPedidoService.crearFlete(flete); | 120 | crearNotaPedidoService.crearFlete(flete); |
| 122 | } | 121 | } |
| 123 | var articulosNotaPedido = $scope.articulosTabla; | 122 | var articulosNotaPedido = $scope.articulosTabla; |
| 124 | for(var i = 0; i < articulosNotaPedido.length; i++) { | 123 | for(var i = 0; i < articulosNotaPedido.length; i++) { |
| 125 | delete articulosNotaPedido[i].edit; | 124 | delete articulosNotaPedido[i].edit; |
| 126 | articulosNotaPedido[i].idNotaPedido = data.data.id; | 125 | articulosNotaPedido[i].idNotaPedido = data.data.id; |
| 127 | crearNotaPedidoService | 126 | crearNotaPedidoService |
| 128 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); | 127 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); |
| 129 | } | 128 | } |
| 130 | $scope.limpiarPantalla(); | 129 | $scope.limpiarPantalla(); |
| 131 | } | 130 | } |
| 132 | ); | 131 | ); |
| 133 | }; | 132 | }; |
| 134 | 133 | ||
| 135 | $scope.seleccionarArticulo = function() { | 134 | $scope.seleccionarArticulo = function() { |
| 136 | if (idLista === undefined) { | 135 | if (idLista === undefined) { |
| 137 | focaModalService.alert( | 136 | focaModalService.alert( |
| 138 | 'Primero seleccione una lista de precio y condicion'); | 137 | 'Primero seleccione una lista de precio y condicion'); |
| 139 | return; | 138 | return; |
| 140 | } | 139 | } |
| 141 | var modalInstance = $uibModal.open( | 140 | var modalInstance = $uibModal.open( |
| 142 | { | 141 | { |
| 143 | ariaLabelledBy: 'Busqueda de Productos', | 142 | ariaLabelledBy: 'Busqueda de Productos', |
| 144 | templateUrl: 'modal-busqueda-productos.html', | 143 | templateUrl: 'modal-busqueda-productos.html', |
| 145 | controller: 'modalBusquedaProductosCtrl', | 144 | controller: 'modalBusquedaProductosCtrl', |
| 146 | resolve: { idLista: function() { return idLista; } }, | 145 | resolve: { idLista: function() { return idLista; } }, |
| 147 | size: 'lg' | 146 | size: 'lg' |
| 148 | } | 147 | } |
| 149 | ); | 148 | ); |
| 150 | modalInstance.result.then( | 149 | modalInstance.result.then( |
| 151 | function(producto) { | 150 | function(producto) { |
| 152 | var newArt = | 151 | var newArt = |
| 153 | { | 152 | { |
| 154 | id: 0, | 153 | id: 0, |
| 155 | codigo: producto.codigo, | 154 | codigo: producto.codigo, |
| 156 | sector: producto.sector, | 155 | sector: producto.sector, |
| 157 | sectorCodigo: producto.sector + '-' + producto.codigo, | 156 | sectorCodigo: producto.sector + '-' + producto.codigo, |
| 158 | descripcion: producto.descripcion, | 157 | descripcion: producto.descripcion, |
| 159 | item: $scope.articulosTabla.length + 1, | 158 | item: $scope.articulosTabla.length + 1, |
| 160 | nombre: producto.descripcion, | 159 | nombre: producto.descripcion, |
| 161 | precio: producto.precio.toFixed(2), | 160 | precio: producto.precio.toFixed(2), |
| 162 | costoUnitario: producto.costo, | 161 | costoUnitario: producto.costo, |
| 163 | edit: false | 162 | edit: false |
| 164 | }; | 163 | }; |
| 165 | $scope.articuloACargar = newArt; | 164 | $scope.articuloACargar = newArt; |
| 166 | $scope.cargando = false; | 165 | $scope.cargando = false; |
| 167 | }, function() { | 166 | }, function() { |
| 168 | // funcion ejecutada cuando se cancela el modal | 167 | // funcion ejecutada cuando se cancela el modal |
| 169 | } | 168 | } |
| 170 | ); | 169 | ); |
| 171 | }; | 170 | }; |
| 172 | 171 | ||
| 173 | $scope.seleccionarVendedor = function() { | 172 | $scope.seleccionarVendedor = function() { |
| 174 | var modalInstance = $uibModal.open( | 173 | var modalInstance = $uibModal.open( |
| 175 | { | 174 | { |
| 176 | ariaLabelledBy: 'Busqueda de Vendedores', | 175 | ariaLabelledBy: 'Busqueda de Vendedores', |
| 177 | templateUrl: 'modal-vendedores.html', | 176 | templateUrl: 'modal-vendedores.html', |
| 178 | controller: 'modalVendedoresCtrl', | 177 | controller: 'modalVendedoresCtrl', |
| 179 | size: 'lg' | 178 | size: 'lg' |
| 180 | } | 179 | } |
| 181 | ); | 180 | ); |
| 182 | modalInstance.result.then( | 181 | modalInstance.result.then( |
| 183 | function(vendedor) { | 182 | function(vendedor) { |
| 184 | addCabecera('Vendedor:', vendedor.NomVen); | 183 | addCabecera('Vendedor:', vendedor.NomVen); |
| 185 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 184 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
| 186 | }, function() { | 185 | }, function() { |
| 187 | 186 | ||
| 188 | } | 187 | } |
| 189 | ); | 188 | ); |
| 190 | }; | 189 | }; |
| 191 | 190 | ||
| 192 | $scope.seleccionarProveedor = function() { | 191 | $scope.seleccionarProveedor = function() { |
| 193 | var modalInstance = $uibModal.open( | 192 | var modalInstance = $uibModal.open( |
| 194 | { | 193 | { |
| 195 | ariaLabelledBy: 'Busqueda de Proveedor', | 194 | ariaLabelledBy: 'Busqueda de Proveedor', |
| 196 | templateUrl: 'modal-proveedor.html', | 195 | templateUrl: 'modal-proveedor.html', |
| 197 | controller: 'focaModalProveedorCtrl', | 196 | controller: 'focaModalProveedorCtrl', |
| 198 | size: 'lg' | 197 | size: 'lg' |
| 199 | } | 198 | } |
| 200 | ); | 199 | ); |
| 201 | modalInstance.result.then( | 200 | modalInstance.result.then( |
| 202 | function(proveedor) { | 201 | function(proveedor) { |
| 203 | $scope.notaPedido.proveedor = proveedor.NOM; | 202 | $scope.notaPedido.proveedor = proveedor.NOM; |
| 204 | addCabecera('Proveedor:', proveedor.NOM); | 203 | addCabecera('Proveedor:', proveedor.NOM); |
| 205 | }, function() { | 204 | }, function() { |
| 206 | 205 | ||
| 207 | } | 206 | } |
| 208 | ); | 207 | ); |
| 209 | }; | 208 | }; |
| 210 | 209 | ||
| 211 | $scope.seleccionarCliente = function() { | 210 | $scope.seleccionarCliente = function() { |
| 212 | var modalInstance = $uibModal.open( | 211 | var modalInstance = $uibModal.open( |
| 213 | { | 212 | { |
| 214 | ariaLabelledBy: 'Busqueda de Cliente', | 213 | ariaLabelledBy: 'Busqueda de Cliente', |
| 215 | templateUrl: 'foca-busqueda-cliente-modal.html', | 214 | templateUrl: 'foca-busqueda-cliente-modal.html', |
| 216 | controller: 'focaBusquedaClienteModalController', | 215 | controller: 'focaBusquedaClienteModalController', |
| 217 | size: 'lg' | 216 | size: 'lg' |
| 218 | } | 217 | } |
| 219 | ); | 218 | ); |
| 220 | modalInstance.result.then( | 219 | modalInstance.result.then( |
| 221 | function(cliente) { | 220 | function(cliente) { |
| 222 | $scope.notaPedido.cliente.nombre = cliente.nom; | 221 | $scope.notaPedido.cliente.nombre = cliente.nom; |
| 223 | $scope.notaPedido.cliente.id = cliente.cod; | 222 | $scope.notaPedido.cliente.id = cliente.cod; |
| 224 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( | 223 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( |
| 225 | function(data) { | 224 | function(data) { |
| 226 | if(data.data.length === 0){ | 225 | if(data.data.length === 0){ |
| 227 | focaModalService | 226 | focaModalService |
| 228 | .alert('El cliente no tienen domicilios de entrega') | 227 | .alert('El cliente no tienen domicilios de entrega') |
| 229 | .then( | 228 | .then( |
| 230 | function() { | 229 | function() { |
| 231 | $scope.seleccionarCliente(); | 230 | $scope.seleccionarCliente(); |
| 232 | $scope.notaPedido.cliente = {nombre: ''}; | 231 | $scope.notaPedido.cliente = {nombre: ''}; |
| 233 | } | 232 | } |
| 234 | ); | 233 | ); |
| 235 | return; | 234 | return; |
| 236 | } | 235 | } |
| 237 | var modalInstanceDomicilio = $uibModal.open( | 236 | var modalInstanceDomicilio = $uibModal.open( |
| 238 | { | 237 | { |
| 239 | ariaLabelledBy: 'Busqueda de Domicilios', | 238 | ariaLabelledBy: 'Busqueda de Domicilios', |
| 240 | templateUrl: 'modal-domicilio.html', | 239 | templateUrl: 'modal-domicilio.html', |
| 241 | controller: 'focaModalDomicilioController', | 240 | controller: 'focaModalDomicilioController', |
| 242 | resolve: { idCliente: function() { return cliente.cod; }}, | 241 | resolve: { idCliente: function() { return cliente.cod; }}, |
| 243 | size: 'lg', | 242 | size: 'lg', |
| 244 | backdrop: 'static', | 243 | backdrop: 'static', |
| 245 | } | 244 | } |
| 246 | ); | 245 | ); |
| 247 | modalInstanceDomicilio.result.then( | 246 | modalInstanceDomicilio.result.then( |
| 248 | function(domicilio) { | 247 | function(domicilio) { |
| 249 | focaModalService.alert('Domicilio elegido' + domicilio.dom); | 248 | focaModalService.alert('Domicilio elegido' + domicilio.dom); |
| 250 | }, function() { | 249 | }, function() { |
| 251 | $scope.notaPedido.cliente.nombre = ''; | 250 | $scope.notaPedido.cliente.nombre = ''; |
| 252 | $scope.notaPedido.cliente.id = ''; | 251 | $scope.notaPedido.cliente.id = ''; |
| 253 | removeCabecera('Cliente:'); | 252 | removeCabecera('Cliente:'); |
| 254 | $scope.seleccionarCliente(); | 253 | $scope.seleccionarCliente(); |
| 255 | return; | 254 | return; |
| 256 | } | 255 | } |
| 257 | ); | 256 | ); |
| 258 | } | 257 | } |
| 259 | ); | 258 | ); |
| 260 | addCabecera('Cliente:', cliente.nom); | 259 | addCabecera('Cliente:', cliente.nom); |
| 261 | }, function() { | 260 | }, function() { |
| 262 | 261 | ||
| 263 | } | 262 | } |
| 264 | ); | 263 | ); |
| 265 | }; | 264 | }; |
| 266 | 265 | ||
| 267 | $scope.mostrarFichaCliente = function() { | 266 | $scope.mostrarFichaCliente = function() { |
| 268 | $uibModal.open( | 267 | $uibModal.open( |
| 269 | { | 268 | { |
| 270 | ariaLabelledBy: 'Datos del Cliente', | 269 | ariaLabelledBy: 'Datos del Cliente', |
| 271 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 270 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
| 272 | controller: 'focaCrearNotaPedidoFichaClienteController', | 271 | controller: 'focaCrearNotaPedidoFichaClienteController', |
| 273 | size: 'lg' | 272 | size: 'lg' |
| 274 | } | 273 | } |
| 275 | ); | 274 | ); |
| 276 | }; | 275 | }; |
| 277 | 276 | ||
| 278 | $scope.getTotal = function() { | 277 | $scope.getTotal = function() { |
| 279 | var total = 0; | 278 | var total = 0; |
| 280 | var arrayTempArticulos = $scope.articulosTabla; | 279 | var arrayTempArticulos = $scope.articulosTabla; |
| 281 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 280 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
| 282 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 281 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
| 283 | } | 282 | } |
| 284 | return total.toFixed(2); | 283 | return total.toFixed(2); |
| 285 | }; | 284 | }; |
| 286 | 285 | ||
| 287 | $scope.getSubTotal = function() { | 286 | $scope.getSubTotal = function() { |
| 288 | if($scope.articuloACargar) { | 287 | if($scope.articuloACargar) { |
| 289 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 288 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
| 290 | } | 289 | } |
| 291 | }; | 290 | }; |
| 292 | 291 | ||
| 293 | $scope.abrirModalListaPrecio = function() { | 292 | $scope.abrirModalListaPrecio = function() { |
| 294 | var modalInstance = $uibModal.open( | 293 | var modalInstance = $uibModal.open( |
| 295 | { | 294 | { |
| 296 | ariaLabelledBy: 'Busqueda de Precio Condición', | 295 | ariaLabelledBy: 'Busqueda de Precio Condición', |
| 297 | templateUrl: 'modal-precio-condicion.html', | 296 | templateUrl: 'modal-precio-condicion.html', |
| 298 | controller: 'focaModalPrecioCondicionController', | 297 | controller: 'focaModalPrecioCondicionController', |
| 299 | size: 'lg' | 298 | size: 'lg' |
| 300 | } | 299 | } |
| 301 | ); | 300 | ); |
| 302 | modalInstance.result.then( | 301 | modalInstance.result.then( |
| 303 | function(precioCondicion) { | 302 | function(precioCondicion) { |
| 304 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; | 303 | var cabecera = ''; |
| 305 | idLista = precioCondicion.idListaPrecio; | 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 | $scope.articulosTabla = []; | 320 | $scope.articulosTabla = []; |
| 307 | 321 | addCabecera('Precios y condiciones:', cabecera); | |
| 308 | addCabecera('Precios y condiciones:', precioCondicion.nombre); | ||
| 309 | }, function() { | 322 | }, function() { |
| 310 | 323 | ||
| 311 | } | 324 | } |
| 312 | ); | 325 | ); |
| 313 | }; | 326 | }; |
| 314 | 327 | ||
| 315 | $scope.abrirModalFlete = function() { | 328 | $scope.abrirModalFlete = function() { |
| 316 | var modalInstance = $uibModal.open( | 329 | var modalInstance = $uibModal.open( |
| 317 | { | 330 | { |
| 318 | ariaLabelledBy: 'Busqueda de Flete', | 331 | ariaLabelledBy: 'Busqueda de Flete', |
| 319 | templateUrl: 'modal-flete.html', | 332 | templateUrl: 'modal-flete.html', |
| 320 | controller: 'focaModalFleteController', | 333 | controller: 'focaModalFleteController', |
| 321 | size: 'lg', | 334 | size: 'lg', |
| 322 | resolve: { | 335 | resolve: { |
| 323 | parametrosFlete: | 336 | parametrosFlete: |
| 324 | function() { | 337 | function() { |
| 325 | return { | 338 | return { |
| 326 | flete: $scope.notaPedido.flete, | 339 | flete: $scope.notaPedido.flete, |
| 327 | bomba: $scope.notaPedido.bomba, | 340 | bomba: $scope.notaPedido.bomba, |
| 328 | kilometros: $scope.notaPedido.kilometros | 341 | kilometros: $scope.notaPedido.kilometros |
| 329 | }; | 342 | }; |
| 330 | } | 343 | } |
| 331 | } | 344 | } |
| 332 | } | 345 | } |
| 333 | ); | 346 | ); |
| 334 | modalInstance.result.then( | 347 | modalInstance.result.then( |
| 335 | function(datos) { | 348 | function(datos) { |
| 336 | $scope.notaPedido.flete = datos.flete; | 349 | $scope.notaPedido.flete = datos.flete; |
| 337 | $scope.notaPedido.bomba = datos.bomba; | 350 | $scope.notaPedido.bomba = datos.bomba; |
| 338 | $scope.notaPedido.kilometros = datos.kilometros; | 351 | $scope.notaPedido.kilometros = datos.kilometros; |
| 339 | 352 | ||
| 340 | addCabecera('Flete:', datos.flete); | 353 | addCabecera('Flete:', datos.flete); |
| 341 | if(datos.flete === 'si') { | 354 | if(datos.flete === 'si') { |
| 342 | addCabecera('Bomba:', datos.bomba); | 355 | addCabecera('Bomba:', datos.bomba); |
| 343 | addCabecera('Kilometros:', datos.kilometros); | 356 | addCabecera('Kilometros:', datos.kilometros); |
| 344 | } else { | 357 | } else { |
| 345 | removeCabecera('Bomba:'); | 358 | removeCabecera('Bomba:'); |
| 346 | removeCabecera('Kilometros:'); | 359 | removeCabecera('Kilometros:'); |
| 347 | } | 360 | } |
| 348 | }, function() { | 361 | }, function() { |
| 349 | 362 | ||
| 350 | } | 363 | } |
| 351 | ); | 364 | ); |
| 352 | }; | 365 | }; |
| 353 | 366 | ||
| 354 | $scope.abrirModalMoneda = function() { | 367 | $scope.abrirModalMoneda = function() { |
| 355 | var modalInstance = $uibModal.open( | 368 | var modalInstance = $uibModal.open( |
| 356 | { | 369 | { |
| 357 | ariaLabelledBy: 'Busqueda de Moneda', | 370 | ariaLabelledBy: 'Busqueda de Moneda', |
| 358 | templateUrl: 'modal-moneda.html', | 371 | templateUrl: 'modal-moneda.html', |
| 359 | controller: 'focaModalMonedaController', | 372 | controller: 'focaModalMonedaController', |
| 360 | size: 'lg' | 373 | size: 'lg' |
| 361 | } | 374 | } |
| 362 | ); | 375 | ); |
| 363 | modalInstance.result.then( | 376 | modalInstance.result.then( |
| 364 | function(moneda) { | 377 | function(moneda) { |
| 365 | $scope.notaPedido.moneda = { | 378 | $scope.notaPedido.moneda = { |
| 366 | id: moneda.ID, | 379 | id: moneda.ID, |
| 367 | detalle: moneda.DETALLE, | 380 | detalle: moneda.DETALLE, |
| 368 | simbolo: moneda.SIMBOLO | 381 | simbolo: moneda.SIMBOLO |
| 369 | }; | 382 | }; |
| 370 | 383 | ||
| 371 | addCabecera('Moneda:', moneda.DETALLE); | 384 | addCabecera('Moneda:', moneda.DETALLE); |
| 372 | }, function() { | 385 | }, function() { |
| 373 | 386 | ||
| 374 | } | 387 | } |
| 375 | ); | 388 | ); |
| 376 | }; | 389 | }; |
| 377 | 390 | ||
| 378 | $scope.agregarATabla = function(key) { | 391 | $scope.agregarATabla = function(key) { |
| 379 | if(key === 13) { | 392 | if(key === 13) { |
| 380 | if($scope.articuloACargar.cantidad === undefined || | 393 | if($scope.articuloACargar.cantidad === undefined || |
| 381 | $scope.articuloACargar.cantidad === 0 || | 394 | $scope.articuloACargar.cantidad === 0 || |
| 382 | $scope.articuloACargar.cantidad === null ){ | 395 | $scope.articuloACargar.cantidad === null ){ |
| 383 | focaModalService.alert('El valor debe ser al menos 1'); | 396 | focaModalService.alert('El valor debe ser al menos 1'); |
| 384 | return; | 397 | return; |
| 385 | } | 398 | } |
| 386 | delete $scope.articuloACargar.sectorCodigo; | 399 | delete $scope.articuloACargar.sectorCodigo; |
| 387 | $scope.articulosTabla.push($scope.articuloACargar); | 400 | $scope.articulosTabla.push($scope.articuloACargar); |
| 388 | $scope.cargando = true; | 401 | $scope.cargando = true; |
| 389 | } | 402 | } |
| 390 | }; | 403 | }; |
| 391 | 404 | ||
| 392 | $scope.quitarArticulo = function(key) { | 405 | $scope.quitarArticulo = function(key) { |
| 393 | $scope.articulosTabla.splice(key, 1); | 406 | $scope.articulosTabla.splice(key, 1); |
| 394 | }; | 407 | }; |
| 395 | 408 | ||
| 396 | $scope.editarArticulo = function(key, articulo) { | 409 | $scope.editarArticulo = function(key, articulo) { |
| 397 | if(key === 13) { | 410 | if(key === 13) { |
| 398 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 411 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
| 399 | articulo.cantidad === undefined){ | 412 | articulo.cantidad === undefined){ |
| 400 | focaModalService.alert('El valor debe ser al menos 1'); | 413 | focaModalService.alert('El valor debe ser al menos 1'); |
| 401 | return; | 414 | return; |
| 402 | } | 415 | } |
| 403 | articulo.edit = false; | 416 | articulo.edit = false; |
| 404 | } | 417 | } |
| 405 | }; | 418 | }; |
| 406 | 419 | ||
| 407 | $scope.cambioEdit = function(articulo) { | 420 | $scope.cambioEdit = function(articulo) { |
| 408 | articulo.edit = true; | 421 | articulo.edit = true; |
| 409 | }; | 422 | }; |
| 410 | 423 | ||
| 411 | $scope.limpiarFlete = function() { | 424 | $scope.limpiarFlete = function() { |
| 412 | $scope.notaPedido.fleteNombre = ''; | 425 | $scope.notaPedido.fleteNombre = ''; |
| 413 | $scope.notaPedido.chofer = ''; | 426 | $scope.notaPedido.chofer = ''; |
| 414 | $scope.notaPedido.vehiculo = ''; | 427 | $scope.notaPedido.vehiculo = ''; |
| 415 | $scope.notaPedido.kilometros = ''; | 428 | $scope.notaPedido.kilometros = ''; |
| 416 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 429 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
| 417 | $scope.choferes = ''; | 430 | $scope.choferes = ''; |
| 418 | $scope.vehiculos = ''; | 431 | $scope.vehiculos = ''; |
| 419 | }; | 432 | }; |
| 420 | 433 | ||
| 421 | $scope.limpiarPantalla = function() { | 434 | $scope.limpiarPantalla = function() { |
| 422 | $scope.limpiarFlete(); | 435 | $scope.limpiarFlete(); |
| 423 | $scope.notaPedido.flete = '0'; | 436 | $scope.notaPedido.flete = '0'; |
| 424 | $scope.notaPedido.bomba = '0'; | 437 | $scope.notaPedido.bomba = '0'; |
| 425 | $scope.notaPedido.precioCondicion = ''; | 438 | $scope.notaPedido.precioCondicion = ''; |
| 426 | $scope.articulosTabla = []; | 439 | $scope.articulosTabla = []; |
| 427 | $scope.notaPedido.vendedor.nombre = ''; | 440 | $scope.notaPedido.vendedor.nombre = ''; |
| 428 | $scope.notaPedido.cliente = {nombre: ''}; | 441 | $scope.notaPedido.cliente = {nombre: ''}; |
| 429 | $scope.notaPedido.domicilio = {dom: ''}; | 442 | $scope.notaPedido.domicilio = {dom: ''}; |
| 430 | $scope.domiciliosCliente = []; | 443 | $scope.domiciliosCliente = []; |
| 431 | }; | 444 | }; |
| 432 | 445 | ||
| 433 | $scope.resetFilter = function() { | 446 | $scope.resetFilter = function() { |
| 434 | $scope.articuloACargar = {}; | 447 | $scope.articuloACargar = {}; |
| 435 | $scope.cargando = true; | 448 | $scope.cargando = true; |
| 436 | }; | 449 | }; |
| 437 | 450 | ||
| 438 | $scope.selectFocus = function($event) { | 451 | $scope.selectFocus = function($event) { |
| 439 | $event.target.select(); | 452 | $event.target.select(); |
| 440 | }; | 453 | }; |
| 441 | 454 | ||
| 442 | $scope.salir = function() { | 455 | $scope.salir = function() { |
| 443 | $location.path('/'); | 456 | $location.path('/'); |
| 444 | }; | 457 | }; |
| 445 | 458 | ||
| 446 | function addCabecera(label, valor) { | 459 | function addCabecera(label, valor) { |
| 447 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 460 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
| 448 | if(propiedad.length === 1) { | 461 | if(propiedad.length === 1) { |
| 449 | propiedad[0].valor = valor; | 462 | propiedad[0].valor = valor; |
| 450 | } else { | 463 | } else { |
| 451 | $scope.cabecera.push({label: label, valor: valor}); | 464 | $scope.cabecera.push({label: label, valor: valor}); |
| 452 | } | 465 | } |
| 453 | } | 466 | } |
| 454 | 467 | ||
| 455 | function removeCabecera(label) { | 468 | function removeCabecera(label) { |
| 456 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 469 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
| 457 | if(propiedad.length === 1){ | 470 | if(propiedad.length === 1){ |
| 458 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 471 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
| 459 | } | 472 | } |
| 460 | } | 473 | } |
| 461 | } | 474 | } |
| 462 | ] | 475 | ] |
| 463 | ) | 476 | ) |
| 464 | .controller('notaPedidoListaCtrl', [ | 477 | .controller('notaPedidoListaCtrl', [ |
| 465 | '$scope', | 478 | '$scope', |
| 466 | 'crearNotaPedidoService', | 479 | 'crearNotaPedidoService', |
| 467 | '$location', | 480 | '$location', |
| 468 | function($scope, crearNotaPedidoService, $location) { | 481 | function($scope, crearNotaPedidoService, $location) { |
| 469 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 482 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
| 470 | $scope.notaPedidos = datos.data; | 483 | $scope.notaPedidos = datos.data; |
| 471 | }); | 484 | }); |
| 472 | $scope.editar = function(notaPedido) { | 485 | $scope.editar = function(notaPedido) { |
| 473 | crearNotaPedidoService.setNotaPedido(notaPedido); | 486 | crearNotaPedidoService.setNotaPedido(notaPedido); |
| 474 | $location.path('/venta-nota-pedido/abm/'); | 487 | $location.path('/venta-nota-pedido/abm/'); |
| 475 | }; | 488 | }; |
| 476 | $scope.crearPedido = function() { | 489 | $scope.crearPedido = function() { |
| 477 | crearNotaPedidoService.clearNotaPedido(); | 490 | crearNotaPedidoService.clearNotaPedido(); |
| 478 | $location.path('/venta-nota-pedido/abm/'); | 491 | $location.path('/venta-nota-pedido/abm/'); |
| 479 | }; | 492 | }; |
| 480 | } | 493 | } |
| 481 | ]) | 494 | ]) |
| 482 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 495 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
| 483 | '$scope', | 496 | '$scope', |
| 484 | 'crearNotaPedidoService', | 497 | 'crearNotaPedidoService', |
| 485 | '$location', | 498 | '$location', |
| 486 | function($scope, crearNotaPedidoService, $location) { | 499 | function($scope, crearNotaPedidoService, $location) { |
| 487 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 500 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
| 488 | $scope.notaPedidos = datos.data; | 501 | $scope.notaPedidos = datos.data; |
| 489 | }); | 502 | }); |
| 490 | $scope.editar = function(notaPedido) { | 503 | $scope.editar = function(notaPedido) { |
| 491 | crearNotaPedidoService.setNotaPedido(notaPedido); | 504 | crearNotaPedidoService.setNotaPedido(notaPedido); |
| 492 | $location.path('/venta-nota-pedido/abm/'); | 505 | $location.path('/venta-nota-pedido/abm/'); |
| 493 | }; | 506 | }; |
| 494 | $scope.crearPedido = function() { | 507 | $scope.crearPedido = function() { |
| 495 | crearNotaPedidoService.clearNotaPedido(); | 508 | crearNotaPedidoService.clearNotaPedido(); |
| 496 | $location.path('/venta-nota-pedido/abm/'); | 509 | $location.path('/venta-nota-pedido/abm/'); |
| 497 | }; | 510 | }; |
| 498 | } | 511 | } |