Atributo field
This commit is contained in:
parent
ef0bd78fe7
commit
41fea8e944
|
@ -5,20 +5,29 @@ export class InputAttrsNormalizer {
|
||||||
$get() {
|
$get() {
|
||||||
return {
|
return {
|
||||||
normalize: function(attrs) {
|
normalize: function(attrs) {
|
||||||
// FIXME: No siempre se pasan estos atributos, ej: searchbar
|
if(attrs.field) {
|
||||||
/* if (!attrs.entity)
|
let split = attrs.field.split('.');
|
||||||
throw new Error(`Attribute 'entity' not defined on input`);
|
let len = split.length;
|
||||||
if (!attrs.field)
|
|
||||||
throw new Error(`Attribute 'field' not defined on input`);
|
if(len == 0)
|
||||||
*/
|
throw new Error (`Attribute 'field' can not be empty`);
|
||||||
|
if(len > 3)
|
||||||
|
throw new Error (`Attribute 'field' must have this syntax: [ctrl].[entity].[field]`);
|
||||||
|
|
||||||
|
let i = len - 1;
|
||||||
|
let field = split[i--];
|
||||||
|
let entity = i >= 0 ? split[i--] : 'model';
|
||||||
|
let ctrl = i >= 0 ? split[i--] : '$ctrl';
|
||||||
|
|
||||||
if (attrs.model === undefined)
|
if (attrs.model === undefined)
|
||||||
attrs.model = `${attrs.entity}.model.${attrs.field}`;
|
attrs.model = `${ctrl}.${entity}.${field}`;
|
||||||
if (attrs.rule === undefined)
|
if (attrs.rule === undefined && len >= 2)
|
||||||
attrs.rule = `${attrs.entity}.${attrs.field}`;
|
attrs.rule = `${entity}.${field}`;
|
||||||
if (attrs.label === undefined)
|
if (attrs.label === undefined && len >= 2)
|
||||||
attrs.label = `${attrs.entity}.${attrs.field}`;
|
attrs.label = `${entity}.${field}`;
|
||||||
if (attrs.name === undefined)
|
if (attrs.name === undefined)
|
||||||
attrs.name = attrs.field;
|
attrs.name = field;
|
||||||
|
}
|
||||||
|
|
||||||
if (attrs.focus !== undefined)
|
if (attrs.focus !== undefined)
|
||||||
attrs.focus = 'vn-focus';
|
attrs.focus = 'vn-focus';
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
<form ng-submit="basicData.submit()" pad-large>
|
<form ng-submit="basicData.submit()" pad-large>
|
||||||
<vn-title>Datos básicos</vn-title>
|
<vn-title>Datos básicos</vn-title>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Nombre" model="basicData.client.name" entity="basicData" name="name"></vn-textfield>
|
<vn-textfield vn-one label="Nombre" field="basicData.client.name" focus></vn-textfield>
|
||||||
<vn-textfield vn-one label="NIF/CIF" model="basicData.client.fi" entity="basicData" name="fi"></vn-textfield>
|
<vn-textfield vn-one label="NIF/CIF" field="basicData.client.fi"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield autofocus vn-one label="Razón social" model="basicData.client.socialName" entity="basicData" name="socialName"></vn-textfield>
|
<vn-textfield autofocus vn-one label="Razón social" field="basicData.client.socialName"></vn-textfield>
|
||||||
<vn-date-picker vn-one label="Fecha alta" model="basicData.client.dischargeDate" entity="basicData" name="registerDate" ></vn-date-picker>
|
<vn-date-picker vn-one label="Fecha alta" field="basicData.client.dischargeDate"></vn-date-picker>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Teléfono" model="basicData.client.telefono" entity="basicData" name="phone"></vn-textfield>
|
<vn-textfield vn-one label="Teléfono" field="basicData.client.telefono"></vn-textfield>
|
||||||
<vn-textfield vn-one label="Fax" model="basicData.client.fax" entity="basicData" name="fax"></vn-textfield>
|
<vn-textfield vn-one label="Fax" field="basicData.client.fax"></vn-textfield>
|
||||||
<vn-textfield vn-one label="Email" model="basicData.client.email" entity="basicData" name="email"></vn-textfield>
|
<vn-textfield vn-one label="Email" field="basicData.client.email"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-combo vn-one label="Comercial" model="basicData.client.salesPerson" entity="basicData" name="comercial">
|
<vn-combo vn-one label="Comercial" field="basicData.client.salesPerson">
|
||||||
<option ng-repeat="p in basicData.sales" value="{{p.id}}">{{p.name}}</ng-repeat>
|
<option ng-repeat="p in basicData.sales" value="{{p.id}}">{{p.name}}</ng-repeat>
|
||||||
</vn-combo>
|
</vn-combo>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<vn-topbar></vn-topbar>
|
<vn-topbar></vn-topbar>
|
||||||
<vn-horizontal class="full-height">
|
<vn-horizontal class="full-height">
|
||||||
<vn-empty class="bg-content" style="width: 18em">
|
<vn-empty class="bg-content" style="width: 18em">
|
||||||
<vn-descriptor descriptor = "card.descriptor"></vn-descriptor>
|
<vn-descriptor descriptor="card.descriptor"></vn-descriptor>
|
||||||
<vn-left-menu items="card.items"></vn-left-menu>
|
<vn-left-menu items="card.items"></vn-left-menu>
|
||||||
</vn-empty>
|
</vn-empty>
|
||||||
<vn-auto >
|
<vn-auto >
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<form ng-submit="create.submit()" pad-large>
|
<form ng-submit="create.submit()" pad-large>
|
||||||
<vn-title>Crear Cliente</vn-title>
|
<vn-title>Crear Cliente</vn-title>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Nombre" field="name" entity="create"></vn-textfield>
|
<vn-textfield vn-one label="Nombre" field="create.model.name"></vn-textfield>
|
||||||
<vn-textfield vn-one label="NIF/CIF" field="fi" entity="create"></vn-textfield>
|
<vn-textfield vn-one label="NIF/CIF" field="create.model.fi"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield autofocus vn-one label="Razón social" field="socialName" entity="create"></vn-textfield>
|
<vn-textfield autofocus vn-one label="Razón social" field="create.model.socialName"></vn-textfield>
|
||||||
<vn-one></vn-one>
|
<vn-one></vn-one>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
|
|
@ -2,44 +2,44 @@
|
||||||
<form ng-submit="fiscal.submit()" pad-large>
|
<form ng-submit="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" model="fiscal.client.active" rule="client.active" name="active"></vn-check>
|
<vn-check vn-one label="Cliente activo" field="fiscal.client.active"></vn-check>
|
||||||
<vn-check vn-one label="Facturar" field="hasToInvoice" entity="fiscal"></vn-check>
|
<vn-check vn-one label="Facturar" field="fiscal.client.hasToInvoice"></vn-check>
|
||||||
<vn-check vn-one label="Factura impresa" field="invoiceByEmail" entity="fiscal"></vn-check>
|
<vn-check vn-one label="Factura impresa" field="invoiceByEmail"></vn-check>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-two label="Domicilio fiscal" model="fiscal.client.street" rule="client.street" name="street"></vn-textfield>
|
<vn-textfield vn-two label="Domicilio fiscal" field="fiscal.client.street" focus></vn-textfield>
|
||||||
<vn-textfield vn-one label="Municipio" model="fiscal.client.city" rule="client.city" name="city"></vn-textfield>
|
<vn-textfield vn-one label="Municipio" field="fiscal.client.city"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Código postal" model="fiscal.client.postcode" rule="client.postcode" name="postcode"></vn-textfield>
|
<vn-textfield vn-one label="Código postal" field="fiscal.client.postcode"></vn-textfield>
|
||||||
<vn-combo vn-one label="Provincia" model="fiscal.client.province" rule="client.province" name="province"></vn-combo>
|
<vn-combo vn-one label="Provincia" field="fiscal.client.province"></vn-combo>
|
||||||
<vn-combo vn-one label="País" field="country" entity="fiscal">
|
<vn-combo vn-one label="País" field="fiscal.client.country">
|
||||||
<option value="1">Comercial 1</option>
|
<option value="1">Spain</option>
|
||||||
<option value="2">Comercial 2</option>
|
<option value="2">Holland</option>
|
||||||
</vn-combo>
|
</vn-combo>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Teléfono Fijo" model="fiscal.client.phone" rule="client.phone" name="phone"></vn-textfield>
|
<vn-textfield vn-one label="Teléfono Fijo" field="fiscal.client.phone"></vn-textfield>
|
||||||
<vn-textfield vn-one label="Teléfono Movil" model="fiscal.client.mobile" rule="client.mobile" name="mobile"></vn-textfield>
|
<vn-textfield vn-one label="Teléfono Movil" field="fiscal.client.mobile"></vn-textfield>
|
||||||
<vn-textfield vn-one label="Correo electrónico" model="fiscal.client.email" rule="client.email" name="email"></vn-textfield>
|
<vn-textfield vn-one label="Correo electrónico" field="fiscal.client.email"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-subtitle>Información de facturación</vn-subtitle>
|
<vn-subtitle>Información de facturación</vn-subtitle>
|
||||||
<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="fiscal.client.payMethod"></vn-combo>
|
||||||
<vn-textfield vn-one label="Vencimiento" model="fiscal.client.dueDay" rule="client.dueDay" name="dueDay"></vn-textfield>
|
<vn-textfield vn-one label="Vencimiento" field="fiscal.client.dueDay"></vn-textfield>
|
||||||
<vn-check vn-three label="Recargo de equivalencia" model="fiscal.client.surcharge" rule="client.surcharge" name="surcharge"></vn-check>
|
<vn-check vn-three label="Recargo de equivalencia" field="fiscal.client.surcharge"></vn-check>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Crédito" model="fiscal.client.credit" rule="client.credit" name="credit"></vn-textfield>
|
<vn-textfield vn-one label="Crédito" field="fiscal.client.credit"></vn-textfield>
|
||||||
<vn-textfield vn-one label="CyC" model="fiscal.client.cyc" rule="client.cyc" name="cyc"></vn-textfield>
|
<vn-textfield vn-one label="CyC" field="fiscal.client.cyc"></vn-textfield>
|
||||||
<vn-textfield vn-one label="IAE" model="fiscal.client.gestdoc" rule="client.gestdoc" name="gestdoc"></vn-textfield>
|
<vn-textfield vn-one label="IAE" field="fiscal.client.gestdoc"></vn-textfield>
|
||||||
<vn-textfield vn-three label="IBAN" model="fiscal.client.iban" rule="client.iban" name="iban"></vn-textfield>
|
<vn-textfield vn-three label="IBAN" field="fiscal.client.iban"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-subtitle>Documentación</vn-subtitle>
|
<vn-subtitle>Documentación</vn-subtitle>
|
||||||
<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="fiscal.client.coreVnh"></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="fiscal.client.coreVnl"></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="fiscal.client.sepaVnl"></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>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<form ng-submit="note.submit()" pad-large>
|
<form ng-submit="note.submit()" pad-large>
|
||||||
<vn-title>Notas</vn-title>
|
<vn-title>Notas</vn-title>
|
||||||
<vn-textfield label="Notas" class="padd-medium-top" field="notes" entity="note"></vn-textfield>
|
<vn-textfield label="Notas" class="padd-medium-top" field="note.model.notes"></vn-textfield>
|
||||||
<vn-submit label="Guardar"></vn-submit>
|
<vn-submit label="Guardar"></vn-submit>
|
||||||
</form>
|
</form>
|
|
@ -1,22 +1,22 @@
|
||||||
<div class="mdl-menu mdl-js-menu mdl-menu--bottom-left user-menu" pad-medium for="searchbar" style="width:600px">
|
<div class="mdl-menu mdl-js-menu mdl-menu--bottom-left user-menu" pad-medium for="searchbar" style="width:600px">
|
||||||
<form ng-submit="search.submit()" pad-large>
|
<form ng-submit="search.submit()" pad-large>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Id Cliente" field="id" entity="search"></vn-textfield>
|
<vn-textfield vn-one label="Id Cliente" field="search.model.id"></vn-textfield>
|
||||||
<vn-textfield vn-one label="NIF/CIF" field="fi" entity="search"></vn-textfield>
|
<vn-textfield vn-one label="NIF/CIF" field="search.model.fi"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Alias" field="alias" entity="search"></vn-textfield>
|
<vn-textfield vn-one label="Alias" field="search.model.alias"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-two label="Razon Social" field="name" entity="search"></vn-textfield>
|
<vn-textfield vn-two label="Razon Social" field="search.model.name"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Población" field="city" entity="search"></vn-textfield>
|
<vn-textfield vn-one label="Población" field="search.model.city"></vn-textfield>
|
||||||
<vn-textfield vn-one label="Código Postal" field="postcode" entity="search"></vn-textfield>
|
<vn-textfield vn-one label="Código Postal" field="search.model.postcode"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-textfield vn-one label="Email" field="email" entity="search"></vn-textfield>
|
<vn-textfield vn-one label="Email" field="search.model.email"></vn-textfield>
|
||||||
<vn-textfield vn-one label="Teléfono" field="phone" entity="search"></vn-textfield>
|
<vn-textfield vn-one label="Teléfono" field="search.model.phone"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-submit label="">
|
<vn-submit label="">
|
||||||
<i class="material-icons">add_shopping_cart</i>Add to shopping cart
|
<i class="material-icons">add_shopping_cart</i>Add to shopping cart
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<form ng-submit="web.submit()" pad-large>
|
<form ng-submit="web.submit()" pad-large>
|
||||||
<vn-title>Acceso Web</vn-title>
|
<vn-title>Acceso Web</vn-title>
|
||||||
<vn-check label="Acceso web activo" model="web.client.active" rule="client.active" name="active"></vn-check>
|
<vn-check label="Acceso web activo" field="web.client.active"></vn-check>
|
||||||
<vn-textfield label="Usuario" class="padd-medium-top" model="web.client.user" focus></vn-textfield>
|
<vn-textfield label="Usuario" class="padd-medium-top" field="web.client.user" focus></vn-textfield>
|
||||||
<vn-submit label="Guardar"></vn-submit>
|
<vn-submit label="Guardar"></vn-submit>
|
||||||
</form>
|
</form>
|
|
@ -3,9 +3,9 @@
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<img src="./logo.svg"/>
|
<img src="./logo.svg"/>
|
||||||
<form name="form" ng-submit="login.submit()">
|
<form name="form" ng-submit="login.submit()">
|
||||||
<vn-textfield label="User" entity="login" field="email"></vn-textfield>
|
<vn-textfield label="User" field="login.model.email"></vn-textfield>
|
||||||
<vn-password label="Password" entity="login" field="password"></vn-password>
|
<vn-password label="Password" field="login.model.password"></vn-password>
|
||||||
<vn-check label="Do not close session" entity="login" field="remember"></vn-check>
|
<vn-check label="Do not close session" field="login.model.remember"></vn-check>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<vn-submit label="Enter"></vn-submit>
|
<vn-submit label="Enter"></vn-submit>
|
||||||
<vn-spinner id="spinner"></vn-spinner>
|
<vn-spinner id="spinner"></vn-spinner>
|
||||||
|
|
Loading…
Reference in New Issue