diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e9fd069 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/node_modules +/dist +/tmp +package-lock\.json +src/etc/develop.js diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..d8cbb07 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,64 @@ +{ + /* + * ENVIRONMENTS + * ================= + */ + + // Define globals exposed by modern browsers. + "browser": true, + + // Define globals exposed by jQuery. + "jquery": true, + + // Define globals exposed by Node.js. + "node": true, + + // Allow ES6. + "esversion": 6, + + /* + * ENFORCING OPTIONS + * ================= + */ + + // Force all variable names to use either camelCase style or UPPER_CASE + // with underscores. + "camelcase": true, + + // Prohibit use of == and != in favor of === and !==. + "eqeqeq": true, + + // Enforce tab width of 2 spaces. + "indent": 4, + + // Prohibit use of a variable before it is defined. + "latedef": false, + + // Enforce line length to 100 characters + "maxlen": 100, + + // Require capitalized names for constructor functions. + "newcap": true, + + // Enforce use of single quotation marks for strings. + "quotmark": "single", + + // Enforce placing 'use strict' at the top function scope + "strict": false, + + // Prohibit use of explicitly undeclared variables. + "undef": true, + + // Warn when variables are defined but never used. + "unused": true, + + // Para que funcione en angular + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], + /* + * RELAXING OPTIONS + * ================= + */ + + // Suppress warnings about == null comparisons. + "eqnull": true +} diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..c38f848 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,102 @@ +const templateCache = require('gulp-angular-templatecache'); +const concat = require('gulp-concat'); +const htmlmin = require('gulp-htmlmin'); +const rename = require('gulp-rename'); +const uglify = require('gulp-uglify-es').default; +const gulp = require('gulp'); +const pump = require('pump'); +const jshint = require('gulp-jshint'); +const replace = require('gulp-replace'); +const connect = require('gulp-connect'); +const clean = require('gulp-clean'); +const header = require('gulp-header'); +const footer =require('gulp-footer'); + +var paths = { + srcJS: 'src/js/*.js', + srcViews: 'src/views/*.html', + specs: 'spec/*.js', + tmp: 'tmp', + dist: 'dist/' +}; + +gulp.task('templates', function() { + return pump( + [ + gulp.src(paths.srcViews), + replace('views/', ''), + htmlmin(), + templateCache('views.js', { + module: 'focaAbmCliente', + root: '' + }), + gulp.dest(paths.tmp) + ] + ); +}); + +gulp.task('uglify', ['templates', 'uglify-spec'], function() { + return pump( + [ + gulp.src([ + paths.srcJS, + 'tmp/views.js' + ]), + concat('foca-abm-cliente.js'), + replace("src/views/", ''), + gulp.dest(paths.tmp), + rename('foca-abm-cliente.min.js'), + uglify(), + gulp.dest(paths.dist) + ] + ); +}); + +gulp.task('uglify-spec', function() { + return pump([ + gulp.src(paths.specs), + concat('foca-abm-cliente.spec.js'), + replace("src/views/", ''), + header("describe('Módulo foca-abm-cliente', function() { \n"), + footer("});"), + gulp.dest(paths.dist) + ]); +}); + +gulp.task('clean', function() { + return gulp.src(['tmp', 'dist'], {read: false}) + .pipe(clean()); +}); + +gulp.task('pre-commit', function() { + pump( + [ + gulp.src([paths.srcJS, paths.specs]), + jshint('.jshintrc'), + jshint.reporter('default'), + jshint.reporter('fail') + ] + ); + + gulp.start('uglify'); +}); + +gulp.task('clean-post-install', function() { + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', + 'index.html', 'spec', 'test.html'], {read: false}) + .pipe(clean()); +}); + +gulp.task('compile', ['templates', 'uglify']); + +gulp.task('watch', function() { + gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); +}); + +gulp.task('webserver', function() { + pump [ + connect.server({port: 3000}) + ] +}); + +gulp.task('default', ['webserver']); diff --git a/package.json b/package.json new file mode 100644 index 0000000..fe90fa7 --- /dev/null +++ b/package.json @@ -0,0 +1,63 @@ +{ + "name": "foca-abm-cliente", + "version": "0.0.1", + "description": "Abm de cliente", + "main": "index.html", + "scripts": { + "test": "test.html", + "compile": "gulp uglify", + "gulp-pre-commit": "gulp pre-commit", + "postinstall": "npm run compile && gulp clean-post-install", + "install-dev": "npm install -D angular bootstrap ui-bootstrap4 font-awesome jquery gulp gulp-connect jasmine-core pre-commit gulp-angular-templatecache gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify-es gulp-uglify gulp-clean jshint pump git+http://git.focasoftware.com/npm/foca-modal.git" + }, + "pre-commit": [ + "gulp-pre-commit" + ], + "repository": { + "type": "git", + "url": "http://git.focasoftware.com/npm/foca-abm-cliente.git" + }, + "author": "Foca Software", + "license": "ISC", + "peerDependencies": { + "angular": "^1.7.x", + "angular-route": "^1.7.x", + "bootstrap": "^4.1.x", + "jquery": "^3.3.x", + "font-awesome": "^4.7.x", + "gulp": "^3.9.x", + "gulp-concat": "2.6.x", + "gulp-jshint": "^2.1.x", + "gulp-rename": "^1.4.x", + "gulp-replace": "^1.0.x", + "gulp-uglify-es": "^1.0.x", + "jshint": "^2.9.x", + "pump": "^3.0.x" + }, + "devDependencies": { + "angular": "^1.7.8", + "angular-mocks": "^1.7.8", + "angular-route": "^1.7.8", + "bootstrap": "^4.2.1", + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", + "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", + "font-awesome": "^4.7.0", + "gulp": "^3.9.1", + "gulp-angular-templatecache": "^2.2.7", + "gulp-clean": "^0.4.0", + "gulp-connect": "^5.7.0", + "gulp-header": "^2.0.7", + "gulp-htmlmin": "^5.0.1", + "gulp-jshint": "^2.1.0", + "gulp-rename": "^1.4.0", + "gulp-replace": "^1.0.0", + "gulp-uglify": "^3.0.1", + "gulp-uglify-es": "^1.0.4", + "jasmine-core": "^3.4.0", + "jquery": "^3.4.1", + "jshint": "^2.10.2", + "pre-commit": "^1.2.2", + "pump": "^3.0.0", + "ui-bootstrap4": "^3.0.6" + } +} diff --git a/src/etc/develop.js.ejemplo b/src/etc/develop.js.ejemplo new file mode 100644 index 0000000..fe76285 --- /dev/null +++ b/src/etc/develop.js.ejemplo @@ -0,0 +1,4 @@ +angular.module('focaAbmCliente') + .constant("API_ENDPOINT", { + 'URL': '//127.0.0.1:9000' + }); diff --git a/src/js/app.js b/src/js/app.js new file mode 100644 index 0000000..f8c5edb --- /dev/null +++ b/src/js/app.js @@ -0,0 +1 @@ +angular.module('focaAbmCliente', ['ngRoute']); diff --git a/src/js/controller.js b/src/js/controller.js new file mode 100644 index 0000000..dac7a26 --- /dev/null +++ b/src/js/controller.js @@ -0,0 +1,18 @@ +angular.module('focaAbmCliente') + .controller('focaAbmClienteController', [ + '$scope', 'focaAbmClienteService', '$location', '$uibModal', + 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$localStorage', + '$routeParams', '$filter', + function($scope, focaAbmClienteService, $location, $uibModal, focaModalService, + focaBotoneraLateralService, $timeout, $localStorage, $routeParams, $filter) { + + //SETEO BOTONERA LATERAL + $timeout(function() { + focaBotoneraLateralService.showSalir(false); + focaBotoneraLateralService.showPausar(false); + focaBotoneraLateralService.showCancelar(false); + focaBotoneraLateralService.showGuardar(true); + }); + + } + ]); diff --git a/src/js/route.js b/src/js/route.js new file mode 100644 index 0000000..beda5c8 --- /dev/null +++ b/src/js/route.js @@ -0,0 +1,11 @@ +angular.module('focaAbmCliente') + .config([ + '$routeProvider', + function($routeProvider) { + $routeProvider.when('/cliente', { + controller: 'focaAbmClienteController', + templateUrl: 'src/views/foca-abm-cliente.html' + }); + } + ]); + \ No newline at end of file diff --git a/src/js/service.js b/src/js/service.js new file mode 100644 index 0000000..daf7b66 --- /dev/null +++ b/src/js/service.js @@ -0,0 +1,6 @@ +angular.module('focaAbmCliente') + .factory('focaAbmCliente', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { + return { + + }; + }]); diff --git a/src/views/foca-abm-cliente.html b/src/views/foca-abm-cliente.html new file mode 100644 index 0000000..5f24335 --- /dev/null +++ b/src/views/foca-abm-cliente.html @@ -0,0 +1,17 @@ +