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

# Conflicts:
#	db.json
This commit is contained in:
nelo 2017-01-13 09:57:16 +01:00
commit 30e5bd9c0b
81 changed files with 1126 additions and 1126 deletions

View File

@ -1,4 +1,5 @@
<vn-vertical full-height class="bg-content">
<vn-main-menu></vn-main-menu>
<vn-vertical ui-view scrollable class="main-view"></vn-vertical>
<vn-topbar vn-empty></vn-topbar>
<vn-vertical vn-auto ui-view scrollable class="main-view"></vn-vertical>
</vn-vertical>

View File

@ -1,4 +1,5 @@
vn-app {
display: block;
height: 100%;
}

View File

@ -1,8 +1,12 @@
<form ng-submit="$ctrl.search()">
<vn-horizontal>
<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-textfield vn-one label="Search" model="$ctrl.model.search"></vn-textfield>
<vn-icon
ng-if="$ctrl.advanced"
ng-click="$ctrl.onClick($event)"
icon="keyboard_arrow_down"
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>
</form>

View File

@ -1,18 +1,25 @@
import template from './searchbar.html';
import {module} from '../../module';
require('./style.css');
export const NAME = 'vnSearchbar'
export const COMPONENT = {
template: template,
transclude: true,
controllerAs: 'searchbar',
controller: function($element) {
template: require('./searchbar.html'),
bindings: {
model: '<',
search: '&',
advanced: '=',
popover: '@'
},
controller: controller
};
module.component(NAME, COMPONENT);
controller.$inject = ['$element', '$scope', '$document', '$compile', 'vnPopover'];
function controller($element, $scope, $document, $compile, popover) {
this.onClick = function(event) {
var popover = $element.find('vn-popover');
popover.controller('vnPopover').show($element);
var child = $document[0].createElement(this.popover);
$compile(child)($scope);
popover.show($element, child);
event.preventDefault();
};
}
};
COMPONENT.controller.$inject = ['$element'];
module.component(NAME, COMPONENT);

View File

@ -1,2 +1,2 @@
<header class="mdl-layout__header mdl-layout__header--scroll bg-dark-bar">
<header class="bg-dark-bar" style="height: 4.2em;">
</header>

View File

@ -1,8 +1,7 @@
import template from './topbar.html';
import {module} from '../../module';
export const NAME = "vnTopbar";
export const NAME = 'vnTopbar';
export const COMPONENT = {
template: template
template: require('./topbar.html')
};
module.component(NAME, COMPONENT);

View File

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

View File

@ -20,6 +20,7 @@ export function directive(resolve, normalizer) {
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
};
}

View File

@ -21,6 +21,7 @@ export function directive(resolve, normalizer) {
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
};
}

View File

@ -46,11 +46,9 @@ 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';
export {directive as Icon} from './icon/icon';
export {factory as IconMdl} from './icon/icon.mdl';
export {NAME as TITLE, COMPONENT as TITLE_COMPONENT} from './title/title';
export {NAME as SUBTITLE, COMPONENT as SUBTITLE_COMPONENT} from './subtitle/subtitle';
export {directive as Popover} from './popover/popover';
export {COMPONENT as Title} from './title/title';
export {COMPONENT as Subtitle} from './subtitle/subtitle';

View File

@ -20,6 +20,7 @@ export function directive(resolve, normalizer) {
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
};
}

View File

@ -20,6 +20,7 @@ export function directive(resolve, normalizer) {
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
}
}

View File

