Commit fdc60f1cc4eec3cc6b51e07481d5752ede9c5847
1 parent
27cb854ca2
Exists in
master
Versión que no funciona.
Subido a pedido de Nicolás.
Showing
15 changed files
with
1590 additions
and
0 deletions
Show diff stats
.gitignore
.jshintrc
... | ... | @@ -0,0 +1,64 @@ |
1 | +{ | |
2 | + /* | |
3 | + * ENVIRONMENTS | |
4 | + * ================= | |
5 | + */ | |
6 | + | |
7 | + // Define globals exposed by modern browsers. | |
8 | + "browser": true, | |
9 | + | |
10 | + // Define globals exposed by jQuery. | |
11 | + "jquery": true, | |
12 | + | |
13 | + // Define globals exposed by Node.js. | |
14 | + "node": true, | |
15 | + | |
16 | + // Allow ES6. | |
17 | + "esversion": 6, | |
18 | + | |
19 | + /* | |
20 | + * ENFORCING OPTIONS | |
21 | + * ================= | |
22 | + */ | |
23 | + | |
24 | + // Force all variable names to use either camelCase style or UPPER_CASE | |
25 | + // with underscores. | |
26 | + "camelcase": true, | |
27 | + | |
28 | + // Prohibit use of == and != in favor of === and !==. | |
29 | + "eqeqeq": true, | |
30 | + | |
31 | + // Enforce tab width of 2 spaces. | |
32 | + "indent": 4, | |
33 | + | |
34 | + // Prohibit use of a variable before it is defined. | |
35 | + "latedef": false, | |
36 | + | |
37 | + // Enforce line length to 100 characters | |
38 | + "maxlen": 100, | |
39 | + | |
40 | + // Require capitalized names for constructor functions. | |
41 | + "newcap": true, | |
42 | + | |
43 | + // Enforce use of single quotation marks for strings. | |
44 | + "quotmark": "single", | |
45 | + | |
46 | + // Enforce placing 'use strict' at the top function scope | |
47 | + "strict": false, | |
48 | + | |
49 | + // Prohibit use of explicitly undeclared variables. | |
50 | + "undef": true, | |
51 | + | |
52 | + // Warn when variables are defined but never used. | |
53 | + "unused": true, | |
54 | + | |
55 | + // Para que funcione en angular | |
56 | + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], | |
57 | + /* | |
58 | + * RELAXING OPTIONS | |
59 | + * ================= | |
60 | + */ | |
61 | + | |
62 | + // Suppress warnings about == null comparisons. | |
63 | + "eqnull": true | |
64 | +} |
gulpfile.js
... | ... | @@ -0,0 +1,95 @@ |
1 | +const templateCache = require('gulp-angular-templatecache'); | |
2 | +const clean = require('gulp-clean'); | |
3 | +const concat = require('gulp-concat'); | |
4 | +const htmlmin = require('gulp-htmlmin'); | |
5 | +const rename = require('gulp-rename'); | |
6 | +const uglify = require('gulp-uglify'); | |
7 | +const gulp = require('gulp'); | |
8 | +const pump = require('pump'); | |
9 | +const jshint = require('gulp-jshint'); | |
10 | +const replace = require('gulp-replace'); | |
11 | +const connect = require('gulp-connect'); | |
12 | + | |
13 | +var paths = { | |
14 | + srcJS: 'src/js/*.js', | |
15 | + srcViews: 'src/views/*.html', | |
16 | + tmp: 'tmp', | |
17 | + dist: 'dist/' | |
18 | +}; | |
19 | + | |
20 | +gulp.task('templates', ['clean'], function() { | |
21 | + return pump( | |
22 | + [ | |
23 | + gulp.src(paths.srcViews), | |
24 | + htmlmin(), | |
25 | + templateCache('views.js', { | |
26 | + module: 'focaCrearRemito', | |
27 | + root: '' | |
28 | + }), | |
29 | + gulp.dest(paths.tmp) | |
30 | + ] | |
31 | + ); | |
32 | +}); | |
33 | + | |
34 | +gulp.task('uglify', ['templates'], function() { | |
35 | + return pump( | |
36 | + [ | |
37 | + gulp.src([ | |
38 | + paths.srcJS, | |
39 | + 'tmp/views.js' | |
40 | + ]), | |
41 | + concat('foca-crear-remito.js'), | |
42 | + replace('src/views/', ''), | |
43 | + gulp.dest(paths.tmp), | |
44 | + rename('foca-crear-remito.min.js'), | |
45 | + uglify(), | |
46 | + replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ | |
47 | + '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+ | |
48 | + '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+ | |
49 | + '"focaModalMoneda","focaModalCotizacion","focaSeguimiento","angular-ladda",'+ | |
50 | + '"cordovaGeolocationModule"', ''), | |
51 | + gulp.dest(paths.dist) | |
52 | + ] | |
53 | + ); | |
54 | +}); | |
55 | + | |
56 | +gulp.task('clean', function(){ | |
57 | + return gulp.src(['tmp', 'dist'], {read: false}) | |
58 | + .pipe(clean()); | |
59 | +}); | |
60 | + | |
61 | +gulp.task('pre-commit', function() { | |
62 | + return pump( | |
63 | + [ | |
64 | + gulp.src(paths.srcJS), | |
65 | + jshint('.jshintrc'), | |
66 | + jshint.reporter('default'), | |
67 | + jshint.reporter('fail') | |
68 | + ] | |
69 | + ); | |
70 | + | |
71 | + gulp.start('uglify'); | |
72 | +}); | |
73 | + | |
74 | +gulp.task('webserver', function() { | |
75 | + pump [ | |
76 | + connect.server({port: 3300, host: '0.0.0.0'}) | |
77 | + ] | |
78 | +}); | |
79 | + | |
80 | +gulp.task('clean-post-install', function() { | |
81 | + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | |
82 | + 'index.html'], {read: false}) | |
83 | + .pipe(clean()); | |
84 | +}); | |
85 | + | |
86 | +gulp.task('default', ['webserver']); | |
87 | + | |
88 | +gulp.task('watch', function() { | |
89 | + gulp.watch([paths.srcJS, paths.srcViews], ['copy']); | |
90 | +}); | |
91 | + | |
92 | +gulp.task('copy', ['uglify'], function(){ | |
93 | + return gulp.src('dist/*.js') | |
94 | + .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist')); | |
95 | +}); |
index.html
... | ... | @@ -0,0 +1,46 @@ |
1 | +<html ng-app="focaCrearRemito"> | |
2 | + <head> | |
3 | + <meta charset="UTF-8"/> | |
4 | + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
5 | + | |
6 | + <!--CSS--> | |
7 | + <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> | |
8 | + <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/> | |
9 | + <link href="node_modules/ladda/dist/ladda-themeless.min.css" rel="stylesheet"> | |
10 | + | |
11 | + <!--VENDOR JS--> | |
12 | + <script src="node_modules/jquery/dist/jquery.min.js"></script> | |
13 | + <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | |
14 | + <script src="node_modules/angular/angular.min.js"></script> | |
15 | + <script src="node_modules/angular-route/angular-route.min.js"></script> | |
16 | + <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | |
17 | + <script src="node_modules/ladda/dist/spin.min.js"></script> | |
18 | + <script src="node_modules/ladda/dist/ladda.min.js"></script> | |
19 | + <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> | |
20 | + <script src="vendor/cordovaGeolocationModule.min.js"></script> | |
21 | + | |
22 | + <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> | |
23 | + <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script> | |
24 | + <script src="node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script> | |
25 | + <script src="node_modules/foca-modal-proveedor/dist/foca-modal-proveedor.min.js"></script> | |
26 | + <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> | |
27 | + <script src="node_modules/foca-modal-precio-condiciones/dist/foca-modal-precio-condiciones.min.js"></script> | |
28 | + <script src="node_modules/foca-modal-flete/dist/foca-modal-flete.min.js"></script> | |
29 | + <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> | |
30 | + <script src="node_modules/foca-modal-domicilio/dist/foca-modal-domicilios.min.js"></script> | |
31 | + <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script> | |
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> | |
34 | + | |
35 | + <script src="src/js/app.js"></script> | |
36 | + <script src="src/js/controller.js"></script> | |
37 | + <script src="src/js/service.js"></script> | |
38 | + <script src="src/js/businessService.js"></script> | |
39 | + <script src="src/js/route.js"></script> | |
40 | + | |
41 | + <script src="src/etc/develop.js"></script> | |
42 | + </head> | |
43 | + <body> | |
44 | + <div ng-view class="container-fluid"></div> | |
45 | + </body> | |
46 | +</html> |
package.json
... | ... | @@ -0,0 +1,68 @@ |
1 | +{ | |
2 | + "name": "foca-crear-remito", | |
3 | + "version": "0.0.1", | |
4 | + "description": "Listado y ABM nota de remitos", | |
5 | + "main": "index.js", | |
6 | + "scripts": { | |
7 | + "test": "echo \"Error: no test specified\" && exit 1", | |
8 | + "compile": "gulp uglify", | |
9 | + "gulp-pre-commit": "gulp pre-commit", | |
10 | + "postinstall": "npm run compile && gulp clean-post-install", | |
11 | + "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git git+https://debo.suite.repo/modulos-npm/foca-modal-flete git+https://debo.suite.repo/modulos-npm/foca-modal.git git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git" | |
12 | + }, | |
13 | + "pre-commit": [ | |
14 | + "gulp-pre-commit" | |
15 | + ], | |
16 | + "repository": { | |
17 | + "type": "git", | |
18 | + "url": "https://debo.suite.repo/modulos-npm/foca-crear-remito.git" | |
19 | + }, | |
20 | + "author": "Foca Software", | |
21 | + "license": "ISC", | |
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" | |
29 | + }, | |
30 | + "devDependencies": { | |
31 | + "angular": "^1.7.5", | |
32 | + "angular-ladda": "^0.4.3", | |
33 | + "angular-route": "^1.7.5", | |
34 | + "bootstrap": "^4.1.3", | |
35 | + "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | |
36 | + "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | |
37 | + "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", | |
38 | + "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | |
39 | + "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", | |
40 | + "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", | |
41 | + "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", | |
42 | + "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", | |
43 | + "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | |
44 | + "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | |
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", | |
47 | + "font-awesome": "^4.7.0", | |
48 | + "gulp": "^3.9.1", | |
49 | + "gulp-angular-templatecache": "^2.2.2", | |
50 | + "gulp-clean": "^0.4.0", | |
51 | + "gulp-concat": "^2.6.1", | |
52 | + "gulp-connect": "^5.6.1", | |
53 | + "gulp-htmlmin": "^5.0.1", | |
54 | + "gulp-jshint": "^2.1.0", | |
55 | + "gulp-rename": "^1.4.0", | |
56 | + "gulp-replace": "^1.0.0", | |
57 | + "gulp-sequence": "^1.0.0", | |
58 | + "gulp-uglify": "^3.0.1", | |
59 | + "gulp-uglify-es": "^1.0.4", | |
60 | + "jasmine-core": "^3.3.0", | |
61 | + "jquery": "^3.3.1", | |
62 | + "jshint": "^2.9.6", | |
63 | + "ladda": "1.0.6", | |
64 | + "pre-commit": "^1.2.2", | |
65 | + "pump": "^3.0.0", | |
66 | + "ui-bootstrap4": "^3.0.5" | |
67 | + } | |
68 | +} |
src/etc/develop.js.ejemplo
src/js/app.js
... | ... | @@ -0,0 +1,18 @@ |
1 | +angular.module('focaCrearRemito', [ | |
2 | + 'ngRoute', | |
3 | + 'ui.bootstrap', | |
4 | + 'focaModalVendedores', | |
5 | + 'focaBusquedaProductos', | |
6 | + 'focaModalProveedor', | |
7 | + 'focaBusquedaCliente', | |
8 | + 'focaModalPrecioCondicion', | |
9 | + 'focaModalFlete', | |
10 | + 'focaDirectivas', | |
11 | + 'focaModal', | |
12 | + 'focaModalDomicilio', | |
13 | + 'focaModalMoneda', | |
14 | + 'focaModalCotizacion', | |
15 | + 'focaSeguimiento', | |
16 | + 'angular-ladda', | |
17 | + 'cordovaGeolocationModule' | |
18 | +]); |
src/js/businessService.js
... | ... | @@ -0,0 +1,27 @@ |
1 | +angular.module('focaCrearRemito') | |
2 | + .factory('remitoBusinessService', [ | |
3 | + 'crearRemitoService', | |
4 | + function(crearRemitoService) { | |
5 | + return { | |
6 | + addArticulos: function(articulosRemito, idRemito, cotizacion) { | |
7 | + for(var i = 0; i < articulosRemito.length; i++) { | |
8 | + delete articulosRemito[i].editCantidad; | |
9 | + delete articulosRemito[i].editPrecio; | |
10 | + articulosRemito[i].idRemito = idRemito; | |
11 | + articulosRemito[i].precio = articulosRemito[i].precio * cotizacion; | |
12 | + crearRemitoService.crearArticulosParaRemito(articulosRemito[i]); | |
13 | + } | |
14 | + }, | |
15 | + addEstado: function(idRemito, idVendedor) { | |
16 | + var date = new Date(); | |
17 | + var estado = { | |
18 | + idRemito: idRemito, | |
19 | + fecha: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | |
20 | + .toISOString().slice(0, 19).replace('T', ' '), | |
21 | + estado: 0, | |
22 | + idVendedor: idVendedor | |
23 | + }; | |
24 | + crearRemitoService.crearEstadoParaRemito(estado); | |
25 | + } | |
26 | + }; | |
27 | + }]); |
src/js/controller.js
... | ... | @@ -0,0 +1,621 @@ |
1 | +angular.module('focaCrearRemito') .controller('remitoController', | |
2 | + [ | |
3 | + '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', | |
4 | + 'focaModalService', 'focaSeguimientoService', 'remitoBusinessService', | |
5 | + function( | |
6 | + $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, | |
7 | + focaSeguimientoService, remitoBusinessService | |
8 | + ) { | |
9 | + $scope.botonera = [ | |
10 | + {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | |
11 | + {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | |
12 | + {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | |
13 | + {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | |
14 | + { | |
15 | + texto: 'Precios y condiciones', | |
16 | + accion: function() {$scope.abrirModalListaPrecio();}}, | |
17 | + {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | |
18 | + {texto: '', accion: function() {}}, | |
19 | + {texto: '', accion: function() {}} | |
20 | + ]; | |
21 | + $scope.datepickerAbierto = false; | |
22 | + | |
23 | + $scope.show = false; | |
24 | + $scope.cargando = true; | |
25 | + $scope.dateOptions = { | |
26 | + maxDate: new Date(), | |
27 | + minDate: new Date(2010, 0, 1) | |
28 | + }; | |
29 | + | |
30 | + $scope.remito = { | |
31 | + vendedor: {}, | |
32 | + cliente: {}, | |
33 | + proveedor: {}, | |
34 | + domicilio: {dom: ''}, | |
35 | + moneda: {}, | |
36 | + cotizacion: {} | |
37 | + }; | |
38 | + var monedaPorDefecto; | |
39 | + //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | |
40 | + crearRemitoService.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.remito.moneda = monedaPorDefecto; | |
52 | + $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; | |
53 | + }); | |
54 | + | |
55 | + $scope.cabecera = []; | |
56 | + $scope.showCabecera = true; | |
57 | + | |
58 | + $scope.now = new Date(); | |
59 | + $scope.puntoVenta = Math.round(Math.random() * 10000); | |
60 | + $scope.comprobante = Math.round(Math.random() * 1000000); | |
61 | + | |
62 | + $scope.articulosTabla = []; | |
63 | + $scope.idLista = undefined; | |
64 | + //La pantalla solo se usa para cargar remitos | |
65 | + //var remitoTemp = crearRemitoService.getRemito(); | |
66 | + | |
67 | + crearRemitoService.getPrecioCondicion().then( | |
68 | + function(res) { | |
69 | + $scope.precioCondiciones = res.data; | |
70 | + } | |
71 | + ); | |
72 | + //La pantalla solo se usa para cargar remitos | |
73 | + // if (remitoTemp !== undefined) { | |
74 | + // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); | |
75 | + // $scope.remito = remitoTemp; | |
76 | + // $scope.remito.flete = ($scope.remito.flete).toString(); | |
77 | + // $scope.remito.bomba = ($scope.remito.bomba).toString(); | |
78 | + // $scope.idLista = $scope.remito.precioCondicion; | |
79 | + // crearRemitoService | |
80 | + // .getArticulosByIdRemito($scope.remito.id).then( | |
81 | + // function(res) { | |
82 | + // $scope.articulosTabla = res.data; | |
83 | + // } | |
84 | + // ); | |
85 | + //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO | |
86 | + //(NO REQUERIDO EN ESTA VERSION) | |
87 | + // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( | |
88 | + // function(res) { | |
89 | + // $scope.remito.domicilio = res.data; | |
90 | + // } | |
91 | + // ); | |
92 | + // } else { | |
93 | + // $scope.remito.fechaCarga = new Date(); | |
94 | + // $scope.remito.bomba = '0'; | |
95 | + // $scope.remito.flete = '0'; | |
96 | + // $scope.idLista = undefined; | |
97 | + // } | |
98 | + //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | |
99 | + // $scope.addNewDom = function() { | |
100 | + // $scope.remito.domicilio.push({ 'id': 0 }); | |
101 | + // }; | |
102 | + // $scope.removeNewChoice = function(choice) { | |
103 | + // if ($scope.remito.domicilio.length > 1) { | |
104 | + // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( | |
105 | + // function(c) { | |
106 | + // return c.$$hashKey === choice.$$hashKey; | |
107 | + // } | |
108 | + // ), 1); | |
109 | + // } | |
110 | + // }; | |
111 | + | |
112 | + $scope.crearRemito = function() { | |
113 | + if(!$scope.remito.vendedor.codigo) { | |
114 | + focaModalService.alert('Ingrese Vendedor'); | |
115 | + return; | |
116 | + } else if(!$scope.remito.cliente.cod) { | |
117 | + focaModalService.alert('Ingrese Cliente'); | |
118 | + return; | |
119 | + } else if(!$scope.remito.proveedor.codigo) { | |
120 | + focaModalService.alert('Ingrese Proveedor'); | |
121 | + return; | |
122 | + } else if(!$scope.remito.moneda.id) { | |
123 | + focaModalService.alert('Ingrese Moneda'); | |
124 | + return; | |
125 | + } else if(!$scope.remito.cotizacion.ID) { | |
126 | + focaModalService.alert('Ingrese Cotización'); | |
127 | + return; | |
128 | + } else if(!$scope.plazosPagos) { | |
129 | + focaModalService.alert('Ingrese Precios y Condiciones'); | |
130 | + return; | |
131 | + } else if( | |
132 | + $scope.remito.flete === undefined || $scope.remito.flete === null) | |
133 | + { | |
134 | + focaModalService.alert('Ingrese Flete'); | |
135 | + return; | |
136 | + } else if(!$scope.remito.domicilio.id) { | |
137 | + focaModalService.alert('Ingrese Domicilio'); | |
138 | + return; | |
139 | + } else if($scope.articulosTabla.length === 0) { | |
140 | + focaModalService.alert('Debe cargar al menos un articulo'); | |
141 | + return; | |
142 | + } | |
143 | + var date = new Date(); | |
144 | + var remito = { | |
145 | + id: 0, | |
146 | + fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | |
147 | + .toISOString().slice(0, 19).replace('T', ' '), | |
148 | + idVendedor: $scope.remito.vendedor.codigo, | |
149 | + idCliente: $scope.remito.cliente.cod, | |
150 | + nombreCliente: $scope.remito.cliente.nom, | |
151 | + cuitCliente: $scope.remito.cliente.cuit, | |
152 | + idProveedor: $scope.remito.proveedor.codigo, | |
153 | + idDomicilio: $scope.remito.domicilio.id, | |
154 | + idCotizacion: $scope.remito.cotizacion.ID, | |
155 | + cotizacion: $scope.remito.cotizacion.COTIZACION, | |
156 | + flete: $scope.remito.flete, | |
157 | + fob: $scope.remito.fob, | |
158 | + bomba: $scope.remito.bomba, | |
159 | + kilometros: $scope.remito.kilometros, | |
160 | + estado: 0, | |
161 | + total: $scope.getTotal() | |
162 | + }; | |
163 | + crearRemitoService.crearRemito(remito).then( | |
164 | + function(data) { | |
165 | + remitoBusinessService.addArticulos($scope.articulosTabla, | |
166 | + data.data.id, $scope.remito.cotizacion.COTIZACION); | |
167 | + focaSeguimientoService.guardarPosicion('crear nota remito', ''); | |
168 | + var plazos = $scope.plazosPagos; | |
169 | + for(var j = 0; j < plazos.length; j++) { | |
170 | + var json = { | |
171 | + idRemito: data.data.id, | |
172 | + dias: plazos[j].dias | |
173 | + }; | |
174 | + crearRemitoService.crearPlazosParaRemito(json); | |
175 | + } | |
176 | + remitoBusinessService.addEstado(data.data.id, | |
177 | + $scope.remito.vendedor.codigo); | |
178 | + | |
179 | + focaModalService.alert('Nota remito creada'); | |
180 | + $scope.cabecera = []; | |
181 | + addCabecera('Moneda:', $scope.remito.moneda.detalle); | |
182 | + addCabecera( | |
183 | + 'Fecha cotizacion:', | |
184 | + $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') | |
185 | + ); | |
186 | + addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); | |
187 | + $scope.remito.vendedor = {}; | |
188 | + $scope.remito.cliente = {}; | |
189 | + $scope.remito.proveedor = {}; | |
190 | + $scope.remito.domicilio = {}; | |
191 | + $scope.remito.flete = null; | |
192 | + $scope.remito.fob = null; | |
193 | + $scope.remito.bomba = null; | |
194 | + $scope.remito.kilometros = null; | |
195 | + $scope.articulosTabla = []; | |
196 | + } | |
197 | + ); | |
198 | + }; | |
199 | + | |
200 | + $scope.seleccionarArticulo = function() { | |
201 | + if ($scope.idLista === undefined) { | |
202 | + focaModalService.alert( | |
203 | + 'Primero seleccione una lista de precio y condicion'); | |
204 | + return; | |
205 | + } | |
206 | + var modalInstance = $uibModal.open( | |
207 | + { | |
208 | + ariaLabelledBy: 'Busqueda de Productos', | |
209 | + templateUrl: 'modal-busqueda-productos.html', | |
210 | + controller: 'modalBusquedaProductosCtrl', | |
211 | + resolve: { | |
212 | + parametroProducto: { | |
213 | + idLista: $scope.idLista, | |
214 | + cotizacion: $scope.remito.cotizacion.COTIZACION, | |
215 | + simbolo: $scope.remito.moneda.simbolo | |
216 | + } | |
217 | + }, | |
218 | + size: 'lg' | |
219 | + } | |
220 | + ); | |
221 | + modalInstance.result.then( | |
222 | + function(producto) { | |
223 | + var newArt = | |
224 | + { | |
225 | + id: 0, | |
226 | + codigo: producto.codigo, | |
227 | + sector: producto.sector, | |
228 | + sectorCodigo: producto.sector + '-' + producto.codigo, | |
229 | + descripcion: producto.descripcion, | |
230 | + item: $scope.articulosTabla.length + 1, | |
231 | + nombre: producto.descripcion, | |
232 | + precio: parseFloat(producto.precio.toFixed(4)), | |
233 | + costoUnitario: producto.costo, | |
234 | + editCantidad: false, | |
235 | + editPrecio: false | |
236 | + }; | |
237 | + $scope.articuloACargar = newArt; | |
238 | + $scope.cargando = false; | |
239 | + }, function() { | |
240 | + // funcion ejecutada cuando se cancela el modal | |
241 | + } | |
242 | + ); | |
243 | + }; | |
244 | + | |
245 | + $scope.seleccionarVendedor = function() { | |
246 | + var modalInstance = $uibModal.open( | |
247 | + { | |
248 | + ariaLabelledBy: 'Busqueda de Vendedores', | |
249 | + templateUrl: 'modal-vendedores.html', | |
250 | + controller: 'modalVendedoresCtrl', | |
251 | + size: 'lg' | |
252 | + } | |
253 | + ); | |
254 | + modalInstance.result.then( | |
255 | + function(vendedor) { | |
256 | + addCabecera('Vendedor:', vendedor.NomVen); | |
257 | + $scope.remito.vendedor.codigo = vendedor.CodVen; | |
258 | + }, function() { | |
259 | + | |
260 | + } | |
261 | + ); | |
262 | + }; | |
263 | + | |
264 | + $scope.seleccionarProveedor = function() { | |
265 | + var modalInstance = $uibModal.open( | |
266 | + { | |
267 | + ariaLabelledBy: 'Busqueda de Proveedor', | |
268 | + templateUrl: 'modal-proveedor.html', | |
269 | + controller: 'focaModalProveedorCtrl', | |
270 | + size: 'lg' | |
271 | + } | |
272 | + ); | |
273 | + modalInstance.result.then( | |
274 | + function(proveedor) { | |
275 | + $scope.remito.proveedor.codigo = proveedor.COD; | |
276 | + addCabecera('Proveedor:', proveedor.NOM); | |
277 | + }, function() { | |
278 | + | |
279 | + } | |
280 | + ); | |
281 | + }; | |
282 | + | |
283 | + $scope.seleccionarCliente = function() { | |
284 | + | |
285 | + var modalInstance = $uibModal.open( | |
286 | + { | |
287 | + ariaLabelledBy: 'Busqueda de Cliente', | |
288 | + templateUrl: 'foca-busqueda-cliente-modal.html', | |
289 | + controller: 'focaBusquedaClienteModalController', | |
290 | + size: 'lg' | |
291 | + } | |
292 | + ); | |
293 | + modalInstance.result.then( | |
294 | + function(cliente) { | |
295 | + $scope.abrirModalDomicilios(cliente); | |
296 | + }, function() { | |
297 | + | |
298 | + } | |
299 | + ); | |
300 | + }; | |
301 | + | |
302 | + $scope.abrirModalDomicilios = function(cliente) { | |
303 | + var modalInstanceDomicilio = $uibModal.open( | |
304 | + { | |
305 | + ariaLabelledBy: 'Busqueda de Domicilios', | |
306 | + templateUrl: 'modal-domicilio.html', | |
307 | + controller: 'focaModalDomicilioController', | |
308 | + resolve: { idCliente: function() { return cliente.cod; }}, | |
309 | + size: 'lg', | |
310 | + } | |
311 | + ); | |
312 | + modalInstanceDomicilio.result.then( | |
313 | + function(domicilio) { | |
314 | + $scope.remito.domicilio.id = domicilio.nivel2; | |
315 | + $scope.remito.cliente = cliente; | |
316 | + | |
317 | + addCabecera('Cliente:', cliente.nom); | |
318 | + addCabecera('Domicilio:', domicilio.dom); | |
319 | + }, function() { | |
320 | + $scope.seleccionarCliente(); | |
321 | + return; | |
322 | + } | |
323 | + ); | |
324 | + }; | |
325 | + | |
326 | + $scope.mostrarFichaCliente = function() { | |
327 | + $uibModal.open( | |
328 | + { | |
329 | + ariaLabelledBy: 'Datos del Cliente', | |
330 | + templateUrl: 'foca-crear-remito-ficha-cliente.html', | |
331 | + controller: 'focaCrearRemitoFichaClienteController', | |
332 | + size: 'lg' | |
333 | + } | |
334 | + ); | |
335 | + }; | |
336 | + | |
337 | + $scope.getTotal = function() { | |
338 | + var total = 0; | |
339 | + var arrayTempArticulos = $scope.articulosTabla; | |
340 | + for (var i = 0; i < arrayTempArticulos.length; i++) { | |
341 | + total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | |
342 | + } | |
343 | + return parseFloat(total.toFixed(2)); | |
344 | + }; | |
345 | + | |
346 | + $scope.getSubTotal = function() { | |
347 | + if($scope.articuloACargar) { | |
348 | + return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | |
349 | + } | |
350 | + }; | |
351 | + | |
352 | + $scope.abrirModalListaPrecio = function() { | |
353 | + var modalInstance = $uibModal.open( | |
354 | + { | |
355 | + ariaLabelledBy: 'Busqueda de Precio Condición', | |
356 | + templateUrl: 'modal-precio-condicion.html', | |
357 | + controller: 'focaModalPrecioCondicionController', | |
358 | + size: 'lg' | |
359 | + } | |
360 | + ); | |
361 | + modalInstance.result.then( | |
362 | + function(precioCondicion) { | |
363 | + var cabecera = ''; | |
364 | + var plazosConcat = ''; | |
365 | + if(!Array.isArray(precioCondicion)) { | |
366 | + $scope.plazosPagos = precioCondicion.plazoPago; | |
367 | + $scope.idLista = precioCondicion.idListaPrecio; | |
368 | + for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | |
369 | + plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | |
370 | + } | |
371 | + cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | |
372 | + } else { //Cuando se ingresan los plazos manualmente | |
373 | + $scope.idLista = -1; //-1, el modal productos busca todos los productos | |
374 | + $scope.plazosPagos = precioCondicion; | |
375 | + for(var j = 0; j < precioCondicion.length; j++) { | |
376 | + plazosConcat += precioCondicion[j].dias + ' '; | |
377 | + } | |
378 | + cabecera = 'Ingreso manual ' + plazosConcat.trim(); | |
379 | + } | |
380 | + $scope.articulosTabla = []; | |
381 | + addCabecera('Precios y condiciones:', cabecera); | |
382 | + }, function() { | |
383 | + | |
384 | + } | |
385 | + ); | |
386 | + }; | |
387 | + | |
388 | + $scope.abrirModalFlete = function() { | |
389 | + var modalInstance = $uibModal.open( | |
390 | + { | |
391 | + ariaLabelledBy: 'Busqueda de Flete', | |
392 | + templateUrl: 'modal-flete.html', | |
393 | + controller: 'focaModalFleteController', | |
394 | + size: 'lg', | |
395 | + resolve: { | |
396 | + parametrosFlete: | |
397 | + function() { | |
398 | + return { | |
399 | + flete: $scope.remito.flete ? '1' : | |
400 | + ($scope.remito.fob ? 'FOB' : | |
401 | + ($scope.remito.flete === undefined ? null : '0')), | |
402 | + bomba: $scope.remito.bomba ? '1' : | |
403 | + ($scope.remito.bomba === undefined ? null : '0'), | |
404 | + kilometros: $scope.remito.kilometros | |
405 | + }; | |
406 | + } | |
407 | + } | |
408 | + } | |
409 | + ); | |
410 | + modalInstance.result.then( | |
411 | + function(datos) { | |
412 | + $scope.remito.flete = datos.flete; | |
413 | + $scope.remito.fob = datos.FOB; | |
414 | + $scope.remito.bomba = datos.bomba; | |
415 | + $scope.remito.kilometros = datos.kilometros; | |
416 | + | |
417 | + addCabecera('Flete:', datos.flete ? 'Si' : | |
418 | + ($scope.remito.fob ? 'FOB' : 'No')); | |
419 | + if(datos.flete) { | |
420 | + addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | |
421 | + addCabecera('Kilometros:', datos.kilometros); | |
422 | + } else { | |
423 | + removeCabecera('Bomba:'); | |
424 | + removeCabecera('Kilometros:'); | |
425 | + $scope.remito.fob = false; | |
426 | + $scope.remito.bomba = false; | |
427 | + $scope.remito.kilometros = null; | |
428 | + } | |
429 | + }, function() { | |
430 | + | |
431 | + } | |
432 | + ); | |
433 | + }; | |
434 | + | |
435 | + $scope.abrirModalMoneda = function() { | |
436 | + var modalInstance = $uibModal.open( | |
437 | + { | |
438 | + ariaLabelledBy: 'Busqueda de Moneda', | |
439 | + templateUrl: 'modal-moneda.html', | |
440 | + controller: 'focaModalMonedaController', | |
441 | + size: 'lg' | |
442 | + } | |
443 | + ); | |
444 | + modalInstance.result.then( | |
445 | + function(moneda) { | |
446 | + $scope.abrirModalCotizacion(moneda); | |
447 | + }, function() { | |
448 | + | |
449 | + } | |
450 | + ); | |
451 | + }; | |
452 | + | |
453 | + $scope.abrirModalCotizacion = function(moneda) { | |
454 | + var modalInstance = $uibModal.open( | |
455 | + { | |
456 | + ariaLabelledBy: 'Busqueda de Cotización', | |
457 | + templateUrl: 'modal-cotizacion.html', | |
458 | + controller: 'focaModalCotizacionController', | |
459 | + size: 'lg', | |
460 | + resolve: {idMoneda: function() {return moneda.ID;}} | |
461 | + } | |
462 | + ); | |
463 | + modalInstance.result.then( | |
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.remito.cotizacion.COTIZACION; | |
469 | + articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | |
470 | + cotizacion.COTIZACION; | |
471 | + } | |
472 | + $scope.articulosTabla = articulosTablaTemp; | |
473 | + $scope.remito.moneda = { | |
474 | + id: moneda.ID, | |
475 | + detalle: moneda.DETALLE, | |
476 | + simbolo: moneda.SIMBOLO | |
477 | + }; | |
478 | + $scope.remito.cotizacion = { | |
479 | + ID: cotizacion.ID, | |
480 | + COTIZACION: cotizacion.COTIZACION, | |
481 | + FECHA: cotizacion.FECHA | |
482 | + }; | |
483 | + addCabecera('Moneda:', moneda.DETALLE); | |
484 | + addCabecera( | |
485 | + 'Fecha cotizacion:', | |
486 | + $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | |
487 | + ); | |
488 | + addCabecera('Cotizacion:', cotizacion.COTIZACION); | |
489 | + }, function() { | |
490 | + | |
491 | + } | |
492 | + ); | |
493 | + }; | |
494 | + | |
495 | + $scope.agregarATabla = function(key) { | |
496 | + if(key === 13) { | |
497 | + if($scope.articuloACargar.cantidad === undefined || | |
498 | + $scope.articuloACargar.cantidad === 0 || | |
499 | + $scope.articuloACargar.cantidad === null ){ | |
500 | + focaModalService.alert('El valor debe ser al menos 1'); | |
501 | + return; | |
502 | + } | |
503 | + delete $scope.articuloACargar.sectorCodigo; | |
504 | + $scope.articulosTabla.push($scope.articuloACargar); | |
505 | + $scope.cargando = true; | |
506 | + } | |
507 | + }; | |
508 | + | |
509 | + $scope.quitarArticulo = function(key) { | |
510 | + $scope.articulosTabla.splice(key, 1); | |
511 | + }; | |
512 | + | |
513 | + $scope.editarArticulo = function(key, articulo) { | |
514 | + if(key === 13) { | |
515 | + if(articulo.cantidad === null || articulo.cantidad === 0 || | |
516 | + articulo.cantidad === undefined){ | |
517 | + focaModalService.alert('El valor debe ser al menos 1'); | |
518 | + return; | |
519 | + } | |
520 | + articulo.editCantidad = false; | |
521 | + articulo.editPrecio = false; | |
522 | + } | |
523 | + }; | |
524 | + | |
525 | + $scope.cambioEdit = function(articulo, propiedad) { | |
526 | + if(propiedad === 'cantidad') { | |
527 | + articulo.editCantidad = true; | |
528 | + } else if(propiedad === 'precio') { | |
529 | + articulo.editPrecio = true; | |
530 | + } | |
531 | + }; | |
532 | + | |
533 | + $scope.limpiarFlete = function() { | |
534 | + $scope.remito.fleteNombre = ''; | |
535 | + $scope.remito.chofer = ''; | |
536 | + $scope.remito.vehiculo = ''; | |
537 | + $scope.remito.kilometros = ''; | |
538 | + $scope.remito.costoUnitarioKmFlete = ''; | |
539 | + $scope.choferes = ''; | |
540 | + $scope.vehiculos = ''; | |
541 | + }; | |
542 | + | |
543 | + $scope.limpiarPantalla = function() { | |
544 | + $scope.limpiarFlete(); | |
545 | + $scope.remito.flete = '0'; | |
546 | + $scope.remito.bomba = '0'; | |
547 | + $scope.remito.precioCondicion = ''; | |
548 | + $scope.articulosTabla = []; | |
549 | + $scope.remito.vendedor.nombre = ''; | |
550 | + $scope.remito.cliente = {nombre: ''}; | |
551 | + $scope.remito.domicilio = {dom: ''}; | |
552 | + $scope.domiciliosCliente = []; | |
553 | + }; | |
554 | + | |
555 | + $scope.resetFilter = function() { | |
556 | + $scope.articuloACargar = {}; | |
557 | + $scope.cargando = true; | |
558 | + }; | |
559 | + | |
560 | + $scope.selectFocus = function($event) { | |
561 | + $event.target.select(); | |
562 | + }; | |
563 | + | |
564 | + $scope.salir = function() { | |
565 | + $location.path('/'); | |
566 | + }; | |
567 | + | |
568 | + function addCabecera(label, valor) { | |
569 | + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | |
570 | + if(propiedad.length === 1) { | |
571 | + propiedad[0].valor = valor; | |
572 | + } else { | |
573 | + $scope.cabecera.push({label: label, valor: valor}); | |
574 | + } | |
575 | + } | |
576 | + | |
577 | + function removeCabecera(label) { | |
578 | + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | |
579 | + if(propiedad.length === 1){ | |
580 | + $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | |
581 | + } | |
582 | + } | |
583 | + } | |
584 | + ] | |
585 | +) | |
586 | +.controller('remitoListaCtrl', [ | |
587 | + '$scope', | |
588 | + 'crearRemitoService', | |
589 | + '$location', | |
590 | + function($scope, crearRemitoService, $location) { | |
591 | + crearRemitoService.obtenerRemito().then(function(datos) { | |
592 | + $scope.remitos = datos.data; | |
593 | + }); | |
594 | + $scope.editar = function(remito) { | |
595 | + crearRemitoService.setRemito(remito); | |
596 | + $location.path('/venta-nota-remito/abm/'); | |
597 | + }; | |
598 | + $scope.crearRemito = function() { | |
599 | + crearRemitoService.clearRemito(); | |
600 | + $location.path('/venta-nota-remito/abm/'); | |
601 | + }; | |
602 | + } | |
603 | +]) | |
604 | +.controller('focaCrearRemitoFichaClienteController', [ | |
605 | + '$scope', | |
606 | + 'crearRemitoService', | |
607 | + '$location', | |
608 | + function($scope, crearRemitoService, $location) { | |
609 | + crearRemitoService.obtenerRemito().then(function(datos) { | |
610 | + $scope.remitos = datos.data; | |
611 | + }); | |
612 | + $scope.editar = function(remito) { | |
613 | + crearRemitoService.setRemito(remito); | |
614 | + $location.path('/venta-nota-remito/abm/'); | |
615 | + }; | |
616 | + $scope.crearRemito = function() { | |
617 | + crearRemitoService.clearRemito(); | |
618 | + $location.path('/venta-nota-remito/abm/'); | |
619 | + }; | |
620 | + } | |
621 | +]); |
src/js/route.js
src/js/service.js
... | ... | @@ -0,0 +1,56 @@ |
1 | +angular.module('focaCrearRemito') | |
2 | + .service('crearRemitoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | |
3 | + var route = API_ENDPOINT.URL; | |
4 | + return { | |
5 | + crearRemito: function(remito) { | |
6 | + return $http.post(route + '/nota-remito', {remito: remito}); | |
7 | + }, | |
8 | + obtenerRemito: function() { | |
9 | + return $http.get(route +'/nota-remito'); | |
10 | + }, | |
11 | + setRemito: function(remito) { | |
12 | + this.remito = remito; | |
13 | + }, | |
14 | + clearRemito: function() { | |
15 | + this.remito = undefined; | |
16 | + }, | |
17 | + getRemito: function() { | |
18 | + return this.remito; | |
19 | + }, | |
20 | + getArticulosByIdRemito: function(id) { | |
21 | + return $http.get(route+'/articulos/nota-remito/'+id); | |
22 | + }, | |
23 | + crearArticulosParaRemito: function(articuloRemito) { | |
24 | + return $http.post(route + '/articulos/nota-remito', | |
25 | + {articuloRemito: articuloRemito}); | |
26 | + }, | |
27 | + getDomiciliosByIdRemito: function(id) { | |
28 | + return $http.get(route +'/nota-remito/'+id+'/domicilios'); | |
29 | + }, | |
30 | + getDomiciliosByIdCliente: function(id) { | |
31 | + var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | |
32 | + return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | |
33 | + }, | |
34 | + getPrecioCondicion: function() { | |
35 | + return $http.get(route + '/precio-condicion'); | |
36 | + }, | |
37 | + getPrecioCondicionById: function(id) { | |
38 | + return $http.get(route + '/precio-condicion/' + id); | |
39 | + }, | |
40 | + getPlazoPagoByPrecioCondicion: function(id) { | |
41 | + return $http.get(route + '/plazo-pago/precio-condicion/'+ id); | |
42 | + }, | |
43 | + crearFlete: function(flete) { | |
44 | + return $http.post(route + '/flete', {flete : flete}); | |
45 | + }, | |
46 | + crearPlazosParaRemito: function(plazos) { | |
47 | + return $http.post(route + '/plazo-pago/nota-remito', plazos); | |
48 | + }, | |
49 | + getCotizacionByIdMoneda: function(id) { | |
50 | + return $http.get(route + '/moneda/' + id); | |
51 | + }, | |
52 | + crearEstadoParaRemito: function(estado) { | |
53 | + return $http.post(route + '/estado', {estado: estado}); | |
54 | + } | |
55 | + }; | |
56 | + }]); |
src/views/foca-crear-remito-ficha-cliente.html
... | ... | @@ -0,0 +1,78 @@ |
1 | +<div class="modal-header"> | |
2 | + <h3 class="modal-title"></h3> | |
3 | +</div> | |
4 | +<div class="modal-body" id="modal-body"> | |
5 | + <div class="input-group mb-3"> | |
6 | + <input | |
7 | + type="text" | |
8 | + class="form-control" | |
9 | + placeholder="Busqueda" | |
10 | + ng-model="filters" | |
11 | + ng-change="search()" | |
12 | + ng-keydown="busquedaDown($event.keyCode)" | |
13 | + ng-keypress="busquedaPress($event.keyCode)" | |
14 | + foca-focus="selectedVendedor == -1" | |
15 | + ng-focus="selectedVendedor = -1" | |
16 | + > | |
17 | + <table class="table table-striped table-sm"> | |
18 | + <thead> | |
19 | + <tr> | |
20 | + <th>Código</th> | |
21 | + <th>Nombre</th> | |
22 | + <th></th> | |
23 | + </tr> | |
24 | + </thead> | |
25 | + <tbody> | |
26 | + <tr ng-repeat="(key, vendedor) in currentPageVendedores"> | |
27 | + <td ng-bind="vendedor.CodVen"></td> | |
28 | + <td ng-bind="vendedor.NomVen"></td> | |
29 | + <td> | |
30 | + <button | |
31 | + type="button" | |
32 | + class="btn p-2 float-right btn-sm" | |
33 | + ng-class="{ | |
34 | + 'btn-secondary': selectedVendedor != key, | |
35 | + 'btn-primary': selectedVendedor == key | |
36 | + }" | |
37 | + ng-click="select(vendedor)" | |
38 | + foca-focus="selectedVendedor == {{key}}" | |
39 | + ng-keydown="itemVendedor($event.keyCode)"> | |
40 | + <i class="fa fa-arrow-right" aria-hidden="true"></i> | |
41 | + </button> | |
42 | + </td> | |
43 | + </tr> | |
44 | + </tbody> | |
45 | + </table> | |
46 | + <nav> | |
47 | + <ul class="pagination justify-content-end"> | |
48 | + <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | |
49 | + <a class="page-link" href="#" ng-click="selectPage(currentPage - 1)"> | |
50 | + <span aria-hidden="true">«</span> | |
51 | + <span class="sr-only">Anterior</span> | |
52 | + </a> | |
53 | + </li> | |
54 | + <li | |
55 | + class="page-item" | |
56 | + ng-repeat="pagina in paginas" | |
57 | + ng-class="{'active': pagina == currentPage}" | |
58 | + > | |
59 | + <a | |
60 | + class="page-link" | |
61 | + href="#" | |
62 | + ng-click="selectPage(pagina)" | |
63 | + ng-bind="pagina" | |
64 | + ></a> | |
65 | + </li> | |
66 | + <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | |
67 | + <a class="page-link" href="#" ng-click="selectPage(currentPage + 1)"> | |
68 | + <span aria-hidden="true">»</span> | |
69 | + <span class="sr-only">Siguiente</span> | |
70 | + </a> | |
71 | + </li> | |
72 | + </ul> | |
73 | + </nav> | |
74 | + </div> | |
75 | +</div> | |
76 | +<div class="modal-footer"> | |
77 | + <button class="btn btn-secondary" data-dismiss="modal">Cerrar</button> | |
78 | +</div> |
src/views/remito-lista.html
... | ... | @@ -0,0 +1,25 @@ |
1 | +<table class="table table-sm table-hover table-nonfluid"> | |
2 | + <thead> | |
3 | + <tr> | |
4 | + <th>Código</th> | |
5 | + <th>Vendedor</th> | |
6 | + <th>Cliente</th> | |
7 | + <th>Proveedor</th> | |
8 | + <th>Total</th> | |
9 | + <th><button class="btn btn-primary" ng-click="crearRemito()">Crear</button></th> | |
10 | + </tr> | |
11 | + </thead> | |
12 | + <tbody> | |
13 | + <tr ng-repeat="item in remitos"> | |
14 | + <td ng-bind="item.id"></td> | |
15 | + <td ng-bind="item.vendedor"></td> | |
16 | + <td ng-bind="item.cliente"></td> | |
17 | + <td ng-bind="item.proveedor"></td> | |
18 | + <td ng-bind="(item.total | 0) | currency"></td> | |
19 | + <td> | |
20 | + <button class="btn btn-info" ng-show="false" ng-click="editar(item)"><i class="fa fa-edit"></i></button> | |
21 | + <!-- <button class="btn btn-danger" ng-click="borrar(item.id)"><i class="fa fa-trash"></i></button> --> | |
22 | + </td> | |
23 | + </tr> | |
24 | + </tbody> | |
25 | +</table> |
src/views/remito.html
... | ... | @@ -0,0 +1,474 @@ |
1 | +<div class="crear-nota-remito"> | |
2 | + <form name="formCrearNota" ng-submit="crearRemito()" class="mb-0"> | |
3 | + <div class="row"> | |
4 | + <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> | |
5 | + <div class="row p-1 panel-informativo"> | |
6 | + <div class="col-12"> | |
7 | + <div class="row"> | |
8 | + <div class="col-12 col-sm-4 nota-remito"> | |
9 | + <h5>REMITO</h5> | |
10 | + </div> | |
11 | + <div class="col-5 col-sm-4 numero-remito" | |
12 | + >Nº {{puntoVenta}}-{{comprobante}} | |
13 | + </div> | |
14 | + <div class="col-7 col-sm-4 text-right"> | |
15 | + Fecha: | |
16 | + <span | |
17 | + ng-show="!datepickerAbierto" | |
18 | + ng-bind="now | date:'dd/MM/yyyy HH:mm'" | |
19 | + ng-click="datepickerAbierto = true" | |
20 | + > | |
21 | + </span> | |
22 | + <input | |
23 | + ng-show="datepickerAbierto" | |
24 | + type="date" | |
25 | + ng-model="now" | |
26 | + ng-change="datepickerAbierto = false" | |
27 | + ng-blur="datepickerAbierto = false" | |
28 | + class="form-control form-control-sm col-8 float-right" | |
29 | + foca-focus="datepickerAbierto" | |
30 | + hasta-hoy | |
31 | + /> | |
32 | + </div> | |
33 | + </div> | |
34 | + <div class="row"> | |
35 | + <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | |
36 | + <span class="label" ng-bind="cab.label"></span> | |
37 | + <span class="valor" ng-bind="cab.valor"></span> | |
38 | + </div> | |
39 | + <a | |
40 | + class="btn col-12 btn-secondary d-sm-none" | |
41 | + ng-show="cabecera.length > 0" | |
42 | + ng-click="showCabecera = !showCabecera" | |
43 | + > | |
44 | + <i | |
45 | + class="fa fa-chevron-down" | |
46 | + ng-hide="showCabecera" | |
47 | + aria-hidden="true" | |
48 | + > | |
49 | + </i> | |
50 | + <i | |
51 | + class="fa fa-chevron-up" | |
52 | + ng-show="showCabecera" | |
53 | + aria-hidden="true"> | |
54 | + </i> | |
55 | + </a> | |
56 | + </div> | |
57 | + </div> | |
58 | + </div> | |
59 | + <div class="row p-1 botonera-secundaria"> | |
60 | + <div class="col-12"> | |
61 | + <div class="row"> | |
62 | + <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> | |
63 | + <button | |
64 | + type="button" | |
65 | + class="btn btn-default btn-block btn-xs text-left py-2" | |
66 | + ng-click="boton.accion()" | |
67 | + ng-class="{'d-none d-sm-block': boton.texto == ''}" | |
68 | + > | |
69 | + <i | |
70 | + class="fa fa-arrow-circle-right" | |
71 | + ng-show="boton.texto != ''" | |
72 | + ></i> | |
73 | + | |
74 | + {{boton.texto}} | |
75 | + </button> | |
76 | + </div> | |
77 | + </div> | |
78 | + </div> | |
79 | + </div> | |
80 | + </div> | |
81 | + </div> | |
82 | + </form> | |
83 | + <div class="row"> | |
84 | + <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | |
85 | + <!-- PC --> | |
86 | + <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | |
87 | + <table class="table tabla-articulo table-striped table-sm table-dark"> | |
88 | + <thead> | |
89 | + <tr class="d-flex"> | |
90 | + <th class="">#</th> | |
91 | + <th class="col">Código</th> | |
92 | + <th class="col-4">Descripción</th> | |
93 | + <th class="col text-right">Cantidad</th> | |
94 | + <th class="col text-right">Precio Unitario</th> | |
95 | + <th class="col text-right">SubTotal</th> | |
96 | + <th class="text-right"> | |
97 | + <button | |
98 | + class="btn btn-outline-secondary selectable" | |
99 | + ng-click="show = !show; masMenos()" | |
100 | + > | |
101 | + <i | |
102 | + class="fa fa-chevron-down" | |
103 | + ng-show="show" | |
104 | + aria-hidden="true" | |
105 | + > | |
106 | + </i> | |
107 | + <i | |
108 | + class="fa fa-chevron-up" | |
109 | + ng-hide="show" | |
110 | + aria-hidden="true"> | |
111 | + </i> | |
112 | + </button> | |
113 | + </th> | |
114 | + </tr> | |
115 | + </thead> | |
116 | + <tbody class="tabla-articulo-body"> | |
117 | + <tr | |
118 | + ng-repeat="(key, articulo) in articulosTabla" | |
119 | + ng-show="show || key == (articulosTabla.length - 1)" | |
120 | + class="d-flex" | |
121 | + > | |
122 | + <td ng-bind="key + 1"></td> | |
123 | + <td | |
124 | + class="col" | |
125 | + ng-bind="articulo.sector + '-' + articulo.codigo" | |
126 | + ></td> | |
127 | + <td | |
128 | + class="col-4" | |
129 | + ng-bind="articulo.descripcion" | |
130 | + ></td> | |
131 | + <td class="col text-right"> | |
132 | + <input | |
133 | + ng-show="articulo.editCantidad" | |
134 | + ng-model="articulo.cantidad" | |
135 | + class="form-control" | |
136 | + type="number" | |
137 | + min="1" | |
138 | + foca-focus="articulo.editCantidad" | |
139 | + ng-keypress="editarArticulo($event.keyCode, articulo)" | |
140 | + ng-focus="selectFocus($event)" | |
141 | + > | |
142 | + <i | |
143 | + class="selectable" | |
144 | + ng-click="cambioEdit(articulo, 'cantidad')" | |
145 | + ng-hide="articulo.editCantidad" | |
146 | + ng-bind="articulo.cantidad"> | |
147 | + </i> | |
148 | + </td> | |
149 | + <td class="col text-right"> | |
150 | + <input | |
151 | + ng-show="articulo.editPrecio" | |
152 | + ng-model="articulo.precio" | |
153 | + class="form-control" | |
154 | + type="number" | |
155 | + min="1" | |
156 | + step="0.0001" | |
157 | + foca-focus="articulo.editPrecio" | |
158 | + ng-keypress="editarArticulo($event.keyCode, articulo)" | |
159 | + ng-focus="selectFocus($event)" | |
160 | + > | |
161 | + <i | |
162 | + class="selectable" | |
163 | + ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" | |
164 | + ng-hide="articulo.editPrecio" | |
165 | + ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"> | |
166 | + </i> | |
167 | + </td> | |
168 | + <td | |
169 | + class="col text-right" | |
170 | + ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo"> | |
171 | + </td> | |
172 | + <td class="text-center"> | |
173 | + <button | |
174 | + class="btn btn-outline-secondary" | |
175 | + ng-click="quitarArticulo(key)" | |
176 | + > | |
177 | + <i class="fa fa-trash"></i> | |
178 | + </button> | |
179 | + </td> | |
180 | + </tr> | |
181 | + </tbody> | |
182 | + <tfoot> | |
183 | + <tr ng-show="!cargando" class="d-flex"> | |
184 | + <td | |
185 | + class="align-middle" | |
186 | + ng-bind="articulosTabla.length + 1" | |
187 | + ></td> | |
188 | + <td class="col"> | |
189 | + <input | |
190 | + class="form-control" | |
191 | + ng-model="articuloACargar.sectorCodigo" | |
192 | + readonly | |
193 | + > | |
194 | + </td> | |
195 | + <td class="col-4 tabla-articulo-descripcion"> | |
196 | + <input | |
197 | + class="form-control" | |
198 | + ng-model="articuloACargar.descripcion" | |
199 | + readonly | |
200 | + > | |
201 | + </td> | |
202 | + <td class="col text-right"> | |
203 | + <input | |
204 | + class="form-control" | |
205 | + type="number" | |
206 | + min="1" | |
207 | + ng-model="articuloACargar.cantidad" | |
208 | + foca-focus="!cargando" | |
209 | + esc-key="resetFilter()" | |
210 | + ng-keypress="agregarATabla($event.keyCode)" | |
211 | + > | |
212 | + </td> | |
213 | + <td class="col text-right"> | |
214 | + <input | |
215 | + class="form-control" | |
216 | + ng-value="articuloACargar.precio | currency: remito.moneda.simbolo : 4" | |
217 | + ng-show="idLista != -1" | |
218 | + readonly | |
219 | + > | |
220 | + <input | |
221 | + class="form-control" | |
222 | + type="number" | |
223 | + step="0.0001" | |
224 | + ng-model="articuloACargar.precio" | |
225 | + esc-key="resetFilter()" | |
226 | + ng-keypress="agregarATabla($event.keyCode)" | |
227 | + ng-show="idLista == -1" | |
228 | + > | |
229 | + </td> | |
230 | + <td class="col text-right"> | |
231 | + <input | |
232 | + class="form-control" | |
233 | + ng-value="getSubTotal() | currency: remito.moneda.simbolo" | |
234 | + readonly | |
235 | + ></td> | |
236 | + <td class="text-center align-middle"> | |
237 | + <button | |
238 | + class="btn btn-outline-secondary" | |
239 | + ng-click="agregarATabla(13)" | |
240 | + > | |
241 | + <i class="fa fa-save"></i> | |
242 | + </button> | |
243 | + </td> | |
244 | + </tr> | |
245 | + <tr ng-show="cargando" class="d-flex"> | |
246 | + <td colspan="7" class="col-12"> | |
247 | + <input | |
248 | + placeholder="Seleccione Articulo" | |
249 | + class="form-control form-control-sm" | |
250 | + readonly | |
251 | + ng-click="seleccionarArticulo()" | |
252 | + /> | |
253 | + </td> | |
254 | + </tr> | |
255 | + <tr class="d-flex"> | |
256 | + <td colspan="4" class="no-border-top"> | |
257 | + <strong>Items:</strong> | |
258 | + <a ng-bind="articulosTabla.length"></a> | |
259 | + </td> | |
260 | + <td class="text-right ml-auto table-celda-total no-border-top"> | |
261 | + <h3>Total:</h3> | |
262 | + </td> | |
263 | + <td class="table-celda-total text-right no-border-top" colspan="1"> | |
264 | + <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> | |
265 | + </td> | |
266 | + <td class="text-right no-border-top"> | |
267 | + <button | |
268 | + type="button" | |
269 | + class="btn btn-default btn-sm" | |
270 | + > | |
271 | + Totales | |
272 | + </button> | |
273 | + </td> | |
274 | + </tr> | |
275 | + </tfoot> | |
276 | + </table> | |
277 | + </div> | |
278 | + | |
279 | + <!-- MOBILE --> | |
280 | + <div class="row d-sm-none"> | |
281 | + <table class="table table-sm table-striped table-dark margin-bottom-mobile"> | |
282 | + <thead> | |
283 | + <tr class="d-flex"> | |
284 | + <th class="">#</th> | |
285 | + <th class="col px-0"> | |
286 | + <div class="d-flex"> | |
287 | + <div class="col-4 px-1">Código</div> | |
288 | + <div class="col-8 px-1">Descripción</div> | |
289 | + </div> | |
290 | + <div class="d-flex"> | |
291 | + <div class="col-3 px-1">Cantidad</div> | |
292 | + <div class="col px-1 text-right">P. Uni.</div> | |
293 | + <div class="col px-1 text-right">Subtotal</div> | |
294 | + </div> | |
295 | + </th> | |
296 | + <th class="text-center tamaño-boton"> | |
297 | + | |
298 | + </th> | |
299 | + </tr> | |
300 | + </thead> | |
301 | + <tbody> | |
302 | + <tr | |
303 | + ng-repeat="(key, articulo) in articulosTabla" | |
304 | + ng-show="show || key == articulosTabla.length - 1" | |
305 | + > | |
306 | + <td class="w-100 align-middle d-flex p-0"> | |
307 | + <div class="align-middle p-1"> | |
308 | + <span ng-bind="key+1" class="align-middle"></span> | |
309 | + </div> | |
310 | + <div class="col px-0"> | |
311 | + <div class="d-flex"> | |
312 | + <div class="col-4 px-1"> | |
313 | + <span | |
314 | + ng-bind="articulo.sector + '-' + articulo.codigo" | |
315 | + ></span> | |
316 | + </div> | |
317 | + <div class="col-8 px-1"> | |
318 | + <span ng-bind="articulo.descripcion"></span> | |
319 | + </div> | |
320 | + </div> | |
321 | + <div class="d-flex"> | |
322 | + <div class="col-3 px-1"> | |
323 | + <span ng-bind="'x' + articulo.cantidad"></span> | |
324 | + </div> | |
325 | + <div class="col-3 px-1 text-right"> | |
326 | + <span ng-bind="articulo.precio | currency: remito.moneda.simbolo : 4"></span> | |
327 | + </div> | |
328 | + <div class="col px-1 text-right"> | |
329 | + <span | |
330 | + ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.simbolo" | |
331 | + > | |
332 | + </span> | |
333 | + </div> | |
334 | + </div> | |
335 | + </div> | |
336 | + <div class="align-middle p-1"> | |
337 | + <button | |
338 | + class="btn btn-outline-secondary" | |
339 | + ng-click="quitarArticulo(key)" | |
340 | + > | |
341 | + <i class="fa fa-trash"></i> | |
342 | + </button> | |
343 | + </div> | |
344 | + </td> | |
345 | + </tr> | |
346 | + </tbody> | |
347 | + <tfoot> | |
348 | + <!-- CARGANDO ITEM --> | |
349 | + <tr ng-show="!cargando" class="d-flex"> | |
350 | + <td | |
351 | + class="align-middle p-1" | |
352 | + ng-bind="articulosTabla.length + 1" | |
353 | + ></td> | |
354 | + <td class="col p-0"> | |
355 | + <div class="d-flex"> | |
356 | + <div class="col-4 px-1"> | |
357 | + <span | |
358 | + ng-bind="articuloACargar.sectorCodigo" | |
359 | + ></span> | |
360 | + </div> | |
361 | + <div class="col-8 px-1"> | |
362 | + <span ng-bind="articuloACargar.descripcion"></span> | |
363 | + </div> | |
364 | + </div> | |
365 | + <div class="d-flex"> | |
366 | + <div class="col-3 px-1 m-1"> | |
367 | + <input | |
368 | + class="form-control p-1" | |
369 | + type="number" | |
370 | + min="1" | |
371 | + ng-model="articuloACargar.cantidad" | |
372 | + foca-focus="!cargando" | |
373 | + ng-keypress="agregarATabla($event.keyCode)" | |
374 | + style="height: auto; line-height: 1.1em" | |
375 | + > | |
376 | + </div> | |
377 | + <div class="col-3 px-1 text-right"> | |
378 | + <span ng-bind="articuloACargar.precio | currency: remito.moneda.simbolo : 4"></span> | |
379 | + </div> | |
380 | + <div class="col px-1 text-right"> | |
381 | + <span | |
382 | + ng-bind="getSubTotal() | currency: remito.moneda.simbolo" | |
383 | + > | |
384 | + </span> | |
385 | + </div> | |
386 | + </div> | |
387 | + </td> | |
388 | + <td class="text-center align-middle"> | |
389 | + <button | |
390 | + class="btn btn-outline-secondary" | |
391 | + ng-click="agregarATabla(13)" | |
392 | + > | |
393 | + <i class="fa fa-save"></i> | |
394 | + </button> | |
395 | + </td> | |
396 | + </tr> | |
397 | + <!-- SELECCIONAR PRODUCTO --> | |
398 | + <tr ng-show="cargando" class="d-flex"> | |
399 | + <td class="col-12"> | |
400 | + <input | |
401 | + placeholder="Seleccione Articulo" | |
402 | + class="form-control form-control-sm" | |
403 | + readonly | |
404 | + ng-click="seleccionarArticulo()" | |
405 | + /> | |
406 | + </td> | |
407 | + </tr> | |
408 | + <!-- TOOGLE EXPANDIR --> | |
409 | + <tr> | |
410 | + <td class="col"> | |
411 | + <button | |
412 | + class="btn btn-outline-secondary selectable w-100" | |
413 | + ng-click="show = !show; masMenos()" | |
414 | + ng-show="articulosTabla.length > 0" | |
415 | + > | |
416 | + <i | |
417 | + class="fa fa-chevron-down" | |
418 | + ng-hide="show" | |
419 | + aria-hidden="true" | |
420 | + > | |
421 | + </i> | |
422 | + <i | |
423 | + class="fa fa-chevron-up" | |
424 | + ng-show="show" | |
425 | + aria-hidden="true"> | |
426 | + </i> | |
427 | + </button> | |
428 | + </td> | |
429 | + </tr> | |
430 | + <!-- FOOTER --> | |
431 | + <tr class="d-flex"> | |
432 | + <td class="align-middle no-border-top" colspan="2"> | |
433 | + <strong>Cantidad Items:</strong> | |
434 | + <a ng-bind="articulosTabla.length"></a> | |
435 | + </td> | |
436 | + <td class="text-right ml-auto table-celda-total no-border-top"> | |
437 | + <h3>Total:</h3> | |
438 | + </td> | |
439 | + <td class="table-celda-total text-right no-border-top"> | |
440 | + <h3>{{getTotal() | currency: remito.moneda.simbolo}}</h3> | |
441 | + </td> | |
442 | + </tr> | |
443 | + </tfoot> | |
444 | + </table> | |
445 | + </div> | |
446 | + </div> | |
447 | + <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-md-block"> | |
448 | + <div class="row align-items-end"> | |
449 | + <div class="col-12"> | |
450 | + <button | |
451 | + ng-click="crearRemito()" | |
452 | + type="submit" | |
453 | + title="Crear nota remito" | |
454 | + class="btn btn-default btn-block mb-2"> | |
455 | + Guardar | |
456 | + </button> | |
457 | + <button | |
458 | + ng-click="salir()" | |
459 | + type="button" | |
460 | + title="Salir" | |
461 | + class="btn btn-default btn-block"> | |
462 | + Salir | |
463 | + </button> | |
464 | + </div> | |
465 | + </div> | |
466 | + </div> | |
467 | + </div> | |
468 | + <div class="row d-md-none fixed-bottom"> | |
469 | + <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | |
470 | + <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | |
471 | + <span class="mr-3 ml-auto" ng-click="crearRemito()">Guardar</span> | |
472 | + </div> | |
473 | + </div> | |
474 | +</div> |
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 |