File tree Expand file tree Collapse file tree
frontend/web/components/pages/organisation-settings/tabs/general-tab/sections Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import React from 'react'
22import { useHistory } from 'react-router-dom'
3+ import { planNames } from 'common/utils/utils'
34import { Organisation } from 'common/types/responses'
45import { useDeleteOrganisationWithToast } from 'components/pages/organisation-settings/hooks'
56import ConfirmRemoveOrganisation from 'components/modals/ConfirmRemoveOrganisation'
@@ -37,6 +38,9 @@ export const DeleteOrganisation = ({
3738 'p-0' ,
3839 )
3940 }
41+ const isDeleteButtonDisabled =
42+ Utils . getPlanName ( organisation . subscription ?. plan ?? '' ) !==
43+ planNames . free && ! organisation . subscription ?. cancellation_date
4044
4145 return (
4246 < >
@@ -53,10 +57,18 @@ export const DeleteOrganisation = ({
5357 data-test = 'delete-org-btn'
5458 onClick = { handleDelete }
5559 theme = 'danger'
56- disabled = { isLoading }
60+ disabled = { isLoading || isDeleteButtonDisabled }
5761 >
5862 { isLoading ? 'Deleting...' : 'Delete Organisation' }
5963 </ Button >
64+ { isDeleteButtonDisabled && (
65+ < div className = 'col-md-7' >
66+ < p className = 'text-danger' >
67+ You need to cancel your active subscriptions before deleting your
68+ organisation.
69+ </ p >
70+ </ div >
71+ ) }
6072 </ Row >
6173 </ >
6274 )
You can’t perform that action at this time.
0 commit comments