mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
Fix : setupSubScription & BillingForm & setupOrganizationForm
This commit is contained in:
@@ -3,16 +3,9 @@ import * as Yup from 'yup';
|
||||
import { useFormik } from 'formik';
|
||||
import { Button, Intent } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { pick } from 'lodash';
|
||||
|
||||
import AppToaster from 'components/AppToaster';
|
||||
import ErrorMessage from 'components/ErrorMessage';
|
||||
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import { MeteredBillingTabs, PaymentMethodTabs } from './SubscriptionTabs';
|
||||
import withBillingActions from './withBillingActions';
|
||||
import withRegisterOrganizationActions from 'containers/Authentication/withRegisterOrganizationActions';
|
||||
import { compose } from 'utils';
|
||||
|
||||
function BillingForm({
|
||||
@@ -21,17 +14,7 @@ function BillingForm({
|
||||
|
||||
//#withBillingActions
|
||||
requestSubmitBilling,
|
||||
|
||||
//#withRegisterOrganizationActions
|
||||
requestBuildTenant,
|
||||
}) {
|
||||
// const defaultPlan = useMemo(() => ({
|
||||
// plan_slug: [
|
||||
// { name: 'Basic', value: 'basic' },
|
||||
// { name: 'Pro', value: 'pro' },
|
||||
// ],
|
||||
// }));
|
||||
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -43,14 +26,12 @@ function BillingForm({
|
||||
.required()
|
||||
.label(formatMessage({ id: 'plan_slug' })),
|
||||
license_code: Yup.string().trim(),
|
||||
period: Yup.string(),
|
||||
});
|
||||
|
||||
const initialValues = useMemo(
|
||||
() => ({
|
||||
plan_slug: 'basic',
|
||||
plan_slug: 'free',
|
||||
license_code: '',
|
||||
period: '',
|
||||
}),
|
||||
[],
|
||||
);
|
||||
@@ -64,15 +45,7 @@ function BillingForm({
|
||||
onSubmit: (values, { setSubmitting, resetForm, setErrors }) => {
|
||||
requestSubmitBilling(values)
|
||||
.then((response) => {
|
||||
requestBuildTenant().then(() => {
|
||||
setSubmitting(false);
|
||||
});
|
||||
// AppToaster.show({
|
||||
// message: formatMessage({
|
||||
// id: 'the_biling_has_been_successfully_created',
|
||||
// }),
|
||||
// intent: Intent.SUCCESS,
|
||||
// });
|
||||
setSubmitting(false);
|
||||
})
|
||||
.catch((errors) => {
|
||||
setSubmitting(false);
|
||||
@@ -98,8 +71,4 @@ function BillingForm({
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withDashboardActions,
|
||||
withRegisterOrganizationActions,
|
||||
withBillingActions,
|
||||
)(BillingForm);
|
||||
export default compose(withDashboardActions, withBillingActions)(BillingForm);
|
||||
|
||||
@@ -4,7 +4,6 @@ import BillingPeriods from 'containers/Subscriptions/billingPeriods';
|
||||
import { BillingPaymentmethod } from 'containers/Subscriptions/billingPaymentmethod';
|
||||
|
||||
function BillingTab({ formik }) {
|
||||
console.log(formik.values, 'val');
|
||||
return (
|
||||
<div>
|
||||
<BillingPlans title={'a_select_a_plan'} formik={formik} />
|
||||
|
||||
@@ -76,7 +76,7 @@ function BillingPlans({ formik, title, selected = 1 }) {
|
||||
slug={plan.slug}
|
||||
price={plan.price}
|
||||
currency={plan.currency}
|
||||
onSelected={() => formik.setFieldValue('plan_slug', plan.name)}
|
||||
onSelected={() => formik.setFieldValue('plan_slug', plan.slug)}
|
||||
selected={selected == index + 1}
|
||||
/>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user