mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
feat: optimize transactions locking.
This commit is contained in:
@@ -1,26 +0,0 @@
|
|||||||
.root {
|
|
||||||
|
|
||||||
|
|
||||||
&_danger {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
&__primary{
|
|
||||||
|
|
||||||
|
|
||||||
.title{
|
|
||||||
color: #1a3bd4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.title {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.description {
|
|
||||||
|
|
||||||
}
|
|
||||||
6
src/components/Typo/Paragraph.js
Normal file
6
src/components/Typo/Paragraph.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import clsx from 'classnames';
|
||||||
|
|
||||||
|
export function Paragraph({ className, children }) {
|
||||||
|
return <p className={clsx('paragraph', className)}>{children}</p>;
|
||||||
|
}
|
||||||
2
src/components/Typo/index.js
Normal file
2
src/components/Typo/index.js
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
export * from './Paragraph';
|
||||||
@@ -88,6 +88,7 @@ export * from './IntersectionObserver';
|
|||||||
export * from './SMSPreview';
|
export * from './SMSPreview';
|
||||||
export * from './Contacts';
|
export * from './Contacts';
|
||||||
export * from './Utils/Join';
|
export * from './Utils/Join';
|
||||||
|
export * from './Typo';
|
||||||
|
|
||||||
const Hint = FieldHint;
|
const Hint = FieldHint;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import { FormattedMessage as T, FormattedHTMLMessage } from 'components';
|
import { FormattedMessage as T } from 'components';
|
||||||
import { Intent, Alert } from '@blueprintjs/core';
|
import { Intent, Alert } from '@blueprintjs/core';
|
||||||
import { AppToaster } from 'components';
|
import { AppToaster } from 'components';
|
||||||
|
|
||||||
@@ -61,9 +61,8 @@ function CancelUnlockingPartialTarnsactions({
|
|||||||
return (
|
return (
|
||||||
<Alert
|
<Alert
|
||||||
cancelButtonText={<T id={'cancel'} />}
|
cancelButtonText={<T id={'cancel'} />}
|
||||||
confirmButtonText={<T id={'save'} />}
|
confirmButtonText={<T id={'yes'} />}
|
||||||
icon="trash"
|
intent={Intent.DANGER}
|
||||||
intent={Intent.WARNING}
|
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
onConfirm={handleConfirm}
|
onConfirm={handleConfirm}
|
||||||
|
|||||||
@@ -52,6 +52,16 @@ function GlobalErrors({
|
|||||||
toastKeySomethingWrong,
|
toastKeySomethingWrong,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (globalErrors.transactionsLocked) {
|
||||||
|
AppToaster.show({
|
||||||
|
message:
|
||||||
|
'Transactions before 13 Dec 2021 has been locked. Hence action cannot be performed.',
|
||||||
|
intent: Intent.DANGER,
|
||||||
|
onDismiss: () => {
|
||||||
|
globalErrorsSet({ transactionsLocked: false });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import clsx from 'classnames';
|
|
||||||
import { Intent } from '@blueprintjs/core';
|
import { Intent } from '@blueprintjs/core';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
|
|
||||||
import { Alert, ButtonLink, AppToaster, Join } from 'components';
|
import { Alert, ButtonLink, AppToaster, Join, Paragraph } from 'components';
|
||||||
import { TransactionsLockingProvider } from './TransactionsLockingProvider';
|
import { TransactionsLockingProvider } from './TransactionsLockingProvider';
|
||||||
import {
|
import {
|
||||||
TransactionLockingContent,
|
TransactionLockingContent,
|
||||||
@@ -19,10 +18,6 @@ import {
|
|||||||
validateMoveToPartialLocking,
|
validateMoveToPartialLocking,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
||||||
function Paragraph({ className, children }) {
|
|
||||||
return <p className={clsx('paragraph', className)}>{children}</p>;
|
|
||||||
}
|
|
||||||
|
|
||||||
function TransactionsLockingList({
|
function TransactionsLockingList({
|
||||||
items,
|
items,
|
||||||
onLock,
|
onLock,
|
||||||
@@ -37,6 +32,7 @@ function TransactionsLockingList({
|
|||||||
module,
|
module,
|
||||||
formatted_module,
|
formatted_module,
|
||||||
description,
|
description,
|
||||||
|
...item
|
||||||
}) => (
|
}) => (
|
||||||
<TransactionLockingContent
|
<TransactionLockingContent
|
||||||
name={formatted_module}
|
name={formatted_module}
|
||||||
@@ -49,6 +45,11 @@ function TransactionsLockingList({
|
|||||||
onUnlockPartial={onUnlockPartial}
|
onUnlockPartial={onUnlockPartial}
|
||||||
onEditLock={onLock}
|
onEditLock={onLock}
|
||||||
onCancle={onCancel}
|
onCancle={onCancel}
|
||||||
|
lockToDate={item.formatted_lock_to_date}
|
||||||
|
lockReason={item.lock_reason}
|
||||||
|
unlockReason={item.unlock_reason}
|
||||||
|
unlockFromDate={item.formatted_unlock_from_date}
|
||||||
|
unlockToDate={item.formatted_unlock_to_date}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -40,8 +40,17 @@ export const TransactionLockingContent = ({
|
|||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
module,
|
module,
|
||||||
|
|
||||||
isEnabled,
|
isEnabled,
|
||||||
|
lockToDate,
|
||||||
|
lockReason,
|
||||||
|
|
||||||
|
// Unlock props.
|
||||||
isPartialUnlock,
|
isPartialUnlock,
|
||||||
|
unlockToDate,
|
||||||
|
unlockFromDate,
|
||||||
|
unlockReason,
|
||||||
|
|
||||||
onLock,
|
onLock,
|
||||||
onEditLock,
|
onEditLock,
|
||||||
onUnlockFull,
|
onUnlockFull,
|
||||||
@@ -76,16 +85,43 @@ export const TransactionLockingContent = ({
|
|||||||
<TransLockingItemTitle>
|
<TransLockingItemTitle>
|
||||||
{name}
|
{name}
|
||||||
<Hint content={description} position={Position.BOTTOM_LEFT} />
|
<Hint content={description} position={Position.BOTTOM_LEFT} />
|
||||||
|
|
||||||
{isPartialUnlock && (
|
|
||||||
<Tag small={true} minimal={true} intent={Intent.PRIMARY}>
|
|
||||||
Partial unlocked
|
|
||||||
</Tag>
|
|
||||||
)}
|
|
||||||
</TransLockingItemTitle>
|
</TransLockingItemTitle>
|
||||||
<TransLockingItemDesc>
|
|
||||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
<If condition={!isEnabled}>
|
||||||
</TransLockingItemDesc>
|
<TransLockingItemDesc>
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
||||||
|
</TransLockingItemDesc>
|
||||||
|
</If>
|
||||||
|
|
||||||
|
<If condition={isEnabled}>
|
||||||
|
<TransLockWrap>
|
||||||
|
<TransLockingItemDesc>
|
||||||
|
Transactions of the module locked to{' '}
|
||||||
|
<strong>{lockToDate}</strong>.
|
||||||
|
</TransLockingItemDesc>
|
||||||
|
|
||||||
|
<If condition={lockReason}>
|
||||||
|
<TransLockingReason>
|
||||||
|
<strong>Lock Reason:</strong> {lockReason}
|
||||||
|
</TransLockingReason>
|
||||||
|
</If>
|
||||||
|
</TransLockWrap>
|
||||||
|
</If>
|
||||||
|
|
||||||
|
<If condition={isPartialUnlock}>
|
||||||
|
<TransUnlockWrap>
|
||||||
|
<TransLockingItemDesc>
|
||||||
|
Partial unlocked from <strong>{unlockFromDate}</strong> to{' '}
|
||||||
|
<strong>{unlockToDate}</strong>.
|
||||||
|
</TransLockingItemDesc>
|
||||||
|
|
||||||
|
<If condition={unlockReason}>
|
||||||
|
<TransLockingReason>
|
||||||
|
<strong>Unlock Reason:</strong> {unlockReason}
|
||||||
|
</TransLockingReason>
|
||||||
|
</If>
|
||||||
|
</TransUnlockWrap>
|
||||||
|
</If>
|
||||||
</TransLockingContent>
|
</TransLockingContent>
|
||||||
|
|
||||||
<TransLockingActions>
|
<TransLockingActions>
|
||||||
@@ -208,4 +244,31 @@ export const TransLockingContent = styled.div`
|
|||||||
flex: 1 1 0;
|
flex: 1 1 0;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding-right: 10px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const TransLockingReason = styled.div`
|
||||||
|
font-size: 13px;
|
||||||
|
|
||||||
|
strong {
|
||||||
|
color: #777;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const TransUnlockWrap = styled.div`
|
||||||
|
padding-top: 12px;
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
margin-top: 12px;
|
||||||
|
|
||||||
|
${TransLockingReason} {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
${TransLockingItemDesc} {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
const TransLockWrap = styled.div`
|
||||||
|
${TransLockingReason} {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -1619,7 +1619,6 @@
|
|||||||
"unlocking_full_transactions.dialog.label": "Full unlocking transactions",
|
"unlocking_full_transactions.dialog.label": "Full unlocking transactions",
|
||||||
"unlocking_full_transactions.dialog.reason": "Unlocking reason",
|
"unlocking_full_transactions.dialog.reason": "Unlocking reason",
|
||||||
"unlocking_partial_transactions.alert.success_message": "Partial transaction unlocking has been canceled successfully.",
|
"unlocking_partial_transactions.alert.success_message": "Partial transaction unlocking has been canceled successfully.",
|
||||||
"unlocking_partial_transactions.alert.message": "Are you sure you want to cancel this ?"
|
"unlocking_partial_transactions.alert.message": "Are you sure you want to cancel partial unlock of this module?",
|
||||||
|
"yes": "Yes"
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user