Fix bugs: monthly actuals month filter, unit assessments, project funding logic, UI cleanup

- Fix monthly actuals showing same data for all months (SQL JOIN excluded
  month filter from SUM — added je.id IS NOT NULL guard)
- Fix units displaying $0 assessment by reading from assessment group
  instead of stale unit field; add special assessment column
- Replace proportional project funding with priority-based sequential
  allocation — near-term items get fully funded first; add is_funding_locked
  flag so users can manually lock a project's fund balance
- Remove post-creation opening balance UI (keep only initial balance on
  account creation); remove redundant Fund filter dropdown from Accounts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-25 14:05:07 -05:00
parent 45a267d787
commit e0c956859b
7 changed files with 148 additions and 353 deletions

View File

@@ -23,6 +23,7 @@ interface Unit {
assessment_group_id?: string;
assessment_group_name?: string;
group_regular_assessment?: string;
group_special_assessment?: string;
group_frequency?: string;
}
@@ -193,6 +194,7 @@ export function UnitsPage() {
<Table.Th>Email</Table.Th>
<Table.Th>Group</Table.Th>
<Table.Th ta="right">Assessment</Table.Th>
<Table.Th ta="right">Special Assessment</Table.Th>
<Table.Th>Status</Table.Th>
<Table.Th></Table.Th>
</Table.Tr>
@@ -211,7 +213,15 @@ export function UnitsPage() {
<Text size="xs" c="dimmed">-</Text>
)}
</Table.Td>
<Table.Td ta="right" ff="monospace">${parseFloat(u.monthly_assessment || '0').toFixed(2)}</Table.Td>
<Table.Td ta="right" ff="monospace">
${parseFloat(u.group_regular_assessment || u.monthly_assessment || '0').toFixed(2)}
</Table.Td>
<Table.Td ta="right" ff="monospace">
{parseFloat(u.group_special_assessment || '0') > 0
? `$${parseFloat(u.group_special_assessment || '0').toFixed(2)}`
: <Text size="sm" c="dimmed">-</Text>
}
</Table.Td>
<Table.Td><Badge color={u.status === 'active' ? 'green' : 'gray'} size="sm">{u.status}</Badge></Table.Td>
<Table.Td>
<Group gap={4}>
@@ -227,7 +237,7 @@ export function UnitsPage() {
</Table.Td>
</Table.Tr>
))}
{filtered.length === 0 && <Table.Tr><Table.Td colSpan={8}><Text ta="center" c="dimmed" py="lg">No units yet</Text></Table.Td></Table.Tr>}
{filtered.length === 0 && <Table.Tr><Table.Td colSpan={9}><Text ta="center" c="dimmed" py="lg">No units yet</Text></Table.Td></Table.Tr>}
</Table.Tbody>
</Table>