mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
feat: Move billing to preferences (#566)
* feat: move billing to preferences * chore: remove the commented lines
This commit is contained in:
@@ -15,7 +15,7 @@ import { useAuthActions } from '@/hooks/state';
|
|||||||
|
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
|
|
||||||
import { useAuthenticatedAccount, useDashboardMeta } from '@/hooks/query';
|
import { useAuthenticatedAccount } from '@/hooks/query';
|
||||||
import { firstLettersArgs, compose } from '@/utils';
|
import { firstLettersArgs, compose } from '@/utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,9 +31,6 @@ function DashboardTopbarUser({
|
|||||||
// Retrieve authenticated user information.
|
// Retrieve authenticated user information.
|
||||||
const { data: user } = useAuthenticatedAccount();
|
const { data: user } = useAuthenticatedAccount();
|
||||||
|
|
||||||
const { data: dashboardMeta } = useDashboardMeta({
|
|
||||||
keepPreviousData: true,
|
|
||||||
});
|
|
||||||
const onClickLogout = () => {
|
const onClickLogout = () => {
|
||||||
setLogout();
|
setLogout();
|
||||||
};
|
};
|
||||||
@@ -61,12 +58,6 @@ function DashboardTopbarUser({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<MenuDivider />
|
<MenuDivider />
|
||||||
{dashboardMeta.is_bigcapital_cloud && (
|
|
||||||
<MenuItem
|
|
||||||
text={'Billing'}
|
|
||||||
onClick={() => history.push('/billing')}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={<T id={'keyboard_shortcuts'} />}
|
text={<T id={'keyboard_shortcuts'} />}
|
||||||
onClick={onKeyboardShortcut}
|
onClick={onKeyboardShortcut}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ export default [
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
href: '/preferences/general',
|
href: '/preferences/general',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: 'Billing',
|
||||||
|
href: '/preferences/billing',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: <T id={'users'} />,
|
text: <T id={'users'} />,
|
||||||
href: '/preferences/users',
|
href: '/preferences/users',
|
||||||
|
|||||||
@@ -1,28 +1,40 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
import { useEffect } from 'react';
|
||||||
import * as R from 'ramda';
|
import * as R from 'ramda';
|
||||||
import { Redirect } from 'react-router-dom';
|
import { Redirect } from 'react-router-dom';
|
||||||
import { BillingPageBoot } from './BillingPageBoot';
|
import { BillingPageBoot } from './BillingPageBoot';
|
||||||
import { BillingPageContent } from './BillingPageContent';
|
import { BillingPageContent } from './BillingPageContent';
|
||||||
import { DashboardInsider } from '@/components';
|
|
||||||
import { useDashboardMeta } from '@/hooks/query';
|
import { useDashboardMeta } from '@/hooks/query';
|
||||||
import withAlertActions from '../Alert/withAlertActions';
|
import withAlertActions from '../Alert/withAlertActions';
|
||||||
|
import withDashboardActions from '../Dashboard/withDashboardActions';
|
||||||
|
|
||||||
function BillingPageRoot({ openAlert }) {
|
function BillingPageRoot({
|
||||||
|
openAlert,
|
||||||
|
|
||||||
|
// #withAlertActions
|
||||||
|
changePreferencesPageTitle,
|
||||||
|
}) {
|
||||||
const { data: dashboardMeta } = useDashboardMeta({
|
const { data: dashboardMeta } = useDashboardMeta({
|
||||||
keepPreviousData: true,
|
keepPreviousData: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
changePreferencesPageTitle('Billing');
|
||||||
|
}, [changePreferencesPageTitle]);
|
||||||
|
|
||||||
// In case the edition is not Bigcapital Cloud, redirect to the homepage.
|
// In case the edition is not Bigcapital Cloud, redirect to the homepage.
|
||||||
if (!dashboardMeta.is_bigcapital_cloud) {
|
if (!dashboardMeta.is_bigcapital_cloud) {
|
||||||
return <Redirect to={{ pathname: '/' }} />;
|
return <Redirect to={{ pathname: '/' }} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardInsider>
|
|
||||||
<BillingPageBoot>
|
<BillingPageBoot>
|
||||||
<BillingPageContent />
|
<BillingPageContent />
|
||||||
</BillingPageBoot>
|
</BillingPageBoot>
|
||||||
</DashboardInsider>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default R.compose(withAlertActions)(BillingPageRoot);
|
export default R.compose(
|
||||||
|
withAlertActions,
|
||||||
|
withDashboardActions,
|
||||||
|
)(BillingPageRoot);
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
.root {
|
.root {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 32px 40px;
|
padding: 20px;
|
||||||
min-width: 800px;
|
|
||||||
max-width: 900px;
|
|
||||||
width: 75%;
|
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
width: 450px;
|
width: 450px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
box-shadow: 0 -8px 0 0px #BFCCD6, rgb(0 8 36 / 9%) 0px 4px 20px -5px;
|
box-shadow: 0 -6px 0 0px #ccd6dd;
|
||||||
border: 1px solid #C4D2D7;
|
border: 1px solid #d2dde1;
|
||||||
min-height: 420px;
|
min-height: 420px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -1231,13 +1231,6 @@ export const getDashboardRoutes = () => [
|
|||||||
breadcrumb: 'Bank Rules',
|
breadcrumb: 'Bank Rules',
|
||||||
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: '/billing',
|
|
||||||
component: lazy(() => import('@/containers/Subscriptions/BillingPage')),
|
|
||||||
pageTitle: 'Billing',
|
|
||||||
breadcrumb: 'Billing',
|
|
||||||
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
|
|
||||||
},
|
|
||||||
// Homepage
|
// Homepage
|
||||||
{
|
{
|
||||||
path: `/`,
|
path: `/`,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
import { lazy } from 'react';
|
||||||
import General from '@/containers/Preferences/General/General';
|
import General from '@/containers/Preferences/General/General';
|
||||||
import Users from '../containers/Preferences/Users/Users';
|
import Users from '../containers/Preferences/Users/Users';
|
||||||
import Roles from '../containers/Preferences/Users/Roles/RolesForm/RolesFormPage';
|
import Roles from '../containers/Preferences/Users/Roles/RolesForm/RolesFormPage';
|
||||||
@@ -12,7 +13,9 @@ import Branches from '../containers/Preferences/Branches';
|
|||||||
import Invoices from '../containers/Preferences/Invoices/PreferencesInvoices';
|
import Invoices from '../containers/Preferences/Invoices/PreferencesInvoices';
|
||||||
import { PreferencesCreditNotes } from '../containers/Preferences/CreditNotes/PreferencesCreditNotes';
|
import { PreferencesCreditNotes } from '../containers/Preferences/CreditNotes/PreferencesCreditNotes';
|
||||||
import { PreferencesEstimates } from '@/containers/Preferences/Estimates/PreferencesEstimates';
|
import { PreferencesEstimates } from '@/containers/Preferences/Estimates/PreferencesEstimates';
|
||||||
import{ PreferencesReceipts } from '@/containers/Preferences/Receipts/PreferencesReceipts'
|
import { PreferencesReceipts } from '@/containers/Preferences/Receipts/PreferencesReceipts';
|
||||||
|
|
||||||
|
import BillingPage from '@/containers/Subscriptions/BillingPage';
|
||||||
|
|
||||||
const BASE_URL = '/preferences';
|
const BASE_URL = '/preferences';
|
||||||
|
|
||||||
@@ -87,6 +90,11 @@ export default [
|
|||||||
component: SMSIntegration,
|
component: SMSIntegration,
|
||||||
exact: true,
|
exact: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: `${BASE_URL}/billing`,
|
||||||
|
component: BillingPage,
|
||||||
|
exact: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: `${BASE_URL}/`,
|
path: `${BASE_URL}/`,
|
||||||
component: DefaultRoute,
|
component: DefaultRoute,
|
||||||
|
|||||||
Reference in New Issue
Block a user