WIP: Allocate landed cost.

This commit is contained in:
a.bouhuolia
2021-07-24 03:10:32 +02:00
parent 70aea9bf2d
commit cf2ebe9597
30 changed files with 602 additions and 218 deletions

View File

@@ -1,4 +1,5 @@
import { Model } from 'objection';
import { lowerCase } from 'lodash';
import TenantModel from 'models/TenantModel';
export default class BillLandedCost extends TenantModel {
@@ -16,6 +17,25 @@ export default class BillLandedCost extends TenantModel {
return ['createdAt', 'updatedAt'];
}
/**
* Virtual attributes.
*/
static get virtualAttributes() {
return ['allocationMethodFormatted'];
}
/**
* Allocation method formatted.
*/
get allocationMethodFormatted() {
const allocationMethod = lowerCase(this.allocationMethod);
const keyLabelsPairs = {
value: 'Value',
quantity: 'Quantity',
};
return keyLabelsPairs[allocationMethod] || '';
}
/**
* Relationship mapping.
*/