correction panel-search
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-03-16 14:42:19 +01:00
parent 26f77ca07e
commit 1094bbe92b
6 changed files with 35 additions and 47 deletions

View File

@ -18,19 +18,19 @@ module.exports = Self => {
description: `If it's and integer searchs by invoiceInFk, otherwise it searchs by the supplierName`, description: `If it's and integer searchs by invoiceInFk, otherwise it searchs by the supplierName`,
}, },
{ {
arg: 'agencyFk', arg: 'agencyModeFk',
type: 'integer', type: 'integer',
description: 'The agency route name', description: 'The agency agencyModeFk id',
}, },
{ {
arg: 'agencyAgreement', arg: 'agencyFk',
type: 'integer', type: 'integer',
description: 'The agencyMode id', description: 'The agencyFk id',
}, },
{ {
arg: 'from', arg: 'from',
type: 'date', type: 'date',
description: 'The to date filter', description: 'The from date filter',
}, },
{ {
arg: 'to', arg: 'to',
@ -59,16 +59,16 @@ module.exports = Self => {
switch (param) { switch (param) {
case 'search': case 'search':
return /^\d+$/.test(value) return /^\d+$/.test(value)
? {'fp.itemFk': {inq: value}} ? {'invoiceInFk': {inq: value}}
: {'it.code': {like: `%${value}%`}}; : {'supplierName': {like: `%${value}%`}};
case 'agencyModeFk':
return {'agencyModeFk': value};
case 'agencyFk': case 'agencyFk':
return {'it.categoryFk': value}; return {'agencyFk': value};
case 'agencyAgreement':
return {'it.workerFk': value};
case 'from': case 'from':
return {'created': {gte: value}};
case 'to': case 'to':
param = `fp.${param}`; return {'created': {lte: value}};
return {[param]: value};
} }
}); });

View File

@ -1,6 +1,6 @@
<div class="search-panel"> <div class="search-panel">
<form class="vn-pa-lg" ng-submit="$ctrl.onSearch()"> <form id="manifold-form" ng-submit="$ctrl.onSearch()">
<vn-horizontal> <vn-horizontal class="vn-px-lg vn-pt-lg">
<vn-textfield <vn-textfield
vn-one vn-one
label="General search" label="General search"
@ -8,20 +8,20 @@
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal class="vn-px-lg">
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="AgencyModes" url="AgencyModes"
label="Agency route" label="Agency route"
show-field="name" show-field="name"
value-field="name" value-field="id"
ng-model="filter.agencyFk"> ng-model="filter.agencyModeFk">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete vn-one <vn-autocomplete vn-one
url="Agencies" url="Agencies"
label="Agency Agreement" label="Agency Agreement"
show-field="name" show-field="name"
value-field="name" value-field="id"
ng-model="filter.agencyAgreement"> ng-model="filter.agencyFk">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<section class="vn-px-md"> <section class="vn-px-md">
@ -38,10 +38,6 @@
ng-model="filter.to" ng-model="filter.to"
on-change="$ctrl.to = value"> on-change="$ctrl.to = value">
</vn-date-picker> </vn-date-picker>
<vn-icon color-marginal
icon="info"
vn-tooltip="Cannot choose a range of dates and days onward at the same time">
</vn-icon>
</vn-horizontal> </vn-horizontal>
</section> </section>
<vn-horizontal class="vn-px-lg vn-pb-lg vn-mt-lg"> <vn-horizontal class="vn-px-lg vn-pb-lg vn-mt-lg">

View File

@ -2,22 +2,14 @@ import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel'; import SearchPanel from 'core/components/searchbar/search-panel';
class Controller extends SearchPanel { class Controller extends SearchPanel {
get from() { get filter() {
return this._from; return this.$.filter;
} }
set from(value) { set filter(value = {}) {
this._from = value; if (!value.tags) value.tags = [{}];
this.filter.scopeDays = null;
}
get to() { this.$.filter = value;
return this._to;
}
set to(value) {
this._to = value;
this.filter.scopeDays = null;
} }
} }

View File

@ -1,7 +1,6 @@
<vn-crud-model <vn-crud-model
vn-id="model" vn-id="model"
url="AgencyTerms/filter" url="AgencyTerms/filter"
filter="::$ctrl.filter"
data="agencyTerms" data="agencyTerms"
auto-load="true"> auto-load="true">
</vn-crud-model> </vn-crud-model>
@ -9,7 +8,7 @@
<vn-searchbar <vn-searchbar
auto-state="false" auto-state="false"
panel="vn-agency-term-search-panel" panel="vn-agency-term-search-panel"
info="Search prices by invoiceIn or autonomous" info="Search by invoiceIn id or autonomous name"
placeholder="Search autonomous" placeholder="Search autonomous"
filter="{}" filter="{}"
model="model"> model="model">
@ -46,10 +45,10 @@
<th field="created"> <th field="created">
<span translate>Date</span> <span translate>Date</span>
</th> </th>
<th field="agencyFk"> <th field="agencyModeFk">
<span translate>Agency route</span> <span translate>Agency route</span>
</th> </th>
<th field="agencyAgreement"> <th field="agencyFk">
<span translate>Agency Agreement</span> <span translate>Agency Agreement</span>
</th> </th>
<th field="packages"> <th field="packages">

View File

@ -12,19 +12,19 @@ class Controller extends Section {
}, },
columns: [ columns: [
{ {
field: 'agencyFk', field: 'agencyModeFk',
autocomplete: { autocomplete: {
url: 'AgencyModes', url: 'AgencyModes',
showField: 'name', showField: 'name',
valueField: 'name' valueField: 'id'
} }
}, },
{ {
field: 'agencyAgreement', field: 'agencyFk',
autocomplete: { autocomplete: {
url: 'Agencies', url: 'Agencies',
showField: 'name', showField: 'name',
valueField: 'name' valueField: 'id'
} }
}, },
{ {
@ -41,14 +41,14 @@ class Controller extends Section {
exprBuilder(param, value) { exprBuilder(param, value) {
switch (param) { switch (param) {
case 'agencyFk': case 'agencyModeFk':
return {'a.agencyModeName': value}; return {'a.agencyModeFk': value};
case 'supplierFk': case 'supplierFk':
return {'a.supplierName': value}; return {'a.supplierName': value};
case 'routeFk': case 'routeFk':
return {'a.routeFk': value}; return {'a.routeFk': value};
case 'created': case 'created':
case 'agencyAgreement': case 'agencyFk':
case 'packages': case 'packages':
case 'm3': case 'm3':
case 'kmTotal': case 'kmTotal':

View File

@ -13,4 +13,5 @@ import './log';
import './tickets'; import './tickets';
import './agency-term/index'; import './agency-term/index';
import './agency-term/createInvoiceIn'; import './agency-term/createInvoiceIn';
import './agency-term-search-panel';
import './ticket-popup'; import './ticket-popup';