+
{/*------------ Customer email -----------*/}
}
- inline={true}
+ inline
+ fill
>
-
+
{/*------------ Phone number -----------*/}
}
- inline={true}
+ inline
+ fill
>
-
+
+
-
{/*------------ Customer website -----------*/}
- } inline={true}>
-
+ }
+ inline
+ fill
+ >
+
);
diff --git a/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormFormik.tsx b/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormFormik.tsx
index 3689f3b25..d1644e3c4 100644
--- a/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormFormik.tsx
+++ b/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormFormik.tsx
@@ -3,7 +3,7 @@ import React, { useMemo } from 'react';
import intl from 'react-intl-universal';
import classNames from 'classnames';
import { Formik, Form } from 'formik';
-import { Intent } from '@blueprintjs/core';
+import { Divider, Intent, Tab, Tabs } from '@blueprintjs/core';
import styled from 'styled-components';
import { CLASSES } from '@/constants/classes';
@@ -11,20 +11,19 @@ import { CreateCustomerForm, EditCustomerForm } from './CustomerForm.schema';
import { compose, transformToForm, saveInvoke, parseBoolean } from '@/utils';
import { useCustomerFormContext } from './CustomerFormProvider';
import { defaultInitialValues } from './utils';
+import { css } from '@emotion/css';
-import { AppToaster } from '@/components';
+import { AppToaster, Box, Card, Group } from '@/components';
import CustomerFormPrimarySection from './CustomerFormPrimarySection';
import CustomerFormAfterPrimarySection from './CustomerFormAfterPrimarySection';
import CustomersTabs from './CustomersTabs';
-import CustomerFloatingActions from './CustomerFloatingActions';
+import { CustomerFloatingActions } from './CustomerFloatingActions';
import { withCurrentOrganization } from '@/containers/Organization/withCurrentOrganization';
+import CustomerFinancialPanel from './CustomerFinancialPanel';
+import CustomerShippingAddress from './CustomerShippingAddress';
+import CustomerBillingAddress from './CustomerBillingAddress';
-import '@/style/pages/Customers/Form.scss';
-
-/**
- * Customer form.
- */
function CustomerFormFormik({
organization: { base_currency },
@@ -95,11 +94,7 @@ function CustomerFormFormik({
return (
);
}
+const CustomerFormFields = styled.div`
+ .bp4-form-content,
+ .bp6-form-content {
+ min-width: 300px;
+ }
+
+ .bp4-form-group.bp4-inline label.bp4-label {
+ min-width: 140px;
+ }
+`;
+
export const CustomerFormHeaderPrimary = styled.div`
--x-border: #e4e4e4;
@@ -140,3 +138,42 @@ export const CustomerFormHeaderPrimary = styled.div`
`;
export default compose(withCurrentOrganization())(CustomerFormFormik);
+
+function CustomerFormContent() {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
+
+
+const customerFormSectionDividerClass = css`
+ margin: 20px 0;
+`;
+
+function CustomerFormBasicSection() {
+ return (
+
+
+
+
+
+
+
+
+
+ );
+}
+
+
diff --git a/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormPage.tsx b/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormPage.tsx
index d19a5802a..f8fe7e7fe 100644
--- a/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormPage.tsx
+++ b/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormPage.tsx
@@ -49,26 +49,17 @@ export default function CustomerFormPage() {
return (
-
-
);
}
const CustomerFormPageFormik = styled(CustomerFormFormik)`
- .page-form {
- &__floating-actions {
- margin-left: -40px;
- margin-right: -40px;
- }
- }
`;
const CustomerDashboardInsider = styled(DashboardInsider)`
- padding-bottom: 64px;
`;
diff --git a/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormPrimarySection.tsx b/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormPrimarySection.tsx
index e969b75fd..18957444b 100644
--- a/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormPrimarySection.tsx
+++ b/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormPrimarySection.tsx
@@ -1,9 +1,7 @@
// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
-import classNames from 'classnames';
-import { FormGroup, InputGroup, ControlGroup } from '@blueprintjs/core';
-import { FastField, Field, ErrorMessage } from 'formik';
+import { ControlGroup, Divider, Icon as BlueprintIcon } from '@blueprintjs/core';
import {
Hint,
FieldRequiredHint,
@@ -12,10 +10,12 @@ import {
FormattedMessage as T,
FInputGroup,
FFormGroup,
+ Box,
+ Icon,
+ Stack,
} from '@/components';
import CustomerTypeRadioField from './CustomerTypeRadioField';
-import { CLASSES } from '@/constants/classes';
-import { inputIntent } from '@/utils';
+import CustomerFormSectionTitle from './CustomerFormSectionTitle';
import { useAutofocus } from '@/hooks';
/**
@@ -25,7 +25,9 @@ export default function CustomerFormPrimarySection({}) {
const firstNameFieldRef = useAutofocus();
return (
-
+
+ Customer details
+
{/**-----------Customer type. -----------*/}
@@ -33,9 +35,10 @@ export default function CustomerFormPrimarySection({}) {
}
- inline={true}
+ inline
+ fill
>
-
+
(firstNameFieldRef.current = ref)}
+ fill
+ />
+
-
+
+
+
+
{/*----------- Company Name -----------*/}
}
- inline={true}
+ inline
+ fill
>
-
+
{/*----------- Display Name -----------*/}
-
-
- >
}
- inline={true}
+ inline
+ fill
>
-
+
+
+
+
+ {/*------------ Vendor email -----------*/}
+
}
+ inline={true}
+ >
+
}
+ />
+
+
+ {/*------------ Phone number -----------*/}
+
}
+ inline={true}
+ >
+
+
+
+
+
+
+ {/*------------ Vendor website -----------*/}
+
} inline={true}>
+
}
+ />
+
+
);
}
diff --git a/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormSectionTitle.tsx b/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormSectionTitle.tsx
new file mode 100644
index 000000000..8e5c8148e
--- /dev/null
+++ b/packages/webapp/src/containers/Customers/CustomerForm/CustomerFormSectionTitle.tsx
@@ -0,0 +1,14 @@
+// @ts-nocheck
+import React from 'react';
+import { css } from '@emotion/css';
+
+const customerFormSectionTitleClass = css`
+ font-size: 14px;
+ color: #8f99a8;
+ margin-bottom: 18px;
+ margin-top: 0;
+`;
+
+export default function CustomerFormSectionTitle({ children }) {
+ return
{children}
;
+}
diff --git a/packages/webapp/src/containers/Customers/CustomerForm/CustomerNotePanel.tsx b/packages/webapp/src/containers/Customers/CustomerForm/CustomerNotePanel.tsx
index e3577a38c..c8783954d 100644
--- a/packages/webapp/src/containers/Customers/CustomerForm/CustomerNotePanel.tsx
+++ b/packages/webapp/src/containers/Customers/CustomerForm/CustomerNotePanel.tsx
@@ -1,15 +1,11 @@
// @ts-nocheck
import React from 'react';
-import classNames from 'classnames';
-import { Classes } from '@blueprintjs/core';
import { FormattedMessage as T, FFormGroup, FTextArea } from '@/components';
export default function CustomerNotePanel({ errors, touched, getFieldProps }) {
return (
-
- } inline={false}>
-
-
-
+
} inline={false} fill>
+
+
);
}
diff --git a/packages/webapp/src/containers/Customers/CustomerForm/CustomerShippingAddress.tsx b/packages/webapp/src/containers/Customers/CustomerForm/CustomerShippingAddress.tsx
new file mode 100644
index 000000000..6016b8bd8
--- /dev/null
+++ b/packages/webapp/src/containers/Customers/CustomerForm/CustomerShippingAddress.tsx
@@ -0,0 +1,82 @@
+// @ts-nocheck
+import React from 'react';
+import { Box } from '@/components';
+import {
+ FormattedMessage as T,
+ FFormGroup,
+ FInputGroup,
+ FTextArea,
+} from '@/components';
+import CustomerFormSectionTitle from './CustomerFormSectionTitle';
+
+export default function CustomerShippingAddress() {
+ return (
+
+
+
+
+ }
+ inline
+ fill
+ >
+
+
+
+ }
+ inline
+ fill
+ >
+
+
+
+ }
+ inline
+ fill
+ >
+
+
+
+ }
+ inline
+ fill
+ >
+
+
+
+ }
+ inline
+ fill
+ >
+
+
+
+ }
+ inline
+ fill
+ >
+
+
+
+ }
+ inline
+ fill
+ >
+
+
+
+ );
+}
diff --git a/packages/webapp/src/containers/Customers/CustomerForm/CustomerTypeRadioField.tsx b/packages/webapp/src/containers/Customers/CustomerForm/CustomerTypeRadioField.tsx
index 78aff5782..687aa35c9 100644
--- a/packages/webapp/src/containers/Customers/CustomerForm/CustomerTypeRadioField.tsx
+++ b/packages/webapp/src/containers/Customers/CustomerForm/CustomerTypeRadioField.tsx
@@ -1,27 +1,52 @@
// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
-import classNames from 'classnames';
-import { Radio } from '@blueprintjs/core';
-import { FormattedMessage as T, FFormGroup, FRadioGroup } from '@/components';
-
-import { handleStringChange, saveInvoke } from '@/utils';
+import { Button, ButtonGroup } from '@blueprintjs/core';
+import { FastField } from 'formik';
+import { FormattedMessage as T, FFormGroup } from '@/components';
/**
- * Customer type radio field.
+ * Customer type selector (button group).
*/
-export default function RadioCustomer() {
+export default function CustomerTypeRadioField() {
return (
}
inline
+ fill
fastField
>
-
-
-
-
+
+ {({ field, form }) => (
+
+
+
+
+ )}
+
);
}
diff --git a/packages/webapp/src/lang/en/index.json b/packages/webapp/src/lang/en/index.json
index 32c45611f..ab2f4a15d 100644
--- a/packages/webapp/src/lang/en/index.json
+++ b/packages/webapp/src/lang/en/index.json
@@ -1942,8 +1942,8 @@
"vendor_opening_balance.label": "Edit Vendor Opening Balance",
"vendor_opening_balance.label.opening_balance": "Opening balance",
"vendor_opening_balance.label.opening_balance_at": "Opening balance at",
- "customer.label.opening_branch": "Opening Balance Branch",
- "vendor.label.opening_branch": "Opening Balance Branch",
+ "customer.label.opening_branch": "Balance Branch",
+ "vendor.label.opening_branch": "Balance Branch",
"warehouse.error.warehouse_code_not_unique": "Warehouse code not unique",
"warehouse.error.warehouse_has_associated_transactions": "You could not delete the warehouse that has associated transactions.",
"branche.error.warehouse_code_not_unique": "Branch code not unique",
diff --git a/packages/webapp/src/style/pages/Customers/Form.scss b/packages/webapp/src/style/pages/Customers/Form.scss
deleted file mode 100644
index 5048aa1b5..000000000
--- a/packages/webapp/src/style/pages/Customers/Form.scss
+++ /dev/null
@@ -1,156 +0,0 @@
-@import '../../_base.scss';
-
-.page-form--customer {
- $self: '.page-form';
- padding: 20px;
-
- --x-color-tabs-border: #f0f0f0;
-
- .bp4-dark & {
- --x-color-tabs-border: var(--color-dark-gray3);
- }
-
- #{$self}__header {
- padding: 0;
- }
- #{$self}__primary-section {
- padding: 10px 0 0;
- margin: 0 0 20px;
- overflow: hidden;
- border-bottom: 1px solid #e4e4e4;
- max-width: 1000px;
- }
-
- .bp4-form-group {
- max-width: 500px;
-
- .bp4-control {
- margin-top: 8px;
- margin-bottom: 8px;
- }
-
- &.bp4-inline {
- .bp4-label {
- min-width: 150px;
- }
- }
- .bp4-form-content {
- width: 100%;
- }
- }
-
- .form-group--contact_name {
- max-width: 600px;
-
- .bp4-control-group > * {
- flex-shrink: unset;
-
- &:not(:last-child) {
- padding-right: 10px;
- }
- &.input-group--salutation-list {
- width: 25%;
- }
- &.input-group--first-name,
- &.input-group--last-name {
- width: 37%;
- }
- }
- }
-
- .bp4-form-group {
- margin-bottom: 14px;
- }
-
- .bp4-tab-panel {
- margin-top: 26px;
- }
-
- .form-group--phone-number {
- .bp4-control-group > * {
- flex-shrink: unset;
- padding-right: 5px;
- padding-left: 5px;
-
- &:first-child {
- padding-left: 0;
- }
- &:last-child {
- padding-right: 0;
- }
- }
- }
-
- #{$self}__tabs {
- margin-top: 20px;
- max-width: 1000px;
-
- h4 {
- font-weight: 500;
- color: #888;
- margin-bottom: 1.2rem;
- font-size: 14px;
- }
- // Tab panels.
- .tab-panel {
- &--address {
- .bp4-form-group {
- max-width: 440px;
-
- &.bp4-inline {
- .bp4-label {
- min-width: 145px;
- }
- }
-
- .bp4-form-content {
- width: 100%;
- }
-
- textarea.bp4-input {
- max-width: 100%;
- width: 100%;
- min-height: 50px;
- }
- }
- }
- &--note {
- .form-group--note {
- .bp4-form-group {
- max-width: 600px;
- }
- textarea {
- width: 100%;
- min-height: 100px;
- }
- }
- }
- }
-
- .dropzone-container {
- max-width: 600px;
- }
- }
-
- .bp4-tabs {
- .bp4-tab-list {
- position: relative;
-
- &:before {
- content: '';
- position: absolute;
- bottom: 0;
- width: 100%;
- height: 2px;
- background: var(--x-color-tabs-border);
- }
-
- > *:not(:last-child) {
- margin-right: 25px;
- }
- &.bp4-large > .bp4-tab {
- font-size: 15px;
- }
- }
- }
-}