@ -2,49 +2,55 @@ import {module} from '../module';
import * as resolveFactory from '../resolveDefaultComponents';
require('./style.css');
const _NAME = 'popover';
export const NAME = 'vnPopover';
export function directive(resolver) {
directive.$inject = ['$compile', '$document', 'vnPopover'];
export function directive($compile, $document, popover) {
return {
restrict: 'E',
transclude: true,
controllerAs: 'popover',
template: function(_, attrs) {
return resolver.getTemplate(_NAME, attrs);
},
/* link: function(scope, element, attrs, ctrl) {
var nativeElement = element[0];
nativeElement.addEventListener('click', function(ev) {
ev.preventDefault();
ctrl.show();
restrict: 'A',
link: function($scope, $element, $attrs, $ctrl) {
$element.on('click', function(event) {
var child = $document[0].createElement($attrs.vnPopover);
$compile(child)($scope);
popover.show($element, child);
event.preventDefault();
});
},
*/ controller: function($element) {
var self = this;
var doc = angular.element(document);
function docMouseDownHandler(event) {
if (event != self.lastEvent)
}
}
}
module.directive(NAME, directive);
$get.$inject = ['$document'];
function $get($document) {
var lastEvent;
var popover;
var self = {
onDocMouseDown: function(event) {
if (event != 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;
},
onPopoverMouseDown: function(event) {
lastEvent = event;
},
hide: function() {
$document.off('mousedown', this.onDocMouseDown);
$document[0].body.removeChild (popover);
popover = null;
},
show: function(parent, child) {
popover = $document[0].createElement('div');
popover.className = 'vn-popover';
popover.addEventListener('mousedown', this.onPopoverMouseDown);
popover.appendChild (child);
var style = popover.style;
var spacing = 0;
var margin = 20;
var dblMargin = margin * 2;
var width = node.offsetWidth;
var height = node.offsetHeight;
var width = popover.offsetWidth;
var height = popover.offsetHeight;
var innerWidth = window.innerWidth;
var innerHeight = window.innerHeight;
@ -77,12 +83,10 @@ export function directive(resolver) {
style.left = (left) +'px';
}
style.display = 'block';
doc.on('mousedown', docMouseDownHandler);
$document[0].body.appendChild (popover);
$document.on('mousedown', this.onDocMouseDown);
}
};
return self;
}
}
}
directive.$inject = [resolveFactory.NAME];
module.directive(NAME, directive);
module.provider('vnPopover', function() {this.$get = $get;});

View File

@ -1,5 +0,0 @@
<div
ng-mousedown="popover.onMouseDown($event)"
ng-transclude
*[foo]*>
</div>

View File

@ -1,12 +0,0 @@
import {module} from '../module';
import template from './popover.mdl.html';
export const NAME = 'vnPopoverMdlFactory';
export function factory() {
return {
template: template,
default: {}
}
}
module.factory(NAME, factory);

View File

@ -1,5 +1,4 @@
vn-popover {
display: none;
.vn-popover {
position: fixed;
box-shadow: 0 0 .4em rgba(1,1,1,.4);
background-color: white;

View File

@ -1,4 +1,4 @@
<div class="*[className]*">
<div class="mdl-js-snackbar mdl-snackbar *[className]*">
<div class="mdl-snackbar__text"></div>
<button class="mdl-snackbar__action" type="button"></button>
</div>

View File

@ -7,8 +7,7 @@ export function factory() {
return {
template: template,
default: {
message: 'Default message',
className: 'mdl-js-snackbar mdl-snackbar'
message: 'Default message'
}
}
}

View File

@ -1,2 +0,0 @@
<h5 style="margin-top: 0;" class="border-dashed-top pad-medium-v" level="*[level]*" ng-transclude>
</h5>

View File

@ -1,9 +1,8 @@
import template from './subtitle.html';
import {module} from '../module';
export const NAME = "vnSubtitle";
export const NAME = 'vnSubtitle';
export const COMPONENT = {
template: template,
template: require('./template.html'),
transclude: true
};
module.component(NAME, COMPONENT);

View File

@ -0,0 +1,2 @@
<h5 style="margin-top: 0;" class="margin-medium-bottom" ng-transclude>
</h5>

View File

@ -20,6 +20,7 @@ export function directive(resolve, normalizer) {
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
};
}

View File

@ -20,6 +20,7 @@ export function directive(resolve, normalizer) {
if (mdlField)
mdlField.updateClasses_();
});
componentHandler.upgradeElement(element[0].firstChild);
}
};
}

View File

@ -0,0 +1,2 @@
<h3 style="margin-top: 0;" class="margin-medium-bottom" ng-transclude>
</h3>

View File

@ -1,2 +0,0 @@
<h3 style="margin-top: 0;" class="margin-medium-bottom" level="*[level]*" ng-transclude>
</h3>

View File

@ -1,9 +1,8 @@
import template from './title.html';
import {module as _module} from '../module';
import {module} from '../module';
export const NAME = "vnTitle";
export const NAME = 'vnTitle';
export const COMPONENT = {
template: template,
template: require('./template.html'),
transclude: true
};
_module.component(NAME, COMPONENT);
module.component(NAME, COMPONENT);

View File

@ -4,7 +4,7 @@
<vn-vertical pad-large>
<vn-title vn-one>Consignatario</vn-title>
<vn-horizontal>
<vn-check vn-one label="Activo" field="addressData.address.enabled"></vn-check>
<vn-check vn-one label="Activo" field="addressData.address.enabled" focus></vn-check>
<vn-check vn-one label="Predeterminado" field="addressData.address.default"></vn-check>
</vn-horizontal>
<vn-horizontal>

View File

@ -1,7 +1,6 @@
<vn-vertical class="full-height">
<vn-topbar></vn-topbar>
<vn-horizontal class="full-height">
<vn-empty pad-medium-left >
<vn-vertical full-height style="max-width: 85em; margin: 0 auto;">
<vn-horizontal full-height>
<vn-empty pad-medium-left style="min-width: 18em;">
<vn-descriptor client="card.client" class="display-block" ></vn-descriptor>
<vn-left-menu items="card.items"></vn-left-menu>
</vn-empty>

View File

@ -1,14 +1,13 @@
<vn-topbar></vn-topbar>
<form ng-submit="create.submit()" pad-large>
<form ng-submit="create.submit()" pad-large style="max-width: 67em; margin: 0 auto;">
<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="Nombre" field="create.model.name" focus></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-textfield vn-one label="Razón social" field="create.model.socialName"></vn-textfield>
<vn-one></vn-one>
</vn-horizontal>
<vn-horizontal>

