chrone: sperate client and server to different repos.

This commit is contained in:
a.bouhuolia
2021-09-21 17:13:53 +02:00
parent e011b2a82b
commit 18df5530c7
10015 changed files with 17686 additions and 97524 deletions

View File

@@ -0,0 +1,112 @@
import React from 'react';
import intl from 'react-intl-universal';
import moment from 'moment';
import { Button } from '@blueprintjs/core';
import { Icon, If, FormattedMessage as T } from 'components';
import { useJournalSheetContext } from './JournalProvider';
import FinancialLoadingBar from '../FinancialLoadingBar';
/**
* Retrieve the journal table columns.
*/
export const useJournalTableColumns = () => {
return React.useMemo(
() => [
{
Header: intl.get('date'),
accessor: (row) =>
row.date ? moment(row.date).format('YYYY MMM DD') : '',
className: 'date',
width: 100,
textOverview: true,
},
{
Header: intl.get('transaction_type'),
accessor: 'reference_type_formatted',
className: 'reference_type_formatted',
width: 120,
textOverview: true,
},
{
Header: intl.get('num'),
accessor: 'transaction_number',
className: 'reference_id',
width: 70,
textOverview: true,
},
{
Header: intl.get('description'),
accessor: 'note',
className: 'note',
textOverview: true,
},
{
Header: intl.get('acc_code'),
accessor: 'account_code',
width: 95,
className: 'account_code',
textOverview: true,
},
{
Header: intl.get('account'),
accessor: 'account_name',
className: 'account_name',
textOverview: true,
},
{
Header: intl.get('credit'),
accessor: 'formatted_credit',
className: 'credit',
},
{
Header: intl.get('debit'),
accessor: 'formatted_debit',
className: 'debit',
},
],
[],
);
};
/**
* Journal sheet loading bar.
*/
export function JournalSheetLoadingBar() {
const { isFetching } = useJournalSheetContext();
return (
<If condition={isFetching}>
<FinancialLoadingBar />
</If>
);
}
/**
* Journal sheet alerts.
*/
export function JournalSheetAlerts() {
const { isLoading, refetchSheet, journalSheet } = useJournalSheetContext();
// Handle refetch the report sheet.
const handleRecalcReport = () => {
refetchSheet();
};
// Can't display any error if the report is loading.
if (isLoading) {
return null;
}
return (
<If condition={journalSheet.meta.is_cost_compute_running}>
<div class="alert-compute-running">
<Icon icon="info-block" iconSize={12} />
<T id={'just_a_moment_we_re_calculating_your_cost_transactions'} />
<Button onClick={handleRecalcReport} minimal={true} small={true}>
<T id={'refresh'} />
</Button>
</div>
</If>
);
}