salix/modules/entry/front/descriptor/index.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-01-10 10:52:35 +00:00
import ngModule from '../module';
2020-04-25 09:50:04 +00:00
import Descriptor from 'salix/components/descriptor';
2020-01-10 10:52:35 +00:00
2020-04-25 09:50:04 +00:00
class Controller extends Descriptor {
2020-02-21 11:48:34 +00:00
get entry() {
return this.entity;
2020-02-21 11:48:34 +00:00
}
set entry(value) {
this.entity = value;
}
2020-02-21 11:48:34 +00:00
get travelFilter() {
return JSON.stringify({agencyFk: this.entry.travel.agencyFk});
}
2020-02-21 11:48:34 +00:00
get entryFilter() {
const date = new Date(this.entry.travel.landed);
date.setHours(0, 0, 0, 0);
2020-02-21 11:48:34 +00:00
const from = new Date(date.getTime());
2020-02-21 11:48:34 +00:00
from.setDate(from.getDate() - 10);
const to = new Date(date.getTime());
to.setDate(to.getDate() + 10);
2020-02-21 11:48:34 +00:00
return JSON.stringify({
supplierFk: this.entry.travel.supplierFk,
from,
to
});
2020-02-21 11:48:34 +00:00
}
showEntryReport() {
this.showReport('entry-order', {
clientId: this.vnConfig.storage.currentUserWorkerId,
entryId: this.entry.id
});
}
2020-01-10 10:52:35 +00:00
}
2020-04-25 09:50:04 +00:00
ngModule.vnComponent('vnEntryDescriptor', {
2020-01-10 10:52:35 +00:00
template: require('./index.html'),
2020-04-25 09:50:04 +00:00
controller: Controller,
2020-01-10 10:52:35 +00:00
bindings: {
2020-04-25 09:50:04 +00:00
entry: '<'
}
2020-01-10 10:52:35 +00:00
});