3092-module_transactions #740
|
@ -1,6 +1,5 @@
|
||||||
<vn-crud-model auto-load="true"
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
params="::$ctrl.filterParams"
|
|
||||||
url="SalesMonitors/salesFilter"
|
url="SalesMonitors/salesFilter"
|
||||||
limit="20"
|
limit="20"
|
||||||
order="shippedDate DESC, shippedHour ASC, zoneLanding ASC, id">
|
order="shippedDate DESC, shippedHour ASC, zoneLanding ASC, id">
|
||||||
|
|
|
@ -6,13 +6,30 @@ export default class Controller extends Section {
|
||||||
constructor($element, $) {
|
constructor($element, $) {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
|
|
||||||
this.filterParams = this.fetchParams({
|
this.filterParams = this.fetchParams();
|
||||||
scopeDays: 1
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchParams($params) {
|
$onInit() {
|
||||||
if (!Object.entries($params).length)
|
if (!this.$params.q) {
|
||||||
|
this.$.$applyAsync(
|
||||||
|
() => this.$.model.applyFilter(null, this.filterParams));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchParams($params = {}) {
|
||||||
|
const excludedParams = [
|
||||||
|
'search',
|
||||||
|
'clientFk',
|
||||||
|
'orderFk',
|
||||||
|
'refFk',
|
||||||
|
'scopeDays'
|
||||||
|
];
|
||||||
|
|
||||||
|
const hasExcludedParams = excludedParams.some(param => {
|
||||||
|
return $params && $params[param];
|
||||||
|
});
|
||||||
|
const hasParams = Object.entries($params).length;
|
||||||
|
if (!hasParams || !hasExcludedParams)
|
||||||
$params.scopeDays = 1;
|
$params.scopeDays = 1;
|
||||||
|
|
||||||
if (typeof $params.scopeDays === 'number') {
|
if (typeof $params.scopeDays === 'number') {
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
panel="vn-ticket-search-panel"
|
panel="vn-ticket-search-panel"
|
||||||
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.filterParams">
|
|
||||||
</vn-searchbar>
|
</vn-searchbar>
|
||||||
</vn-portal>
|
</vn-portal>
|
||||||
<vn-portal slot="menu">
|
<vn-portal slot="menu">
|
||||||
|
|
|
@ -2,16 +2,22 @@ import ngModule from '../module';
|
||||||
import ModuleMain from 'salix/components/module-main';
|
import ModuleMain from 'salix/components/module-main';
|
||||||
|
|
||||||
export default class Ticket extends ModuleMain {
|
export default class Ticket extends ModuleMain {
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.filterParams = {
|
|
||||||
scopeDays: 1
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchParams($params) {
|
fetchParams($params) {
|
||||||
if (!Object.entries($params).length)
|
const excludedParams = [
|
||||||
|
'from',
|
||||||
|
'to',
|
||||||
|
'search',
|
||||||
|
'clientFk',
|
||||||
|
'orderFk',
|
||||||
|
'refFk',
|
||||||
|
'scopeDays'
|
||||||
|
];
|
||||||
|
|
||||||
|
const hasExcludedParams = excludedParams.some(param => {
|
||||||
|
return $params && $params[param];
|
||||||
|
});
|
||||||
|
const hasParams = Object.entries($params).length;
|
||||||
|
if (!hasParams || !hasExcludedParams)
|
||||||
$params.scopeDays = 1;
|
$params.scopeDays = 1;
|
||||||
|
|
||||||
if (typeof $params.scopeDays === 'number') {
|
if (typeof $params.scopeDays === 'number') {
|
||||||
|
@ -25,6 +31,8 @@ export default class Ticket extends ModuleMain {
|
||||||
Object.assign($params, {from, to});
|
Object.assign($params, {from, to});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.filterParams = $params;
|
||||||
|
|
||||||
return $params;
|
return $params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue