mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
WIP: Feature JournalNumber dialog / Fix: ItemCategory & EditMakeJournal & Expenses
This commit is contained in:
@@ -6,10 +6,11 @@ export default function MakeJournalEntriesFooter({
|
||||
formik: { isSubmitting },
|
||||
onSubmitClick,
|
||||
onCancelClick,
|
||||
manualJournal,
|
||||
}) {
|
||||
return (
|
||||
<div>
|
||||
<div class='form__floating-footer'>
|
||||
<div class="form__floating-footer">
|
||||
<Button
|
||||
disabled={isSubmitting}
|
||||
intent={Intent.PRIMARY}
|
||||
@@ -18,7 +19,11 @@ export default function MakeJournalEntriesFooter({
|
||||
onSubmitClick({ publish: true, redirect: true });
|
||||
}}
|
||||
>
|
||||
<T id={'save'} />
|
||||
{manualJournal && manualJournal.id ? (
|
||||
<T id={'edit'} />
|
||||
) : (
|
||||
<T id={'save'} />
|
||||
)}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
@@ -49,7 +54,7 @@ export default function MakeJournalEntriesFooter({
|
||||
onCancelClick && onCancelClick();
|
||||
}}
|
||||
>
|
||||
<T id={'cancel'}/>
|
||||
<T id={'cancel'} />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -34,7 +34,8 @@ const ERROR = {
|
||||
VENDORS_NOT_WITH_PAYABLE_ACCOUNT: 'VENDORS.NOT.WITH.PAYABLE.ACCOUNT',
|
||||
PAYABLE_ENTRIES_HAS_NO_VENDORS: 'PAYABLE.ENTRIES.HAS.NO.VENDORS',
|
||||
RECEIVABLE_ENTRIES_HAS_NO_CUSTOMERS: 'RECEIVABLE.ENTRIES.HAS.NO.CUSTOMERS',
|
||||
CREDIT_DEBIT_SUMATION_SHOULD_NOT_EQUAL_ZERO:'CREDIT.DEBIT.SUMATION.SHOULD.NOT.EQUAL.ZERO'
|
||||
CREDIT_DEBIT_SUMATION_SHOULD_NOT_EQUAL_ZERO:
|
||||
'CREDIT.DEBIT.SUMATION.SHOULD.NOT.EQUAL.ZERO',
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -58,7 +59,6 @@ function MakeJournalEntriesForm({
|
||||
onFormSubmit,
|
||||
onCancelForm,
|
||||
}) {
|
||||
|
||||
const { formatMessage } = useIntl();
|
||||
const {
|
||||
setFiles,
|
||||
@@ -75,7 +75,6 @@ function MakeJournalEntriesForm({
|
||||
setFiles(_files.filter((file) => file.uploaded === false));
|
||||
}, []);
|
||||
|
||||
|
||||
const savedMediaIds = useRef([]);
|
||||
const clearSavedMediaIds = () => {
|
||||
savedMediaIds.current = [];
|
||||
@@ -140,6 +139,7 @@ function MakeJournalEntriesForm({
|
||||
|
||||
const defaultEntry = useMemo(
|
||||
() => ({
|
||||
index: 0,
|
||||
account_id: null,
|
||||
credit: 0,
|
||||
debit: 0,
|
||||
@@ -251,7 +251,7 @@ function MakeJournalEntriesForm({
|
||||
}),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const formik = useFormik({
|
||||
@@ -262,7 +262,7 @@ function MakeJournalEntriesForm({
|
||||
},
|
||||
onSubmit: async (values, { setErrors, setSubmitting, resetForm }) => {
|
||||
const entries = values.entries.filter(
|
||||
(entry) => entry.credit || entry.debit,
|
||||
(entry) => entry.debit || entry.credit,
|
||||
);
|
||||
const getTotal = (type = 'credit') => {
|
||||
return entries.reduce((total, item) => {
|
||||
@@ -413,6 +413,7 @@ function MakeJournalEntriesForm({
|
||||
formik={formik}
|
||||
onSubmitClick={handleSubmitClick}
|
||||
onCancelClick={handleCancelClick}
|
||||
manualJournal={manualJournal}
|
||||
/>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
Intent,
|
||||
Position,
|
||||
Classes,
|
||||
Button,
|
||||
} from '@blueprintjs/core';
|
||||
import { DateInput } from '@blueprintjs/datetime';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
@@ -18,11 +19,18 @@ import {
|
||||
Hint,
|
||||
FieldHint,
|
||||
FieldRequiredHint,
|
||||
Icon,
|
||||
} from 'components';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
|
||||
export default function MakeJournalEntriesHeader({
|
||||
import { compose } from 'utils';
|
||||
|
||||
function MakeJournalEntriesHeader({
|
||||
formik: { errors, touched, values, setFieldValue, getFieldProps },
|
||||
|
||||
// #withDialog
|
||||
openDialog,
|
||||
}) {
|
||||
const handleDateChange = useCallback(
|
||||
(date) => {
|
||||
@@ -31,6 +39,9 @@ export default function MakeJournalEntriesHeader({
|
||||
},
|
||||
[setFieldValue],
|
||||
);
|
||||
const handleJournalNumberChange = useCallback(() => {
|
||||
openDialog('journalNumber-form', {});
|
||||
}, [openDialog]);
|
||||
|
||||
return (
|
||||
<div class="make-journal-entries__header">
|
||||
@@ -62,7 +73,15 @@ export default function MakeJournalEntriesHeader({
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
|
||||
<Col width={50}>
|
||||
{/* <FormGroup> */}
|
||||
<Button
|
||||
className={classNames('btn', Classes.SMALL)}
|
||||
icon={<Icon icon="setting" />}
|
||||
onClick={handleJournalNumberChange}
|
||||
/>
|
||||
{/* </FormGroup> */}
|
||||
</Col>
|
||||
<Col width={220}>
|
||||
<FormGroup
|
||||
label={<T id={'date'} />}
|
||||
@@ -153,3 +172,5 @@ export default function MakeJournalEntriesHeader({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withDialogActions)(MakeJournalEntriesHeader);
|
||||
|
||||
Reference in New Issue
Block a user