Commit 2e1c1db0c9f667fb5e2ae3c91291c043cc2d7b17

Authored by Pablo Marco del Pont
1 parent dcfb219ac3
Exists in master

- Correcciones para que funcione el módulo.

1 1 const templateCache = require('gulp-angular-templatecache');
  2 +const clean = require('gulp-clean');
2 3 const concat = require('gulp-concat');
3 4 const htmlmin = require('gulp-htmlmin');
4 5 const rename = require('gulp-rename');
... ... @@ -16,11 +17,10 @@ var paths = {
16 17 dist: 'dist/'
17 18 };
18 19  
19   -gulp.task('templates', function() {
  20 +gulp.task('templates', ['clean'], function() {
20 21 return pump(
21 22 [
22 23 gulp.src(paths.srcViews),
23   - replace('views/', ''),
24 24 htmlmin(),
25 25 templateCache('views.js', {
26 26 module: 'focaCrearNotaPedido',
... ... @@ -39,6 +39,7 @@ gulp.task('uglify', ['templates'], function() {
39 39 'tmp/views.js'
40 40 ]),
41 41 concat('foca-crear-nota-pedido.js'),
  42 + replace('src/views/', ''),
42 43 gulp.dest(paths.tmp),
43 44 rename('foca-crear-nota-pedido.min.js'),
44 45 uglify(),
... ... @@ -47,6 +48,11 @@ gulp.task('uglify', ['templates'], function() {
47 48 );
48 49 });
49 50  
  51 +gulp.task('clean', function(){
  52 + return gulp.src(['tmp', 'dist'], {read: false})
  53 + .pipe(clean());
  54 +});
  55 +
50 56 gulp.task('pre-commit', function() {
51 57 return pump(
52 58 [
... ... @@ -66,4 +72,4 @@ gulp.task('webserver', function() {
66 72 ]
67 73 });
68 74  
69   -gulp.task('default', ['webserver']);
70 75 \ No newline at end of file
  76 +gulp.task('default', ['webserver']);
... ... @@ -5,8 +5,9 @@
5 5 "main": "index.js",
6 6 "scripts": {
7 7 "test": "echo \"Error: no test specified\" && exit 1",
8   - "compile": "gulp uglify",
9   - "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js"
  8 + "compile": "gulp uglify",
  9 + "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js",
  10 + "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es jquery jshint pump"
10 11 },
11 12 "repository": {
12 13 "type": "git",
... ... @@ -15,33 +16,33 @@
15 16 "author": "Foca Software",
16 17 "license": "ISC",
17 18 "dependencies": {
18   - "angular": "^1.7.x",
19   - "angular-route": "^1.7.4",
20   - "bootstrap": "^4.1.x",
21 19 "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas.git",
22 20 "foca-modal-busqueda-productos": "git+https://192.168.0.11/nguarnieri/foca-modal-busqueda-productos",
23 21 "foca-modal-petroleras": "git+https://192.168.0.11/modulos-npm/foca-modal-petroleras.git",
24 22 "foca-modal-vendedores": "git+https://192.168.0.11/modulos-npm/foca-modal-vendedores.git",
25   - "font-awesome": "^4.7.x",
26   - "gulp": "^3.9.x",
27   - "gulp-angular-templatecache": "^2.2.1",
28   - "gulp-clean": "^0.4.0",
29   - "gulp-concat": "2.6.x",
30   - "gulp-jshint": "^2.1.x",
31   - "gulp-rename": "^1.4.x",
32   - "gulp-replace": "^1.0.x",
33   - "gulp-uglify-es": "^1.0.x",
34   - "jquery": "^3.3.x",
35   - "jshint": "^2.9.x",
36   - "pump": "^3.0.x",
37   - "ui-bootstrap4": "^3.0.5"
  23 + "jquery": "^3.3.x"
38 24 },
39 25 "devDependencies": {
  26 + "angular": "^1.7.5",
  27 + "angular-route": "^1.7.5",
  28 + "bootstrap": "^4.1.3",
40 29 "foca-busqueda-cliente": "git+https://192.168.0.11/modulos-npm/foca-busqueda-cliente",
  30 + "font-awesome": "^4.7.0",
  31 + "gulp": "^3.9.1",
  32 + "gulp-angular-templatecache": "^2.2.2",
  33 + "gulp-clean": "^0.4.0",
  34 + "gulp-concat": "^2.6.1",
41 35 "gulp-connect": "^5.6.1",
42 36 "gulp-htmlmin": "^5.0.1",
  37 + "gulp-jshint": "^2.1.0",
  38 + "gulp-rename": "^1.4.0",
  39 + "gulp-replace": "^1.0.0",
43 40 "gulp-uglify": "^3.0.1",
44   - "jasmine-core": "3.2.1",
45   - "pre-commit": "^1.2.2"
  41 + "gulp-uglify-es": "^1.0.4",
  42 + "jasmine-core": "^3.2.1",
  43 + "jshint": "^2.9.6",
  44 + "pre-commit": "^1.2.2",
  45 + "pump": "^3.0.0",
  46 + "ui-bootstrap4": "^3.0.5"
46 47 }
47 48 }
1 1 angular.module('focaCrearNotaPedido', [
2   - 'ngRoute',
3   - 'ui.bootstrap',
4   - 'focaModalVendedores',
5   - 'focaBusquedaProductos',
6   - 'focaModalPetroleras',
7   - 'focaBusquedaCliente'
  2 + 'ngRoute',
  3 + 'ui.bootstrap',
  4 + 'focaModalVendedores',
  5 + 'focaBusquedaProductos',
  6 + 'focaModalPetroleras',
  7 + 'focaBusquedaCliente'
8 8 ]);
9   -
10 9 \ No newline at end of file
src/js/controller.js
... ... @@ -48,7 +48,11 @@ angular.module('focaCrearNotaPedido')
48 48 }
49 49 $scope.removeNewChoice = function(choice) {
50 50 if ($scope.notaPedido.domicilio.length > 1) {
51   - $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex(c => c.$$hashKey == choice.$$hashKey), 1)
  51 + $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex(
  52 + function(c) {
  53 + return c.$$hashKey == choice.$$hashKey;
  54 + }
  55 + ), 1)
52 56 }
53 57 }
54 58 $scope.crearNotaPedido = function() {
... ... @@ -180,7 +184,11 @@ angular.module('focaCrearNotaPedido')
180 184 }
181 185 $scope.getSubTotal = function(item) {
182 186 var subTotal = 0;
183   - var array = $scope.articulosTabla.filter(a => a.item <= item);
  187 + var array = $scope.articulosTabla.filter(
  188 + function(a) {
  189 + return a.item <= item;
  190 + }
  191 + );
184 192 for (var i = 0; i < array.length; i++) {
185 193 subTotal += array[i].precio * array[i].cantidad
186 194 }
... ... @@ -22,7 +22,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;)
22 22 return $http.get(route+'/articulos/nota-pedido/'+id);
23 23 },
24 24 crearArticulosParaNotaPedido: function(articuloNotaPedido) {
25   - return $http.post(route + '/articulos/nota-pedido', {articuloNotaPedido});
  25 + return $http.post(route + '/articulos/nota-pedido', {articuloNotaPedido: articuloNotaPedido});
26 26 },
27 27 getDomiciliosByIdNotaPedido: function(id) {
28 28 return $http.get(route +'/nota-pedido/'+id+'/domicilios');