mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
fix: logo style.
fix: page forms style. feat: auto-fill items entries from item details. fix: hiding dashboard copyright bar.
This commit is contained in:
@@ -118,8 +118,8 @@ function ExpenseForm({
|
||||
};
|
||||
|
||||
// Handle request error
|
||||
const handleError = (error) => {
|
||||
transformErrors(error, { setErrors });
|
||||
const handleError = ({ response: { data: { errors } } }) => {
|
||||
transformErrors(errors, { setErrors });
|
||||
setSubmitting(false);
|
||||
};
|
||||
if (isNewMode) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import { transformUpdatedRows, compose, saveInvoke, repeatValue } from 'utils';
|
||||
* Expenses form entries.
|
||||
*/
|
||||
function ExpenseFormEntriesTable({
|
||||
// #withAlertActions
|
||||
// #withAlertActions
|
||||
openAlert,
|
||||
|
||||
// #ownPorps
|
||||
@@ -57,65 +57,21 @@ function ExpenseFormEntriesTable({
|
||||
[entries, onChange],
|
||||
);
|
||||
|
||||
// Invoke when click on add new line button.
|
||||
const onClickNewRow = () => {
|
||||
const newRows = [...entries, defaultEntry];
|
||||
saveInvoke(onChange, newRows);
|
||||
};
|
||||
|
||||
// Invoke when click on clear all lines button.
|
||||
const handleClickClearAllLines = () => {
|
||||
openAlert('expense-delete-entries');
|
||||
};
|
||||
|
||||
// handle confirm clear all entries alert.
|
||||
const handleConfirmClearEntriesAlert = () => {
|
||||
const newRows = repeatValue(defaultEntry, 3);
|
||||
saveInvoke(onChange, newRows);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<DataTableEditable
|
||||
columns={columns}
|
||||
data={entries}
|
||||
sticky={true}
|
||||
payload={{
|
||||
accounts: accounts,
|
||||
errors: error,
|
||||
updateData: handleUpdateData,
|
||||
removeRow: handleRemoveRow,
|
||||
autoFocus: ['expense_account_id', 0],
|
||||
}}
|
||||
actions={
|
||||
<>
|
||||
<Button
|
||||
small={true}
|
||||
className={'button--secondary button--new-line'}
|
||||
onClick={onClickNewRow}
|
||||
>
|
||||
<T id={'new_lines'} />
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
small={true}
|
||||
className={'button--secondary button--clear-lines ml1'}
|
||||
onClick={handleClickClearAllLines}
|
||||
>
|
||||
<T id={'clear_all_lines'} />
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
totalRow={true}
|
||||
/>
|
||||
<ExpenseDeleteEntriesAlert
|
||||
name={'expense-delete-entries'}
|
||||
onConfirm={handleConfirmClearEntriesAlert}
|
||||
/>
|
||||
</>
|
||||
<DataTableEditable
|
||||
columns={columns}
|
||||
data={entries}
|
||||
sticky={true}
|
||||
payload={{
|
||||
accounts: accounts,
|
||||
errors: error,
|
||||
updateData: handleUpdateData,
|
||||
removeRow: handleRemoveRow,
|
||||
autoFocus: ['expense_account_id', 0],
|
||||
}}
|
||||
footer={true}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withAlertActions
|
||||
)(ExpenseFormEntriesTable);
|
||||
export default compose(withAlertActions)(ExpenseFormEntriesTable);
|
||||
|
||||
@@ -4,36 +4,38 @@ import { FormGroup, TextArea } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import classNames from 'classnames';
|
||||
import { inputIntent } from 'utils';
|
||||
import { Row, Dragzone, Col } from 'components';
|
||||
import { Row, Dragzone, Col, Postbox } from 'components';
|
||||
import { CLASSES } from 'common/classes';
|
||||
|
||||
export default function ExpenseFormFooter() {
|
||||
return (
|
||||
<div className={classNames(CLASSES.PAGE_FORM_FOOTER)}>
|
||||
<Row>
|
||||
<Col md={8}>
|
||||
<FastField name={'description'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={<T id={'description'} />}
|
||||
className={'form-group--description'}
|
||||
intent={inputIntent({ error, touched })}
|
||||
>
|
||||
<TextArea growVertically={true} {...field} />
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
</Col>
|
||||
<Postbox title={'Expense details'} defaultOpen={false}>
|
||||
<Row>
|
||||
<Col md={8}>
|
||||
<FastField name={'description'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={<T id={'description'} />}
|
||||
className={'form-group--description'}
|
||||
intent={inputIntent({ error, touched })}
|
||||
>
|
||||
<TextArea growVertically={true} {...field} />
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
</Col>
|
||||
|
||||
<Col md={4}>
|
||||
<Dragzone
|
||||
initialFiles={[]}
|
||||
// onDrop={handleDropFiles}
|
||||
// onDeleteFile={handleDeleteFile}
|
||||
hint={'Attachments: Maxiumum size: 20MB'}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
<Col md={4}>
|
||||
<Dragzone
|
||||
initialFiles={[]}
|
||||
// onDrop={handleDropFiles}
|
||||
// onDeleteFile={handleDeleteFile}
|
||||
hint={'Attachments: Maxiumum size: 20MB'}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</Postbox>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React from 'react';
|
||||
import { InputGroup, FormGroup, Position, Classes } from '@blueprintjs/core';
|
||||
import { DateInput } from '@blueprintjs/datetime';
|
||||
import { FastField } from 'formik';
|
||||
import { FastField, ErrorMessage } from 'formik';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
import classNames from 'classnames';
|
||||
import { CLASSES } from 'common/classes';
|
||||
import {
|
||||
momentFormatter,
|
||||
@@ -10,16 +11,13 @@ import {
|
||||
inputIntent,
|
||||
handleDateChange,
|
||||
} from 'utils';
|
||||
import classNames from 'classnames';
|
||||
import {
|
||||
CurrencySelectList,
|
||||
ContactSelecetList,
|
||||
ErrorMessage,
|
||||
AccountsSelectList,
|
||||
FieldRequiredHint,
|
||||
Hint,
|
||||
} from 'components';
|
||||
|
||||
import { ACCOUNT_PARENT_TYPE } from 'common/accountTypes';
|
||||
import { useExpenseFormContext } from './ExpenseFormPageProvider';
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
|
||||
import 'style/pages/Expense/PageForm.scss';
|
||||
|
||||
import ExpenseForm from './ExpenseForm';
|
||||
import { ExpenseFormPageProvider } from './ExpenseFormPageProvider';
|
||||
|
||||
import 'style/pages/Expense/PageForm.scss';
|
||||
|
||||
/**
|
||||
* Expense page form.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user