Commit 330ea2290542954ba149a9ebe7c8447edefec876
Exists in
master
and in
1 other branch
Merge branch 'develop' into 'master'
Develop See merge request !53
Showing
10 changed files
Show diff stats
gulpfile.js
1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
2 | const clean = require('gulp-clean'); | 2 | const clean = require('gulp-clean'); |
3 | const concat = require('gulp-concat'); | 3 | const concat = require('gulp-concat'); |
4 | const htmlmin = require('gulp-htmlmin'); | 4 | const htmlmin = require('gulp-htmlmin'); |
5 | const rename = require('gulp-rename'); | 5 | const rename = require('gulp-rename'); |
6 | const uglify = require('gulp-uglify'); | 6 | const uglify = require('gulp-uglify'); |
7 | const gulp = require('gulp'); | 7 | const gulp = require('gulp'); |
8 | const pump = require('pump'); | 8 | const pump = require('pump'); |
9 | const jshint = require('gulp-jshint'); | 9 | const jshint = require('gulp-jshint'); |
10 | const replace = require('gulp-replace'); | 10 | const replace = require('gulp-replace'); |
11 | const connect = require('gulp-connect'); | 11 | const connect = require('gulp-connect'); |
12 | const header = require('gulp-header'); | ||
13 | const footer = require('gulp-footer'); | ||
14 | const gulpSequence = require('gulp-sequence'); | ||
12 | 15 | ||
13 | var paths = { | 16 | var paths = { |
14 | srcJS: 'src/js/*.js', | 17 | srcJS: 'src/js/*.js', |
15 | srcViews: 'src/views/*.html', | 18 | srcViews: 'src/views/*.html', |
19 | specs: 'spec/*.js', | ||
16 | tmp: 'tmp', | 20 | tmp: 'tmp', |
17 | dist: 'dist/' | 21 | dist: 'dist/' |
18 | }; | 22 | }; |
19 | 23 | ||
24 | gulp.task('uglify', gulpSequence('clean', ['templates', 'uglify-spec'], 'uglify-app')); | ||
25 | |||
20 | gulp.task('templates', ['clean'], function() { | 26 | gulp.task('templates', ['clean'], function() { |
21 | return pump( | 27 | return pump( |
22 | [ | 28 | [ |
23 | gulp.src(paths.srcViews), | 29 | gulp.src(paths.srcViews), |
24 | htmlmin(), | 30 | htmlmin(), |
25 | templateCache('views.js', { | 31 | templateCache('views.js', { |
26 | module: 'focaCrearRemito', | 32 | module: 'focaCrearRemito', |
27 | root: '' | 33 | root: '' |
28 | }), | 34 | }), |
29 | gulp.dest(paths.tmp) | 35 | gulp.dest(paths.tmp) |
30 | ] | 36 | ] |
31 | ); | 37 | ); |
32 | }); | 38 | }); |
33 | 39 | ||
34 | gulp.task('uglify', ['templates'], function() { | 40 | gulp.task('uglify-app', function() { |
35 | return pump( | 41 | return pump( |
36 | [ | 42 | [ |
37 | gulp.src([ | 43 | gulp.src([ |
38 | paths.srcJS, | 44 | paths.srcJS, |
39 | 'tmp/views.js' | 45 | 'tmp/views.js' |
40 | ]), | 46 | ]), |
41 | concat('foca-crear-remito.js'), | 47 | concat('foca-crear-remito.js'), |
42 | replace('src/views/', ''), | 48 | replace('src/views/', ''), |
43 | gulp.dest(paths.tmp), | 49 | gulp.dest(paths.tmp), |
44 | rename('foca-crear-remito.min.js'), | 50 | rename('foca-crear-remito.min.js'), |
45 | uglify(), | 51 | uglify(), |
46 | gulp.dest(paths.dist) | 52 | gulp.dest(paths.dist) |
47 | ] | 53 | ] |
48 | ); | 54 | ); |
49 | }); | 55 | }); |
50 | 56 | ||
57 | gulp.task('uglify-spec', function() { | ||
58 | return pump( | ||
59 | [ | ||
60 | gulp.src(paths.specs), | ||
61 | concat('foca-crear-remito.spec.js'), | ||
62 | replace('src/views/', ''), | ||
63 | header("describe('Módulo foca-crear-remito', function() { \n"), | ||
64 | footer("});"), | ||
65 | gulp.dest(paths.dist) | ||
66 | ] | ||
67 | ); | ||
68 | }); | ||
69 | |||
51 | gulp.task('clean', function() { | 70 | gulp.task('clean', function() { |
52 | return gulp.src(['tmp', 'dist'], {read: false}) | 71 | return gulp.src(['tmp', 'dist'], {read: false}) |
53 | .pipe(clean()); | 72 | .pipe(clean()); |
54 | }); | 73 | }); |
55 | 74 | ||
56 | gulp.task('pre-commit', function() { | 75 | gulp.task('pre-commit', function() { |
57 | return pump( | 76 | return pump( |
58 | [ | 77 | [ |
59 | gulp.src(paths.srcJS), | 78 | gulp.src([paths.srcJS, paths.specs]), |
60 | jshint('.jshintrc'), | 79 | jshint('.jshintrc'), |
61 | jshint.reporter('default'), | 80 | jshint.reporter('default'), |
62 | jshint.reporter('fail') | 81 | jshint.reporter('fail') |
63 | ] | 82 | ] |
64 | ); | 83 | ); |
65 | 84 | ||
66 | gulp.start('uglify'); | 85 | gulp.start('uglify'); |
67 | }); | 86 | }); |
68 | 87 | ||
69 | gulp.task('webserver', function() { | 88 | gulp.task('webserver', function() { |
70 | pump [ | 89 | pump [ |
71 | connect.server({port: 3300, host: '0.0.0.0'}) | 90 | connect.server({port: 3300, host: '0.0.0.0'}) |
72 | ] | 91 | ] |
73 | }); | 92 | }); |
74 | 93 | ||
75 | gulp.task('clean-post-install', function() { | 94 | gulp.task('clean-post-install', function() { |
76 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 95 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
77 | 'index.html'], {read: false}) | 96 | 'index.html'], {read: false}) |
78 | .pipe(clean()); | 97 | .pipe(clean()); |
79 | }); | 98 | }); |
80 | 99 | ||
81 | gulp.task('default', ['webserver']); | 100 | gulp.task('default', ['webserver']); |
82 | 101 | ||
83 | gulp.task('watch', function() { | 102 | gulp.task('watch', function() { |
84 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 103 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); |
85 | }); | 104 | }); |
86 | 105 | ||
87 | gulp.task('copy', ['uglify'], function() { | 106 | gulp.task('copy', ['uglify'], function() { |
88 | return gulp.src('dist/*.js') | 107 | return gulp.src('dist/*.js') |
89 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist/')); | 108 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist/')); |
90 | }); | 109 | }); |
91 | 110 | ||
92 | gulp.task('watchAndCopy', function() { | 111 | gulp.task('watchAndCopy', function() { |
93 | return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); | 112 | return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); |
94 | }); | 113 | }); |
95 | 114 |
package.json
1 | { | 1 | { |
2 | "name": "foca-crear-remito", | 2 | "name": "foca-crear-remito", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Listado y ABM nota de remitos", | 4 | "description": "Listado y ABM nota de remitos", |
5 | "main": "index.js", | 5 | "main": "index.js", |
6 | "scripts": { | 6 | "scripts": { |
7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "test.html", |
8 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
9 | "gulp-pre-commit": "gulp pre-commit", | 9 | "gulp-pre-commit": "gulp pre-commit", |
10 | "postinstall": "npm run compile && gulp clean-post-install", | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
11 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-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" | 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 | "pre-commit": [ | 13 | "pre-commit": [ |
14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
15 | ], | 15 | ], |
16 | "repository": { | 16 | "repository": { |
17 | "type": "git", | 17 | "type": "git", |
18 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-remito.git" | 18 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-remito.git" |
19 | }, | 19 | }, |
20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
21 | "license": "ISC", | 21 | "license": "ISC", |
22 | "peerDependencies": { | 22 | "peerDependencies": { |
23 | "foca-busqueda-cliente": "git+http://git.focasoftware.com/npm/foca-busqueda-cliente.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", | 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", | 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", | 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", | 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" | 28 | "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git" |
29 | }, | 29 | }, |
30 | "devDependencies": { | 30 | "devDependencies": { |
31 | "angular": "^1.7.5", | 31 | "angular": "^1.7.5", |
32 | "angular-cookies": "^1.7.5", | 32 | "angular-cookies": "^1.7.5", |
33 | "angular-ladda": "^0.4.3", | 33 | "angular-ladda": "^0.4.3", |
34 | "angular-mocks": "^1.7.7", | ||
34 | "angular-route": "^1.7.5", | 35 | "angular-route": "^1.7.5", |
35 | "bootstrap": "^4.1.3", | 36 | "bootstrap": "^4.1.3", |
36 | "foca-botonera-facturador": "git+http://git.focasoftware.com/npm/foca-botonera-facturador.git", | 37 | "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-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-configuracion": "git+http://git.focasoftware.com/npm/foca-configuracion.git", |
39 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | 40 | "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": "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-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-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-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-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", | 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", | 47 | "foca-seguimiento": "git+http://git.focasoftware.com/npm/foca-seguimiento.git", |
50 | "font-awesome": "^4.7.0", | 48 | "font-awesome": "^4.7.0", |
51 | "gulp": "^3.9.1", | 49 | "gulp": "^3.9.1", |
52 | "gulp-angular-templatecache": "^2.2.5", | 50 | "gulp-angular-templatecache": "^2.2.5", |
53 | "gulp-clean": "^0.4.0", | 51 | "gulp-clean": "^0.4.0", |
54 | "gulp-concat": "^2.6.1", | 52 | "gulp-concat": "^2.6.1", |
55 | "gulp-connect": "^5.6.1", | 53 | "gulp-connect": "^5.6.1", |
56 | "gulp-htmlmin": "^5.0.1", | 54 | "gulp-htmlmin": "^5.0.1", |
57 | "gulp-jshint": "^2.1.0", | 55 | "gulp-jshint": "^2.1.0", |
58 | "gulp-rename": "^1.4.0", | 56 | "gulp-rename": "^1.4.0", |
59 | "gulp-replace": "^1.0.0", | 57 | "gulp-replace": "^1.0.0", |
60 | "gulp-sequence": "^1.0.0", | 58 | "gulp-sequence": "^1.0.0", |
61 | "gulp-uglify": "^3.0.1", | 59 | "gulp-uglify": "^3.0.1", |
62 | "gulp-uglify-es": "^1.0.4", | 60 | "gulp-uglify-es": "^1.0.4", |
63 | "jasmine-core": "^3.3.0", | 61 | "jasmine-core": "^3.3.0", |
64 | "jquery": "^3.3.1", | 62 | "jquery": "^3.3.1", |
65 | "jshint": "^2.9.6", | 63 | "jshint": "^2.9.6", |
66 | "ladda": "1.0.6", | 64 | "ladda": "1.0.6", |
67 | "pre-commit": "^1.2.2", | 65 | "pre-commit": "^1.2.2", |
68 | "pump": "^3.0.0", | 66 | "pump": "^3.0.0", |
69 | "ui-bootstrap4": "^3.0.5" | 67 | "ui-bootstrap4": "^3.0.5" |
70 | } | 68 | } |
71 | } | 69 | } |
spec/controllerSpec.js
File was created | 1 | describe('Controlador modulo crear remito', function() { | |
2 | |||
3 | var $controller; | ||
4 | |||
5 | beforeEach(function() { | ||
6 | |||
7 | module('focaCrearRemito'); | ||
8 | |||
9 | inject(function(_$controller_) { | ||
10 | $controller = _$controller_; | ||
11 | }); | ||
12 | }); | ||
13 | |||
14 | describe('Controlador remitoController', function() { | ||
15 | |||
16 | var timeout; | ||
17 | |||
18 | beforeEach(function() { | ||
19 | |||
20 | inject(function($timeout) { | ||
21 | timeout = $timeout; | ||
22 | }); | ||
23 | }); | ||
24 | |||
25 | it('Existe el controlador remitoController', function() { | ||
26 | |||
27 | //act | ||
28 | var controlador = $controller('remitoController', { | ||
29 | $scope: { | ||
30 | $broadcast: function() { }, | ||
31 | $watch: function() { } | ||
32 | }, | ||
33 | $uibModal: {}, | ||
34 | $location: {}, | ||
35 | $filter: {}, | ||
36 | crearRemitoService: { | ||
37 | getBotonera: function() { }, | ||
38 | getCotizacionByIdMoneda: function() { | ||
39 | return { | ||
40 | then: function() { } | ||
41 | }; | ||
42 | }, | ||
43 | getNumeroRemito: function() { | ||
44 | return { | ||
45 | then: function() { } | ||
46 | }; | ||
47 | } | ||
48 | }, | ||
49 | $timeout: timeout, | ||
50 | focaModalService: {}, | ||
51 | remitoBusinessService: {}, | ||
52 | $rootScope: { | ||
53 | $on: function() { } | ||
54 | }, | ||
55 | focaBotoneraLateralService: {}, | ||
56 | $localStorage: {} | ||
57 | }); | ||
58 | |||
59 | //assert | ||
60 | expect(typeof controlador).toEqual('object'); | ||
61 | |||
62 | }); | ||
63 | |||
64 | it('seleccionarNotaPedido levanta modal', function() { | ||
65 | |||
66 | //arrange | ||
67 | var scope = { | ||
68 | $broadcast: function() { }, | ||
69 | $watch: function() { } | ||
70 | }; | ||
71 | var uibModal = { | ||
72 | open: function() { } | ||
73 | }; | ||
74 | |||
75 | $controller('remitoController', { | ||
76 | $scope: scope, | ||
77 | $uibModal: uibModal, | ||
78 | $location: {}, | ||
79 | $filter: {}, | ||
80 | crearRemitoService: { | ||
81 | getBotonera: function() { }, | ||
82 | getCotizacionByIdMoneda: function() { | ||
83 | return { | ||
84 | then: function() { } | ||
85 | }; | ||
86 | }, | ||
87 | getNumeroRemito: function() { | ||
88 | return { | ||
89 | then: function() { } | ||
90 | }; | ||
91 | } | ||
92 | }, | ||
93 | $timeout: timeout, | ||
94 | focaModalService: {}, | ||
95 | remitoBusinessService: {}, | ||
96 | $rootScope: { | ||
97 | $on: function() { } | ||
98 | }, | ||
99 | focaBotoneraLateralService: {}, | ||
100 | $localStorage: {} | ||
101 | }); | ||
102 | |||
103 | //act | ||
104 | spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } }); | ||
105 | spyOn(scope, 'seleccionarNotaPedido'); | ||
106 | scope.seleccionarNotaPedido(); | ||
107 | |||
108 | //assert | ||
109 | expect(scope.seleccionarNotaPedido).toHaveBeenCalled(); | ||
110 | |||
111 | }); | ||
112 | |||
113 | it('seleccionarRemito levanta modal', function() { | ||
114 | |||
115 | //arrange | ||
116 | var scope = { | ||
117 | $broadcast: function() { }, | ||
118 | $watch: function() { } | ||
119 | }; | ||
120 | var uibModal = { | ||
121 | open: function() { } | ||
122 | }; | ||
123 | |||
124 | $controller('remitoController', { | ||
125 | $scope: scope, | ||
126 | $uibModal: uibModal, | ||
127 | $location: {}, | ||
128 | $filter: {}, | ||
129 | crearRemitoService: { | ||
130 | getBotonera: function() { }, | ||
131 | getCotizacionByIdMoneda: function() { | ||
132 | return { | ||
133 | then: function() { } | ||
134 | }; | ||
135 | }, | ||
136 | getNumeroRemito: function() { | ||
137 | return { | ||
138 | then: function() { } | ||
139 | }; | ||
140 | } | ||
141 | }, | ||
142 | $timeout: timeout, | ||
143 | focaModalService: {}, | ||
144 | remitoBusinessService: {}, | ||
145 | $rootScope: { | ||
146 | $on: function() { } | ||
147 | }, | ||
148 | focaBotoneraLateralService: {}, | ||
149 | $localStorage: {} | ||
150 | }); | ||
151 | |||
152 | //act | ||
153 | spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } }); | ||
154 | spyOn(scope, 'seleccionarRemito'); | ||
155 | scope.seleccionarRemito(); | ||
156 | |||
157 | //assert | ||
158 | expect(scope.seleccionarRemito).toHaveBeenCalled(); | ||
159 | |||
160 | }); | ||
161 | |||
162 | it('crearRemito muestra alerta cuando no se eligió vendedor', function() { | ||
163 | |||
164 | //arrange | ||
165 | var scope = { | ||
166 | $broadcast: function() { }, | ||
167 | $watch: function() { } | ||
168 | }; | ||
169 | var focaModalService = { | ||
170 | alert: function() { } | ||
171 | }; | ||
172 | |||
173 | $controller('remitoController', { | ||
174 | $scope: scope, | ||
175 | $uibModal: {}, | ||
176 | $location: {}, | ||
177 | $filter: {}, | ||
178 | crearRemitoService: { | ||
179 | getBotonera: function() { }, | ||
180 | getCotizacionByIdMoneda: function() { | ||
181 | return { | ||
182 | then: function() { } | ||
183 | }; | ||
184 | }, | ||
185 | getNumeroRemito: function() { | ||
186 | return { | ||
187 | then: function() { } | ||
188 | }; | ||
189 | } | ||
190 | }, | ||
191 | $timeout: timeout, | ||
192 | focaModalService: focaModalService, | ||
193 | remitoBusinessService: {}, | ||
194 | $rootScope: { | ||
195 | $on: function() { } | ||
196 | }, | ||
197 | focaBotoneraLateralService: {}, | ||
198 | $localStorage: {} | ||
199 | }); | ||
200 | |||
201 | //act | ||
202 | spyOn(focaModalService, 'alert'); | ||
203 | scope.crearRemito(); | ||
204 | |||
205 | //assert | ||
206 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Vendedor'); | ||
207 | |||
208 | }); | ||
209 | |||
210 | it('crearRemito muestra alerta cuando no se eligió cliente', function() { | ||
211 | |||
212 | //arrange | ||
213 | var scope = { | ||
214 | $broadcast: function() { }, | ||
215 | $watch: function() { } | ||
216 | }; | ||
217 | var focaModalService = { | ||
218 | alert: function() { } | ||
219 | }; | ||
220 | |||
221 | $controller('remitoController', { | ||
222 | $scope: scope, | ||
223 | $uibModal: {}, | ||
224 | $location: {}, | ||
225 | $filter: {}, | ||
226 | crearRemitoService: { | ||
227 | getBotonera: function() { }, | ||
228 | getCotizacionByIdMoneda: function() { | ||
229 | return { | ||
230 | then: function() { } | ||
231 | }; | ||
232 | }, | ||
233 | getNumeroRemito: function() { | ||
234 | return { | ||
235 | then: function() { } | ||
236 | }; | ||
237 | } | ||
238 | }, | ||
239 | $timeout: timeout, | ||
240 | focaModalService: focaModalService, | ||
241 | remitoBusinessService: {}, | ||
242 | $rootScope: { | ||
243 | $on: function() { } | ||
244 | }, | ||
245 | focaBotoneraLateralService: {}, | ||
246 | $localStorage: {} | ||
247 | }); | ||
248 | |||
249 | scope.remito = { | ||
250 | vendedor: { NUM: true }, | ||
251 | cliente: {} | ||
252 | }; | ||
253 | |||
254 | //act | ||
255 | spyOn(focaModalService, 'alert'); | ||
256 | scope.crearRemito(); | ||
257 | |||
258 | //assert | ||
259 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Cliente'); | ||
260 | |||
261 | }); | ||
262 | |||
263 | it('crearRemito muestra alerta cuando no se eligió Proveedor', function() { | ||
264 | |||
265 | //arrange | ||
266 | var scope = { | ||
267 | $broadcast: function() { }, | ||
268 | $watch: function() { } | ||
269 | }; | ||
270 | var focaModalService = { | ||
271 | alert: function() { } | ||
272 | }; | ||
273 | |||
274 | $controller('remitoController', { | ||
275 | $scope: scope, | ||
276 | $uibModal: {}, | ||
277 | $location: {}, | ||
278 | $filter: {}, | ||
279 | crearRemitoService: { | ||
280 | getBotonera: function() { }, | ||
281 | getCotizacionByIdMoneda: function() { | ||
282 | return { | ||
283 | then: function() { } | ||
284 | }; | ||
285 | }, | ||
286 | getNumeroRemito: function() { | ||
287 | return { | ||
288 | then: function() { } | ||
289 | }; | ||
290 | } | ||
291 | }, | ||
292 | $timeout: timeout, | ||
293 | focaModalService: focaModalService, | ||
294 | remitoBusinessService: {}, | ||
295 | $rootScope: { | ||
296 | $on: function() { } | ||
297 | }, | ||
298 | focaBotoneraLateralService: {}, | ||
299 | $localStorage: {} | ||
300 | }); | ||
301 | |||
302 | scope.remito = { | ||
303 | vendedor: { NUM: true }, | ||
304 | cliente: { COD: true } | ||
305 | }; | ||
306 | |||
307 | //act | ||
308 | spyOn(focaModalService, 'alert'); | ||
309 | scope.crearRemito(); | ||
310 | |||
311 | //assert | ||
312 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Proveedor'); | ||
313 | |||
314 | }); | ||
315 | |||
316 | it('crearRemito muestra alerta cuando no se eligió moneda', function() { | ||
317 | |||
318 | //arrange | ||
319 | var scope = { | ||
320 | $broadcast: function() { }, | ||
321 | $watch: function() { } | ||
322 | }; | ||
323 | var focaModalService = { | ||
324 | alert: function() { } | ||
325 | }; | ||
326 | |||
327 | $controller('remitoController', { | ||
328 | $scope: scope, | ||
329 | $uibModal: {}, | ||
330 | $location: {}, | ||
331 | $filter: {}, | ||
332 | crearRemitoService: { | ||
333 | getBotonera: function() { }, | ||
334 | getCotizacionByIdMoneda: function() { | ||
335 | return { | ||
336 | then: function() { } | ||
337 | }; | ||
338 | }, | ||
339 | getNumeroRemito: function() { | ||
340 | return { | ||
341 | then: function() { } | ||
342 | }; | ||
343 | } | ||
344 | }, | ||
345 | $timeout: timeout, | ||
346 | focaModalService: focaModalService, | ||
347 | remitoBusinessService: {}, | ||
348 | $rootScope: { | ||
349 | $on: function() { } | ||
350 | }, | ||
351 | focaBotoneraLateralService: {}, | ||
352 | $localStorage: {} | ||
353 | }); | ||
354 | |||
355 | scope.remito = { | ||
356 | vendedor: { NUM: true }, | ||
357 | cliente: { COD: true }, | ||
358 | proveedor: {}, | ||
359 | cotizacion: { moneda: {} } | ||
360 | }; | ||
361 | |||
362 | //act | ||
363 | spyOn(focaModalService, 'alert'); | ||
364 | scope.crearRemito(); | ||
365 | |||
366 | //assert | ||
367 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Moneda'); | ||
368 | |||
369 | }); | ||
370 | |||
371 | it('crearRemito muestra alerta cuando no se eligió Cotización', function() { | ||
372 | |||
373 | //arrange | ||
374 | var scope = { | ||
375 | $broadcast: function() { }, | ||
376 | $watch: function() { } | ||
377 | }; | ||
378 | var focaModalService = { | ||
379 | alert: function() { } | ||
380 | }; | ||
381 | |||
382 | $controller('remitoController', { | ||
383 | $scope: scope, | ||
384 | $uibModal: {}, | ||
385 | $location: {}, | ||
386 | $filter: {}, | ||
387 | crearRemitoService: { | ||
388 | getBotonera: function() { }, | ||
389 | getCotizacionByIdMoneda: function() { | ||
390 | return { | ||
391 | then: function() { } | ||
392 | }; | ||
393 | }, | ||
394 | getNumeroRemito: function() { | ||
395 | return { | ||
396 | then: function() { } | ||
397 | }; | ||
398 | } | ||
399 | }, | ||
400 | $timeout: timeout, | ||
401 | focaModalService: focaModalService, | ||
402 | remitoBusinessService: {}, | ||
403 | $rootScope: { | ||
404 | $on: function() { } | ||
405 | }, | ||
406 | focaBotoneraLateralService: {}, | ||
407 | $localStorage: {} | ||
408 | }); | ||
409 | |||
410 | scope.remito = { | ||
411 | vendedor: { NUM: true }, | ||
412 | cliente: { COD: true }, | ||
413 | proveedor: {}, | ||
414 | cotizacion: { moneda: { id: true } } | ||
415 | }; | ||
416 | |||
417 | //act | ||
418 | spyOn(focaModalService, 'alert'); | ||
419 | scope.crearRemito(); | ||
420 | |||
421 | //assert | ||
422 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Cotización'); | ||
423 | |||
424 | }); | ||
425 | |||
426 | it('crearRemito muestra alerta cuando no se eligió flete', function() { | ||
427 | |||
428 | //arrange | ||
429 | var scope = { | ||
430 | $broadcast: function() { }, | ||
431 | $watch: function() { } | ||
432 | }; | ||
433 | var focaModalService = { | ||
434 | alert: function() { } | ||
435 | }; | ||
436 | |||
437 | $controller('remitoController', { | ||
438 | $scope: scope, | ||
439 | $uibModal: {}, | ||
440 | $location: {}, | ||
441 | $filter: {}, | ||
442 | crearRemitoService: { | ||
443 | getBotonera: function() { }, | ||
444 | getCotizacionByIdMoneda: function() { | ||
445 | return { | ||
446 | then: function() { } | ||
447 | }; | ||
448 | }, | ||
449 | getNumeroRemito: function() { | ||
450 | return { | ||
451 | then: function() { } | ||
452 | }; | ||
453 | } | ||
454 | }, | ||
455 | $timeout: timeout, | ||
456 | focaModalService: focaModalService, | ||
457 | remitoBusinessService: {}, | ||
458 | $rootScope: { | ||
459 | $on: function() { } | ||
460 | }, | ||
461 | focaBotoneraLateralService: {}, | ||
462 | $localStorage: {} | ||
463 | }); | ||
464 | |||
465 | scope.remito = { | ||
466 | vendedor: { NUM: true }, | ||
467 | cliente: { COD: true }, | ||
468 | proveedor: {}, | ||
469 | cotizacion: { | ||
470 | moneda: { id: true }, | ||
471 | ID: true | ||
472 | } | ||
473 | }; | ||
474 | |||
475 | //act | ||
476 | spyOn(focaModalService, 'alert'); | ||
477 | scope.crearRemito(); | ||
478 | |||
479 | //assert | ||
480 | expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Flete'); | ||
481 | |||
482 | }); | ||
483 | |||
484 | it('crearRemito muestra alerta cuando no se eligió articulos', function() { | ||
485 | |||
486 | //arrange | ||
487 | var scope = { | ||
488 | $broadcast: function() { }, | ||
489 | $watch: function() { } | ||
490 | }; | ||
491 | var focaModalService = { | ||
492 | alert: function() { } | ||
493 | }; | ||
494 | |||
495 | $controller('remitoController', { | ||
496 | $scope: scope, | ||
497 | $uibModal: {}, | ||
498 | $location: {}, | ||
499 | $filter: {}, | ||
500 | crearRemitoService: { | ||
501 | getBotonera: function() { }, | ||
502 | getCotizacionByIdMoneda: function() { | ||
503 | return { | ||
504 | then: function() { } | ||
505 | }; | ||
506 | }, | ||
507 | getNumeroRemito: function() { | ||
508 | return { | ||
509 | then: function() { } | ||
510 | }; | ||
511 | } | ||
512 | }, | ||
513 | $timeout: timeout, | ||
514 | focaModalService: focaModalService, | ||
515 | remitoBusinessService: {}, | ||
516 | $rootScope: { | ||
517 | $on: function() { } | ||
518 | }, | ||
519 | focaBotoneraLateralService: {}, | ||
520 | $localStorage: {} | ||
521 | }); | ||
522 | |||
523 | scope.remito = { | ||
524 | vendedor: { NUM: true }, | ||
525 | cliente: { COD: true }, | ||
526 | proveedor: {}, | ||
527 | cotizacion: { | ||
528 | moneda: { id: true }, | ||
529 | ID: true | ||
530 | }, | ||
531 | flete: true, | ||
532 | articulosRemito: [] | ||
533 | }; | ||
534 | |||
535 | //act | ||
536 | spyOn(focaModalService, 'alert'); | ||
537 | scope.crearRemito(); | ||
538 | |||
539 | //assert | ||
540 | expect(focaModalService.alert).toHaveBeenCalledWith('Debe cargar al menos un articulo'); | ||
541 | |||
542 | }); | ||
543 | |||
544 | it('crearRemito llama a startGuardar', function() { | ||
545 | |||
546 | //arrange | ||
547 | var scope = { | ||
548 | $broadcast: function() { }, | ||
549 | $watch: function() { } | ||
550 | }; | ||
551 | var focaBotoneraLateralService = { | ||
552 | startGuardar: function() { } | ||
553 | }; | ||
554 | |||
555 | $controller('remitoController', { | ||
556 | $scope: scope, | ||
557 | $uibModal: {}, | ||
558 | $location: {}, | ||
559 | $filter: {}, | ||
560 | crearRemitoService: { | ||
561 | getBotonera: function() { }, | ||
562 | getCotizacionByIdMoneda: function() { | ||
563 | return { | ||
564 | then: function() { } | ||
565 | }; | ||
566 | }, | ||
567 | getNumeroRemito: function() { | ||
568 | return { | ||
569 | then: function() { } | ||
570 | }; | ||
571 | }, | ||
572 | crearRemito: function() { | ||
573 | return { | ||
574 | then: function() { } | ||
575 | }; | ||
576 | } | ||
577 | }, | ||
578 | $timeout: timeout, | ||
579 | focaModalService: {}, | ||
580 | remitoBusinessService: {}, | ||
581 | $rootScope: { | ||
582 | $on: function() { } | ||
583 | }, | ||
584 | focaBotoneraLateralService: focaBotoneraLateralService, | ||
585 | $localStorage: {} | ||
586 | }); | ||
587 | |||
588 | scope.remito = { | ||
589 | vendedor: { NUM: true }, | ||
590 | cliente: { COD: true }, | ||
591 | proveedor: {}, | ||
592 | cotizacion: { | ||
593 | moneda: { id: true }, | ||
594 | ID: true | ||
595 | }, | ||
596 | flete: true, | ||
597 | articulosRemito: [ 1 ] | ||
598 | }; | ||
599 | |||
600 | //act | ||
601 | spyOn(focaBotoneraLateralService, 'startGuardar'); | ||
602 | scope.crearRemito(); | ||
603 | |||
604 | //assert | ||
605 | expect(focaBotoneraLateralService.startGuardar).toHaveBeenCalled(); | ||
606 | |||
607 | }); | ||
608 | |||
609 | it('crearRemito llama a endGuardar y abre modal', function(done) { | ||
610 | |||
611 | //arrange | ||
612 | var scope = { | ||
613 | $broadcast: function() { }, | ||
614 | $watch: function() { } | ||
615 | }; | ||
616 | var focaBotoneraLateralService = { | ||
617 | startGuardar: function() { }, | ||
618 | endGuardar: function() { } | ||
619 | }; | ||
620 | var uibModal = { | ||
621 | open: function() { } | ||
622 | }; | ||
623 | var crearRemitoService = { | ||
624 | getBotonera: function() { }, | ||
625 | getCotizacionByIdMoneda: function() { | ||
626 | return { | ||
627 | then: function() { } | ||
628 | }; | ||
629 | }, | ||
630 | getNumeroRemito: function() { | ||
631 | return { | ||
632 | then: function() { } | ||
633 | }; | ||
634 | }, | ||
635 | crearRemito: function() { } | ||
636 | }; | ||
637 | |||
638 | $controller('remitoController', { | ||
639 | $scope: scope, | ||
640 | $uibModal: uibModal, | ||
641 | $location: {}, | ||
642 | $filter: {}, | ||
643 | crearRemitoService: crearRemitoService, | ||
644 | $timeout: timeout, | ||
645 | focaModalService: {}, | ||
646 | remitoBusinessService: { | ||
647 | addArticulos: function() { } | ||
648 | }, | ||
649 | $rootScope: { | ||
650 | $on: function() { } | ||
651 | }, | ||
652 | focaBotoneraLateralService: focaBotoneraLateralService, | ||
653 | $localStorage: {} | ||
654 | }); | ||
655 | |||
656 | scope.remito = { | ||
657 | vendedor: { NUM: true }, | ||
658 | cliente: { COD: true }, | ||
659 | proveedor: {}, | ||
660 | cotizacion: { | ||
661 | moneda: { id: true }, | ||
662 | ID: true | ||
663 | }, | ||
664 | flete: true, | ||
665 | articulosRemito: [1] | ||
666 | }; | ||
667 | var promiseRespond = Promise.resolve({ data: {} }); | ||
668 | |||
669 | //act | ||
670 | spyOn(crearRemitoService, 'crearRemito').and.returnValue(promiseRespond); | ||
671 | spyOn(focaBotoneraLateralService, 'endGuardar'); | ||
672 | spyOn(uibModal, 'open'); | ||
673 | scope.crearRemito(); | ||
674 | |||
675 | //assert | ||
676 | promiseRespond.then(function() { | ||
677 | |||
678 | expect(focaBotoneraLateralService.endGuardar).toHaveBeenCalled(); | ||
679 | done(); | ||
680 | }); | ||
681 | }); | ||
682 | |||
683 | it('seleccionarProductos abre modal', function() { | ||
684 | |||
685 | //arrange | ||
686 | var scope = { | ||
687 | $broadcast: function() { }, | ||
688 | $watch: function() { } | ||
689 | }; | ||
690 | var uibModal = { | ||
691 | open: function() { } | ||
692 | }; | ||
693 | |||
694 | $controller('remitoController', { | ||
695 | $scope: scope, | ||
696 | $uibModal: uibModal, | ||
697 | $location: {}, | ||
698 | $filter: {}, | ||
699 | crearRemitoService: { | ||
700 | getBotonera: function() {}, | ||
701 | getCotizacionByIdMoneda: function() { | ||
702 | return { | ||
703 | then: function() {} | ||
704 | }; | ||
705 | }, | ||
706 | getNumeroRemito: function() { | ||
707 | return { | ||
708 | then: function() {} | ||
709 | }; | ||
710 | } | ||
711 | }, | ||
712 | $timeout: timeout, | ||
713 | focaModalService: {}, | ||
714 | remitoBusinessService: { | ||
715 | addArticulos: function() { } | ||
716 | }, | ||
717 | $rootScope: { | ||
718 | $on: function() { } | ||
719 | }, | ||
720 | focaBotoneraLateralService: {}, | ||
721 | $localStorage: {} | ||
722 | }); | ||
723 | |||
724 | scope.remito = { | ||
725 | cotizacion: { | ||
726 | moneda: { }, | ||
727 | }, | ||
728 | }; | ||
729 | scope.idLista = true; | ||
730 | |||
731 | //act | ||
732 | spyOn(uibModal, 'open').and.returnValue({ result: { then: function() {} } }); | ||
733 | scope.seleccionarProductos(); | ||
734 | |||
735 | //assert | ||
736 | expect(uibModal.open).toHaveBeenCalled(); | ||
737 | }); | ||
738 | |||
739 | it('seleccionarProductos abre alerta si no se eligió lista', function() { | ||
740 | |||
741 | //arrange | ||
742 | var scope = { | ||
743 | $broadcast: function() { }, | ||
744 | $watch: function() { } | ||
745 | }; | ||
746 | var focaModalService = { | ||
747 | alert: function() { } | ||
748 | }; | ||
749 | |||
750 | $controller('remitoController', { | ||
751 | $scope: scope, | ||
752 | $uibModal: {}, | ||
753 | $location: {}, | ||
754 | $filter: {}, | ||
755 | crearRemitoService: { | ||
756 | getBotonera: function() {}, | ||
757 | getCotizacionByIdMoneda: function() { | ||
758 | return { | ||
759 | then: function() {} | ||
760 | }; | ||
761 | }, | ||
762 | getNumeroRemito: function() { | ||
763 | return { | ||
764 | then: function() {} | ||
765 | }; | ||
766 | } | ||
767 | }, | ||
768 | $timeout: timeout, | ||
769 | focaModalService: focaModalService, | ||
770 | remitoBusinessService: { | ||
771 | addArticulos: function() { } | ||
772 | }, | ||
773 | $rootScope: { | ||
774 | $on: function() { } | ||
775 | }, | ||
776 | focaBotoneraLateralService: {}, | ||
777 | $localStorage: {} | ||
778 | }); | ||
779 | |||
780 | //act | ||
781 | spyOn(focaModalService, 'alert'); | ||
782 | scope.seleccionarProductos(); | ||
783 | |||
784 | //assert | ||
785 | expect(focaModalService.alert) | ||
786 | .toHaveBeenCalledWith('Primero seleccione una lista de precio y condicion'); | ||
787 | }); | ||
788 | |||
789 | it('seleccionarPuntosDeDescarga abre modal', function() { | ||
790 | |||
791 | //arrange | ||
792 | var scope = { | ||
793 | $broadcast: function() { }, | ||
794 | $watch: function() { } | ||
795 | }; | ||
796 | var uibModal = { | ||
797 | open: function() { } | ||
798 | }; | ||
799 | |||
800 | $controller('remitoController', { | ||
801 | $scope: scope, | ||
802 | $uibModal: uibModal, | ||
803 | $location: {}, | ||
804 | $filter: {}, | ||
805 | crearRemitoService: { | ||
806 | getBotonera: function() {}, | ||
807 | getCotizacionByIdMoneda: function() { | ||
808 | return { | ||
809 | then: function() {} | ||
810 | }; | ||
811 | }, | ||
812 | getNumeroRemito: function() { | ||
813 | return { | ||
814 | then: function() {} | ||
815 | }; | ||
816 | } | ||
817 | }, | ||
818 | $timeout: timeout, | ||
819 | focaModalService: {}, | ||
820 | remitoBusinessService: { | ||
821 | addArticulos: function() { } | ||
822 | }, | ||
823 | $rootScope: { | ||
824 | $on: function() { } | ||
825 | }, | ||
826 | focaBotoneraLateralService: {}, | ||
827 | $localStorage: {} | ||
828 | }); | ||
829 | scope.remito = { | ||
830 | cliente: { COD: true }, | ||
831 | domicilio: { id: true } | ||
832 | }; | ||
833 | |||
834 | //act | ||
835 | spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } }); | ||
836 | scope.seleccionarPuntosDeDescarga(); | ||
837 | |||
838 | //assert | ||
839 | expect(uibModal.open).toHaveBeenCalled(); | ||
840 | }); | ||
841 | |||
842 | it('seleccionarVendedor abre modal', function() { | ||
843 | |||
844 | //arrange | ||
845 | var scope = { | ||
846 | $broadcast: function() { }, | ||
847 | $watch: function() { } | ||
848 | }; | ||
849 | var focaModalService = { | ||
850 | modal: function() { } | ||
851 | }; | ||
852 | |||
853 | $controller('remitoController', { | ||
854 | $scope: scope, | ||
855 | $uibModal: {}, | ||
856 | $location: {}, | ||
857 | $filter: {}, | ||
858 | crearRemitoService: { | ||
859 | getBotonera: function() {}, | ||
860 | getCotizacionByIdMoneda: function() { | ||
861 | return { | ||
862 | then: function() {} | ||
863 | }; | ||
864 | }, | ||
865 | getNumeroRemito: function() { | ||
866 | return { | ||
867 | then: function() {} | ||
868 | }; | ||
869 | } | ||
870 | }, | ||
871 | $timeout: timeout, | ||
872 | focaModalService: focaModalService, | ||
873 | remitoBusinessService: { | ||
874 | addArticulos: function() { } | ||
875 | }, | ||
876 | $rootScope: { | ||
877 | $on: function() { } | ||
878 | }, | ||
879 | focaBotoneraLateralService: {}, | ||
880 | $localStorage: {} | ||
881 | }); | ||
882 | |||
883 | //act | ||
884 | spyOn(focaModalService, 'modal').and.returnValue({ then: function() { } }); | ||
885 | scope.seleccionarVendedor(); | ||
886 | |||
887 | //assert | ||
888 | expect(focaModalService.modal).toHaveBeenCalled(); | ||
889 | }); | ||
890 | |||
891 | it('seleccionarCliente abre modal', function() { | ||
892 | |||
893 | //arrange | ||
894 | var scope = { | ||
895 | $broadcast: function() { }, | ||
896 | $watch: function() { } | ||
897 | }; | ||
898 | var uibModal = { | ||
899 | open: function() { } | ||
900 | }; | ||
901 | |||
902 | $controller('remitoController', { | ||
903 | $scope: scope, | ||
904 | $uibModal: uibModal, | ||
905 | $location: {}, | ||
906 | $filter: {}, | ||
907 | crearRemitoService: { | ||
908 | getBotonera: function() {}, | ||
909 | getCotizacionByIdMoneda: function() { | ||
910 | return { | ||
911 | then: function() {} | ||
912 | }; | ||
913 | }, | ||
914 | getNumeroRemito: function() { | ||
915 | return { | ||
916 | then: function() {} | ||
917 | }; | ||
918 | } | ||
919 | }, | ||
920 | $timeout: timeout, | ||
921 | focaModalService: {}, | ||
922 | remitoBusinessService: { | ||
923 | addArticulos: function() { } | ||
924 | }, | ||
925 | $rootScope: { | ||
926 | $on: function() { } | ||
927 | }, | ||
928 | focaBotoneraLateralService: {}, | ||
929 | $localStorage: {} | ||
930 | }); | ||
931 | |||
932 | //act | ||
933 | spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } }); | ||
934 | scope.seleccionarCliente(true); | ||
935 | |||
936 | //assert | ||
937 | expect(uibModal.open).toHaveBeenCalled(); | ||
938 | }); | ||
939 | |||
940 | it('seleccionarCliente setea cliente y llama a abrirModalDomicilios', function(done) { | ||
941 | |||
942 | //arrange | ||
943 | var scope = { | ||
944 | $broadcast: function() { }, | ||
945 | $watch: function() { } | ||
946 | }; | ||
947 | var uibModal = { | ||
948 | open: function() { } | ||
949 | }; | ||
950 | |||
951 | $controller('remitoController', { | ||
952 | $scope: scope, | ||
953 | $uibModal: uibModal, | ||
954 | $location: {}, | ||
955 | $filter: {}, | ||
956 | crearRemitoService: { | ||
957 | getBotonera: function() {}, | ||
958 | getCotizacionByIdMoneda: function() { | ||
959 | return { | ||
960 | then: function() {} | ||
961 | }; | ||
962 | }, | ||
963 | getNumeroRemito: function() { | ||
964 | return { | ||
965 | then: function() {} | ||
966 | }; | ||
967 | } | ||
968 | }, | ||
969 | $timeout: timeout, | ||
970 | focaModalService: {}, | ||
971 | remitoBusinessService: { | ||
972 | addArticulos: function() { } | ||
973 | }, | ||
974 | $rootScope: { | ||
975 | $on: function() { } | ||
976 | }, | ||
977 | focaBotoneraLateralService: {}, | ||
978 | $localStorage: {} | ||
979 | }); | ||
980 | var response = 'test'; | ||
981 | var promesa = { result: Promise.resolve(response) }; | ||
982 | |||
983 | //act | ||
984 | spyOn(uibModal, 'open').and.returnValue(promesa); | ||
985 | spyOn(scope, 'abrirModalDomicilios'); | ||
986 | scope.seleccionarCliente(true); | ||
987 | |||
988 | //assert | ||
989 | promesa.result.then(function() { | ||
990 | expect(scope.abrirModalDomicilios).toHaveBeenCalledWith(response); | ||
991 | expect(scope.cliente).toEqual(response); | ||
992 | done(); | ||
993 | }); | ||
994 | }); | ||
995 | |||
996 | it('seleccionarProveedor abre modal', function() { | ||
997 | |||
998 | //arrange | ||
999 | var scope = { | ||
1000 | $broadcast: function() { }, | ||
1001 | $watch: function() { } | ||
1002 | }; | ||
1003 | var focaModalService = { | ||
1004 | modal: function() { } | ||
1005 | }; | ||
1006 | |||
1007 | $controller('remitoController', { | ||
1008 | $scope: scope, | ||
1009 | $uibModal: {}, | ||
1010 | $location: {}, | ||
1011 | $filter: {}, | ||
1012 | crearRemitoService: { | ||
1013 | getBotonera: function() {}, | ||
1014 | getCotizacionByIdMoneda: function() { | ||
1015 | return { | ||
1016 | then: function() {} | ||
1017 | }; | ||
1018 | }, | ||
1019 | getNumeroRemito: function() { | ||
1020 | return { | ||
1021 | then: function() {} | ||
1022 | }; | ||
1023 | } | ||
1024 | }, | ||
1025 | $timeout: timeout, | ||
1026 | focaModalService: focaModalService, | ||
1027 | remitoBusinessService: { | ||
1028 | addArticulos: function() { } | ||
1029 | }, | ||
1030 | $rootScope: { | ||
1031 | $on: function() { } | ||
1032 | }, | ||
1033 | focaBotoneraLateralService: {}, | ||
1034 | $localStorage: {} | ||
1035 | }); | ||
1036 | |||
1037 | //act | ||
1038 | spyOn(focaModalService, 'modal').and.returnValue({ then: function() { } }); | ||
1039 | scope.seleccionarProveedor(); | ||
1040 | |||
1041 | //assert | ||
1042 | expect(focaModalService.modal).toHaveBeenCalled(); | ||
1043 | }); | ||
1044 | |||
1045 | it('seleccionarProveedor setea provedor y llama a callback', function(done) { | ||
1046 | |||
1047 | //arrange | ||
1048 | var scope = { | ||
1049 | $broadcast: function() { }, | ||
1050 | $watch: function() { } | ||
1051 | }; | ||
1052 | var focaModalService = { | ||
1053 | modal: function() { } | ||
1054 | }; | ||
1055 | |||
1056 | $controller('remitoController', { | ||
1057 | $scope: scope, | ||
1058 | $uibModal: {}, | ||
1059 | $location: {}, | ||
1060 | $filter: function() { | ||
1061 | return function() { }; | ||
1062 | }, | ||
1063 | crearRemitoService: { | ||
1064 | getBotonera: function() {}, | ||
1065 | getCotizacionByIdMoneda: function() { | ||
1066 | return { | ||
1067 | then: function() {} | ||
1068 | }; | ||
1069 | }, | ||
1070 | getNumeroRemito: function() { | ||
1071 | return { | ||
1072 | then: function() {} | ||
1073 | }; | ||
1074 | } | ||
1075 | }, | ||
1076 | $timeout: timeout, | ||
1077 | focaModalService: focaModalService, | ||
1078 | remitoBusinessService: { | ||
1079 | addArticulos: function() { } | ||
1080 | }, | ||
1081 | $rootScope: { | ||
1082 | $on: function() { } | ||
1083 | }, | ||
1084 | focaBotoneraLateralService: {}, | ||
1085 | $localStorage: {} | ||
1086 | }); | ||
1087 | var response = { COD: 1 }; | ||
1088 | var promesa = Promise.resolve(response); | ||
1089 | window.callback = function() { }; | ||
1090 | |||
1091 | //act | ||
1092 | spyOn(focaModalService, 'modal').and.returnValue(promesa); | ||
1093 | spyOn(window, 'callback'); | ||
1094 | scope.seleccionarProveedor(window.callback); | ||
1095 | |||
1096 | //assert | ||
1097 | promesa.then(function() { | ||
1098 | expect(window.callback).toHaveBeenCalled(); | ||
1099 | expect(scope.remito.proveedor).toBe(response); | ||
1100 | expect(scope.remito.idProveedor).toBe(response.COD); | ||
1101 | done(); | ||
1102 | }); | ||
1103 | }); | ||
1104 | |||
1105 | it('abrirModalDomicilios abre modal', function() { | ||
1106 | |||
1107 | //arrange | ||
1108 | var scope = { | ||
1109 | $broadcast: function() { }, | ||
1110 | $watch: function() { } | ||
1111 | }; | ||
1112 | var uibModal = { | ||
1113 | open: function() { } | ||
1114 | }; | ||
1115 | |||
1116 | $controller('remitoController', { | ||
1117 | $scope: scope, | ||
1118 | $uibModal: uibModal, | ||
1119 | $location: {}, | ||
1120 | $filter: {}, | ||
1121 | crearRemitoService: { | ||
1122 | getBotonera: function() {}, | ||
1123 | getCotizacionByIdMoneda: function() { | ||
1124 | return { | ||
1125 | then: function() {} | ||
1126 | }; | ||
1127 | }, | ||
1128 | getNumeroRemito: function() { | ||
1129 | return { | ||
1130 | then: function() {} | ||
1131 | }; | ||
1132 | } | ||
1133 | }, | ||
1134 | $timeout: timeout, | ||
1135 | focaModalService: {}, | ||
1136 | remitoBusinessService: { | ||
1137 | addArticulos: function() { } | ||
1138 | }, | ||
1139 | $rootScope: { | ||
1140 | $on: function() { } | ||
1141 | }, | ||
1142 | focaBotoneraLateralService: {}, | ||
1143 | $localStorage: {} | ||
1144 | }); | ||
1145 | |||
1146 | //act | ||
1147 | spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } }); | ||
1148 | scope.abrirModalDomicilios(); | ||
1149 | |||
1150 | //assert | ||
1151 | expect(uibModal.open).toHaveBeenCalled(); | ||
1152 | |||
1153 | }); | ||
1154 | |||
1155 | it('getTotal devuelve correctamente', function() { | ||
1156 | |||
1157 | //arrange | ||
1158 | var scope = { | ||
1159 | $broadcast: function() { }, | ||
1160 | $watch: function() { } | ||
1161 | }; | ||
1162 | |||
1163 | $controller('remitoController', { | ||
1164 | $scope: scope, | ||
1165 | $uibModal: {}, | ||
1166 | $location: {}, | ||
1167 | $filter: {}, | ||
1168 | crearRemitoService: { | ||
1169 | getBotonera: function() {}, | ||
1170 | getCotizacionByIdMoneda: function() { | ||
1171 | return { | ||
1172 | then: function() {} | ||
1173 | }; | ||
1174 | }, | ||
1175 | getNumeroRemito: function() { | ||
1176 | return { | ||
1177 | then: function() {} | ||
1178 | }; | ||
1179 | } | ||
1180 | }, | ||
1181 | $timeout: timeout, | ||
1182 | focaModalService: {}, | ||
1183 | remitoBusinessService: { | ||
1184 | addArticulos: function() { } | ||
1185 | }, | ||
1186 | $rootScope: { | ||
1187 | $on: function() { } | ||
1188 | }, | ||
1189 | focaBotoneraLateralService: {}, | ||
1190 | $localStorage: {} | ||
1191 | }); | ||
1192 | scope.remito = { | ||
1193 | articulosRemito: [ | ||
1194 | { | ||
1195 | precio: 100, | ||
1196 | cantidad: 3 | ||
1197 | } | ||
1198 | ] | ||
1199 | }; | ||
1200 | |||
1201 | //act | ||
1202 | var result = scope.getTotal(); | ||
1203 | |||
1204 | //assert | ||
1205 | expect(result).toEqual(300); | ||
1206 | |||
1207 | }); | ||
1208 | |||
1209 | it('getSubTotal devuelve correctamente', function() { | ||
1210 | |||
1211 | //arrange | ||
1212 | var scope = { | ||
1213 | $broadcast: function() { }, | ||
1214 | $watch: function() { } | ||
1215 | }; | ||
1216 | |||
1217 | $controller('remitoController', { | ||
1218 | $scope: scope, | ||
1219 | $uibModal: {}, | ||
1220 | $location: {}, | ||
1221 | $filter: {}, | ||
1222 | crearRemitoService: { | ||
1223 | getBotonera: function() {}, | ||
1224 | getCotizacionByIdMoneda: function() { | ||
1225 | return { | ||
1226 | then: function() {} | ||
1227 | }; | ||
1228 | }, | ||
1229 | getNumeroRemito: function() { | ||
1230 | return { | ||
1231 | then: function() {} | ||
1232 | }; | ||
1233 | } | ||
1234 | }, | ||
1235 | $timeout: timeout, | ||
1236 | focaModalService: {}, | ||
1237 | remitoBusinessService: { | ||
1238 | addArticulos: function() { } | ||
1239 | }, | ||
1240 | $rootScope: { | ||
1241 | $on: function() { } | ||
1242 | }, | ||
1243 | focaBotoneraLateralService: {}, | ||
1244 | $localStorage: {} | ||
1245 | }); | ||
1246 | scope.articuloACargar = { | ||
1247 | precio: 200, | ||
1248 | cantidad: 4 | ||
1249 | }; | ||
1250 | |||
1251 | //act | ||
1252 | var result = scope.getSubTotal(); | ||
1253 | |||
1254 | //assert | ||
1255 | expect(result).toEqual(800); | ||
1256 | |||
1257 | }); | ||
1258 | |||
1259 | it('seleccionarPreciosYCondiciones muestra alerta sino se eligió cliente', function() { | ||
1260 | |||
1261 | //arrange | ||
1262 | var scope = { | ||
1263 | $broadcast: function() { }, | ||
1264 | $watch: function() { } | ||
1265 | }; | ||
1266 | var focaModalService = { | ||
1267 | alert: function() {} | ||
1268 | }; | ||
1269 | |||
1270 | $controller('remitoController', { | ||
1271 | $scope: scope, | ||
1272 | $uibModal: {}, | ||
1273 | $location: {}, | ||
1274 | $filter: {}, | ||
1275 | crearRemitoService: { | ||
1276 | getBotonera: function() {}, | ||
1277 | getCotizacionByIdMoneda: function() { | ||
1278 | return { | ||
1279 | then: function() {} | ||
1280 | }; | ||
1281 | }, | ||
1282 | getNumeroRemito: function() { | ||
1283 | return { | ||
1284 | then: function() {} | ||
1285 | }; | ||
1286 | } | ||
1287 | }, | ||
1288 | $timeout: timeout, | ||
1289 | focaModalService: focaModalService, | ||
1290 | remitoBusinessService: { | ||
1291 | addArticulos: function() { } | ||
1292 | }, | ||
1293 | $rootScope: { | ||
1294 | $on: function() { } | ||
1295 | }, | ||
1296 | focaBotoneraLateralService: {}, | ||
1297 | $localStorage: {} | ||
1298 | }); | ||
1299 | |||
1300 | //act | ||
1301 | spyOn(focaModalService, 'alert'); | ||
1302 | scope.seleccionarPreciosYCondiciones(); | ||
1303 | |||
1304 | //assert | ||
1305 | expect(focaModalService.alert).toHaveBeenCalledWith('Primero seleccione un cliente'); | ||
1306 | |||
1307 | }); | ||
1308 | |||
1309 | it('seleccionarPreciosYCondiciones abre modal', function() { | ||
1310 | |||
1311 | //arrange | ||
1312 | var scope = { | ||
1313 | $broadcast: function() { }, | ||
1314 | $watch: function() { } | ||
1315 | }; | ||
1316 | var uibModal = { | ||
1317 | open: function() {} | ||
1318 | }; | ||
1319 | |||
1320 | $controller('remitoController', { | ||
1321 | $scope: scope, | ||
1322 | $uibModal: uibModal, | ||
1323 | $location: {}, | ||
1324 | $filter: {}, | ||
1325 | crearRemitoService: { | ||
1326 | getBotonera: function() {}, | ||
1327 | getCotizacionByIdMoneda: function() { | ||
1328 | return { | ||
1329 | then: function() {} | ||
1330 | }; | ||
1331 | }, | ||
1332 | getNumeroRemito: function() { | ||
1333 | return { | ||
1334 | then: function() {} | ||
1335 | }; | ||
1336 | } | ||
1337 | }, | ||
1338 | $timeout: timeout, | ||
1339 | focaModalService: {}, | ||
1340 | remitoBusinessService: { | ||
1341 | addArticulos: function() { } | ||
1342 | }, | ||
1343 | $rootScope: { | ||
1344 | $on: function() { } | ||
1345 | }, | ||
1346 | focaBotoneraLateralService: {}, | ||
1347 | $localStorage: {} | ||
1348 | }); | ||
1349 | scope.remito = { | ||
1350 | cliente: { COD: true } | ||
1351 | }; | ||
1352 | |||
1353 | //act | ||
1354 | spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } }); | ||
1355 | scope.seleccionarPreciosYCondiciones(); | ||
1356 | |||
1357 | //assert | ||
1358 | expect(uibModal.open).toHaveBeenCalled(); | ||
1359 | |||
1360 | }); | ||
1361 | |||
1362 | it('seleccionarMoneda abre modal y llama a cotizacion', function(done) { | ||
1363 | |||
1364 | //arrange | ||
1365 | var scope = { | ||
1366 | $broadcast: function() { }, | ||
1367 | $watch: function() { } | ||
1368 | }; | ||
1369 | var focaModalService = { | ||
1370 | modal: function() {} | ||
1371 | }; | ||
1372 | var uibModal = { | ||
1373 | open: function() { | ||
1374 | return { | ||
1375 | result: { | ||
1376 | then: function() {} | ||
1377 | } | ||
1378 | }; | ||
1379 | } | ||
1380 | }; | ||
1381 | |||
1382 | $controller('remitoController', { | ||
1383 | $scope: scope, | ||
1384 | $uibModal: uibModal, | ||
1385 | $location: {}, | ||
1386 | $filter: {}, | ||
1387 | crearRemitoService: { | ||
1388 | getBotonera: function() {}, | ||
1389 | getCotizacionByIdMoneda: function() { | ||
1390 | return { | ||
1391 | then: function() {} | ||
1392 | }; | ||
1393 | }, | ||
1394 | getNumeroRemito: function() { | ||
1395 | return { | ||
1396 | then: function() {} | ||
1397 | }; | ||
1398 | } | ||
1399 | }, | ||
1400 | $timeout: timeout, | ||
1401 | focaModalService: focaModalService, | ||
1402 | remitoBusinessService: { | ||
1403 | addArticulos: function() { } | ||
1404 | }, | ||
1405 | $rootScope: { | ||
1406 | $on: function() { } | ||
1407 | }, | ||
1408 | focaBotoneraLateralService: {}, | ||
1409 | $localStorage: {} | ||
1410 | }); | ||
1411 | var promesa = Promise.resolve('test'); | ||
1412 | |||
1413 | //act | ||
1414 | spyOn(focaModalService, 'modal').and.returnValue(promesa); | ||
1415 | scope.seleccionarMoneda(); | ||
1416 | |||
1417 | //assert | ||
1418 | promesa.then(function() { | ||
1419 | expect(focaModalService.modal).toHaveBeenCalled(); | ||
1420 | done(); | ||
1421 | }); | ||
1422 | }); | ||
1423 | |||
1424 | it('seleccionarObservaciones levanta prompt', function() { | ||
1425 | |||
1426 | //arrange | ||
1427 | var scope = { | ||
1428 | $broadcast: function() { }, | ||
1429 | $watch: function() { } | ||
1430 | }; | ||
1431 | var focaModalService = { | ||
1432 | prompt: function() {} | ||
1433 | }; | ||
1434 | |||
1435 | $controller('remitoController', { | ||
1436 | $scope: scope, | ||
1437 | $uibModal: {}, | ||
1438 | $location: {}, | ||
1439 | $filter: {}, | ||
1440 | crearRemitoService: { | ||
1441 | getBotonera: function() {}, | ||
1442 | getCotizacionByIdMoneda: function() { | ||
1443 | return { | ||
1444 | then: function() {} | ||
1445 | }; | ||
1446 | }, | ||
1447 | getNumeroRemito: function() { | ||
1448 | return { | ||
1449 | then: function() {} | ||
1450 | }; | ||
1451 | } | ||
1452 | }, | ||
1453 | $timeout: timeout, | ||
1454 | focaModalService: focaModalService, | ||
1455 | remitoBusinessService: { | ||
1456 | addArticulos: function() { } | ||
1457 | }, | ||
1458 | $rootScope: { | ||
1459 | $on: function() { } | ||
1460 | }, | ||
1461 | focaBotoneraLateralService: {}, | ||
1462 | $localStorage: {} | ||
1463 | }); | ||
1464 | |||
1465 | //act | ||
1466 | spyOn(focaModalService, 'prompt').and.returnValue({ then: function() { } }); | ||
1467 | scope.seleccionarObservaciones(); | ||
1468 | |||
1469 | //assert | ||
1470 | expect(focaModalService.prompt).toHaveBeenCalled(); | ||
1471 | }); | ||
1472 | |||
1473 | it('abrirModalCotizacion abre modal', function() { | ||
1474 | |||
1475 | //arrange | ||
1476 | var scope = { | ||
1477 | $broadcast: function() { }, | ||
1478 | $watch: function() { } | ||
1479 | }; | ||
1480 | var uibModal = { | ||
1481 | open: function() {} | ||
1482 | }; | ||
1483 | |||
1484 | $controller('remitoController', { | ||
1485 | $scope: scope, | ||
1486 | $uibModal: uibModal, | ||
1487 | $location: {}, | ||
1488 | $filter: {}, | ||
1489 | crearRemitoService: { | ||
1490 | getBotonera: function() {}, | ||
1491 | getCotizacionByIdMoneda: function() { | ||
1492 | return { | ||
1493 | then: function() {} | ||
1494 | }; | ||
1495 | }, | ||
1496 | getNumeroRemito: function() { | ||
1497 | return { | ||
1498 | then: function() {} | ||
1499 | }; | ||
1500 | } | ||
1501 | }, | ||
1502 | $timeout: timeout, | ||
1503 | focaModalService: {}, | ||
1504 | remitoBusinessService: { | ||
1505 | addArticulos: function() { } | ||
1506 | }, | ||
1507 | $rootScope: { | ||
1508 | $on: function() { } | ||
1509 | }, | ||
1510 | focaBotoneraLateralService: {}, | ||
1511 | $localStorage: {} | ||
1512 | }); | ||
1513 | |||
1514 | //act | ||
1515 | spyOn(uibModal, 'open').and.returnValue({ result: { then: function() { } } }); | ||
1516 | scope.abrirModalCotizacion(); | ||
1517 | |||
1518 | //assert | ||
1519 | expect(uibModal.open).toHaveBeenCalled(); | ||
1520 | }); | ||
1521 | }); | ||
1522 | }); | ||
1523 |
spec/routeSpec.js
File was created | 1 | describe('Rutas de módulo crear remito', function() { | |
2 | |||
3 | var route; | ||
4 | |||
5 | beforeEach(function() { | ||
6 | |||
7 | module('focaCrearRemito'); | ||
8 | inject(function($route) { | ||
9 | route = $route; | ||
10 | }); | ||
11 | }); | ||
12 | |||
13 | it('la ruta /venta-remito/crear lleva a la ruta correcta', function() { | ||
14 | |||
15 | //assert | ||
16 | expect(route.routes['/venta-remito/crear'].controller) | ||
17 | .toEqual('remitoController'); | ||
18 | expect(route.routes['/venta-remito/crear'].templateUrl) | ||
19 | .toEqual('src/views/remito.html'); | ||
20 | }); | ||
21 | }); | ||
22 |
spec/serviceSpec.js
File was created | 1 | describe('Servicios modulo crear remito', function() { | |
2 | |||
3 | beforeEach(function(){ | ||
4 | module('focaCrearRemito'); | ||
5 | inject(module(function($provide) { | ||
6 | $provide.value('API_ENDPOINT', { | ||
7 | URL: 'localhost' | ||
8 | }); | ||
9 | })); | ||
10 | }); | ||
11 | |||
12 | describe('servicio crearRemitoService', function() { | ||
13 | |||
14 | var servicio, httpBackend; | ||
15 | |||
16 | beforeEach(function() { | ||
17 | inject(function($httpBackend, _crearRemitoService_) { | ||
18 | servicio = _crearRemitoService_; | ||
19 | httpBackend = $httpBackend; | ||
20 | }); | ||
21 | }); | ||
22 | |||
23 | it('existe el servicio crearRemitoService', function() { | ||
24 | |||
25 | //assert | ||
26 | expect(typeof servicio).toEqual('object'); | ||
27 | }); | ||
28 | |||
29 | it('función crearRemito llama a ruta correcta', function() { | ||
30 | |||
31 | //arrange | ||
32 | var result; | ||
33 | var fakeParam = 1; | ||
34 | var respond = 'test'; | ||
35 | httpBackend.expectPOST('localhost/remito', fakeParam).respond(respond); | ||
36 | |||
37 | //act | ||
38 | servicio.crearRemito(fakeParam).then(function(res) { | ||
39 | result = res.data; | ||
40 | }); | ||
41 | httpBackend.flush(); | ||
42 | |||
43 | //assert | ||
44 | expect(result).toEqual(respond); | ||
45 | }); | ||
46 | |||
47 | it('función getRemitoById llama a ruta correcta', function() { | ||
48 | |||
49 | //arrange | ||
50 | var result; | ||
51 | var fakeParam = 1; | ||
52 | var respond = 'test'; | ||
53 | httpBackend.expectGET('localhost/remito/obtener/' + fakeParam).respond(respond); | ||
54 | |||
55 | //act | ||
56 | servicio.getRemitoById(fakeParam).then(function(res) { | ||
57 | result = res.data; | ||
58 | }); | ||
59 | httpBackend.flush(); | ||
60 | |||
61 | //assert | ||
62 | expect(result).toEqual(respond); | ||
63 | }); | ||
64 | |||
65 | it('función obtenerRemito llama a ruta correcta', function() { | ||
66 | |||
67 | //arrange | ||
68 | var result; | ||
69 | var fakeParam = 1; | ||
70 | var respond = 'test'; | ||
71 | httpBackend.expectGET('localhost/nota-pedido').respond(respond); | ||
72 | |||
73 | //act | ||
74 | servicio.obtenerRemito(fakeParam).then(function(res) { | ||
75 | result = res.data; | ||
76 | }); | ||
77 | httpBackend.flush(); | ||
78 | |||
79 | //assert | ||
80 | expect(result).toEqual(respond); | ||
81 | }); | ||
82 | |||
83 | it('función setRemito setea correctamente', function() { | ||
84 | |||
85 | //arrange | ||
86 | var fakeParam = 1; | ||
87 | |||
88 | //act | ||
89 | servicio.setRemito(fakeParam); | ||
90 | |||
91 | //assert | ||
92 | expect(servicio.remito).toEqual(fakeParam); | ||
93 | }); | ||
94 | |||
95 | it('función clearRemito setea correctamente', function() { | ||
96 | |||
97 | //act | ||
98 | servicio.clearRemito(); | ||
99 | |||
100 | //assert | ||
101 | expect(servicio.remito).toEqual(undefined); | ||
102 | }); | ||
103 | |||
104 | it('función getRemito trae correctamente', function() { | ||
105 | |||
106 | //arrange | ||
107 | var fakeParam = 1; | ||
108 | |||
109 | //act | ||
110 | servicio.remito = fakeParam; | ||
111 | var result = servicio.getRemito(); | ||
112 | |||
113 | //assert | ||
114 | expect(result).toEqual(fakeParam); | ||
115 | }); | ||
116 | |||
117 | it('función getArticulosByIdRemito llama a ruta correcta', function() { | ||
118 | |||
119 | //arrange | ||
120 | var result; | ||
121 | var fakeParam = 1; | ||
122 | var respond = 'test'; | ||
123 | httpBackend.expectGET('localhost/articulos/nota-pedido/' + fakeParam).respond(respond); | ||
124 | |||
125 | //act | ||
126 | servicio.getArticulosByIdRemito(fakeParam).then(function(res) { | ||
127 | result = res.data; | ||
128 | }); | ||
129 | httpBackend.flush(); | ||
130 | |||
131 | //assert | ||
132 | expect(result).toEqual(respond); | ||
133 | }); | ||
134 | |||
135 | it('función crearArticulosParaRemito llama a ruta correcta', function() { | ||
136 | |||
137 | //arrange | ||
138 | var result; | ||
139 | var fakeParam = 1; | ||
140 | var respond = 'test'; | ||
141 | httpBackend.expectPOST('localhost/articulos/remito', {articuloRemito: fakeParam}) | ||
142 | .respond(respond); | ||
143 | |||
144 | //act | ||
145 | servicio.crearArticulosParaRemito(fakeParam).then(function(res) { | ||
146 | result = res.data; | ||
147 | }); | ||
148 | httpBackend.flush(); | ||
149 | |||
150 | //assert | ||
151 | expect(result).toEqual(respond); | ||
152 | }); | ||
153 | |||
154 | it('función getDomiciliosByIdRemito llama a ruta correcta', function() { | ||
155 | |||
156 | //arrange | ||
157 | var result; | ||
158 | var fakeParam = 1; | ||
159 | var respond = 'test'; | ||
160 | httpBackend.expectGET('localhost/nota-pedido/' + fakeParam + '/domicilios') | ||
161 | .respond(respond); | ||
162 | |||
163 | //act | ||
164 | servicio.getDomiciliosByIdRemito(fakeParam).then(function(res) { | ||
165 | result = res.data; | ||
166 | }); | ||
167 | httpBackend.flush(); | ||
168 | |||
169 | //assert | ||
170 | expect(result).toEqual(respond); | ||
171 | }); | ||
172 | |||
173 | it('función getDomiciliosByIdCliente llama a ruta correcta', function() { | ||
174 | |||
175 | //arrange | ||
176 | var result; | ||
177 | var fakeParam = 1; | ||
178 | var respond = 'test'; | ||
179 | httpBackend.expectGET('localhost/domicilio/tipo/2/cliente/' + fakeParam) | ||
180 | .respond(respond); | ||
181 | |||
182 | //act | ||
183 | servicio.getDomiciliosByIdCliente(fakeParam).then(function(res) { | ||
184 | result = res.data; | ||
185 | }); | ||
186 | httpBackend.flush(); | ||
187 | |||
188 | //assert | ||
189 | expect(result).toEqual(respond); | ||
190 | }); | ||
191 | |||
192 | it('función getPrecioCondicion llama a ruta correcta', function() { | ||
193 | |||
194 | //arrange | ||
195 | var result; | ||
196 | var respond = 'test'; | ||
197 | httpBackend.expectGET('localhost/precio-condicion').respond(respond); | ||
198 | |||
199 | //act | ||
200 | servicio.getPrecioCondicion().then(function(res) { | ||
201 | result = res.data; | ||
202 | }); | ||
203 | httpBackend.flush(); | ||
204 | |||
205 | //assert | ||
206 | expect(result).toEqual(respond); | ||
207 | }); | ||
208 | |||
209 | it('función getPrecioCondicionById llama a ruta correcta', function() { | ||
210 | |||
211 | //arrange | ||
212 | var result; | ||
213 | var fakeParam = 1; | ||
214 | var respond = 'test'; | ||
215 | httpBackend.expectGET('localhost/precio-condicion/' + fakeParam).respond(respond); | ||
216 | |||
217 | //act | ||
218 | servicio.getPrecioCondicionById(fakeParam).then(function(res) { | ||
219 | result = res.data; | ||
220 | }); | ||
221 | httpBackend.flush(); | ||
222 | |||
223 | //assert | ||
224 | expect(result).toEqual(respond); | ||
225 | }); | ||
226 | |||
227 | it('función getPlazoPagoByPrecioCondicion llama a ruta correcta', function() { | ||
228 | |||
229 | //arrange | ||
230 | var result; | ||
231 | var fakeParam = 1; | ||
232 | var respond = 'test'; | ||
233 | httpBackend.expectGET('localhost/plazo-pago/precio-condicion/' + fakeParam) | ||
234 | .respond(respond); | ||
235 | |||
236 | //act | ||
237 | servicio.getPlazoPagoByPrecioCondicion(fakeParam).then(function(res) { | ||
238 | result = res.data; | ||
239 | }); | ||
240 | httpBackend.flush(); | ||
241 | |||
242 | //assert | ||
243 | expect(result).toEqual(respond); | ||
244 | }); | ||
245 | |||
246 | it('función crearFlete llama a ruta correcta', function() { | ||
247 | |||
248 | //arrange | ||
249 | var result; | ||
250 | var fakeParam = 1; | ||
251 | var respond = 'test'; | ||
252 | httpBackend.expectPOST('localhost/flete', {flete: fakeParam}).respond(respond); | ||
253 | |||
254 | //act | ||
255 | servicio.crearFlete(fakeParam).then(function(res) { | ||
256 | result = res.data; | ||
257 | }); | ||
258 | httpBackend.flush(); | ||
259 | |||
260 | //assert | ||
261 | expect(result).toEqual(respond); | ||
262 | }); | ||
263 | |||
264 | it('función crearPlazosParaRemito llama a ruta correcta', function() { | ||
265 | |||
266 | //arrange | ||
267 | var result; | ||
268 | var fakeParam = 1; | ||
269 | var respond = 'test'; | ||
270 | httpBackend.expectPOST('localhost/plazo-pago/remito', fakeParam).respond(respond); | ||
271 | |||
272 | //act | ||
273 | servicio.crearPlazosParaRemito(fakeParam).then(function(res) { | ||
274 | result = res.data; | ||
275 | }); | ||
276 | httpBackend.flush(); | ||
277 | |||
278 | //assert | ||
279 | expect(result).toEqual(respond); | ||
280 | }); | ||
281 | |||
282 | it('función getCotizacionByIdMoneda llama a ruta correcta', function() { | ||
283 | |||
284 | //arrange | ||
285 | var result; | ||
286 | var fakeParam = 1; | ||
287 | var respond = 'test'; | ||
288 | httpBackend.expectGET('localhost/moneda/' + fakeParam).respond(respond); | ||
289 | |||
290 | //act | ||
291 | servicio.getCotizacionByIdMoneda(fakeParam).then(function(res) { | ||
292 | result = res.data; | ||
293 | }); | ||
294 | httpBackend.flush(); | ||
295 | |||
296 | //assert | ||
297 | expect(result).toEqual(respond); | ||
298 | }); | ||
299 | |||
300 | it('función crearEstadoParaRemito llama a ruta correcta', function() { | ||
301 | |||
302 | //arrange | ||
303 | var result; | ||
304 | var fakeParam = 1; | ||
305 | var respond = 'test'; | ||
306 | httpBackend.expectPOST('localhost/estado', { estado: fakeParam }).respond(respond); | ||
307 | |||
308 | //act | ||
309 | servicio.crearEstadoParaRemito(fakeParam).then(function(res) { | ||
310 | result = res.data; | ||
311 | }); | ||
312 | httpBackend.flush(); | ||
313 | |||
314 | //assert | ||
315 | expect(result).toEqual(respond); | ||
316 | }); | ||
317 | |||
318 | it('función getNumeroRemito llama a ruta correcta', function() { | ||
319 | |||
320 | //arrange | ||
321 | var result; | ||
322 | var respond = 'test'; | ||
323 | httpBackend.expectGET('localhost/remito/numero-siguiente').respond(respond); | ||
324 | |||
325 | //act | ||
326 | servicio.getNumeroRemito().then(function(res) { | ||
327 | result = res.data; | ||
328 | }); | ||
329 | httpBackend.flush(); | ||
330 | |||
331 | //assert | ||
332 | expect(result).toEqual(respond); | ||
333 | }); | ||
334 | |||
335 | it('función imprimirRemitoByIdRemito llama a ruta correcta', function() { | ||
336 | |||
337 | //arrange | ||
338 | var result; | ||
339 | var fakeParam = 1; | ||
340 | var respond = new Blob(['test']); | ||
341 | httpBackend.expectGET('localhost/remito/comprobante/' + fakeParam) | ||
342 | .respond(respond); | ||
343 | |||
344 | //act | ||
345 | servicio.imprimirRemitoByIdRemito(fakeParam).then(function(res) { | ||
346 | result = res.data; | ||
347 | }); | ||
348 | httpBackend.flush(); | ||
349 | |||
350 | //assert | ||
351 | expect(result).toEqual(respond); | ||
352 | }); | ||
353 | |||
354 | it('función getPuntosDescargaByClienDom llama a ruta correcta', function() { | ||
355 | |||
356 | //arrange | ||
357 | var result; | ||
358 | var fakeParam = 1; | ||
359 | var respond = 'test'; | ||
360 | httpBackend.expectGET('localhost/punto-descarga/' + fakeParam + '/' + fakeParam) | ||
361 | .respond(respond); | ||
362 | |||
363 | //act | ||
364 | servicio.getPuntosDescargaByClienDom(fakeParam, fakeParam).then(function(res) { | ||
365 | result = res.data; | ||
366 | }); | ||
367 | httpBackend.flush(); | ||
368 | |||
369 | //assert | ||
370 | expect(result).toEqual(respond); | ||
371 | }); | ||
372 | |||
373 | it('función enviarCorreo llama a ruta correcta', function() { | ||
374 | |||
375 | //arrange | ||
376 | var result; | ||
377 | var fakeParam = 1; | ||
378 | var respond = 'test'; | ||
379 | httpBackend.expectPOST('localhost/remito/mail', fakeParam) | ||
380 | .respond(respond); | ||
381 | |||
382 | //act | ||
383 | servicio.enviarCorreo(fakeParam).then(function(res) { | ||
384 | result = res.data; | ||
385 | }); | ||
386 | httpBackend.flush(); | ||
387 | |||
388 | //assert | ||
389 | expect(result).toEqual(respond); | ||
390 | }); | ||
391 | }); | ||
392 | }); | ||
393 |
src/js/app.js
1 | angular.module('focaCrearRemito', []); | 1 | angular.module('focaCrearRemito', ['ngRoute']); |
2 | 2 |
src/js/controller.js
1 | angular.module('focaCrearRemito') .controller('remitoController', | 1 | angular.module('focaCrearRemito') .controller('remitoController', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', |
4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', | 4 | 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', |
5 | '$localStorage', | 5 | '$localStorage', |
6 | function( | 6 | function( |
7 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, | 7 | $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, |
8 | remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage) | 8 | remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage) |
9 | { | 9 | { |
10 | config(); | 10 | config(); |
11 | 11 | ||
12 | function config() { | 12 | function config() { |
13 | $scope.botonera = crearRemitoService.getBotonera(); | 13 | $scope.botonera = crearRemitoService.getBotonera(); |
14 | $scope.isNumber = angular.isNumber; | 14 | $scope.isNumber = angular.isNumber; |
15 | $scope.datepickerAbierto = false; | 15 | $scope.datepickerAbierto = false; |
16 | $scope.show = false; | 16 | $scope.show = false; |
17 | $scope.cargando = true; | 17 | $scope.cargando = true; |
18 | $scope.now = new Date(); | 18 | $scope.now = new Date(); |
19 | $scope.puntoVenta = rellenar(0, 4); | 19 | $scope.puntoVenta = rellenar(0, 4); |
20 | $scope.comprobante = rellenar(0, 8); | 20 | $scope.comprobante = rellenar(0, 8); |
21 | $scope.dateOptions = { | 21 | $scope.dateOptions = { |
22 | maxDate: new Date(), | 22 | maxDate: new Date(), |
23 | minDate: new Date(2010, 0, 1) | 23 | minDate: new Date(2010, 0, 1) |
24 | }; | 24 | }; |
25 | 25 | ||
26 | var monedaPorDefecto; | 26 | var monedaPorDefecto; |
27 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 27 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
28 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { | 28 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { |
29 | monedaPorDefecto = res.data[0]; | 29 | monedaPorDefecto = res.data[0]; |
30 | 30 | ||
31 | $scope.remito.cotizacion = Object.assign( | 31 | $scope.remito.cotizacion = Object.assign( |
32 | {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0] | 32 | {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0] |
33 | ); | 33 | ); |
34 | $scope.inicial.cotizacion = $scope.remito.cotizacion; | 34 | $scope.inicial.cotizacion = $scope.remito.cotizacion; |
35 | $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion); | 35 | $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion); |
36 | }); | 36 | }); |
37 | 37 | ||
38 | //SETEO BOTONERA LATERAL | 38 | //SETEO BOTONERA LATERAL |
39 | $timeout(function() { | 39 | $timeout(function() { |
40 | focaBotoneraLateralService.showSalir(false); | 40 | focaBotoneraLateralService.showSalir(false); |
41 | focaBotoneraLateralService.showPausar(true); | 41 | focaBotoneraLateralService.showPausar(true); |
42 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); | 42 | focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); |
43 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 43 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
44 | }); | 44 | }); |
45 | 45 | ||
46 | init(); | 46 | init(); |
47 | $timeout(function() {getLSRemito();}); | 47 | $timeout(function() {getLSRemito();}); |
48 | } | 48 | } |
49 | 49 | ||
50 | function init() { | 50 | function init() { |
51 | $scope.$broadcast('cleanCabecera'); | 51 | $scope.$broadcast('cleanCabecera'); |
52 | 52 | ||
53 | $scope.remito = { | 53 | $scope.remito = { |
54 | id: 0, | 54 | id: 0, |
55 | estado: 0, | 55 | estado: 0, |
56 | vendedor: {}, | 56 | vendedor: {}, |
57 | cliente: {}, | 57 | cliente: {}, |
58 | proveedor: {}, | 58 | proveedor: {}, |
59 | domicilio: {dom: ''}, | 59 | domicilio: {dom: ''}, |
60 | moneda: {}, | 60 | moneda: {}, |
61 | cotizacion: $scope.cotizacionPorDefecto || {}, | 61 | cotizacion: $scope.cotizacionPorDefecto || {}, |
62 | articulosRemito: [] | 62 | articulosRemito: [] |
63 | }; | 63 | }; |
64 | 64 | ||
65 | $scope.notaPedido = { | 65 | $scope.notaPedido = { |
66 | id: 0 | 66 | id: 0 |
67 | }; | 67 | }; |
68 | 68 | ||
69 | $scope.remito.articulosRemito = []; | 69 | $scope.remito.articulosRemito = []; |
70 | $scope.idLista = undefined; | 70 | $scope.idLista = undefined; |
71 | 71 | ||
72 | crearRemitoService.getNumeroRemito().then( | 72 | crearRemitoService.getNumeroRemito().then( |
73 | function(res) { | 73 | function(res) { |
74 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 74 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
75 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 75 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
76 | }, | 76 | }, |
77 | function(err) { | 77 | function(err) { |
78 | focaModalService.alert('La terminal no esta configurada correctamente'); | 78 | focaModalService.alert('La terminal no esta configurada correctamente'); |
79 | console.info(err); | 79 | console.info(err); |
80 | } | 80 | } |
81 | ); | 81 | ); |
82 | 82 | ||
83 | $scope.inicial = angular.copy($scope.remito); | 83 | $scope.inicial = angular.copy($scope.remito); |
84 | } | 84 | } |
85 | 85 | ||
86 | $scope.$watch('remito', function(newValue, oldValue) { | 86 | $scope.$watch('remito', function(newValue) { |
87 | focaBotoneraLateralService.setPausarData({ | 87 | focaBotoneraLateralService.setPausarData({ |
88 | label: 'remito', | 88 | label: 'remito', |
89 | val: newValue | 89 | val: newValue |
90 | }); | 90 | }); |
91 | }, true); | 91 | }, true); |
92 | 92 | ||
93 | $scope.seleccionarNotaPedido = function() { | 93 | $scope.seleccionarNotaPedido = function() { |
94 | if(varlidarRemitoFacturado()) { | 94 | if(varlidarRemitoFacturado()) { |
95 | var modalInstance = $uibModal.open( | 95 | var modalInstance = $uibModal.open( |
96 | { | 96 | { |
97 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 97 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
98 | templateUrl: 'foca-modal-nota-pedido.html', | 98 | templateUrl: 'foca-modal-nota-pedido.html', |
99 | controller: 'focaModalNotaPedidoController', | 99 | controller: 'focaModalNotaPedidoController', |
100 | size: 'lg', | 100 | size: 'lg', |
101 | resolve: { | 101 | resolve: { |
102 | usadoPor: function() { return 'remito'; }, | 102 | usadoPor: function() { return 'remito'; }, |
103 | idVendedor: function() { return null; } | 103 | idVendedor: function() { return null; } |
104 | } | 104 | } |
105 | } | 105 | } |
106 | ); | 106 | ); |
107 | modalInstance.result.then( | 107 | modalInstance.result.then( |
108 | function(notaPedido) { | 108 | function(notaPedido) { |
109 | //añado cabeceras | 109 | //añado cabeceras |
110 | $scope.notaPedido.id = notaPedido.id; | 110 | $scope.notaPedido.id = notaPedido.id; |
111 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 111 | $scope.$broadcast('removeCabecera', 'Bomba:'); |
112 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 112 | $scope.$broadcast('removeCabecera', 'Kilometros:'); |
113 | var cabeceras = [ | 113 | var cabeceras = [ |
114 | { | 114 | { |
115 | label: 'Moneda:', | 115 | label: 'Moneda:', |
116 | valor: notaPedido.cotizacion.moneda.DETALLE | 116 | valor: notaPedido.cotizacion.moneda.DETALLE |
117 | }, | 117 | }, |
118 | { | 118 | { |
119 | label: 'Fecha cotizacion:', | 119 | label: 'Fecha cotizacion:', |
120 | valor: $filter('date')(notaPedido.cotizacion.FECHA, | 120 | valor: $filter('date')(notaPedido.cotizacion.FECHA, |
121 | 'dd/MM/yyyy') | 121 | 'dd/MM/yyyy') |
122 | }, | 122 | }, |
123 | { | 123 | { |
124 | label: 'Cotizacion:', | 124 | label: 'Cotizacion:', |
125 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, | 125 | valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, |
126 | '2') | 126 | '2') |
127 | }, | 127 | }, |
128 | { | 128 | { |
129 | label: 'Cliente:', | 129 | label: 'Cliente:', |
130 | valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) + | 130 | valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) + |
131 | ' - ' + notaPedido.cliente.NOM | 131 | ' - ' + notaPedido.cliente.NOM |
132 | }, | 132 | }, |
133 | { | 133 | { |
134 | label: 'Domicilio:', | 134 | label: 'Domicilio:', |
135 | valor: notaPedido.domicilioStamp | 135 | valor: notaPedido.domicilioStamp |
136 | }, | 136 | }, |
137 | { | 137 | { |
138 | label: 'Vendedor:', | 138 | label: 'Vendedor:', |
139 | valor: $filter('rellenarDigitos')( | 139 | valor: $filter('rellenarDigitos')( |
140 | notaPedido.vendedor.NUM, 3 | 140 | notaPedido.vendedor.NUM, 3 |
141 | ) + ' - ' + notaPedido.vendedor.NOM | 141 | ) + ' - ' + notaPedido.vendedor.NOM |
142 | }, | 142 | }, |
143 | { | 143 | { |
144 | label: 'Proveedor:', | 144 | label: 'Proveedor:', |
145 | valor: $filter('rellenarDigitos') | 145 | valor: $filter('rellenarDigitos') |
146 | (notaPedido.proveedor.COD, 5) + ' - ' + | 146 | (notaPedido.proveedor.COD, 5) + ' - ' + |
147 | notaPedido.proveedor.NOM | 147 | notaPedido.proveedor.NOM |
148 | }, | 148 | }, |
149 | { | 149 | { |
150 | label: 'Precio condicion:', | 150 | label: 'Precio condicion:', |
151 | valor: valorPrecioCondicion() + ' ' + | 151 | valor: valorPrecioCondicion() + ' ' + |
152 | remitoBusinessService | 152 | remitoBusinessService |
153 | .plazoToString(notaPedido.notaPedidoPlazo) | 153 | .plazoToString(notaPedido.notaPedidoPlazo) |
154 | }, | 154 | }, |
155 | { | 155 | { |
156 | label: 'Flete:', | 156 | label: 'Flete:', |
157 | valor: notaPedido.fob === 1 ? 'FOB' : ( | 157 | valor: notaPedido.fob === 1 ? 'FOB' : ( |
158 | notaPedido.flete === 1 ? 'Si' : 'No') | 158 | notaPedido.flete === 1 ? 'Si' : 'No') |
159 | } | 159 | } |
160 | ]; | 160 | ]; |
161 | 161 | ||
162 | if (notaPedido.observaciones) { | ||
163 | cabeceras.push({ | ||
164 | label: 'Observaciones:', | ||
165 | valor: notaPedido.observaciones | ||
166 | }); | ||
167 | } | ||
168 | |||
162 | function valorPrecioCondicion() { | 169 | function valorPrecioCondicion() { |
163 | if(notaPedido.idPrecioCondicion > 0) { | 170 | if (notaPedido.idPrecioCondicion > 0) { |
164 | return notaPedido.precioCondicion.nombre; | 171 | return notaPedido.precioCondicion.nombre; |
165 | }else { | 172 | } else { |
166 | return 'Ingreso Manual'; | 173 | return 'Ingreso Manual'; |
167 | } | 174 | } |
168 | } | 175 | } |
169 | 176 | ||
170 | if(notaPedido.flete === 1) { | 177 | if (notaPedido.flete === 1) { |
171 | var cabeceraBomba = { | 178 | var cabeceraBomba = { |
172 | label: 'Bomba:', | 179 | label: 'Bomba:', |
173 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | 180 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' |
174 | }; | 181 | }; |
175 | if(notaPedido.kilometros) { | 182 | if (notaPedido.kilometros) { |
176 | var cabeceraKilometros = { | 183 | var cabeceraKilometros = { |
177 | label: 'Kilometros:', | 184 | label: 'Kilometros:', |
178 | valor: notaPedido.kilometros | 185 | valor: notaPedido.kilometros |
179 | }; | 186 | }; |
180 | cabeceras.push(cabeceraKilometros); | 187 | cabeceras.push(cabeceraKilometros); |
181 | } | 188 | } |
182 | cabeceras.push(cabeceraBomba); | 189 | cabeceras.push(cabeceraBomba); |
183 | } | 190 | } |
184 | 191 | ||
185 | delete notaPedido.id; | 192 | delete notaPedido.id; |
186 | $scope.remito = notaPedido; | 193 | $scope.remito = notaPedido; |
187 | $scope.remito.id = 0; | 194 | $scope.remito.id = 0; |
188 | $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo; | 195 | $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo; |
189 | 196 | ||
190 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { | 197 | for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { |
191 | notaPedido.articulosNotaPedido[i].id = 0; | 198 | notaPedido.articulosNotaPedido[i].id = 0; |
192 | } | 199 | } |
193 | 200 | ||
194 | $scope.remito.articulosRemito = notaPedido.articulosNotaPedido; | 201 | $scope.remito.articulosRemito = notaPedido.articulosNotaPedido; |
195 | remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, | 202 | remitoBusinessService.calcularArticulos($scope.remito.articulosRemito, |
196 | notaPedido.cotizacion.VENDEDOR); | 203 | notaPedido.cotizacion.VENDEDOR); |
197 | 204 | ||
198 | if(notaPedido.idPrecioCondicion > 0) { | 205 | if(notaPedido.idPrecioCondicion > 0) { |
199 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; | 206 | $scope.idLista = notaPedido.precioCondicion.idListaPrecio; |
200 | }else { | 207 | }else { |
201 | $scope.idLista = -1; | 208 | $scope.idLista = -1; |
202 | } | 209 | } |
203 | 210 | ||
204 | enableObservaciones(notaPedido.observaciones ? true : false); | 211 | enableObservaciones(notaPedido.observaciones ? true : false); |
205 | addArrayCabecera(cabeceras); | 212 | addArrayCabecera(cabeceras); |
206 | 213 | ||
207 | }, function() { | 214 | }, function() { |
208 | // funcion ejecutada cuando se cancela el modal | 215 | // funcion ejecutada cuando se cancela el modal |
209 | } | 216 | } |
210 | ); | 217 | ); |
211 | } | 218 | } |
212 | }; | 219 | }; |
213 | 220 | ||
214 | $scope.seleccionarRemito = function() { | 221 | $scope.seleccionarRemito = function() { |
215 | var modalInstance = $uibModal.open( | 222 | var modalInstance = $uibModal.open( |
216 | { | 223 | { |
217 | ariaLabelledBy: 'Busqueda de Remito', | 224 | ariaLabelledBy: 'Busqueda de Remito', |
218 | templateUrl: 'foca-modal-remito.html', | 225 | templateUrl: 'foca-modal-remito.html', |
219 | controller: 'focaModalRemitoController', | 226 | controller: 'focaModalRemitoController', |
220 | size: 'lg', | 227 | size: 'lg', |
221 | resolve: {usadoPor: function() {return 'remito';}} | 228 | resolve: {usadoPor: function() {return 'remito';}} |
222 | } | 229 | } |
223 | ); | 230 | ); |
224 | modalInstance.result.then( | 231 | modalInstance.result.then( |
225 | setearRemito, function() { | 232 | setearRemito, function() { |
226 | // funcion ejecutada cuando se cancela el modal | 233 | // funcion ejecutada cuando se cancela el modal |
227 | } | 234 | } |
228 | ); | 235 | ); |
229 | }; | 236 | }; |
230 | 237 | ||
231 | //validacion por domicilio y por plazo pago | 238 | //validacion por domicilio y por plazo pago |
232 | $scope.crearRemito = function() { | 239 | $scope.crearRemito = function() { |
233 | if (!$scope.remito.vendedor.NUM) { | 240 | if (!$scope.remito.vendedor.NUM) { |
234 | focaModalService.alert('Ingrese Vendedor'); | 241 | focaModalService.alert('Ingrese Vendedor'); |
235 | return; | 242 | return; |
236 | } else if (!$scope.remito.cliente.COD) { | 243 | } else if (!$scope.remito.cliente.COD) { |
237 | focaModalService.alert('Ingrese Cliente'); | 244 | focaModalService.alert('Ingrese Cliente'); |
238 | return; | 245 | return; |
239 | } else if (!$scope.remito.proveedor) { | 246 | } else if (!$scope.remito.proveedor) { |
240 | focaModalService.alert('Ingrese Proveedor'); | 247 | focaModalService.alert('Ingrese Proveedor'); |
241 | return; | 248 | return; |
242 | } else if (!$scope.remito.cotizacion.moneda.id && !$scope.remito.cotizacion.moneda.ID) { | 249 | } else if (!$scope.remito.cotizacion.moneda.id && |
250 | !$scope.remito.cotizacion.moneda.ID) | ||
251 | { | ||
243 | focaModalService.alert('Ingrese Moneda'); | 252 | focaModalService.alert('Ingrese Moneda'); |
244 | return; | 253 | return; |
245 | } else if (!$scope.remito.cotizacion.ID) { | 254 | } else if (!$scope.remito.cotizacion.ID) { |
246 | focaModalService.alert('Ingrese Cotización'); | 255 | focaModalService.alert('Ingrese Cotización'); |
247 | return; | 256 | return; |
248 | } else if ( | 257 | } else if ( |
249 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 258 | $scope.remito.flete === undefined || $scope.remito.flete === null) |
250 | { | 259 | { |
251 | focaModalService.alert('Ingrese Flete'); | 260 | focaModalService.alert('Ingrese Flete'); |
252 | return; | 261 | return; |
253 | } else if ($scope.remito.articulosRemito.length === 0) { | 262 | } else if ($scope.remito.articulosRemito.length === 0) { |
254 | focaModalService.alert('Debe cargar al menos un articulo'); | 263 | focaModalService.alert('Debe cargar al menos un articulo'); |
255 | return; | 264 | return; |
256 | } | 265 | } |
257 | focaBotoneraLateralService.startGuardar(); | 266 | focaBotoneraLateralService.startGuardar(); |
258 | $scope.saveLoading = true; | 267 | $scope.saveLoading = true; |
259 | var save = { | 268 | var save = { |
260 | remito: { | 269 | remito: { |
261 | id: $scope.remito.id, | 270 | id: $scope.remito.id, |
262 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | 271 | fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), |
263 | idCliente: $scope.remito.cliente.COD, | 272 | idCliente: $scope.remito.cliente.COD, |
264 | nombreCliente: $scope.remito.cliente.NOM, | 273 | nombreCliente: $scope.remito.cliente.NOM, |
265 | cuitCliente: $scope.remito.cliente.CUIT, | 274 | cuitCliente: $scope.remito.cliente.CUIT, |
266 | responsabilidadIvaCliente: 0,//TODO, | 275 | responsabilidadIvaCliente: 0,//TODO, |
267 | descuento: 0,//TODO, | 276 | descuento: 0,//TODO, |
268 | importeNeto: 0,//TODO | 277 | importeNeto: 0,//TODO |
269 | importeExento: 0,//TODO | 278 | importeExento: 0,//TODO |
270 | importeIva: 0,//TODO | 279 | importeIva: 0,//TODO |
271 | importeIvaServicios: 0,//TODO | 280 | importeIvaServicios: 0,//TODO |
272 | importeImpuestoInterno: 0,//TODO | 281 | importeImpuestoInterno: 0,//TODO |
273 | importeImpuestoInterno1: 0,//TODO | 282 | importeImpuestoInterno1: 0,//TODO |
274 | importeImpuestoInterno2: 0,//TODO | 283 | importeImpuestoInterno2: 0,//TODO |
275 | percepcion: 0,//TODO | 284 | percepcion: 0,//TODO |
276 | percepcionIva: 0,//TODO | 285 | percepcionIva: 0,//TODO |
277 | redondeo: 0,//TODO | 286 | redondeo: 0,//TODO |
278 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, | 287 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, |
279 | numeroNotaPedido: $scope.remito.numeroNotaPedido, | 288 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
280 | anulado: false, | 289 | anulado: false, |
281 | planilla: 0,//TODO | 290 | planilla: 0,//TODO |
282 | lugar: 0,//TODO | 291 | lugar: 0,//TODO |
283 | cuentaMadre: 0,// | 292 | cuentaMadre: 0,// |
284 | cuentaContable: 0,//TODO | 293 | cuentaContable: 0,//TODO |
285 | asiento: 0,//TODO | 294 | asiento: 0,//TODO |
286 | e_hd: '',//TODO | 295 | e_hd: '',//TODO |
287 | c_hd: '', | 296 | c_hd: '', |
288 | numeroLiquidoProducto: 0,//TODO | 297 | numeroLiquidoProducto: 0,//TODO |
289 | idVendedor: $scope.remito.idVendedor, | 298 | idVendedor: $scope.remito.idVendedor, |
290 | idProveedor: $scope.remito.idProveedor, | 299 | idProveedor: $scope.remito.idProveedor, |
291 | idDomicilio: $scope.remito.idDomicilio, | 300 | idDomicilio: $scope.remito.idDomicilio, |
292 | idCotizacion: $scope.remito.cotizacion.ID, | 301 | idCotizacion: $scope.remito.cotizacion.ID, |
293 | idPrecioCondicion: $scope.remito.idPrecioCondicion, | 302 | idPrecioCondicion: $scope.remito.idPrecioCondicion, |
294 | flete: $scope.remito.flete, | 303 | flete: $scope.remito.flete, |
295 | fob: $scope.remito.fob, | 304 | fob: $scope.remito.fob, |
296 | bomba: $scope.remito.bomba, | 305 | bomba: $scope.remito.bomba, |
297 | kilometros: $scope.remito.kilometros, | 306 | kilometros: $scope.remito.kilometros, |
298 | domicilioStamp: $scope.remito.domicilioStamp, | 307 | domicilioStamp: $scope.remito.domicilioStamp, |
299 | estado: 0,//TODO | 308 | estado: 0,//TODO |
300 | destinoVenta: 0,//TODO | 309 | destinoVenta: 0,//TODO |
301 | operacionTipo: 0//TODO | 310 | operacionTipo: 0//TODO |
302 | }, | 311 | }, |
303 | notaPedido: $scope.notaPedido | 312 | notaPedido: $scope.notaPedido |
304 | }; | 313 | }; |
305 | 314 | ||
306 | crearRemitoService.crearRemito(save).then( | 315 | crearRemitoService.crearRemito(save).then( |
307 | function(data) { | 316 | function(data) { |
308 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, | 317 | remitoBusinessService.addArticulos($scope.remito.articulosRemito, |
309 | data.data.id, $scope.remito.cotizacion.COTIZACION); | 318 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
310 | 319 | ||
311 | focaBotoneraLateralService.endGuardar(true); | 320 | focaBotoneraLateralService.endGuardar(true); |
312 | $scope.saveLoading = false; | 321 | $scope.saveLoading = false; |
313 | 322 | ||
314 | //TODO: updatear plazos | 323 | //TODO: updatear plazos |
315 | if($scope.remito.id === 0) { | 324 | if($scope.remito.id === 0) { |
316 | var plazos = $scope.remito.remitoPlazo; | 325 | var plazos = $scope.remito.remitoPlazo; |
317 | 326 | ||
318 | for(var j = 0; j < plazos.length; j++) { | 327 | for(var j = 0; j < plazos.length; j++) { |
319 | var json = { | 328 | var json = { |
320 | idRemito: $scope.remito.id, | 329 | idRemito: $scope.remito.id, |
321 | dias: plazos[j].dias | 330 | dias: plazos[j].dias |
322 | }; | 331 | }; |
323 | crearRemitoService.crearPlazosParaRemito(json); | 332 | crearRemitoService.crearPlazosParaRemito(json); |
324 | } | 333 | } |
325 | } | 334 | } |
326 | 335 | ||
327 | $uibModal.open({ | 336 | $uibModal.open({ |
328 | templateUrl: 'remito-comprobante.html', | 337 | templateUrl: 'remito-comprobante.html', |
329 | controller: 'focaRemitoComprobanteController', | 338 | controller: 'focaRemitoComprobanteController', |
330 | resolve: { | 339 | resolve: { |
331 | parametros: { | 340 | parametros: { |
332 | idRemito: data.data.id | 341 | idRemito: data.data.id |
333 | } | 342 | } |
334 | } | 343 | } |
335 | }); | 344 | }); |
336 | 345 | ||
337 | init(); | 346 | init(); |
338 | 347 | ||
339 | }, function(error) { | 348 | }, function(error) { |
340 | focaModalService.alert('Hubo un error al crear el remito'); | 349 | focaModalService.alert('Hubo un error al crear el remito'); |
341 | focaBotoneraLateralService.endGuardar(); | 350 | focaBotoneraLateralService.endGuardar(); |
342 | $scope.saveLoading = false; | 351 | $scope.saveLoading = false; |
343 | console.info(error); | 352 | console.info(error); |
344 | } | 353 | } |
345 | ); | 354 | ); |
346 | }; | 355 | }; |
347 | 356 | ||
348 | $scope.seleccionarProductos = function() { | 357 | $scope.seleccionarProductos = function() { |
349 | if($scope.idLista === undefined) { | 358 | if($scope.idLista === undefined) { |
350 | focaModalService.alert( | 359 | focaModalService.alert( |
351 | 'Primero seleccione una lista de precio y condicion'); | 360 | 'Primero seleccione una lista de precio y condicion'); |
352 | return; | 361 | return; |
353 | } | 362 | } |
354 | var modalInstance = $uibModal.open( | 363 | var modalInstance = $uibModal.open( |
355 | { | 364 | { |
356 | ariaLabelledBy: 'Busqueda de Productos', | 365 | ariaLabelledBy: 'Busqueda de Productos', |
357 | templateUrl: 'modal-busqueda-productos.html', | 366 | templateUrl: 'modal-busqueda-productos.html', |
358 | controller: 'modalBusquedaProductosCtrl', | 367 | controller: 'modalBusquedaProductosCtrl', |
359 | resolve: { | 368 | resolve: { |
360 | parametroProducto: { | 369 | parametroProducto: { |
361 | idLista: $scope.idLista, | 370 | idLista: $scope.idLista, |
362 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 371 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
363 | simbolo: $scope.remito.cotizacion.moneda.simbolo | 372 | simbolo: $scope.remito.cotizacion.moneda.simbolo |
364 | } | 373 | } |
365 | }, | 374 | }, |
366 | size: 'lg' | 375 | size: 'lg' |
367 | } | 376 | } |
368 | ); | 377 | ); |
369 | modalInstance.result.then( | 378 | modalInstance.result.then( |
370 | function(producto) { | 379 | function(producto) { |
371 | var newArt = | 380 | var newArt = |
372 | { | 381 | { |
373 | id: 0, | 382 | id: 0, |
374 | codigo: producto.codigo, | 383 | codigo: producto.codigo, |
375 | sector: producto.sector, | 384 | sector: producto.sector, |
376 | sectorCodigo: producto.sector + '-' + producto.codigo, | 385 | sectorCodigo: producto.sector + '-' + producto.codigo, |
377 | descripcion: producto.descripcion, | 386 | descripcion: producto.descripcion, |
378 | item: $scope.remito.articulosRemito.length + 1, | 387 | item: $scope.remito.articulosRemito.length + 1, |
379 | nombre: producto.descripcion, | 388 | nombre: producto.descripcion, |
380 | precio: parseFloat(producto.precio.toFixed(4)), | 389 | precio: parseFloat(producto.precio.toFixed(4)), |
381 | costoUnitario: producto.costo, | 390 | costoUnitario: producto.costo, |
382 | editCantidad: false, | 391 | editCantidad: false, |
383 | editPrecio: false, | 392 | editPrecio: false, |
384 | rubro: producto.CodRub, | 393 | rubro: producto.CodRub, |
385 | exentoUnitario: producto.precio, | 394 | exentoUnitario: producto.precio, |
386 | ivaUnitario: producto.IMPIVA, | 395 | ivaUnitario: producto.IMPIVA, |
387 | impuestoInternoUnitario: producto.ImpInt, | 396 | impuestoInternoUnitario: producto.ImpInt, |
388 | impuestoInterno1Unitario: producto.ImpInt2, | 397 | impuestoInterno1Unitario: producto.ImpInt2, |
389 | impuestoInterno2Unitario: producto.ImpInt3, | 398 | impuestoInterno2Unitario: producto.ImpInt3, |
390 | precioLista: producto.precio, | 399 | precioLista: producto.precio, |
391 | combustible: 1, | 400 | combustible: 1, |
392 | facturado: 0 | 401 | facturado: 0 |
393 | }; | 402 | }; |
394 | $scope.articuloACargar = newArt; | 403 | $scope.articuloACargar = newArt; |
395 | $scope.cargando = false; | 404 | $scope.cargando = false; |
396 | }, function() { | 405 | }, function() { |
397 | // funcion ejecutada cuando se cancela el modal | 406 | // funcion ejecutada cuando se cancela el modal |
398 | } | 407 | } |
399 | ); | 408 | ); |
400 | }; | 409 | }; |
401 | 410 | ||
402 | $scope.seleccionarPuntosDeDescarga = function() { | 411 | $scope.seleccionarPuntosDeDescarga = function() { |
403 | if(!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { | 412 | if(!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { |
404 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); | 413 | focaModalService.alert('Primero seleccione un cliente y un domicilio'); |
405 | return; | 414 | return; |
406 | }else { | 415 | }else { |
407 | var modalInstance = $uibModal.open( | 416 | var modalInstance = $uibModal.open( |
408 | { | 417 | { |
409 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', | 418 | ariaLabelledBy: 'Búsqueda de Puntos de descarga', |
410 | templateUrl: 'modal-punto-descarga.html', | 419 | templateUrl: 'modal-punto-descarga.html', |
411 | controller: 'focaModalPuntoDescargaController', | 420 | controller: 'focaModalPuntoDescargaController', |
412 | size: 'lg', | 421 | size: 'lg', |
413 | resolve: { | 422 | resolve: { |
414 | filters: { | 423 | filters: { |
415 | idDomicilio: $scope.remito.domicilio.id, | 424 | idDomicilio: $scope.remito.domicilio.id, |
416 | idCliente: $scope.remito.cliente.COD, | 425 | idCliente: $scope.remito.cliente.COD, |
417 | articulos: $scope.remito.articulosRemito, | 426 | articulos: $scope.remito.articulosRemito, |
418 | puntosDescarga: $scope.remito.domicilio.puntosDescarga | 427 | puntosDescarga: $scope.remito.domicilio.puntosDescarga |
419 | } | 428 | } |
420 | } | 429 | } |
421 | } | 430 | } |
422 | ); | 431 | ); |
423 | modalInstance.result.then( | 432 | modalInstance.result.then( |
424 | function(puntosDescarga) { | 433 | function(puntosDescarga) { |
425 | $scope.remito.puntosDescarga = puntosDescarga; | 434 | $scope.remito.puntosDescarga = puntosDescarga; |
426 | 435 | ||
427 | //AGREGO PUNTOS DE DESCARGA A CABECERA | 436 | //AGREGO PUNTOS DE DESCARGA A CABECERA |
428 | var puntosStamp = ''; | 437 | var puntosStamp = ''; |
429 | puntosDescarga.forEach(function(punto, idx, arr) { | 438 | puntosDescarga.forEach(function(punto, idx, arr) { |
430 | puntosStamp += punto.descripcion; | 439 | puntosStamp += punto.descripcion; |
431 | if((idx + 1) !== arr.length) puntosStamp += ', '; | 440 | if((idx + 1) !== arr.length) puntosStamp += ', '; |
432 | }); | 441 | }); |
433 | 442 | ||
434 | $scope.$broadcast('addCabecera', { | 443 | $scope.$broadcast('addCabecera', { |
435 | label: 'Puntos de descarga:', | 444 | label: 'Puntos de descarga:', |
436 | valor: puntosStamp | 445 | valor: puntosStamp |
437 | }); | 446 | }); |
438 | }, function() { | 447 | }, function() { |
439 | $scope.abrirModalDomicilios($scope.cliente); | 448 | $scope.abrirModalDomicilios($scope.cliente); |
440 | } | 449 | } |
441 | ); | 450 | ); |
442 | } | 451 | } |
443 | }; | 452 | }; |
444 | 453 | ||
445 | $scope.seleccionarVendedor = function() { | 454 | $scope.seleccionarVendedor = function(callback, ocultarVendedor) { |
455 | if (ocultarVendedor) { | ||
456 | callback(); | ||
457 | return; | ||
458 | } | ||
459 | |||
446 | if(varlidarRemitoFacturado()) { | 460 | if(varlidarRemitoFacturado()) { |
447 | var parametrosModal = { | 461 | var parametrosModal = { |
448 | titulo: 'Búsqueda vendedores', | 462 | titulo: 'Búsqueda vendedores', |
449 | query: '/vendedor', | 463 | query: '/vendedor', |
450 | columnas: [ | 464 | columnas: [ |
451 | { | 465 | { |
452 | propiedad: 'NUM', | 466 | propiedad: 'NUM', |
453 | nombre: 'Código', | 467 | nombre: 'Código', |
454 | filtro: { | 468 | filtro: { |
455 | nombre: 'rellenarDigitos', | 469 | nombre: 'rellenarDigitos', |
456 | parametro: 3 | 470 | parametro: 3 |
457 | } | 471 | } |
458 | }, | 472 | }, |
459 | { | 473 | { |
460 | propiedad: 'NOM', | 474 | propiedad: 'NOM', |
461 | nombre: 'Nombre' | 475 | nombre: 'Nombre' |
462 | } | 476 | } |
463 | ], | 477 | ], |
464 | size: 'md' | 478 | size: 'md' |
465 | }; | 479 | }; |
466 | focaModalService.modal(parametrosModal).then( | 480 | focaModalService.modal(parametrosModal).then( |
467 | function(vendedor) { | 481 | function(vendedor) { |
468 | $scope.$broadcast('addCabecera',{ | 482 | $scope.$broadcast('addCabecera',{ |
469 | label: 'Vendedor:', | 483 | label: 'Vendedor:', |
470 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + | 484 | valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + |
471 | vendedor.NOM | 485 | vendedor.NOM |
472 | }); | 486 | }); |
473 | $scope.remito.idVendedor = vendedor.id; | 487 | $scope.remito.idVendedor = vendedor.id; |
474 | $scope.remito.vendedor = vendedor; | 488 | $scope.remito.vendedor = vendedor; |
489 | deleteCliente(); | ||
490 | callback(); | ||
475 | }, function() { | 491 | }, function() { |
476 | 492 | ||
477 | } | 493 | } |
478 | ); | 494 | ); |
479 | } | 495 | } |
480 | }; | 496 | }; |
481 | 497 | ||
482 | $scope.seleccionarProveedor = function() { | 498 | $scope.seleccionarCliente = function(ocultarVendedor) { |
499 | |||
500 | $scope.seleccionarVendedor(function() { | ||
501 | if (varlidarRemitoFacturado()) { | ||
502 | var modalInstance = $uibModal.open( | ||
503 | { | ||
504 | ariaLabelledBy: 'Busqueda de Cliente', | ||
505 | templateUrl: 'foca-busqueda-cliente-modal.html', | ||
506 | controller: 'focaBusquedaClienteModalController', | ||
507 | resolve: { | ||
508 | vendedor: function() { return $scope.remito.vendedor; }, | ||
509 | cobrador: function() { return null; } | ||
510 | }, | ||
511 | size: 'lg' | ||
512 | } | ||
513 | ); | ||
514 | modalInstance.result.then( | ||
515 | function(cliente) { | ||
516 | $scope.abrirModalDomicilios(cliente); | ||
517 | $scope.cliente = cliente; | ||
518 | }, function() { | ||
519 | $scope.seleccionarCliente(); | ||
520 | } | ||
521 | ); | ||
522 | } | ||
523 | }, ocultarVendedor); | ||
524 | }; | ||
525 | |||
526 | $scope.seleccionarProveedor = function(callback) { | ||
483 | if(varlidarRemitoFacturado()) { | 527 | if(varlidarRemitoFacturado()) { |
484 | var parametrosModal = { | 528 | var parametrosModal = { |
485 | titulo: 'Búsqueda de Proveedor', | 529 | titulo: 'Búsqueda de Proveedor', |
486 | query: '/proveedor', | 530 | query: '/proveedor', |
487 | columnas: [ | 531 | columnas: [ |
488 | { | 532 | { |
489 | nombre: 'Código', | 533 | nombre: 'Código', |
490 | propiedad: 'COD', | 534 | propiedad: 'COD', |
491 | filtro: { | 535 | filtro: { |
492 | nombre: 'rellenarDigitos', | 536 | nombre: 'rellenarDigitos', |
493 | parametro: 5 | 537 | parametro: 5 |
494 | } | 538 | } |
495 | }, | 539 | }, |
496 | { | 540 | { |
497 | nombre: 'Nombre', | 541 | nombre: 'Nombre', |
498 | propiedad: 'NOM' | 542 | propiedad: 'NOM' |
499 | }, | 543 | }, |
500 | { | 544 | { |
501 | nombre: 'CUIT', | 545 | nombre: 'CUIT', |
502 | propiedad: 'CUIT' | 546 | propiedad: 'CUIT' |
503 | } | 547 | } |
504 | ], | 548 | ], |
505 | tipo: 'POST', | 549 | tipo: 'POST', |
506 | json: {razonCuitCod: ''} | 550 | json: {razonCuitCod: ''} |
507 | }; | 551 | }; |
508 | focaModalService.modal(parametrosModal).then( | 552 | focaModalService.modal(parametrosModal).then( |
509 | function(proveedor) { | 553 | function(proveedor) { |
510 | $scope.remito.proveedor = proveedor; | 554 | $scope.remito.proveedor = proveedor; |
511 | $scope.remito.idProveedor = proveedor.COD; | 555 | $scope.remito.idProveedor = proveedor.COD; |
512 | 556 | ||
513 | $scope.$broadcast('addCabecera',{ | 557 | $scope.$broadcast('addCabecera',{ |
514 | label: 'Proveedor:', | 558 | label: 'Proveedor:', |
515 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | 559 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + |
516 | proveedor.NOM | 560 | proveedor.NOM |
517 | }); | 561 | }); |
518 | }, function() { | 562 | callback(); |
519 | 563 | }, function() { } | |
520 | } | ||
521 | ); | ||
522 | } | ||
523 | }; | ||
524 | |||
525 | $scope.seleccionarCliente = function() { | ||
526 | if (!$scope.remito.vendedor) { | ||
527 | focaModalService.alert('Primero seleccione un vendedor'); | ||
528 | return; | ||
529 | } | ||
530 | |||
531 | if (varlidarRemitoFacturado()) { | ||
532 | var modalInstance = $uibModal.open( | ||
533 | { | ||
534 | ariaLabelledBy: 'Busqueda de Cliente', | ||
535 | templateUrl: 'foca-busqueda-cliente-modal.html', | ||
536 | controller: 'focaBusquedaClienteModalController', | ||
537 | resolve: { | ||
538 | vendedor: function() { return $scope.remito.vendedor; } | ||
539 | }, | ||
540 | size: 'lg' | ||
541 | } | ||
542 | ); | ||
543 | modalInstance.result.then( | ||
544 | function(cliente) { | ||
545 | $scope.abrirModalDomicilios(cliente); | ||
546 | $scope.cliente = cliente; | ||
547 | }, function() { | ||
548 | |||
549 | } | ||
550 | ); | 564 | ); |
551 | } | 565 | } |
552 | }; | 566 | }; |
553 | 567 | ||
554 | $scope.abrirModalDomicilios = function(cliente) { | 568 | $scope.abrirModalDomicilios = function(cliente) { |
555 | var modalInstanceDomicilio = $uibModal.open( | 569 | var modalInstanceDomicilio = $uibModal.open( |
556 | { | 570 | { |
557 | ariaLabelledBy: 'Busqueda de Domicilios', | 571 | ariaLabelledBy: 'Busqueda de Domicilios', |
558 | templateUrl: 'modal-domicilio.html', | 572 | templateUrl: 'modal-domicilio.html', |
559 | controller: 'focaModalDomicilioController', | 573 | controller: 'focaModalDomicilioController', |
560 | size: 'lg', | 574 | size: 'lg', |
561 | resolve: { | 575 | resolve: { |
562 | idCliente: function() { return cliente.cod; }, | 576 | idCliente: function() { return cliente.cod; }, |
563 | esNuevo: function() { return cliente.esNuevo; } | 577 | esNuevo: function() { return cliente.esNuevo; } |
564 | } | 578 | } |
565 | } | 579 | } |
566 | ); | 580 | ); |
567 | modalInstanceDomicilio.result.then( | 581 | modalInstanceDomicilio.result.then( |
568 | function(domicilio) { | 582 | function(domicilio) { |
569 | $scope.remito.domicilio = domicilio; | 583 | $scope.remito.domicilio = domicilio; |
570 | $scope.remito.cliente = { | 584 | $scope.remito.cliente = { |
571 | COD: cliente.cod, | 585 | COD: cliente.cod, |
572 | CUIT: cliente.cuit, | 586 | CUIT: cliente.cuit, |
573 | NOM: cliente.nom, | 587 | NOM: cliente.nom, |
574 | MAIL: cliente.mail | 588 | MAIL: cliente.mail, |
589 | MOD: cliente.mod | ||
575 | }; | 590 | }; |
576 | 591 | ||
577 | 592 | ||
578 | var domicilioStamp = | 593 | var domicilioStamp = |
579 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + | 594 | domicilio.Calle + ' ' + domicilio.Numero + ', ' + |
580 | domicilio.Localidad + ', ' + domicilio.Provincia; | 595 | domicilio.Localidad + ', ' + domicilio.Provincia; |
581 | $scope.remito.domicilioStamp = domicilioStamp; | 596 | $scope.remito.domicilioStamp = domicilioStamp; |
582 | 597 | ||
583 | $scope.$broadcast('addCabecera',{ | 598 | $scope.$broadcast('addCabecera',{ |
584 | label: 'Cliente:', | 599 | label: 'Cliente:', |
585 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom | 600 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom |
586 | }); | 601 | }); |
587 | $scope.$broadcast('addCabecera',{ | 602 | $scope.$broadcast('addCabecera',{ |
588 | label: 'Domicilio:', | 603 | label: 'Domicilio:', |
589 | valor: domicilioStamp | 604 | valor: domicilioStamp |
590 | }); | 605 | }); |
591 | 606 | ||
592 | if(domicilio.verPuntos) { | 607 | if(domicilio.verPuntos) { |
593 | delete $scope.remito.domicilio.verPuntos; | 608 | delete $scope.remito.domicilio.verPuntos; |
594 | $scope.seleccionarPuntosDeDescarga(); | 609 | $scope.seleccionarPuntosDeDescarga(); |
595 | }else { | 610 | }else { |
596 | crearRemitoService | 611 | crearRemitoService |
597 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) | 612 | .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) |
598 | .then(function(res) { | 613 | .then(function(res) { |
599 | if(res.data.length) $scope.seleccionarPuntosDeDescarga(); | 614 | if(res.data.length) $scope.seleccionarPuntosDeDescarga(); |
600 | }); | 615 | }); |
601 | } | 616 | } |
602 | }, function() { | 617 | }, function() { |
603 | $scope.seleccionarCliente(); | 618 | $scope.seleccionarCliente(true); |
604 | return; | 619 | return; |
605 | } | 620 | } |
606 | ); | 621 | ); |
607 | }; | 622 | }; |
608 | 623 | ||
609 | $scope.mostrarFichaCliente = function() { | ||
610 | $uibModal.open( | ||
611 | { | ||
612 | ariaLabelledBy: 'Datos del Cliente', | ||
613 | templateUrl: 'foca-crear-remito-ficha-cliente.html', | ||
614 | controller: 'focaCrearRemitoFichaClienteController', | ||
615 | size: 'lg' | ||
616 | } | ||
617 | ); | ||
618 | }; | ||
619 | |||
620 | $scope.getTotal = function() { | 624 | $scope.getTotal = function() { |
621 | var total = 0; | 625 | var total = 0; |
622 | var arrayTempArticulos = $scope.remito.articulosRemito; | 626 | var arrayTempArticulos = $scope.remito.articulosRemito; |
623 | for(var i = 0; i < arrayTempArticulos.length; i++) { | 627 | for(var i = 0; i < arrayTempArticulos.length; i++) { |
624 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 628 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
625 | } | 629 | } |
626 | return parseFloat(total.toFixed(2)); | 630 | return parseFloat(total.toFixed(2)); |
627 | }; | 631 | }; |
628 | 632 | ||
629 | $scope.getSubTotal = function() { | 633 | $scope.getSubTotal = function() { |
630 | if($scope.articuloACargar) { | 634 | if($scope.articuloACargar) { |
631 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 635 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
632 | } | 636 | } |
633 | }; | 637 | }; |
634 | 638 | ||
635 | $scope.seleccionarPreciosYCondiciones = function() { | 639 | $scope.seleccionarPreciosYCondiciones = function() { |
640 | if (!$scope.remito.cliente.COD) { | ||
641 | focaModalService.alert('Primero seleccione un cliente'); | ||
642 | return; | ||
643 | } | ||
636 | if(varlidarRemitoFacturado()) { | 644 | if(varlidarRemitoFacturado()) { |
637 | var modalInstance = $uibModal.open( | 645 | var modalInstance = $uibModal.open( |
638 | { | 646 | { |
639 | ariaLabelledBy: 'Busqueda de Precio Condición', | 647 | ariaLabelledBy: 'Busqueda de Precio Condición', |
640 | templateUrl: 'modal-precio-condicion.html', | 648 | templateUrl: 'modal-precio-condicion.html', |
641 | controller: 'focaModalPrecioCondicionController', | 649 | controller: 'focaModalPrecioCondicionController', |
642 | size: 'lg' | 650 | size: 'lg', |
651 | resolve: { | ||
652 | idListaPrecio: function() { | ||
653 | return $scope.remito.cliente.MOD || null; | ||
654 | } | ||
655 | } | ||
643 | } | 656 | } |
644 | ); | 657 | ); |
645 | modalInstance.result.then( | 658 | modalInstance.result.then( |
646 | function(precioCondicion) { | 659 | function(precioCondicion) { |
647 | var cabecera = ''; | 660 | var cabecera = ''; |
648 | var plazosConcat = ''; | 661 | var plazosConcat = ''; |
649 | if(!Array.isArray(precioCondicion)) { | 662 | if(!Array.isArray(precioCondicion)) { |
650 | $scope.remito.idPrecioCondicion = precioCondicion.id; | 663 | $scope.remito.idPrecioCondicion = precioCondicion.id; |
651 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; | 664 | $scope.remito.remitoPlazo = precioCondicion.plazoPago; |
652 | $scope.idLista = precioCondicion.idListaPrecio; | 665 | $scope.idLista = precioCondicion.idListaPrecio; |
653 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 666 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
654 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 667 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
655 | } | 668 | } |
656 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + | 669 | cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + |
657 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); | 670 | ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); |
658 | }else { //Cuando se ingresan los plazos manualmente | 671 | }else { //Cuando se ingresan los plazos manualmente |
659 | $scope.remito.idPrecioCondicion = 0; | 672 | $scope.remito.idPrecioCondicion = 0; |
660 | //-1, el modal productos busca todos los productos | 673 | //-1, el modal productos busca todos los productos |
661 | $scope.idLista = -1; | 674 | $scope.idLista = -1; |
662 | $scope.remito.remitoPlazo = precioCondicion; | 675 | $scope.remito.remitoPlazo = precioCondicion; |
663 | for(var j = 0; j < precioCondicion.length; j++) { | 676 | for(var j = 0; j < precioCondicion.length; j++) { |
664 | plazosConcat += precioCondicion[j].dias + ' '; | 677 | plazosConcat += precioCondicion[j].dias + ' '; |
665 | } | 678 | } |
666 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 679 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
667 | } | 680 | } |
668 | $scope.remito.articulosRemito = []; | 681 | $scope.remito.articulosRemito = []; |
669 | $scope.$broadcast('addCabecera',{ | 682 | $scope.$broadcast('addCabecera',{ |
670 | label: 'Precios y condiciones:', | 683 | label: 'Precios y condiciones:', |
671 | valor: cabecera | 684 | valor: cabecera |
672 | }); | 685 | }); |
673 | 686 | ||
674 | $scope.remito.precioCondicion = precioCondicion; | 687 | $scope.remito.precioCondicion = precioCondicion; |
675 | }, function() { | 688 | }, function() { |
676 | 689 | ||
677 | } | 690 | } |
678 | ); | 691 | ); |
679 | } | 692 | } |
680 | }; | 693 | }; |
681 | 694 | ||
682 | $scope.seleccionarFlete = function() { | 695 | $scope.seleccionarTransportista = function() { |
683 | if(varlidarRemitoFacturado()) { | 696 | $scope.seleccionarProveedor(function() { |
684 | var modalInstance = $uibModal.open( | 697 | if (varlidarRemitoFacturado()) { |
685 | { | 698 | var modalInstance = $uibModal.open( |
686 | ariaLabelledBy: 'Busqueda de Flete', | 699 | { |
687 | templateUrl: 'modal-flete.html', | 700 | ariaLabelledBy: 'Busqueda de Flete', |
688 | controller: 'focaModalFleteController', | 701 | templateUrl: 'modal-flete.html', |
689 | size: 'lg', | 702 | controller: 'focaModalFleteController', |
690 | resolve: { | 703 | size: 'lg', |
691 | parametrosFlete: | 704 | resolve: { |
692 | function() { | 705 | parametrosFlete: |
693 | return { | 706 | function() { |
694 | flete: $scope.remito.flete ? '1' : | 707 | return { |
695 | ($scope.remito.fob ? 'FOB' : | 708 | flete: $scope.remito.flete ? '1' : |
696 | ($scope.remito.flete === undefined ? null : '0')), | 709 | ($scope.remito.fob ? 'FOB' : |
697 | bomba: $scope.remito.bomba ? '1' : | 710 | ($scope.remito.flete === undefined ? |
698 | ($scope.remito.bomba === undefined ? null : '0'), | 711 | null : '0')), |
699 | kilometros: $scope.remito.kilometros | 712 | bomba: $scope.remito.bomba ? '1' : |
700 | }; | 713 | ($scope.remito.bomba === undefined ? |
701 | } | 714 | null : '0'), |
715 | kilometros: $scope.remito.kilometros | ||
716 | }; | ||
717 | } | ||
718 | } | ||
702 | } | 719 | } |
703 | } | 720 | ); |
704 | ); | 721 | modalInstance.result.then( |
705 | modalInstance.result.then( | 722 | function(datos) { |
706 | function(datos) { | 723 | $scope.remito.flete = datos.flete; |
707 | $scope.remito.flete = datos.flete; | 724 | $scope.remito.fob = datos.FOB; |
708 | $scope.remito.fob = datos.FOB; | 725 | $scope.remito.bomba = datos.bomba; |
709 | $scope.remito.bomba = datos.bomba; | 726 | $scope.remito.kilometros = datos.kilometros; |
710 | $scope.remito.kilometros = datos.kilometros; | 727 | |
711 | |||
712 | $scope.$broadcast('addCabecera',{ | ||
713 | label: 'Flete:', | ||
714 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') | ||
715 | }); | ||
716 | if(datos.flete) { | ||
717 | $scope.$broadcast('addCabecera',{ | 728 | $scope.$broadcast('addCabecera',{ |
718 | label: 'Bomba:', | 729 | label: 'Flete:', |
719 | valor: datos.bomba ? 'Si' : 'No' | 730 | valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') |
720 | }); | ||
721 | $scope.$broadcast('addCabecera',{ | ||
722 | label: 'Kilometros:', | ||
723 | valor: datos.kilometros | ||
724 | }); | 731 | }); |
725 | }else { | 732 | if (datos.flete) { |
726 | $scope.$broadcast('removeCabecera', 'Bomba:'); | 733 | $scope.$broadcast('addCabecera',{ |
727 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | 734 | label: 'Bomba:', |
728 | $scope.remito.fob = false; | 735 | valor: datos.bomba ? 'Si' : 'No' |
729 | $scope.remito.bomba = false; | 736 | }); |
730 | $scope.remito.kilometros = null; | 737 | $scope.$broadcast('addCabecera',{ |
738 | label: 'Kilometros:', | ||
739 | valor: datos.kilometros | ||
740 | }); | ||
741 | } else { | ||
742 | $scope.$broadcast('removeCabecera', 'Bomba:'); | ||
743 | $scope.$broadcast('removeCabecera', 'Kilometros:'); | ||
744 | $scope.remito.fob = false; | ||
745 | $scope.remito.bomba = false; | ||
746 | $scope.remito.kilometros = null; | ||
747 | } | ||
748 | }, function() { | ||
749 | $scope.seleccionarTransportista(); | ||
731 | } | 750 | } |
732 | }, function() { | 751 | ); |
733 | 752 | } | |
734 | } | 753 | }); |
735 | ); | ||
736 | } | ||
737 | }; | 754 | }; |
738 | 755 | ||
739 | $scope.seleccionarMoneda = function() { | 756 | $scope.seleccionarMoneda = function() { |
740 | if(varlidarRemitoFacturado()) { | 757 | if(varlidarRemitoFacturado()) { |
741 | var parametrosModal = { | 758 | var parametrosModal = { |
742 | titulo: 'Búsqueda de monedas', | 759 | titulo: 'Búsqueda de monedas', |
743 | query: '/moneda', | 760 | query: '/moneda', |
744 | columnas: [ | 761 | columnas: [ |
745 | { | 762 | { |
746 | propiedad: 'DETALLE', | 763 | propiedad: 'DETALLE', |
747 | nombre: 'Nombre' | 764 | nombre: 'Nombre' |
748 | }, | 765 | }, |
749 | { | 766 | { |
750 | propiedad: 'SIMBOLO', | 767 | propiedad: 'SIMBOLO', |
751 | nombre: 'Símbolo' | 768 | nombre: 'Símbolo' |
752 | } | 769 | } |
753 | ], | 770 | ], |
754 | size: 'md' | 771 | size: 'md' |
755 | }; | 772 | }; |
756 | focaModalService.modal(parametrosModal).then( | 773 | focaModalService.modal(parametrosModal).then( |
757 | function(moneda) { | 774 | function(moneda) { |
758 | $scope.abrirModalCotizacion(moneda); | 775 | $scope.abrirModalCotizacion(moneda); |
759 | }, function() { | 776 | }, function() { |
760 | 777 | ||
761 | } | 778 | } |
762 | ); | 779 | ); |
763 | } | 780 | } |
764 | }; | 781 | }; |
765 | 782 | ||
766 | $scope.seleccionarObservaciones = function() { | 783 | $scope.seleccionarObservaciones = function() { |
767 | focaModalService | 784 | focaModalService |
768 | .prompt('Observaciones', $scope.remito.observaciones, true, true) | 785 | .prompt({ |
786 | titulo: 'Observaciones', | ||
787 | value: $scope.remito.observaciones, | ||
788 | textarea: true, | ||
789 | readonly: true | ||
790 | }) | ||
769 | .then(function(observaciones) { | 791 | .then(function(observaciones) { |
770 | $scope.remito.observaciones = observaciones; | 792 | $scope.remito.observaciones = observaciones; |
771 | }); | 793 | }); |
772 | }; | 794 | }; |
773 | 795 | ||
774 | $scope.abrirModalCotizacion = function(moneda) { | 796 | $scope.abrirModalCotizacion = function(moneda) { |
775 | var modalInstance = $uibModal.open( | 797 | var modalInstance = $uibModal.open( |
776 | { | 798 | { |
777 | ariaLabelledBy: 'Busqueda de Cotización', | 799 | ariaLabelledBy: 'Busqueda de Cotización', |
778 | templateUrl: 'modal-cotizacion.html', | 800 | templateUrl: 'modal-cotizacion.html', |
779 | controller: 'focaModalCotizacionController', | 801 | controller: 'focaModalCotizacionController', |
780 | size: 'lg', | 802 | size: 'lg', |
781 | resolve: {idMoneda: function() {return moneda.ID;}} | 803 | resolve: {idMoneda: function() {return moneda.ID;}} |
782 | } | 804 | } |
783 | ); | 805 | ); |
784 | modalInstance.result.then( | 806 | modalInstance.result.then( |
785 | function(cotizacion) { | 807 | function(cotizacion) { |
786 | var articulosTablaTemp = $scope.remito.articulosRemito; | 808 | var articulosTablaTemp = $scope.remito.articulosRemito; |
787 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 809 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
788 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 810 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
789 | $scope.remito.cotizacion.COTIZACION; | 811 | $scope.remito.cotizacion.COTIZACION; |
790 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 812 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
791 | cotizacion.COTIZACION; | 813 | cotizacion.COTIZACION; |
792 | } | 814 | } |
793 | $scope.remito.articulosRemito = articulosTablaTemp; | 815 | $scope.remito.articulosRemito = articulosTablaTemp; |
794 | $scope.remito.cotizacion.moneda = moneda; | 816 | $scope.remito.cotizacion.moneda = moneda; |
795 | $scope.remito.cotizacion = cotizacion; | 817 | $scope.remito.cotizacion = cotizacion; |
796 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { | 818 | if(moneda.DETALLE === 'PESOS ARGENTINOS') { |
797 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 819 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
798 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 820 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
799 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 821 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
800 | }else { | 822 | }else { |
801 | $scope.$broadcast('addCabecera',{ | 823 | $scope.$broadcast('addCabecera',{ |
802 | label: 'Moneda:', | 824 | label: 'Moneda:', |
803 | valor: moneda.DETALLE | 825 | valor: moneda.DETALLE |
804 | }); | 826 | }); |
805 | $scope.$broadcast('addCabecera',{ | 827 | $scope.$broadcast('addCabecera',{ |
806 | label: 'Fecha cotizacion:', | 828 | label: 'Fecha cotizacion:', |
807 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 829 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
808 | }); | 830 | }); |
809 | $scope.$broadcast('addCabecera',{ | 831 | $scope.$broadcast('addCabecera',{ |
810 | label: 'Cotizacion:', | 832 | label: 'Cotizacion:', |
811 | valor: $filter('number')(cotizacion.COTIZACION, '2') | 833 | valor: $filter('number')(cotizacion.COTIZACION, '2') |
812 | }); | 834 | }); |
813 | } | 835 | } |
814 | }, function() { | 836 | }, function() { |
815 | 837 | ||
816 | } | 838 | } |
817 | ); | 839 | ); |
818 | }; | 840 | }; |
819 | 841 | ||
820 | $scope.agregarATabla = function(key) { | 842 | $scope.agregarATabla = function(key) { |
821 | if(key === 13) { | 843 | if(key === 13) { |
822 | if($scope.articuloACargar.cantidad === undefined || | 844 | if($scope.articuloACargar.cantidad === undefined || |
823 | $scope.articuloACargar.cantidad === 0 || | 845 | $scope.articuloACargar.cantidad === 0 || |
824 | $scope.articuloACargar.cantidad === null ) { | 846 | $scope.articuloACargar.cantidad === null ) { |
825 | focaModalService.alert('El valor debe ser al menos 1'); | 847 | focaModalService.alert('El valor debe ser al menos 1'); |
826 | return; | 848 | return; |
827 | } | 849 | } |
828 | delete $scope.articuloACargar.sectorCodigo; | 850 | delete $scope.articuloACargar.sectorCodigo; |
829 | $scope.remito.articulosRemito.push($scope.articuloACargar); | 851 | $scope.remito.articulosRemito.push($scope.articuloACargar); |
830 | $scope.cargando = true; | 852 | $scope.cargando = true; |
831 | } | 853 | } |
832 | }; | 854 | }; |
833 | 855 | ||
834 | $scope.quitarArticulo = function(key) { | 856 | $scope.quitarArticulo = function(key) { |
835 | $scope.remito.articulosRemito.splice(key, 1); | 857 | $scope.remito.articulosRemito.splice(key, 1); |
836 | }; | 858 | }; |
837 | 859 | ||
838 | $scope.editarArticulo = function(key, articulo) { | 860 | $scope.editarArticulo = function(key, articulo) { |
839 | if(key === 13) { | 861 | if (key === 13) { |
840 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 862 | if (!articulo.cantidad || !articulo.precio) { |
841 | articulo.cantidad === undefined) { | 863 | focaModalService.alert('Los valores deben ser al menos 1'); |
842 | focaModalService.alert('El valor debe ser al menos 1'); | 864 | return; |
865 | } else if (articulo.cantidad < 0 || articulo.precio < 0) { | ||
866 | focaModalService.alert('Los valores no pueden ser negativos'); | ||
843 | return; | 867 | return; |
844 | } | 868 | } |
845 | articulo.editCantidad = false; | 869 | articulo.editCantidad = articulo.editPrecio = false; |
846 | articulo.editPrecio = false; | ||
847 | } | 870 | } |
848 | }; | 871 | }; |
849 | 872 | ||
850 | $scope.cambioEdit = function(articulo, propiedad) { | 873 | $scope.cambioEdit = function(articulo, propiedad) { |
851 | if(propiedad === 'cantidad') { | 874 | if(propiedad === 'cantidad') { |
852 | articulo.editCantidad = true; | 875 | articulo.editCantidad = true; |
853 | }else if(propiedad === 'precio') { | 876 | }else if(propiedad === 'precio') { |
854 | articulo.editPrecio = true; | 877 | articulo.editPrecio = true; |
855 | } | 878 | } |
856 | }; | 879 | }; |
857 | 880 | ||
858 | $scope.limpiarFlete = function() { | ||
859 | $scope.remito.fleteNombre = ''; | ||
860 | $scope.remito.chofer = ''; | ||
861 | $scope.remito.vehiculo = ''; | ||
862 | $scope.remito.kilometros = ''; | ||
863 | $scope.remito.costoUnitarioKmFlete = ''; | ||
864 | $scope.choferes = ''; | ||
865 | $scope.vehiculos = ''; | ||
866 | }; | ||
867 | |||
868 | $scope.limpiarPantalla = function() { | ||
869 | $scope.limpiarFlete(); | ||
870 | $scope.remito.flete = '0'; | ||
871 | $scope.remito.bomba = '0'; | ||
872 | $scope.remito.precioCondicion = ''; | ||
873 | $scope.remito.articulosRemito = []; | ||
874 | $scope.remito.vendedor.nombre = ''; | ||
875 | $scope.remito.cliente = {nombre: ''}; | ||
876 | $scope.remito.domicilio = {dom: ''}; | ||
877 | $scope.domiciliosCliente = []; | ||
878 | }; | ||
879 | |||
880 | $scope.resetFilter = function() { | 881 | $scope.resetFilter = function() { |
881 | $scope.articuloACargar = {}; | 882 | $scope.articuloACargar = {}; |
882 | $scope.cargando = true; | 883 | $scope.cargando = true; |
883 | }; | 884 | }; |
884 | //Recibe aviso si el teclado está en uso | 885 | //Recibe aviso si el teclado está en uso |
885 | $rootScope.$on('usarTeclado', function(event, data) { | 886 | $rootScope.$on('usarTeclado', function(event, data) { |
886 | if(data) { | 887 | if(data) { |
887 | $scope.mostrarTeclado = true; | 888 | $scope.mostrarTeclado = true; |
888 | return; | 889 | return; |
889 | } | 890 | } |
890 | $scope.mostrarTeclado = false; | 891 | $scope.mostrarTeclado = false; |
891 | }); | 892 | }); |
892 | 893 | ||
893 | $scope.selectFocus = function($event) { | 894 | $scope.selectFocus = function($event) { |
894 | // Si el teclado esta en uso no selecciona el valor | 895 | // Si el teclado esta en uso no selecciona el valor |
895 | if($scope.mostrarTeclado) { | 896 | if($scope.mostrarTeclado) { |
896 | return; | 897 | return; |
897 | } | 898 | } |
898 | $event.target.select(); | 899 | $event.target.select(); |
899 | }; | 900 | }; |
900 | 901 | ||
901 | function addArrayCabecera(array) { | 902 | function addArrayCabecera(array) { |
902 | for(var i = 0; i < array.length; i++) { | 903 | for(var i = 0; i < array.length; i++) { |
903 | $scope.$broadcast('addCabecera',{ | 904 | $scope.$broadcast('addCabecera',{ |
904 | label: array[i].label, | 905 | label: array[i].label, |
905 | valor: array[i].valor | 906 | valor: array[i].valor |
906 | }); | 907 | }); |
907 | } | 908 | } |
908 | } | 909 | } |
909 | 910 | ||
910 | function rellenar(relleno, longitud) { | 911 | function rellenar(relleno, longitud) { |
911 | relleno = '' + relleno; | 912 | relleno = '' + relleno; |
912 | while (relleno.length < longitud) { | 913 | while (relleno.length < longitud) { |
913 | relleno = '0' + relleno; | 914 | relleno = '0' + relleno; |
914 | } | 915 | } |
915 | 916 | ||
916 | return relleno; | 917 | return relleno; |
917 | } | 918 | } |
918 | 919 | ||
919 | function varlidarRemitoFacturado() { | 920 | function varlidarRemitoFacturado() { |
920 | if($scope.remito.estado !== 5) { | 921 | if($scope.remito.estado !== 5) { |
921 | return true; | 922 | return true; |
922 | }else { | 923 | }else { |
923 | focaModalService.alert('No se puede editar un remito facturado'); | 924 | focaModalService.alert('No se puede editar un remito facturado'); |
924 | return false(); | 925 | return false(); |
925 | } | 926 | } |
926 | } | 927 | } |
927 | 928 | ||
928 | function salir() { | 929 | function salir() { |
929 | var confirmacion = false; | 930 | var confirmacion = false; |
930 | 931 | ||
931 | if (!angular.equals($scope.remito, $scope.inicial)) { | 932 | if (!angular.equals($scope.remito, $scope.inicial)) { |
932 | confirmacion = true; | 933 | confirmacion = true; |
933 | } | 934 | } |
934 | 935 | ||
935 | if (confirmacion) { | 936 | if (confirmacion) { |
936 | focaModalService.confirm( | 937 | focaModalService.confirm( |
937 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 938 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
938 | ).then(function(data) { | 939 | ).then(function(data) { |
939 | if (data) { | 940 | if (data) { |
940 | $location.path('/'); | 941 | $location.path('/'); |
941 | } | 942 | } |
942 | }); | 943 | }); |
943 | } else { | 944 | } else { |
944 | $location.path('/'); | 945 | $location.path('/'); |
945 | } | 946 | } |
946 | } | 947 | } |
947 | 948 | ||
948 | function enableObservaciones(val) { | 949 | function enableObservaciones(val) { |
949 | var boton = $scope.botonera.filter(function(botonObs) { | 950 | var boton = $scope.botonera.filter(function(botonObs) { |
950 | return botonObs.label === 'Observaciones'; | 951 | return botonObs.label === 'Observaciones'; |
951 | }); | 952 | }); |
952 | 953 | ||
953 | boton[0].disable = !val; | 954 | boton[0].disable = !val; |
954 | } | 955 | } |
955 | 956 | ||
956 | function setearRemito(remito) { | 957 | function setearRemito(remito) { |
957 | //añado cabeceras | 958 | //añado cabeceras |
958 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 959 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
959 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 960 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
960 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 961 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
961 | 962 | ||
962 | var cabeceras = []; | 963 | var cabeceras = []; |
963 | 964 | ||
964 | if (remito.cotizacion.ID) { | 965 | if (remito.cotizacion.ID) { |
965 | cabeceras.push({ | 966 | cabeceras.push({ |
966 | label: 'Moneda:', | 967 | label: 'Moneda:', |
967 | valor: remito.cotizacion.moneda.DETALLE | 968 | valor: remito.cotizacion.moneda.DETALLE |
968 | }); | 969 | }); |
969 | cabeceras.push({ | 970 | cabeceras.push({ |
970 | label: 'Fecha cotizacion:', | 971 | label: 'Fecha cotizacion:', |
971 | valor: $filter('date')(remito.cotizacion.FECHA, | 972 | valor: $filter('date')(remito.cotizacion.FECHA, |
972 | 'dd/MM/yyyy') | 973 | 'dd/MM/yyyy') |
973 | }); | 974 | }); |
974 | cabeceras.push({ | 975 | cabeceras.push({ |
975 | label: 'Cotizacion:', | 976 | label: 'Cotizacion:', |
976 | valor: $filter('number')(remito.cotizacion.VENDEDOR, | 977 | valor: $filter('number')(remito.cotizacion.VENDEDOR, |
977 | '2') | 978 | '2') |
978 | }); | 979 | }); |
979 | } | 980 | } |
980 | if (remito.cliente.COD) { | 981 | if (remito.cliente.COD) { |
981 | cabeceras.push({ | 982 | cabeceras.push({ |
982 | label: 'Cliente:', | 983 | label: 'Cliente:', |
983 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + | 984 | valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' + |
984 | remito.cliente.NOM | 985 | remito.cliente.NOM |
985 | }); | 986 | }); |
986 | cabeceras.push({ | 987 | cabeceras.push({ |
987 | label: 'Domicilio:', | 988 | label: 'Domicilio:', |
988 | valor: remito.domicilioStamp | 989 | valor: remito.domicilioStamp |
989 | }); | 990 | }); |
990 | } | 991 | } |
991 | if (remito.vendedor.NUM) { | 992 | if (remito.vendedor.NUM) { |
992 | cabeceras.push({ | 993 | cabeceras.push({ |
993 | label: 'Vendedor:', | 994 | label: 'Vendedor:', |
994 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + | 995 | valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + |
995 | ' - ' + remito.vendedor.NOM | 996 | ' - ' + remito.vendedor.NOM |
996 | }); | 997 | }); |
997 | } | 998 | } |
998 | if (remito.proveedor.COD) { | 999 | if (remito.proveedor.COD) { |
999 | cabeceras.push({ | 1000 | cabeceras.push({ |
src/js/service.js
1 | angular.module('focaCrearRemito') | 1 | angular.module('focaCrearRemito') |
2 | .service('crearRemitoService', ['$http', 'API_ENDPOINT', | 2 | .service('crearRemitoService', ['$http', 'API_ENDPOINT', |
3 | function($http, API_ENDPOINT) { | 3 | function($http, API_ENDPOINT) { |
4 | var route = API_ENDPOINT.URL; | 4 | var route = API_ENDPOINT.URL; |
5 | return { | 5 | return { |
6 | crearRemito: function(remito) { | 6 | crearRemito: function(remito) { |
7 | // TODO: Cambiar para usar el servicio /remito | 7 | // TODO: Cambiar para usar el servicio /remito |
8 | return $http.post(route + '/remito', remito); | 8 | return $http.post(route + '/remito', remito); |
9 | }, | 9 | }, |
10 | getRemitoById: function(id) { | 10 | getRemitoById: function(id) { |
11 | return $http.get(route + '/remito/obtener/' + id); | 11 | return $http.get(route + '/remito/obtener/' + id); |
12 | }, | 12 | }, |
13 | obtenerRemito: function() { | 13 | obtenerRemito: function() { |
14 | return $http.get(route +'/nota-pedido'); | 14 | return $http.get(route +'/nota-pedido'); |
15 | }, | 15 | }, |
16 | setRemito: function(remito) { | 16 | setRemito: function(remito) { |
17 | this.remito = remito; | 17 | this.remito = remito; |
18 | }, | 18 | }, |
19 | clearRemito: function() { | 19 | clearRemito: function() { |
20 | this.remito = undefined; | 20 | this.remito = undefined; |
21 | }, | 21 | }, |
22 | getRemito: function() { | 22 | getRemito: function() { |
23 | return this.remito; | 23 | return this.remito; |
24 | }, | 24 | }, |
25 | getArticulosByIdRemito: function(id) { | 25 | getArticulosByIdRemito: function(id) { |
26 | return $http.get(route+'/articulos/nota-pedido/'+id); | 26 | return $http.get(route+'/articulos/nota-pedido/'+id); |
27 | }, | 27 | }, |
28 | crearArticulosParaRemito: function(articuloRemito) { | 28 | crearArticulosParaRemito: function(articuloRemito) { |
29 | return $http.post(route + '/articulos/remito', | 29 | return $http.post(route + '/articulos/remito', |
30 | {articuloRemito: articuloRemito}); | 30 | {articuloRemito: articuloRemito}); |
31 | }, | 31 | }, |
32 | getDomiciliosByIdRemito: function(id) { | 32 | getDomiciliosByIdRemito: function(id) { |
33 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); | 33 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); |
34 | }, | 34 | }, |
35 | getDomiciliosByIdCliente: function(id) { | 35 | getDomiciliosByIdCliente: function(id) { |
36 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) | 36 | var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) |
37 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); | 37 | return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); |
38 | }, | 38 | }, |
39 | getPrecioCondicion: function() { | 39 | getPrecioCondicion: function() { |
40 | return $http.get(route + '/precio-condicion'); | 40 | return $http.get(route + '/precio-condicion'); |
41 | }, | 41 | }, |
42 | getPrecioCondicionById: function(id) { | 42 | getPrecioCondicionById: function(id) { |
43 | return $http.get(route + '/precio-condicion/' + id); | 43 | return $http.get(route + '/precio-condicion/' + id); |
44 | }, | 44 | }, |
45 | getPlazoPagoByPrecioCondicion: function(id) { | 45 | getPlazoPagoByPrecioCondicion: function(id) { |
46 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); | 46 | return $http.get(route + '/plazo-pago/precio-condicion/'+ id); |
47 | }, | 47 | }, |
48 | crearFlete: function(flete) { | 48 | crearFlete: function(flete) { |
49 | return $http.post(route + '/flete', {flete : flete}); | 49 | return $http.post(route + '/flete', {flete : flete}); |
50 | }, | 50 | }, |
51 | crearPlazosParaRemito: function(plazos) { | 51 | crearPlazosParaRemito: function(plazos) { |
52 | return $http.post(route + '/plazo-pago/remito', plazos); | 52 | return $http.post(route + '/plazo-pago/remito', plazos); |
53 | }, | 53 | }, |
54 | getCotizacionByIdMoneda: function(id) { | 54 | getCotizacionByIdMoneda: function(id) { |
55 | return $http.get(route + '/moneda/' + id); | 55 | return $http.get(route + '/moneda/' + id); |
56 | }, | 56 | }, |
57 | crearEstadoParaRemito: function(estado) { | 57 | crearEstadoParaRemito: function(estado) { |
58 | return $http.post(route + '/estado', {estado: estado}); | 58 | return $http.post(route + '/estado', {estado: estado}); |
59 | }, | 59 | }, |
60 | getNumeroRemito: function() { | 60 | getNumeroRemito: function() { |
61 | return $http.get(route + '/remito/numero-siguiente'); | 61 | return $http.get(route + '/remito/numero-siguiente'); |
62 | }, | 62 | }, |
63 | imprimirRemitoByIdRemito: function(idRemito, original) { | 63 | imprimirRemitoByIdRemito: function(idRemito, original) { |
64 | var tipo = original ? '/original' : ''; | 64 | var tipo = original ? '/original' : ''; |
65 | return $http.get(route + '/remito/comprobante/' + idRemito + tipo, { | 65 | return $http.get(route + '/remito/comprobante/' + idRemito + tipo, { |
66 | responseType: 'arraybuffer' | 66 | responseType: 'arraybuffer' |
67 | }); | 67 | }); |
68 | }, | 68 | }, |
69 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { | 69 | getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { |
70 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + | 70 | return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + |
71 | idDomicilio + '/' + idCliente); | 71 | idDomicilio + '/' + idCliente); |
72 | }, | 72 | }, |
73 | enviarCorreo: function(options) { | 73 | enviarCorreo: function(options) { |
74 | return $http.post(API_ENDPOINT.URL + '/remito/mail', options); | 74 | return $http.post(API_ENDPOINT.URL + '/remito/mail', options); |
75 | }, | 75 | }, |
76 | getBotonera: function() { | 76 | getBotonera: function() { |
77 | return [ | 77 | return [ |
78 | { | 78 | { |
79 | label: 'Nota pedido', | 79 | label: 'Nota pedido', |
80 | image: 'notaDePedido.png' | 80 | image: 'notaDePedido.png' |
81 | }, | 81 | }, |
82 | { | 82 | { |
83 | label: 'Vendedor', | ||
84 | image: 'vendedor.png' | ||
85 | }, | ||
86 | { | ||
87 | label: 'Cliente', | 83 | label: 'Cliente', |
88 | image: 'cliente.png' | 84 | image: 'cliente.png' |
89 | }, | 85 | }, |
90 | { | 86 | { |
91 | label: 'Proveedor', | 87 | label: 'Transportista', |
92 | image: 'proveedor.png' | 88 | image: 'proveedor.png' |
93 | }, | 89 | }, |
94 | { | 90 | { |
95 | label: 'Moneda', | 91 | label: 'Moneda', |
96 | image: 'moneda.png' | 92 | image: 'moneda.png' |
97 | }, | 93 | }, |
98 | { | 94 | { |
99 | label: 'Precios y condiciones', | 95 | label: 'Precios y condiciones', |
100 | image: 'precios-condiciones.png' | 96 | image: 'precios-condiciones.png' |
101 | }, | 97 | }, |
102 | { | 98 | { |
103 | label: 'Flete', | ||
104 | image: 'flete.png' | ||
105 | }, | ||
106 | { | ||
107 | label: 'Productos', | 99 | label: 'Productos', |
108 | image: 'productos.png' | 100 | image: 'productos.png' |
109 | }, | 101 | }, |
110 | { | 102 | { |
111 | label: 'Observaciones', | 103 | label: 'Observaciones', |
112 | image: 'productos.png', | 104 | image: 'botonObservaciones.png', |
113 | disable: true | 105 | disable: true |
114 | } | 106 | } |
115 | ]; | 107 | ]; |
116 | } | 108 | } |
117 | }; | 109 | }; |
118 | }]); | 110 | }]); |
119 | 111 |
src/views/remito.html
1 | <div class="crear-nota-remito foca-crear row"> | 1 | <div class="crear-nota-remito foca-crear row"> |
2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador |
3 | titulo="'Remito'" | 3 | titulo="'Remito'" |
4 | numero="puntoVenta + '-' + comprobante" | 4 | numero="puntoVenta + '-' + comprobante" |
5 | fecha="now" | 5 | fecha="now" |
6 | class="mb-0 col-lg-12" | 6 | class="mb-0 col-lg-12" |
7 | busqueda="seleccionarRemito" | 7 | busqueda="seleccionarRemito" |
8 | ></foca-cabecera-facturador> | 8 | ></foca-cabecera-facturador> |
9 | <div class="col-lg-12"> | 9 | <div class="col-lg-12"> |
10 | <div class="row mt-4"> | 10 | <div class="row mt-4"> |
11 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> | 11 | <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> |
12 | <div class="row p-1 botonera-secundaria px-5 py-2"> | 12 | <div class="row p-1 botonera-secundaria px-5 py-2"> |
13 | <div class="col-12"> | 13 | <div class="col-12"> |
14 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> | 14 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> |
15 | </div> | 15 | </div> |
16 | </div> | 16 | </div> |
17 | <!-- PC --> | 17 | <!-- PC --> |
18 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 18 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> |
19 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 19 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> |
20 | <thead> | 20 | <thead> |
21 | <tr class="d-flex"> | 21 | <tr class="d-flex"> |
22 | <th class="">#</th> | 22 | <th class="">#</th> |
23 | <th class="col">Código</th> | 23 | <th class="col">Código</th> |
24 | <th class="col-4">Descripción</th> | 24 | <th class="col-4">Descripción</th> |
25 | <th class="col text-right">Cantidad</th> | 25 | <th class="col text-right">Cantidad</th> |
26 | <th class="col text-right">Precio Unitario</th> | 26 | <th class="col text-right">Precio Unitario</th> |
27 | <th class="col text-right">SubTotal</th> | 27 | <th class="col text-right">SubTotal</th> |
28 | <th class="text-right"> | 28 | <th class="text-right"> |
29 | <button | 29 | <button |
30 | class="btn btn-outline-light selectable" | 30 | class="btn btn-outline-light selectable" |
31 | ng-click="show = !show; masMenos()" | 31 | ng-click="show = !show; masMenos()" |
32 | > | 32 | > |
33 | <i | 33 | <i |
34 | class="fa fa-chevron-down" | 34 | class="fa fa-chevron-down" |
35 | ng-show="show" | 35 | ng-show="show" |
36 | aria-hidden="true" | 36 | aria-hidden="true" |
37 | > | 37 | > |
38 | </i> | 38 | </i> |
39 | <i | 39 | <i |
40 | class="fa fa-chevron-up" | 40 | class="fa fa-chevron-up" |
41 | ng-hide="show" | 41 | ng-hide="show" |
42 | aria-hidden="true"> | 42 | aria-hidden="true"> |
43 | </i> | 43 | </i> |
44 | </button> | 44 | </button> |
45 | </th> | 45 | </th> |
46 | </tr> | 46 | </tr> |
47 | </thead> | 47 | </thead> |
48 | <tbody class="tabla-articulo-body"> | 48 | <tbody class="tabla-articulo-body"> |
49 | <tr | 49 | <tr |
50 | ng-repeat="(key, articulo) in remito.articulosRemito" | 50 | ng-repeat="(key, articulo) in remito.articulosRemito" |
51 | ng-show="show || key == (remito.articulosRemito.length - 1)" | 51 | ng-show="show || key == (remito.articulosRemito.length - 1)" |
52 | class="d-flex" | 52 | class="d-flex" |
53 | > | 53 | > |
54 | <td ng-bind="key + 1"></td> | 54 | <td ng-bind="key + 1"></td> |
55 | <td | 55 | <td |
56 | class="col" | 56 | class="col" |
57 | ng-bind="articulo.sector + '-' + articulo.codigo" | 57 | ng-bind="articulo.sector + '-' + articulo.codigo" |
58 | ></td> | 58 | ></td> |
59 | <td | 59 | <td |
60 | class="col-4" | 60 | class="col-4" |
61 | ng-bind="articulo.descripcion" | 61 | ng-bind="articulo.descripcion" |
62 | ></td> | 62 | ></td> |
63 | <td class="col text-right"> | 63 | <td class="col text-right"> |
64 | <input | 64 | <input |
65 | ng-show="articulo.editCantidad" | 65 | ng-show="articulo.editCantidad" |
66 | ng-model="articulo.cantidad" | 66 | ng-model="articulo.cantidad" |
67 | class="form-control" | 67 | class="form-control" |
68 | foca-tipo-input | 68 | foca-tipo-input |
69 | min="1" | 69 | min="1" |
70 | foca-focus="articulo.editCantidad" | 70 | foca-focus="articulo.editCantidad" |
71 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 71 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
72 | ng-focus="selectFocus($event)" | 72 | ng-focus="selectFocus($event)" |
73 | teclado-virtual | 73 | teclado-virtual |
74 | > | 74 | > |
75 | <i | 75 | <i |
76 | class="selectable" | 76 | class="selectable" |
77 | ng-click="cambioEdit(articulo, 'cantidad')" | 77 | ng-click="cambioEdit(articulo, 'cantidad')" |
78 | ng-hide="articulo.editCantidad" | 78 | ng-hide="articulo.editCantidad" |
79 | ng-bind="articulo.cantidad"> | 79 | ng-bind="articulo.cantidad"> |
80 | </i> | 80 | </i> |
81 | </td> | 81 | </td> |
82 | <td class="col text-right"> | 82 | <td class="col text-right"> |
83 | <input | 83 | <input |
84 | ng-show="articulo.editPrecio" | 84 | ng-show="articulo.editPrecio" |
85 | ng-model="articulo.precio" | 85 | ng-model="articulo.precio" |
86 | class="form-control" | 86 | class="form-control" |
87 | foca-tipo-input | 87 | foca-tipo-input |
88 | min="1" | 88 | min="1" |
89 | step="0.0001" | 89 | step="0.0001" |
90 | foca-focus="articulo.editPrecio" | 90 | foca-focus="articulo.editPrecio" |
91 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 91 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
92 | ng-focus="selectFocus($event)" | 92 | ng-focus="selectFocus($event)" |
93 | teclado-virtual | 93 | teclado-virtual |
94 | > | 94 | > |
95 | <i | 95 | <i |
96 | class="selectable" | 96 | class="selectable" |
97 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" | 97 | ng-click="cambioEdit(articulo, 'precio')" |
98 | ng-hide="articulo.editPrecio" | 98 | ng-hide="articulo.editPrecio" |
99 | ng-bind="articulo.precio | number: 4"> | 99 | ng-bind="articulo.precio | number: 4"> |
100 | </i> | 100 | </i> |
101 | </td> | 101 | </td> |
102 | <td | 102 | <td |
103 | class="col text-right" | 103 | class="col text-right" |
104 | ng-bind="(articulo.precio * articulo.cantidad) | number: 2"> | 104 | ng-bind="(articulo.precio * articulo.cantidad) | number: 2"> |
105 | </td> | 105 | </td> |
106 | <td class="text-center"> | 106 | <td class="text-center"> |
107 | <button | 107 | <button |
108 | class="btn btn-outline-light" | 108 | class="btn btn-outline-light" |
109 | ng-click="quitarArticulo(key)" | 109 | ng-click="quitarArticulo(key)" |
110 | > | 110 | > |
111 | <i class="fa fa-trash"></i> | 111 | <i class="fa fa-trash"></i> |
112 | </button> | 112 | </button> |
113 | <button | ||
114 | class="btn btn-outline-light" | ||
115 | ng-click="editarArticulo(13, articulo)" | ||
116 | ng-show="articulo.editCantidad || articulo.editPrecio" | ||
117 | > | ||
118 | <i class="fa fa-save"></i> | ||
119 | </button> | ||
113 | </td> | 120 | </td> |
114 | </tr> | 121 | </tr> |
115 | </tbody> | 122 | </tbody> |
116 | <tfoot> | 123 | <tfoot> |
117 | <tr ng-show="!cargando" class="d-flex"> | 124 | <tr ng-show="!cargando" class="d-flex"> |
118 | <td | 125 | <td |
119 | class="align-middle" | 126 | class="align-middle" |
120 | ng-bind="remito.articulosRemito.length + 1" | 127 | ng-bind="remito.articulosRemito.length + 1" |
121 | ></td> | 128 | ></td> |
122 | <td class="col"> | 129 | <td class="col"> |
123 | <input | 130 | <input |
124 | class="form-control" | 131 | class="form-control" |
125 | ng-model="articuloACargar.sectorCodigo" | 132 | ng-model="articuloACargar.sectorCodigo" |
126 | readonly | 133 | readonly |
127 | > | 134 | > |
128 | </td> | 135 | </td> |
129 | <td class="col-4 tabla-articulo-descripcion"> | 136 | <td class="col-4 tabla-articulo-descripcion"> |
130 | <input | 137 | <input |
131 | class="form-control" | 138 | class="form-control" |
132 | ng-model="articuloACargar.descripcion" | 139 | ng-model="articuloACargar.descripcion" |
133 | readonly | 140 | readonly |
134 | > | 141 | > |
135 | </td> | 142 | </td> |
136 | <td class="col text-right"> | 143 | <td class="col text-right"> |
137 | <input | 144 | <input |
138 | class="form-control" | 145 | class="form-control" |
139 | foca-tipo-input | 146 | foca-tipo-input |
140 | min="1" | 147 | min="1" |
141 | ng-model="articuloACargar.cantidad" | 148 | ng-model="articuloACargar.cantidad" |
142 | foca-focus="!cargando" | 149 | foca-focus="!cargando" |
143 | esc-key="resetFilter()" | 150 | esc-key="resetFilter()" |
144 | ng-keypress="agregarATabla($event.keyCode)" | 151 | ng-keypress="agregarATabla($event.keyCode)" |
145 | teclado-virtual | 152 | teclado-virtual |
146 | > | 153 | > |
147 | </td> | 154 | </td> |
148 | <td class="col text-right"> | 155 | <td class="col text-right"> |
149 | <input | 156 | <input |
150 | class="form-control" | 157 | class="form-control" |
151 | ng-value="articuloACargar.precio | number: 4" | 158 | ng-model="articuloACargar.precio" |
152 | ng-show="idLista != -1" | 159 | ng-show="idLista != -1" |
153 | readonly | 160 | ng-keypress="agregarATabla($event.keyCode)" |
154 | > | 161 | > |
155 | <input | 162 | <input |
156 | class="form-control" | 163 | class="form-control" |
157 | foca-tipo-input | 164 | foca-tipo-input |
158 | step="0.0001" | 165 | step="0.0001" |
159 | ng-model="articuloACargar.precio" | 166 | ng-model="articuloACargar.precio" |
160 | esc-key="resetFilter()" | 167 | esc-key="resetFilter()" |
161 | ng-keypress="agregarATabla($event.keyCode)" | 168 | ng-keypress="agregarATabla($event.keyCode)" |
162 | ng-show="idLista == -1" | 169 | ng-show="idLista == -1" |
163 | teclado-virtual | 170 | teclado-virtual |
164 | > | 171 | > |
165 | </td> | 172 | </td> |
166 | <td class="col text-right"> | 173 | <td class="col text-right"> |
167 | <input | 174 | <input |
168 | class="form-control" | 175 | class="form-control" |
169 | ng-value="getSubTotal() | number: 2" | 176 | ng-value="getSubTotal() | number: 2" |
170 | readonly | 177 | readonly |
171 | ></td> | 178 | ></td> |
172 | <td class="text-center align-middle"> | 179 | <td class="text-center align-middle"> |
173 | <button | 180 | <button |
174 | class="btn btn-outline-light" | 181 | class="btn btn-outline-light" |
175 | ng-click="agregarATabla(13)" | 182 | ng-click="agregarATabla(13)" |
176 | > | 183 | > |
177 | <i class="fa fa-save"></i> | 184 | <i class="fa fa-save"></i> |
178 | </button> | 185 | </button> |
179 | </td> | 186 | </td> |
180 | </tr> | 187 | </tr> |
181 | 188 | ||
182 | <tr class="d-flex"> | 189 | <tr class="d-flex"> |
183 | <td colspan="4" class="no-border-top"> | 190 | <td colspan="4" class="no-border-top"> |
184 | <strong>Items:</strong> | 191 | <strong>Items:</strong> |
185 | <a ng-bind="remito.articulosRemito.length"></a> | 192 | <a ng-bind="remito.articulosRemito.length"></a> |
186 | </td> | 193 | </td> |
187 | <td class="text-right ml-auto table-celda-total no-border-top"> | 194 | <td class="text-right ml-auto table-celda-total no-border-top"> |
188 | <h3>Total:</h3> | 195 | <h3>Total:</h3> |
189 | </td> | 196 | </td> |
190 | <td class="table-celda-total text-right no-border-top" colspan="1"> | 197 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
191 | <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> | 198 | <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> |
192 | </td> | 199 | </td> |
193 | <td class="text-right no-border-top"> | 200 | <td class="text-right no-border-top"> |
194 | <button | 201 | <button |
195 | type="button" | 202 | type="button" |
196 | class="btn btn-default btn-sm" | 203 | class="btn btn-default btn-sm" |
197 | > | 204 | > |
198 | Totales | 205 | Totales |
199 | </button> | 206 | </button> |
200 | </td> | 207 | </td> |
201 | </tr> | 208 | </tr> |
202 | </tfoot> | 209 | </tfoot> |
203 | </table> | 210 | </table> |
204 | </div> | 211 | </div> |
205 | 212 | ||
206 | <!-- MOBILE --> | 213 | <!-- MOBILE --> |
207 | <div class="row d-sm-none"> | 214 | <div class="row d-sm-none"> |
208 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> | 215 | <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> |
209 | <thead> | 216 | <thead> |
210 | <tr class="d-flex"> | 217 | <tr class="d-flex"> |
211 | <th class="">#</th> | 218 | <th class="">#</th> |
212 | <th class="col px-0"> | 219 | <th class="col px-0"> |
213 | <div class="d-flex"> | 220 | <div class="d-flex"> |
214 | <div class="col-4 px-1">Código</div> | 221 | <div class="col-4 px-1">Código</div> |
215 | <div class="col-8 px-1">Descripción</div> | 222 | <div class="col-8 px-1">Descripción</div> |
216 | </div> | 223 | </div> |
217 | <div class="d-flex"> | 224 | <div class="d-flex"> |
218 | <div class="col-3 px-1">Cantidad</div> | 225 | <div class="col-3 px-1">Cantidad</div> |
219 | <div class="col px-1 text-right">P. Uni.</div> | 226 | <div class="col px-1 text-right">P. Uni.</div> |
220 | <div class="col px-1 text-right">Subtotal</div> | 227 | <div class="col px-1 text-right">Subtotal</div> |
221 | </div> | 228 | </div> |
222 | </th> | 229 | </th> |
223 | <th class="text-center tamaño-boton"> | 230 | <th class="text-center tamaño-boton"> |
224 | | 231 | |
225 | </th> | 232 | </th> |
226 | </tr> | 233 | </tr> |
227 | </thead> | 234 | </thead> |
228 | <tbody> | 235 | <tbody> |
229 | <tr | 236 | <tr |
230 | ng-repeat="(key, articulo) in remito.articulosRemito" | 237 | ng-repeat="(key, articulo) in remito.articulosRemito" |
231 | ng-show="show || key == remito.articulosRemito.length - 1" | 238 | ng-show="show || key == remito.articulosRemito.length - 1" |
232 | > | 239 | > |
233 | <td class="w-100 align-middle d-flex p-0"> | 240 | <td class="w-100 align-middle d-flex p-0"> |
234 | <div class="align-middle p-1"> | 241 | <div class="align-middle p-1"> |
235 | <span ng-bind="key+1" class="align-middle"></span> | 242 | <span ng-bind="key+1" class="align-middle"></span> |
236 | </div> | 243 | </div> |
237 | <div class="col px-0"> | 244 | <div class="col px-0"> |
238 | <div class="d-flex"> | 245 | <div class="d-flex"> |
239 | <div class="col-4 px-1"> | 246 | <div class="col-4 px-1"> |
240 | <span | 247 | <span |
241 | ng-bind="articulo.sector + '-' + articulo.codigo" | 248 | ng-bind="articulo.sector + '-' + articulo.codigo" |
242 | ></span> | 249 | ></span> |
243 | </div> | 250 | </div> |
244 | <div class="col-8 px-1"> | 251 | <div class="col-8 px-1"> |
245 | <span | 252 | <span |
246 | ng-bind="'x' + articulo.cantidad" | 253 | ng-bind="'x' + articulo.cantidad" |
247 | ng-hide="articulo.editCantidad" | 254 | ng-hide="articulo.editCantidad" |
248 | ></span> | 255 | ></span> |
249 | <i | 256 | <i |
250 | class="fa fa-pencil text-white-50" | 257 | class="fa fa-pencil text-white-50" |
251 | aria-hidden="true" | 258 | aria-hidden="true" |
252 | ng-hide="articulo.editCantidad" | 259 | ng-hide="articulo.editCantidad" |
253 | ng-click="articulo.editCantidad = true" | 260 | ng-click="articulo.editCantidad = true" |
254 | ></i> | 261 | ></i> |
255 | <input | 262 | <input |
256 | ng-show="articulo.editCantidad" | 263 | ng-show="articulo.editCantidad" |
257 | ng-model="articulo.cantidad" | 264 | ng-model="articulo.cantidad" |
258 | class="form-control" | 265 | class="form-control" |
259 | foca-tipo-input | 266 | foca-tipo-input |
260 | min="1" | 267 | min="1" |
261 | step="0.001" | 268 | step="0.001" |
262 | foca-focus="articulo.editCantidad" | 269 | foca-focus="articulo.editCantidad" |
263 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 270 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
264 | ng-focus="selectFocus($event)" | 271 | ng-focus="selectFocus($event)" |
265 | > | 272 | > |
266 | </div> | 273 | </div> |
267 | </div> | 274 | </div> |
268 | <div class="d-flex"> | 275 | <div class="d-flex"> |
269 | <div class="col-3 px-1"> | 276 | <div class="col-3 px-1"> |
270 | <span ng-bind="'x' + articulo.cantidad"></span> | 277 | <span ng-bind="'x' + articulo.cantidad"></span> |
271 | </div> | 278 | </div> |
272 | <div class="col px-1 text-right"> | 279 | <div class="col px-1 text-right"> |
273 | <span ng-bind="articulo.precio | currency: remito.moneda.SIMBOLO : 4"></span> | 280 | <span ng-bind="articulo.precio | currency: remito.moneda.SIMBOLO : 4"></span> |
274 | </div> | 281 | </div> |
275 | <div class="col px-1 text-right"> | 282 | <div class="col px-1 text-right"> |
276 | <span | 283 | <span |
277 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.SIMBOLO" | 284 | ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.SIMBOLO" |
278 | > | 285 | > |
279 | </span> | 286 | </span> |
280 | </div> | 287 | </div> |
281 | </div> | 288 | </div> |
282 | </div> | 289 | </div> |
283 | <div class="align-middle p-1"> | 290 | <div class="align-middle p-1"> |
284 | <button | 291 | <button |
285 | class="btn btn-outline-light" | 292 | class="btn btn-outline-light" |
286 | ng-click="quitarArticulo(key)" | 293 | ng-click="quitarArticulo(key)" |
287 | > | 294 | > |
288 | <i class="fa fa-trash"></i> | 295 | <i class="fa fa-trash"></i> |
289 | </button> | 296 | </button> |
290 | </div> | 297 | </div> |
291 | </td> | 298 | </td> |
292 | </tr> | 299 | </tr> |
293 | </tbody> | 300 | </tbody> |
294 | <tfoot> | 301 | <tfoot> |
295 | <!-- CARGANDO ITEM --> | 302 | <!-- CARGANDO ITEM --> |
296 | <tr ng-show="!cargando" class="d-flex"> | 303 | <tr ng-show="!cargando" class="d-flex"> |
297 | <td | 304 | <td |
298 | class="align-middle p-1" | 305 | class="align-middle p-1" |
299 | ng-bind="remito.articulosRemito.length + 1" | 306 | ng-bind="remito.articulosRemito.length + 1" |
300 | ></td> | 307 | ></td> |
301 | <td class="col p-0"> | 308 | <td class="col p-0"> |
302 | <div class="d-flex"> | 309 | <div class="d-flex"> |
303 | <div class="col-4 px-1"> | 310 | <div class="col-4 px-1"> |
304 | <span | 311 | <span |
305 | ng-bind="articuloACargar.sectorCodigo" | 312 | ng-bind="articuloACargar.sectorCodigo" |
306 | ></span> | 313 | ></span> |
307 | </div> | 314 | </div> |
308 | <div class="col-8 px-1"> | 315 | <div class="col-8 px-1"> |
309 | <span ng-bind="articuloACargar.descripcion"></span> | 316 | <span ng-bind="articuloACargar.descripcion"></span> |
310 | </div> | 317 | </div> |
311 | </div> | 318 | </div> |
312 | <div class="d-flex"> | 319 | <div class="d-flex"> |
313 | <div class="col-3 px-1 m-1"> | 320 | <div class="col-3 px-1 m-1"> |
314 | <input | 321 | <input |
315 | class="form-control p-1" | 322 | class="form-control p-1" |
316 | foca-tipo-input | 323 | foca-tipo-input |
317 | min="1" | 324 | min="1" |
318 | ng-model="articuloACargar.cantidad" | 325 | ng-model="articuloACargar.cantidad" |
319 | foca-focus="!cargando" | 326 | foca-focus="!cargando" |
320 | ng-keypress="agregarATabla($event.keyCode)" | 327 | ng-keypress="agregarATabla($event.keyCode)" |
321 | style="height: auto; line-height: 1.1em" | 328 | style="height: auto; line-height: 1.1em" |
322 | > | 329 | > |
323 | </div> | 330 | </div> |
324 | <div class="col px-1 text-right"> | 331 | <div class="col px-1 text-right"> |
325 | <span ng-bind="articuloACargar.precio | currency: remito.moneda.SIMBOLO : 4"></span> | 332 | <span ng-bind="articuloACargar.precio | currency: remito.moneda.SIMBOLO : 4"></span> |
326 | </div> | 333 | </div> |
327 | <div class="col px-1 text-right"> | 334 | <div class="col px-1 text-right"> |
328 | <span | 335 | <span |
329 | ng-bind="getSubTotal() | currency: remito.moneda.SIMBOLO" | 336 | ng-bind="getSubTotal() | currency: remito.moneda.SIMBOLO" |
330 | > | 337 | > |
331 | </span> | 338 | </span> |
332 | </div> | 339 | </div> |
333 | </div> | 340 | </div> |
334 | </td> | 341 | </td> |
335 | <td class="text-center align-middle"> | 342 | <td class="text-center align-middle"> |
336 | <button | 343 | <button |
337 | class="btn btn-outline-light" | 344 | class="btn btn-outline-light" |
338 | ng-click="agregarATabla(13)" | 345 | ng-click="agregarATabla(13)" |
339 | > | 346 | > |
340 | <i class="fa fa-save"></i> | 347 | <i class="fa fa-save"></i> |
341 | </button> | 348 | </button> |
342 | </td> | 349 | </td> |
343 | </tr> | 350 | </tr> |
344 | <!-- TOOGLE EXPANDIR --> | 351 | <!-- TOOGLE EXPANDIR --> |
345 | <tr> | 352 | <tr> |
346 | <td class="col"> | 353 | <td class="col"> |
347 | <button | 354 | <button |
348 | class="btn btn-outline-light selectable w-100" | 355 | class="btn btn-outline-light selectable w-100" |
349 | ng-click="show = !show; masMenos()" | 356 | ng-click="show = !show; masMenos()" |
350 | ng-show="remito.articulosRemito.length > 0" | 357 | ng-show="remito.articulosRemito.length > 0" |
351 | > | 358 | > |
352 | <i | 359 | <i |
353 | class="fa fa-chevron-down" | 360 | class="fa fa-chevron-down" |
354 | ng-hide="show" | 361 | ng-hide="show" |
355 | aria-hidden="true" | 362 | aria-hidden="true" |
356 | > | 363 | > |
357 | </i> | 364 | </i> |
358 | <i | 365 | <i |
359 | class="fa fa-chevron-up" | 366 | class="fa fa-chevron-up" |
360 | ng-show="show" | 367 | ng-show="show" |
361 | aria-hidden="true"> | 368 | aria-hidden="true"> |
362 | </i> | 369 | </i> |
363 | </button> | 370 | </button> |
364 | </td> | 371 | </td> |
365 | </tr> | 372 | </tr> |
366 | <!-- FOOTER --> | 373 | <!-- FOOTER --> |
367 | <tr class="d-flex"> | 374 | <tr class="d-flex"> |
368 | <td class="align-middle no-border-top" colspan="2"> | 375 | <td class="align-middle no-border-top" colspan="2"> |
369 | <strong>Cantidad Items:</strong> | 376 | <strong>Cantidad Items:</strong> |
370 | <a ng-bind="remito.articulosRemito.length"></a> | 377 | <a ng-bind="remito.articulosRemito.length"></a> |
371 | </td> | 378 | </td> |
372 | <td class="text-right ml-auto table-celda-total no-border-top"> | 379 | <td class="text-right ml-auto table-celda-total no-border-top"> |
373 | <h3>Total:</h3> | 380 | <h3>Total:</h3> |
374 | </td> | 381 | </td> |
375 | <td class="table-celda-total text-right no-border-top"> | 382 | <td class="table-celda-total text-right no-border-top"> |
376 | <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> | 383 | <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> |
377 | </td> | 384 | </td> |
378 | </tr> | 385 | </tr> |
379 | </tfoot> | 386 | </tfoot> |
380 | </table> | 387 | </table> |
381 | </div> | 388 | </div> |
382 | </div> | 389 | </div> |
383 | </div> | 390 | </div> |
384 | </div> | 391 | </div> |
385 | <div class="row d-md-none fixed-bottom"> | 392 | <div class="row d-md-none fixed-bottom"> |
386 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> | 393 | <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> |
387 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> | 394 | <span class="ml-3 text-muted" ng-click="salir()">Salir</span> |
388 | <span | 395 | <span |
389 | class="mr-3 ml-auto" | 396 | class="mr-3 ml-auto" |
390 | ng-class="saveLoading ? 'text-muted' : ''" | 397 | ng-class="saveLoading ? 'text-muted' : ''" |
391 | ng-click="crearRemito()" | 398 | ng-click="crearRemito()" |
392 | ladda="saveLoading" | 399 | ladda="saveLoading" |
393 | data-style="expand-left" | 400 | data-style="expand-left" |
394 | >Guardar</span> | 401 | >Guardar</span> |
395 | </div> | 402 | </div> |
396 | </div> | 403 | </div> |
397 | </div> | 404 | </div> |
398 | 405 |
test.html
File was created | 1 | <html> | |
2 | <head> | ||
3 | <link rel="stylesheet" type="text/css" href="node_modules/jasmine-core/lib/jasmine-core/jasmine.css"> | ||
4 | <meta charset="UTF-8" /> | ||
5 | </head> | ||
6 | <body> | ||
7 | <script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script> | ||
8 | <script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script> | ||
9 | <script type="text/javascript" src="node_modules/jasmine-core/lib/jasmine-core/boot.js"></script> | ||
10 | <script type="text/javascript" src="node_modules/angular/angular.min.js"></script> | ||
11 | <script type="text/javascript" src="node_modules/angular-route/angular-route.min.js"></script> | ||
12 | <script type="text/javascript" src="node_modules/angular-mocks/angular-mocks.js"></script> | ||
13 | <script type="text/javascript" src="src/js/app.js"></script> | ||
14 | <script type="text/javascript" src="src/js/controller.js"></script> | ||
15 | <script type="text/javascript" src="src/js/service.js"></script> | ||
16 | <script type="text/javascript" src="src/js/route.js"></script> | ||
17 | |||
18 | <script type="text/javascript" src="spec/controllerSpec.js"></script> | ||
19 | <script type="text/javascript" src="spec/serviceSpec.js"></script> | ||
20 | <script type="text/javascript" src="spec/routeSpec.js"></script> | ||
21 | </body> | ||
22 | </html> | ||
23 |