feat: update billing UI for pending cancellations and add service area modal to agent profile
This commit is contained in:
@@ -19,6 +19,9 @@ class _BillingTabState extends ConsumerState<BillingTab>
|
||||
bool _isLoadingSubscription = false;
|
||||
bool _openedExternalCheckout = false;
|
||||
|
||||
bool get cancelAtPeriodEnd =>
|
||||
_subscription?['cancelAtPeriodEnd'] == true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -179,7 +182,9 @@ class _BillingTabState extends ConsumerState<BillingTab>
|
||||
const Spacer(),
|
||||
if (_subscription?['currentPeriodEnd'] != null)
|
||||
Text(
|
||||
'Renews ${_formatDate(_subscription!['currentPeriodEnd'] as String)}',
|
||||
cancelAtPeriodEnd
|
||||
? 'Cancels on ${_formatDate(_subscription!['currentPeriodEnd'] as String)}'
|
||||
: 'Renews ${_formatDate(_subscription!['currentPeriodEnd'] as String)}',
|
||||
style: TextStyle(
|
||||
fontFamily: 'SourceSerif4',
|
||||
fontSize: 13,
|
||||
@@ -256,17 +261,19 @@ class _BillingTabState extends ConsumerState<BillingTab>
|
||||
const SizedBox(height: 16),
|
||||
..._buildPlanFeatures(),
|
||||
const SizedBox(height: 16),
|
||||
Center(
|
||||
child: TextButton(
|
||||
onPressed: _cancelSubscription,
|
||||
style: TextButton.styleFrom(foregroundColor: Colors.red),
|
||||
child: const Text('Cancel Subscription',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500)),
|
||||
// Hide Cancel Subscription once cancellation is pending (matches web)
|
||||
if (!cancelAtPeriodEnd)
|
||||
Center(
|
||||
child: TextButton(
|
||||
onPressed: _cancelSubscription,
|
||||
style: TextButton.styleFrom(foregroundColor: Colors.red),
|
||||
child: const Text('Cancel Subscription',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Fractul',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user