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

View File

@ -1,6 +1,6 @@
<div class="search-panel">
<form class="vn-pa-lg" ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<form id="manifold-form" ng-submit="$ctrl.onSearch()">
<vn-horizontal class="vn-px-lg vn-pt-lg">
<vn-textfield
vn-one
label="General search"
@ -8,20 +8,20 @@
vn-focus>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-horizontal class="vn-px-lg">
<vn-autocomplete vn-one
url="AgencyModes"
label="Agency route"
show-field="name"
value-field="name"
ng-model="filter.agencyFk">
value-field="id"
ng-model="filter.agencyModeFk">
</vn-autocomplete>
<vn-autocomplete vn-one
url="Agencies"
label="Agency Agreement"
show-field="name"
value-field="name"
ng-model="filter.agencyAgreement">
value-field="id"
ng-model="filter.agencyFk">
</vn-autocomplete>
</vn-horizontal>
<section class="vn-px-md">
@ -38,10 +38,6 @@
ng-model="filter.to"
on-change="$ctrl.to = value">
</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>
</section>
<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';
class Controller extends SearchPanel {
get from() {
return this._from;
get filter() {
return this.$.filter;
}
set from(value) {
this._from = value;
this.filter.scopeDays = null;
}
set filter(value = {}) {
if (!value.tags) value.tags = [{}];
get to() {
return this._to;
}
set to(value) {
this._to = value;
this.filter.scopeDays = null;
this.$.filter = value;
}
}

View File

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

View File

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

View File

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