@@ -91,10 +66,11 @@ function BillFormHeader({
}
>
-
}
+ onContactSelected={onChangeSelected('vendor_id')}
/>
diff --git a/client/src/containers/Purchases/PaymentMades/PaymentMadeFormHeader.js b/client/src/containers/Purchases/PaymentMades/PaymentMadeFormHeader.js
index 172c29396..c3ccb237a 100644
--- a/client/src/containers/Purchases/PaymentMades/PaymentMadeFormHeader.js
+++ b/client/src/containers/Purchases/PaymentMades/PaymentMadeFormHeader.js
@@ -16,7 +16,7 @@ import { CLASSES } from 'common/classes';
import { momentFormatter, compose, tansformDateValue } from 'utils';
import {
AccountsSelectList,
- VendorSelecetList,
+ ContactSelecetList,
ErrorMessage,
FieldRequiredHint,
Money,
@@ -68,16 +68,6 @@ function PaymentMadeFormHeader({
[setFieldValue],
);
- const handleVenderRenderer = useCallback(
- (vender, { handleClick }) => (
-
- ),
- [],
- );
const triggerFullAmountChanged = (value) => {
onFullAmountChanged && onFullAmountChanged(value);
@@ -87,19 +77,6 @@ function PaymentMadeFormHeader({
triggerFullAmountChanged(event.currentTarget.value);
};
- const handleFilterVender = (query, vender, index, exactMatch) => {
- const normalizedTitle = vender.display_name.toLowerCase();
- const normalizedQuery = query.toLowerCase();
- if (exactMatch) {
- return normalizedTitle === normalizedQuery;
- } else {
- return (
- `${vender.display_name} ${normalizedTitle}`.indexOf(normalizedQuery) >=
- 0
- );
- }
- };
-
const onChangeSelect = useCallback(
(filedName) => {
return (item) => {
@@ -133,10 +110,11 @@ function PaymentMadeFormHeader({
}
>
-
}
+ onContactSelected={onChangeSelect('vendor_id')}
// buttonProps={{ disabled: !isNewMode }}
disabled={!isNewMode}
/>
diff --git a/client/src/containers/Sales/Estimate/EstimateFormHeader.js b/client/src/containers/Sales/Estimate/EstimateFormHeader.js
index c120a6ebb..1cbfdc8d4 100644
--- a/client/src/containers/Sales/Estimate/EstimateFormHeader.js
+++ b/client/src/containers/Sales/Estimate/EstimateFormHeader.js
@@ -14,7 +14,7 @@ import { momentFormatter, compose, tansformDateValue } from 'utils';
import classNames from 'classnames';
import { CLASSES } from 'common/classes';
import {
- ListSelect,
+ ContactSelecetList,
ErrorMessage,
FieldRequiredHint,
Icon,
@@ -53,21 +53,6 @@ function EstimateFormHeader({
[],
);
- // Filter Customer
- const filterCustomer = (query, customer, _index, exactMatch) => {
- const normalizedTitle = customer.display_name.toLowerCase();
- const normalizedQuery = query.toLowerCase();
- if (exactMatch) {
- return normalizedTitle === normalizedQuery;
- } else {
- return (
- `${customer.display_name} ${normalizedTitle}`.indexOf(
- normalizedQuery,
- ) >= 0
- );
- }
- };
-
// handle change customer
const onChangeCustomer = useCallback(
(filedName) => {
@@ -99,17 +84,11 @@ function EstimateFormHeader({
}
>
-
}
- itemRenderer={CustomerRenderer}
- itemPredicate={filterCustomer}
- popoverProps={{ minimal: true }}
- onItemSelect={onChangeCustomer('customer_id')}
- selectedItem={values.customer_id}
- selectedItemProp={'id'}
- defaultText={
}
- labelProp={'display_name'}
+
}
+ onContactSelected={onChangeCustomer('customer_id')}
/>
diff --git a/client/src/containers/Sales/Invoice/InvoiceFormHeader.js b/client/src/containers/Sales/Invoice/InvoiceFormHeader.js
index ade8b97e0..960f4d9ea 100644
--- a/client/src/containers/Sales/Invoice/InvoiceFormHeader.js
+++ b/client/src/containers/Sales/Invoice/InvoiceFormHeader.js
@@ -13,7 +13,7 @@ import { momentFormatter, compose, tansformDateValue } from 'utils';
import classNames from 'classnames';
import { CLASSES } from 'common/classes';
import {
- ListSelect,
+ ContactSelecetList,
ErrorMessage,
FieldRequiredHint,
Icon,
@@ -52,21 +52,6 @@ function InvoiceFormHeader({
[],
);
- // Filter Customer
- const filterCustomer = (query, customer, _index, exactMatch) => {
- const normalizedTitle = customer.display_name.toLowerCase();
- const normalizedQuery = query.toLowerCase();
- if (exactMatch) {
- return normalizedTitle === normalizedQuery;
- } else {
- return (
- `${customer.display_name} ${normalizedTitle}`.indexOf(
- normalizedQuery,
- ) >= 0
- );
- }
- };
-
// handle change customer
const onChangeCustomer = useCallback(
(filedName) => {
@@ -99,17 +84,11 @@ function InvoiceFormHeader({
}
>
-
}
- itemRenderer={CustomerRenderer}
- itemPredicate={filterCustomer}
- popoverProps={{ minimal: true }}
- onItemSelect={onChangeCustomer('customer_id')}
- selectedItem={values.customer_id}
- selectedItemProp={'id'}
- defaultText={
}
- labelProp={'display_name'}
+
}
+ onContactSelected={onChangeCustomer('customer_id')}
/>
diff --git a/client/src/containers/Sales/PaymentReceive/PaymentReceiveFormHeader.js b/client/src/containers/Sales/PaymentReceive/PaymentReceiveFormHeader.js
index 0396e55da..e6e784406 100644
--- a/client/src/containers/Sales/PaymentReceive/PaymentReceiveFormHeader.js
+++ b/client/src/containers/Sales/PaymentReceive/PaymentReceiveFormHeader.js
@@ -13,11 +13,11 @@ import moment from 'moment';
import { sumBy } from 'lodash';
import classNames from 'classnames';
-import { CLASSES } from 'common/classes'
+import { CLASSES } from 'common/classes';
import { momentFormatter, compose, tansformDateValue } from 'utils';
import {
AccountsSelectList,
- ListSelect,
+ ContactSelecetList,
ErrorMessage,
FieldRequiredHint,
Hint,
@@ -72,19 +72,6 @@ function PaymentReceiveFormHeader({
[],
);
- const handleFilterCustomer = (query, customer, index, exactMatch) => {
- const normalizedTitle = customer.display_name.toLowerCase();
- const normalizedQuery = query.toLowerCase();
- if (exactMatch) {
- return normalizedTitle === normalizedQuery;
- } else {
- return (
- `${customer.display_name} ${normalizedTitle}`.indexOf(
- normalizedQuery,
- ) >= 0
- );
- }
- };
const onChangeSelect = useCallback(
(filedName) => {
@@ -129,17 +116,11 @@ function PaymentReceiveFormHeader({
}
>
-
}
- itemRenderer={handleCusomterRenderer}
- itemPredicate={handleFilterCustomer}
- popoverProps={{ minimal: true }}
- onItemSelect={onChangeSelect('customer_id')}
- selectedItem={values.customer_id}
- selectedItemProp={'id'}
- defaultText={
}
- labelProp={'display_name'}
+
}
+ onContactSelected={onChangeSelect('customer_id')}
/>
@@ -167,26 +148,27 @@ function PaymentReceiveFormHeader({
label={
}
inline={true}
className={('form-group--full-amount', CLASSES.FILL)}
- intent={
- errors.full_amount && touched.full_amount && Intent.DANGER
- }
+ intent={errors.full_amount && touched.full_amount && Intent.DANGER}
labelInfo={
}
helperText={
}
>
-
- Receive full amount ()
+
+ Receive full amount (
+ )
@@ -253,10 +235,14 @@ function PaymentReceiveFormHeader({
inline={true}
className={classNames('form-group--reference', CLASSES.FILL)}
intent={errors.reference_no && touched.reference_no && Intent.DANGER}
- helperText={
}
+ helperText={
+
+ }
>
diff --git a/client/src/containers/Sales/Receipt/ReceiptFormHeader.js b/client/src/containers/Sales/Receipt/ReceiptFormHeader.js
index 390442ac2..004f71d76 100644
--- a/client/src/containers/Sales/Receipt/ReceiptFormHeader.js
+++ b/client/src/containers/Sales/Receipt/ReceiptFormHeader.js
@@ -15,7 +15,7 @@ import classNames from 'classnames';
import { CLASSES } from 'common/classes';
import {
AccountsSelectList,
- ListSelect,
+ ContactSelecetList,
ErrorMessage,
FieldRequiredHint,
Icon,
@@ -44,32 +44,6 @@ function ReceiptFormHeader({
[setFieldValue],
);
- const CustomerRenderer = useCallback(
- (cutomer, { handleClick }) => (
-
- ),
- [],
- );
-
- // Filter Customer
- const filterCustomer = (query, customer, _index, exactMatch) => {
- const normalizedTitle = customer.display_name.toLowerCase();
- const normalizedQuery = query.toLowerCase();
- if (exactMatch) {
- return normalizedTitle === normalizedQuery;
- } else {
- return (
- `${customer.display_name} ${normalizedTitle}`.indexOf(
- normalizedQuery,
- ) >= 0
- );
- }
- };
-
// handle change
const onChangeSelect = useCallback(
(filedName) => {
@@ -108,17 +82,11 @@ function ReceiptFormHeader({
}
>
-
}
- itemRenderer={CustomerRenderer}
- itemPredicate={filterCustomer}
- popoverProps={{ minimal: true }}
- onItemSelect={onChangeSelect('customer_id')}
- selectedItem={values.customer_id}
- selectedItemProp={'id'}
- defaultText={
}
- labelProp={'display_name'}
+
}
+ onContactSelected={onChangeSelect('customer_id')}
/>