mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
Merge branch 'master' of https://github.com/abouolia/Ratteb
This commit is contained in:
@@ -14,7 +14,7 @@ import CustomerFormAfterPrimarySection from './CustomerFormAfterPrimarySection';
|
||||
import CustomersTabs from './CustomersTabs';
|
||||
import CustomerFloatingActions from './CustomerFloatingActions';
|
||||
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
import withCurrentOrganization from 'containers/Organization/withCurrentOrganization';
|
||||
|
||||
import { compose, transformToForm } from 'utils';
|
||||
import { useCustomerFormContext } from './CustomerFormProvider';
|
||||
@@ -59,10 +59,7 @@ const defaultInitialValues = {
|
||||
/**
|
||||
* Customer form.
|
||||
*/
|
||||
function CustomerForm({
|
||||
// #withSettings
|
||||
baseCurrency,
|
||||
}) {
|
||||
function CustomerForm({ organization: { base_currency } }) {
|
||||
const {
|
||||
customer,
|
||||
customerId,
|
||||
@@ -75,7 +72,6 @@ function CustomerForm({
|
||||
|
||||
// const isNewMode = !customerId;
|
||||
const history = useHistory();
|
||||
|
||||
|
||||
/**
|
||||
* Initial values in create and edit mode.
|
||||
@@ -83,10 +79,10 @@ function CustomerForm({
|
||||
const initialValues = useMemo(
|
||||
() => ({
|
||||
...defaultInitialValues,
|
||||
currency_code: baseCurrency,
|
||||
currency_code: base_currency,
|
||||
...transformToForm(contactDuplicate || customer, defaultInitialValues),
|
||||
}),
|
||||
[customer, contactDuplicate, baseCurrency],
|
||||
[customer, contactDuplicate, base_currency],
|
||||
);
|
||||
|
||||
//Handles the form submit.
|
||||
@@ -153,8 +149,4 @@ function CustomerForm({
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
)(CustomerForm);
|
||||
export default compose(withCurrentOrganization())(CustomerForm);
|
||||
|
||||
@@ -95,6 +95,11 @@ function CustomersTable({
|
||||
openDrawer('contact-detail-drawer', { contactId: id });
|
||||
};
|
||||
|
||||
// Handle cell click.
|
||||
const handleCellClick = (cell, event) => {
|
||||
openDrawer('contact-detail-drawer', { contactId: cell.row.original.id });
|
||||
};
|
||||
|
||||
if (isEmptyStatus) {
|
||||
return <CustomersEmptyStatus />;
|
||||
}
|
||||
@@ -122,6 +127,7 @@ function CustomersTable({
|
||||
autoResetPage={false}
|
||||
TableLoadingRenderer={TableSkeletonRows}
|
||||
TableHeaderSkeletonRenderer={TableSkeletonHeader}
|
||||
onCellClick={handleCellClick}
|
||||
payload={{
|
||||
onDelete: handleCustomerDelete,
|
||||
onEdit: handleCustomerEdit,
|
||||
|
||||
@@ -104,6 +104,7 @@ export function useCustomersTableColumns() {
|
||||
width: 45,
|
||||
disableResizing: true,
|
||||
disableSortBy: true,
|
||||
clickable: true,
|
||||
},
|
||||
{
|
||||
id: 'display_name',
|
||||
@@ -111,6 +112,7 @@ export function useCustomersTableColumns() {
|
||||
accessor: 'display_name',
|
||||
className: 'display_name',
|
||||
width: 150,
|
||||
clickable: true,
|
||||
},
|
||||
{
|
||||
id: 'company_name',
|
||||
@@ -118,6 +120,7 @@ export function useCustomersTableColumns() {
|
||||
accessor: 'company_name',
|
||||
className: 'company_name',
|
||||
width: 150,
|
||||
clickable: true,
|
||||
},
|
||||
{
|
||||
id: 'work_phone',
|
||||
@@ -125,6 +128,7 @@ export function useCustomersTableColumns() {
|
||||
accessor: PhoneNumberAccessor,
|
||||
className: 'phone_number',
|
||||
width: 100,
|
||||
clickable: true,
|
||||
},
|
||||
{
|
||||
id: 'balance',
|
||||
@@ -132,6 +136,7 @@ export function useCustomersTableColumns() {
|
||||
accessor: BalanceAccessor,
|
||||
className: 'receivable_balance',
|
||||
width: 100,
|
||||
clickable: true,
|
||||
},
|
||||
],
|
||||
[],
|
||||
|
||||
Reference in New Issue
Block a user