Admin Control Suite
Relevant source files
The following files were used as context for generating this wiki page:
The Admin Control Suite is a governance-driven administrative hub designed to manage high-stakes operations within the Monarch Property Management ecosystem. It provides a centralized interface for executing database-level "Admin Jobs," managing Requests for Quotations (RFQs), and overseeing project lifecycles with a focus on auditability and risk mitigation.
The suite ensures that all administrative actions—ranging from simple record updates to mass deletions—are performed under a strict governance policy. This includes tracking the intent behind operations, enforcing risk-based approval workflows, and maintaining a permanent audit trail of all changes.
Sources: src/pages/AdminControlSuite.tsx:21-26, src/pages/admin/UnifiedRFQManagement.tsx:12-18
Governance and Job Management
The core of the Control Suite is the Admin Job system, which transitions administrative tasks from direct database manipulation to structured, tracked operations. Each job is defined by its target, the intended operation, and a risk assessment.
Risk Levels and Approval Workflow
Operations are categorized into three distinct risk tiers, each requiring different levels of oversight:
| Risk Level | Description | Approval Requirement |
|---|---|---|
| Low | Read operations (SELECT) or minor updates to non-critical records. | Single approval (typically the creator). |
| Medium | Moderate updates affecting multiple records or sensitive configurations. | Peer review recommended before execution. |
| High | Mass operations, deletions, or schema-impacting changes. | Dual approval and mandatory system snapshot. |
Sources: src/pages/AdminControlSuite.tsx:156-180
Job Lifecycle
The following diagram illustrates the lifecycle of an administrative job from creation to completion.
RFQ System Administration
The Admin Control Suite integrates a sophisticated RFQ (Request for Quotation) management system. This allows administrators to draft detailed technical specifications, invite verified vendors, and analyze bids.
RFQ Configuration Components
Administrators manage RFQs through a tabbed interface that covers several technical domains:
- Document Control: Manages RFQ reference numbers, project identification, and official status (e.g., "Issued for Quotation").
- Technical Specifications: Defines unit configurations, cooling load summaries, and Bill of Quantities (BOQ) items.
- Commercial Framework: Sets payment milestones, maintenance terms, and emergency service conditions.
- System Strategy: Enforces non-negotiable design intents, such as prohibited system types (e.g., VRF or shared loops).
Sources: src/pages/admin/RFQEdit.tsx:126-140, src/pages/admin/ComprehensiveRFQDetail.tsx:180-210
Vendor Invitation and Bid Analysis
The suite facilitates direct interaction with the vendor marketplace through a structured sequence:
Unified Project and RFQ Management
The suite provides a "Unified" view to manage both modern RFQs and legacy projects. This ensures continuity for properties transitioning to the newer procurement system.
Data Structures
The management system relies on two primary data models for tracking procurement:
RFQ Item Schema
| Field | Type | Description |
|---|---|---|
id | UUID | Unique identifier for the RFQ. |
status | String | draft, open, closed, or awarded. |
lots_count | Integer | Number of distinct bidding units (lots) defined. |
property_id | Integer | Foreign key linking to the property table. |
Legacy Project Schema
| Field | Type | Description |
|---|---|---|
priority | String | low, medium, high, or urgent. |
budget_min/max | Numeric | Range defined for vendor guidance. |
category | String | Service type (e.g., Plumbing, Electrical). |
Sources: src/components/AdminRFQSystem.tsx:40-75, src/pages/admin/UnifiedRFQManagement.tsx:35-60
Implementation Details
Security Defined Helpers
To maintain the integrity of the audit trail, the suite utilizes SECURITY DEFINER functions in the backend. These functions ensure that administrative actions are executed with the necessary privileges while strictly recording the auth.uid() of the initiator.
Sources: src/pages/AdminControlSuite.tsx:115-125, DEPLOYMENT_GUIDE.md:20-25
Code Snippet: Admin Job Creation
The following logic demonstrates how an administrative job is initialized with risk metadata:
const createJob = async () => {
const { data, error } = await supabase
.from('admin_jobs')
.insert({
title,
intent,
risk_level: riskLevel, // 'low' | 'medium' | 'high'
target_table: targetTable,
target_operation: operation, // 'UPDATE' | 'DELETE' | etc.
created_by: user?.id,
status: 'draft'
});
};
Sources: src/pages/AdminControlSuite.tsx:43-65
Summary
The Admin Control Suite serves as the high-privilege operations center for the platform. By combining structured "Admin Jobs" with a comprehensive RFQ management engine, it enables property administrators to perform complex maintenance and procurement tasks while adhering to strict compliance and audit standards. Its modular design allows for granular control over project specifications, vendor communications, and database operations.