diff --git a/modules/route/back/methods/agency-term/filter.js b/modules/route/back/methods/agency-term/filter.js index 854e8702f..ee79a04a7 100644 --- a/modules/route/back/methods/agency-term/filter.js +++ b/modules/route/back/methods/agency-term/filter.js @@ -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}}; } }); diff --git a/modules/route/front/agency-term-search-panel/index.html b/modules/route/front/agency-term-search-panel/index.html index fb6641a52..fec6bf5eb 100644 --- a/modules/route/front/agency-term-search-panel/index.html +++ b/modules/route/front/agency-term-search-panel/index.html @@ -1,6 +1,6 @@
-
- + + - + + value-field="id" + ng-model="filter.agencyModeFk"> + value-field="id" + ng-model="filter.agencyFk">
@@ -38,10 +38,6 @@ ng-model="filter.to" on-change="$ctrl.to = value"> - -
diff --git a/modules/route/front/agency-term-search-panel/index.js b/modules/route/front/agency-term-search-panel/index.js index 4d21e6829..7e9ab43d9 100644 --- a/modules/route/front/agency-term-search-panel/index.js +++ b/modules/route/front/agency-term-search-panel/index.js @@ -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; } } diff --git a/modules/route/front/agency-term/index/index.html b/modules/route/front/agency-term/index/index.html index c33f012e7..0d8ea40e7 100644 --- a/modules/route/front/agency-term/index/index.html +++ b/modules/route/front/agency-term/index/index.html @@ -1,7 +1,6 @@ @@ -9,7 +8,7 @@ @@ -46,10 +45,10 @@ Date - + Agency route - + Agency Agreement diff --git a/modules/route/front/agency-term/index/index.js b/modules/route/front/agency-term/index/index.js index ece7f18da..f73095e7a 100644 --- a/modules/route/front/agency-term/index/index.js +++ b/modules/route/front/agency-term/index/index.js @@ -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': diff --git a/modules/route/front/index.js b/modules/route/front/index.js index d5becd8dd..55cb745e1 100644 --- a/modules/route/front/index.js +++ b/modules/route/front/index.js @@ -13,4 +13,5 @@ import './log'; import './tickets'; import './agency-term/index'; import './agency-term/createInvoiceIn'; +import './agency-term-search-panel'; import './ticket-popup';