mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
re-structure to monorepo.
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import * as R from 'ramda';
|
||||
import {
|
||||
TransactionsLockingList,
|
||||
TransactionsLockingFull,
|
||||
TransactionLockingSkeletonList,
|
||||
} from './components';
|
||||
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import withAlertsActions from '@/containers/Alert/withAlertActions';
|
||||
|
||||
import { useTransactionsLockingContext } from './TransactionsLockingProvider';
|
||||
|
||||
/**
|
||||
* Transactions locking body.
|
||||
* @returns {JSX}
|
||||
*/
|
||||
function TransactionsLockingBodyJsx({
|
||||
// #withDialogActions
|
||||
openDialog,
|
||||
|
||||
// #withAlertsActions
|
||||
openAlert,
|
||||
}) {
|
||||
const { isTransactionLockingLoading, transactionLockingType } =
|
||||
useTransactionsLockingContext();
|
||||
|
||||
// Handle locking transactions.
|
||||
const handleLockingTransactions = (module, {}, isEnabled) => {
|
||||
openDialog('locking-transactions', {
|
||||
isEnabled: isEnabled,
|
||||
module: module,
|
||||
});
|
||||
};
|
||||
// Handle unlocking transactions
|
||||
const handleUnlockTransactions = (module) => {
|
||||
openDialog('unlocking-transactions', { module: module });
|
||||
};
|
||||
// Handle unlocking transactions
|
||||
const handleUnlockingPartial = (module) => {
|
||||
openDialog('unlocking-partial-transactions', { module: module });
|
||||
};
|
||||
// Handle cancel partial unlocking.
|
||||
const handleCancelUnlockingPartail = (module) => {
|
||||
openAlert('cancel-unlocking-partail', { module: module });
|
||||
};
|
||||
|
||||
return !isTransactionLockingLoading ? (
|
||||
transactionLockingType === 'partial' ? (
|
||||
<TransactionsLockingList
|
||||
onLock={handleLockingTransactions}
|
||||
onEditLock={handleLockingTransactions}
|
||||
onCancelLock={handleUnlockTransactions}
|
||||
onUnlockPartial={handleUnlockingPartial}
|
||||
onCancelUnlockPartial={handleCancelUnlockingPartail}
|
||||
/>
|
||||
) : (
|
||||
<TransactionsLockingFull
|
||||
onLock={handleLockingTransactions}
|
||||
onCancelLock={handleUnlockTransactions}
|
||||
onUnlockPartial={handleUnlockingPartial}
|
||||
onCancelUnlockPartial={handleCancelUnlockingPartail}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<TransactionLockingSkeletonList />
|
||||
);
|
||||
}
|
||||
|
||||
export const TransactionsLockingBody = R.compose(
|
||||
withAlertsActions,
|
||||
withDialogActions,
|
||||
)(TransactionsLockingBodyJsx);
|
||||
Reference in New Issue
Block a user