Merge
This commit is contained in:
commit
1eb0fb9c8d
|
@ -11,7 +11,7 @@ class Controller {
|
|||
};
|
||||
}
|
||||
onSubmit() {
|
||||
this.element.querySelector('vn-watcher').$ctrl.submit().then (
|
||||
this.element.querySelector('vn-watcher').$ctrl.submit().then(
|
||||
() => this.$state.go('clientCard.notes')
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div pad-large style="min-width: 30em;" ng-show="$ctrl.formVisibility">
|
||||
<form name="form" ng-submit="form.$valid && $ctrl.onSubmit($ctrl.filter)" ng-keyup="$ctrl.getKeyPressed($event)">
|
||||
<form name="form" ng-submit="form.$valid && $ctrl.onSearch()" ng-keyup="$ctrl.getKeyPressed($event)">
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Id Cliente" model="$ctrl.filter.id" vn-focus></vn-textfield>
|
||||
<vn-textfield vn-one label="NIF/CIF" model="$ctrl.filter.fi"></vn-textfield>
|
||||
|
|
|
@ -3,13 +3,26 @@ import {module} from '../module';
|
|||
export const NAME = 'vnClientSearchPanel';
|
||||
export const COMPONENT = {
|
||||
template: require('./index.html'),
|
||||
controller: function($scope) {
|
||||
controller: function($scope, $window) {
|
||||
this.filter = {id: null, fi: null, name: null, socialName: null, city: null, postcode: null, email: null, phone: null};
|
||||
this.formVisibility = true;
|
||||
this.onSubmit = function() {};
|
||||
this.getKeyPressed = function(event){
|
||||
if (event.which === 27)
|
||||
this.onSearch = () => {
|
||||
this.setStorageValue();
|
||||
this.onSubmit(this.filter);
|
||||
};
|
||||
this.getKeyPressed = function(event) {
|
||||
if (event.which === 27)
|
||||
this.formVisibility = false;
|
||||
};
|
||||
this.$onChanges = () => {
|
||||
var value = JSON.parse($window.sessionStorage.getItem('filter'));
|
||||
if (value !== undefined)
|
||||
this.filter = value;
|
||||
};
|
||||
this.setStorageValue = () => {
|
||||
$window.sessionStorage.setItem('filter', JSON.stringify(this.filter));
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
module.component(NAME, COMPONENT);
|
||||
|
|
|
@ -2,12 +2,13 @@ import {module} from '../../module';
|
|||
require('./style.css');
|
||||
|
||||
class Controller {
|
||||
constructor($element, $scope, $document, $compile, vnPopover) {
|
||||
constructor($element, $scope, $document, $compile, vnPopover, $window) {
|
||||
this.element = $element[0];
|
||||
this.$scope = $scope;
|
||||
this.$document = $document;
|
||||
this.$compile = $compile;
|
||||
this.vnPopover = vnPopover;
|
||||
this.$window = $window;
|
||||
}
|
||||
onClick(event) {
|
||||
var child = this.$document[0].createElement(this.popover);
|
||||
|
@ -26,11 +27,14 @@ class Controller {
|
|||
this.onSubmit();
|
||||
}
|
||||
onSubmit() {
|
||||
if(this.onSearch)
|
||||
if (this.onSearch)
|
||||
this.onSearch();
|
||||
}
|
||||
$onDestroy() {
|
||||
this.$window.sessionStorage.removeItem('filter');
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$element', '$scope', '$document', '$compile', 'vnPopover'];
|
||||
Controller.$inject = ['$element', '$scope', '$document', '$compile', 'vnPopover', '$window'];
|
||||
|
||||
export const NAME = 'vnSearchbar'
|
||||
export const COMPONENT = {
|
||||
|
|
10
db.json
10
db.json
|
@ -10,8 +10,8 @@
|
|||
"Province": 44,
|
||||
"Agency": 4,
|
||||
"Account": 32,
|
||||
"ClientObservation": 1272,
|
||||
"ACL": 2
|
||||
"ACL": 2,
|
||||
"ClientObservation": 1274
|
||||
},
|
||||
"models": {
|
||||
"User": {
|
||||
|
@ -144,6 +144,10 @@
|
|||
"1270": "{\"text\":\"7777\",\"creationDate\":\"2017-02-07T09:12:13.000Z\",\"id\":1270}",
|
||||
"1271": "{\"text\":\"dddd\",\"creationDate\":\"2017-02-07T09:12:39.000Z\",\"id\":1271}"
|
||||
},
|
||||
"ACL": {}
|
||||
"ACL": {
|
||||
"1271": "{\"text\":\"dddd\",\"creationDate\":\"2017-02-07T09:12:39.000Z\",\"id\":1271}",
|
||||
"1272": "{\"text\":\"12121\",\"creationDate\":\"2017-03-09T13:29:01.000Z\",\"id\":1272}",
|
||||
"1273": "{\"text\":\"23232323232323\",\"creationDate\":\"2017-03-09T13:29:28.000Z\",\"id\":1273}"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,11 @@
|
|||
module.exports = function(ClientObservation) {
|
||||
|
||||
ClientObservation.validate('text',isEnabled,{message: 'Se debe rellenar el campo de texto'});
|
||||
ClientObservation.validate('text', isEnabled, {message: 'Se debe rellenar el campo de texto'});
|
||||
function isEnabled(err) {
|
||||
if (!this.text) err();
|
||||
if (!this.text) err();
|
||||
}
|
||||
|
||||
ClientObservation.observe('before save', function (ctx, next) {
|
||||
ClientObservation.observe('before save', function(ctx, next) {
|
||||
ctx.instance.creationDate = Date();
|
||||
next();
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
"model": "SalesPerson",
|
||||
"foreignKey": "id"
|
||||
},
|
||||
"client": {
|
||||
"clients": {
|
||||
"type": "hasOne",
|
||||
"model": "Client",
|
||||
"type": "belongsTo",
|
||||
"foreignKey": "id"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
module.exports = function(server) {
|
||||
//server.enableAuth();
|
||||
server.enableAuth();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue