travel descriptor quicklinks
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-11-16 14:50:03 +01:00
parent 55a1ae0348
commit c0b2ef9666
3 changed files with 56 additions and 1 deletions

View File

@ -37,6 +37,9 @@
"m3": {
"type": "Number"
},
"cargoSupplierFk": {
"type": "Number"
},
"agencyModeFk": {
"type": "Number",
"mysql": {

View File

@ -24,5 +24,23 @@
value="{{$ctrl.travel.totalEntries}}">
</vn-label-value>
</div>
<div class="quicklinks">
<div ng-transclude="btnOne">
<vn-quick-link
tooltip="All travels with current agency"
state="['travel.index', {q: $ctrl.travelFilter}]"
icon="local_airport">
</vn-quick-link>
</div>
<div ng-transclude="btnTwo">
<vn-quick-link
tooltip="All entries with current supplier"
state="['entry.index', {q: $ctrl.entryFilter}]"
icon="icon-entry">
</vn-quick-link>
</div>
<div ng-transclude="btnThree">
</div>
</div>
</slot-body>
</vn-descriptor-content>

View File

@ -10,6 +10,39 @@ class Controller extends Descriptor {
this.entity = value;
}
get travelFilter() {
let travelFilter;
const travel = this.travel;
if (travel && travel.agencyFk) {
travelFilter = this.travel && JSON.stringify({
agencyFk: this.travel.agencyFk
});
}
return travelFilter;
}
get entryFilter() {
let travel = this.travel;
if (!travel || !travel.landed) return null;
const date = new Date(travel.landed);
date.setHours(0, 0, 0, 0);
const from = new Date(date.getTime());
from.setDate(from.getDate() - 10);
const to = new Date(date.getTime());
to.setDate(to.getDate() + 10);
return JSON.stringify({
supplierFk: this.travel.cargoSupplierFk,
from,
to
});
}
loadData() {
const filter = {
fields: [
@ -19,7 +52,8 @@ class Controller extends Descriptor {
'landed',
'totalEntries',
'warehouseInFk',
'warehouseOutFk'
'warehouseOutFk',
'cargoSupplierFk'
],
include: [
{