Merge pull request 'fix searchbar index' (#491) from 2625-travel_index into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #491
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2020-12-23 11:51:10 +00:00
commit c740767599
8 changed files with 18 additions and 9 deletions

View File

@ -1638,7 +1638,7 @@ INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`)
INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`) INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`)
VALUES VALUES
(1, 2, 69), (1, 1, 69),
(5, 1, 442), (5, 1, 442),
(9, 1, 442), (9, 1, 442),
(18, 3, 567); (18, 3, 567);

View File

@ -71,7 +71,7 @@ describe('User config', () => {
expect(expectedLocalWarehouse).toBeTruthy(); expect(expectedLocalWarehouse).toBeTruthy();
expect(expectedLocalBank).toBeTruthy(); expect(expectedLocalBank).toBeTruthy();
expect(expectedLocalCompany).toBeTruthy(); expect(expectedLocalCompany).toBeTruthy();
expect(userWarehouse).toEqual('Warehouse Two'); expect(userWarehouse).toEqual('Warehouse One');
expect(userCompany).toEqual('CCs'); expect(userCompany).toEqual('CCs');
}); });

View File

@ -2,15 +2,14 @@
vn-id="model" vn-id="model"
url="Routes/filter" url="Routes/filter"
limit="20" limit="20"
order="created DESC" order="created DESC">
auto-load="true">
</vn-crud-model> </vn-crud-model>
<vn-portal slot="topbar"> <vn-portal slot="topbar">
<vn-searchbar <vn-searchbar
vn-focus vn-focus
panel="vn-route-search-panel" panel="vn-route-search-panel"
info="Search routes by id" info="Search routes by id"
filter="$ctrl.filter" filter="$ctrl.filterParams"
model="model"> model="model">
</vn-searchbar> </vn-searchbar>
</vn-portal> </vn-portal>

View File

@ -10,7 +10,8 @@ export default class Route extends ModuleMain {
let from = new Date(); let from = new Date();
from.setHours(0, 0, 0, 0); from.setHours(0, 0, 0, 0);
this.filter = {from, to, warehouseFk: this.vnConfig.warehouseFk}; this.filterParams = {from, to, warehouseFk: this.vnConfig.warehouseFk};
this.$.model.applyFilter(null, this.filterParams);
} }
} }

View File

@ -11,7 +11,7 @@
info="Search ticket by id or alias" info="Search ticket by id or alias"
model="model" model="model"
fetch-params="$ctrl.fetchParams($params)" fetch-params="$ctrl.fetchParams($params)"
suggested-filter="$ctrl.defaultFilter"> suggested-filter="$ctrl.filterParams">
</vn-searchbar> </vn-searchbar>
</vn-portal> </vn-portal>
<vn-portal slot="menu"> <vn-portal slot="menu">

View File

@ -5,7 +5,7 @@ export default class Ticket extends ModuleMain {
constructor() { constructor() {
super(); super();
this.defaultFilter = { this.filterParams = {
scopeDays: 1 scopeDays: 1
}; };
} }

View File

@ -10,7 +10,8 @@
panel="vn-travel-search-panel" panel="vn-travel-search-panel"
info="Search travels by id" info="Search travels by id"
model="model" model="model"
fetch-params="$ctrl.fetchParams($params)"> fetch-params="$ctrl.fetchParams($params)"
suggested-filter="$ctrl.filterParams">
</vn-searchbar> </vn-searchbar>
</vn-portal> </vn-portal>
<vn-portal slot="menu"> <vn-portal slot="menu">

View File

@ -2,6 +2,14 @@ import ngModule from '../module';
import ModuleMain from 'salix/components/module-main'; import ModuleMain from 'salix/components/module-main';
export default class Travel extends ModuleMain { export default class Travel extends ModuleMain {
constructor() {
super();
this.filterParams = {
scopeDays: 1
};
}
fetchParams($params) { fetchParams($params) {
if (!Object.entries($params).length) if (!Object.entries($params).length)
$params.scopeDays = 1; $params.scopeDays = 1;