vn-switch

cambio campos obligatorios cliente
eliminado campo fecha de alta
This commit is contained in:
nelo 2017-01-09 14:58:44 +01:00
parent d2fc2e794c
commit f510ce5e9d
16 changed files with 113 additions and 42 deletions

View File

@ -42,6 +42,8 @@ export {NAME as DATE_PICKER, directive as DatePickerDirective} from './date-pick
export {NAME as DATE_PICKER_MDL, factory as datePickerMdl} from './date-picker/date-picker.mdl';
export {NAME as CARD, directive as CardDirective} from './card/card';
export {NAME as CARD_MDL, factory as cardMdl} from './card/card.mdl';
export {NAME as SWITCH, directive as SwitchDirective} from './switch/switch';
export {NAME as SWITCH_MDL, factory as switchdMdl} from './switch/switch.mdl';
export {directive as Popover} from './popover/popover';
export {factory as PopoverMdl} from './popover/popover.mdl';

View File

@ -0,0 +1,28 @@
import {module as _module} from '../module';
import * as resolveFactory from '../resolveDefaultComponents';
import * as normalizerFactory from '../inputAttrsNormalizer';
import * as util from '../util';
const _NAME = 'switch';
export const NAME = util.getName(_NAME);
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME];
export function directive(resolve, normalizer) {
return {
restrict: 'E',
template: function(_, attrs) {
normalizer.normalize(attrs);
return resolve.getTemplate(_NAME, attrs);
},
link: function(scope, element, attrs) {
scope.$watch(attrs.model, () => {
let mdlField = element[0].firstChild.MaterialSwitch;
if (mdlField)
mdlField.updateClasses_();
});
}
};
}
_module.directive(NAME, directive);

View File

@ -0,0 +1,4 @@
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
<input type="checkbox" class="*[className]*" ng-model="*[model]*">
<span class="mdl-switch__label">*[label]*</span>
</label>

View File

@ -0,0 +1,21 @@
import {module as _module} from '../module';
import * as util from '../util';
import * as constant from '../constants';
import template from './switch.mdl.html';
const _NAME = 'switch';
const DEFAULT_CLASS = 'mdl-switch__input';
export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK);
export function factory() {
return {
template: template,
default: {
className: DEFAULT_CLASS,
label: ""
}
}
}
_module.factory(NAME, factory);

View File

@ -5,13 +5,10 @@
<vn-horizontal>
<vn-textfield vn-one label="Nombre" field="basicData.client.name" focus></vn-textfield>
<vn-textfield vn-one label="NIF/CIF" field="basicData.client.fi"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield autofocus vn-one label="Razón social" field="basicData.client.socialName"></vn-textfield>
<vn-date-picker vn-one label="Fecha alta" field="basicData.client.dischargeDate"></vn-date-picker>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Teléfono" field="basicData.client.telefono"></vn-textfield>
<vn-textfield vn-one label="Teléfono" field="basicData.client.phone"></vn-textfield>
<vn-textfield vn-one label="Fax" field="basicData.client.fax"></vn-textfield>
<vn-textfield vn-one label="Email" field="basicData.client.email"></vn-textfield>
</vn-horizontal>
@ -19,6 +16,7 @@
<vn-combo vn-one label="Comercial" field="basicData.client.salesPerson">
<option ng-repeat="p in basicData.sales" value="{{p.id}}">{{p.name}}</ng-repeat>
</vn-combo>
<vn-two></vn-two>
</vn-horizontal>
<vn-horizontal>
<vn-one>

View File

