43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
|
import ngModule from '../module';
|
||
|
import Section from 'salix/components/section';
|
||
|
|
||
|
export default class Controller extends Section {
|
||
|
constructor($element, $) {
|
||
|
super($element, $);
|
||
|
|
||
|
this.entry = {
|
||
|
companyFk: this.vnConfig.companyFk
|
||
|
};
|
||
|
|
||
|
if (this.$params && this.$params.supplierFk)
|
||
|
this.entry.supplierFk = parseInt(this.$params.supplierFk);
|
||
|
if (this.$params && this.$params.travelFk)
|
||
|
this.entry.travelFk = parseInt(this.$params.travelFk);
|
||
|
if (this.$params && this.$params.companyFk)
|
||
|
this.entry.companyFk = parseInt(this.$params.companyFk);
|
||
|
}
|
||
|
|
||
|
onSubmit() {
|
||
|
this.$.watcher.submit().then(
|
||
|
res => this.$state.go('entry.card.basicData', {id: res.data.id})
|
||
|
);
|
||
|
}
|
||
|
|
||
|
searchFunction($search) {
|
||
|
return {or: [
|
||
|
{'am.name': {like: `%${$search}%`}},
|
||
|
{'win.name': {like: `%${$search}%`}},
|
||
|
{'wout.name': {like: `%${$search}%`}},
|
||
|
{'t.shipped': new Date($search)},
|
||
|
{'t.landed': new Date($search)}
|
||
|
]};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Controller.$inject = ['$element', '$scope'];
|
||
|
|
||
|
ngModule.vnComponent('vnEntryCreate', {
|
||
|
template: require('./index.html'),
|
||
|
controller: Controller
|
||
|
});
|