vnSearchbar - General search reflected in a new field in the panel

This commit is contained in:
Juan 2018-11-05 10:14:31 +01:00
parent 5a52035dac
commit f02f3938dd
9 changed files with 96 additions and 20 deletions

View File

@ -3,11 +3,18 @@
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield
vn-one vn-one
label="Name" label="General search"
model="filter.name" model="filter.search"
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Name"
model="filter.name">
</vn-textfield>
</vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-autocomplete <vn-autocomplete
vn-one vn-one

View File

@ -3,11 +3,18 @@
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield
vn-one vn-one
label="Client" label="General search"
model="filter.client" model="filter.search"
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Client"
model="filter.client">
</vn-textfield>
</vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield
vn-one vn-one

View File

@ -1,22 +1,61 @@
<div pad-large style="min-width: 30em"> <div pad-large style="min-width: 30em">
<form ng-submit="$ctrl.onSearch()"> <form ng-submit="$ctrl.onSearch()">
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Client id" model="filter.id" vn-focus></vn-textfield> <vn-textfield
<vn-textfield vn-one label="Tax number" model="filter.fi"></vn-textfield> vn-one
label="General search"
model="filter.search"
vn-focus>
</vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Name" model="filter.name"></vn-textfield> <vn-textfield
vn-one
label="Client id"
model="filter.id">
</vn-textfield>
<vn-textfield
vn-one
label="Tax number"
model="filter.fi">
</vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Social name" model="filter.socialName"></vn-textfield> <vn-textfield
vn-one label="Name"
model="filter.name">
</vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Town/City" model="filter.city"></vn-textfield> <vn-textfield
<vn-textfield vn-one label="Postcode" model="filter.postcode"></vn-textfield> vn-one
label="Social name"
model="filter.socialName">
</vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield vn-one label="Email" model="filter.email"></vn-textfield> <vn-textfield
<vn-textfield vn-one label="Phone" model="filter.phone"></vn-textfield> vn-one
label="Town/City"
model="filter.city">
</vn-textfield>
<vn-textfield
vn-one
label="Postcode"
model="filter.postcode">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Email"
model="filter.email">
</vn-textfield>
<vn-textfield
vn-one
label="Phone"
model="filter.phone">
</vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal margin-large-top> <vn-horizontal margin-large-top>
<vn-submit label="Search"></vn-submit> <vn-submit label="Search"></vn-submit>

View File

@ -159,14 +159,13 @@ export default class Controller extends Component {
let regex = /((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi; let regex = /((([\w_]+):([\w_]+))|([\w_]+):\(([\w_ ]+)\))/gi;
let findPattern = searchString.match(regex); let findPattern = searchString.match(regex);
let remnantString = searchString.replace(regex, '').trim(); let remnantString = searchString.replace(regex, '').trim();
if (findPattern) { if (findPattern)
for (let i = 0; i < findPattern.length; i++) { for (let i = 0; i < findPattern.length; i++) {
let aux = findPattern[i].split(':'); let aux = findPattern[i].split(':');
let property = aux[0]; let property = aux[0];
let value = aux[1].replace(/\(|\)/g, ''); let value = aux[1].replace(/\(|\)/g, '');
result[property] = value.trim(); result[property] = value.trim();
} }
}
if (remnantString) if (remnantString)
result.search = remnantString; result.search = remnantString;
} }

View File

@ -12,4 +12,5 @@ Next: Next
Finalize: Finalize Finalize: Finalize
Previous: Back Previous: Back
Load more: Load more Load more: Load more
Auto-scroll interrupted, please adjust the search: Auto-scroll interrupted, please adjust the search Auto-scroll interrupted, please adjust the search: Auto-scroll interrupted, please adjust the search
General search: General search

View File

@ -23,4 +23,5 @@ Value can't be null: El valor no puede ser nulo
Value should be %s characters long: El valor debe ser de %s carácteres de longitud Value should be %s characters long: El valor debe ser de %s carácteres de longitud
Value should have a length between %s and %s: El valor debe tener una longitud de entre %s y %s Value should have a length between %s and %s: El valor debe tener una longitud de entre %s y %s
Value should have at least %s characters: El valor debe tener al menos %s carácteres Value should have at least %s characters: El valor debe tener al menos %s carácteres
Value should have at most %s characters: El valor debe tener un máximo de %s carácteres Value should have at most %s characters: El valor debe tener un máximo de %s carácteres
General search: Busqueda general

View File

@ -4,10 +4,17 @@
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield
vn-one vn-one
label="Id" label="General search"
model="filter.id" model="filter.search"
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Id"
model="filter.id">
</vn-textfield>
<vn-textfield <vn-textfield
vn-one vn-one
label="Name" label="Name"

View File

@ -1,5 +1,13 @@
<div pad-large style="min-width: 30em"> <div pad-large style="min-width: 30em">
<form ng-submit="$ctrl.onSearch()"> <form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield
vn-one
label="General search"
model="filter.search"
vn-focus>
</vn-textfield>
</vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield
vn-one vn-one

View File

@ -3,11 +3,18 @@
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield
vn-one vn-one
label="Nickname" label="General search"
model="filter.nickname" model="filter.search"
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Nickname"
model="filter.nickname">
</vn-textfield>
</vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield
vn-one vn-one