salix/modules/invoiceIn/front/serial-search-panel/index.js

45 lines
1.0 KiB
JavaScript
Raw Normal View History

2023-03-27 12:29:22 +00:00
import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel';
import './style.scss';
class Controller extends SearchPanel {
constructor($element, $) {
super($element, $);
2023-03-28 09:34:14 +00:00
this.filter = {};
2023-03-27 12:29:22 +00:00
const filter = {
fields: ['daysAgo']
};
2023-03-28 09:34:14 +00:00
this.$http.get('InvoiceInConfigs', {filter}).then(res => {
if (res.data) {
this.invoiceInConfig = res.data[0];
this.addFilters();
}
});
2023-03-27 12:29:22 +00:00
}
removeItemFilter(param) {
this.filter[param] = null;
this.addFilters();
}
onKeyPress($event) {
if ($event.key === 'Enter')
this.addFilters();
}
addFilters() {
2023-03-28 09:34:14 +00:00
if (!this.filter.daysAgo)
this.filter.daysAgo = this.invoiceInConfig.daysAgo;
2023-03-27 12:29:22 +00:00
return this.model.addFilter({}, this.filter);
}
}
ngModule.component('vnInvoiceInSerialSearchPanel', {
template: require('./index.html'),
controller: Controller,
bindings: {
model: '<'
}
});