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