View File

@ -1,13 +1,17 @@
<vn-vertical class="full-height">
<vn-topbar></vn-topbar>
<div style="max-width: 45em; margin: 0 auto;">
<div>
<div style="max-width: 39em; margin: 0 auto;">
<vn-card margin-medium>
<form pad-medium ng-submit="search.submit()">
<vn-horizontal>
<vn-searchbar vn-auto></vn-searchbar>
<a vn-empty ui-sref="create"><vn-button label="New client"></vn-button></a>
<vn-horizontal pad-medium>
<vn-searchbar
vn-auto
model="search.filter"
search="search.find()"
advanced="true"
popover="vn-client-search-panel"
params="search.filter"
return="search.find()">
</vn-searchbar>
</vn-horizontal>
</form>
</vn-card>
<vn-card margin-medium>
<vn-item-client
@ -17,4 +21,9 @@
</vn-item-client>
</vn-card>
</div>
</vn-vertical>
<a
ui-sref="create"
style="position: fixed; bottom: 2em; right: 2em;">
<vn-button label="New client"></vn-button>
</a>
</div>

View File

@ -8,25 +8,20 @@ export const COMPONENT = {
controllerAs: 'search',
controller: function($http) {
this.clients = [];
$http.get('/client/api/Clients').then(
json => {
this.clients = json.data;
},
this.find = function() {
var queryStr = '/client/api/Clients';
var search = this.filter.search;
if(search) {
let json = JSON.stringify({where: {name: {ilike: search}}});
var queryStr = `${queryStr}?filter=${json}`;
}
$http.get(queryStr).then(
json => this.clients = json.data,
json => console.error(json.data.error.message)
);
this.submit = function() {
var query = {where: model};
var self = this;
$http.get(`/client/api/Clients/findOne?filter=${JSON.stringify(query)}`).then(
function(response) {
self.clients = [];
self.clients.push(response.data);
},
function(response) {
console.log(response);
}
);
};
this.filter = {};
this.find();
}
};
COMPONENT.controller.$inject = ['$http'];

View File

@ -2,9 +2,8 @@
<vn-card>
<vn-vertical pad-large>
<vn-title>Notas</vn-title>
<vn-textfield label="Notas" class="padd-medium-top" field="note.model.notes"></vn-textfield>
<vn-textfield label="Notas" field="note.model.notes" focus padd-medium-top></vn-textfield>
<vn-submit margin-large-top label="Guardar"></vn-submit>
</vn-vertical>
</vn-card>
</form>

View File

@ -1,4 +1,4 @@
<div pad-large style="width: 600px;">
<div pad-large style="min-width: 30em;">
<form name="form" ng-submit="form.$valid && search.submit()">
<vn-horizontal>
<vn-textfield vn-one label="Id Cliente" field="search.model.id"></vn-textfield>
@ -8,7 +8,7 @@
<vn-textfield vn-one label="Alias" field="search.model.alias"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-two label="Razon Social" field="search.model.name"></vn-textfield>
<vn-textfield vn-one label="Razon Social" field="search.model.name"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Población" field="search.model.city"></vn-textfield>
@ -18,7 +18,9 @@
<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-horizontal margin-large-top>
<vn-button label="Search"></vn-button>
</vn-horizontal>
</form>
</div>

View File

@ -1,7 +1,7 @@
import template from './search-panel.html';
import {module} from '../../module';
export const NAME = "vnSearchPanel";
export const NAME = 'vnClientSearchPanel';
export const COMPONENT = {
controllerAs: 'search',
template: template

View File

@ -32,8 +32,8 @@
"3": "{\"name\":\"Carlos Zambrano\",\"id\":3}"
},
"Address": {
"63": "{\"street\":\"Avd. Espioca nº 100\",\"consignee\":\"Verndatura Silla\",\"city\":\"Silla\",\"postcode\":\"46460\",\"phone\":\"66666666\",\"mobile\":\"989898888\",\"id\":63,\"province\":\"2\",\"agency\":\"3\",\"default\":true,\"enabled\":true}",
"64": "{\"street\":\"Aaa\",\"consignee\":\"aaa\",\"city\":\"aaa\",\"postcode\":\"11111\",\"phone\":\"963242100\",\"mobile\":\"11231241423\",\"id\":64}"
"63": "{\"street\":\"Avd. Espioca nº 100\",\"consignee\":\"Verndatura Silla\",\"city\":\"Silla\",\"postcode\":\"46460\",\"phone\":\"66666666\",\"mobile\":\"989898888\",\"id\":63,\"province\":\"2\",\"agency\":\"2\",\"default\":true,\"enabled\":true}",
"64": "{\"street\":\"Aaa\",\"consignee\":\"aaa\",\"city\":\"aaa\",\"postcode\":\"11111\",\"phone\":\"963242100\",\"mobile\":\"11231241423\",\"id\":64,\"enabled\":true}"
},
"Country": {
"1": "{\"id\":1,\"name\":\"Spain\"}",