diff --git a/client/src/common/classes.js b/client/src/common/classes.js index f6112b1a8..ca94a067a 100644 --- a/client/src/common/classes.js +++ b/client/src/common/classes.js @@ -8,6 +8,9 @@ const CLASSES = { PAGE_FORM: 'page-form', PAGE_FORM_HEADER: 'page-form__header', PAGE_FORM_HEADER_PRIMARY: 'page-form__primary-section', + PAGE_FORM_HEADER_FIELDS: 'page-form__header-fields', + PAGE_FORM_HEADER_BIG_NUMBERS: 'page-form__big-numbers', + PAGE_FORM_FOOTER: 'page-form__footer', PAGE_FORM_FLOATING_ACTIONS: 'page-form__floating-actions', diff --git a/client/src/containers/Purchases/Bill/BillForm.js b/client/src/containers/Purchases/Bill/BillForm.js index 47c800e5a..9a05536eb 100644 --- a/client/src/containers/Purchases/Bill/BillForm.js +++ b/client/src/containers/Purchases/Bill/BillForm.js @@ -13,10 +13,12 @@ import classNames from 'classnames'; import { FormattedMessage as T, useIntl } from 'react-intl'; import { pick } from 'lodash'; import { CLASSES } from 'common/classes'; + import BillFormHeader from './BillFormHeader'; import EstimatesItemsTable from 'containers/Sales/Estimate/EntriesItemsTable'; import BillFloatingActions from './BillFloatingActions'; import BillFormFooter from './BillFormFooter'; + import withDashboardActions from 'containers/Dashboard/withDashboardActions'; import withMediaActions from 'containers/Media/withMediaActions'; import withBillActions from './withBillActions'; @@ -41,6 +43,7 @@ function BillForm({ //#withDashboard changePageTitle, + changePageSubtitle, //#withBillDetail bill, @@ -235,6 +238,7 @@ function BillForm({ setSubmitting(false); saveBillSubmit({ action: 'update', ...payload }); resetForm(); + changePageSubtitle(''); }) .catch((errors) => { handleErrors(errors, { setErrors }); @@ -302,10 +306,22 @@ function BillForm({ orderingIndex([...formik.values.entries, defaultBill]), ); }; + + const handleBillNumberChanged = useCallback((billNumber) => { + changePageSubtitle(billNumber); + }, []); + + // Clear page subtitle once unmount bill form page. + useEffect(() => () => { + changePageSubtitle(''); + }, [changePageSubtitle]); + return (
- + { + onBillNumberChanged && onBillNumberChanged(event.currentTarget.value); + }; + return (
@@ -166,6 +171,7 @@ function BillFormHeader({ intent={errors.bill_number && touched.bill_number && Intent.DANGER} minimal={true} {...getFieldProps('bill_number')} + onBlur={handleBillNumberBlur} /> diff --git a/client/src/containers/Purchases/Bill/withBills.js b/client/src/containers/Purchases/Bill/withBills.js index b3c4729f1..94bebc7e2 100644 --- a/client/src/containers/Purchases/Bill/withBills.js +++ b/client/src/containers/Purchases/Bill/withBills.js @@ -5,8 +5,7 @@ import { getBillPaginationMetaFactory, getBillTableQueryFactory, getVendorPayableBillsFactory, - getPayableBillsByPaymentMadeFactory, - getPaymentMadeFormPayableBillsFactory + getVendorPayableBillsEntriesFactory, } from 'store/Bills/bills.selectors'; export default (mapState) => { @@ -14,8 +13,7 @@ export default (mapState) => { const getBillsPaginationMeta = getBillPaginationMetaFactory(); const getBillTableQuery = getBillTableQueryFactory(); const getVendorPayableBills = getVendorPayableBillsFactory(); - const getPayableBillsByPaymentMade = getPayableBillsByPaymentMadeFactory(); - const getPaymentMadeFormPayableBills = getPaymentMadeFormPayableBillsFactory(); + const getVendorPayableBillsEntries = getVendorPayableBillsEntriesFactory(); const mapStateToProps = (state, props) => { const tableQuery = getBillTableQuery(state, props); @@ -29,9 +27,8 @@ export default (mapState) => { billsPageination: getBillsPaginationMeta(state, props, tableQuery), billsLoading: state.bills.loading, nextBillNumberChanged: state.bills.nextBillNumberChanged, - - // vendorPayableBills: getVendorPayableBills(state, props), - paymentMadePayableBills: getPaymentMadeFormPayableBills(state, props), + vendorPayableBills: getVendorPayableBills(state, props), + vendorPayableBillsEntries: getVendorPayableBillsEntries(state, props), }; return mapState ? mapState(mapped, state, props) : mapped; }; diff --git a/client/src/containers/Purchases/PaymentMades/PaymentMade.js b/client/src/containers/Purchases/PaymentMades/PaymentMade.js index 7eee9a8fb..6afad957b 100644 --- a/client/src/containers/Purchases/PaymentMades/PaymentMade.js +++ b/client/src/containers/Purchases/PaymentMades/PaymentMade.js @@ -83,6 +83,7 @@ function PaymentMade({ > ); diff --git a/client/src/containers/Purchases/PaymentMades/PaymentMadeFooter.js b/client/src/containers/Purchases/PaymentMades/PaymentMadeFooter.js new file mode 100644 index 000000000..d91bd7606 --- /dev/null +++ b/client/src/containers/Purchases/PaymentMades/PaymentMadeFooter.js @@ -0,0 +1,32 @@ +import React from 'react'; +import classNames from 'classnames'; +import { FormGroup, TextArea } from '@blueprintjs/core'; +import { FormattedMessage as T } from 'react-intl'; +import { Row, Col } from 'components'; +import { CLASSES } from 'common/classes'; + +/** + * Payment made form footer. + */ +export default function PaymentMadeFooter({ + getFieldProps +}) { + return ( +
+ + + {/* --------- Statement --------- */} + } + className={'form-group--statement'} + > +