Commit 570ac1a4af8293030b8043a2ce5674569f6bfa16
1 parent
ae1676e213
Exists in
master
agrego foca-botonera-facturador
Showing
5 changed files
with
295 additions
and
311 deletions
Show diff stats
index.html
| ... | ... | @@ -34,6 +34,7 @@ |
| 34 | 34 | <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script> |
| 35 | 35 | <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script> |
| 36 | 36 | <script src="node_modules/foca-modal-nota-pedido/dist/foca-modal-nota-pedido.min.js"></script> |
| 37 | + <script src="node_modules/foca-botonera-facturador/dist/foca-botonera-facturador.min.js"></script> | |
| 37 | 38 | |
| 38 | 39 | <script src="src/js/app.js"></script> |
| 39 | 40 | <script src="src/js/controller.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 angular-cookies 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 git+https://debo.suite.repo/modulos-npm/foca-configuracion.git" | |
| 11 | + "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route angular-cookies 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 git+http://git.focasoftware.com/npm/foca-configuracion.git" | |
| 12 | 12 | }, |
| 13 | 13 | "pre-commit": [ |
| 14 | 14 | "gulp-pre-commit" |
| ... | ... | @@ -20,12 +20,12 @@ |
| 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-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", | |
| 27 | - "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | |
| 28 | - "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" | |
| 23 | + "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git", | |
| 24 | + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | |
| 25 | + "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git", | |
| 26 | + "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git", | |
| 27 | + "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git", | |
| 28 | + "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git" | |
| 29 | 29 | }, |
| 30 | 30 | "devDependencies": { |
| 31 | 31 | "angular": "^1.7.5", |
| ... | ... | @@ -33,19 +33,20 @@ |
| 33 | 33 | "angular-ladda": "^0.4.3", |
| 34 | 34 | "angular-route": "^1.7.5", |
| 35 | 35 | "bootstrap": "^4.1.3", |
| 36 | - "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | |
| 37 | - "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git", | |
| 38 | - "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | |
| 39 | - "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", | |
| 40 | - "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | |
| 41 | - "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", | |
| 42 | - "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", | |
| 43 | - "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", | |
| 44 | - "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", | |
| 45 | - "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | |
| 46 | - "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | |
| 47 | - "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | |
| 48 | - "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", | |
| 36 | + "foca-botonera-facturador": "git+http://git.focasoftware.com/npm/foca-botonera-facturador.git", | |
| 37 | + "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git", | |
| 38 | + "foca-configuracion": "git+http://git.focasoftware.com/npm/foca-configuracion.git", | |
| 39 | + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | |
| 40 | + "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", | |
| 41 | + "foca-modal-busqueda-productos": "git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git", | |
| 42 | + "foca-modal-cotizacion": "git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git", | |
| 43 | + "foca-modal-domicilio": "git+http://git.focasoftware.com/npm/foca-modal-domicilio.git", | |
| 44 | + "foca-modal-flete": "git+http://git.focasoftware.com/npm/foca-modal-flete.git", | |
| 45 | + "foca-modal-moneda": "git+http://git.focasoftware.com/npm/foca-modal-moneda.git", | |
| 46 | + "foca-modal-precio-condiciones": "git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git", | |
| 47 | + "foca-modal-proveedor": "git+http://git.focasoftware.com/npm/foca-modal-proveedor.git", | |
| 48 | + "foca-modal-vendedores": "git+http://git.focasoftware.com/npm/foca-modal-vendedores.git", | |
| 49 | + "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git", | |
| 49 | 50 | "font-awesome": "^4.7.0", |
| 50 | 51 | "gulp": "^3.9.1", |
| 51 | 52 | "gulp-angular-templatecache": "^2.2.5", |
src/js/controller.js
| ... | ... | @@ -6,30 +6,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 6 | 6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, |
| 7 | 7 | remitoBusinessService, $rootScope) |
| 8 | 8 | { |
| 9 | - $scope.botonera = [ | |
| 10 | - {texto: 'Nota Pedido', imagen: '../img/abmPrecios.png', accion: function() { | |
| 11 | - varlidarRemitoFacturado($scope.seleccionarNotaPedido);}}, | |
| 12 | - {texto: 'Vendedor', imagen: '../img/abmPrecios.png', accion: function() { | |
| 13 | - varlidarRemitoFacturado($scope.seleccionarVendedor);}}, | |
| 14 | - {texto: 'Cliente', imagen: '../img/abmPrecios.png', accion: function() { | |
| 15 | - varlidarRemitoFacturado($scope.seleccionarCliente);}}, | |
| 16 | - {texto: 'Proveedor', imagen: '../img/abmPrecios.png', accion: function() { | |
| 17 | - varlidarRemitoFacturado($scope.seleccionarProveedor);}}, | |
| 18 | - {texto: 'Moneda', imagen: '../img/abmPrecios.png', accion: function() { | |
| 19 | - varlidarRemitoFacturado($scope.abrirModalMoneda);}}, | |
| 20 | - {texto: 'Precios y condiciones', imagen: '../img/abmPrecios.png', | |
| 21 | - accion: function() {varlidarRemitoFacturado($scope.abrirModalListaPrecio);}}, | |
| 22 | - {texto: 'Flete', imagen: '../img/abmPrecios.png', accion: function() { | |
| 23 | - varlidarRemitoFacturado($scope.abrirModalFlete);}}, | |
| 24 | - {texto: 'Productos', imagen: '../img/abmPrecios.png', accion: function() { | |
| 25 | - $scope.seleccionarArticulo(); | |
| 26 | - }}, | |
| 27 | - {texto: '', accion: function() {}}, | |
| 28 | - {texto: '', accion: function() {}}, | |
| 29 | - {texto: '', accion: function() {}}, | |
| 30 | - {texto: '', accion: function() {}} | |
| 31 | - | |
| 32 | - ]; | |
| 9 | + $scope.botonera = crearRemitoService.getBotonera(); | |
| 33 | 10 | $scope.isNumber = angular.isNumber; |
| 34 | 11 | $scope.datepickerAbierto = false; |
| 35 | 12 | $scope.show = false; |
| ... | ... | @@ -89,115 +66,118 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 89 | 66 | ); |
| 90 | 67 | |
| 91 | 68 | $scope.seleccionarNotaPedido = function() { |
| 92 | - var modalInstance = $uibModal.open( | |
| 93 | - { | |
| 94 | - ariaLabelledBy: 'Busqueda de Nota de Pedido', | |
| 95 | - templateUrl: 'foca-modal-nota-pedido.html', | |
| 96 | - controller: 'focaModalNotaPedidoController', | |
| 97 | - size: 'lg', | |
| 98 | - resolve: { | |
| 99 | - usadoPor: function() { | |
| 100 | - return 'remito'; | |
| 69 | + if(varlidarRemitoFacturado){ | |
| 70 | + var modalInstance = $uibModal.open( | |
| 71 | + { | |
| 72 | + ariaLabelledBy: 'Busqueda de Nota de Pedido', | |
| 73 | + templateUrl: 'foca-modal-nota-pedido.html', | |
| 74 | + controller: 'focaModalNotaPedidoController', | |
| 75 | + size: 'lg', | |
| 76 | + resolve: { | |
| 77 | + usadoPor: function() { | |
| 78 | + return 'remito'; | |
| 79 | + } | |
| 101 | 80 | } |
| 102 | 81 | } |
| 103 | - } | |
| 104 | - ); | |
| 105 | - modalInstance.result.then( | |
| 106 | - function(notaPedido) { | |
| 107 | - //aรฑado cabeceras | |
| 108 | - $scope.notaPedido.id = notaPedido.id; | |
| 109 | - removeCabecera('Bomba:'); | |
| 110 | - removeCabecera('Kilometros:'); | |
| 111 | - var cabeceras = [ | |
| 112 | - { | |
| 113 | - label: 'Moneda:', | |
| 114 | - valor: notaPedido.cotizacion.moneda.DETALLE | |
| 115 | - }, | |
| 116 | - { | |
| 117 | - label: 'Fecha cotizacion:', | |
| 118 | - valor: $filter('date')(notaPedido.cotizacion.FECHA, | |
| 119 | - 'dd/MM/yyyy') | |
| 120 | - }, | |
| 121 | - { | |
| 122 | - label: 'Cotizacion:', | |
| 123 | - valor: notaPedido.cotizacion.VENDEDOR | |
| 124 | - }, | |
| 125 | - { | |
| 126 | - label: 'Cliente:', | |
| 127 | - valor: notaPedido.cliente.NOM | |
| 128 | - }, | |
| 129 | - { | |
| 130 | - label: 'Domicilio:', | |
| 131 | - valor: notaPedido.domicilioStamp | |
| 132 | - }, | |
| 133 | - { | |
| 134 | - label: 'Vendedor:', | |
| 135 | - valor: notaPedido.vendedor.NomVen | |
| 136 | - }, | |
| 137 | - { | |
| 138 | - label: 'Proveedor:', | |
| 139 | - valor: notaPedido.proveedor.NOM | |
| 140 | - }, | |
| 141 | - { | |
| 142 | - label: 'Precio condicion:', | |
| 143 | - valor: valorPrecioCondicion() + ' ' + | |
| 144 | - remitoBusinessService.plazoToString(notaPedido.notaPedidoPlazo) | |
| 145 | - }, | |
| 146 | - { | |
| 147 | - label: 'Flete:', | |
| 148 | - valor: notaPedido.fob === 1 ? 'FOB' : ( | |
| 149 | - notaPedido.flete === 1 ? 'Si' : 'No') | |
| 82 | + ); | |
| 83 | + modalInstance.result.then( | |
| 84 | + function(notaPedido) { | |
| 85 | + //aรฑado cabeceras | |
| 86 | + $scope.notaPedido.id = notaPedido.id; | |
| 87 | + removeCabecera('Bomba:'); | |
| 88 | + removeCabecera('Kilometros:'); | |
| 89 | + var cabeceras = [ | |
| 90 | + { | |
| 91 | + label: 'Moneda:', | |
| 92 | + valor: notaPedido.cotizacion.moneda.DETALLE | |
| 93 | + }, | |
| 94 | + { | |
| 95 | + label: 'Fecha cotizacion:', | |
| 96 | + valor: $filter('date')(notaPedido.cotizacion.FECHA, | |
| 97 | + 'dd/MM/yyyy') | |
| 98 | + }, | |
| 99 | + { | |
| 100 | + label: 'Cotizacion:', | |
| 101 | + valor: notaPedido.cotizacion.VENDEDOR | |
| 102 | + }, | |
| 103 | + { | |
| 104 | + label: 'Cliente:', | |
| 105 | + valor: notaPedido.cliente.NOM | |
| 106 | + }, | |
| 107 | + { | |
| 108 | + label: 'Domicilio:', | |
| 109 | + valor: notaPedido.domicilioStamp | |
| 110 | + }, | |
| 111 | + { | |
| 112 | + label: 'Vendedor:', | |
| 113 | + valor: notaPedido.vendedor.NomVen | |
| 114 | + }, | |
| 115 | + { | |
| 116 | + label: 'Proveedor:', | |
| 117 | + valor: notaPedido.proveedor.NOM | |
| 118 | + }, | |
| 119 | + { | |
| 120 | + label: 'Precio condicion:', | |
| 121 | + valor: valorPrecioCondicion() + ' ' + | |
| 122 | + remitoBusinessService | |
| 123 | + .plazoToString(notaPedido.notaPedidoPlazo) | |
| 124 | + }, | |
| 125 | + { | |
| 126 | + label: 'Flete:', | |
| 127 | + valor: notaPedido.fob === 1 ? 'FOB' : ( | |
| 128 | + notaPedido.flete === 1 ? 'Si' : 'No') | |
| 129 | + } | |
| 130 | + ]; | |
| 131 | + | |
| 132 | + function valorPrecioCondicion() { | |
| 133 | + if(notaPedido.idPrecioCondicion > 0) { | |
| 134 | + return notaPedido.precioCondicion.nombre; | |
| 135 | + } else { | |
| 136 | + return 'Ingreso Manual'; | |
| 137 | + } | |
| 150 | 138 | } |
| 151 | - ]; | |
| 152 | - | |
| 153 | - function valorPrecioCondicion() { | |
| 139 | + | |
| 140 | + if(notaPedido.flete === 1) { | |
| 141 | + var cabeceraBomba = { | |
| 142 | + label: 'Bomba:', | |
| 143 | + valor: notaPedido.bomba === 1 ? 'Si' : 'No' | |
| 144 | + }; | |
| 145 | + if(notaPedido.kilometros) { | |
| 146 | + var cabeceraKilometros = { | |
| 147 | + label: 'Kilometros:', | |
| 148 | + valor: notaPedido.kilometros | |
| 149 | + }; | |
| 150 | + cabeceras.push(cabeceraKilometros); | |
| 151 | + } | |
| 152 | + cabeceras.push(cabeceraBomba); | |
| 153 | + } | |
| 154 | + | |
| 155 | + for (var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { | |
| 156 | + notaPedido.articulosNotaPedido[i].id = 0; | |
| 157 | + } | |
| 158 | + | |
| 159 | + $scope.articulosTabla = notaPedido.articulosNotaPedido; | |
| 160 | + remitoBusinessService.calcularArticulos($scope.articulosTabla, | |
| 161 | + notaPedido.cotizacion.VENDEDOR); | |
| 162 | + | |
| 154 | 163 | if(notaPedido.idPrecioCondicion > 0) { |
| 155 | - return notaPedido.precioCondicion.nombre; | |
| 164 | + $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | |
| 156 | 165 | } else { |
| 157 | - return 'Ingreso Manual'; | |
| 158 | - } | |
| 159 | - } | |
| 160 | - | |
| 161 | - if(notaPedido.flete === 1) { | |
| 162 | - var cabeceraBomba = { | |
| 163 | - label: 'Bomba:', | |
| 164 | - valor: notaPedido.bomba === 1 ? 'Si' : 'No' | |
| 165 | - }; | |
| 166 | - if(notaPedido.kilometros) { | |
| 167 | - var cabeceraKilometros = { | |
| 168 | - label: 'Kilometros:', | |
| 169 | - valor: notaPedido.kilometros | |
| 170 | - }; | |
| 171 | - cabeceras.push(cabeceraKilometros); | |
| 166 | + $scope.idLista = -1; | |
| 172 | 167 | } |
| 173 | - cabeceras.push(cabeceraBomba); | |
| 174 | - } | |
| 175 | - | |
| 176 | - for (var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { | |
| 177 | - notaPedido.articulosNotaPedido[i].id = 0; | |
| 168 | + | |
| 169 | + delete notaPedido.id; | |
| 170 | + $scope.remito = notaPedido; | |
| 171 | + $scope.remito.id = 0; | |
| 172 | + $scope.remito.moneda = notaPedido.cotizacion.moneda; | |
| 173 | + $scope.plazosPagos = notaPedido.notaPedidoPlazo; | |
| 174 | + addArrayCabecera(cabeceras); | |
| 175 | + | |
| 176 | + }, function() { | |
| 177 | + // funcion ejecutada cuando se cancela el modal | |
| 178 | 178 | } |
| 179 | - | |
| 180 | - $scope.articulosTabla = notaPedido.articulosNotaPedido; | |
| 181 | - remitoBusinessService.calcularArticulos($scope.articulosTabla, | |
| 182 | - notaPedido.cotizacion.VENDEDOR); | |
| 183 | - | |
| 184 | - if(notaPedido.idPrecioCondicion > 0) { | |
| 185 | - $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | |
| 186 | - } else { | |
| 187 | - $scope.idLista = -1; | |
| 188 | - } | |
| 189 | - | |
| 190 | - delete notaPedido.id; | |
| 191 | - $scope.remito = notaPedido; | |
| 192 | - $scope.remito.id = 0; | |
| 193 | - $scope.remito.moneda = notaPedido.cotizacion.moneda; | |
| 194 | - $scope.plazosPagos = notaPedido.notaPedidoPlazo; | |
| 195 | - addArrayCabecera(cabeceras); | |
| 196 | - | |
| 197 | - }, function() { | |
| 198 | - // funcion ejecutada cuando se cancela el modal | |
| 199 | - } | |
| 200 | - ); | |
| 179 | + ); | |
| 180 | + } | |
| 201 | 181 | }; |
| 202 | 182 | |
| 203 | 183 | $scope.seleccionarRemito = function() { |
| ... | ... | @@ -431,7 +411,7 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 431 | 411 | ); |
| 432 | 412 | }; |
| 433 | 413 | |
| 434 | - $scope.seleccionarArticulo = function() { | |
| 414 | + $scope.seleccionarProductos = function() { | |
| 435 | 415 | if ($scope.idLista === undefined) { |
| 436 | 416 | focaModalService.alert( |
| 437 | 417 | 'Primero seleccione una lista de precio y condicion'); |
| ... | ... | @@ -486,65 +466,71 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 486 | 466 | }; |
| 487 | 467 | |
| 488 | 468 | $scope.seleccionarVendedor = function() { |
| 489 | - var modalInstance = $uibModal.open( | |
| 490 | - { | |
| 491 | - ariaLabelledBy: 'Busqueda de Vendedores', | |
| 492 | - templateUrl: 'modal-vendedores.html', | |
| 493 | - controller: 'modalVendedoresCtrl', | |
| 494 | - size: 'lg' | |
| 495 | - } | |
| 496 | - ); | |
| 497 | - modalInstance.result.then( | |
| 498 | - function(vendedor) { | |
| 499 | - addCabecera('Vendedor:', vendedor.NomVen); | |
| 500 | - $scope.remito.idVendedor = vendedor.CodVen; | |
| 501 | - }, function() { | |
| 502 | - | |
| 503 | - } | |
| 504 | - ); | |
| 469 | + if(varlidarRemitoFacturado){ | |
| 470 | + var modalInstance = $uibModal.open( | |
| 471 | + { | |
| 472 | + ariaLabelledBy: 'Busqueda de Vendedores', | |
| 473 | + templateUrl: 'modal-vendedores.html', | |
| 474 | + controller: 'modalVendedoresCtrl', | |
| 475 | + size: 'lg' | |
| 476 | + } | |
| 477 | + ); | |
| 478 | + modalInstance.result.then( | |
| 479 | + function(vendedor) { | |
| 480 | + addCabecera('Vendedor:', vendedor.NomVen); | |
| 481 | + $scope.remito.idVendedor = vendedor.CodVen; | |
| 482 | + }, function() { | |
| 483 | + | |
| 484 | + } | |
| 485 | + ); | |
| 486 | + } | |
| 505 | 487 | }; |
| 506 | 488 | |
| 507 | 489 | $scope.seleccionarProveedor = function() { |
| 508 | - var modalInstance = $uibModal.open( | |
| 509 | - { | |
| 510 | - ariaLabelledBy: 'Busqueda de Proveedor', | |
| 511 | - templateUrl: 'modal-proveedor.html', | |
| 512 | - controller: 'focaModalProveedorCtrl', | |
| 513 | - size: 'lg', | |
| 514 | - resolve: { | |
| 515 | - transportista: function() { | |
| 516 | - return false; | |
| 490 | + if(varlidarRemitoFacturado) { | |
| 491 | + var modalInstance = $uibModal.open( | |
| 492 | + { | |
| 493 | + ariaLabelledBy: 'Busqueda de Proveedor', | |
| 494 | + templateUrl: 'modal-proveedor.html', | |
| 495 | + controller: 'focaModalProveedorCtrl', | |
| 496 | + size: 'lg', | |
| 497 | + resolve: { | |
| 498 | + transportista: function() { | |
| 499 | + return false; | |
| 500 | + } | |
| 517 | 501 | } |
| 518 | 502 | } |
| 519 | - } | |
| 520 | - ); | |
| 521 | - modalInstance.result.then( | |
| 522 | - function(proveedor) { | |
| 523 | - $scope.remito.idProveedor = proveedor.COD; | |
| 524 | - addCabecera('Proveedor:', proveedor.NOM); | |
| 525 | - }, function() { | |
| 526 | - | |
| 527 | - } | |
| 528 | - ); | |
| 503 | + ); | |
| 504 | + modalInstance.result.then( | |
| 505 | + function(proveedor) { | |
| 506 | + $scope.remito.idProveedor = proveedor.COD; | |
| 507 | + addCabecera('Proveedor:', proveedor.NOM); | |
| 508 | + }, function() { | |
| 509 | + | |
| 510 | + } | |
| 511 | + ); | |
| 512 | + } | |
| 529 | 513 | }; |
| 530 | 514 | |
| 531 | 515 | $scope.seleccionarCliente = function() { |
| 532 | 516 | |
| 533 | - var modalInstance = $uibModal.open( | |
| 534 | - { | |
| 535 | - ariaLabelledBy: 'Busqueda de Cliente', | |
| 536 | - templateUrl: 'foca-busqueda-cliente-modal.html', | |
| 537 | - controller: 'focaBusquedaClienteModalController', | |
| 538 | - size: 'lg' | |
| 539 | - } | |
| 540 | - ); | |
| 541 | - modalInstance.result.then( | |
| 542 | - function(cliente) { | |
| 543 | - $scope.abrirModalDomicilios(cliente); | |
| 544 | - }, function() { | |
| 545 | - | |
| 546 | - } | |
| 547 | - ); | |
| 517 | + if(varlidarRemitoFacturado()) { | |
| 518 | + var modalInstance = $uibModal.open( | |
| 519 | + { | |
| 520 | + ariaLabelledBy: 'Busqueda de Cliente', | |
| 521 | + templateUrl: 'foca-busqueda-cliente-modal.html', | |
| 522 | + controller: 'focaBusquedaClienteModalController', | |
| 523 | + size: 'lg' | |
| 524 | + } | |
| 525 | + ); | |
| 526 | + modalInstance.result.then( | |
| 527 | + function(cliente) { | |
| 528 | + $scope.abrirModalDomicilios(cliente); | |
| 529 | + }, function() { | |
| 530 | + | |
| 531 | + } | |
| 532 | + ); | |
| 533 | + } | |
| 548 | 534 | }; |
| 549 | 535 | |
| 550 | 536 | $scope.abrirModalDomicilios = function(cliente) { |
| ... | ... | @@ -605,107 +591,114 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 605 | 591 | } |
| 606 | 592 | }; |
| 607 | 593 | |
| 608 | - $scope.abrirModalListaPrecio = function() { | |
| 609 | - var modalInstance = $uibModal.open( | |
| 610 | - { | |
| 611 | - ariaLabelledBy: 'Busqueda de Precio Condiciรณn', | |
| 612 | - templateUrl: 'modal-precio-condicion.html', | |
| 613 | - controller: 'focaModalPrecioCondicionController', | |
| 614 | - size: 'lg' | |
| 615 | - } | |
| 616 | - ); | |
| 617 | - modalInstance.result.then( | |
| 618 | - function(precioCondicion) { | |
| 619 | - var cabecera = ''; | |
| 620 | - var plazosConcat = ''; | |
| 621 | - if(!Array.isArray(precioCondicion)) { | |
| 622 | - $scope.remito.idPrecioCondicion = precioCondicion.id; | |
| 623 | - $scope.plazosPagos = precioCondicion.plazoPago; | |
| 624 | - $scope.idLista = precioCondicion.idListaPrecio; | |
| 625 | - for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | |
| 626 | - plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | |
| 627 | - } | |
| 628 | - cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | |
| 629 | - } else { //Cuando se ingresan los plazos manualmente | |
| 630 | - $scope.remito.idPrecioCondicion = 0; | |
| 631 | - $scope.idLista = -1; //-1, el modal productos busca todos los productos | |
| 632 | - $scope.plazosPagos = precioCondicion; | |
| 633 | - for(var j = 0; j < precioCondicion.length; j++) { | |
| 634 | - plazosConcat += precioCondicion[j].dias + ' '; | |
| 594 | + $scope.seleccionarPreciosYCondiciones = function() { | |
| 595 | + if(varlidarRemitoFacturado){ | |
| 596 | + var modalInstance = $uibModal.open( | |
| 597 | + { | |
| 598 | + ariaLabelledBy: 'Busqueda de Precio Condiciรณn', | |
| 599 | + templateUrl: 'modal-precio-condicion.html', | |
| 600 | + controller: 'focaModalPrecioCondicionController', | |
| 601 | + size: 'lg' | |
| 602 | + } | |
| 603 | + ); | |
| 604 | + modalInstance.result.then( | |
| 605 | + function(precioCondicion) { | |
| 606 | + var cabecera = ''; | |
| 607 | + var plazosConcat = ''; | |
| 608 | + if(!Array.isArray(precioCondicion)) { | |
| 609 | + $scope.remito.idPrecioCondicion = precioCondicion.id; | |
| 610 | + $scope.plazosPagos = precioCondicion.plazoPago; | |
| 611 | + $scope.idLista = precioCondicion.idListaPrecio; | |
| 612 | + for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | |
| 613 | + plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | |
| 614 | + } | |
| 615 | + cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | |
| 616 | + } else { //Cuando se ingresan los plazos manualmente | |
| 617 | + $scope.remito.idPrecioCondicion = 0; | |
| 618 | + //-1, el modal productos busca todos los productos | |
| 619 | + $scope.idLista = -1; | |
| 620 | + $scope.plazosPagos = precioCondicion; | |
| 621 | + for(var j = 0; j < precioCondicion.length; j++) { | |
| 622 | + plazosConcat += precioCondicion[j].dias + ' '; | |
| 623 | + } | |
| 624 | + cabecera = 'Ingreso manual ' + plazosConcat.trim(); | |
| 635 | 625 | } |
| 636 | - cabecera = 'Ingreso manual ' + plazosConcat.trim(); | |
| 626 | + $scope.articulosTabla = []; | |
| 627 | + addCabecera('Precios y condiciones:', cabecera); | |
| 628 | + }, function() { | |
| 629 | + | |
| 637 | 630 | } |
| 638 | - $scope.articulosTabla = []; | |
| 639 | - addCabecera('Precios y condiciones:', cabecera); | |
| 640 | - }, function() { | |
| 641 | - | |
| 642 | - } | |
| 643 | - ); | |
| 631 | + ); | |
| 632 | + } | |
| 644 | 633 | }; |
| 645 | 634 | |
| 646 | - $scope.abrirModalFlete = function() { | |
| 647 | - var modalInstance = $uibModal.open( | |
| 648 | - { | |
| 649 | - ariaLabelledBy: 'Busqueda de Flete', | |
| 650 | - templateUrl: 'modal-flete.html', | |
| 651 | - controller: 'focaModalFleteController', | |
| 652 | - size: 'lg', | |
| 653 | - resolve: { | |
| 654 | - parametrosFlete: | |
| 655 | - function() { | |
| 656 | - return { | |
| 657 | - flete: $scope.remito.flete ? '1' : | |
| 658 | - ($scope.remito.fob ? 'FOB' : | |
| 659 | - ($scope.remito.flete === undefined ? null : '0')), | |
| 660 | - bomba: $scope.remito.bomba ? '1' : | |
| 661 | - ($scope.remito.bomba === undefined ? null : '0'), | |
| 662 | - kilometros: $scope.remito.kilometros | |
| 663 | - }; | |
| 664 | - } | |
| 635 | + $scope.seleccionarFlete = function() { | |
| 636 | + if(varlidarRemitoFacturado){ | |
| 637 | + var modalInstance = $uibModal.open( | |
| 638 | + { | |
| 639 | + ariaLabelledBy: 'Busqueda de Flete', | |
| 640 | + templateUrl: 'modal-flete.html', | |
| 641 | + controller: 'focaModalFleteController', | |
| 642 | + size: 'lg', | |
| 643 | + resolve: { | |
| 644 | + parametrosFlete: | |
| 645 | + function() { | |
| 646 | + return { | |
| 647 | + flete: $scope.remito.flete ? '1' : | |
| 648 | + ($scope.remito.fob ? 'FOB' : | |
| 649 | + ($scope.remito.flete === undefined ? null : '0')), | |
| 650 | + bomba: $scope.remito.bomba ? '1' : | |
| 651 | + ($scope.remito.bomba === undefined ? null : '0'), | |
| 652 | + kilometros: $scope.remito.kilometros | |
| 653 | + }; | |
| 654 | + } | |
| 655 | + } | |
| 665 | 656 | } |
| 666 | - } | |
| 667 | - ); | |
| 668 | - modalInstance.result.then( | |
| 669 | - function(datos) { | |
| 670 | - $scope.remito.flete = datos.flete; | |
| 671 | - $scope.remito.fob = datos.FOB; | |
| 672 | - $scope.remito.bomba = datos.bomba; | |
| 673 | - $scope.remito.kilometros = datos.kilometros; | |
| 674 | - | |
| 675 | - addCabecera('Flete:', datos.flete ? 'Si' : | |
| 676 | - ($scope.remito.fob ? 'FOB' : 'No')); | |
| 677 | - if(datos.flete) { | |
| 678 | - addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | |
| 679 | - addCabecera('Kilometros:', datos.kilometros); | |
| 680 | - } else { | |
| 681 | - removeCabecera('Bomba:'); | |
| 682 | - removeCabecera('Kilometros:'); | |
| 683 | - $scope.remito.fob = false; | |
| 684 | - $scope.remito.bomba = false; | |
| 685 | - $scope.remito.kilometros = null; | |
| 657 | + ); | |
| 658 | + modalInstance.result.then( | |
| 659 | + function(datos) { | |
| 660 | + $scope.remito.flete = datos.flete; | |
| 661 | + $scope.remito.fob = datos.FOB; | |
| 662 | + $scope.remito.bomba = datos.bomba; | |
| 663 | + $scope.remito.kilometros = datos.kilometros; | |
| 664 | + | |
| 665 | + addCabecera('Flete:', datos.flete ? 'Si' : | |
| 666 | + ($scope.remito.fob ? 'FOB' : 'No')); | |
| 667 | + if(datos.flete) { | |
| 668 | + addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | |
| 669 | + addCabecera('Kilometros:', datos.kilometros); | |
| 670 | + } else { | |
| 671 | + removeCabecera('Bomba:'); | |
| 672 | + removeCabecera('Kilometros:'); | |
| 673 | + $scope.remito.fob = false; | |
| 674 | + $scope.remito.bomba = false; | |
| 675 | + $scope.remito.kilometros = null; | |
| 676 | + } | |
| 677 | + }, function() { | |
| 678 | + | |
| 686 | 679 | } |
| 687 | - }, function() { | |
| 688 | - | |
| 689 | - } | |
| 690 | - ); | |
| 680 | + ); | |
| 681 | + } | |
| 691 | 682 | }; |
| 692 | 683 | |
| 693 | - $scope.abrirModalMoneda = function() { | |
| 694 | - var modalInstance = $uibModal.open( | |
| 695 | - { | |
| 696 | - ariaLabelledBy: 'Busqueda de Moneda', | |
| 697 | - templateUrl: 'modal-moneda.html', | |
| 698 | - controller: 'focaModalMonedaController', | |
| 699 | - size: 'lg' | |
| 700 | - } | |
| 701 | - ); | |
| 702 | - modalInstance.result.then( | |
| 703 | - function(moneda) { | |
| 704 | - $scope.abrirModalCotizacion(moneda); | |
| 705 | - }, function() { | |
| 706 | - | |
| 707 | - } | |
| 708 | - ); | |
| 684 | + $scope.seleccionarMoneda = function() { | |
| 685 | + if(varlidarRemitoFacturado){ | |
| 686 | + var modalInstance = $uibModal.open( | |
| 687 | + { | |
| 688 | + ariaLabelledBy: 'Busqueda de Moneda', | |
| 689 | + templateUrl: 'modal-moneda.html', | |
| 690 | + controller: 'focaModalMonedaController', | |
| 691 | + size: 'lg' | |
| 692 | + } | |
| 693 | + ); | |
| 694 | + modalInstance.result.then( | |
| 695 | + function(moneda) { | |
| 696 | + $scope.abrirModalCotizacion(moneda); | |
| 697 | + }, function() { | |
| 698 | + | |
| 699 | + } | |
| 700 | + ); | |
| 701 | + } | |
| 709 | 702 | }; |
| 710 | 703 | |
| 711 | 704 | $scope.abrirModalCotizacion = function(moneda) { |
| ... | ... | @@ -863,12 +856,12 @@ angular.module('focaCrearRemito') .controller('remitoController', |
| 863 | 856 | return relleno; |
| 864 | 857 | } |
| 865 | 858 | |
| 866 | - function varlidarRemitoFacturado(funcion) { | |
| 867 | - if($scope.remito.estado === 5) { | |
| 859 | + function varlidarRemitoFacturado() { | |
| 860 | + if($scope.remito.estado !== 5) { | |
| 861 | + return true; | |
| 862 | + }else{ | |
| 868 | 863 | focaModalService.alert('No se puede editar un remito facturado'); |
| 869 | - } | |
| 870 | - else { | |
| 871 | - funcion(); | |
| 864 | + return false(); | |
| 872 | 865 | } |
| 873 | 866 | } |
| 874 | 867 | } |
src/js/service.js
| ... | ... | @@ -55,6 +55,10 @@ angular.module('focaCrearRemito') |
| 55 | 55 | }, |
| 56 | 56 | getNumeroRemito: function() { |
| 57 | 57 | return $http.get(route + '/remito/numero-siguiente'); |
| 58 | + }, | |
| 59 | + getBotonera: function() { | |
| 60 | + return ['Nota pedido', 'Vendedor', 'Cliente', 'Proveedor', | |
| 61 | + 'Moneda', 'Precios y condiciones', 'Flete', 'Productos']; | |
| 58 | 62 | } |
| 59 | 63 | }; |
| 60 | 64 | }]); |
src/views/remito.html
| ... | ... | @@ -83,22 +83,7 @@ |
| 83 | 83 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> |
| 84 | 84 | <div class="row p-1 botonera-secundaria px-5 py-2"> |
| 85 | 85 | <div class="col-12"> |
| 86 | - <div class="row"> | |
| 87 | - <div | |
| 88 | - class="col-6 col-sm-2 px-1 py-1 m-auto m-md-0" | |
| 89 | - ng-repeat="boton in botonera" | |
| 90 | - ng-class="{'d-none d-md-grid': boton.texto == ''}"> | |
| 91 | - <button | |
| 92 | - type="button" | |
| 93 | - class="btn btn-default btn-block btn-xs text-center py-1 rounded border border-light" | |
| 94 | - ng-click="boton.accion()" | |
| 95 | - ng-class="{'d-sm-block h-100': boton.texto == ''}" | |
| 96 | - > | |
| 97 | - <img src="{{boton.imagen}}" alt="" ng-if="boton.imagen"> | |
| 98 | - <span>{{boton.texto}}</span> | |
| 99 | - </button> | |
| 100 | - </div> | |
| 101 | - </div> | |
| 86 | + <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> | |
| 102 | 87 | </div> |
| 103 | 88 | </div> |
| 104 | 89 | <!-- PC --> |