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:
a.bouhuolia
2021-02-25 10:51:27 +02:00
parent 5a58e9bafd
commit 9e2c995813
84 changed files with 1019 additions and 682 deletions

View File

@@ -3,7 +3,7 @@ import { FormGroup, TextArea } from '@blueprintjs/core';
import { FormattedMessage as T } from 'react-intl';
import { FastField } from 'formik';
import classNames from 'classnames';
import { Row, Col } from 'components';
import { Postbox, Row, Col } from 'components';
import { CLASSES } from 'common/classes';
import Dragzone from 'components/Dragzone';
import { inputIntent } from 'utils';
@@ -12,30 +12,32 @@ import { inputIntent } from 'utils';
export default function BillFormFooter() {
return (
<div class={classNames(CLASSES.PAGE_FORM_FOOTER)}>
<Row>
<Col md={8}>
<FastField name={'note'}>
{({ field, meta: { error, touched } }) => (
<FormGroup
label={<T id={'note'} />}
className={'form-group--note'}
intent={inputIntent({ error, touched })}
>
<TextArea growVertically={true} {...field} />
</FormGroup>
)}
</FastField>
</Col>
<Postbox title={'Bill details'} defaultOpen={false}>
<Row>
<Col md={8}>
<FastField name={'note'}>
{({ field, meta: { error, touched } }) => (
<FormGroup
label={<T id={'note'} />}
className={'form-group--note'}
intent={inputIntent({ error, touched })}
>
<TextArea growVertically={true} {...field} />
</FormGroup>
)}
</FastField>
</Col>
<Col md={4}>
<Dragzone
initialFiles={[]}
// onDrop={onDropFiles}
// onDeleteFile={onDropFiles}
hint={'Attachments: Maxiumum size: 20MB'}
/>
</Col>
</Row>
<Col md={4}>
<Dragzone
initialFiles={[]}
// onDrop={onDropFiles}
// onDeleteFile={onDropFiles}
hint={'Attachments: Maxiumum size: 20MB'}
/>
</Col>
</Row>
</Postbox>
</div>
);
}

View File

@@ -7,8 +7,8 @@ export const defaultBillEntry = {
index: 0,
item_id: '',
rate: '',
discount: 0,
quantity: 1,
discount: '',
quantity: '',
description: '',
};

View File

@@ -20,23 +20,23 @@ function PaymentMadeEntriesTable({
entries,
// #withAlertsActions
openAlert
openAlert,
}) {
const {
paymentVendorId,
isDueBillsFetching,
} = usePaymentMadeFormContext();
const { paymentVendorId, isDueBillsFetching } = usePaymentMadeFormContext();
const columns = usePaymentMadeEntriesTableColumns();
// Handle update data.
const handleUpdateData = useCallback((rowIndex, columnId, value) => {
const newRows = compose(
updateTableRow(rowIndex, columnId, value),
)(entries);
onUpdateData(newRows);
}, [onUpdateData, entries]);
// Handle update data.
const handleUpdateData = useCallback(
(rowIndex, columnId, value) => {
const newRows = compose(updateTableRow(rowIndex, columnId, value))(
entries,
);
onUpdateData(newRows);
},
[onUpdateData, entries],
);
// Detarmines the right no results message before selecting vendor and aftering
// selecting vendor id.
@@ -44,15 +44,6 @@ function PaymentMadeEntriesTable({
? 'There is no payable bills for this vendor that can be applied for this payment'
: 'Please select a vendor to display all open bills for it.';
// Handle clear all lines action.
const handleClearAllLines = () => {
const fullAmount = safeSumBy(entries, 'payment_amount');
if (fullAmount > 0) {
openAlert('clear-all-lines-payment-made');
}
}
return (
<CloudLoadingIndicator isLoading={isDueBillsFetching}>
<DataTableEditable
@@ -66,21 +57,10 @@ function PaymentMadeEntriesTable({
updateData: handleUpdateData,
}}
noResults={noResultsMessage}
actions={
<Button
small={true}
className={'button--secondary button--clear-lines'}
onClick={handleClearAllLines}
>
<T id={'clear_all_lines'} />
</Button>
}
totalRow={true}
footer={true}
/>
</CloudLoadingIndicator>
);
}
export default compose(
withAlertActions
)(PaymentMadeEntriesTable);
export default compose(withAlertActions)(PaymentMadeEntriesTable);

View File

@@ -3,7 +3,7 @@ import classNames from 'classnames';
import { FormGroup, TextArea } from '@blueprintjs/core';
import { FormattedMessage as T } from 'react-intl';
import { FastField } from 'formik';
import { Row, Col } from 'components';
import { Postbox, Row, Col } from 'components';
import { CLASSES } from 'common/classes';
/**
@@ -12,21 +12,23 @@ import { CLASSES } from 'common/classes';
export default function PaymentMadeFooter() {
return (
<div className={classNames(CLASSES.PAGE_FORM_FOOTER)}>
<Row>
<Col md={8}>
{/* --------- Statement --------- */}
<FastField name={'customer_name'}>
{({ form, field, meta: { error, touched } }) => (
<FormGroup
label={<T id={'statement'} />}
className={'form-group--statement'}
>
<TextArea growVertically={true} {...field} />
</FormGroup>
)}
</FastField>
</Col>
</Row>
<Postbox title={'Payment made details'} defaultOpen={false}>
<Row>
<Col md={8}>
{/* --------- Statement --------- */}
<FastField name={'customer_name'}>
{({ form, field, meta: { error, touched } }) => (
<FormGroup
label={<T id={'statement'} />}
className={'form-group--statement'}
>
<TextArea growVertically={true} {...field} />
</FormGroup>
)}
</FastField>
</Col>
</Row>
</Postbox>
</div>
);
}