mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
chrone: sperate client and server to different repos.
This commit is contained in:
38
src/components/PaymentReceiveListField.js
Normal file
38
src/components/PaymentReceiveListField.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import { MenuItem } from '@blueprintjs/core';
|
||||
import ListSelect from 'components/ListSelect';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
function PaymentReceiveListField({
|
||||
invoices,
|
||||
selectedInvoiceId,
|
||||
onInvoiceSelected,
|
||||
defaultSelectText = <T id={'select_invoice'} />,
|
||||
}) {
|
||||
const onInvoiceSelect = useCallback((_invoice) => {
|
||||
onInvoiceSelected && onInvoiceSelected(_invoice);
|
||||
});
|
||||
|
||||
const handleInvoiceRenderer = useCallback(
|
||||
(item, { handleClick }) => (
|
||||
<MenuItem id={item.id} name={item.name} onClick={handleClick} />
|
||||
),
|
||||
[],
|
||||
);
|
||||
|
||||
return (
|
||||
<ListSelect
|
||||
item={invoices}
|
||||
noResults={<MenuItem disabled={true} text={<T id={'no_results'} />} />}
|
||||
itemRenderer={handleInvoiceRenderer}
|
||||
popoverProps={{ minimal: true }}
|
||||
onItemSelect={onInvoiceSelect}
|
||||
selectedItem={`${selectedInvoiceId}`}
|
||||
selectedItemProp={'id'}
|
||||
textProp={'name'}
|
||||
defaultText={defaultSelectText}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default PaymentReceiveListField;
|
||||
Reference in New Issue
Block a user