mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
Fix Customers
This commit is contained in:
@@ -222,22 +222,22 @@ const CustomerBillingAddress = ({
|
|||||||
label={<T id={'address_line_1'} />}
|
label={<T id={'address_line_1'} />}
|
||||||
className={'form-group--journal-number'}
|
className={'form-group--journal-number'}
|
||||||
intent={
|
intent={
|
||||||
errors.billing_address_1 &&
|
errors.shipping_address_1 &&
|
||||||
touched.billing_address_1 &&
|
touched.shipping_address_1 &&
|
||||||
Intent.DANGER
|
Intent.DANGER
|
||||||
}
|
}
|
||||||
inline={true}
|
inline={true}
|
||||||
helperText={
|
helperText={
|
||||||
<ErrorMessage name="billing_address_1" {...{ errors, touched }} />
|
<ErrorMessage name="shipping_address_1" {...{ errors, touched }} />
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<TextArea
|
<TextArea
|
||||||
intent={
|
intent={
|
||||||
errors.billing_address_1 &&
|
errors.shipping_address_1 &&
|
||||||
touched.billing_address_1 &&
|
touched.shipping_address_1 &&
|
||||||
Intent.DANGER
|
Intent.DANGER
|
||||||
}
|
}
|
||||||
{...getFieldProps('billing_address_1')}
|
{...getFieldProps('shipping_address_1')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
{/*------------ Shipping Address 2 -----------*/}
|
{/*------------ Shipping Address 2 -----------*/}
|
||||||
@@ -245,22 +245,22 @@ const CustomerBillingAddress = ({
|
|||||||
label={<T id={'address_line_2'} />}
|
label={<T id={'address_line_2'} />}
|
||||||
className={'form-group--journal-number'}
|
className={'form-group--journal-number'}
|
||||||
intent={
|
intent={
|
||||||
errors.billing_address_2 &&
|
errors.shipping_address_2 &&
|
||||||
touched.billing_address_2 &&
|
touched.shipping_address_2 &&
|
||||||
Intent.DANGER
|
Intent.DANGER
|
||||||
}
|
}
|
||||||
inline={true}
|
inline={true}
|
||||||
helperText={
|
helperText={
|
||||||
<ErrorMessage name="billing_address_2" {...{ errors, touched }} />
|
<ErrorMessage name="shipping_address_2" {...{ errors, touched }} />
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<TextArea
|
<TextArea
|
||||||
intent={
|
intent={
|
||||||
errors.billing_address_2 &&
|
errors.shipping_address_2 &&
|
||||||
touched.billing_address_2 &&
|
touched.shipping_address_2 &&
|
||||||
Intent.DANGER
|
Intent.DANGER
|
||||||
}
|
}
|
||||||
{...getFieldProps('billing_address_2')}
|
{...getFieldProps('shipping_address_2')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
{/*------------ Shipping Address city -----------*/}
|
{/*------------ Shipping Address city -----------*/}
|
||||||
|
|||||||
@@ -79,10 +79,10 @@ function CustomerForm({
|
|||||||
.required()
|
.required()
|
||||||
.label(formatMessage({ id: 'display_name_' })),
|
.label(formatMessage({ id: 'display_name_' })),
|
||||||
|
|
||||||
email: Yup.string().email(),
|
email: Yup.string().email().nullable(),
|
||||||
work_phone: Yup.number(),
|
work_phone: Yup.number(),
|
||||||
personal_phone: Yup.number(),
|
personal_phone: Yup.number(),
|
||||||
website: Yup.string().url(),
|
website: Yup.string().url().nullable(),
|
||||||
|
|
||||||
active: Yup.boolean(),
|
active: Yup.boolean(),
|
||||||
note: Yup.string().trim(),
|
note: Yup.string().trim(),
|
||||||
@@ -103,7 +103,7 @@ function CustomerForm({
|
|||||||
shipping_address_postcode: Yup.number().nullable(),
|
shipping_address_postcode: Yup.number().nullable(),
|
||||||
shipping_address_phone: Yup.number(),
|
shipping_address_phone: Yup.number(),
|
||||||
|
|
||||||
opening_balance: Yup.number(),
|
opening_balance: Yup.number().nullable(),
|
||||||
currency_code: Yup.string(),
|
currency_code: Yup.string(),
|
||||||
opening_balance_at: Yup.date(),
|
opening_balance_at: Yup.date(),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -122,7 +122,12 @@ const CustomerTable = ({
|
|||||||
{
|
{
|
||||||
id: 'phone_number',
|
id: 'phone_number',
|
||||||
Header: formatMessage({ id: 'phone_number' }),
|
Header: formatMessage({ id: 'phone_number' }),
|
||||||
accessor: 'work_phone',
|
accessor: (row) => (
|
||||||
|
<div>
|
||||||
|
<div className={'work_phone'}>{row.work_phone}</div>
|
||||||
|
<div className={'personal_phone'}>{row.personal_phone}</div>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
className: 'phone_number',
|
className: 'phone_number',
|
||||||
width: 100,
|
width: 100,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -99,14 +99,14 @@ export const fetchCustomer = ({ id }) => {
|
|||||||
|
|
||||||
export const deleteCustomer = ({ id }) => {
|
export const deleteCustomer = ({ id }) => {
|
||||||
return (dispatch) =>
|
return (dispatch) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resovle, reject) => {
|
||||||
ApiService.delete(`customers/${id}`)
|
ApiService.delete(`customers/${id}`)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.CUSTOMER_DELETE,
|
type: t.CUSTOMER_DELETE,
|
||||||
payload: { id },
|
payload: { id },
|
||||||
});
|
});
|
||||||
resolve(response);
|
resovle(response);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
reject(error.response.data.errors || []);
|
reject(error.response.data.errors || []);
|
||||||
|
|||||||
@@ -55,9 +55,8 @@ const customersReducer = createReducer(initialState, {
|
|||||||
|
|
||||||
[t.CUSTOMER_DELETE]: (state, action) => {
|
[t.CUSTOMER_DELETE]: (state, action) => {
|
||||||
const { id } = action.payload;
|
const { id } = action.payload;
|
||||||
|
|
||||||
if (typeof state.items[id] !== 'undefined') {
|
if (typeof state.items[id] !== 'undefined') {
|
||||||
delete state.items[action.id];
|
delete state.items[id];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user