Merge branch 'master' of ssh://git.verdnatura.es:/var/lib/git/salix
This commit is contained in:
commit
f8cf1efac3
|
@ -6,14 +6,14 @@ import * as run from './run';
|
|||
import * as configNgTranslate from './translate';
|
||||
import * as components from './components';
|
||||
|
||||
import title from './styles/title.css'
|
||||
import padding from './styles/layout.css'
|
||||
import margin from './styles/margin.scss'
|
||||
import layout from './styles/padding.scss'
|
||||
import background from './styles/background.scss'
|
||||
import border from './styles/border.scss'
|
||||
import fontStyle from './styles/font-style.scss'
|
||||
import misc from './styles/misc.scss'
|
||||
import display from './styles/display.css'
|
||||
import title from './styles/title.css';
|
||||
import padding from './styles/layout.css';
|
||||
import margin from './styles/margin.scss';
|
||||
import layout from './styles/padding.scss';
|
||||
import background from './styles/background.scss';
|
||||
import border from './styles/border.scss';
|
||||
import fontStyle from './styles/font-style.scss';
|
||||
import misc from './styles/misc.scss';
|
||||
import display from './styles/display.css';
|
||||
|
||||
bootstrap();
|
||||
|
|
|
@ -19,7 +19,7 @@ function controller($element, $scope, $document, $compile, popover) {
|
|||
this.onClick = function(event) {
|
||||
var child = $document[0].createElement(this.popover);
|
||||
$compile(child)($scope);
|
||||
popover.show(child, $element);
|
||||
popover.show(child, $element[0]);
|
||||
|
||||
// XXX: ¿Existe una forma más adecuada de acceder al controlador de un componente?
|
||||
var childCtrl = angular.element(child).isolateScope().$ctrl;
|
||||
|
|
|
@ -1,124 +1,369 @@
|
|||
import {module} from '../module';
|
||||
export {factory as mdlFactory} from './index.mdl';
|
||||
import * as resolveFactory from '../resolveDefaultComponents';
|
||||
import * as normalizerFactory from '../inputAttrsNormalizer';
|
||||
require('./style.css');
|
||||
require('./style.scss');
|
||||
|
||||
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME];
|
||||
export function directive(resolve, normalizer) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
scope: {
|
||||
url: '@',
|
||||
showField: '@',
|
||||
valueField: '@',
|
||||
model: '<'
|
||||
},
|
||||
template: function(element, attrs) {
|
||||
normalizer.normalize(attrs);
|
||||
return resolve.getTemplate('autocomplete', attrs);
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.$watch(attrs.model, () => {
|
||||
let mdlField = element[0].firstChild.MaterialTextfield;
|
||||
if (mdlField)
|
||||
mdlField.updateClasses_();
|
||||
});
|
||||
componentHandler.upgradeElement(element[0].firstChild);
|
||||
},
|
||||
controller: controller
|
||||
};
|
||||
export const component = {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
bindings: {
|
||||
url: '@',
|
||||
showField: '@',
|
||||
valueField: '@',
|
||||
model: '<'
|
||||
},
|
||||
template: template,
|
||||
controller: controller
|
||||
};
|
||||
module.component('vnAutocomplete', component);
|
||||
|
||||
template.$inject = ['$element', '$attrs', 'vnInputAttrsNormalizer', 'vnResolveDefaultComponent'];
|
||||
function template($element, $attrs, normalizer, resolve) {
|
||||
normalizer.normalize($attrs);
|
||||
return resolve.getTemplate('autocomplete', $attrs);
|
||||
}
|
||||
module.directive('vnAutocomplete', directive);
|
||||
|
||||
controller.$inject = ['$http', '$element', '$attrs', '$scope', '$parse', '$document', 'vnPopover'];
|
||||
export function controller($http, $element, $attrs, $scope, $parse, $document, popover) {
|
||||
let dropdown = null;
|
||||
let input = $element.find('input');
|
||||
let data = [];
|
||||
function controller($http, $element, $attrs, $scope, $parse, $document, popoverProvider) {
|
||||
let locked = false;
|
||||
|
||||
$http.get($scope.url).then(
|
||||
json => {
|
||||
data = json.data;
|
||||
setTimeout(function() {
|
||||
$scope.setValue($scope.model);
|
||||
});
|
||||
},
|
||||
json => {data = [];}
|
||||
);
|
||||
|
||||
$scope.$watch($attrs.model, (newValue) => {
|
||||
if(!locked) {
|
||||
locked = true;
|
||||
$scope.setValue(newValue);
|
||||
this.setValue(newValue);
|
||||
locked = false;
|
||||
}
|
||||
});
|
||||
|
||||
$scope.setValue = function(value) {
|
||||
let index = -1;
|
||||
componentHandler.upgradeElement($element[0].firstChild);
|
||||
|
||||
if(value && data)
|
||||
for(let i = 0; i < data.length; i++)
|
||||
if(data[i][$scope.valueField] == value) {
|
||||
$scope.selectOptionByIndex(i);
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.selectOptionByIndex(-1);
|
||||
function mdlUpdate() {
|
||||
let mdlField = $element[0].firstChild.MaterialTextfield;
|
||||
if (mdlField)
|
||||
mdlField.updateClasses_();
|
||||
}
|
||||
|
||||
$scope.selectOptionByIndex = function(index) {
|
||||
let value;
|
||||
Object.assign(this, {
|
||||
init: function() {
|
||||
this.input = $element.find('input')[0];
|
||||
this.item = null;
|
||||
this.data = null;
|
||||
this.popover = null;
|
||||
this.popoverData = null;
|
||||
this.timeoutId = null;
|
||||
this.lastSearch = null;
|
||||
this.lastRequest = null;
|
||||
this.currentRequest = null;
|
||||
this.moreData = false;
|
||||
this.activeOption = -1;
|
||||
this.maxRows = 10;
|
||||
this.requestDelay = 350;
|
||||
this.requestItem();
|
||||
},
|
||||
loadData: function(textFilter) {
|
||||
textFilter = textFilter ? textFilter : '';
|
||||
|
||||
if(index >= 0) {
|
||||
let item = data[index];
|
||||
input.val(item[$scope.showField]);
|
||||
value = item[$scope.valueField];
|
||||
}
|
||||
else {
|
||||
input.val('');
|
||||
value = undefined;
|
||||
}
|
||||
if(this.lastSearch === textFilter) {
|
||||
this.popoverDataReady();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!locked) {
|
||||
$scope.$apply(function () {
|
||||
locked = true;
|
||||
$parse($attrs.model).assign($scope, value);
|
||||
locked = false;
|
||||
this.lastSearch = textFilter;
|
||||
|
||||
let lastRequest = this.lastRequest;
|
||||
let requestWillSame = lastRequest !== null
|
||||
&& !this.moreData
|
||||
&& textFilter.substr(0, lastRequest.length) === lastRequest;
|
||||
|
||||
if(requestWillSame)
|
||||
this.localFilter(textFilter);
|
||||
else
|
||||
this.requestData(textFilter, false);
|
||||
},
|
||||
getRequestFields: function() {
|
||||
let fields = {};
|
||||
fields[this.valueField] = true;
|
||||
fields[this.showField] = true;
|
||||
return fields;
|
||||
},
|
||||
requestData: function(textFilter, append) {
|
||||
let where = {};
|
||||
let skip = 0;
|
||||
|
||||
if(textFilter)
|
||||
where[this.showField] = {ilike: textFilter};
|
||||
if(append && this.data)
|
||||
skip = this.data.length;
|
||||
|
||||
let filter = {
|
||||
fields: this.getRequestFields(),
|
||||
where: where,
|
||||
order: `${this.showField} ASC`,
|
||||
skip: skip,
|
||||
limit: this.maxRows
|
||||
};
|
||||
|
||||
this.lastRequest = textFilter ? textFilter : '';
|
||||
let json = JSON.stringify(filter);
|
||||
|
||||
if(this.currentRequest)
|
||||
this.currentRequest.resolve();
|
||||
|
||||
this.currentRequest = $http.get(`${this.url}?filter=${json}`);
|
||||
this.currentRequest.then(
|
||||
json => this.onRequest(json.data, append),
|
||||
json => this.onRequest([])
|
||||
);
|
||||
},
|
||||
onRequest: function(data, append) {
|
||||
this.currentRequest = null;
|
||||
this.moreData = data.length >= this.maxRows;
|
||||
|
||||
if(!append || !this.data)
|
||||
this.data = data;
|
||||
else
|
||||
this.data = this.data.concat(data);
|
||||
|
||||
this.setPopoverData(this.data);
|
||||
},
|
||||
localFilter: function(textFilter) {
|
||||
let regex = new RegExp(textFilter, 'i');
|
||||
let data = this.data.filter((item) => {
|
||||
return regex.test(item[this.showField]);
|
||||
});
|
||||
this.setPopoverData(data);
|
||||
},
|
||||
setPopoverData: function(data) {
|
||||
this.popoverData = data;
|
||||
this.popoverDataReady();
|
||||
},
|
||||
popoverDataReady: function() {
|
||||
if(this.hasFocus)
|
||||
this.showPopover();
|
||||
},
|
||||
showPopover: function() {
|
||||
if(!this.data) return;
|
||||
|
||||
let fragment = $document[0].createDocumentFragment();
|
||||
let data = this.popoverData;
|
||||
|
||||
for(let i = 0; i < data.length; i++) {
|
||||
let li = $document[0].createElement('li');
|
||||
li.appendChild($document[0].createTextNode(data[i][this.showField]));
|
||||
fragment.appendChild(li);
|
||||
}
|
||||
|
||||
if(this.moreData) {
|
||||
let li = $document[0].createElement('li');
|
||||
li.appendChild($document[0].createTextNode('Load more'));
|
||||
li.className = 'load-more';
|
||||
fragment.appendChild(li);
|
||||
}
|
||||
|
||||
if (!this.popover) {
|
||||
let popover = $document[0].createElement('ul');
|
||||
popover.addEventListener('click',
|
||||
(e) => this.onPopoverClick(e));
|
||||
popover.addEventListener('mousedown',
|
||||
(e) => this.onPopoverMousedown(e));
|
||||
popover.className = 'vn-autocomplete';
|
||||
popover.appendChild(fragment);
|
||||
popoverProvider.show(popover, this.input);
|
||||
this.popover = popover;
|
||||
}
|
||||
else {
|
||||
this.popover.innerHTML = '';
|
||||
this.popover.appendChild(fragment);
|
||||
}
|
||||
},
|
||||
hidePopover: function() {
|
||||
if(!this.popover) return;
|
||||
this.activeOption = -1;
|
||||
popoverProvider.hide();
|
||||
this.popover = null;
|
||||
},
|
||||
selectPopoverOption: function(index) {
|
||||
if(!this.popover || index == -1) return;
|
||||
if(index < this.popoverData.length) {
|
||||
this.selectOptionByDataIndex(this.popoverData, index);
|
||||
this.hidePopover();
|
||||
}
|
||||
else
|
||||
this.requestData(this.lastRequest, true);
|
||||
},
|
||||
onPopoverClick: function(event) {
|
||||
let childs = this.popover.childNodes;
|
||||
for(let i = 0; i < childs.length; i++)
|
||||
if(childs[i] === event.target) {
|
||||
this.selectPopoverOption(i);
|
||||
break;
|
||||
}
|
||||
},
|
||||
onPopoverMousedown: function(event) {
|
||||
// Prevents input from loosing focus
|
||||
event.preventDefault();
|
||||
},
|
||||
onClick: function(event) {
|
||||
if(!this.popover)
|
||||
this.showPopover();
|
||||
},
|
||||
onFocus: function() {
|
||||
this.hasFocus = true;
|
||||
this.input.select();
|
||||
|
||||
if(this.data)
|
||||
this.showPopover();
|
||||
else
|
||||
this.loadData();
|
||||
},
|
||||
onBlur: function() {
|
||||
this.hasFocus = false;
|
||||
this.restoreShowValue();
|
||||
this.hidePopover();
|
||||
},
|
||||
onKeydown: function(event) {
|
||||
switch(event.keyCode) {
|
||||
case 13: // Enter
|
||||
this.selectPopoverOption(this.activeOption);
|
||||
break;
|
||||
case 27: // Escape
|
||||
this.restoreShowValue();
|
||||
this.input.select();
|
||||
break;
|
||||
case 38: // Arrow up
|
||||
this.activateOption(this.activeOption-1);
|
||||
break;
|
||||
case 40: // Arrow down
|
||||
this.activateOption(this.activeOption+1);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
},
|
||||
onKeyup: function(event) {
|
||||
if(!this.isKeycodePrintable(event.keyCode)) return;
|
||||
if(this.timeoutId) clearTimeout(this.timeoutId);
|
||||
this.timeoutId = setTimeout(() => this.onTimeout(), this.requestDelay);
|
||||
},
|
||||
onTimeout: function() {
|
||||
this.loadData(this.input.value);
|
||||
this.timeoutId = null;
|
||||
},
|
||||
isKeycodePrintable: function(keyCode) {
|
||||
return keyCode == 32 // Spacebar
|
||||
|| keyCode == 8 // Backspace
|
||||
|| (keyCode > 47 && keyCode < 58) // Numbers
|
||||
|| (keyCode > 64 && keyCode < 91) // Letters
|
||||
|| (keyCode > 95 && keyCode < 112) // Numpad
|
||||
|| (keyCode > 185 && keyCode < 193) // ;=,-./`
|
||||
|| (keyCode > 218 && keyCode < 223); // [\]'
|
||||
},
|
||||
restoreShowValue: function() {
|
||||
this.putItem(this.item);
|
||||
},
|
||||
requestItem: function() {
|
||||
if(!this.model) return;
|
||||
|
||||
let where = {};
|
||||
where[this.valueField] = this.model;
|
||||
|
||||
let filter = {
|
||||
fields: this.getRequestFields(),
|
||||
where: where,
|
||||
};
|
||||
|
||||
let json = JSON.stringify(filter);
|
||||
|
||||
$http.get(`${this.url}?filter=${json}`).then(
|
||||
json => this.onItemRequest(json.data),
|
||||
json => this.onItemRequest(null)
|
||||
);
|
||||
},
|
||||
onItemRequest: function(data) {
|
||||
if(data && data.length > 0)
|
||||
this.showItem(data[0]);
|
||||
else
|
||||
this.showItem(null);
|
||||
},
|
||||
activateOption: function(index) {
|
||||
|
||||
if(!this.popover)
|
||||
this.showPopover();
|
||||
|
||||
let popover = this.popover;
|
||||
let childs = popover.childNodes;
|
||||
let len = this.popoverData.length;
|
||||
|
||||
if(this.activeOption >= 0)
|
||||
childs[this.activeOption].className = '';
|
||||
|
||||
if(index >= len)
|
||||
index = 0;
|
||||
else if(index < 0)
|
||||
index = len - 1;
|
||||
|
||||
if (index >= 0) {
|
||||
let opt = childs[index];
|
||||
let top = popover.scrollTop;
|
||||
let height = popover.clientHeight;
|
||||
|
||||
if(opt.offsetTop + opt.offsetHeight > top + height)
|
||||
top = opt.offsetTop + opt.offsetHeight - height;
|
||||
else if(opt.offsetTop < top)
|
||||
top = opt.offsetTop;
|
||||
|
||||
opt.className = 'active';
|
||||
popover.scrollTop = top;
|
||||
}
|
||||
|
||||
this.activeOption = index;
|
||||
},
|
||||
setValue: function(value) {
|
||||
if(value) {
|
||||
let data = this.data;
|
||||
|
||||
if(data)
|
||||
for(let i = 0; i < data.length; i++)
|
||||
if(data[i][this.valueField] == value) {
|
||||
this.putItem(data[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
this.requestItem();
|
||||
}
|
||||
else
|
||||
this.putItem(null);
|
||||
},
|
||||
selectOptionByIndex: function(index) {
|
||||
this.selectOptionByDataIndex(this.data, index);
|
||||
},
|
||||
selectOptionByDataIndex: function(data, index) {
|
||||
if(data && index >= 0 && index < data.length)
|
||||
this.putItem(data[index]);
|
||||
else
|
||||
this.putItem(null);
|
||||
},
|
||||
putItem: function(item) {
|
||||
this.showItem(item);
|
||||
let value = item ? item[this.valueField] : undefined;
|
||||
|
||||
if(!locked) {
|
||||
setTimeout (() => {
|
||||
$scope.$apply(function () {
|
||||
locked = true;
|
||||
$parse($attrs.model).assign($scope, value);
|
||||
locked = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
showItem: function(item) {
|
||||
this.input.value = item ? item[this.showField] : '';
|
||||
this.item = item;
|
||||
mdlUpdate();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function onOptionClick(event) {
|
||||
popover.hide();
|
||||
|
||||
let childs = dropdown.childNodes;
|
||||
for(let i = 0; i < childs.length; i++)
|
||||
if(childs[i] === event.target) {
|
||||
$scope.selectOptionByIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.onClick = () => {
|
||||
dropdown = $document[0].createElement('ul');
|
||||
dropdown.addEventListener('click', onOptionClick);
|
||||
dropdown.className = 'vn-dropdown';
|
||||
|
||||
for(let i = 0; i < data.length; i++) {
|
||||
let item = $document[0].createElement('li');
|
||||
item.className = 'vn-dropdown-item';
|
||||
item.appendChild($document[0].createTextNode(data[i][$scope.showField]));
|
||||
dropdown.appendChild(item);
|
||||
}
|
||||
|
||||
popover.show(dropdown, input);
|
||||
};
|
||||
|
||||
$scope.onKeypress = () => {
|
||||
console.log(input.val());
|
||||
};
|
||||
this.init();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
<div class="mdl-textfield mdl-js-textfield *[className]*" ng-click="onClick()">
|
||||
<input class="mdl-textfield__input" type="text" rule="*[rule]*" ng-keypress="onKeypress()" *[enabled]* *[focus]*/>
|
||||
<div class="mdl-textfield mdl-js-textfield *[className]*">
|
||||
<input
|
||||
class="mdl-textfield__input"
|
||||
type="text"
|
||||
rule="*[rule]*"
|
||||
*[enabled]*
|
||||
*[focus]*
|
||||
ng-keydown="$ctrl.onKeydown($event)"
|
||||
ng-click="$ctrl.onClick($event)"
|
||||
ng-keyup="$ctrl.onKeyup($event)"
|
||||
ng-focus="$ctrl.onFocus($event)"
|
||||
ng-blur="$ctrl.onBlur($event)"/>
|
||||
<label class="mdl-textfield__label" translate>*[label]*</label>
|
||||
</div>
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
.vn-dropdown {
|
||||
list-style-type: none;
|
||||
padding: 1em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.vn-dropdown-item {
|
||||
display: block;
|
||||
padding: .8em;
|
||||
margin: 0;
|
||||
}
|
||||
.vn-dropdown-item:hover {
|
||||
background-color: rgba(1,1,1,.1);
|
||||
cursor: pointer;
|
||||
}
|
||||
.vn-dropdown-item:active {
|
||||
background-color: rgba(1,1,1,.2);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
ul.vn-autocomplete {
|
||||
list-style-type: none;
|
||||
padding: 1em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: auto;
|
||||
max-height: 300px;
|
||||
|
||||
li {
|
||||
display: block;
|
||||
padding: .8em;
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
|
||||
&.active,
|
||||
&:hover {
|
||||
background-color: rgba(1,1,1,.1);
|
||||
}
|
||||
&.load-more {
|
||||
color: #ffa410;
|
||||
font-weight: bold;
|
||||
padding: .4em .8em;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,8 @@
|
|||
/* TODO: No utilizar !important */
|
||||
.mdl-button {
|
||||
font-weight: bolder;
|
||||
color: #ffa410;
|
||||
|
||||
}
|
||||
.mdl-button--colored {
|
||||
color: white !important;
|
||||
|
@ -26,3 +28,14 @@
|
|||
color: white !important;
|
||||
background-color: #ff9400 !important;
|
||||
}
|
||||
|
||||
.mdl-dialog__actions--full-width>*{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mdl-dialog{
|
||||
width: 400px;
|
||||
font-family: raleway-regular;
|
||||
line-height:60px;
|
||||
text-align: center;
|
||||
}
|
|
@ -47,7 +47,7 @@ function provider($document, $compile) {
|
|||
}
|
||||
|
||||
if(parent) {
|
||||
let parentNode = parent[0];
|
||||
let parentNode = parent;
|
||||
let rect = parentNode.getBoundingClientRect();
|
||||
let left = rect.left;
|
||||
let top = rect.top + spacing + parentNode.offsetHeight;
|
||||
|
@ -77,6 +77,7 @@ function provider($document, $compile) {
|
|||
this.show(childElement, parent);
|
||||
},
|
||||
hide: function() {
|
||||
if(!this.popover) return;
|
||||
$document.off('mousedown', this.docMouseDownHandler);
|
||||
$document[0].body.removeChild (this.popover);
|
||||
this.popover = null;
|
||||
|
|
|
@ -21,11 +21,7 @@ export const COMPONENT = {
|
|||
this.$onDestroy = function() {
|
||||
deregister();
|
||||
};
|
||||
/*
|
||||
$http.get('/client/api/SalesPeople').then(
|
||||
json => {this.sales = json.data;}
|
||||
);
|
||||
*/
|
||||
|
||||
function callback(transition) {
|
||||
if (!equalsObject(self.client, self.clientOld)) {
|
||||
self.state = transition.to().name;
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
<dialog class="mdl-dialog">
|
||||
<div class="mdl-dialog__content">
|
||||
<p>
|
||||
¿Desea salir sin guardar los cambios?
|
||||
</p>
|
||||
</div>
|
||||
<div class="mdl-dialog__actions mdl-dialog__actions--full-width">
|
||||
<button type="button" class="mdl-button" ng-click="dialogConfirm.accept()">Aceptar</button>
|
||||
<button type="button" class="mdl-button close" ng-click="dialogConfirm.cancel()">Cancelar</button>
|
||||
</div>
|
||||
<dialog class="mdl-dialog ">
|
||||
<vn-vertical class="mdl-dialog__content">
|
||||
<h6 class="dialog-title">
|
||||
¿Seguro que quieres salir sin guardar?
|
||||
</h6>
|
||||
<h6>
|
||||
Los cambios que no hayas guardado se perderán
|
||||
</h6>
|
||||
</vn-vertical>
|
||||
<vn-horizontal class="mdl-dialog__actions mdl-dialog__actions--full-width">
|
||||
<button vn-one type="button" class="mdl-button close" ng-click="dialogConfirm.cancel()">Cancelar</button>
|
||||
<button vn-one type="button" class="mdl-button" ng-click="dialogConfirm.accept()">Aceptar</button>
|
||||
</vn-horizontal>
|
||||
</dialog>
|
|
@ -1,6 +1,8 @@
|
|||
import template from './index.html';
|
||||
import {module} from '../../module';
|
||||
|
||||
require('./style.css');
|
||||
|
||||
export const NAME = 'vnDialogConfirm';
|
||||
export const COMPONENT = {
|
||||
template: template,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
.dialog-title{
|
||||
color:#424242;
|
||||
font-family: raleway-bold;
|
||||
}
|
|
@ -8,8 +8,8 @@
|
|||
<div class="margin-none">{{descriptor.client.id}}</div>
|
||||
<div class="margin-none">{{descriptor.client.name}}</div>
|
||||
<div class="margin-none">{{descriptor.client.phone}}</div>
|
||||
<vn-switch label="Activo" field="descriptor.client.active"></vn-switch>
|
||||
</vn-vertical>
|
||||
</vn-horizontal>
|
||||
<vn-switch label="Activo" field="descriptor.client.active"></vn-switch>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
|
|
|
@ -13,12 +13,20 @@
|
|||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Código postal" field="fiscal.client.postcode"></vn-textfield>
|
||||
<vn-combo vn-one label="Provincia" field="fiscal.client.province">
|
||||
<option ng-repeat="p in fiscal.provinces | orderBy:'name'" value="{{p.id}}">{{p.name}}</option>
|
||||
</vn-combo>
|
||||
<vn-combo vn-one label="País" field="fiscal.client.country">
|
||||
<option ng-repeat="c in fiscal.countries | orderBy:'name'" value="{{c.id}}">{{c.name}}</option>
|
||||
</vn-combo>
|
||||
<vn-autocomplete vn-one
|
||||
field="fiscal.client.province"
|
||||
url="/client/api/Provinces"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Provincia">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete vn-one
|
||||
field="fiscal.client.country"
|
||||
url="/client/api/Countries"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="País">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
|
@ -27,9 +35,13 @@
|
|||
<vn-title>Información de facturación</vn-title>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-two label="IBAN" field="fiscal.client.iban"></vn-textfield>
|
||||
<vn-combo vn-two label="Forma de pago" field="fiscal.client.payMethod">
|
||||
<option ng-repeat="p in fiscal.payments" value="{{p.id}}">{{p.name}}</option>
|
||||
</vn-combo>
|
||||
<vn-autocomplete vn-two
|
||||
field="fiscal.client.payMethod"
|
||||
url="/client/api/PaymentMethods"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Forma de pago">
|
||||
</vn-autocomplete>
|
||||
<vn-textfield vn-one label="Vencimiento" field="fiscal.client.dueDay"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
|
|
|
@ -12,18 +12,6 @@ export const COMPONENT = {
|
|||
var self = this;
|
||||
var deregister = $transitions.onStart({ }, callback);
|
||||
|
||||
$http.get('/client/api/Countries').then(
|
||||
json => this.countries = json.data
|
||||
);
|
||||
|
||||
$http.get('/client/api/Provinces').then(
|
||||
json => this.provinces = json.data
|
||||
);
|
||||
|
||||
$http.get('/client/api/PaymentMethods').then(
|
||||
json => this.payments = json.data
|
||||
);
|
||||
|
||||
this.submit = function() {
|
||||
if (!equalsObject(this.client, this.clientOld)) {
|
||||
this.client.modify = "FiscalData";
|
||||
|
|
|
@ -6,7 +6,6 @@ export const COMPONENT = {
|
|||
template: template,
|
||||
controllerAs: 'newNote',
|
||||
controller: function($http, $state, copyObject, equalsObject, $transitions, $element) {
|
||||
|
||||
this.client = $state.params.id;
|
||||
this.note = {text: null};
|
||||
var self = this;
|
||||
|
|
89
db.json
89
db.json
|
@ -2,15 +2,15 @@
|
|||
"ids": {
|
||||
"User": 2,
|
||||
"AccessToken": 2,
|
||||
"Client": 16,
|
||||
"Client": 17,
|
||||
"PaymentMethod": 4,
|
||||
"SalesPerson": 4,
|
||||
"Address": 58,
|
||||
"Country": 3,
|
||||
"Province": 3,
|
||||
"SalesPerson": 11,
|
||||
"Address": 61,
|
||||
"Country": 10,
|
||||
"Province": 44,
|
||||
"Agency": 4,
|
||||
"Account": 20,
|
||||
"ClientObservation": 1265
|
||||
"Account": 21,
|
||||
"ClientObservation": 1268
|
||||
},
|
||||
"models": {
|
||||
"User": {
|
||||
|
@ -22,7 +22,8 @@
|
|||
"Client": {
|
||||
"12": "{\"name\":\"Verdnatura\",\"id\":12,\"fi\":\"B97367486\",\"salesPerson\":\"1\",\"telefono\":\"963242100\",\"socialName\":\"Verdnatura Levante SL\",\"active\":true,\"user\":\"verdnatura\",\"fax\":\"963242100\",\"phone\":\"963242101d\",\"email\":\"informatica@verdnatura.es\",\"surcharge\":true,\"cyc\":2345,\"credit\":1000,\"iban\":\"456\",\"street\":\"Avenida Espioca, 100\",\"city\":\"Silla\",\"postcode\":\"46013\",\"mobile\":\"654654654\",\"dueDay\":10,\"gestdoc\":23452343,\"province\":\"2\",\"country\":\"1\",\"modify\":\"BasicData\",\"navigate\":true,\"payMethod\":\"1\"}",
|
||||
"14": "{\"name\":\"Cliente 1\",\"id\":14,\"street\":\"Aaaaaaaaaa\",\"fi\":\"1234567890A\",\"socialName\":\"Cliente 1\",\"fax\":\"963242100\",\"dischargeDate\":\"01/01/2017\",\"telefono\":\"963242100\",\"salesPerson\":\"2\",\"email\":\"informatica@verdnatura.es\",\"city\":\"asdf\",\"postcode\":\"asdf\",\"phone\":\"asdf\",\"mobile\":\"asdf\",\"credit\":2345,\"cyc\":123,\"iban\":\"asdf\",\"dueDay\":345,\"gestdoc\":2435,\"surcharge\":true,\"navigate\":true}",
|
||||
"15": "{\"name\":\"afsdf\",\"fi\":\"12341234rasf\",\"socialName\":\"asdfasd\",\"dueDay\":5,\"id\":15,\"payMethod\":\"2\",\"salesPerson\":\"1\",\"modify\":\"BasicData\",\"iban\":\"sdfgsdfgsdfg\"}"
|
||||
"15": "{\"name\":\"afsdf\",\"fi\":\"12341234rasf\",\"socialName\":\"asdfasd\",\"dueDay\":5,\"id\":15,\"payMethod\":\"2\",\"salesPerson\":\"1\",\"modify\":\"BasicData\",\"iban\":\"sdfgsdfgsdfg\"}",
|
||||
"16": "{\"name\":\"floristeria laasdfas\",\"fi\":\"2345234523d\",\"socialName\":\"23452345assdfgsdfgt\",\"active\":true,\"dueDay\":5,\"id\":16,\"modify\":\"FiscalData\",\"email\":\"asdfopi jso@aosijf.com\",\"phone\":\"654654654\",\"mobile\":\"654456456\",\"fax\":\"456456456\",\"street\":\"asdfasdf\"}"
|
||||
},
|
||||
"PaymentMethod": {
|
||||
"1": "{\"name\":\"Tarjeta\",\"id\":1}",
|
||||
|
@ -32,20 +33,78 @@
|
|||
"SalesPerson": {
|
||||
"1": "{\"id\":1,\"name\":\"Jesus Brocal\"}",
|
||||
"2": "{\"name\":\"Juan Carlos Lorenzo\",\"id\":2}",
|
||||
"3": "{\"name\":\"Carlos Zambrano\",\"id\":3}"
|
||||
"3": "{\"name\":\"Carlos Zambrano\",\"id\":3}",
|
||||
"4": "{\"name\":\"Juan Ferrer\",\"id\":4}",
|
||||
"5": "{\"name\":\"Javi Gallego\",\"id\":5}",
|
||||
"6": "{\"name\":\"Vicente Falco\",\"id\":6}",
|
||||
"7": "{\"name\":\"Nelo Sanchez\",\"id\":7}",
|
||||
"8": "{\"name\":\"Francisco Natek\",\"id\":8}",
|
||||
"9": "{\"name\":\"Silverio Rodriguez\",\"id\":9}",
|
||||
"10": "{\"name\":\"Manoli\",\"id\":10}"
|
||||
},
|
||||
"Address": {
|
||||
"57": "{\"street\":\"Avda Espioca\",\"consignee\":\"Vicente\",\"city\":\"Silla\",\"postcode\":\"46900\",\"phone\":\"963242100\",\"province\":\"1\",\"agency\":\"3\",\"id\":57,\"enabled\":true,\"default\":true}",
|
||||
"58": "{\"street\":\"asdfasdfsdf\",\"consignee\":\"oiaspjdfopasidjfopsj\",\"city\":\"asdfasd\",\"postcode\":\"46460\",\"enabled\":true,\"phone\":\"23423342\",\"mobile\":\"234423\",\"default\":false,\"province\":\"19\",\"agency\":\"1\",\"client\":\"16\",\"id\":58}",
|
||||
"59": "{\"street\":\"asdfasdf\",\"consignee\":\"asdfasdfasdf\",\"city\":\"sdfasdf\",\"postcode\":\"asdfa\",\"enabled\":true,\"phone\":\"a\",\"province\":\"14\",\"agency\":\"3\",\"client\":\"16\",\"id\":59,\"default\":false}",
|
||||
"60": "{\"street\":\"asdfasdf\",\"consignee\":\"aasdfasdf\",\"city\":\"asdf\",\"postcode\":\"asdf\",\"enabled\":false,\"default\":false,\"province\":\"3\",\"client\":\"16\",\"id\":60}",
|
||||
"63": "{\"street\":\"Avd. Espioca nº 100\",\"consignee\":\"Verndatura Silla\",\"city\":\"Silla\",\"postcode\":\"46460\",\"phone\":\"66666666\",\"mobile\":\"989898888\",\"id\":63,\"province\":\"2\",\"agency\":\"3\",\"default\":false,\"enabled\":false}",
|
||||
"64": "{\"street\":\"Aaa\",\"consignee\":\"aaa\",\"city\":\"121212\",\"postcode\":\"11111\",\"phone\":\"963242100\",\"mobile\":\"11231241423\",\"id\":64,\"default\":false,\"province\":\"1\",\"agency\":\"2\",\"enabled\":false}"
|
||||
},
|
||||
"Country": {
|
||||
"1": "{\"id\":1,\"name\":\"Spain\"}",
|
||||
"2": "{\"id\":2,\"name\":\"France\"}"
|
||||
"2": "{\"id\":2,\"name\":\"France\"}",
|
||||
"3": "{\"name\":\"Italy\",\"id\":3}",
|
||||
"4": "{\"name\":\"Germany\",\"id\":4}",
|
||||
"5": "{\"name\":\"Portugal\",\"id\":5}",
|
||||
"6": "{\"name\":\"Netherlands\",\"id\":6}",
|
||||
"7": "{\"name\":\"Colombia\",\"id\":7}",
|
||||
"8": "{\"name\":\"Mexico\",\"id\":8}",
|
||||
"9": "{\"name\":\"USA\",\"id\":9}"
|
||||
},
|
||||
"Province": {
|
||||
"1": "{\"id\":1,\"name\":\"Valencia\"}",
|
||||
"2": "{\"id\":2,\"name\":\"Madrid\"}"
|
||||
"2": "{\"id\":2,\"name\":\"Madrid\"}",
|
||||
"3": "{\"id\":3,\"name\":\"Alicante\"}",
|
||||
"4": "{\"id\":4,\"name\":\"Castellon\"}",
|
||||
"5": "{\"id\":5,\"name\":\"Murcia\"}",
|
||||
"6": "{\"id\":6,\"name\":\"Albacete\"}",
|
||||
"7": "{\"id\":7,\"name\":\"Barcelona\"}",
|
||||
"8": "{\"id\":8,\"name\":\"Tarragona\"}",
|
||||
"9": "{\"id\":9,\"name\":\"Gerona\"}",
|
||||
"10": "{\"id\":10,\"name\":\"Granada\"}",
|
||||
"11": "{\"id\":11,\"name\":\"Guadalajara\"}",
|
||||
"12": "{\"id\":12,\"name\":\"Cuenca\"}",
|
||||
"13": "{\"id\":13,\"name\":\"Asturias\"}",
|
||||
"14": "{\"id\":14,\"name\":\"Almería\"}",
|
||||
"15": "{\"id\":15,\"name\":\"Ávila\"}",
|
||||
"16": "{\"id\":16,\"name\":\"Vadajoz\"}",
|
||||
"17": "{\"id\":17,\"name\":\"Burgos\"}",
|
||||
"18": "{\"id\":18,\"name\":\"Málaga\"}",
|
||||
"19": "{\"id\":19,\"name\":\"Navarra\"}",
|
||||
"20": "{\"id\":20,\"name\":\"Ceuta\"}",
|
||||
"21": "{\"id\":21,\"name\":\"Melilla\"}",
|
||||
"22": "{\"id\":22,\"name\":\"Melilla\"}",
|
||||
"23": "{\"id\":23,\"name\":\"Zaragoza\"}",
|
||||
"24": "{\"id\":24,\"name\":\"Zamora\"}",
|
||||
"25": "{\"id\":25,\"name\":\"Vizcaya\"}",
|
||||
"26": "{\"id\":26,\"name\":\"Valladolid\"}",
|
||||
"27": "{\"id\":27,\"name\":\"Toledo\"}",
|
||||
"28": "{\"id\":28,\"name\":\"Teruel\"}",
|
||||
"29": "{\"id\":29,\"name\":\"Santa Cruz de Tenerife\"}",
|
||||
"30": "{\"id\":30,\"name\":\"Soria\"}",
|
||||
"31": "{\"id\":31,\"name\":\"Sevilla\"}",
|
||||
"32": "{\"id\":32,\"name\":\"Segovia\"}",
|
||||
"33": "{\"id\":33,\"name\":\"Salamanca\"}",
|
||||
"34": "{\"id\":34,\"name\":\"La Rioja\"}",
|
||||
"35": "{\"id\":35,\"name\":\"Pontevedra\"}",
|
||||
"36": "{\"id\":36,\"name\":\"Las Palmas\"}",
|
||||
"37": "{\"id\":37,\"name\":\"Palencia\"}",
|
||||
"38": "{\"id\":38,\"name\":\"Orense\"}",
|
||||
"39": "{\"id\":39,\"name\":\"Lugo\"}",
|
||||
"40": "{\"id\":40,\"name\":\"Lérida\"}",
|
||||
"41": "{\"id\":41,\"name\":\"León\"}",
|
||||
"42": "{\"id\":42,\"name\":\"Jaén\"}",
|
||||
"43": "{\"id\":43,\"name\":\"Baleares\"}"
|
||||
},
|
||||
"Agency": {
|
||||
"1": "{\"name\":\"Zeleris\",\"id\":1}",
|
||||
|
@ -55,7 +114,8 @@
|
|||
"Account": {
|
||||
"1": "{\"id\":1,\"password\":\"joselito\",\"name\":\"asdf\"}",
|
||||
"14": "{\"id\":14,\"active\":true,\"name\":\"f\"}",
|
||||
"15": "{\"id\":15,\"name\":\"asdf\"}"
|
||||
"15": "{\"id\":15,\"name\":\"asdf\"}",
|
||||
"16": "{\"id\":16,\"name\":\"joselito\",\"active\":true}"
|
||||
},
|
||||
"ClientObservation": {
|
||||
"1258": "{\"text\":\"Nota de prueba 1\",\"creationDate\":\"2017-01-17T15:24:23.320Z\",\"client\":12,\"salesPerson\":\"user\",\"id\":1258}",
|
||||
|
@ -64,7 +124,10 @@
|
|||
"1261": "{\"text\":\"Nota 2\",\"creationDate\":\"2017-01-17T15:35:06.313Z\",\"client\":14,\"salesPerson\":\"user\",\"id\":1261}",
|
||||
"1262": "{\"text\":\"Nota 3\",\"creationDate\":\"2017-01-17T15:35:10.602Z\",\"client\":14,\"salesPerson\":\"user\",\"id\":1262}",
|
||||
"1263": "{\"text\":\"Nota 4\",\"creationDate\":\"2017-01-17T15:35:44.768Z\",\"client\":14,\"salesPerson\":\"user\",\"id\":1263}",
|
||||
"1264": "{\"text\":\"Nota 5\",\"creationDate\":\"2017-01-17T15:35:50.064Z\",\"client\":14,\"salesPerson\":\"user\",\"id\":1264}"
|
||||
"1264": "{\"text\":\"Nota 5\",\"creationDate\":\"2017-01-17T15:35:50.064Z\",\"client\":14,\"salesPerson\":\"user\",\"id\":1264}",
|
||||
"1265": "{\"text\":\"primera nota\",\"creationDate\":\"2017-01-20T10:23:28.000Z\",\"client\":\"16\",\"salesPerson\":\"user\",\"modify\":\"ClientObservation\",\"id\":1265}",
|
||||
"1266": "{\"text\":\"segunda nota\",\"creationDate\":\"2017-01-20T10:23:37.000Z\",\"client\":\"16\",\"salesPerson\":\"user\",\"modify\":\"ClientObservation\",\"id\":1266}",
|
||||
"1267": "{\"text\":\"tercera nota\",\"creationDate\":\"2017-01-20T10:23:53.000Z\",\"client\":\"16\",\"salesPerson\":\"user\",\"modify\":\"ClientObservation\",\"id\":1267}"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue