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() {
|
2020-04-30 10:48:52 +00:00
|
|
|
return this.entity;
|
2020-02-21 11:48:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set entry(value) {
|
2020-04-30 10:48:52 +00:00
|
|
|
this.entity = value;
|
|
|
|
}
|
2020-02-21 11:48:34 +00:00
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
get travelFilter() {
|
2020-05-06 12:38:09 +00:00
|
|
|
return this.entry && JSON.stringify({
|
|
|
|
agencyFk: this.entry.travel.agencyFk
|
|
|
|
});
|
2020-04-30 10:48:52 +00:00
|
|
|
}
|
2020-02-21 11:48:34 +00:00
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
get entryFilter() {
|
2020-05-06 12:38:09 +00:00
|
|
|
if (!this.entry) return null;
|
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
const date = new Date(this.entry.travel.landed);
|
|
|
|
date.setHours(0, 0, 0, 0);
|
2020-02-21 11:48:34 +00:00
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
const from = new Date(date.getTime());
|
2020-02-21 11:48:34 +00:00
|
|
|
from.setDate(from.getDate() - 10);
|
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
const to = new Date(date.getTime());
|
|
|
|
to.setDate(to.getDate() + 10);
|
2020-02-21 11:48:34 +00:00
|
|
|
|
2020-04-30 10:48:52 +00:00
|
|
|
return JSON.stringify({
|
2020-05-06 12:38:09 +00:00
|
|
|
supplierFk: this.entry.supplierFk,
|
2020-04-30 10:48:52 +00:00
|
|
|
from,
|
|
|
|
to
|
|
|
|
});
|
2020-02-21 11:48:34 +00:00
|
|
|
}
|
|
|
|
|
2020-02-24 11:20:53 +00:00
|
|
|
showEntryReport() {
|
2020-04-30 10:48:52 +00:00
|
|
|
this.showReport('entry-order', {
|
2020-02-24 11:20:53 +00:00
|
|
|
clientId: this.vnConfig.storage.currentUserWorkerId,
|
|
|
|
entryId: this.entry.id
|
2020-04-30 10:48:52 +00:00
|
|
|
});
|
2020-02-24 11:20:53 +00:00
|
|
|
}
|
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
|
|
|
});
|