mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
fix(Billing): display payment methods only if subscription is not active.
This commit is contained in:
15
src/containers/Subscriptions/BillingPaymentMethod.js
Normal file
15
src/containers/Subscriptions/BillingPaymentMethod.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { T } from 'components';
|
||||||
|
import { PaymentMethodTabs } from './SubscriptionTabs';
|
||||||
|
|
||||||
|
export default ({ formik, title, description }) => {
|
||||||
|
return (
|
||||||
|
<section class="billing-plans__section">
|
||||||
|
<h1 className="title"><T id={'setup.plans.payment_methods.title'} /></h1>
|
||||||
|
<p className="paragraph"><T id={'setup.plans.payment_methods.description' } /></p>
|
||||||
|
|
||||||
|
<PaymentMethodTabs formik={formik} />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import * as R from 'ramda';
|
||||||
|
|
||||||
import 'style/pages/Subscription/BillingPlans.scss';
|
import 'style/pages/Subscription/BillingPlans.scss';
|
||||||
|
|
||||||
import BillingPlansInput from './BillingPlansInput';
|
import BillingPlansInput from './BillingPlansInput';
|
||||||
import BillingPeriodsInput from './BillingPeriodsInput';
|
import BillingPeriodsInput from './BillingPeriodsInput';
|
||||||
// import BillingPaymentMethod from './BillingPaymentMethod';
|
import BillingPaymentMethod from './BillingPaymentMethod';
|
||||||
|
|
||||||
|
import withSubscriptions from './withSubscriptions';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Billing plans form.
|
* Billing plans form.
|
||||||
@@ -14,7 +17,24 @@ export default function BillingPlansForm() {
|
|||||||
<div class="billing-plans">
|
<div class="billing-plans">
|
||||||
<BillingPlansInput />
|
<BillingPlansInput />
|
||||||
<BillingPeriodsInput />
|
<BillingPeriodsInput />
|
||||||
{/* <BillingPaymentMethod /> */}
|
<BillingPaymentMethodWhenSubscriptionInactive />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Billing payment methods when subscription is inactive.
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
*/
|
||||||
|
function BillingPaymentMethodWhenSubscriptionInactiveJSX({
|
||||||
|
// # withSubscriptions
|
||||||
|
isSubscriptionActive,
|
||||||
|
|
||||||
|
...props
|
||||||
|
}) {
|
||||||
|
return !isSubscriptionActive ? <BillingPaymentMethod {...props} /> : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const BillingPaymentMethodWhenSubscriptionInactive = R.compose(
|
||||||
|
withSubscriptions(({ isSubscriptionActive }) => ({ isSubscriptionActive })),
|
||||||
|
)(BillingPaymentMethodWhenSubscriptionInactiveJSX);
|
||||||
|
|||||||
Reference in New Issue
Block a user