bug fixed filter in clients
This commit is contained in:
parent
7dfed60e7d
commit
9fa608b11f
|
@ -25,7 +25,7 @@ class DatePicker extends Component {
|
||||||
this.$filter = $filter;
|
this.$filter = $filter;
|
||||||
this.$timeout = $timeout;
|
this.$timeout = $timeout;
|
||||||
this.enabled = true;
|
this.enabled = true;
|
||||||
this._modelView = '';
|
this._modelView = null;
|
||||||
this._model = undefined;
|
this._model = undefined;
|
||||||
|
|
||||||
componentHandler.upgradeElement($element[0].firstChild);
|
componentHandler.upgradeElement($element[0].firstChild);
|
||||||
|
@ -70,7 +70,7 @@ class DatePicker extends Component {
|
||||||
parts.push(fromatEquivalence[val]);
|
parts.push(fromatEquivalence[val]);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (string.indexOf(' ') !== -1) { // datetime format
|
if (string.indexOf(' ') !== -1 || string.indexOf('T') !== -1) { // datetime format
|
||||||
let dates = parts.slice(0, 3).join('-');
|
let dates = parts.slice(0, 3).join('-');
|
||||||
let hours = parts.slice(3, parts.length).join(':');
|
let hours = parts.slice(3, parts.length).join(':');
|
||||||
return `${dates} ${hours}`.trim();
|
return `${dates} ${hours}`.trim();
|
||||||
|
|
|
@ -10,17 +10,17 @@ export default class Controller {
|
||||||
this.$window = $window;
|
this.$window = $window;
|
||||||
}
|
}
|
||||||
onClick(event) {
|
onClick(event) {
|
||||||
var child = this.vnPopover.showComponent(this.popover, this.$scope, this.element);
|
this.child = this.vnPopover.showComponent(this.popover, this.$scope, this.element);
|
||||||
|
|
||||||
// XXX: ¿Existe una forma más adecuada de acceder al controlador de un componente?
|
// XXX: ¿Existe una forma más adecuada de acceder al controlador de un componente?
|
||||||
var childCtrl = angular.element(child).isolateScope().$ctrl;
|
var childCtrl = angular.element(this.child).isolateScope().$ctrl;
|
||||||
childCtrl.filter = Object.assign({}, this.index.filter);
|
childCtrl.filter = Object.assign({}, this.index.filter);
|
||||||
childCtrl.onSubmit = filter => this.onChildSubmit(filter);
|
childCtrl.onSubmit = filter => this.onChildSubmit(filter);
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
onChildSubmit(filter) {
|
onChildSubmit(filter) {
|
||||||
this.vnPopover.hide();
|
// this.vnPopover.hide();
|
||||||
Object.assign(this.index.filter, filter);
|
Object.assign(this.index.filter, filter);
|
||||||
this.onSubmit();
|
this.onSubmit();
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,10 @@ export default class Controller {
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
if (this.onSearch)
|
if (this.onSearch)
|
||||||
this.onSearch();
|
this.onSearch();
|
||||||
|
|
||||||
|
angular.element(this.child).scope().$destroy();
|
||||||
|
angular.element(this.child).remove();
|
||||||
|
delete this.child;
|
||||||
}
|
}
|
||||||
$onDestroy() {
|
$onDestroy() {
|
||||||
this.$window.sessionStorage.removeItem('filter');
|
this.$window.sessionStorage.removeItem('filter');
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports = function(Client){
|
||||||
}
|
}
|
||||||
|
|
||||||
function andWhere(p){
|
function andWhere(p){
|
||||||
return {
|
let where = {
|
||||||
where: {
|
where: {
|
||||||
id: p.id,
|
id: p.id,
|
||||||
name: {regexp: p.name},
|
name: {regexp: p.name},
|
||||||
|
@ -30,14 +30,17 @@ module.exports = function(Client){
|
||||||
socialName: {regexp: p.socialName},
|
socialName: {regexp: p.socialName},
|
||||||
city: {regexp: p.city},
|
city: {regexp: p.city},
|
||||||
postcode: p.postcode,
|
postcode: p.postcode,
|
||||||
email: {regexp: p.email},
|
email: {regexp: p.email}
|
||||||
or: [
|
|
||||||
{phone: p.phone},
|
|
||||||
{mobile: p.phone}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
skip: (p.page - 1) * p.size,
|
skip: (p.page - 1) * p.size,
|
||||||
limit: p.size
|
limit: p.size
|
||||||
|
};
|
||||||
|
if(p.phone){
|
||||||
|
where.or = [
|
||||||
|
{phone: p.phone},
|
||||||
|
{mobile: p.phone}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
return where;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue