Commit 8c0920d722faa83752add8f7e9f70e99b366b4aa
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'upstream/master'
Showing
9 changed files
Show diff stats
gulpfile.js
| ... | ... | @@ -46,7 +46,8 @@ gulp.task('uglify', ['templates'], function() { |
| 46 | 46 | replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ |
| 47 | 47 | '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+ |
| 48 | 48 | '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+ |
| 49 | - '"angular-ladda"', ''), | |
| 49 | + '"focaModalMoneda","focaModalCotizacion","focaSeguimiento","angular-ladda",'+ | |
| 50 | + '"cordovaGeolocationModule"', ''), | |
| 50 | 51 | gulp.dest(paths.dist) |
| 51 | 52 | ] |
| 52 | 53 | ); |
index.html
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | <script src="node_modules/ladda/dist/spin.min.js"></script> |
| 18 | 18 | <script src="node_modules/ladda/dist/ladda.min.js"></script> |
| 19 | 19 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> |
| 20 | + <script src="vendor/cordovaGeolocationModule.min.js"></script> | |
| 20 | 21 | |
| 21 | 22 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> |
| 22 | 23 | <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script> |
| ... | ... | @@ -29,10 +30,12 @@ |
| 29 | 30 | <script src="node_modules/foca-modal-domicilio/dist/foca-modal-domicilios.min.js"></script> |
| 30 | 31 | <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script> |
| 31 | 32 | <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script> |
| 33 | + <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script> | |
| 32 | 34 | |
| 33 | 35 | <script src="src/js/app.js"></script> |
| 34 | 36 | <script src="src/js/controller.js"></script> |
| 35 | 37 | <script src="src/js/service.js"></script> |
| 38 | + <script src="src/js/businessService.js"></script> | |
| 36 | 39 | <script src="src/js/route.js"></script> |
| 37 | 40 | |
| 38 | 41 | <script src="src/etc/develop.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-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+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" | |
| 12 | 12 | }, |
| 13 | 13 | "pre-commit": [ |
| 14 | 14 | "gulp-pre-commit" |
| ... | ... | @@ -24,7 +24,8 @@ |
| 24 | 24 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", |
| 25 | 25 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", |
| 26 | 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 | + "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" | |
| 28 | 29 | }, |
| 29 | 30 | "devDependencies": { |
| 30 | 31 | "angular": "^1.7.5", |
| ... | ... | @@ -42,6 +43,7 @@ |
| 42 | 43 | "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", |
| 43 | 44 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", |
| 44 | 45 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", |
| 46 | + "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", | |
| 45 | 47 | "font-awesome": "^4.7.0", |
| 46 | 48 | "gulp": "^3.9.1", |
| 47 | 49 | "gulp-angular-templatecache": "^2.2.2", |
src/js/app.js
| ... | ... | @@ -10,7 +10,9 @@ angular.module('focaCrearNotaPedido', [ |
| 10 | 10 | 'focaDirectivas', |
| 11 | 11 | 'focaModal', |
| 12 | 12 | 'focaModalDomicilio', |
| 13 | - 'angular-ladda', | |
| 14 | 13 | 'focaModalMoneda', |
| 15 | - 'focaModalCotizacion' | |
| 14 | + 'focaModalCotizacion', | |
| 15 | + 'focaSeguimiento', | |
| 16 | + 'angular-ladda', | |
| 17 | + 'cordovaGeolocationModule' | |
| 16 | 18 | ]); |
src/js/businessService.js
| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | +angular.module('focaCrearNotaPedido') | |
| 2 | + .factory('notaPedidoBusinessService', [ | |
| 3 | + 'crearNotaPedidoService', | |
| 4 | + function(crearNotaPedidoService) { | |
| 5 | + return { | |
| 6 | + addArticulos: function(articulosNotaPedido, idNotaPedido, cotizacion) { | |
| 7 | + for(var i = 0; i < articulosNotaPedido.length; i++) { | |
| 8 | + delete articulosNotaPedido[i].editCantidad; | |
| 9 | + delete articulosNotaPedido[i].editPrecio; | |
| 10 | + articulosNotaPedido[i].idNotaPedido = idNotaPedido; | |
| 11 | + articulosNotaPedido[i].precio = articulosNotaPedido[i].precio * cotizacion; | |
| 12 | + crearNotaPedidoService.crearArticulosParaNotaPedido(articulosNotaPedido[i]); | |
| 13 | + } | |
| 14 | + }, | |
| 15 | + addEstado: function(idNotaPedido, idVendedor) { | |
| 16 | + var date = new Date(); | |
| 17 | + var estado = { | |
| 18 | + idNotaPedido: idNotaPedido, | |
| 19 | + fecha: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | |
| 20 | + .toISOString().slice(0, 19).replace('T', ' '), | |
| 21 | + estado: 0, | |
| 22 | + idVendedor: idVendedor | |
| 23 | + }; | |
| 24 | + crearNotaPedidoService.crearEstadoParaNotaPedido(estado); | |
| 25 | + } | |
| 26 | + }; | |
| 27 | + }]); |
src/js/controller.js
| 1 | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 2 | 2 | [ |
| 3 | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', |
| 4 | - 'focaModalService', | |
| 4 | + 'focaModalService', 'focaSeguimientoService', 'notaPedidoBusinessService', | |
| 5 | 5 | function( |
| 6 | - $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService | |
| 6 | + $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, | |
| 7 | + focaSeguimientoService, notaPedidoBusinessService | |
| 7 | 8 | ) { |
| 8 | 9 | $scope.botonera = [ |
| 9 | 10 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
| ... | ... | @@ -25,38 +26,32 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 25 | 26 | maxDate: new Date(), |
| 26 | 27 | minDate: new Date(2010, 0, 1) |
| 27 | 28 | }; |
| 28 | - $scope.crearObjetoNotaPedido = function() { | |
| 29 | - $scope.notaPedido = { | |
| 30 | - vendedor: {}, | |
| 31 | - cliente: {}, | |
| 32 | - proveedor: {}, | |
| 33 | - domicilio: {dom: ''}, | |
| 34 | - moneda: {}, | |
| 35 | - cotizacion: {} | |
| 36 | - }; | |
| 37 | - }; | |
| 38 | 29 | |
| 39 | - //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | |
| 40 | - $scope.obtenerMonedaPorDefecto = function() { | |
| 41 | - crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { | |
| 42 | - monedaPorDefecto = { | |
| 43 | - id: res.data[0].ID, | |
| 44 | - detalle: res.data[0].DETALLE, | |
| 45 | - simbolo: res.data[0].SIMBOLO, | |
| 46 | - cotizaciones: res.data[0].cotizaciones | |
| 47 | - }; | |
| 48 | - addCabecera('Moneda:', monedaPorDefecto.detalle); | |
| 49 | - addCabecera('Fecha cotizacion:', | |
| 50 | - new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); | |
| 51 | - addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); | |
| 52 | - $scope.notaPedido.moneda = monedaPorDefecto; | |
| 53 | - $scope.notaPedido.cotizacion.id = monedaPorDefecto.cotizaciones[0].ID; | |
| 54 | - }); | |
| 30 | + $scope.notaPedido = { | |
| 31 | + vendedor: {}, | |
| 32 | + cliente: {}, | |
| 33 | + proveedor: {}, | |
| 34 | + domicilio: {dom: ''}, | |
| 35 | + moneda: {}, | |
| 36 | + cotizacion: {} | |
| 55 | 37 | }; |
| 56 | - | |
| 57 | 38 | var monedaPorDefecto; |
| 58 | - $scope.crearObjetoNotaPedido(); | |
| 59 | - $scope.obtenerMonedaPorDefecto(); | |
| 39 | + //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | |
| 40 | + crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { | |
| 41 | + monedaPorDefecto = { | |
| 42 | + id: res.data[0].ID, | |
| 43 | + detalle: res.data[0].DETALLE, | |
| 44 | + simbolo: res.data[0].SIMBOLO, | |
| 45 | + cotizaciones: res.data[0].cotizaciones | |
| 46 | + }; | |
| 47 | + addCabecera('Moneda:', monedaPorDefecto.detalle); | |
| 48 | + addCabecera('Fecha cotizacion:', | |
| 49 | + new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); | |
| 50 | + addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); | |
| 51 | + $scope.notaPedido.moneda = monedaPorDefecto; | |
| 52 | + $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; | |
| 53 | + }); | |
| 54 | + | |
| 60 | 55 | $scope.cabecera = []; |
| 61 | 56 | $scope.showCabecera = true; |
| 62 | 57 | |
| ... | ... | @@ -118,7 +113,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 118 | 113 | if(!$scope.notaPedido.vendedor.codigo) { |
| 119 | 114 | focaModalService.alert('Ingrese Vendedor'); |
| 120 | 115 | return; |
| 121 | - } else if(!$scope.notaPedido.cliente.id) { | |
| 116 | + } else if(!$scope.notaPedido.cliente.cod) { | |
| 122 | 117 | focaModalService.alert('Ingrese Cliente'); |
| 123 | 118 | return; |
| 124 | 119 | } else if(!$scope.notaPedido.proveedor.codigo) { |
| ... | ... | @@ -127,20 +122,22 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 127 | 122 | } else if(!$scope.notaPedido.moneda.id) { |
| 128 | 123 | focaModalService.alert('Ingrese Moneda'); |
| 129 | 124 | return; |
| 130 | - } else if(!$scope.notaPedido.cotizacion.id) { | |
| 125 | + } else if(!$scope.notaPedido.cotizacion.ID) { | |
| 131 | 126 | focaModalService.alert('Ingrese Cotización'); |
| 132 | 127 | return; |
| 133 | 128 | } else if(!$scope.plazosPagos) { |
| 134 | 129 | focaModalService.alert('Ingrese Precios y Condiciones'); |
| 135 | 130 | return; |
| 136 | - } else if(!$scope.notaPedido.flete) { | |
| 131 | + } else if( | |
| 132 | + $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) | |
| 133 | + { | |
| 137 | 134 | focaModalService.alert('Ingrese Flete'); |
| 138 | 135 | return; |
| 139 | 136 | } else if(!$scope.notaPedido.domicilio.id) { |
| 140 | 137 | focaModalService.aler('Ingrese Domicilio'); |
| 141 | 138 | return; |
| 142 | 139 | } else if($scope.articulosTabla.length === 0) { |
| 143 | - focaModalService.alert('Debe cargar almenos un articulo'); | |
| 140 | + focaModalService.alert('Debe cargar al menos un articulo'); | |
| 144 | 141 | return; |
| 145 | 142 | } |
| 146 | 143 | var date = new Date(); |
| ... | ... | @@ -149,27 +146,25 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 149 | 146 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
| 150 | 147 | .toISOString().slice(0, 19).replace('T', ' '), |
| 151 | 148 | idVendedor: $scope.notaPedido.vendedor.codigo, |
| 152 | - idCliente: $scope.notaPedido.cliente.id, | |
| 149 | + idCliente: $scope.notaPedido.cliente.cod, | |
| 150 | + nombreCliente: $scope.notaPedido.cliente.nom, | |
| 151 | + cuitCliente: $scope.notaPedido.cliente.cuit, | |
| 153 | 152 | idProveedor: $scope.notaPedido.proveedor.codigo, |
| 154 | 153 | idDomicilio: $scope.notaPedido.domicilio.id, |
| 155 | - idCotizacion: $scope.notaPedido.cotizacion.id, | |
| 156 | - flete: parseInt($scope.notaPedido.flete), | |
| 157 | - fob: parseInt($scope.notaPedido.fob), | |
| 158 | - bomba: parseInt($scope.notaPedido.bomba), | |
| 154 | + idCotizacion: $scope.notaPedido.cotizacion.ID, | |
| 155 | + cotizacion: $scope.notaPedido.cotizacion.COTIZACION, | |
| 156 | + flete: $scope.notaPedido.flete, | |
| 157 | + fob: $scope.notaPedido.fob, | |
| 158 | + bomba: $scope.notaPedido.bomba, | |
| 159 | 159 | kilometros: $scope.notaPedido.kilometros, |
| 160 | + estado: 0, | |
| 160 | 161 | total: $scope.getTotal() |
| 161 | 162 | }; |
| 162 | 163 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
| 163 | 164 | function(data) { |
| 164 | - | |
| 165 | - var articulosNotaPedido = $scope.articulosTabla; | |
| 166 | - for(var i = 0; i < articulosNotaPedido.length; i++) { | |
| 167 | - delete articulosNotaPedido[i].editCantidad; | |
| 168 | - delete articulosNotaPedido[i].editPrecio; | |
| 169 | - articulosNotaPedido[i].idNotaPedido = data.data.id; | |
| 170 | - crearNotaPedidoService | |
| 171 | - .crearArticulosParaNotaPedido(articulosNotaPedido[i]); | |
| 172 | - } | |
| 165 | + notaPedidoBusinessService.addArticulos($scope.articulosTabla, | |
| 166 | + data.data.id, $scope.notaPedido.cotizacion.COTIZACION); | |
| 167 | + focaSeguimientoService.guardarPosicion('crear nota pedido', ''); | |
| 173 | 168 | var plazos = $scope.plazosPagos; |
| 174 | 169 | for(var j = 0; j < plazos.length; j++) { |
| 175 | 170 | var json = { |
| ... | ... | @@ -178,10 +173,25 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 178 | 173 | }; |
| 179 | 174 | crearNotaPedidoService.crearPlazosParaNotaPedido(json); |
| 180 | 175 | } |
| 176 | + notaPedidoBusinessService.addEstado(data.data.id, | |
| 177 | + $scope.notaPedido.vendedor.codigo); | |
| 178 | + | |
| 181 | 179 | focaModalService.alert('Nota pedido creada'); |
| 182 | - $scope.obtenerMonedaPorDefecto(); | |
| 183 | - $scope.crearObjetoNotaPedido(); | |
| 184 | 180 | $scope.cabecera = []; |
| 181 | + addCabecera('Moneda:', $scope.notaPedido.moneda.detalle); | |
| 182 | + addCabecera( | |
| 183 | + 'Fecha cotizacion:', | |
| 184 | + $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') | |
| 185 | + ); | |
| 186 | + addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.COTIZACION); | |
| 187 | + $scope.notaPedido.vendedor = {}; | |
| 188 | + $scope.notaPedido.cliente = {}; | |
| 189 | + $scope.notaPedido.proveedor = {}; | |
| 190 | + $scope.notaPedido.domicilio = {}; | |
| 191 | + $scope.notaPedido.flete = null; | |
| 192 | + $scope.notaPedido.fob = null; | |
| 193 | + $scope.notaPedido.bomba = null; | |
| 194 | + $scope.notaPedido.kilometros = null; | |
| 185 | 195 | $scope.articulosTabla = []; |
| 186 | 196 | } |
| 187 | 197 | ); |
| ... | ... | @@ -198,7 +208,13 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 198 | 208 | ariaLabelledBy: 'Busqueda de Productos', |
| 199 | 209 | templateUrl: 'modal-busqueda-productos.html', |
| 200 | 210 | controller: 'modalBusquedaProductosCtrl', |
| 201 | - resolve: { idLista: function() { return $scope.idLista; } }, | |
| 211 | + resolve: { | |
| 212 | + parametroProducto: { | |
| 213 | + idLista: $scope.idLista, | |
| 214 | + cotizacion: $scope.notaPedido.cotizacion.COTIZACION, | |
| 215 | + simbolo: $scope.notaPedido.moneda.simbolo | |
| 216 | + } | |
| 217 | + }, | |
| 202 | 218 | size: 'lg' |
| 203 | 219 | } |
| 204 | 220 | ); |
| ... | ... | @@ -213,7 +229,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 213 | 229 | descripcion: producto.descripcion, |
| 214 | 230 | item: $scope.articulosTabla.length + 1, |
| 215 | 231 | nombre: producto.descripcion, |
| 216 | - precio: parseFloat(producto.precio.toFixed(2)), | |
| 232 | + precio: parseFloat(producto.precio.toFixed(4)), | |
| 217 | 233 | costoUnitario: producto.costo, |
| 218 | 234 | editCantidad: false, |
| 219 | 235 | editPrecio: false |
| ... | ... | @@ -276,21 +292,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 276 | 292 | ); |
| 277 | 293 | modalInstance.result.then( |
| 278 | 294 | function(cliente) { |
| 279 | - crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( | |
| 280 | - function(data) { | |
| 281 | - if(data.data.length === 0){ | |
| 282 | - focaModalService | |
| 283 | - .alert('El cliente no tienen domicilios de entrega') | |
| 284 | - .then( | |
| 285 | - function() { | |
| 286 | - $scope.seleccionarCliente(); | |
| 287 | - } | |
| 288 | - ); | |
| 289 | - return; | |
| 290 | - } | |
| 291 | - $scope.abrirModalDomicilios(cliente); | |
| 292 | - } | |
| 293 | - ); | |
| 295 | + $scope.abrirModalDomicilios(cliente); | |
| 294 | 296 | }, function() { |
| 295 | 297 | |
| 296 | 298 | } |
| ... | ... | @@ -310,7 +312,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 310 | 312 | modalInstanceDomicilio.result.then( |
| 311 | 313 | function(domicilio) { |
| 312 | 314 | $scope.notaPedido.domicilio.id = domicilio.id; |
| 313 | - $scope.notaPedido.cliente.id = cliente.cod; | |
| 315 | + $scope.notaPedido.cliente = cliente; | |
| 316 | + | |
| 314 | 317 | addCabecera('Cliente:', cliente.nom); |
| 315 | 318 | addCabecera('Domicilio:', domicilio.dom); |
| 316 | 319 | }, function() { |
| ... | ... | @@ -393,8 +396,11 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 393 | 396 | parametrosFlete: |
| 394 | 397 | function() { |
| 395 | 398 | return { |
| 396 | - flete: $scope.notaPedido.flete, | |
| 397 | - bomba: $scope.notaPedido.bomba, | |
| 399 | + flete: $scope.notaPedido.flete ? '1' : | |
| 400 | + ($scope.notaPedido.fob ? 'FOB' : | |
| 401 | + ($scope.notaPedido.flete === undefined ? null : '0')), | |
| 402 | + bomba: $scope.notaPedido.bomba ? '1' : | |
| 403 | + ($scope.notaPedido.bomba === undefined ? null : '0'), | |
| 398 | 404 | kilometros: $scope.notaPedido.kilometros |
| 399 | 405 | }; |
| 400 | 406 | } |
| ... | ... | @@ -408,13 +414,17 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 408 | 414 | $scope.notaPedido.bomba = datos.bomba; |
| 409 | 415 | $scope.notaPedido.kilometros = datos.kilometros; |
| 410 | 416 | |
| 411 | - addCabecera('Flete:', datos.flete); | |
| 412 | - if(datos.flete === '1') { | |
| 413 | - addCabecera('Bomba:', datos.bomba); | |
| 417 | + addCabecera('Flete:', datos.flete ? 'Si' : | |
| 418 | + ($scope.notaPedido.fob ? 'FOB' : 'No')); | |
| 419 | + if(datos.flete) { | |
| 420 | + addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | |
| 414 | 421 | addCabecera('Kilometros:', datos.kilometros); |
| 415 | 422 | } else { |
| 416 | 423 | removeCabecera('Bomba:'); |
| 417 | 424 | removeCabecera('Kilometros:'); |
| 425 | + $scope.notaPedido.fob = false; | |
| 426 | + $scope.notaPedido.bomba = false; | |
| 427 | + $scope.notaPedido.kilometros = null; | |
| 418 | 428 | } |
| 419 | 429 | }, function() { |
| 420 | 430 | |
| ... | ... | @@ -433,7 +443,6 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 433 | 443 | ); |
| 434 | 444 | modalInstance.result.then( |
| 435 | 445 | function(moneda) { |
| 436 | - | |
| 437 | 446 | $scope.abrirModalCotizacion(moneda); |
| 438 | 447 | }, function() { |
| 439 | 448 | |
| ... | ... | @@ -453,14 +462,23 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
| 453 | 462 | ); |
| 454 | 463 | modalInstance.result.then( |
| 455 | 464 | function(cotizacion) { |
| 465 | + var articulosTablaTemp = $scope.articulosTabla; | |
| 466 | + for(var i = 0; i < articulosTablaTemp.length; i++) { | |
| 467 | + articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | |
| 468 | + $scope.notaPedido.cotizacion.COTIZACION; | |
| 469 | + articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | |
| 470 | + cotizacion.COTIZACION; | |
| 471 | + } | |
| 472 | + $scope.articulosTabla = articulosTablaTemp; | |
| 456 | 473 | $scope.notaPedido.moneda = { |
| 457 | 474 | id: moneda.ID, |
| 458 | 475 | detalle: moneda.DETALLE, |
| 459 | 476 | simbolo: moneda.SIMBOLO |
| 460 | 477 | }; |
| 461 | 478 | $scope.notaPedido.cotizacion = { |
| 462 | - id: cotizacion.ID, | |
| 463 | - cotizacion: cotizacion.COTIZACION | |
| 479 | + ID: cotizacion.ID, | |
| 480 | + COTIZACION: cotizacion.COTIZACION, | |
| 481 | + FECHA: cotizacion.FECHA | |
| 464 | 482 | }; |
| 465 | 483 | addCabecera('Moneda:', moneda.DETALLE); |
| 466 | 484 | addCabecera( |
src/js/service.js
| ... | ... | @@ -48,6 +48,9 @@ angular.module('focaCrearNotaPedido') |
| 48 | 48 | }, |
| 49 | 49 | getCotizacionByIdMoneda: function(id) { |
| 50 | 50 | return $http.get(route + '/moneda/' + id); |
| 51 | + }, | |
| 52 | + crearEstadoParaNotaPedido: function(estado) { | |
| 53 | + return $http.post(route + '/estado', {estado: estado}); | |
| 51 | 54 | } |
| 52 | 55 | }; |
| 53 | 56 | }]); |
src/views/nota-pedido.html
| ... | ... | @@ -124,7 +124,7 @@ |
| 124 | 124 | class="col" |
| 125 | 125 | ng-bind="articulo.sector + '-' + articulo.codigo" |
| 126 | 126 | ></td> |
| 127 | - <td | |
| 127 | + <td | |
| 128 | 128 | class="col-4" |
| 129 | 129 | ng-bind="articulo.descripcion" |
| 130 | 130 | ></td> |
| ... | ... | @@ -153,7 +153,7 @@ |
| 153 | 153 | class="form-control" |
| 154 | 154 | type="number" |
| 155 | 155 | min="1" |
| 156 | - step="0.01" | |
| 156 | + step="0.0001" | |
| 157 | 157 | foca-focus="articulo.editPrecio" |
| 158 | 158 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
| 159 | 159 | ng-focus="selectFocus($event)" |
| ... | ... | @@ -162,12 +162,12 @@ |
| 162 | 162 | class="selectable" |
| 163 | 163 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" |
| 164 | 164 | ng-hide="articulo.editPrecio" |
| 165 | - ng-bind="articulo.precio"> | |
| 165 | + ng-bind="articulo.precio | currency: notaPedido.moneda.simbolo : 4"> | |
| 166 | 166 | </i> |
| 167 | 167 | </td> |
| 168 | 168 | <td |
| 169 | 169 | class="col text-right" |
| 170 | - ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> | |
| 170 | + ng-bind="(articulo.precio * articulo.cantidad) | currency: notaPedido.moneda.simbolo"> | |
| 171 | 171 | </td> |
| 172 | 172 | <td class="text-center"> |
| 173 | 173 | <button |
| ... | ... | @@ -213,14 +213,14 @@ |
| 213 | 213 | <td class="col text-right"> |
| 214 | 214 | <input |
| 215 | 215 | class="form-control" |
| 216 | - ng-value="articuloACargar.precio | currency: '$'" | |
| 216 | + ng-value="articuloACargar.precio | currency: notaPedido.moneda.simbolo : 4" | |
| 217 | 217 | ng-show="idLista != -1" |
| 218 | 218 | readonly |
| 219 | 219 | > |
| 220 | 220 | <input |
| 221 | 221 | class="form-control" |
| 222 | 222 | type="number" |
| 223 | - step="0.01" | |
| 223 | + step="0.0001" | |
| 224 | 224 | ng-model="articuloACargar.precio" |
| 225 | 225 | esc-key="resetFilter()" |
| 226 | 226 | ng-keypress="agregarATabla($event.keyCode)" |
| ... | ... | @@ -230,7 +230,7 @@ |
| 230 | 230 | <td class="col text-right"> |
| 231 | 231 | <input |
| 232 | 232 | class="form-control" |
| 233 | - ng-value="getSubTotal() | currency: '$'" | |
| 233 | + ng-value="getSubTotal() | currency: notaPedido.moneda.simbolo" | |
| 234 | 234 | readonly |
| 235 | 235 | ></td> |
| 236 | 236 | <td class="text-center align-middle"> |
| ... | ... | @@ -254,14 +254,14 @@ |
| 254 | 254 | </tr> |
| 255 | 255 | <tr class="d-flex"> |
| 256 | 256 | <td colspan="4" class="no-border-top"> |
| 257 | - <strong>Cantidad Items:</strong> | |
| 257 | + <strong>Items:</strong> | |
| 258 | 258 | <a ng-bind="articulosTabla.length"></a> |
| 259 | 259 | </td> |
| 260 | 260 | <td class="text-right ml-auto table-celda-total no-border-top"> |
| 261 | 261 | <h3>Total:</h3> |
| 262 | 262 | </td> |
| 263 | 263 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
| 264 | - <h3>{{getTotal() | currency: '$'}}</h3> | |
| 264 | + <h3>{{getTotal() | currency: notaPedido.moneda.simbolo}}</h3> | |
| 265 | 265 | </td> |
| 266 | 266 | <td class="text-right no-border-top"> |
| 267 | 267 | <button |
| ... | ... | @@ -323,11 +323,11 @@ |
| 323 | 323 | <span ng-bind="'x' + articulo.cantidad"></span> |
| 324 | 324 | </div> |
| 325 | 325 | <div class="col-3 px-1 text-right"> |
| 326 | - <span ng-bind="articulo.precio | currency: '$'"></span> | |
| 326 | + <span ng-bind="articulo.precio | currency: notaPedido.moneda.simbolo : 4"></span> | |
| 327 | 327 | </div> |
| 328 | 328 | <div class="col px-1 text-right"> |
| 329 | 329 | <span |
| 330 | - ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'" | |
| 330 | + ng-bind="(articulo.precio * articulo.cantidad) | currency: notaPedido.moneda.simbolo" | |
| 331 | 331 | > |
| 332 | 332 | </span> |
| 333 | 333 | </div> |
| ... | ... | @@ -375,11 +375,11 @@ |
| 375 | 375 | > |
| 376 | 376 | </div> |
| 377 | 377 | <div class="col-3 px-1 text-right"> |
| 378 | - <span ng-bind="articuloACargar.precio | currency: '$'"></span> | |
| 378 | + <span ng-bind="articuloACargar.precio | currency: notaPedido.moneda.simbolo : 4"></span> | |
| 379 | 379 | </div> |
| 380 | 380 | <div class="col px-1 text-right"> |
| 381 | 381 | <span |
| 382 | - ng-bind="getSubTotal() | currency: '$'" | |
| 382 | + ng-bind="getSubTotal() | currency: notaPedido.moneda.simbolo" | |
| 383 | 383 | > |
| 384 | 384 | </span> |
| 385 | 385 | </div> |
| ... | ... | @@ -437,7 +437,7 @@ |
| 437 | 437 | <h3>Total:</h3> |
| 438 | 438 | </td> |
| 439 | 439 | <td class="table-celda-total text-right no-border-top"> |
| 440 | - <h3>{{getTotal() | currency: '$'}}</h3> | |
| 440 | + <h3>{{getTotal() | currency: notaPedido.moneda.simbolo}}</h3> | |
| 441 | 441 | </td> |
| 442 | 442 | </tr> |
| 443 | 443 | </tfoot> |
vendor/cordovaGeolocationModule.min.js
| ... | ... | @@ -0,0 +1 @@ |
| 1 | +var cordovaGeolocationModule=angular.module("cordovaGeolocationModule",[]);cordovaGeolocationModule.constant("cordovaGeolocationConstants",{apiVersion:"1.0.0",cordovaVersion:">=3.4.0"});cordovaGeolocationModule.factory("cordovaGeolocationService",["$rootScope","$log","cordovaGeolocationConstants",function(e,t,n){return{apiVersion:function(){t.debug("cordovaGeolocationService.apiVersion.");return n.apiVersion},cordovaVersion:function(){t.debug("cordovaGeolocationService.cordovaVersion.");return n.cordovaVersion},checkGeolocationAvailability:function(){t.debug("cordovaGeolocationService.checkGeolocationAvailability.");if(!navigator.geolocation){t.warn("Geolocation API is not available.");return false}return true},getCurrentPosition:function(n,r,i){t.debug("cordovaGeolocationService.getCurrentPosition.");if(!this.checkGeolocationAvailability()){return}navigator.geolocation.getCurrentPosition(function(t){e.$apply(n(t))},function(t){e.$apply(r(t))},i)},watchPosition:function(n,r,i){t.debug("cordovaGeolocationService.watchPosition.");if(!this.checkGeolocationAvailability()){return}return navigator.geolocation.watchPosition(function(t){e.$apply(n(t))},function(t){e.$apply(r(t))},i)},clearWatch:function(e){t.debug("cordovaGeolocationService.clearWatch.");if(!this.checkGeolocationAvailability()){return}navigator.geolocation.clearWatch(e)}}}]) | |
| 0 | 2 | \ No newline at end of file |