mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-22 15:50:32 +00:00
BIG-71: localize moment date formats.
This commit is contained in:
@@ -89,6 +89,7 @@ const CLASSES = {
|
|||||||
...Classes,
|
...Classes,
|
||||||
CARD: 'card',
|
CARD: 'card',
|
||||||
ALIGN_RIGHT: 'align-right',
|
ALIGN_RIGHT: 'align-right',
|
||||||
|
FONT_BOLD: 'font-bold',
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ import intl from 'react-intl-universal';
|
|||||||
import { find } from 'lodash';
|
import { find } from 'lodash';
|
||||||
import rtlDetect from 'rtl-detect';
|
import rtlDetect from 'rtl-detect';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
|
|
||||||
import { AppIntlProvider } from './AppIntlProvider';
|
import { AppIntlProvider } from './AppIntlProvider';
|
||||||
|
|
||||||
import withDashboardActions from '../containers/Dashboard/withDashboardActions';
|
import withDashboardActions from '../containers/Dashboard/withDashboardActions';
|
||||||
import withDashboard from '../containers/Dashboard/withDashboard';
|
import withDashboard from '../containers/Dashboard/withDashboard';
|
||||||
|
|
||||||
@@ -56,6 +58,10 @@ function useDocumentDirectionModifier(locale, isRTL) {
|
|||||||
}, [isRTL, locale]);
|
}, [isRTL, locale]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function transformMomentLocale(currentLocale) {
|
||||||
|
return currentLocale === 'ar' ? 'ar-ly' : currentLocale;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application Intl loader.
|
* Application Intl loader.
|
||||||
*/
|
*/
|
||||||
@@ -84,7 +90,7 @@ function AppIntlLoader({ appIntlIsLoading, setAppIntlIsLoading, children }) {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
moment.locale(currentLocale);
|
moment.locale(transformMomentLocale(currentLocale));
|
||||||
setIsLocalsLoading(false);
|
setIsLocalsLoading(false);
|
||||||
});
|
});
|
||||||
}, [currentLocale, setIsLocalsLoading]);
|
}, [currentLocale, setIsLocalsLoading]);
|
||||||
|
|||||||
19
client/src/components/Utils/FormatDate.js
Normal file
19
client/src/components/Utils/FormatDate.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import moment from 'moment';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the given date.
|
||||||
|
*/
|
||||||
|
export function FormatDate({ value, format = 'YYYY MMM DD' }) {
|
||||||
|
const localizedFormat = intl.get(`date_format.${format}`);
|
||||||
|
|
||||||
|
return moment().format(localizedFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format date table cell.
|
||||||
|
*/
|
||||||
|
export function FormatDateCell({ value, column: { formatDate } }) {
|
||||||
|
return <FormatDate value={value} {...formatDate} />;
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
export * from './FormatNumber';
|
export * from './FormatNumber';
|
||||||
|
export * from './FormatDate';
|
||||||
@@ -79,6 +79,7 @@ export * from './Drawer';
|
|||||||
export * from './Forms';
|
export * from './Forms';
|
||||||
export * from './MultiSelectTaggable'
|
export * from './MultiSelectTaggable'
|
||||||
export * from './Utils/FormatNumber';
|
export * from './Utils/FormatNumber';
|
||||||
|
export * from './Utils/FormatDate';
|
||||||
|
|
||||||
const Hint = FieldHint;
|
const Hint = FieldHint;
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,11 @@ import {
|
|||||||
MenuDivider,
|
MenuDivider,
|
||||||
Popover,
|
Popover,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import { FormattedMessage as T } from 'components';
|
|
||||||
import moment from 'moment';
|
|
||||||
import { Choose, Money, If, Icon } from 'components';
|
|
||||||
import { safeCallback } from 'utils';
|
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
|
|
||||||
|
import { FormattedMessage as T, Choose, Money, If, Icon } from 'components';
|
||||||
|
import { safeCallback } from 'utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount accessor.
|
* Amount accessor.
|
||||||
*/
|
*/
|
||||||
@@ -105,13 +104,6 @@ export const StatusAccessor = (row) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Date accessor.
|
|
||||||
*/
|
|
||||||
export const DateAccessor = (row) => {
|
|
||||||
return moment(row.date).format('YYYY MMM DD');
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note column accessor.
|
* Note column accessor.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import moment from 'moment';
|
import clsx from 'classnames';
|
||||||
import { NoteAccessor, StatusAccessor, DateAccessor } from './components';
|
|
||||||
|
import { CLASSES } from '../../../common/classes';
|
||||||
|
import { FormatDateCell } from '../../../components';
|
||||||
|
import { NoteAccessor, StatusAccessor } from './components';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the manual journals columns.
|
* Retrieve the manual journals columns.
|
||||||
@@ -12,7 +15,8 @@ export const useManualJournalsColumns = () => {
|
|||||||
{
|
{
|
||||||
id: 'date',
|
id: 'date',
|
||||||
Header: intl.get('date'),
|
Header: intl.get('date'),
|
||||||
accessor: DateAccessor,
|
accessor: 'date',
|
||||||
|
Cell: FormatDateCell,
|
||||||
width: 115,
|
width: 115,
|
||||||
className: 'date',
|
className: 'date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
@@ -21,10 +25,10 @@ export const useManualJournalsColumns = () => {
|
|||||||
id: 'amount',
|
id: 'amount',
|
||||||
Header: intl.get('amount'),
|
Header: intl.get('amount'),
|
||||||
accessor: 'formatted_amount',
|
accessor: 'formatted_amount',
|
||||||
className: 'amount',
|
|
||||||
width: 115,
|
width: 115,
|
||||||
clickable: true,
|
clickable: true,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'journal_number',
|
id: 'journal_number',
|
||||||
@@ -39,7 +43,6 @@ export const useManualJournalsColumns = () => {
|
|||||||
Header: intl.get('journal_type'),
|
Header: intl.get('journal_type'),
|
||||||
accessor: 'journal_type',
|
accessor: 'journal_type',
|
||||||
width: 110,
|
width: 110,
|
||||||
className: 'journal_type',
|
|
||||||
clickable: true,
|
clickable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -47,7 +50,6 @@ export const useManualJournalsColumns = () => {
|
|||||||
Header: intl.get('publish'),
|
Header: intl.get('publish'),
|
||||||
accessor: (row) => StatusAccessor(row),
|
accessor: (row) => StatusAccessor(row),
|
||||||
width: 95,
|
width: 95,
|
||||||
className: 'status',
|
|
||||||
clickable: true,
|
clickable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -56,15 +58,14 @@ export const useManualJournalsColumns = () => {
|
|||||||
accessor: NoteAccessor,
|
accessor: NoteAccessor,
|
||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
width: 85,
|
width: 85,
|
||||||
className: 'note',
|
|
||||||
clickable: true,
|
clickable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'created_at',
|
id: 'created_at',
|
||||||
Header: intl.get('created_at'),
|
Header: intl.get('created_at'),
|
||||||
accessor: (r) => moment(r.created_at).format('YYYY MMM DD'),
|
accessor: 'created_at',
|
||||||
|
Cell: FormatDateCell,
|
||||||
width: 125,
|
width: 125,
|
||||||
className: 'created_at',
|
|
||||||
clickable: true,
|
clickable: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,27 +1,21 @@
|
|||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import moment from 'moment';
|
|
||||||
|
|
||||||
|
import { FormatDateCell } from '../../../components';
|
||||||
import { isBlank } from 'utils';
|
import { isBlank } from 'utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debit/credit table cell.
|
* Debit/credit table cell.
|
||||||
*/
|
*/
|
||||||
function DebitCreditTableCell({ value, payload: { account } }) {
|
function DebitCreditTableCell({ value, payload: { account } }) {
|
||||||
return !isBlank(value) && value !== 0
|
return !isBlank(value) && value !== 0 ? account.formatted_amount : null;
|
||||||
? // <Money amount={value} currency={account.currency_code} />
|
|
||||||
account.formatted_amount
|
|
||||||
: null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Running balance table cell.
|
* Running balance table cell.
|
||||||
*/
|
*/
|
||||||
function RunningBalanceTableCell({ value, payload: { account } }) {
|
function RunningBalanceTableCell({ value, payload: { account } }) {
|
||||||
return (
|
return account.formatted_amount;
|
||||||
// <Money amount={value} currency={account.currency_code} />
|
|
||||||
account.formatted_amount
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +26,8 @@ export const useAccountReadEntriesColumns = () =>
|
|||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
Header: intl.get('transaction_date'),
|
Header: intl.get('transaction_date'),
|
||||||
accessor: ({ date }) => moment(date).format('YYYY MMM DD'),
|
accessor: 'date',
|
||||||
|
Cell: FormatDateCell,
|
||||||
width: 110,
|
width: 110,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import intl from 'react-intl-universal';
|
|||||||
import { defaultTo } from 'lodash';
|
import { defaultTo } from 'lodash';
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
|
|
||||||
import { DetailsMenu, DetailItem } from 'components';
|
import { FormatDate, DetailsMenu, DetailItem } from 'components';
|
||||||
|
|
||||||
import { useBillDrawerContext } from './BillDrawerProvider';
|
import { useBillDrawerContext } from './BillDrawerProvider';
|
||||||
import BillDrawerCls from 'style/components/Drawers/BillDrawer.module.scss';
|
import BillDrawerCls from 'style/components/Drawers/BillDrawer.module.scss';
|
||||||
@@ -27,7 +27,7 @@ export default function BillDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('bill_date')}
|
label={intl.get('bill_date')}
|
||||||
children={bill.formatted_bill_date}
|
children={<FormatDate value={bill.bill_date} />}
|
||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('vendor_name')}
|
label={intl.get('vendor_name')}
|
||||||
@@ -35,7 +35,7 @@ export default function BillDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('due_date')}
|
label={intl.get('due_date')}
|
||||||
children={bill.formatted_due_date}
|
children={<FormatDate value={bill.due_date} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ export default function BillDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('bill.details.created_at')}
|
label={intl.get('bill.details.created_at')}
|
||||||
children={'2020 Ang 21'}
|
children={<FormatDate value={bill.created_at} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import intl from 'react-intl-universal';
|
|||||||
import { defaultTo } from 'lodash';
|
import { defaultTo } from 'lodash';
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
|
|
||||||
import { T, DetailsMenu, DetailItem } from 'components';
|
import { FormatDate, T, DetailsMenu, DetailItem } from 'components';
|
||||||
import { useEstimateDetailDrawerContext } from './EstimateDetailDrawerProvider';
|
import { useEstimateDetailDrawerContext } from './EstimateDetailDrawerProvider';
|
||||||
|
|
||||||
import EstimateDetailsCls from 'style/components/Drawers/EstimateDetails.module.scss';
|
import EstimateDetailsCls from 'style/components/Drawers/EstimateDetails.module.scss';
|
||||||
@@ -45,7 +45,7 @@ export default function EstimateDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={<T id={'estimate.details.created_at'} />}
|
label={<T id={'estimate.details.created_at'} />}
|
||||||
children={'2020 Ang 21'}
|
children={<FormatDate value={estimate.created_at} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import intl from 'react-intl-universal';
|
|||||||
import { defaultTo } from 'lodash';
|
import { defaultTo } from 'lodash';
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
|
|
||||||
import { DetailsMenu, DetailItem } from 'components';
|
import { DetailsMenu, DetailItem, FormatDate } from 'components';
|
||||||
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
import { useInvoiceDetailDrawerContext } from './InvoiceDetailDrawerProvider';
|
||||||
|
|
||||||
import InvoiceDrawerCls from 'style/components/Drawers/InvoiceDrawer.module.scss';
|
import InvoiceDrawerCls from 'style/components/Drawers/InvoiceDrawer.module.scss';
|
||||||
@@ -30,11 +30,11 @@ export default function InvoiceDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('invoice_date')}
|
label={intl.get('invoice_date')}
|
||||||
children={invoice.formatted_invoice_date}
|
children={<FormatDate value={invoice.invoice_date} />}
|
||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('due_date')}
|
label={intl.get('due_date')}
|
||||||
children={invoice.formatted_due_date}
|
children={<FormatDate value={invoice.due_date} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ export default function InvoiceDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('invoice.details.created_at')}
|
label={intl.get('invoice.details.created_at')}
|
||||||
children={'2020 Ang 21'}
|
children={<FormatDate value={invoice.created_at} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import moment from 'moment';
|
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
import { defaultTo } from 'lodash';
|
import { defaultTo } from 'lodash';
|
||||||
|
|
||||||
import { DetailsMenu, DetailItem } from 'components';
|
import { DetailsMenu, DetailItem, FormatDate } from 'components';
|
||||||
|
|
||||||
import { usePaymentMadeDetailContext } from './PaymentMadeDetailProvider';
|
import { usePaymentMadeDetailContext } from './PaymentMadeDetailProvider';
|
||||||
|
|
||||||
import PaymentDrawerCls from './PaymentMadeDrawer.module.scss';
|
import PaymentDrawerCls from './PaymentMadeDrawer.module.scss';
|
||||||
@@ -36,7 +34,7 @@ export default function PaymentMadeDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('payment_date')}
|
label={intl.get('payment_date')}
|
||||||
children={paymentMade.formatted_payment_date}
|
children={<FormatDate value={paymentMade.payment_date} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
|
|
||||||
@@ -47,7 +45,7 @@ export default function PaymentMadeDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('created_at')}
|
label={intl.get('created_at')}
|
||||||
children={moment(paymentMade.created_at).format('YYYY MMM DD')}
|
children={<FormatDate value={paymentMade.created_at} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import moment from 'moment';
|
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
|
|
||||||
import { defaultTo } from 'lodash';
|
import { defaultTo } from 'lodash';
|
||||||
|
|
||||||
import { DetailsMenu, DetailItem } from 'components';
|
import { FormatDate, DetailsMenu, DetailItem } from 'components';
|
||||||
|
|
||||||
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
import { usePaymentReceiveDetailContext } from './PaymentReceiveDetailProvider';
|
||||||
|
|
||||||
import PaymentDrawerCls from './PaymentReceiveDrawer.module.scss';
|
import PaymentDrawerCls from './PaymentReceiveDrawer.module.scss';
|
||||||
@@ -40,7 +37,7 @@ export default function PaymentReceiveDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('payment_date')}
|
label={intl.get('payment_date')}
|
||||||
children={paymentReceive.formatted_payment_date}
|
children={<FormatDate value={paymentReceive.payment_date} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
|
|
||||||
@@ -51,7 +48,7 @@ export default function PaymentReceiveDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('created_at')}
|
label={intl.get('created_at')}
|
||||||
children={moment(paymentReceive.created_at).format('YYYY MMM DD')}
|
children={<FormatDate value={paymentReceive.created_at} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import intl from 'react-intl-universal';
|
|||||||
import { defaultTo } from 'lodash';
|
import { defaultTo } from 'lodash';
|
||||||
import clsx from 'classnames';
|
import clsx from 'classnames';
|
||||||
|
|
||||||
import { DetailsMenu, DetailItem } from 'components';
|
import { FormatDate, DetailsMenu, DetailItem } from 'components';
|
||||||
|
|
||||||
import { useReceiptDetailDrawerContext } from './ReceiptDetailDrawerProvider';
|
import { useReceiptDetailDrawerContext } from './ReceiptDetailDrawerProvider';
|
||||||
|
|
||||||
@@ -31,11 +31,11 @@ export default function ReceiptDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('receipt_date')}
|
label={intl.get('receipt_date')}
|
||||||
children={receipt.formatted_receipt_date}
|
children={<FormatDate value={receipt.receipt_date} />}
|
||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('closed_date')}
|
label={intl.get('closed_date')}
|
||||||
children={defaultTo(receipt.formatted_closed_at_date, '-')}
|
children={<FormatDate value={receipt.closed_at_date} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ export default function ReceiptDetailHeader() {
|
|||||||
/>
|
/>
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label={intl.get('receipt.details.created_at')}
|
label={intl.get('receipt.details.created_at')}
|
||||||
children={'2020 Ang 21'}
|
children={<FormatDate value={receipt.created_at} />}
|
||||||
/>
|
/>
|
||||||
</DetailsMenu>
|
</DetailsMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,10 +11,15 @@ import {
|
|||||||
Menu,
|
Menu,
|
||||||
MenuDivider,
|
MenuDivider,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import moment from 'moment';
|
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
|
|
||||||
import { FormattedMessage as T, Money, Icon, If } from 'components';
|
import {
|
||||||
|
FormatDateCell,
|
||||||
|
FormattedMessage as T,
|
||||||
|
Money,
|
||||||
|
Icon,
|
||||||
|
If,
|
||||||
|
} from 'components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,7 +133,8 @@ export function useExpensesTableColumns() {
|
|||||||
{
|
{
|
||||||
id: 'payment_date',
|
id: 'payment_date',
|
||||||
Header: intl.get('payment_date'),
|
Header: intl.get('payment_date'),
|
||||||
accessor: (r) => moment(r.payment_date).format('YYYY MMM DD'),
|
accessor: 'payment_date',
|
||||||
|
Cell: FormatDateCell,
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'payment_date',
|
className: 'payment_date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
|||||||
@@ -4,16 +4,19 @@ import {
|
|||||||
Menu,
|
Menu,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
MenuDivider,
|
MenuDivider,
|
||||||
Popover,
|
|
||||||
Button,
|
|
||||||
Position,
|
|
||||||
Tag,
|
Tag,
|
||||||
ProgressBar,
|
ProgressBar,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import moment from 'moment';
|
|
||||||
|
|
||||||
import { FormattedMessage as T, Icon, If, Choose, Money } from 'components';
|
import {
|
||||||
|
FormatDateCell,
|
||||||
|
FormattedMessage as T,
|
||||||
|
Icon,
|
||||||
|
If,
|
||||||
|
Choose,
|
||||||
|
Money,
|
||||||
|
} from 'components';
|
||||||
import { formattedAmount, safeCallback, isBlank, calculateStatus } from 'utils';
|
import { formattedAmount, safeCallback, isBlank, calculateStatus } from 'utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,17 +139,6 @@ export function StatusAccessor(bill) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ActionsCell(props) {
|
|
||||||
return (
|
|
||||||
<Popover
|
|
||||||
content={<ActionsMenu {...props} />}
|
|
||||||
position={Position.RIGHT_BOTTOM}
|
|
||||||
>
|
|
||||||
<Button icon={<Icon icon="more-h-16" iconSize={16} />} />
|
|
||||||
</Popover>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve bills table columns.
|
* Retrieve bills table columns.
|
||||||
*/
|
*/
|
||||||
@@ -156,7 +148,8 @@ export function useBillsTableColumns() {
|
|||||||
{
|
{
|
||||||
id: 'bill_date',
|
id: 'bill_date',
|
||||||
Header: intl.get('bill_date'),
|
Header: intl.get('bill_date'),
|
||||||
accessor: (r) => moment(r.bill_date).format('YYYY MMM DD'),
|
accessor: 'bill_date',
|
||||||
|
Cell: FormatDateCell,
|
||||||
width: 110,
|
width: 110,
|
||||||
className: 'bill_date',
|
className: 'bill_date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
@@ -197,7 +190,8 @@ export function useBillsTableColumns() {
|
|||||||
{
|
{
|
||||||
id: 'due_date',
|
id: 'due_date',
|
||||||
Header: intl.get('due_date'),
|
Header: intl.get('due_date'),
|
||||||
accessor: (r) => moment(r.due_date).format('YYYY MMM DD'),
|
accessor: 'due_date',
|
||||||
|
Cell: FormatDateCell,
|
||||||
width: 110,
|
width: 110,
|
||||||
className: 'due_date',
|
className: 'due_date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import moment from 'moment';
|
|
||||||
import {
|
import {
|
||||||
Intent,
|
Intent,
|
||||||
Button,
|
Button,
|
||||||
@@ -11,13 +10,9 @@ import {
|
|||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
|
|
||||||
import { Icon, Money } from 'components';
|
import { Icon, Money, FormatDateCell } from 'components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
|
||||||
export function DateCell({ value }) {
|
|
||||||
return moment(value).format('YYYY MMM DD');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AmountAccessor(row) {
|
export function AmountAccessor(row) {
|
||||||
return <Money amount={row.amount} currency={row.currency_code} />;
|
return <Money amount={row.amount} currency={row.currency_code} />;
|
||||||
}
|
}
|
||||||
@@ -75,7 +70,7 @@ export function usePaymentMadesTableColumns() {
|
|||||||
{
|
{
|
||||||
id: 'payment_date',
|
id: 'payment_date',
|
||||||
Header: intl.get('payment_date'),
|
Header: intl.get('payment_date'),
|
||||||
Cell: DateCell,
|
Cell: FormatDateCell,
|
||||||
accessor: 'payment_date',
|
accessor: 'payment_date',
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'payment_date',
|
className: 'payment_date',
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {
|
import { Intent, Tag, Menu, MenuItem, MenuDivider } from '@blueprintjs/core';
|
||||||
Intent,
|
|
||||||
Tag,
|
|
||||||
Button,
|
|
||||||
Popover,
|
|
||||||
Menu,
|
|
||||||
MenuItem,
|
|
||||||
MenuDivider,
|
|
||||||
Position,
|
|
||||||
} from '@blueprintjs/core';
|
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import moment from 'moment';
|
import clsx from 'classnames';
|
||||||
|
|
||||||
import { FormattedMessage as T, Money, Choose, Icon, If } from 'components';
|
import { CLASSES } from '../../../../common/classes';
|
||||||
|
import {
|
||||||
|
FormatDateCell,
|
||||||
|
FormattedMessage as T,
|
||||||
|
Money,
|
||||||
|
Choose,
|
||||||
|
Icon,
|
||||||
|
If,
|
||||||
|
} from 'components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,25 +129,10 @@ export function ActionsMenu({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function DateCell({ value }) {
|
|
||||||
return moment(value).format('YYYY MMM DD');
|
|
||||||
}
|
|
||||||
|
|
||||||
function AmountAccessor({ amount, currency_code }) {
|
function AmountAccessor({ amount, currency_code }) {
|
||||||
return <Money amount={amount} currency={currency_code} />;
|
return <Money amount={amount} currency={currency_code} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ActionsCell(props) {
|
|
||||||
return (
|
|
||||||
<Popover
|
|
||||||
content={<ActionsMenu {...props} />}
|
|
||||||
position={Position.RIGHT_BOTTOM}
|
|
||||||
>
|
|
||||||
<Button icon={<Icon icon="more-h-16" iconSize={16} />} />
|
|
||||||
</Popover>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useEstiamtesTableColumns() {
|
export function useEstiamtesTableColumns() {
|
||||||
return React.useMemo(
|
return React.useMemo(
|
||||||
() => [
|
() => [
|
||||||
@@ -156,7 +140,7 @@ export function useEstiamtesTableColumns() {
|
|||||||
id: 'estimate_date',
|
id: 'estimate_date',
|
||||||
Header: intl.get('estimate_date'),
|
Header: intl.get('estimate_date'),
|
||||||
accessor: 'estimate_date',
|
accessor: 'estimate_date',
|
||||||
Cell: DateCell,
|
Cell: FormatDateCell,
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'estimate_date',
|
className: 'estimate_date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
@@ -175,7 +159,7 @@ export function useEstiamtesTableColumns() {
|
|||||||
id: 'expiration_date',
|
id: 'expiration_date',
|
||||||
Header: intl.get('expiration_date'),
|
Header: intl.get('expiration_date'),
|
||||||
accessor: 'expiration_date',
|
accessor: 'expiration_date',
|
||||||
Cell: DateCell,
|
Cell: FormatDateCell,
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'expiration_date',
|
className: 'expiration_date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
@@ -198,6 +182,7 @@ export function useEstiamtesTableColumns() {
|
|||||||
width: 140,
|
width: 140,
|
||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'status',
|
id: 'status',
|
||||||
|
|||||||
@@ -8,9 +8,17 @@ import {
|
|||||||
ProgressBar,
|
ProgressBar,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import moment from 'moment';
|
import clsx from 'classnames';
|
||||||
|
|
||||||
import { FormattedMessage as T, AppToaster, Choose, If, Icon } from 'components';
|
import { CLASSES } from '../../../../common/classes';
|
||||||
|
import {
|
||||||
|
FormatDateCell,
|
||||||
|
FormattedMessage as T,
|
||||||
|
AppToaster,
|
||||||
|
Choose,
|
||||||
|
If,
|
||||||
|
Icon,
|
||||||
|
} from 'components';
|
||||||
import { formattedAmount, safeCallback, calculateStatus } from 'utils';
|
import { formattedAmount, safeCallback, calculateStatus } from 'utils';
|
||||||
|
|
||||||
export const statusAccessor = (row) => {
|
export const statusAccessor = (row) => {
|
||||||
@@ -150,7 +158,8 @@ export function useInvoicesTableColumns() {
|
|||||||
{
|
{
|
||||||
id: 'invoice_date',
|
id: 'invoice_date',
|
||||||
Header: intl.get('invoice_date'),
|
Header: intl.get('invoice_date'),
|
||||||
accessor: (r) => moment(r.invoice_date).format('YYYY MMM DD'),
|
accessor: 'invoice_date',
|
||||||
|
Cell: FormatDateCell,
|
||||||
width: 110,
|
width: 110,
|
||||||
className: 'invoice_date',
|
className: 'invoice_date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
@@ -183,6 +192,7 @@ export function useInvoicesTableColumns() {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'status',
|
id: 'status',
|
||||||
@@ -195,7 +205,8 @@ export function useInvoicesTableColumns() {
|
|||||||
{
|
{
|
||||||
id: 'due_date',
|
id: 'due_date',
|
||||||
Header: intl.get('due_date'),
|
Header: intl.get('due_date'),
|
||||||
accessor: (r) => moment(r.due_date).format('YYYY MMM DD'),
|
accessor: 'due_date',
|
||||||
|
Cell: FormatDateCell,
|
||||||
width: 110,
|
width: 110,
|
||||||
className: 'due_date',
|
className: 'due_date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ import {
|
|||||||
Position,
|
Position,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import moment from 'moment';
|
import clsx from 'classnames';
|
||||||
|
|
||||||
import { Money, Icon } from 'components';
|
import { FormatDateCell, Money, Icon } from 'components';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
|
import { CLASSES } from '../../../../common/classes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table actions menu.
|
* Table actions menu.
|
||||||
@@ -56,13 +57,6 @@ export function AmountAccessor(row) {
|
|||||||
return <Money amount={row.amount} currency={row.currency_code} />;
|
return <Money amount={row.amount} currency={row.currency_code} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Payment date accessor.
|
|
||||||
*/
|
|
||||||
export function PaymentDateAccessor(row) {
|
|
||||||
return moment(row.payment_date).format('YYYY MMM DD');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actions cell.
|
* Actions cell.
|
||||||
*/
|
*/
|
||||||
@@ -86,7 +80,8 @@ export function usePaymentReceivesColumns() {
|
|||||||
{
|
{
|
||||||
id: 'payment_date',
|
id: 'payment_date',
|
||||||
Header: intl.get('payment_date'),
|
Header: intl.get('payment_date'),
|
||||||
accessor: PaymentDateAccessor,
|
accessor: 'payment_date',
|
||||||
|
Cell: FormatDateCell,
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'payment_date',
|
className: 'payment_date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
@@ -109,6 +104,7 @@ export function usePaymentReceivesColumns() {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'payment_receive_no',
|
id: 'payment_receive_no',
|
||||||
|
|||||||
@@ -11,10 +11,11 @@ import {
|
|||||||
Tag,
|
Tag,
|
||||||
Button,
|
Button,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
import moment from 'moment';
|
import clsx from 'classnames';
|
||||||
|
|
||||||
|
import { CLASSES } from '../../../../common/classes';
|
||||||
import { safeCallback } from 'utils';
|
import { safeCallback } from 'utils';
|
||||||
import { Choose, Money, Icon, If } from 'components';
|
import { FormatDateCell, Choose, Money, Icon, If } from 'components';
|
||||||
|
|
||||||
export function ActionsMenu({
|
export function ActionsMenu({
|
||||||
payload: { onEdit, onDelete, onClose, onDrawer, onViewDetails, onPrint },
|
payload: { onEdit, onDelete, onClose, onDrawer, onViewDetails, onPrint },
|
||||||
@@ -99,7 +100,8 @@ export function useReceiptsTableColumns() {
|
|||||||
{
|
{
|
||||||
id: 'receipt_date',
|
id: 'receipt_date',
|
||||||
Header: intl.get('receipt_date'),
|
Header: intl.get('receipt_date'),
|
||||||
accessor: (r) => moment(r.receipt_date).format('YYYY MMM DD'),
|
accessor: 'receipt_date',
|
||||||
|
Cell: FormatDateCell,
|
||||||
width: 140,
|
width: 140,
|
||||||
className: 'receipt_date',
|
className: 'receipt_date',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
@@ -140,6 +142,7 @@ export function useReceiptsTableColumns() {
|
|||||||
align: 'right',
|
align: 'right',
|
||||||
clickable: true,
|
clickable: true,
|
||||||
textOverview: true,
|
textOverview: true,
|
||||||
|
className: clsx(CLASSES.FONT_BOLD),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'status',
|
id: 'status',
|
||||||
|
|||||||
@@ -1352,6 +1352,9 @@
|
|||||||
"payment_receive.auto_increment.manually": "يتم تعيين سندات الدفع يدوياً. هل أنت متأكد من تغيير هذه الإعدادات؟",
|
"payment_receive.auto_increment.manually": "يتم تعيين سندات الدفع يدوياً. هل أنت متأكد من تغيير هذه الإعدادات؟",
|
||||||
"auto_increment.field.manually": "سأدخلها يدويًا في كل مرة",
|
"auto_increment.field.manually": "سأدخلها يدويًا في كل مرة",
|
||||||
"auto_increment.field.manual_this_transaction": "إدخال يدوي لهذه العملية فقط.",
|
"auto_increment.field.manual_this_transaction": "إدخال يدوي لهذه العملية فقط.",
|
||||||
"auto_increment.field.auto": "زيادة الرقم العملية تلقائيًا."
|
"auto_increment.field.auto": "زيادة الرقم العملية تلقائيًا.",
|
||||||
|
"date_format": {
|
||||||
|
"YYYY MMM DD": "DD MMM YYYY"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1323,5 +1323,8 @@
|
|||||||
"payment_receive.auto_increment.manually": "Yor payment numbers are set on manual mode. Are you sure chaning this settings?",
|
"payment_receive.auto_increment.manually": "Yor payment numbers are set on manual mode. Are you sure chaning this settings?",
|
||||||
"auto_increment.field.manually": "I will enter them manually each time",
|
"auto_increment.field.manually": "I will enter them manually each time",
|
||||||
"auto_increment.field.manual_this_transaction": "Manual entering for this transaction.",
|
"auto_increment.field.manual_this_transaction": "Manual entering for this transaction.",
|
||||||
"auto_increment.field.auto": "Auto-incrementing number."
|
"auto_increment.field.auto": "Auto-incrementing number.",
|
||||||
|
"date_format": {
|
||||||
|
"YYYY MMM DD": "YYYY MMM DD"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -282,3 +282,7 @@ html[lang^="ar"] {
|
|||||||
.align-right{
|
.align-right{
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.font-bold{
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user