@ -6,9 +6,10 @@ export const COMPONENT = {
template: template,
controllerAs: 'basicData',
bindings: {
client: '<'
client: '='
},
controller: function($http) {
$http.get('/client/api/SalesPeople').then(
json => this.sales = json.data,
json => console.error(json.data.error.message)

View File

@ -1,7 +1,7 @@
<vn-vertical class="full-height">
<vn-topbar></vn-topbar>
<vn-horizontal class="full-height">
<vn-empty style="width: 18em" pad-medium-left >
<vn-empty pad-medium-left >
<vn-descriptor descriptor="card.descriptor" class="display-block" ></vn-descriptor>
<vn-left-menu items="card.items"></vn-left-menu>
</vn-empty>

View File

@ -1,3 +1,4 @@
import './style.css';
import template from './card.html';
import {module} from '../../module';
@ -15,7 +16,8 @@ export const COMPONENT = {
this.descriptor = {
clientId: this.client.id,
name: this.client.name,
phone: this.client.phone
phone: this.client.phone,
active: this.client.active
};
},
json => console.error(json.data.error.message)

View File

@ -0,0 +1,3 @@
vn-descriptor{
font-family: raleway-bold;
}

View File

@ -1,16 +1,21 @@
<vn-topbar></vn-topbar>
<form ng-submit="create.submit()" pad-large>
<vn-title>Crear Cliente</vn-title>
<vn-horizontal>
<vn-textfield vn-one label="Nombre" field="create.model.name"></vn-textfield>
<vn-textfield vn-one label="NIF/CIF" field="create.model.fi"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield autofocus vn-one label="Razón social" field="create.model.socialName"></vn-textfield>
<vn-one></vn-one>
</vn-horizontal>
<vn-horizontal>
<vn-one>
<vn-submit label="Crear" id="create"></vn-submit>
</vn-one>
</vn-horizontal>
<vn-card>
<vn-vertical pad-large>
<vn-title>Crear Cliente</vn-title>
<vn-horizontal>
<vn-textfield vn-one label="Nombre" field="create.model.name"></vn-textfield>
<vn-textfield vn-one label="NIF/CIF" field="create.model.fi"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield autofocus vn-one label="Razón social" field="create.model.socialName"></vn-textfield>
<vn-one></vn-one>
</vn-horizontal>
<vn-horizontal>
<vn-one>
<vn-submit label="Crear" id="create"></vn-submit>
</vn-one>
</vn-horizontal>
</vn-vertical>
</vn-card>
</form>

View File

@ -1,12 +1,15 @@
<vn-card>
<vn-horizontal class="margin-medium" pad-medium-top pad-medium-bottom>
<vn-one>
<i class="material-icons" style="font-size:60px;">person</i>
</vn-one>
<vn-vertical vn-two>
<div class="margin-right: .4em;" class="margin-none">{{descriptor.descriptor.clientId}}</div>
<div class="margin-none">{{descriptor.descriptor.name}}</div>
<div class="margin-none">{{descriptor.descriptor.phone}}</div>
</vn-vertical>
</vn-horizontal>
<vn-vertical class="margin-medium" pad-medium-top pad-medium-bottom>
<vn-horizontal>
<vn-one>
<i class="material-icons descriptor-icon">person</i>
</vn-one>
<vn-vertical vn-two>
<div class="margin-none">{{descriptor.descriptor.clientId}}</div>
<div class="margin-none">{{descriptor.descriptor.name}}</div>
<div class="margin-none">{{descriptor.descriptor.phone}}</div>
</vn-vertical>
</vn-horizontal>
<vn-switch label="Activo" field="descriptor.descriptor.active"></vn-switch>
</vn-vertical>
</vn-card>

View File

@ -1,3 +1,4 @@
import './style.css';
import template from './descriptor.html';
import {module} from '../../module';

View File

@ -0,0 +1,3 @@
.descriptor-icon{
font-size:60px;
}

View File

@ -1,11 +1,11 @@
<a ui-sref="clientCard.basicData({ id: {{itemClient.client.id}} })" pad-medium border-solid-bottom>
<vn-horizontal>
<vn-auto>
<div><b>{{itemClient.client.name}}</b></div>
<div>{{itemClient.client.phone}}, {{itemClient.client.contact}}</div>
<div class="vn-item-client-name">{{itemClient.client.name}}</div>
<div>{{itemClient.client.id}} </div>
</vn-auto>
<vn-empty style="vertical-align: middle;">
<vn-icon icon="arrow_forward"></vn-icon>
<vn-icon-button icon="arrow_forward"></vn-icon>
</vn-empty>
</vn-horizontal>
</a>

View File

@ -8,4 +8,8 @@ vn-item-client a {
}
vn-item-client a:hover {
background-color: rgba(0, 0, 0, .1);
}
.vn-item-client-name{
font-family: raleway-bold;
}

View File

@ -25,16 +25,13 @@
"type": "string"
},
"street": {
"type": "string",
"required": "true"
"type": "string"
},
"consignee": {
"type": "string",
"required": "true"
"type": "string"
},
"city": {
"type": "string",
"required": "true"
"type": "string"
},
"postcode": {
"type": "string"
@ -43,8 +40,7 @@
"type": "Number"
},
"country": {
"type": "string",
"required": "true"
"type": "string"
},
"email": {
"type": "string"