Compare commits

..

1 Commits

Author SHA1 Message Date
Ahmed Bouhuolia
7ad1d3677c fix(webapp): Payment made details drawer does not show up 2023-06-14 13:13:32 +02:00
3 changed files with 7 additions and 10 deletions

View File

@@ -9,6 +9,7 @@ import events from '@/subscribers/events';
import UnitOfWork from '@/services/UnitOfWork';
import { EventPublisher } from '@/lib/EventPublisher/EventPublisher';
import { CommandExpenseValidator } from './CommandExpenseValidator';
import { ExpenseCategory } from 'models';
import HasTenancyService from '@/services/Tenancy/TenancyService';
@Service()
@@ -36,7 +37,7 @@ export class DeleteExpense {
expenseId: number,
authorizedUser: ISystemUser
): Promise<void> => {
const { Expense, ExpenseCategory } = this.tenancy.models(tenantId);
const { Expense } = this.tenancy.models(tenantId);
// Retrieves the expense transaction with associated entries or
// throw not found error.
@@ -59,7 +60,7 @@ export class DeleteExpense {
} as IExpenseDeletingPayload);
// Deletes expense associated entries.
await ExpenseCategory.query(trx).where('expenseId', expenseId).delete();
await ExpenseCategory.query(trx).findById(expenseId).delete();
// Deletes expense transactions.
await Expense.query(trx).findById(expenseId).delete();

View File

@@ -46,7 +46,7 @@ export class ExpenseGLEntries {
...commonEntry,
credit: expense.localAmount,
accountId: expense.paymentAccountId,
accountNormal: AccountNormal.DEBIT,
accountNormal: AccountNormal.CREDIT,
index: 1,
};
};

View File

@@ -13,7 +13,6 @@ import {
import PaymentMadesEmptyStatus from './PaymentMadesEmptyStatus';
import withPaymentMade from './withPaymentMade';
import withPaymentMadeActions from './withPaymentMadeActions';
import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization';
@@ -24,6 +23,7 @@ import withSettings from '@/containers/Settings/withSettings';
import { usePaymentMadesTableColumns, ActionsMenu } from './components';
import { usePaymentMadesListContext } from './PaymentMadesListProvider';
import { useMemorizedColumnsWidths } from '@/hooks';
import { DRAWERS } from '@/constants/drawers';
/**
* Payment made datatable transactions.
@@ -32,9 +32,6 @@ function PaymentMadesTable({
// #withPaymentMadeActions
setPaymentMadesTableState,
// #withPaymentMade
paymentMadesTableState,
// #withAlerts
openAlert,
@@ -71,12 +68,12 @@ function PaymentMadesTable({
// Handle view detail payment made.
const handleViewDetailPaymentMade = ({ id }) => {
openDrawer('payment-made-detail-drawer', { paymentMadeId: id });
openDrawer(DRAWERS.PAYMENT_MADE, { paymentMadeId: id });
};
// Handle cell click.
const handleCellClick = (cell, event) => {
openDrawer('payment-made-detail-drawer', {
openDrawer(DRAWERS.PAYMENT_MADE, {
paymentMadeId: cell.row.original.id,
});
};
@@ -134,7 +131,6 @@ function PaymentMadesTable({
export default compose(
withPaymentMadeActions,
withPaymentMade(({ paymentMadesTableState }) => ({ paymentMadesTableState })),
withAlertsActions,
withDrawerActions,
withCurrentOrganization(),