Files
gh-christianlouis-docuelevate/frontend/templates/file_detail.html
T
copilot-swe-agent[bot] 334714423e fix(ui): address code review feedback on inline preview
- Remove invalid type attribute from iframe elements
- Add dedicated download endpoint with attachment disposition
- Update download links to use new endpoint instead of preview

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
2026-02-08 16:16:31 +00:00

912 lines
28 KiB
HTML

{% extends "base.html" %}
{% block title %}File Details{% endblock %}
{% block head_extra %}
<style>
.detail-container {
max-width: 1200px;
margin: 0 auto;
}
.back-button {
display: inline-flex;
align-items: center;
color: #3182ce;
text-decoration: none;
margin-bottom: 1.5rem;
font-weight: 600;
}
.back-button:hover {
color: #2c5aa0;
}
.back-button i {
margin-right: 0.5rem;
}
.detail-card {
background-color: white;
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
padding: 2rem;
margin-bottom: 1.5rem;
}
.detail-card h3 {
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 1rem;
color: #2d3748;
}
.detail-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1.5rem;
}
.detail-item {
display: flex;
flex-direction: column;
}
.detail-label {
font-weight: 600;
color: #4a5568;
margin-bottom: 0.25rem;
font-size: 0.875rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.detail-value {
color: #2d3748;
font-size: 1rem;
word-break: break-word;
}
/* Status badges */
.status-badge {
display: inline-block;
padding: 0.5rem 1rem;
border-radius: 9999px;
font-size: 1rem;
font-weight: 600;
text-align: center;
}
.status-pending {
background-color: #FEF3C7;
color: #92400E;
}
.status-processing {
background-color: #DBEAFE;
color: #1E3A8A;
}
.status-completed {
background-color: #D1FAE5;
color: #065F46;
}
.status-failed {
background-color: #FEE2E2;
color: #991B1B;
}
/* Step summary section */
.step-summary {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin-bottom: 1.5rem;
}
.summary-card {
background-color: #f7fafc;
border-radius: 0.5rem;
padding: 1rem;
border-left: 4px solid #e2e8f0;
}
.summary-card.main-steps {
border-left-color: #4299e1;
}
.summary-card.upload-steps {
border-left-color: #48bb78;
}
.summary-title {
font-weight: 600;
color: #2d3748;
margin-bottom: 0.5rem;
font-size: 0.875rem;
text-transform: uppercase;
}
.summary-counts {
display: flex;
gap: 1rem;
flex-wrap: wrap;
}
.summary-count {
display: flex;
align-items: center;
gap: 0.25rem;
font-size: 0.875rem;
}
.count-badge {
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.5rem;
height: 1.5rem;
border-radius: 50%;
font-weight: 600;
font-size: 0.75rem;
}
.count-badge.success {
background-color: #48bb78;
color: white;
}
.count-badge.failure {
background-color: #f56565;
color: white;
}
.count-badge.in-progress {
background-color: #4299e1;
color: white;
}
.count-badge.queued {
background-color: #ecc94b;
color: white;
}
/* Processing logs - collapsible */
.timeline {
position: relative;
padding-left: 2rem;
}
.timeline::before {
content: '';
position: absolute;
left: 0.5rem;
top: 0;
bottom: 0;
width: 2px;
background-color: #e2e8f0;
}
.timeline-item {
position: relative;
padding-bottom: 2rem;
}
.timeline-item:last-child {
padding-bottom: 0;
}
.timeline-marker {
position: absolute;
left: -1.5rem;
width: 1rem;
height: 1rem;
border-radius: 50%;
background-color: #e2e8f0;
border: 2px solid white;
}
.timeline-marker.success {
background-color: #48bb78;
}
.timeline-marker.failure {
background-color: #f56565;
}
.timeline-marker.in_progress {
background-color: #4299e1;
}
.timeline-marker.pending {
background-color: #ecc94b;
}
.timeline-content {
background-color: #f7fafc;
border-radius: 0.5rem;
padding: 1rem;
border-left: 3px solid #e2e8f0;
}
.timeline-content.success {
border-left-color: #48bb78;
background-color: #f0fff4;
}
.timeline-content.failure {
border-left-color: #f56565;
background-color: #fff5f5;
}
.timeline-content.in_progress {
border-left-color: #4299e1;
background-color: #ebf8ff;
}
.timeline-content.pending {
border-left-color: #ecc94b;
background-color: #fffff0;
}
.timeline-title {
font-weight: 600;
color: #2d3748;
margin-bottom: 0.5rem;
}
.timeline-message {
color: #4a5568;
margin-bottom: 0.5rem;
}
.timeline-meta {
display: flex;
justify-content: space-between;
font-size: 0.875rem;
color: #718096;
}
.timeline-task-id {
font-family: monospace;
font-size: 0.75rem;
color: #a0aec0;
}
.logs-toggle {
cursor: pointer;
user-select: none;
display: inline-flex;
align-items: center;
gap: 0.5rem;
color: #3182ce;
font-weight: 600;
margin-bottom: 1rem;
}
.logs-toggle:hover {
color: #2c5aa0;
}
.logs-content {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease-out;
}
.logs-content.expanded {
max-height: 5000px;
transition: max-height 0.5s ease-in;
}
.no-logs {
text-align: center;
padding: 3rem;
color: #718096;
}
.no-logs i {
font-size: 3rem;
margin-bottom: 1rem;
opacity: 0.5;
}
.error-message {
background-color: #FEE2E2;
border: 1px solid #F87171;
color: #B91C1C;
padding: 1rem;
border-radius: 0.25rem;
margin-bottom: 1rem;
}
.file-status-indicator {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
border-radius: 0.25rem;
font-size: 0.875rem;
}
.file-status-indicator.exists {
background-color: #D1FAE5;
color: #065F46;
}
.file-status-indicator.missing {
background-color: #FEE2E2;
color: #991B1B;
}
/* Flow visualization with branches */
.flow-stage {
display: flex;
align-items: flex-start;
margin-bottom: 1.5rem;
}
.flow-indicator {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 1rem;
flex-shrink: 0;
}
.flow-indicator.success {
background-color: #48bb78;
color: white;
}
.flow-indicator.failure {
background-color: #f56565;
color: white;
}
.flow-indicator.in_progress {
background-color: #4299e1;
color: white;
}
.flow-indicator.pending, .flow-indicator.queued {
background-color: #ecc94b;
color: white;
}
.flow-indicator.not_run {
background-color: #e2e8f0;
color: #718096;
}
.flow-content {
flex: 1;
background-color: #f7fafc;
padding: 1rem;
border-radius: 0.5rem;
border-left: 3px solid #e2e8f0;
}
.flow-content.success {
border-left-color: #48bb78;
background-color: #f0fff4;
}
.flow-content.failure {
border-left-color: #f56565;
background-color: #fff5f5;
}
.flow-content.in_progress {
border-left-color: #4299e1;
background-color: #ebf8ff;
}
.flow-content.pending, .flow-content.queued {
border-left-color: #ecc94b;
background-color: #fffff0;
}
.flow-title {
font-weight: 600;
color: #2d3748;
margin-bottom: 0.25rem;
}
.flow-message {
color: #4a5568;
font-size: 0.875rem;
}
.flow-timestamp {
color: #718096;
font-size: 0.75rem;
margin-top: 0.25rem;
}
.flow-connector {
width: 2px;
height: 20px;
background-color: #e2e8f0;
margin-left: 19px;
margin-bottom: 0.5rem;
}
/* Branch visualization */
.flow-branches {
margin-left: 56px;
margin-top: 1rem;
padding-left: 1rem;
border-left: 2px dashed #cbd5e0;
}
.branch-item {
display: flex;
align-items: flex-start;
margin-bottom: 1rem;
position: relative;
}
.branch-item::before {
content: '';
position: absolute;
left: -1rem;
top: 20px;
width: 1rem;
height: 2px;
background-color: #cbd5e0;
}
.branch-indicator {
width: 30px;
height: 30px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 0.75rem;
flex-shrink: 0;
font-size: 0.875rem;
}
.branch-indicator.success {
background-color: #48bb78;
color: white;
}
.branch-indicator.failure {
background-color: #f56565;
color: white;
}
.branch-indicator.in_progress {
background-color: #4299e1;
color: white;
}
.branch-indicator.pending, .branch-indicator.queued {
background-color: #ecc94b;
color: white;
}
.branch-content {
flex: 1;
background-color: white;
padding: 0.75rem;
border-radius: 0.5rem;
border: 1px solid #e2e8f0;
}
.branch-content.failure {
border-color: #f56565;
background-color: #fffafa;
}
.branch-title {
font-weight: 600;
color: #2d3748;
font-size: 0.875rem;
margin-bottom: 0.25rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.branch-message {
color: #4a5568;
font-size: 0.75rem;
}
.retry-btn {
background-color: #f56565;
color: white;
border: none;
padding: 0.25rem 0.75rem;
border-radius: 0.25rem;
font-size: 0.75rem;
cursor: pointer;
font-weight: 600;
}
.retry-btn:hover {
background-color: #e53e3e;
}
.retry-btn:disabled {
background-color: #cbd5e0;
cursor: not-allowed;
}
</style>
{% if file %}
<script>
// JavaScript for handling retry functionality
async function reprocessFile() {
const fileId = {{ file.id | tojson }};
const button = document.getElementById('reprocess-btn');
const statusDiv = document.getElementById('reprocess-status');
// Disable button and show loading
button.disabled = true;
button.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Processing...';
statusDiv.innerHTML = '';
try {
const response = await fetch(`/api/files/${fileId}/reprocess`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
if (response.ok) {
statusDiv.innerHTML = `
<div style="background-color: #D1FAE5; color: #065F46; padding: 1rem; border-radius: 0.25rem; margin-top: 1rem;">
<i class="fas fa-check-circle"></i> File queued for reprocessing. Task ID: ${data.task_id}
<br><small>Refresh the page in a few moments to see updated status.</small>
</div>
`;
// Reload page after 3 seconds
setTimeout(() => window.location.reload(), 3000);
} else {
statusDiv.innerHTML = `
<div class="error-message" style="margin-top: 1rem;">
<i class="fas fa-exclamation-triangle"></i> Error: ${data.detail || 'Failed to reprocess file'}
</div>
`;
button.disabled = false;
button.innerHTML = '<i class="fas fa-redo"></i> Retry Processing';
}
} catch (error) {
statusDiv.innerHTML = `
<div class="error-message" style="margin-top: 1rem;">
<i class="fas fa-exclamation-triangle"></i> Network error: ${error.message}
</div>
`;
button.disabled = false;
button.innerHTML = '<i class="fas fa-redo"></i> Retry Processing';
}
}
// JavaScript for handling per-subtask retry
async function retrySubtask(subtaskName, buttonId) {
const fileId = {{ file.id | tojson }};
const button = document.getElementById(buttonId);
const statusDiv = document.getElementById('subtask-status-' + subtaskName);
// Disable button and show loading
button.disabled = true;
button.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Retrying...';
if (statusDiv) {
statusDiv.innerHTML = '';
}
try {
const response = await fetch(`/api/files/${fileId}/retry-subtask?subtask_name=${subtaskName}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
if (response.ok) {
if (statusDiv) {
statusDiv.innerHTML = `
<div style="background-color: #D1FAE5; color: #065F46; padding: 0.5rem; border-radius: 0.25rem; margin-top: 0.5rem; font-size: 0.75rem;">
<i class="fas fa-check-circle"></i> Queued for retry. Task ID: ${data.task_id}
</div>
`;
}
// Reload page after 2 seconds
setTimeout(() => window.location.reload(), 2000);
} else {
if (statusDiv) {
statusDiv.innerHTML = `
<div style="background-color: #FEE2E2; color: #991B1B; padding: 0.5rem; border-radius: 0.25rem; margin-top: 0.5rem; font-size: 0.75rem;">
<i class="fas fa-exclamation-triangle"></i> Error: ${data.detail || 'Failed to retry'}
</div>
`;
}
button.disabled = false;
button.innerHTML = '<i class="fas fa-redo"></i> Retry';
}
} catch (error) {
if (statusDiv) {
statusDiv.innerHTML = `
<div style="background-color: #FEE2E2; color: #991B1B; padding: 0.5rem; border-radius: 0.25rem; margin-top: 0.5rem; font-size: 0.75rem;">
<i class="fas fa-exclamation-triangle"></i> Network error: ${error.message}
</div>
`;
}
button.disabled = false;
button.innerHTML = '<i class="fas fa-redo"></i> Retry';
}
}
// Toggle logs visibility
function toggleLogs() {
const logsContent = document.getElementById('logs-content');
const toggleIcon = document.getElementById('logs-toggle-icon');
if (logsContent.classList.contains('expanded')) {
logsContent.classList.remove('expanded');
toggleIcon.classList.remove('fa-chevron-up');
toggleIcon.classList.add('fa-chevron-down');
} else {
logsContent.classList.add('expanded');
toggleIcon.classList.remove('fa-chevron-down');
toggleIcon.classList.add('fa-chevron-up');
}
}
</script>
{% endif %}
{% endblock %}
{% block content %}
<div class="detail-container">
<a href="/files" class="back-button">
<i class="fas fa-arrow-left"></i>
Back to File List
</a>
{% if error %}
<div class="error-message">
<p><strong>Error:</strong> {{ error }}</p>
</div>
{% else %}
<!-- File Information Card -->
<div class="detail-card">
<h3>File Information</h3>
<div class="detail-grid">
<div class="detail-item">
<span class="detail-label">File ID</span>
<span class="detail-value">{{ file.id }}</span>
</div>
<div class="detail-item">
<span class="detail-label">Original Filename</span>
<span class="detail-value">{{ file.original_filename }}</span>
</div>
<div class="detail-item">
<span class="detail-label">File Hash</span>
<span class="detail-value" style="font-family: monospace; font-size: 0.875rem;">{{ file.filehash }}</span>
</div>
<div class="detail-item">
<span class="detail-label">File Size</span>
<span class="detail-value">{{ (file.file_size / 1024) | round(2) }} KB ({{ file.file_size }} bytes)</span>
</div>
<div class="detail-item">
<span class="detail-label">MIME Type</span>
<span class="detail-value">{{ file.mime_type or 'N/A' }}</span>
</div>
<div class="detail-item">
<span class="detail-label">Created At</span>
<span class="detail-value">{{ file.created_at.strftime('%Y-%m-%d %H:%M:%S') if file.created_at else 'N/A' }}</span>
</div>
<div class="detail-item">
<span class="detail-label">Local Path</span>
<span class="detail-value" style="font-family: monospace; font-size: 0.875rem;">{{ file.local_filename }}</span>
</div>
<div class="detail-item">
<span class="detail-label">File on Disk</span>
<span class="detail-value">
{% if file_exists %}
<span class="file-status-indicator exists">
<i class="fas fa-check-circle"></i> File exists
</span>
{% else %}
<span class="file-status-indicator missing">
<i class="fas fa-times-circle"></i> File not found
</span>
{% endif %}
</span>
</div>
</div>
</div>
<!-- Step Summary Card -->
{% if step_summary %}
<div class="detail-card">
<h3>Processing Status Summary</h3>
<div class="step-summary">
<div class="summary-card main-steps">
<div class="summary-title">Main Processing Steps</div>
<div class="summary-counts">
{% if step_summary.main.success > 0 %}
<div class="summary-count">
<span class="count-badge success">{{ step_summary.main.success }}</span>
<span>Success</span>
</div>
{% endif %}
{% if step_summary.main.failure > 0 %}
<div class="summary-count">
<span class="count-badge failure">{{ step_summary.main.failure }}</span>
<span>Failed</span>
</div>
{% endif %}
{% if step_summary.main.in_progress > 0 %}
<div class="summary-count">
<span class="count-badge in-progress">{{ step_summary.main.in_progress }}</span>
<span>In Progress</span>
</div>
{% endif %}
{% if step_summary.main.queued > 0 %}
<div class="summary-count">
<span class="count-badge queued">{{ step_summary.main.queued }}</span>
<span>Queued</span>
</div>
{% endif %}
</div>
</div>
{% if step_summary.total_upload_tasks > 0 %}
<div class="summary-card upload-steps">
<div class="summary-title">Upload Destinations</div>
<div class="summary-counts">
{% if step_summary.uploads.success > 0 %}
<div class="summary-count">
<span class="count-badge success">{{ step_summary.uploads.success }}</span>
<span>Success</span>
</div>
{% endif %}
{% if step_summary.uploads.failure > 0 %}
<div class="summary-count">
<span class="count-badge failure">{{ step_summary.uploads.failure }}</span>
<span>Failed</span>
</div>
{% endif %}
{% if step_summary.uploads.in_progress > 0 %}
<div class="summary-count">
<span class="count-badge in-progress">{{ step_summary.uploads.in_progress }}</span>
<span>In Progress</span>
</div>
{% endif %}
{% if step_summary.uploads.queued > 0 %}
<div class="summary-count">
<span class="count-badge queued">{{ step_summary.uploads.queued }}</span>
<span>Queued</span>
</div>
{% endif %}
</div>
</div>
{% endif %}
</div>
</div>
{% endif %}
<!-- Processing History Card (Collapsible) -->
<div class="detail-card">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem;">
<h3 style="margin: 0;">Processing History</h3>
{% if file_exists %}
<button id="reprocess-btn" onclick="reprocessFile()" style="background-color: #3182ce; color: white; padding: 0.5rem 1rem; border: none; border-radius: 0.25rem; cursor: pointer; font-weight: 600;">
<i class="fas fa-redo"></i> Retry Processing
</button>
{% endif %}
</div>
<div id="reprocess-status"></div>
{% if logs %}
<div class="logs-toggle" onclick="toggleLogs()">
<i id="logs-toggle-icon" class="fas fa-chevron-down"></i>
<span>View Full Processing Logs ({{ logs|length }} entries)</span>
</div>
<div id="logs-content" class="logs-content">
<div class="timeline">
{% for log in logs %}
<div class="timeline-item">
<div class="timeline-marker {{ log.status.lower().replace(' ', '_') }}"></div>
<div class="timeline-content {{ log.status.lower().replace(' ', '_') }}">
<div class="timeline-title">
{{ log.step_name }} - <span style="text-transform: capitalize;">{{ log.status }}</span>
</div>
{% if log.message %}
<div class="timeline-message">{{ log.message }}</div>
{% endif %}
<div class="timeline-meta">
<span>{{ log.timestamp.strftime('%Y-%m-%d %H:%M:%S') if log.timestamp else 'N/A' }}</span>
{% if log.task_id %}
<span class="timeline-task-id">Task: {{ log.task_id[:16] }}...</span>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% else %}
<div class="no-logs">
<i class="fas fa-clipboard-list"></i>
<p>No processing logs found for this file.</p>
<p style="margin-top: 0.5rem; font-size: 0.875rem;">The file may not have been processed yet.</p>
</div>
{% endif %}
</div>
<!-- Process Flow Visualization Card -->
{% if flow_data %}
<div class="detail-card">
<h3>Process Flow Visualization</h3>
<div style="padding: 1rem 0;">
{% for stage in flow_data %}
<div class="flow-stage">
<!-- Status indicator -->
<div class="flow-indicator {{ stage.status.lower().replace(' ', '_') }}">
{% if stage.status == 'success' %}<i class="fas fa-check"></i>
{% elif stage.status == 'failure' %}<i class="fas fa-times"></i>
{% elif stage.status == 'in_progress' %}<i class="fas fa-spinner fa-spin"></i>
{% elif stage.status in ['pending', 'queued'] %}<i class="fas fa-clock"></i>
{% else %}<i class="fas fa-circle"></i>{% endif %}
</div>
<!-- Stage content -->
<div class="flow-content {{ stage.status.lower().replace(' ', '_') }}">
<div class="flow-title">{{ stage.label }}</div>
{% if stage.message %}
<div class="flow-message">{{ stage.message }}</div>
{% endif %}
{% if stage.status == 'not_run' %}
<div style="color: #718096; font-size: 0.875rem; font-style: italic;">Not executed</div>
{% endif %}
{% if stage.timestamp %}
<div class="flow-timestamp">
{{ stage.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}
</div>
{% endif %}
</div>
</div>
<!-- Upload branches (if this stage has them) -->
{% if stage.is_branch_parent and stage.branches %}
<div class="flow-branches">
{% for branch in stage.branches %}
<div class="branch-item">
<div class="branch-indicator {{ branch.status.lower().replace(' ', '_') }}">
{% if branch.status == 'success' %}<i class="fas fa-check"></i>
{% elif branch.status == 'failure' %}<i class="fas fa-times"></i>
{% elif branch.status == 'in_progress' %}<i class="fas fa-spinner fa-spin"></i>
{% else %}<i class="fas fa-clock"></i>{% endif %}
</div>
<div class="branch-content {% if branch.status == 'failure' %}failure{% endif %}">
<div class="branch-title">
<span>{{ branch.label }}</span>
{% if branch.can_retry and branch.status == 'failure' %}
<button
id="retry-btn-{{ branch.key }}"
class="retry-btn"
onclick="retrySubtask('{{ branch.key }}', 'retry-btn-{{ branch.key }}')">
<i class="fas fa-redo"></i> Retry
</button>
{% endif %}
</div>
{% if branch.message %}
<div class="branch-message">{{ branch.message }}</div>
{% endif %}
{% if branch.timestamp %}
<div style="color: #718096; font-size: 0.65rem; margin-top: 0.25rem;">
{{ branch.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}
</div>
{% endif %}
<div id="subtask-status-{{ branch.key }}"></div>
</div>
</div>
{% endfor %}
</div>
{% endif %}
<!-- Connector line (except for last item) -->
{% if not loop.last %}
<div class="flow-connector"></div>
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}
<!-- File Preview Card -->
{% if file_exists or processed_exists %}
<div class="detail-card">
<h3>File Previews</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 2rem;">
{% if file_exists %}
<div>
<h4 style="font-weight: 600; color: #2d3748; margin-bottom: 1rem;">Original File</h4>
<div style="border: 2px solid #e2e8f0; border-radius: 0.5rem; overflow: hidden; background-color: #f7fafc;">
{% if file.mime_type and file.mime_type.startswith('image/') %}
<!-- Image preview -->
<img src="/api/files/{{ file.id }}/preview?version=original" alt="{{ file.original_filename }}" style="width: 100%; height: auto; display: block;">
{% elif file.mime_type and file.mime_type.startswith('text/') %}
<!-- Text file preview -->
<iframe src="/api/files/{{ file.id }}/preview?version=original" style="width: 100%; height: 600px; border: none;"></iframe>
{% else %}
<!-- PDF and other documents -->
<iframe src="/api/files/{{ file.id }}/preview?version=original" style="width: 100%; height: 600px; border: none;"></iframe>
{% endif %}
</div>
<div style="margin-top: 0.5rem; text-align: center; display: flex; gap: 1rem; justify-content: center;">
<a href="/api/files/{{ file.id }}/preview?version=original" target="_blank" style="color: #3182ce; text-decoration: none; font-size: 0.875rem;">
<i class="fas fa-external-link-alt"></i> Open in new tab
</a>
<a href="/api/files/{{ file.id }}/download?version=original" style="color: #3182ce; text-decoration: none; font-size: 0.875rem;">
<i class="fas fa-download"></i> Download
</a>
</div>
</div>
{% endif %}
{% if processed_exists %}
<div>
<h4 style="font-weight: 600; color: #2d3748; margin-bottom: 1rem;">Processed File</h4>
<div style="border: 2px solid #e2e8f0; border-radius: 0.5rem; overflow: hidden; background-color: #f7fafc;">
<!-- Processed files are typically PDFs -->
<iframe src="/api/files/{{ file.id }}/preview?version=processed" style="width: 100%; height: 600px; border: none;"></iframe>
</div>
<div style="margin-top: 0.5rem; text-align: center; display: flex; gap: 1rem; justify-content: center;">
<a href="/api/files/{{ file.id }}/preview?version=processed" target="_blank" style="color: #3182ce; text-decoration: none; font-size: 0.875rem;">
<i class="fas fa-external-link-alt"></i> Open in new tab
</a>
<a href="/api/files/{{ file.id }}/download?version=processed" style="color: #3182ce; text-decoration: none; font-size: 0.875rem;">
<i class="fas fa-download"></i> Download
</a>
</div>
</div>
{% endif %}
</div>
</div>
{% endif %}
{% endif %}
</div>
{% endblock %}