entry search panel changes
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Bernat Exposito 2021-01-14 09:26:50 +01:00
parent 33289b3ac1
commit a45a76018b
5 changed files with 17 additions and 7 deletions

View File

@ -721,9 +721,9 @@ export default {
}, },
workerSummary: { workerSummary: {
header: 'vn-worker-summary h5', header: 'vn-worker-summary h5',
id: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(2) > section > span', id: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(3) > section > span',
email: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(3) > section > span', email: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(4) > section > span',
department: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(4) > section > span', department: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(5) > section > span',
userId: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(2) > section > span', userId: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(2) > section > span',
userName: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(3) > section > span', userName: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(3) > section > span',
role: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(4) > section > span', role: 'vn-worker-summary vn-one:nth-child(2) > vn-label-value:nth-child(4) > section > span',

View File

@ -93,7 +93,12 @@ module.exports = Self => {
let where = buildFilter(ctx.args, (param, value) => { let where = buildFilter(ctx.args, (param, value) => {
switch (param) { switch (param) {
case 'search': case 'search':
return {'e.id': value}; return /^\d+$/.test(value)
? {'e.id': value}
: {or: [
{'s.name': {like: `%${value}%`}},
{'s.nickname': {like: `%${value}%`}}
]};
case 'ref': case 'ref':
param = `e.${param}`; param = `e.${param}`;
return {[param]: {like: `%${value}%`}}; return {[param]: {like: `%${value}%`}};
@ -141,6 +146,7 @@ module.exports = Self => {
e.invoiceInFk, e.invoiceInFk,
t.landed, t.landed,
s.name AS supplierName, s.name AS supplierName,
s.nickname AS supplierAlias,
co.code AS companyCode, co.code AS companyCode,
cu.code AS currencyCode cu.code AS currencyCode
FROM vn.entry e FROM vn.entry e

View File

@ -8,7 +8,7 @@
<vn-searchbar <vn-searchbar
vn-focus vn-focus
panel="vn-entry-search-panel" panel="vn-entry-search-panel"
info="Search entrys by id" info="Search entries by id, supplier name or supplier alias"
model="model"> model="model">
</vn-searchbar> </vn-searchbar>
</vn-portal> </vn-portal>

View File

@ -5,7 +5,7 @@
vn-one vn-one
label="General search" label="General search"
ng-model="filter.search" ng-model="filter.search"
info="Search entries by id" info="Search entries by id, supplier name or supplier alias"
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
@ -45,8 +45,11 @@
label="Supplier" label="Supplier"
ng-model="filter.supplierFk" ng-model="filter.supplierFk"
url="Suppliers" url="Suppliers"
fields="['name','nickname']"
search-function="{or: [{nickname: {like: '%'+ $search +'%'}}, {name: {like: '%'+ $search +'%'}}]}"
show-field="name" show-field="name"
value-field="id"> value-field="id">
<tpl-item>{{name}}: {{nickname}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-date-picker <vn-date-picker
vn-one vn-one

View File

@ -5,3 +5,4 @@ From: Desde
To: Hasta To: Hasta
Agency: Agencia Agency: Agencia
Warehouse: Almacén Warehouse: Almacén
Search entries by id, supplier name or supplier alias: Buscar entradas por id, nombre del proveedor o alias del proveedor