fix: billing portal error, onboarding wizard improvements, budget empty state
- Fix "Manage Billing" button error for trial orgs without Stripe customer; add fallback to retrieve customer from subscription, show helpful message for trial users, and surface real error messages in the UI - Add "Balance As-Of Date" field to onboarding wizard so opening balance journal entries use the correct statement date instead of today - Add "Total Unit Count" field to onboarding wizard assessment group step so cash flow projections work immediately - Remove broken budget upload step from onboarding wizard (was using legacy budgets endpoint); replace with guidance to use Budget Planning page - Replace bare "No budget plan lines" text with rich onboarding-style card featuring download template and upload CSV action buttons Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import {
|
||||
Title, Table, Group, Button, Stack, Text, NumberInput,
|
||||
Select, Loader, Center, Badge, Card, Alert, Modal,
|
||||
Select, Loader, Center, Badge, Card, Alert, Modal, ThemeIcon,
|
||||
} from '@mantine/core';
|
||||
import { notifications } from '@mantine/notifications';
|
||||
import {
|
||||
IconDeviceFloppy, IconInfoCircle, IconPencil, IconX,
|
||||
IconCheck, IconArrowBack, IconTrash, IconRefresh,
|
||||
IconUpload, IconDownload,
|
||||
IconUpload, IconDownload, IconFileSpreadsheet,
|
||||
} from '@tabler/icons-react';
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import api from '../../services/api';
|
||||
@@ -659,7 +659,37 @@ export function BudgetPlanningPage() {
|
||||
{lineData.length === 0 && (
|
||||
<Table.Tr>
|
||||
<Table.Td colSpan={15}>
|
||||
<Text ta="center" c="dimmed" py="lg">No budget plan lines.</Text>
|
||||
<Card withBorder p="xl" mx="auto" maw={600} my="lg" style={{ textAlign: 'center' }}>
|
||||
<ThemeIcon size={60} radius="xl" variant="light" color="blue" mx="auto" mb="md">
|
||||
<IconFileSpreadsheet size={28} />
|
||||
</ThemeIcon>
|
||||
<Title order={4} mb="xs">Get Started with Your {selectedYear} Budget</Title>
|
||||
<Text c="dimmed" size="sm" mb="lg" maw={450} mx="auto">
|
||||
Your budget plan is created but has no line items yet. Download the
|
||||
CSV template pre-filled with your chart of accounts, fill in your
|
||||
monthly amounts, then upload it here.
|
||||
</Text>
|
||||
<Group justify="center" gap="md">
|
||||
<Button
|
||||
variant="light"
|
||||
leftSection={<IconDownload size={16} />}
|
||||
onClick={handleDownloadTemplate}
|
||||
>
|
||||
Download Budget Template
|
||||
</Button>
|
||||
<Button
|
||||
leftSection={<IconUpload size={16} />}
|
||||
onClick={handleImportCSV}
|
||||
loading={importMutation.isPending}
|
||||
>
|
||||
Upload Budget CSV
|
||||
</Button>
|
||||
</Group>
|
||||
<Text size="xs" c="dimmed" mt="md">
|
||||
Tip: The template includes all your active accounts. Fill in the monthly
|
||||
dollar amounts for each line, save as CSV, then upload.
|
||||
</Text>
|
||||
</Card>
|
||||
</Table.Td>
|
||||
</Table.Tr>
|
||||
)}
|
||||
|
||||
@@ -24,6 +24,7 @@ interface SubscriptionInfo {
|
||||
trialEndsAt: string | null;
|
||||
currentPeriodEnd: string | null;
|
||||
cancelAtPeriodEnd: boolean;
|
||||
hasStripeCustomer: boolean;
|
||||
}
|
||||
|
||||
const statusColors: Record<string, string> = {
|
||||
@@ -68,8 +69,9 @@ export function SettingsPage() {
|
||||
if (data.url) {
|
||||
window.location.href = data.url;
|
||||
}
|
||||
} catch {
|
||||
notifications.show({ message: 'Unable to open billing portal', color: 'red' });
|
||||
} catch (err: any) {
|
||||
const msg = err.response?.data?.message || 'Unable to open billing portal';
|
||||
notifications.show({ message: typeof msg === 'string' ? msg : 'Unable to open billing portal', color: 'red' });
|
||||
} finally {
|
||||
setPortalLoading(false);
|
||||
}
|
||||
@@ -167,17 +169,23 @@ export function SettingsPage() {
|
||||
<Badge variant="light" color="cyan" size="sm">Invoice / ACH</Badge>
|
||||
</Group>
|
||||
)}
|
||||
<Button
|
||||
variant="light"
|
||||
color="teal"
|
||||
size="sm"
|
||||
leftSection={<IconCreditCard size={16} />}
|
||||
onClick={handleManageBilling}
|
||||
loading={portalLoading}
|
||||
mt="xs"
|
||||
>
|
||||
Manage Billing
|
||||
</Button>
|
||||
{subscription.hasStripeCustomer ? (
|
||||
<Button
|
||||
variant="light"
|
||||
color="teal"
|
||||
size="sm"
|
||||
leftSection={<IconCreditCard size={16} />}
|
||||
onClick={handleManageBilling}
|
||||
loading={portalLoading}
|
||||
mt="xs"
|
||||
>
|
||||
Manage Billing
|
||||
</Button>
|
||||
) : subscription.status === 'trial' ? (
|
||||
<Text size="xs" c="dimmed" mt="xs">
|
||||
Billing portal will be available once you add a payment method.
|
||||
</Text>
|
||||
) : null}
|
||||
</Stack>
|
||||
) : (
|
||||
<Text size="sm" c="dimmed">No active subscription</Text>
|
||||
|
||||
Reference in New Issue
Block a user