# EntityReportDetail Component
A reusable whole-page UIX component for report detail pages. Provides a standardized layout with breadcrumb navigation, form card, success/error handling, and recent downloads section.
## Features
- ✅ Full-page layout with theme support
- ✅ Automatic breadcrumb generation
- ✅ Built-in success/error message handling
- ✅ Recent downloads section with filtering
- ✅ Info message support
- ✅ Flexible form content via children
- ✅ Responsive grid layout for downloads
- ✅ Theme-aware styling throughout
## Usage
### Basic Example
```jsx
import React, { useState } from "react";
import { EntityReportDetail, Button, Input, UIXThemeProvider } from "components/UIX";
import { BanknotesIcon, CalendarIcon } from "@heroicons/react/24/outline";
function MyReportPage() {
const [showSuccess, setShowSuccess] = useState(false);
const [errors, setErrors] = useState({});
const [fromDate, setFromDate] = useState("");
const [toDate, setToDate] = useState("");
const recentDownloads = []; // Get from your service
return (
setShowSuccess(false)}
onDismissErrors={() => setErrors({})}
>
{/* Your form content goes here */}
);
}
```
## Props
| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| `reportTitle` | `string` | ✅ Yes | - | Title displayed in the card header |
| `reportDescription` | `string` | ✅ Yes | - | Description text below the title |
| `reportBreadcrumbLabel` | `string` | ❌ No | `reportTitle` | Label for the breadcrumb (defaults to reportTitle) |
| `icon` | `React.Component` | ✅ Yes | - | HeroIcon component for the report (e.g., `BanknotesIcon`) |
| `children` | `React.ReactNode` | ✅ Yes | - | Form content to render inside the card |
| `recentDownloads` | `Array` | ❌ No | `[]` | Array of recent download objects |
| `showSuccess` | `boolean` | ❌ No | `false` | Whether to show success message |
| `errors` | `Object` | ❌ No | `{}` | Error object for display |
| `infoMessage` | `string` | ❌ No | `""` | Info alert message to display |
| `onDismissSuccess` | `Function` | ❌ No | - | Callback when success message is dismissed |
| `onDismissErrors` | `Function` | ❌ No | - | Callback when errors are dismissed |
| `reportId` | `string\|number` | ❌ No | - | Report ID for filtering recent downloads |
| `reportType` | `string` | ❌ No | - | Report type for filtering recent downloads |
### Recent Downloads Array Format
Each item in the `recentDownloads` array should have:
```javascript
{
filename: "report-2024-01-15.csv", // Display name
downloadedAt: "2024-01-15T10:30:00Z", // ISO date string
reportId: 1, // Optional: for filtering
reportType: "Due Service Fees" // Optional: for filtering
}
```
### Error Object Format
The `errors` object should be a key-value map:
```javascript
{
fromDate: "Start date is required",
toDate: "End date must be after start date",
general: "Failed to generate report"
}
```
## Layout Structure
The component creates this structure:
```
┌─────────────────────────────────────────┐
│ Breadcrumb: Dashboard > Reports > ... │
├─────────────────────────────────────────┤
│ ┌─────────────────────────────────────┐ │
│ │ 📊 Report Title │ │
│ │ Report Description │ │
│ ├─────────────────────────────────────┤ │
│ │ [Success/Error Messages] │ │
│ │ [Info Message] │ │
│ │ │ │
│ │ {children - Your Form Content} │ │
│ └─────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────┐ │
│ │ 🕒 Recent Downloads │ │
│ │ ┌─────┐ ┌─────┐ ┌─────┐ │ │
│ │ │file1│ │file2│ │file3│ │ │
│ │ └─────┘ └─────┘ └─────┘ │ │
│ └─────────────────────────────────────┘ │
└─────────────────────────────────────────┘
```
## Styling & Themes
The component is fully theme-aware and uses:
- `bg-gradient-primary` for page background
- `bg-card` and `card-border` for card styling
- `bg-gradient-header` for card headers
- `text-primary`, `text-secondary` for text
- `text-success`, `text-error` for status colors
All colors automatically adapt to the active theme (blue, red, purple, green, charcoal).
## Best Practices
### 1. Form Structure
Wrap your form content in a `