Files
eoy-pdf-sortandmerge/templates/job.html
T
nmemmert f4611c5aa4 Fix client-side issues: logo loading and JS errors
- Replace base64 logo with static file reference to avoid ERR_INVALID_URL
- Add missing status element to index.html to fix TypeError in XMLHttpRequest
- Reduce MAX_CONTENT_LENGTH from 1000TB to 100GB for practicality
- Update all templates to use logo_url instead of logo_b64
- Update Waitress max_request_body_size to match Flask limit
2025-11-06 08:15:49 -05:00

227 lines
6.9 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Job Status - End of Year Statements</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}
.header {
text-align: center;
margin-bottom: 30px;
}
.logo {
max-width: 200px;
height: auto;
}
.job-section {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
margin-bottom: 20px;
}
.status-section {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
margin-bottom: 20px;
}
progress {
width: 100%;
height: 20px;
}
.status-processing {
color: #007bff;
}
.status-completed {
color: #28a745;
}
.status-failed {
color: #dc3545;
}
.nav-links {
text-align: center;
margin-bottom: 20px;
}
.nav-links a {
color: #007bff;
text-decoration: none;
margin: 0 15px;
font-weight: bold;
}
.nav-links a:hover {
text-decoration: underline;
}
button {
background-color: #007bff;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:disabled {
background-color: #ccc;
cursor: not-allowed;
}
.download-btn {
background-color: #28a745;
}
.back-btn {
background-color: #6c757d;
}
.error {
color: red;
margin-top: 10px;
}
.job-info {
margin-bottom: 20px;
}
.job-info div {
margin-bottom: 5px;
}
.auth-section {
margin-top: 20px;
text-align: center;
}
.user-info {
display: inline-block;
background: white;
padding: 10px 20px;
border-radius: 6px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.user-info span {
margin-right: 15px;
font-weight: bold;
}
.logout-btn, .login-btn {
background-color: #dc3545;
color: white;
padding: 6px 12px;
border: none;
border-radius: 4px;
text-decoration: none;
font-size: 14px;
display: inline-block;
}
.login-btn {
background-color: #28a745;
}
.logout-btn:hover, .login-btn:hover {
opacity: 0.8;
}
</style>
</head>
<body>
<div class="header">
<img src="{{ logo_url }}" alt="Logo" class="logo">
<h1>Job Status</h1>
<!-- Authentication section -->
<div class="auth-section">
{% if session.oauth_token %}
<div class="user-info">
<span>Welcome, {{ user_info.displayName or user_info.givenName or 'User' }}!</span>
<a href="{{ url_for('logout') }}" class="logout-btn">Logout</a>
</div>
{% else %}
<div class="login-prompt">
<a href="{{ url_for('login') }}" class="login-btn">Login with Microsoft</a>
</div>
{% endif %}
</div>
</div>
<div class="nav-links">
<a href="{{ url_for('index') }}">Upload New Files</a> |
<a href="{{ url_for('results') }}">View All Jobs & Downloads</a>
</div>
<div class="job-section">
<h2>Job Information</h2>
<div class="job-info">
<div><strong>Job Name:</strong> {{ job['id'] }}</div>
<div><strong>Started:</strong> {{ job['timestamp'].strftime('%Y-%m-%d %H:%M:%S') if job['timestamp'] else 'Unknown' }}</div>
<div><strong>Files:</strong> {{ job['file_count'] if job['file_count'] else 'Processing...' }}</div>
<div><strong>Status:</strong>
<span class="status-{{ job['status'] }}">
{{ job['status'].title() }}
</span>
</div>
</div>
{% if job['status'] == 'processing' %}
<div class="status-section">
<h3>Processing Progress</h3>
<p id="statusMessage">{{ job['message'] }}</p>
<progress id="progressBar" value="{{ job['progress'] }}" max="100"></progress>
<div style="margin-top: 10px;">
<strong>{{ job.progress }}% Complete</strong>
</div>
</div>
{% endif %}
{% if job['status'] == 'completed' %}
<div class="status-section">
<h3>Processing Complete!</h3>
<p>{{ job.message }}</p>
<progress value="100" max="100"></progress>
<div style="margin-top: 20px;">
<a href="{{ url_for('download_job', job_id=job['id']) }}" class="download-btn" style="color: white; text-decoration: none; padding: 10px 20px; border-radius: 4px; display: inline-block;">Download Results</a>
</div>
</div>
{% endif %}
{% if job['status'] == 'failed' %}
<div class="status-section">
<h3>Processing Failed</h3>
<p>{{ job.message }}</p>
{% if job.error %}
<div class="error">
<strong>Error:</strong> {{ job.error }}
</div>
{% endif %}
<progress value="0" max="100"></progress>
</div>
{% endif %}
</div>
<div class="nav-links">
<a href="{{ url_for('index') }}" class="back-btn">Back to Upload</a>
<a href="{{ url_for('results') }}">View All Jobs</a>
</div>
{% if job['status'] == 'processing' %}
<script>
// Auto-refresh for processing jobs
function updateStatus() {
fetch("/api/job/{{ job['id'] }}/status")
.then(response => response.json())
.then(data => {
document.getElementById('statusMessage').textContent = data.message;
document.getElementById('progressBar').value = data.progress;
if (data.status === 'completed' || data.status === 'failed') {
// Reload the page to show completion/failure state
location.reload();
}
})
.catch(err => {
console.log('Status update error:', err);
});
}
// Update status every 2 seconds
setInterval(updateStatus, 2000);
</script>
{% endif %}
</body>
</html>