mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
fix: FastField re-rendering.
fix: Allocate landed cost dialog.
This commit is contained in:
@@ -71,7 +71,6 @@ export default class CashFlowController extends BaseFinancialReportController {
|
||||
/**
|
||||
* Transformes the report statement to table rows.
|
||||
* @param {ITransactionsByVendorsStatement} statement -
|
||||
*
|
||||
*/
|
||||
private transformToTableRows(cashFlowDOO: ICashFlowStatementDOO, tenantId: number) {
|
||||
const i18n = this.tenancy.i18n(tenantId);
|
||||
|
||||
@@ -45,7 +45,7 @@ export default class VendorBalanceSummaryReportController extends BaseFinancialR
|
||||
* Transformes the report statement to table rows.
|
||||
* @param {IVendorBalanceSummaryStatement} statement -
|
||||
*/
|
||||
transformToTableRows({ data }: IVendorBalanceSummaryStatement) {
|
||||
private transformToTableRows({ data }: IVendorBalanceSummaryStatement) {
|
||||
return {
|
||||
table: {
|
||||
data: this.vendorBalanceSummaryTableRows.tableRowsTransformer(data),
|
||||
@@ -57,7 +57,10 @@ export default class VendorBalanceSummaryReportController extends BaseFinancialR
|
||||
* Transformes the report statement to raw json.
|
||||
* @param {IVendorBalanceSummaryStatement} statement -
|
||||
*/
|
||||
transformToJsonResponse({ data, columns }: IVendorBalanceSummaryStatement) {
|
||||
private transformToJsonResponse({
|
||||
data,
|
||||
columns,
|
||||
}: IVendorBalanceSummaryStatement) {
|
||||
return {
|
||||
data: this.transfromToResponse(data),
|
||||
columns: this.transfromToResponse(columns),
|
||||
@@ -76,10 +79,11 @@ export default class VendorBalanceSummaryReportController extends BaseFinancialR
|
||||
const filter = this.matchedQueryData(req);
|
||||
|
||||
try {
|
||||
const vendorBalanceSummary = await this.vendorBalanceSummaryService.vendorBalanceSummary(
|
||||
tenantId,
|
||||
filter
|
||||
);
|
||||
const vendorBalanceSummary =
|
||||
await this.vendorBalanceSummaryService.vendorBalanceSummary(
|
||||
tenantId,
|
||||
filter
|
||||
);
|
||||
const accept = this.accepts(req);
|
||||
const acceptType = accept.types(['json', 'application/json+table']);
|
||||
|
||||
|
||||
@@ -192,7 +192,10 @@ export default class BillAllocateLandedCost extends BaseController {
|
||||
billId
|
||||
);
|
||||
|
||||
return res.status(200).send({ billId, transactions });
|
||||
return res.status(200).send({
|
||||
billId,
|
||||
transactions: this.transfromToResponse(transactions)
|
||||
});
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { ref } from 'objection';
|
||||
import { ref, transaction } from 'objection';
|
||||
import {
|
||||
ILandedCostTransactionsQueryDTO,
|
||||
ILandedCostTransaction,
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
import TransactionLandedCost from './TransctionLandedCost';
|
||||
import BillsService from '../Bills';
|
||||
import HasTenancyService from 'services/Tenancy/TenancyService';
|
||||
import { formatNumber } from 'utils';
|
||||
|
||||
@Service()
|
||||
export default class LandedCostListing {
|
||||
@@ -71,8 +72,15 @@ export default class LandedCostListing {
|
||||
|
||||
const landedCostTransactions = await BillLandedCost.query()
|
||||
.where('bill_id', billId)
|
||||
.withGraphFetched('allocateEntries');
|
||||
.withGraphFetched('allocateEntries')
|
||||
.withGraphFetched('bill');
|
||||
|
||||
return landedCostTransactions;
|
||||
return landedCostTransactions.map((transaction) => ({
|
||||
...transaction.toJSON(),
|
||||
formattedAmount: formatNumber(
|
||||
transaction.amount,
|
||||
transaction.bill.currencyCode
|
||||
),
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user