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`)
VALUES
(1, 2, 69),
(1, 1, 69),
(5, 1, 442),
(9, 1, 442),
(18, 3, 567);

View File

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

View File

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

View File

@ -10,7 +10,8 @@ export default class Route extends ModuleMain {
let from = new Date();
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"
model="model"
fetch-params="$ctrl.fetchParams($params)"
suggested-filter="$ctrl.defaultFilter">
suggested-filter="$ctrl.filterParams">
</vn-searchbar>
</vn-portal>
<vn-portal slot="menu">

View File

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

View File

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

View File

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