This commit is contained in:
Vicente Falco 2017-01-10 12:56:57 +01:00
commit b41a285e7f
30 changed files with 269 additions and 135 deletions

View File

@ -3,12 +3,12 @@
<vn-icon icon="apps" id="apps" title="Applications"></vn-icon>
<vn-icon icon="notifications" title="Notifications"></vn-icon>
<vn-icon icon="account_circle" title="Profile" style="font-size: 35px;"></vn-icon>
<!--
<vn-popover pad-medium for="apps">
<a ui-sref="clients"><vn-icon icon=""></vn-icon></a>
</vn-popover>
<!--
-->
<ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right user-menu" pad-medium for="apps">
<a ui-sref="clients"><i class="material-icons" id="clients">person</i></a>
</ul>
-->
</div>

View File

@ -7,12 +7,11 @@ export const COMPONENT = {
template: template,
controllerAs: "mainMenu",
controller: function() {
this.onLogoutClick = function ()
{
this.onLogoutClick = function() {
let appName = 'salix';
document.cookie = `${appName}-session=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
window.location = `/account?api_key=${appName}`;
}
};
}
};
module.component(NAME, COMPONENT);

View File

@ -1,6 +1,8 @@
<vn-horizontal>
<vn-textfield vn-one label="Search"></vn-textfield>
<vn-icon icon="keyboard_arrow_down"></vn-icon>
<vn-textfield vn-one label="Search" model="$ctrl.search"></vn-textfield>
<vn-icon icon="keyboard_arrow_down" ng-click="searchbar.onClick($event)" style="cursor: pointer;"></vn-icon>
<vn-icon-button icon="search"></vn-icon-button>
<vn-popover id="popover">
<vn-search-panel></vn-search-panel>
</vn-popover>
</vn-horizontal>

View File

@ -1,8 +1,18 @@
import template from './searchbar.html';
import {module} from '../../module';
require('./style.css');
export const NAME = 'vnSearchbar'
export const COMPONENT = {
template: template
template: template,
transclude: true,
controllerAs: 'searchbar',
controller: function($element) {
this.onClick = function(event) {
var popover = $element.find('vn-popover');
popover.controller('vnPopover').show($element);
};
}
};
COMPONENT.controller.$inject = ['$element'];
module.component(NAME, COMPONENT);

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

@ -1,6 +1,6 @@
import * as vendors from 'vendor';
import {getModuleName,getVendorDependencies} from './util';
import {getModuleName, getVendorDependencies} from './util';
const DEPENDENCIES = getVendorDependencies(vendors)
const DEPENDENCIES = getVendorDependencies(vendors);
export const NAME = getModuleName('core');
export const module = vendors.ng.module(NAME,DEPENDENCIES);
export const module = vendors.ng.module(NAME, DEPENDENCIES);

View File

@ -9,13 +9,70 @@ export function directive(resolver) {
return {
restrict: 'E',
transclude: true,
controllerAs: 'popover',
template: function(_, attrs) {
return resolver.getTemplate(_NAME, attrs);
},
controller: function() {
this.onClick = function (event) {
event.stopPropagation();
controller: function($element) {
var self = this;
var doc = angular.element(document);
function docMouseDownHandler (event) {
if (event != self.lastEvent)
self.hide();
}
this.onMouseDown = function(event) {
this.lastEvent = event;
};
this.hide = function ()
{
$element[0].style.display = 'none';
doc.off('mousedown', docMouseDownHandler);
}
this.show = function(parent) {
var node = $element[0];
var style = node.style;
var spacing = 4;
var margin = 20;
var dblMargin = margin * 2;
var width = node.offsetWidth;
var height = node.offsetHeight;
var innerWidth = window.innerWidth;
var innerHeight = window.innerHeight;
if(width + dblMargin > innerWidth) {
width = innerWidth - dblMargin;
style.width = width +'px';
}
if(height + dblMargin > innerHeight) {
height = innerHeight - dblMargin;
style.height = height +'px';
}
if(parent) {
var parentNode = parent[0];
var rect = parentNode.getBoundingClientRect();
var left = rect.left;
var top = rect.top + spacing + parentNode.offsetHeight;
if(left + width > innerWidth)
left -= (left + width) - window.innerWidth + margin;
if(top + height > innerHeight)
top -= height + parentNode.offsetHeight + spacing * 2;
if(left < 0)
left = margin;
if(top < 0)
top = margin;
style.top = (top) +'px';
style.left = (left) +'px';
}
style.display = 'block';
doc.on('mousedown', docMouseDownHandler);
};
}
}
}

View File

@ -1,7 +1,5 @@
<div
class="mdl-menu mdl-js-menu mdl-menu--bottom-right user-menu"
ng-click="$ctrl.onClick($event)"
pad-medium
ng-mousedown="popover.onMouseDown($event)"
ng-transclude
*[foo]*>
</div>

View File

@ -1,4 +1,9 @@
vn-popover {
display: none;
position: absolute;
position: fixed;
box-shadow: 0 0 .2em rgba(1,1,1,.4);
background-color: white;
z-index: 100;
top: 0;
left: 0;
}

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

@ -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,7 +6,7 @@ export const COMPONENT = {
template: template,
controllerAs: 'basicData',
bindings: {
client: '<'
client: '='
},
controller: function($http) {
$http.get('/client/api/SalesPeople').then(

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,4 +1,7 @@
<vn-topbar></vn-topbar>
<form ng-submit="create.submit()" pad-large>
<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>
@ -13,4 +16,6 @@
<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-vertical class="margin-medium" pad-medium-top pad-medium-bottom>
<vn-horizontal>
<vn-one>
<i class="material-icons" style="font-size:60px;">person</i>
<i class="material-icons descriptor-icon">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.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

@ -17,7 +17,4 @@
</vn-item-client>
</vn-card>
</div>
<vn-popover>
Popover test!
</vn-popover>
</vn-vertical>

View File

@ -8,14 +8,12 @@ export const COMPONENT = {
controllerAs: 'search',
controller: function($http) {
this.clients = [];
$http.get('/client/api/Clients').then(
json => {
this.clients = json.data;
},
json => console.error(json.data.error.message)
);
this.submit = function() {
var query = {where: model};
var self = this;

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

@ -9,3 +9,7 @@ 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

@ -1,5 +1,5 @@
<div class="mdl-menu mdl-js-menu mdl-menu--bottom-left user-menu" pad-medium for="searchbar" style="width:600px">
<form name="form" ng-submit="form.$valid && search.submit()" pad-large>
<div pad-large style="width: 600px;">
<form name="form" ng-submit="form.$valid && search.submit()">
<vn-horizontal>
<vn-textfield vn-one label="Id Cliente" field="search.model.id"></vn-textfield>
<vn-textfield vn-one label="NIF/CIF" field="search.model.fi"></vn-textfield>
@ -18,9 +18,7 @@
<vn-textfield vn-one label="Email" field="search.model.email"></vn-textfield>
<vn-textfield vn-one label="Teléfono" field="search.model.phone"></vn-textfield>
</vn-horizontal>
<vn-submit label="">
<i class="material-icons">add_shopping_cart</i>Add to shopping cart
</vn-submit>
<vn-button label="Search"></vn-button>
</form>
</div>

View File

@ -1,11 +1,11 @@
export function getComponentName(name, isProvider){
if(isProvider){
export function getComponentName(name, isProvider) {
if (isProvider) {
return {
name: name,
provider: name + "Provider"
}
};
}
return {
name: name
}
};
}

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"