> ## Documentation Index
> Fetch the complete documentation index at: https://docs.younegotiate.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload History

> EcoMail Hub users review creditor profile import status and download source or failed files.

## Real-World Example

After uploading the ABC creditor prospects file, Maya opens Upload History. She sees the original filename, record counts, success count, failed count, and status. If rows failed, she downloads the failed file, fixes the `Errors` column issues, and uploads a corrected file.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["User opens Upload History"] --> B["Portal lists visible import history"]
    B --> C["User reviews status and counts"]
    C --> D{"Download requested?"}
    D -->|Source file| E["Download original uploaded CSV"]
    D -->|Failed file| F["Download failed CSV when available"]
    D -->|Delete history| G["Hide history row"]
    classDef default fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef actor fill:#E0F2FE,stroke:#0284C7,stroke-width:2px,color:#0C4A6E;
    classDef system fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef decision fill:#FEF3C7,stroke:#D97706,stroke-width:2px,color:#78350F;
    classDef risk fill:#FEE2E2,stroke:#DC2626,stroke-width:2px,color:#7F1D1D;
    classDef outcome fill:#DCFCE7,stroke:#16A34A,stroke-width:2px,color:#14532D;
    class A actor;
    class B,C system;
    class D decision;
    class E,F,G outcome;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## How It Should Work

* It should show only import history for the logged-in EcoMail Hub user.
* It should allow downloading the original uploaded file when it still exists.
* It should allow downloading the failed file only when the import generated one.
* It should hide deleted history rows without deleting unrelated upload records.

## How It Should Not Work

* It should not let one EcoMail Hub user download another user's import file.
* It should not show failed-file download as successful when no failed file exists.
* It should not treat a hidden history row as a failed import.

## Developer Notes

* Authorization checks compare history ownership to the authenticated `consumer-response-manager` user.
* History deletion updates `is_hidden` instead of removing the upload history record.

## Related App Areas

* `app/Livewire/ConsumerResponseManager/ImportCreditorProfiles/FileUploadHistoryPage.php`
* `app/Models/CreditorProfileImportHistory.php`
* `app/Enums/ConsumerResponseManager/CreditorProfileImportHistoryStatus.php`
