mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-22 07:40:32 +00:00
feat: Add default customer message and terms and conditions to the transactions.
This commit is contained in:
@@ -12,6 +12,10 @@ export default [
|
|||||||
text: <T id={'users'} />,
|
text: <T id={'users'} />,
|
||||||
href: '/preferences/users',
|
href: '/preferences/users',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: 'Invoices',
|
||||||
|
href: '/preferences/invoices',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: <T id={'currencies'} />,
|
text: <T id={'currencies'} />,
|
||||||
href: '/preferences/currencies',
|
href: '/preferences/currencies',
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import { PreferencesCreditNotesBoot } from './PreferencesCreditNotesFormBoot';
|
||||||
|
import PreferencesInvoiceFormPage from './PreferencesCreditNotesFormPage';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* items preferences.
|
||||||
|
*/
|
||||||
|
export default function PreferencesCreditNotes() {
|
||||||
|
return (
|
||||||
|
<PreferencesCreditNotesBoot>
|
||||||
|
<PreferencesInvoiceFormPage />
|
||||||
|
</PreferencesCreditNotesBoot>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import * as Yup from 'yup';
|
||||||
|
|
||||||
|
const Schema = Yup.object().shape({
|
||||||
|
termsConditions: Yup.string().optional(),
|
||||||
|
customerNotes: Yup.string().optional(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const PreferencesEstimatesFormSchema = Schema;
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { Form } from 'formik';
|
||||||
|
import { Button, Intent } from '@blueprintjs/core';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
import {
|
||||||
|
FieldRequiredHint,
|
||||||
|
FormattedMessage as T,
|
||||||
|
FFormGroup,
|
||||||
|
FTextArea,
|
||||||
|
} from '@/components';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preferences estimates form.
|
||||||
|
*/
|
||||||
|
export function PreferencesCreditNotesForm({ isSubmitting }) {
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
|
// Handle close click.
|
||||||
|
const handleCloseClick = () => {
|
||||||
|
history.go(-1);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Form>
|
||||||
|
{/* ---------- Terms & Conditions ---------- */}
|
||||||
|
<FFormGroup
|
||||||
|
name={'termsConditions'}
|
||||||
|
label={<T id={'pref.estimates.termsConditions.field'} />}
|
||||||
|
labelInfo={<FieldRequiredHint />}
|
||||||
|
fastField={true}
|
||||||
|
>
|
||||||
|
<FTextArea
|
||||||
|
medium={'true'}
|
||||||
|
name={'termsConditions'}
|
||||||
|
fastField={true}
|
||||||
|
fill={true}
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
|
||||||
|
{/* ---------- Customer Notes ---------- */}
|
||||||
|
<FFormGroup
|
||||||
|
name={'customerNotes'}
|
||||||
|
label={<T id={'pref.estimates.customerNotes.field'} />}
|
||||||
|
fastField={true}
|
||||||
|
>
|
||||||
|
<FTextArea
|
||||||
|
medium={'true'}
|
||||||
|
name={'tax_number'}
|
||||||
|
fastField={true}
|
||||||
|
fill={true}
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
|
||||||
|
<CardFooterActions>
|
||||||
|
<Button loading={isSubmitting} intent={Intent.PRIMARY} type="submit">
|
||||||
|
<T id={'save'} />
|
||||||
|
</Button>
|
||||||
|
<Button onClick={handleCloseClick}>
|
||||||
|
<T id={'close'} />
|
||||||
|
</Button>
|
||||||
|
</CardFooterActions>
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const CardFooterActions = styled.div`
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px solid #e0e7ea;
|
||||||
|
margin-top: 30px;
|
||||||
|
|
||||||
|
.bp4-button {
|
||||||
|
min-width: 70px;
|
||||||
|
|
||||||
|
+ .bp4-button {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import { CLASSES } from '@/constants/classes';
|
||||||
|
import { useSettings } from '@/hooks/query';
|
||||||
|
import PreferencesPageLoader from '../PreferencesPageLoader';
|
||||||
|
|
||||||
|
const PreferencesCreditNotesFormContext = React.createContext();
|
||||||
|
|
||||||
|
function PreferencesCreditNotesBoot({ ...props }) {
|
||||||
|
// Fetches organization settings.
|
||||||
|
const { isLoading: isSettingsLoading } = useSettings();
|
||||||
|
|
||||||
|
// Provider state.
|
||||||
|
const provider = {
|
||||||
|
organization: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Detarmines whether if any query is loading.
|
||||||
|
const isLoading = isSettingsLoading;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT,
|
||||||
|
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_ACCOUNTANT,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{isLoading ? (
|
||||||
|
<PreferencesPageLoader />
|
||||||
|
) : (
|
||||||
|
<PreferencesCreditNotesFormContext.Provider value={provider} {...props} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const usePreferencesCreditNotesFormContext = () =>
|
||||||
|
React.useContext(PreferencesCreditNotesFormContext);
|
||||||
|
|
||||||
|
export { PreferencesCreditNotesBoot, usePreferencesCreditNotesFormContext };
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import React, { useEffect } from 'react';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
|
import { Formik } from 'formik';
|
||||||
|
import { Intent } from '@blueprintjs/core';
|
||||||
|
|
||||||
|
import { AppToaster } from '@/components';
|
||||||
|
import { PreferencesCreditNotesFormSchema } from './PreferencesCreditNotesForm.schema';
|
||||||
|
import { usePreferencesInvoiceFormContext } from './PreferencesCreditNotesFormBoot';
|
||||||
|
import { PreferencesCreditNotesForm } from './PreferencesCreditNotesForm';
|
||||||
|
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
||||||
|
|
||||||
|
import { compose, transformToForm } from '@/utils';
|
||||||
|
|
||||||
|
const defaultValues = {
|
||||||
|
termsConditions: '',
|
||||||
|
customerNotes: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preferences - .
|
||||||
|
*/
|
||||||
|
function PreferencesCreditNotesFormPageRoot({
|
||||||
|
// #withDashboardActions
|
||||||
|
changePreferencesPageTitle,
|
||||||
|
}) {
|
||||||
|
const { organization } = usePreferencesInvoiceFormContext();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
changePreferencesPageTitle(intl.get('preferences.estimates'));
|
||||||
|
}, [changePreferencesPageTitle]);
|
||||||
|
|
||||||
|
// Initial values.
|
||||||
|
const initialValues = {
|
||||||
|
...defaultValues,
|
||||||
|
...transformToForm(organization.metadata, defaultValues),
|
||||||
|
};
|
||||||
|
// Handle the form submit.
|
||||||
|
const handleFormSubmit = (values, { setSubmitting }) => {
|
||||||
|
// Handle request success.
|
||||||
|
const onSuccess = (response) => {
|
||||||
|
AppToaster.show({
|
||||||
|
message: intl.get('preferences.estimates.success_message'),
|
||||||
|
intent: Intent.SUCCESS,
|
||||||
|
});
|
||||||
|
setSubmitting(false);
|
||||||
|
};
|
||||||
|
// Handle request error.
|
||||||
|
const onError = () => {
|
||||||
|
setSubmitting(false);
|
||||||
|
};
|
||||||
|
// updateOrganization({ ...values })
|
||||||
|
// .then(onSuccess)
|
||||||
|
// .catch(onError);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Formik
|
||||||
|
initialValues={initialValues}
|
||||||
|
validationSchema={PreferencesCreditNotesFormSchema}
|
||||||
|
onSubmit={handleFormSubmit}
|
||||||
|
component={PreferencesCreditNotesForm}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PreferencesCreditNotesFormPage = compose(withDashboardActions)(
|
||||||
|
PreferencesCreditNotesFormPageRoot,
|
||||||
|
);
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import { PreferencesEstimatesBoot } from './PreferencesEstimatesFormBoot';
|
||||||
|
import PreferencesInvoiceFormPage from './PreferencesEstimatesFormPage';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* items preferences.
|
||||||
|
*/
|
||||||
|
export default function PreferencesEstimates() {
|
||||||
|
return (
|
||||||
|
<PreferencesEstimatesBoot>
|
||||||
|
<PreferencesInvoiceFormPage />
|
||||||
|
</PreferencesEstimatesBoot>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import * as Yup from 'yup';
|
||||||
|
|
||||||
|
const Schema = Yup.object().shape({
|
||||||
|
termsConditions: Yup.string().optional(),
|
||||||
|
customerNotes: Yup.string().optional(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const PreferencesEstimatesFormSchema = Schema;
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { Form } from 'formik';
|
||||||
|
import { Button, Intent } from '@blueprintjs/core';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
import {
|
||||||
|
FieldRequiredHint,
|
||||||
|
FormattedMessage as T,
|
||||||
|
FFormGroup,
|
||||||
|
FTextArea,
|
||||||
|
} from '@/components';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preferences estimates form.
|
||||||
|
*/
|
||||||
|
export function PreferencesEstimatesForm({ isSubmitting }) {
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
|
// Handle close click.
|
||||||
|
const handleCloseClick = () => {
|
||||||
|
history.go(-1);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Form>
|
||||||
|
{/* ---------- Terms & Conditions ---------- */}
|
||||||
|
<FFormGroup
|
||||||
|
name={'termsConditions'}
|
||||||
|
label={<T id={'pref.estimates.termsConditions.field'} />}
|
||||||
|
labelInfo={<FieldRequiredHint />}
|
||||||
|
fastField={true}
|
||||||
|
>
|
||||||
|
<FTextArea
|
||||||
|
medium={'true'}
|
||||||
|
name={'termsConditions'}
|
||||||
|
fastField={true}
|
||||||
|
fill={true}
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
|
||||||
|
{/* ---------- Customer Notes ---------- */}
|
||||||
|
<FFormGroup
|
||||||
|
name={'customerNotes'}
|
||||||
|
label={<T id={'pref.estimates.customerNotes.field'} />}
|
||||||
|
fastField={true}
|
||||||
|
>
|
||||||
|
<FTextArea
|
||||||
|
medium={'true'}
|
||||||
|
name={'tax_number'}
|
||||||
|
fastField={true}
|
||||||
|
fill={true}
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
|
||||||
|
<CardFooterActions>
|
||||||
|
<Button loading={isSubmitting} intent={Intent.PRIMARY} type="submit">
|
||||||
|
<T id={'save'} />
|
||||||
|
</Button>
|
||||||
|
<Button onClick={handleCloseClick}>
|
||||||
|
<T id={'close'} />
|
||||||
|
</Button>
|
||||||
|
</CardFooterActions>
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const CardFooterActions = styled.div`
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px solid #e0e7ea;
|
||||||
|
margin-top: 30px;
|
||||||
|
|
||||||
|
.bp4-button {
|
||||||
|
min-width: 70px;
|
||||||
|
|
||||||
|
+ .bp4-button {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import { CLASSES } from '@/constants/classes';
|
||||||
|
import { useSettings } from '@/hooks/query';
|
||||||
|
import PreferencesPageLoader from '../PreferencesPageLoader';
|
||||||
|
|
||||||
|
const PreferencesEstimatesFormContext = React.createContext();
|
||||||
|
|
||||||
|
function PreferencesEstimatesBoot({ ...props }) {
|
||||||
|
// Fetches organization settings.
|
||||||
|
const { isLoading: isSettingsLoading } = useSettings();
|
||||||
|
|
||||||
|
// Provider state.
|
||||||
|
const provider = {
|
||||||
|
organization: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Detarmines whether if any query is loading.
|
||||||
|
const isLoading = isSettingsLoading;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT,
|
||||||
|
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_ACCOUNTANT,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{isLoading ? (
|
||||||
|
<PreferencesPageLoader />
|
||||||
|
) : (
|
||||||
|
<PreferencesEstimatesFormContext.Provider value={provider} {...props} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const usePreferencesEstimatesFormContext = () =>
|
||||||
|
React.useContext(PreferencesEstimatesFormContext);
|
||||||
|
|
||||||
|
export { PreferencesEstimatesBoot, usePreferencesEstimatesFormContext };
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import React, { useEffect } from 'react';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
|
import { Formik } from 'formik';
|
||||||
|
import { Intent } from '@blueprintjs/core';
|
||||||
|
|
||||||
|
import { AppToaster } from '@/components';
|
||||||
|
import { PreferencesEstimatesFormSchema } from './PreferencesEstimatesForm.schema';
|
||||||
|
import { usePreferencesInvoiceFormContext } from './PreferencesEstimatesFormBoot';
|
||||||
|
import { PreferencesEstimatesForm } from './PreferencesEstimatesForm';
|
||||||
|
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
||||||
|
|
||||||
|
import { compose, transformToForm } from '@/utils';
|
||||||
|
|
||||||
|
const defaultValues = {
|
||||||
|
termsConditions: '',
|
||||||
|
customerNotes: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preferences - .
|
||||||
|
*/
|
||||||
|
function PreferencesEstimatesFormPageRoot({
|
||||||
|
// #withDashboardActions
|
||||||
|
changePreferencesPageTitle,
|
||||||
|
}) {
|
||||||
|
const { organization } = usePreferencesInvoiceFormContext();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
changePreferencesPageTitle(intl.get('preferences.estimates'));
|
||||||
|
}, [changePreferencesPageTitle]);
|
||||||
|
|
||||||
|
// Initial values.
|
||||||
|
const initialValues = {
|
||||||
|
...defaultValues,
|
||||||
|
...transformToForm(organization.metadata, defaultValues),
|
||||||
|
};
|
||||||
|
// Handle the form submit.
|
||||||
|
const handleFormSubmit = (values, { setSubmitting }) => {
|
||||||
|
// Handle request success.
|
||||||
|
const onSuccess = (response) => {
|
||||||
|
AppToaster.show({
|
||||||
|
message: intl.get('preferences.estimates.success_message'),
|
||||||
|
intent: Intent.SUCCESS,
|
||||||
|
});
|
||||||
|
setSubmitting(false);
|
||||||
|
};
|
||||||
|
// Handle request error.
|
||||||
|
const onError = () => {
|
||||||
|
setSubmitting(false);
|
||||||
|
};
|
||||||
|
// updateOrganization({ ...values })
|
||||||
|
// .then(onSuccess)
|
||||||
|
// .catch(onError);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Formik
|
||||||
|
initialValues={initialValues}
|
||||||
|
validationSchema={PreferencesEstimatesFormSchema}
|
||||||
|
onSubmit={handleFormSubmit}
|
||||||
|
component={PreferencesEstimatesForm}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const PreferencesEstimatesFormPage = compose(withDashboardActions)(
|
||||||
|
PreferencesEstimatesFormPageRoot,
|
||||||
|
);
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import * as Yup from 'yup';
|
||||||
|
|
||||||
|
const Schema = Yup.object().shape({
|
||||||
|
termsConditions: Yup.string().optional(),
|
||||||
|
customerNotes: Yup.string().optional(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const PreferencesInvoiceFormSchema = Schema;
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import React from 'react';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import { CLASSES } from '@/constants/classes';
|
||||||
|
import { useSettings } from '@/hooks/query';
|
||||||
|
import PreferencesPageLoader from '../PreferencesPageLoader';
|
||||||
|
|
||||||
|
const PreferencesInvoiceFormContext = React.createContext();
|
||||||
|
|
||||||
|
function PreferencesInvoicesBoot({ ...props }) {
|
||||||
|
// Fetches organization settings.
|
||||||
|
const { isLoading: isSettingsLoading } = useSettings();
|
||||||
|
|
||||||
|
// Provider state.
|
||||||
|
const provider = {
|
||||||
|
organization: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Detarmines whether if any query is loading.
|
||||||
|
const isLoading = isSettingsLoading;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT,
|
||||||
|
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_ACCOUNTANT,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{isLoading ? (
|
||||||
|
<PreferencesPageLoader />
|
||||||
|
) : (
|
||||||
|
<PreferencesInvoiceFormContext.Provider value={provider} {...props} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const usePreferencesInvoiceFormContext = () =>
|
||||||
|
React.useContext(PreferencesInvoiceFormContext);
|
||||||
|
|
||||||
|
export { PreferencesInvoicesBoot, usePreferencesInvoiceFormContext };
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import React, { useEffect } from 'react';
|
||||||
|
import intl from 'react-intl-universal';
|
||||||
|
import { Formik } from 'formik';
|
||||||
|
import { Intent } from '@blueprintjs/core';
|
||||||
|
|
||||||
|
import { AppToaster } from '@/components';
|
||||||
|
import { PreferencesInvoiceFormSchema } from './PreferencesInvoiceForm.schema';
|
||||||
|
import { usePreferencesInvoiceFormContext } from './PreferencesInvoiceFormBoot';
|
||||||
|
import { PreferencesGeneralForm } from './PreferencesInvoicesForm';
|
||||||
|
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
||||||
|
|
||||||
|
import { compose, transformToForm } from '@/utils';
|
||||||
|
|
||||||
|
const defaultValues = {
|
||||||
|
termsConditions: '',
|
||||||
|
customerNotes: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preferences - Invoices.
|
||||||
|
*/
|
||||||
|
function PreferencesInvoiceFormPage({
|
||||||
|
// #withDashboardActions
|
||||||
|
changePreferencesPageTitle,
|
||||||
|
}) {
|
||||||
|
const { organization } = usePreferencesInvoiceFormContext();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
changePreferencesPageTitle(intl.get('preferences.invoices'));
|
||||||
|
}, [changePreferencesPageTitle]);
|
||||||
|
|
||||||
|
// Initial values.
|
||||||
|
const initialValues = {
|
||||||
|
...defaultValues,
|
||||||
|
...transformToForm(organization.metadata, defaultValues),
|
||||||
|
};
|
||||||
|
// Handle the form submit.
|
||||||
|
const handleFormSubmit = (values, { setSubmitting }) => {
|
||||||
|
// Handle request success.
|
||||||
|
const onSuccess = (response) => {
|
||||||
|
AppToaster.show({
|
||||||
|
message: intl.get('preferences.invoices.success_message'),
|
||||||
|
intent: Intent.SUCCESS,
|
||||||
|
});
|
||||||
|
setSubmitting(false);
|
||||||
|
};
|
||||||
|
// Handle request error.
|
||||||
|
const onError = () => {
|
||||||
|
setSubmitting(false);
|
||||||
|
};
|
||||||
|
// updateOrganization({ ...values })
|
||||||
|
// .then(onSuccess)
|
||||||
|
// .catch(onError);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Formik
|
||||||
|
initialValues={initialValues}
|
||||||
|
validationSchema={PreferencesInvoiceFormSchema}
|
||||||
|
onSubmit={handleFormSubmit}
|
||||||
|
component={PreferencesGeneralForm}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default compose(withDashboardActions)(PreferencesInvoiceFormPage);
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import { PreferencesInvoicesBoot } from './PreferencesInvoiceFormBoot';
|
||||||
|
import PreferencesInvoiceFormPage from './PreferencesInvoiceFormPage';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* items preferences.
|
||||||
|
*/
|
||||||
|
export default function PreferencesInvoices() {
|
||||||
|
return (
|
||||||
|
<PreferencesInvoicesBoot>
|
||||||
|
<PreferencesInvoiceFormPage />
|
||||||
|
</PreferencesInvoicesBoot>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { Form } from 'formik';
|
||||||
|
import { Button, Intent } from '@blueprintjs/core';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
|
import {
|
||||||
|
FieldRequiredHint,
|
||||||
|
FormattedMessage as T,
|
||||||
|
FFormGroup,
|
||||||
|
FInputGroup,
|
||||||
|
FTextArea,
|
||||||
|
} from '@/components';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preferences general form.
|
||||||
|
*/
|
||||||
|
export function PreferencesGeneralForm({ isSubmitting }) {
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
|
// Handle close click.
|
||||||
|
const handleCloseClick = () => {
|
||||||
|
history.go(-1);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Form>
|
||||||
|
{/* ---------- Terms & Conditions ---------- */}
|
||||||
|
<FFormGroup
|
||||||
|
name={'termsConditions'}
|
||||||
|
label={<T id={'pref.invoices.termsConditions.field'} />}
|
||||||
|
labelInfo={<FieldRequiredHint />}
|
||||||
|
fastField={true}
|
||||||
|
>
|
||||||
|
<FTextArea
|
||||||
|
medium={'true'}
|
||||||
|
name={'termsConditions'}
|
||||||
|
fastField={true}
|
||||||
|
fill={true}
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
|
||||||
|
{/* ---------- Customer Notes ---------- */}
|
||||||
|
<FFormGroup
|
||||||
|
name={'customerNotes'}
|
||||||
|
label={<T id={'pref.invoices.customerNotes.field'} />}
|
||||||
|
fastField={true}
|
||||||
|
>
|
||||||
|
<FTextArea
|
||||||
|
medium={'true'}
|
||||||
|
name={'tax_number'}
|
||||||
|
fastField={true}
|
||||||
|
fill={true}
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
|
||||||
|
<CardFooterActions>
|
||||||
|
<Button loading={isSubmitting} intent={Intent.PRIMARY} type="submit">
|
||||||
|
<T id={'save'} />
|
||||||
|
</Button>
|
||||||
|
<Button onClick={handleCloseClick}>
|
||||||
|
<T id={'close'} />
|
||||||
|
</Button>
|
||||||
|
</CardFooterActions>
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const CardFooterActions = styled.div`
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px solid #e0e7ea;
|
||||||
|
margin-top: 30px;
|
||||||
|
|
||||||
|
.bp4-button {
|
||||||
|
min-width: 70px;
|
||||||
|
|
||||||
|
+ .bp4-button {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
@@ -2290,5 +2290,8 @@
|
|||||||
"sidebar.new_project": "New Project",
|
"sidebar.new_project": "New Project",
|
||||||
"sidebar.new_time_entry": "New Time Entry",
|
"sidebar.new_time_entry": "New Time Entry",
|
||||||
"sidebar.project_profitability_summary": "Project Profitability Summary",
|
"sidebar.project_profitability_summary": "Project Profitability Summary",
|
||||||
"global_error.too_many_requests": "Too many requests"
|
"global_error.too_many_requests": "Too many requests",
|
||||||
|
|
||||||
|
"pref.invoices.termsConditions.field": "Terms & Conditions",
|
||||||
|
"pref.invoices.customerNotes.field": "Customer Notes"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import SMSIntegration from '../containers/Preferences/SMSIntegration';
|
|||||||
import DefaultRoute from '../containers/Preferences/DefaultRoute';
|
import DefaultRoute from '../containers/Preferences/DefaultRoute';
|
||||||
import Warehouses from '../containers/Preferences/Warehouses';
|
import Warehouses from '../containers/Preferences/Warehouses';
|
||||||
import Branches from '../containers/Preferences/Branches';
|
import Branches from '../containers/Preferences/Branches';
|
||||||
|
import Invoices from '../containers/Preferences/Invoices/PreferencesInvoices';
|
||||||
|
|
||||||
|
|
||||||
const BASE_URL = '/preferences';
|
const BASE_URL = '/preferences';
|
||||||
|
|
||||||
@@ -23,6 +25,16 @@ export default [
|
|||||||
component: Users,
|
component: Users,
|
||||||
exact: true,
|
exact: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: `${BASE_URL}/invoices`,
|
||||||
|
component: Invoices,
|
||||||
|
exact: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: `${BASE_URL}/credit-notes`,
|
||||||
|
component: CreditNotes,
|
||||||
|
exact: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: `${BASE_URL}/roles`,
|
path: `${BASE_URL}/roles`,
|
||||||
component: Roles,
|
component: Roles,
|
||||||
|
|||||||
Reference in New Issue
Block a user