Merge branch 'master' of ssh://git.verdnatura.es:/var/lib/git/salix

# Conflicts:
#	@salix/crud/src/client/basic-data/index.html
This commit is contained in:
nelo 2016-12-15 16:57:28 +01:00
commit 98dada7c8c
27 changed files with 101 additions and 93 deletions

View File

@ -3,6 +3,7 @@ import {bootstrap} from './bootstrap';
import * as spliting from './spliting'; import * as spliting from './spliting';
import * as routes from './configroutes'; import * as routes from './configroutes';
import * as run from './run'; import * as run from './run';
import * as configNgTranslate from './translate';
import * as components from './components'; import * as components from './components';
import title from './styles/title.css' import title from './styles/title.css'

View File

@ -14,5 +14,4 @@ export const bootstrap = () => {
throw new Error("element is not defined"); throw new Error("element is not defined");
} }
ng.bootstrap(_element, [SALIX]); ng.bootstrap(_element, [SALIX]);
}; };

View File

@ -2,7 +2,6 @@ import * as core from 'core';
import * as spliting from './spliting'; import * as spliting from './spliting';
import * as deps from './spliting/deps.json'; import * as deps from './spliting/deps.json';
function loader(module) { function loader(module) {
function load($ocLazyLoad, $q){ function load($ocLazyLoad, $q){
return $q((resolve) => { return $q((resolve) => {

View File

@ -1,4 +1,3 @@
import {ng} from 'vendor';
import {module} from './module'; import {module} from './module';
export const run = function($rootScope) { export const run = function($rootScope) {

View File

@ -0,0 +1,9 @@
import {module} from './module';
export const configNgTranslate = function($translateProvider) {
$translateProvider
.translations('es', {/* Traducciones */})
.preferredLanguage('es');
}
configNgTranslate.$inject = ['$translateProvider'];
module.config(configNgTranslate);

View File

@ -1,3 +1,3 @@
<button type = "*[typeName]*" class="*[className]*" *[enabled]* > <button type = "*[typeName]*" class="*[className]*" *[enabled]* translate>
*[label]* *[label]*
</button> </button>

View File

@ -1,4 +1,4 @@
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect"> <label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect">
<input type="checkbox" name="*[name]*" class="*[className]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*> <input type="checkbox" name="*[name]*" class="*[className]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*>
<span class="mdl-checkbox__label">*[label]*</span> <span class="mdl-checkbox__label" translate>*[label]*</span>
</label> </label>

View File

@ -1,5 +1,5 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<select class="mdl-textfield__input" class="*[className]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* ng-transclude> <select class="mdl-textfield__input" class="*[className]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* ng-transclude>
</select> </select>
<label class="mdl-textfield__label">*[label]*</label> <label class="mdl-textfield__label" translate>*[label]*</label>
</div> </div>

View File

@ -1,4 +1,4 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input *[className]*" type="text" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]*> <input class="mdl-textfield__input *[className]*" type="text" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]*>
<label class="mdl-textfield__label">*[label]*</label> <label class="mdl-textfield__label" translate>*[label]*</label>
</div> </div>

View File

@ -6,8 +6,8 @@ export class InputAttrsNormalizer {
$get(){ $get(){
return { return {
normalize: function(attrs) { normalize: function(attrs) {
/* // FIXME: No siempre se pasan estos atributos, ej: searchbar
if (!attrs.entity) /* if (!attrs.entity)
throw new Error(`Attribute 'entity' not defined on input`); throw new Error(`Attribute 'entity' not defined on input`);
if (!attrs.field) if (!attrs.field)
throw new Error(`Attribute 'field' not defined on input`); throw new Error(`Attribute 'field' not defined on input`);

View File

@ -4,5 +4,3 @@ import {getModuleName,getVendorDependencies} from './util';
const DEPENDENCIES = getVendorDependencies(vendors) const DEPENDENCIES = getVendorDependencies(vendors)
export const NAME = getModuleName('core'); export const NAME = getModuleName('core');
export const module = vendors.ng.module(NAME,DEPENDENCIES); export const module = vendors.ng.module(NAME,DEPENDENCIES);

View File

@ -1,4 +1,4 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="*[className]*" type="password" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*> <input class="*[className]*" type="password" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*>
<label class="mdl-textfield__label">*[label]*</label> <label class="mdl-textfield__label" translate>*[label]*</label>
</div> </div>

View File

@ -1,2 +1,2 @@
<input type="radio" class="*[className]*" name="*[name]*" ng-model="*[model]*.*[name]*" *[enabled]*> <input type="radio" class="*[className]*" name="*[name]*" ng-model="*[model]*.*[name]*" *[enabled]*>
<span class="mdl-radio__label">*[text]*</span> <span class="mdl-radio__label" translate>*[text]*</span>

View File

@ -11,11 +11,11 @@ function $get($http){
}) (); }) ();
let routesCdn = script.getAttribute ('routes-cdn'); let routesCdn = script.getAttribute ('routes-cdn');
return $http
({ return $http({
method: 'GET', method: 'GET',
url: routesCdn url: routesCdn
}) });
} }
$get.$inject = ["$http"]; $get.$inject = ["$http"];
@ -25,4 +25,3 @@ export class RoutesLoader{ constructor () {} }
RoutesLoader.prototype.$get = $get; RoutesLoader.prototype.$get = $get;
var routes = new RoutesLoader (); var routes = new RoutesLoader ();
_module.provider (NAME, () => routes) _module.provider (NAME, () => routes)

View File

@ -8,9 +8,9 @@ export const NAME = util.getName(_NAME);
directive.$inject = [resolveFactory.NAME]; directive.$inject = [resolveFactory.NAME];
export function directive (resolve){ export function directive (resolve){
return{ return{
require:'E', restrict: 'E',
template: function(_,attr){ template: function(_, attrs){
return resolve.getTemplate(_NAME, attr); return resolve.getTemplate(_NAME, attrs);
} }
} }
} }

View File

@ -1,2 +1,2 @@
<input type="submit" class="*[className]*" value="*[label]*" *[enabled]*> <input type="submit" class="*[className]*" translate-attr="{value: '*[label]*'}" value="*[label]*" *[enabled]*>
</input> </input>

View File

@ -1,4 +1,4 @@
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label"> <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="*[className]*" type="*[type]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*> <input class="*[className]*" type="*[type]*" name="*[name]*" ng-model="*[model]*" rule="*[rule]*" *[enabled]* *[focus]*>
<label class="mdl-textfield__label">*[label]*</label> <label class="mdl-textfield__label" translate>*[label]*</label>
</div> </div>

View File

@ -8,10 +8,7 @@ export const COMPONENT = {
template: template, template: template,
controllerAs: 'card', controllerAs: 'card',
controller: function($http, $stateParams) { controller: function($http, $stateParams) {
let clientRoutes = routes['src/client/routes.js'].routes;
this.items = [];
this.client = null; this.client = null;
$http.get(`/client/api/Clients/${$stateParams.id}`).then( $http.get(`/client/api/Clients/${$stateParams.id}`).then(
(json) => { (json) => {
this.client = json.data; this.client = json.data;
@ -24,7 +21,8 @@ export const COMPONENT = {
(json) => console.error (json.data.error.message) (json) => console.error (json.data.error.message)
); );
clientRoutes.forEach ((i) => { this.items = [];
routes['client'].routes.forEach ((i) => {
if (i.description) if (i.description)
this.items.push ({ this.items.push ({
description: i.description, description: i.description,

View File

@ -2,46 +2,46 @@
<form ng-submit="frm.isValid && fiscal.submit()" pad-large> <form ng-submit="frm.isValid && fiscal.submit()" pad-large>
<vn-title>Datos fiscales y de facturación</vn-title> <vn-title>Datos fiscales y de facturación</vn-title>
<vn-horizontal> <vn-horizontal>
<vn-check vn-one label="Cliente Activo" field="active" entity="fiscal"></vn-check> <vn-check vn-one label="Cliente activo" field="active" entity="fiscal"></vn-check>
<vn-check vn-one label="Facturar" field="invoice" entity="fiscal"></vn-check> <vn-check vn-one label="Facturar" field="invoice" entity="fiscal"></vn-check>
<vn-check vn-one label="Factura Impresa" field="mailInvoice" entity="fiscal"></vn-check> <vn-check vn-one label="Factura impresa" field="mailInvoice" entity="fiscal"></vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-two label="Domicilio Fiscal" field="consignee" entity="fiscal"></vn-textfield> <vn-textfield vn-two label="Domicilio fiscal" field="consignee" entity="fiscal"></vn-textfield>
<vn-textfield vn-one label="Municipio" field="city" entity="fiscal"></vn-textfield> <vn-textfield vn-one label="Municipio" field="city" entity="fiscal"></vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Codigo Postal" field="postcode" entity="fiscal"></vn-textfield> <vn-textfield vn-one label="Código postal" field="postcode" entity="fiscal"></vn-textfield>
<vn-combo vn-one label="Provincia" field="province" entity="fiscal"></vn-combo> <vn-combo vn-one label="Provincia" field="province" entity="fiscal"></vn-combo>
<vn-combo vn-one label="Pais" field="country" entity="fiscal"> <vn-combo vn-one label="País" field="country" entity="fiscal">
<option value="1">Comercial 1</option> <option value="1">Comercial 1</option>
<option value="2">Comercial 2</option> <option value="2">Comercial 2</option>
</vn-combo> </vn-combo>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Telefono Fijo" field="phone" entity="fiscal"></vn-textfield> <vn-textfield vn-one label="Teléfono Fijo" field="phone" entity="fiscal"></vn-textfield>
<vn-textfield vn-one label="Telefono Movil" field="mobile" entity="fiscal"></vn-textfield> <vn-textfield vn-one label="Teléfono Movil" field="mobile" entity="fiscal"></vn-textfield>
<vn-textfield vn-one label="Email" field="email" entity="fiscal"></vn-textfield> <vn-textfield vn-one label="Correo electrónico" field="email" entity="fiscal"></vn-textfield>
</vn-horizontal> </vn-horizontal>
<hr class="border-dashed-top"/> <hr class="border-dashed-top"/>
<h5 vn-one style="margin-top: 0;">Información de facturación</h5> <h5 vn-one style="margin-top: 0;">Información de facturación</h5>
<vn-horizontal> <vn-horizontal>
<vn-combo vn-two label="Forma de Pago" field="payMethod" entity="fiscal"></vn-combo> <vn-combo vn-two label="Forma de pago" field="payMethod" entity="fiscal"></vn-combo>
<vn-textfield vn-one label="Vencimiento" field="expiration" entity="fiscal"></vn-textfield> <vn-textfield vn-one label="Vencimiento" field="expiration" entity="fiscal"></vn-textfield>
<vn-check vn-three label="Recargo de equivalencia" field="er" entity="fiscal"></vn-check> <vn-check vn-three label="Recargo de equivalencia" field="er" entity="fiscal"></vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Credito" field="credit" entity="fiscal"></vn-textfield> <vn-textfield vn-one label="Crédito" field="credit" entity="fiscal"></vn-textfield>
<vn-textfield vn-one label="CyC" field="cyc" entity="fiscal"></vn-textfield> <vn-textfield vn-one label="CyC" field="cyc" entity="fiscal"></vn-textfield>
<vn-textfield vn-one label="IAE" field="iae" entity="fiscal"></vn-textfield> <vn-textfield vn-one label="IAE" field="iae" entity="fiscal"></vn-textfield>
<vn-textfield vn-three label="iban" field="iban" entity="fiscal"></vn-textfield> <vn-textfield vn-three label="IBAN" field="iban" entity="fiscal"></vn-textfield>
</vn-horizontal> </vn-horizontal>
<hr class="border-dashed-top"/> <hr class="border-dashed-top"/>
<h5 style="margin-top: 0;">Documentación</h5> <h5 style="margin-top: 0;">Documentación</h5>
<vn-horizontal> <vn-horizontal>
<vn-check vn-two label="Recibido core vnh" field="coreVnh" entity="fiscal"></vn-check> <vn-check vn-two label="Recibido core VNH" field="coreVnh" entity="fiscal"></vn-check>
<vn-check vn-two label="Recibido core vnl" field="coreVnl" entity="fiscal"></vn-check> <vn-check vn-two label="Recibido core VNL" field="coreVnl" entity="fiscal"></vn-check>
<vn-check vn-two label="Recibido B2B vnl" field="sepaVnl" entity="fiscal"></vn-check> <vn-check vn-two label="Recibido B2B VNL" field="sepaVnl" entity="fiscal"></vn-check>
</vn-horizontal> </vn-horizontal>
<vn-empty class="margin-large-top"> <vn-empty class="margin-large-top">
<vn-submit label="Guardar"></vn-submit> <vn-submit label="Guardar"></vn-submit>

View File

@ -8,7 +8,7 @@ var babel = require('gulp-babel');
var fs = require('fs'); var fs = require('fs');
var del = require('del'); var del = require('del');
var webpack = require('webpack'); var webpack = require('webpack');
var WebpackDevServer = require("webpack-dev-server"); var WebpackDevServer = require('webpack-dev-server');
var webpackConfig = require('./webpack.config.js'); var webpackConfig = require('./webpack.config.js');
// Clean // Clean
@ -100,11 +100,18 @@ gulp.task('webpack-dev-server', ['spliting'], function() {
var routeFiles = './crud/**/routes.js'; var routeFiles = './crud/**/routes.js';
gulp.task('routes', function() { gulp.task('routes', function() {
var fileTpl = '\n"<%=file.relative%>": <%=contents%>'; var fileTpl = '\n"<%=dirname%>": <%=contents%>';
var globalTpl = 'var routes = {<%=contents%>\n}'; var globalTpl = 'var routes = {<%=contents%>\n}';
var regex = new RegExp('^src/(.*)/routes\.js$');
function cb(file) {
var relative = file.relative.replace('\\', '/');
var dirname = relative.match(regex)[1];
return {dirname: dirname};
}
return gulp.src(routeFiles) return gulp.src(routeFiles)
.pipe(wrap(fileTpl)) .pipe(wrap(fileTpl, cb))
.pipe(concat('salix.routes.js', {newLine: ','})) .pipe(concat('salix.routes.js', {newLine: ','}))
.pipe(wrap(globalTpl)) .pipe(wrap(globalTpl))
.pipe(babel({presets: ['es2015']})) .pipe(babel({presets: ['es2015']}))

View File

@ -13,5 +13,5 @@
</form> </form>
</div> </div>
</div> </div>
<vn-snackbar id="snackbar"/></vn-snackbar> <vn-snackbar id="snackbar"></vn-snackbar>
</div> </div>

View File

@ -5,15 +5,12 @@ import style from './login.scss'
export const COMPONENT = export const COMPONENT =
{ {
template: template, template: template,
controller: function ($http) controller: function($http) {
{
var self = this; var self = this;
this.submit = function () this.submit = function() {
{
var model = this.model; var model = this.model;
if (model && model.email && model.password) if(model && model.email && model.password) {
{
setLoading(true); setLoading(true);
model.appId = window.location.href; model.appId = window.location.href;
$http.post('/account', this.model).then ( $http.post('/account', this.model).then (
@ -25,22 +22,18 @@ export const COMPONENT =
showMessage('Please insert your email and password'); showMessage('Please insert your email and password');
}; };
function onLoginOk (response) function onLoginOk (response) {
{
setLoading(false); setLoading(false);
//sessionStorage.setItem ('token', response.data.accessToken);
window.location = response.data.location +'?access_token='+ response.data.accessToken; window.location = response.data.location +'?access_token='+ response.data.accessToken;
} }
function onLoginErr (response) function onLoginErr(response) {
{
setLoading(false); setLoading(false);
self.model.password = ''; self.model.password = '';
var message; var message;
switch (response.status) switch(response.status) {
{
case 401: case 401:
message = 'Invalid credentials'; message = 'Invalid credentials';
break; break;
@ -54,23 +47,22 @@ export const COMPONENT =
showMessage(message); showMessage(message);
} }
function $ (id) function $(id) {
{
return document.getElementById(id); return document.getElementById(id);
} }
function setLoading (isLoading) function setLoading(isLoading) {
{ // FIXME: Al minimificar MaterialSpinner es undefined
var spinner = $('spinner').firstChild.MaterialSpinner; /* var spinner = $('spinner').firstChild.MaterialSpinner;
if(isLoading) if(isLoading)
spinner.start(); spinner.start();
else else
spinner.stop(); spinner.stop();
} */ }
function showMessage (message) function showMessage(message) {
{ // FIXME: Al minimificar no muestra la barra
var snackbar = $('snackbar').firstChild.MaterialSnackbar; var snackbar = $('snackbar').firstChild.MaterialSnackbar;
snackbar.showSnackbar({message: message}); snackbar.showSnackbar({message: message});
} }

View File

@ -10,6 +10,7 @@
}, },
"dependencies": { "dependencies": {
"angular": "^1.5.8", "angular": "^1.5.8",
"angular-translate": "^2.13.1",
"angular-ui-router": "^1.0.0-beta.3", "angular-ui-router": "^1.0.0-beta.3",
"express": "^4.14.0", "express": "^4.14.0",
"material-design-lite": "^1.2.1", "material-design-lite": "^1.2.1",

View File

@ -0,0 +1,5 @@
import * as _ngTranslate from 'angular-translate';
export const ngTranslate = {
name: 'pascalprecht.translate'
};

View File

@ -1,4 +1,5 @@
export * from './angular-vendor'; export * from './angular-vendor';
export * from './oclazyload-vendor'; export * from './oclazyload-vendor';
export * from './uirouter-vendor'; export * from './uirouter-vendor';
export * from './angular-translate-vendor';
export * from './materialdesignlite-vendor'; export * from './materialdesignlite-vendor';