Commit 5fbdcf18976c04f6eb24112bf6aa4b2a0992b801

Authored by Nicolás Guarnieri
1 parent e5dd5c1f9e
Exists in master

fix buildeo

1 const templateCache = require('gulp-angular-templatecache'); 1 const templateCache = require('gulp-angular-templatecache');
2 const concat = require('gulp-concat'); 2 const concat = require('gulp-concat');
3 const htmlmin = require('gulp-htmlmin'); 3 const htmlmin = require('gulp-htmlmin');
4 const rename = require('gulp-rename'); 4 const rename = require('gulp-rename');
5 const uglify = require('gulp-uglify-es').default; 5 const uglify = require('gulp-uglify-es').default;
6 const gulp = require('gulp'); 6 const gulp = require('gulp');
7 const pump = require('pump'); 7 const pump = require('pump');
8 const jshint = require('gulp-jshint'); 8 const jshint = require('gulp-jshint');
9 const replace = require('gulp-replace');
10 const connect = require('gulp-connect');
9 11
10 var paths = { 12 var paths = {
11 srcJS: 'src/js/*.js', 13 srcJS: 'src/js/*.js',
12 srcViews: 'src/views/*.html', 14 srcViews: 'src/views/*.html',
13 tmp: 'tmp', 15 tmp: 'tmp',
14 dist: 'dist/' 16 dist: 'dist/'
15 }; 17 };
16 18
17 gulp.task('templates', function() { 19 gulp.task('templates', function() {
18 pump( 20 pump(
19 [ 21 [
20 gulp.src(paths.srcViews), 22 gulp.src(paths.srcViews),
21 htmlmin(), 23 htmlmin(),
22 templateCache('views.js', { 24 templateCache('views.js', {
23 module: 'focaBusquedaCliente', 25 module: 'focaBusquedaCliente',
24 root: '' 26 root: ''
25 }), 27 }),
26 gulp.dest(paths.tmp) 28 gulp.dest(paths.tmp)
27 ] 29 ]
28 ); 30 );
29 }); 31 });
30 32
31 gulp.task('uglify', ['templates'], function() { 33 gulp.task('uglify', ['templates'], function() {
32 pump( 34 pump(
33 [ 35 [
34 gulp.src([ 36 gulp.src([
35 paths.srcJS, 37 paths.srcJS,
36 'tmp/views.js' 38 'tmp/views.js'
37 ]), 39 ]),
38 concat('foca-busqueda-cliente.js'), 40 concat('foca-busqueda-cliente.js'),
41 replace("src/views/", ''),
39 gulp.dest(paths.tmp), 42 gulp.dest(paths.tmp),
40 rename('foca-busqueda-cliente.min.js'), 43 rename('foca-busqueda-cliente.min.js'),
41 uglify(), 44 uglify(),
42 gulp.dest(paths.dist) 45 gulp.dest(paths.dist)
43 ] 46 ]
44 ); 47 );
45 }); 48 });
46 49
47 gulp.task('pre-commit', function() { 50 gulp.task('pre-commit', function() {
48 pump( 51 pump(
49 [ 52 [
50 gulp.src(paths.srcJS), 53 gulp.src(paths.srcJS),
51 jshint('.jshintrc'), 54 jshint('.jshintrc'),
52 jshint.reporter('default'), 55 jshint.reporter('default'),
53 jshint.reporter('fail') 56 jshint.reporter('fail')
54 ] 57 ]
55 ); 58 );
56 }); 59 });
60
61
62 gulp.task('webserver', function() {
63 pump [
64 connect.server({port: 3000})
65 ]
66 });
67
68 gulp.task('default', ['webserver']);
57 69
1 <html ng-app="focaBusquedaCliente"> 1 <html ng-app="focaBusquedaCliente">
2 2
3 <head> 3 <head>
4 <meta charset="UTF-8" /> 4 <meta charset="UTF-8" />
5 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> 5 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6 6
7 <!--CSS--> 7 <!--CSS-->
8 <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" /> 8 <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
9 <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> 9 <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
10 10
11 <!--VENDOR JS--> 11 <!--VENDOR JS-->
12 <script src="node_modules/jquery/dist/jquery.min.js"></script> 12 <script src="node_modules/jquery/dist/jquery.min.js"></script>
13 <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> 13 <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
14 <script src="node_modules/angular/angular.min.js"></script> 14 <script src="node_modules/angular/angular.min.js"></script>
15 <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> 15 <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script>
16 16
17 <!-- BUILD --> 17 <!-- BUILD -->
18 <script src="src/js/app.js"></script> 18 <script src="src/js/app.js"></script>
19 <script src="src/js/controller.js"></script> 19 <script src="src/js/controller.js"></script>
20 <script src="src/js/service.js"></script> 20 <script src="src/js/service.js"></script>
21 21
22 <script src="src/etc/develop.js"></script>
22 <!-- /BUILD --> 23 <!-- /BUILD -->
23 24
24 <!-- CONFIG PARA DEVELOP --> 25 <!-- CONFIG PARA DEVELOP -->
25 <script type="text/javascript"> 26 <script type="text/javascript">
26 angular.module('focaBusquedaCliente') 27 angular.module('focaBusquedaCliente')
27 .controller('controller', ['$uibModal', function ($uibModal) { 28 .controller('controller', ['$uibModal', function ($uibModal) {
28 var modalInstance = $uibModal.open( 29 var modalInstance = $uibModal.open(
29 { 30 {
30 ariaLabelledBy: 'Busqueda de Cliete', 31 ariaLabelledBy: 'Busqueda de Cliete',
31 templateUrl: 'src/views/foca-busqueda-cliente-modal', 32 templateUrl: 'src/views/foca-busqueda-cliente-modal.html',
32 controller: 'focaBusquedaClienteModalController', 33 controller: 'focaBusquedaClienteModalController',
33 size: 'lg' 34 size: 'lg'
34 } 35 }
35 ); 36 );
36 }]); 37 }]);
37 </script> 38 </script>
38 </head> 39 </head>
39 40
40 <body ng-controller="controller"> 41 <body ng-controller="controller">
41 <style> 42 <style>
42 .p-5 { 43 .p-5 {
43 padding: 5px !important; 44 padding: 5px !important;
44 } 45 }
45 </style> 46 </style>
46 </body> 47 </body>
47 48
48 </html> 49 </html>
1 { 1 {
2 "name": "foca-busqueda-cliente", 2 "name": "foca-busqueda-cliente",
3 "version": "1.0.0", 3 "version": "1.0.0",
4 "description": "Búsqueda de clientes", 4 "description": "Búsqueda de clientes",
5 "main": "dist/foca-abm-sectores.js", 5 "main": "dist/foca-abm-sectores.js",
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1", 7 "test": "echo \"Error: no test specified\" && exit 1",
8 "compile": "gulp uglify", 8 "compile": "gulp uglify",
9 "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js" 9 "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js"
10 }, 10 },
11 "repository": { 11 "repository": {
12 "type": "git", 12 "type": "git",
13 "url": "https://192.168.0.11/modulos-npm/foca-busqueda-cliente.git" 13 "url": "https://192.168.0.11/modulos-npm/foca-busqueda-cliente.git"
14 }, 14 },
15 "author": "Foca Software", 15 "author": "Foca Software",
16 "license": "ISC", 16 "license": "ISC",
17 "peerDependencies": { 17 "peerDependencies": {
18 "angular": "^1.7.x", 18 "angular": "^1.7.x",
19 "bootstrap": "^4.1.x", 19 "bootstrap": "^4.1.x",
20 "jquery": "^3.3.x", 20 "jquery": "^3.3.x",
21 "font-awesome": "^4.7.x", 21 "font-awesome": "^4.7.x",
22 "gulp": "^3.9.x", 22 "gulp": "^3.9.x",
23 "gulp-concat": "2.6.x", 23 "gulp-concat": "2.6.x",
24 "gulp-jshint": "^2.1.x", 24 "gulp-jshint": "^2.1.x",
25 "gulp-rename": "^1.4.x", 25 "gulp-rename": "^1.4.x",
26 "gulp-replace": "^1.0.x", 26 "gulp-replace": "^1.0.x",
27 "gulp-uglify-es": "^1.0.x", 27 "gulp-uglify-es": "^1.0.x",
28 "jshint": "^2.9.x", 28 "jshint": "^2.9.x",
29 "pump": "^3.0.x" 29 "pump": "^3.0.x"
30 }, 30 },
31 "devDependencies": { 31 "devDependencies": {
32 "gulp-connect": "^5.6.1", 32 "gulp-connect": "^5.6.1",
33 "jasmine-core": "3.2.1", 33 "jasmine-core": "3.2.1",
34 "pre-commit": "^1.2.2" 34 "pre-commit": "^1.2.2",
35 },
36 "dependencies": {
37 "angular": "1.7.4", 35 "angular": "1.7.4",
38 "angular-ui-bootstrap": "2.5.6", 36 "angular-ui-bootstrap": "2.5.6",
39 "bootstrap": "4.1.3", 37 "bootstrap": "4.1.3",
40 "font-awesome": "4.7.0", 38 "font-awesome": "4.7.0",
41 "gulp": "^3.9.1", 39 "gulp": "^3.9.1",
42 "gulp-angular-templatecache": "2.2.1", 40 "gulp-angular-templatecache": "2.2.1",
43 "gulp-concat": "2.6.1", 41 "gulp-concat": "2.6.1",
44 "gulp-htmlmin": "5.0.1", 42 "gulp-htmlmin": "5.0.1",
45 "gulp-jshint": "2.1.0", 43 "gulp-jshint": "2.1.0",
46 "gulp-rename": "1.4.0", 44 "gulp-rename": "1.4.0",
47 "gulp-replace": "1.0.0", 45 "gulp-replace": "1.0.0",
48 "gulp-uglify-es": "1.0.4", 46 "gulp-uglify-es": "1.0.4",
49 "jquery": "3.3.1", 47 "jquery": "3.3.1",
50 "jshint": "2.9.6", 48 "jshint": "2.9.6",
51 "pump": "3.0.0" 49 "pump": "3.0.0",
50 "ui-bootstrap4": "^3.0.5"
52 } 51 }
53 } 52 }
File was created 1 angular.module('focaBusquedaCliente')
2 .constant("API_ENDPOINT", {
3 'URL': '//192.168.0.23:9900'
4 });
5
src/etc/develop.js.ejemplo
File was created 1 angular.module('focaBusquedaCliente')
2 .constant("API_ENDPOINT", {
3 'URL': '//127.0.0.1:9000'
4 });
5
1 angular.module('focaBusquedaCliente') 1 angular.module('focaBusquedaCliente')
2 .component('focaBusquedaCliente', { 2 .component('focaBusquedaCliente', {
3 templateUrl: 'foca-busqueda-cliente.html', 3 templateUrl: 'src/views/foca-busqueda-cliente.html',
4 controller: 'focaBusquedaClienteController' 4 controller: 'focaBusquedaClienteController'
5 }); 5 });
6 6
src/js/controller.js
1 angular.module('focaBusquedaCliente') 1 angular.module('focaBusquedaCliente')
2 .controller('focaBusquedaClienteController', [ 2 .controller('focaBusquedaClienteController', [
3 '$scope', 3 '$scope',
4 '$uibModal', 4 '$uibModal',
5 function($scope, $uibModal) { 5 function($scope, $uibModal) {
6 $scope.abrirModal = function() { 6 $scope.abrirModal = function() {
7 $uibModal.open({ 7 $uibModal.open({
8 animation: false, 8 animation: false,
9 templateUrl: 'foca-busqueda-cliente-modal.html', 9 templateUrl: 'src/views/foca-busqueda-cliente-modal.html',
10 backdrop: false, 10 backdrop: false,
11 controller: 'focaBusquedaClienteModalController' 11 controller: 'focaBusquedaClienteModalController'
12 }).result.then(function(cliente){ 12 }).result.then(function(cliente){
13 console.log(cliente); 13 console.log(cliente);
14 }); 14 });
15 }; 15 };
16 } 16 }
17 ]) 17 ])
18 .controller('focaBusquedaClienteModalController', [ 18 .controller('focaBusquedaClienteModalController', [
19 '$uibModalInstance', 19 '$uibModalInstance',
20 'focaBusquedaClienteService', 20 'focaBusquedaClienteService',
21 '$scope', 21 '$scope',
22 function($uibModalInstance, focaBusquedaClienteService, $scope) { 22 function($uibModalInstance, focaBusquedaClienteService, $scope) {
23 $scope.obtenerClientesPorNombreOCuit = function(textoBusqueda) { 23 $scope.obtenerClientesPorNombreOCuit = function(textoBusqueda) {
24 return focaBusquedaClienteService 24 return focaBusquedaClienteService
25 .obtenerClientesPorNombreOCuit(textoBusqueda) 25 .obtenerClientesPorNombreOCuit(textoBusqueda)
26 .then(function(datos) { 26 .then(function(datos) {
27 return datos.data; 27 return datos.data;
28 }); 28 });
29 }; 29 };
30 $scope.seleccionar = function(cliente) { 30 $scope.seleccionar = function(cliente) {
31 $scope.cliente = cliente; 31 $scope.cliente = cliente;
32 }; 32 };
33 $scope.cancelar = function() { 33 $scope.cancelar = function() {
34 $uibModalInstance.dismiss(); 34 $uibModalInstance.dismiss();
35 }; 35 };
36 $scope.aceptar = function() { 36 $scope.aceptar = function() {
37 $uibModalInstance.close($scope.cliente); 37 $uibModalInstance.close($scope.cliente);
38 }; 38 };
39 } 39 }
40 ]); 40 ]);
41 41