Phase 2 tweaks: admin tenant creation, unit delete, frequency, UI overhaul
- Admin panel: create tenants with org + first user, manage org status (active/suspended/archived), contract number and plan level fields - Units: delete with invoice check, assessment group dropdown binding - Assessment groups: frequency field (monthly/quarterly/annual) with income calculations normalized to monthly equivalents - Sidebar: grouped nav sections (Financials, Assessments, Transactions, Planning, Reports, Admin), renamed Chart of Accounts to Accounts - Header: replaced text with SVG logo - Capital projects: Kanban as default view, table-only PDF export, Future category (beyond 5-year plan) - Auth: block login for suspended/archived organizations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,8 +13,10 @@ CREATE TABLE shared.organizations (
|
||||
name VARCHAR(255) NOT NULL,
|
||||
schema_name VARCHAR(63) NOT NULL UNIQUE,
|
||||
subdomain VARCHAR(63) UNIQUE,
|
||||
status VARCHAR(20) DEFAULT 'active' CHECK (status IN ('active', 'suspended', 'trial')),
|
||||
status VARCHAR(20) DEFAULT 'active' CHECK (status IN ('active', 'suspended', 'trial', 'archived')),
|
||||
settings JSONB DEFAULT '{}',
|
||||
contract_number VARCHAR(100),
|
||||
plan_level VARCHAR(50) DEFAULT 'standard' CHECK (plan_level IN ('standard', 'premium', 'enterprise')),
|
||||
address_line1 VARCHAR(255),
|
||||
address_line2 VARCHAR(255),
|
||||
city VARCHAR(100),
|
||||
|
||||
@@ -63,7 +63,7 @@ END IF;
|
||||
-- Check if org exists
|
||||
SELECT id INTO v_org_id FROM shared.organizations WHERE schema_name = v_schema;
|
||||
IF v_org_id IS NULL THEN
|
||||
INSERT INTO shared.organizations (id, name, subdomain, address_line1, city, state, zip_code, schema_name)
|
||||
INSERT INTO shared.organizations (id, name, subdomain, address_line1, city, state, zip_code, schema_name, contract_number, plan_level)
|
||||
VALUES (
|
||||
uuid_generate_v4(),
|
||||
'Sunrise Valley HOA',
|
||||
@@ -72,7 +72,9 @@ IF v_org_id IS NULL THEN
|
||||
'Scottsdale',
|
||||
'AZ',
|
||||
'85255',
|
||||
v_schema
|
||||
v_schema,
|
||||
'CON-2026-001',
|
||||
'premium'
|
||||
) RETURNING id INTO v_org_id;
|
||||
|
||||
INSERT INTO shared.user_organizations (user_id, organization_id, role)
|
||||
@@ -176,6 +178,7 @@ CREATE TABLE IF NOT EXISTS %I.assessment_groups (
|
||||
regular_assessment DECIMAL(10,2) NOT NULL DEFAULT 0.00,
|
||||
special_assessment DECIMAL(10,2) DEFAULT 0.00,
|
||||
unit_count INTEGER DEFAULT 0,
|
||||
frequency VARCHAR(20) DEFAULT ''monthly'',
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ DEFAULT NOW()
|
||||
|
||||
Reference in New Issue
Block a user