mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
feat: configure columns of resources export
This commit is contained in:
@@ -244,6 +244,7 @@
|
|||||||
"account.field.active": "Active",
|
"account.field.active": "Active",
|
||||||
"account.field.currency": "Currency",
|
"account.field.currency": "Currency",
|
||||||
"account.field.balance": "Balance",
|
"account.field.balance": "Balance",
|
||||||
|
"account.field.bank_balance": "Bank Balance",
|
||||||
"account.field.parent_account": "Parent Account",
|
"account.field.parent_account": "Parent Account",
|
||||||
"account.field.created_at": "Created at",
|
"account.field.created_at": "Created at",
|
||||||
"item.field.type": "Item Type",
|
"item.field.type": "Item Type",
|
||||||
@@ -331,7 +332,7 @@
|
|||||||
"bill_payment.field.reference_no": "Reference No.",
|
"bill_payment.field.reference_no": "Reference No.",
|
||||||
"bill_payment.field.description": "Description",
|
"bill_payment.field.description": "Description",
|
||||||
"bill_payment.field.exchange_rate": "Exchange Rate",
|
"bill_payment.field.exchange_rate": "Exchange Rate",
|
||||||
"bill_payment.field.statement": "Statement",
|
"bill_payment.field.note": "Note",
|
||||||
"bill_payment.field.entries.bill": "Bill No.",
|
"bill_payment.field.entries.bill": "Bill No.",
|
||||||
"bill_payment.field.entries.payment_amount": "Payment Amount",
|
"bill_payment.field.entries.payment_amount": "Payment Amount",
|
||||||
"bill_payment.field.reference": "Reference No.",
|
"bill_payment.field.reference": "Reference No.",
|
||||||
|
|||||||
@@ -90,56 +90,49 @@ export default {
|
|||||||
name: {
|
name: {
|
||||||
name: 'account.field.name',
|
name: 'account.field.name',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
code: {
|
code: {
|
||||||
name: 'account.field.code',
|
name: 'account.field.code',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
name: 'account.field.description',
|
|
||||||
type: 'text',
|
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
rootType: {
|
rootType: {
|
||||||
name: 'account.field.root_type',
|
name: 'account.field.root_type',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
accessor: 'accountRootType',
|
||||||
},
|
},
|
||||||
accountType: {
|
accountType: {
|
||||||
name: 'account.field.type',
|
name: 'account.field.type',
|
||||||
accessor: 'accountTypeLabel',
|
accessor: 'accountTypeLabel',
|
||||||
type: 'enumeration',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
accountNormal: {
|
accountNormal: {
|
||||||
name: 'account.field.normal',
|
name: 'account.field.normal',
|
||||||
accessor: 'accountNormalFormatted',
|
accessor: 'accountNormalFormatted',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
currencyCode: {
|
currencyCode: {
|
||||||
name: 'account.field.currency',
|
name: 'account.field.currency',
|
||||||
exportable: true,
|
type: 'text',
|
||||||
},
|
},
|
||||||
bankBalance: {
|
bankBalance: {
|
||||||
name: 'account.field.bank_balance',
|
name: 'account.field.bank_balance',
|
||||||
accessor: 'bankBalanceFormatted',
|
accessor: 'bankBalanceFormatted',
|
||||||
|
type: 'text',
|
||||||
exportable: true,
|
exportable: true,
|
||||||
},
|
},
|
||||||
balance: {
|
balance: {
|
||||||
name: 'account.field.bank_balance',
|
name: 'account.field.balance',
|
||||||
accessor: 'amount',
|
accessor: 'amount',
|
||||||
exportable: true,
|
},
|
||||||
|
description: {
|
||||||
|
name: 'account.field.description',
|
||||||
|
type: 'text',
|
||||||
},
|
},
|
||||||
active: {
|
active: {
|
||||||
name: 'account.field.active',
|
name: 'account.field.active',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
createdAt: {
|
createdAt: {
|
||||||
name: 'account.field.created_at',
|
name: 'account.field.created_at',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
|
|||||||
@@ -100,12 +100,29 @@ export default {
|
|||||||
},
|
},
|
||||||
vendorId: {
|
vendorId: {
|
||||||
name: 'Vendor',
|
name: 'Vendor',
|
||||||
|
accessor: 'vendor.displayName',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
},
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Amount',
|
||||||
|
accessor: 'formattedAmount',
|
||||||
|
},
|
||||||
exchangeRate: {
|
exchangeRate: {
|
||||||
name: 'Exchange Rate',
|
name: 'Exchange Rate',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
|
currencyCode: {
|
||||||
|
name: 'Currency Code',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
dueAmount: {
|
||||||
|
name: 'Due Amount',
|
||||||
|
accessor: 'formattedDueAmount',
|
||||||
|
},
|
||||||
|
paidAmount: {
|
||||||
|
name: 'Paid Amount',
|
||||||
|
accessor: 'formattedPaymentAmount'
|
||||||
|
},
|
||||||
note: {
|
note: {
|
||||||
name: 'Note',
|
name: 'Note',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
|
|||||||
@@ -82,16 +82,25 @@ export default {
|
|||||||
name: 'bill_payment.field.payment_number',
|
name: 'bill_payment.field.payment_number',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
},
|
},
|
||||||
paymentAccountId: {
|
paymentAccount: {
|
||||||
name: 'bill_payment.field.payment_account',
|
name: 'bill_payment.field.payment_account',
|
||||||
type: 'relation',
|
accessor: 'paymentAccount.name',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Amount',
|
||||||
|
accessor: 'formattedAmount',
|
||||||
|
},
|
||||||
|
currencyCode: {
|
||||||
|
name: 'Currency Code',
|
||||||
|
type: 'text',
|
||||||
},
|
},
|
||||||
exchangeRate: {
|
exchangeRate: {
|
||||||
name: 'bill_payment.field.exchange_rate',
|
name: 'bill_payment.field.exchange_rate',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
statement: {
|
statement: {
|
||||||
name: 'bill_payment.field.statement',
|
name: 'bill_payment.field.note',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
},
|
},
|
||||||
reference: {
|
reference: {
|
||||||
@@ -131,7 +140,7 @@ export default {
|
|||||||
fieldType: 'number',
|
fieldType: 'number',
|
||||||
},
|
},
|
||||||
statement: {
|
statement: {
|
||||||
name: 'bill_payment.field.statement',
|
name: 'bill_payment.field.note',
|
||||||
fieldType: 'text',
|
fieldType: 'text',
|
||||||
},
|
},
|
||||||
reference: {
|
reference: {
|
||||||
|
|||||||
@@ -161,16 +161,19 @@ export default {
|
|||||||
costAccount: {
|
costAccount: {
|
||||||
name: 'item.field.sell_account',
|
name: 'item.field.sell_account',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
|
accessor: 'costAccount.name',
|
||||||
exportable: true,
|
exportable: true,
|
||||||
},
|
},
|
||||||
sellAccount: {
|
sellAccount: {
|
||||||
name: 'item.field.sell_description',
|
name: 'item.field.sell_description',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
|
accessor: 'sellAccount.name',
|
||||||
exportable: true,
|
exportable: true,
|
||||||
},
|
},
|
||||||
inventoryAccount: {
|
inventoryAccount: {
|
||||||
name: 'item.field.inventory_account',
|
name: 'item.field.inventory_account',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
|
accessor: 'inventoryAccount.name',
|
||||||
exportable: true,
|
exportable: true,
|
||||||
},
|
},
|
||||||
sellDescription: {
|
sellDescription: {
|
||||||
@@ -196,6 +199,7 @@ export default {
|
|||||||
category: {
|
category: {
|
||||||
name: 'item.field.category',
|
name: 'item.field.category',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
|
accessor: 'category.name',
|
||||||
exportable: true,
|
exportable: true,
|
||||||
},
|
},
|
||||||
active: {
|
active: {
|
||||||
|
|||||||
@@ -33,22 +33,18 @@ export default {
|
|||||||
name: {
|
name: {
|
||||||
name: 'item_category.field.name',
|
name: 'item_category.field.name',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
name: 'item_category.field.description',
|
name: 'item_category.field.description',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
count: {
|
count: {
|
||||||
name: 'item_category.field.count',
|
name: 'item_category.field.count',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
createdAt: {
|
createdAt: {
|
||||||
name: 'item_category.field.created_at',
|
name: 'item_category.field.created_at',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
|
|||||||
@@ -61,43 +61,37 @@ export default {
|
|||||||
columns: {
|
columns: {
|
||||||
customer: {
|
customer: {
|
||||||
name: 'payment_receive.field.customer',
|
name: 'payment_receive.field.customer',
|
||||||
|
accessor: 'customer.displayName',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
importable: true,
|
|
||||||
},
|
},
|
||||||
paymentDate: {
|
paymentDate: {
|
||||||
name: 'payment_receive.field.payment_date',
|
name: 'payment_receive.field.payment_date',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
importable: true,
|
|
||||||
},
|
},
|
||||||
amount: {
|
amount: {
|
||||||
name: 'payment_receive.field.amount',
|
name: 'payment_receive.field.amount',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
importable: true,
|
|
||||||
},
|
},
|
||||||
referenceNo: {
|
referenceNo: {
|
||||||
name: 'payment_receive.field.reference_no',
|
name: 'payment_receive.field.reference_no',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
importable: true,
|
|
||||||
},
|
},
|
||||||
depositAccount: {
|
depositAccount: {
|
||||||
name: 'payment_receive.field.deposit_account',
|
name: 'payment_receive.field.deposit_account',
|
||||||
|
accessor: 'depositAccount.name',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
importable: true,
|
|
||||||
},
|
},
|
||||||
paymentReceiveNo: {
|
paymentReceiveNo: {
|
||||||
name: 'payment_receive.field.payment_receive_no',
|
name: 'payment_receive.field.payment_receive_no',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
importable: true,
|
|
||||||
},
|
},
|
||||||
statement: {
|
statement: {
|
||||||
name: 'payment_receive.field.statement',
|
name: 'payment_receive.field.statement',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
importable: true,
|
|
||||||
},
|
},
|
||||||
created_at: {
|
created_at: {
|
||||||
name: 'payment_receive.field.created_at',
|
name: 'payment_receive.field.created_at',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
importable: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
|
|||||||
@@ -101,6 +101,11 @@ export default {
|
|||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
exportable: true,
|
||||||
},
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'Amount',
|
||||||
|
accessor: 'formattedAmount',
|
||||||
|
type: 'text',
|
||||||
|
},
|
||||||
exchangeRate: {
|
exchangeRate: {
|
||||||
name: 'Exchange Rate',
|
name: 'Exchange Rate',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
|||||||
@@ -92,52 +92,56 @@ export default {
|
|||||||
invoiceDate: {
|
invoiceDate: {
|
||||||
name: 'invoice.field.invoice_date',
|
name: 'invoice.field.invoice_date',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
dueDate: {
|
dueDate: {
|
||||||
name: 'invoice.field.due_date',
|
name: 'invoice.field.due_date',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
referenceNo: {
|
referenceNo: {
|
||||||
name: 'invoice.field.reference_no',
|
name: 'invoice.field.reference_no',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
invoiceNo: {
|
invoiceNo: {
|
||||||
name: 'invoice.field.invoice_no',
|
name: 'invoice.field.invoice_no',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
customer: {
|
customer: {
|
||||||
name: 'invoice.field.customer',
|
name: 'invoice.field.customer',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
accessor: 'customer.displayName',
|
||||||
|
},
|
||||||
|
amount: {
|
||||||
|
name: 'invoice.field.amount',
|
||||||
|
type: 'text',
|
||||||
|
accessor: 'balanceAmountFormatted',
|
||||||
},
|
},
|
||||||
exchangeRate: {
|
exchangeRate: {
|
||||||
name: 'invoice.field.exchange_rate',
|
name: 'invoice.field.exchange_rate',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
currencyCode: {
|
currencyCode: {
|
||||||
name: 'invoice.field.currency',
|
name: 'invoice.field.currency',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
},
|
||||||
|
paidAmount: {
|
||||||
|
name: 'Paid Amount',
|
||||||
|
accessor: 'paymentAmountFormatted'
|
||||||
|
},
|
||||||
|
dueAmount: {
|
||||||
|
name: 'Due Amount',
|
||||||
|
accessor: 'dueAmountFormatted',
|
||||||
},
|
},
|
||||||
invoiceMessage: {
|
invoiceMessage: {
|
||||||
name: 'invoice.field.invoice_message',
|
name: 'invoice.field.invoice_message',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
termsConditions: {
|
termsConditions: {
|
||||||
name: 'invoice.field.terms_conditions',
|
name: 'invoice.field.terms_conditions',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
delivered: {
|
delivered: {
|
||||||
name: 'invoice.field.delivered',
|
name: 'invoice.field.delivered',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fields2: {
|
fields2: {
|
||||||
|
|||||||
@@ -83,31 +83,24 @@ export default {
|
|||||||
name: 'receipt.field.amount',
|
name: 'receipt.field.amount',
|
||||||
column: 'amount',
|
column: 'amount',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
depositAccount: {
|
depositAccount: {
|
||||||
column: 'deposit_account_id',
|
|
||||||
name: 'receipt.field.deposit_account',
|
name: 'receipt.field.deposit_account',
|
||||||
type: 'relation',
|
type: 'text',
|
||||||
exportable: true,
|
accessor: 'depositAccount.name',
|
||||||
},
|
},
|
||||||
customer: {
|
customer: {
|
||||||
name: 'receipt.field.customer',
|
name: 'receipt.field.customer',
|
||||||
column: 'customer_id',
|
type: 'text',
|
||||||
type: 'relation',
|
accessor: 'customer.displayName',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
receiptDate: {
|
receiptDate: {
|
||||||
name: 'receipt.field.receipt_date',
|
name: 'receipt.field.receipt_date',
|
||||||
column: 'receipt_date',
|
|
||||||
type: 'date',
|
type: 'date',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
receiptNumber: {
|
receiptNumber: {
|
||||||
name: 'receipt.field.receipt_number',
|
name: 'receipt.field.receipt_number',
|
||||||
column: 'receipt_number',
|
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
referenceNo: {
|
referenceNo: {
|
||||||
name: 'receipt.field.reference_no',
|
name: 'receipt.field.reference_no',
|
||||||
@@ -119,19 +112,14 @@ export default {
|
|||||||
name: 'receipt.field.receipt_message',
|
name: 'receipt.field.receipt_message',
|
||||||
column: 'receipt_message',
|
column: 'receipt_message',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
statement: {
|
statement: {
|
||||||
name: 'receipt.field.statement',
|
name: 'receipt.field.statement',
|
||||||
column: 'statement',
|
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
createdAt: {
|
createdAt: {
|
||||||
name: 'receipt.field.created_at',
|
name: 'receipt.field.created_at',
|
||||||
column: 'created_at',
|
|
||||||
type: 'date',
|
type: 'date',
|
||||||
exportable: true,
|
|
||||||
},
|
},
|
||||||
status: {
|
status: {
|
||||||
name: 'receipt.field.status',
|
name: 'receipt.field.status',
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default {
|
|||||||
fieldType: 'text',
|
fieldType: 'text',
|
||||||
},
|
},
|
||||||
personal_phone: {
|
personal_phone: {
|
||||||
name: 'vendor.field.personal_pone',
|
name: 'vendor.field.personal_phone',
|
||||||
column: 'personal_phone',
|
column: 'personal_phone',
|
||||||
fieldType: 'text',
|
fieldType: 'text',
|
||||||
},
|
},
|
||||||
@@ -118,7 +118,7 @@ export default {
|
|||||||
exportable: true,
|
exportable: true,
|
||||||
},
|
},
|
||||||
personalPhone: {
|
personalPhone: {
|
||||||
name: 'vendor.field.personal_pone',
|
name: 'vendor.field.personal_phone',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
exportable: true,
|
exportable: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Inject, Service } from 'typedi';
|
import { Inject, Service } from 'typedi';
|
||||||
import xlsx from 'xlsx';
|
import xlsx from 'xlsx';
|
||||||
|
import { get } from 'lodash';
|
||||||
import { sanitizeResourceName } from '../Import/_utils';
|
import { sanitizeResourceName } from '../Import/_utils';
|
||||||
import ResourceService from '../Resource/ResourceService';
|
import ResourceService from '../Resource/ResourceService';
|
||||||
import { ExportableResources } from './ExportResources';
|
import { ExportableResources } from './ExportResources';
|
||||||
@@ -92,7 +93,7 @@ export class ExportResourceService {
|
|||||||
private createWorkbook(data: any[], exportableColumns: any[]) {
|
private createWorkbook(data: any[], exportableColumns: any[]) {
|
||||||
const workbook = xlsx.utils.book_new();
|
const workbook = xlsx.utils.book_new();
|
||||||
const worksheetData = data.map((item) =>
|
const worksheetData = data.map((item) =>
|
||||||
exportableColumns.map((col) => item[col.accessor])
|
exportableColumns.map((col) => get(item, col.accessor))
|
||||||
);
|
);
|
||||||
worksheetData.unshift(exportableColumns.map((col) => col.name));
|
worksheetData.unshift(exportableColumns.map((col) => col.name));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user