mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
fix: full amount bold expenses transactions.
fix: bulk delete expenses transactions. fix: issue delete account node in tree.
This commit is contained in:
@@ -143,7 +143,7 @@ function ExpenseForm({
|
||||
|
||||
const form = {
|
||||
...values,
|
||||
is_published: submitPayload.publish,
|
||||
publish: submitPayload.publish,
|
||||
categories,
|
||||
};
|
||||
// Handle request success.
|
||||
|
||||
@@ -35,6 +35,7 @@ export const getAccountsListFactory = () =>
|
||||
return treeToList(accountsTree, {
|
||||
idFieldKey: 'id',
|
||||
childrenFieldKey: 'children',
|
||||
nodeFilter: (node, depth) => accountsItems[node.id],
|
||||
nodeMapper: (node, depth) => {
|
||||
const account = accountsItems[node.id];
|
||||
const spaceChar = String.fromCharCode(160);
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
.dashboard__insider--expense-form{
|
||||
background-color: #fff;
|
||||
}
|
||||
.dashboard__insider--expenses{
|
||||
|
||||
|
||||
.bigcapital-datatable{
|
||||
|
||||
.tbody{
|
||||
.tr .td.total_amount{
|
||||
span{
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.page-form--expense{
|
||||
$self: '.page-form';
|
||||
|
||||
|
||||
@@ -329,15 +329,16 @@ export function treeToList(
|
||||
idFieldKey = 'id',
|
||||
childrenFieldKey = 'children',
|
||||
nodeMapper = (node, depth) => node,
|
||||
nodeFilter = (node, depth) => true,
|
||||
},
|
||||
) {
|
||||
let depth = 0;
|
||||
|
||||
const walker = (tree) => {
|
||||
return tree.reduce(function (acc, o) {
|
||||
return tree.reduce((acc, o) => {
|
||||
depth += 1;
|
||||
|
||||
if (o[idFieldKey]) {
|
||||
if (o[idFieldKey] && nodeFilter(o, depth)) {
|
||||
acc.push(nodeMapper(o, depth));
|
||||
}
|
||||
if (o[childrenFieldKey]) {
|
||||
|
||||
@@ -251,7 +251,7 @@ export default class ExpensesController extends BaseController {
|
||||
*/
|
||||
async bulkDeleteExpenses(req: Request, res: Response, next: NextFunction) {
|
||||
const { tenantId, user } = req;
|
||||
const { ids: expensesIds } = req.params;
|
||||
const { ids: expensesIds } = req.query;
|
||||
|
||||
try {
|
||||
await this.expensesService.deleteBulkExpenses(
|
||||
|
||||
@@ -85,9 +85,9 @@ export default class ExpenseRepository extends TenantRepository {
|
||||
* @param {number[]} expensesIds
|
||||
*/
|
||||
async bulkDelete(expensesIds: number[]): Promise<void> {
|
||||
const { Expense } = this.models;
|
||||
const { Expense, ExpenseCategory } = this.models;
|
||||
|
||||
await Expense.query().whereIn('expense_id', expensesIds).delete();
|
||||
await ExpenseCategory.query().whereIn('expense_id', expensesIds).delete();
|
||||
await Expense.query().whereIn('id', expensesIds).delete();
|
||||
|
||||
this.flushCache();
|
||||
|
||||
Reference in New Issue
Block a user