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 routes from './configroutes';
import * as run from './run';
import * as configNgTranslate from './translate';
import * as components from './components';
import title from './styles/title.css'

View File

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

View File

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

View File

@ -3,4 +3,4 @@ import * as core from 'core';
import {NAME as CORE} from 'core';
export const NAME = 'salix';
export const module = vendors.ng.module(NAME,[CORE]);
export const module = vendors.ng.module(NAME, [CORE]);

View File

@ -1,10 +1,9 @@
import {ng} from 'vendor';
import {module} from './module';
export const run = function($rootScope){
export const run = function($rootScope) {
$rootScope.$on('$viewContentLoaded',()=>{
componentHandler.upgradeAllRegistered();
})
}
run.$inject=['$rootScope'];
run.$inject = ['$rootScope'];
module.run(run);

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]*
</button>

View File

@ -1,4 +1,4 @@
<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]*>
<span class="mdl-checkbox__label">*[label]*</span>
<span class="mdl-checkbox__label" translate>*[label]*</span>
</label>

View File

@ -1,5 +1,5 @@
<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>
<label class="mdl-textfield__label">*[label]*</label>
<label class="mdl-textfield__label" translate>*[label]*</label>
</div>

View File

@ -1,4 +1,4 @@
<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]*>
<label class="mdl-textfield__label">*[label]*</label>
<label class="mdl-textfield__label" translate>*[label]*</label>
</div>

View File

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

View File

@ -4,5 +4,3 @@ import {getModuleName,getVendorDependencies} from './util';
const DEPENDENCIES = getVendorDependencies(vendors)
export const NAME = getModuleName('core');
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">
<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>

View File

@ -1,2 +1,2 @@
<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');
return $http
({
return $http({
method: 'GET',
url: routesCdn
})
});
}
$get.$inject = ["$http"];
@ -25,4 +25,3 @@ export class RoutesLoader{ constructor () {} }
RoutesLoader.prototype.$get = $get;
var routes = new RoutesLoader ();
_module.provider (NAME, () => routes)

View File

@ -4,7 +4,7 @@ export const NAME = 'vnRule';
export function directive() {
return {
restrict: 'A',
link: function (attrs, element){
link: function (attrs, element) {
}
};
}

View File

@ -5,14 +5,14 @@ import * as util from '../util';
const _NAME = 'spinner';
export const NAME = util.getName(_NAME);
directive.$inject =[resolveFactory.NAME];
directive.$inject = [resolveFactory.NAME];
export function directive (resolve){
return{
require:'E',
template: function(_,attr){
return resolve.getTemplate(_NAME, attr);
restrict: 'E',
template: function(_, attrs){
return resolve.getTemplate(_NAME, attrs);
}
}
}
_module.directive(NAME,directive);
_module.directive(NAME, directive);

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>

View File

@ -1,4 +1,4 @@
<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]*>
<label class="mdl-textfield__label">*[label]*</label>
<label class="mdl-textfield__label" translate>*[label]*</label>
</div>

View File

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

View File

@ -2,46 +2,46 @@
<form ng-submit="frm.isValid && fiscal.submit()" pad-large>
<vn-title>Datos fiscales y de facturación</vn-title>
<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="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-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-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="Pais" field="country" entity="fiscal">
<vn-combo vn-one label="País" field="country" entity="fiscal">
<option value="1">Comercial 1</option>
<option value="2">Comercial 2</option>
</vn-combo>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Telefono 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="Email" field="email" entity="fiscal"></vn-textfield>
<vn-textfield vn-one label="Teléfono Fijo" field="phone" entity="fiscal"></vn-textfield>
<vn-textfield vn-one label="Teléfono Movil" field="mobile" entity="fiscal"></vn-textfield>
<vn-textfield vn-one label="Correo electrónico" field="email" entity="fiscal"></vn-textfield>
</vn-horizontal>
<hr class="border-dashed-top"/>
<h5 vn-one style="margin-top: 0;">Información de facturación</h5>
<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-check vn-three label="Recargo de equivalencia" field="er" entity="fiscal"></vn-check>
</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="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>
<hr class="border-dashed-top"/>
<h5 style="margin-top: 0;">Documentación</h5>
<vn-horizontal>
<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 B2B vnl" field="sepaVnl" 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 B2B VNL" field="sepaVnl" entity="fiscal"></vn-check>
</vn-horizontal>
<vn-empty class="margin-large-top">
<vn-submit label="Guardar"></vn-submit>

View File

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

View File

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

View File

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

View File

@ -10,6 +10,7 @@
},
"dependencies": {
"angular": "^1.5.8",
"angular-translate": "^2.13.1",
"angular-ui-router": "^1.0.0-beta.3",
"express": "^4.14.0",
"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 './oclazyload-vendor';
export * from './uirouter-vendor';
export * from './angular-translate-vendor';
export * from './materialdesignlite-vendor';