Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +1 -28
templates/index.html
CHANGED
|
@@ -208,21 +208,8 @@
|
|
| 208 |
border: 1px solid var(--border-color);
|
| 209 |
border-radius: 0.35rem;
|
| 210 |
background-color: white;
|
| 211 |
-
/* Ensure PDF viewer has a min-height even if no PDF is loaded */
|
| 212 |
-
min-height: 200px;
|
| 213 |
-
display: flex; /* Use flexbox to center content */
|
| 214 |
-
justify-content: center;
|
| 215 |
-
align-items: center;
|
| 216 |
-
color: #6c757d; /* Muted text color */
|
| 217 |
}
|
| 218 |
|
| 219 |
-
#pdf-viewer embed,
|
| 220 |
-
#pdf-viewer object,
|
| 221 |
-
#pdf-viewer iframe {
|
| 222 |
-
display: block; /* Ensure these take up space */
|
| 223 |
-
}
|
| 224 |
-
|
| 225 |
-
|
| 226 |
.success-alert {
|
| 227 |
display: none;
|
| 228 |
margin-top: 1.5rem; /* Less margin */
|
|
@@ -258,7 +245,6 @@
|
|
| 258 |
color: #0f5132;
|
| 259 |
background-color: #d1e7dd;
|
| 260 |
border-color: #badbcc;
|
| 261 |
-
padding: 0.75rem 1.25rem; /* Bootstrap default alert padding */
|
| 262 |
}
|
| 263 |
|
| 264 |
.alert-success strong {
|
|
@@ -268,7 +254,6 @@
|
|
| 268 |
color: #721c24;
|
| 269 |
background-color: #f8d7da;
|
| 270 |
border-color: #f5c6cb;
|
| 271 |
-
padding: 0.75rem 1.25rem; /* Bootstrap default alert padding */
|
| 272 |
}
|
| 273 |
.alert-danger strong {
|
| 274 |
color: var(--danger-color);
|
|
@@ -382,16 +367,12 @@
|
|
| 382 |
|
| 383 |
<h5 class="mt-4">PDF Preview:</h5>
|
| 384 |
<div id="pdf-viewer" class="mt-2">
|
| 385 |
-
<p>PDF preview will appear here after generation.</p>
|
| 386 |
<!-- PDF will be embedded here -->
|
| 387 |
</div>
|
| 388 |
</div>
|
| 389 |
</div>
|
| 390 |
</div>
|
| 391 |
</div>
|
| 392 |
-
<div id="data-volatility-note" class="alert alert-info mt-4 text-center">
|
| 393 |
-
<i class="fas fa-exclamation-triangle me-2"></i> Note: Patient data is stored temporarily in memory for this demo and will be lost when the server restarts.
|
| 394 |
-
</div>
|
| 395 |
</div>
|
| 396 |
|
| 397 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
|
@@ -451,7 +432,6 @@
|
|
| 451 |
$('#whatsapp-alert').hide();
|
| 452 |
$('#api-error-alert').hide();
|
| 453 |
$('#pdf-viewer').empty(); // Clear previous PDF preview
|
| 454 |
-
$('#pdf-viewer').html('<p>Generating PDF preview...</p>'); // Add loading text
|
| 455 |
|
| 456 |
// Create FormData object for file upload
|
| 457 |
const formData = new FormData(this);
|
|
@@ -508,9 +488,8 @@
|
|
| 508 |
if (response.pdf_data) {
|
| 509 |
const pdfData = `data:application/pdf;base64,${response.pdf_data}`;
|
| 510 |
// Use <object> or <iframe> for better compatibility than <embed>
|
| 511 |
-
// <embed> is often simpler but less supported on some mobile/browsers
|
| 512 |
$('#pdf-viewer').html(`<object data="${pdfData}" type="application/pdf" width="100%" height="500px">
|
| 513 |
-
<p>Your browser does not support
|
| 514 |
</object>`);
|
| 515 |
console.log("PDF preview embedded.");
|
| 516 |
} else {
|
|
@@ -531,7 +510,6 @@
|
|
| 531 |
console.error("Submission failed:", response.error);
|
| 532 |
$('#api-error-message').text(response.error || 'An unknown error occurred.');
|
| 533 |
$('#api-error-alert').fadeIn();
|
| 534 |
-
$('#pdf-viewer').html('<p class="text-muted">Could not generate PDF preview due to an error.</p>'); // Update preview area on error
|
| 535 |
}
|
| 536 |
},
|
| 537 |
error: function(xhr, status, error) {
|
|
@@ -555,14 +533,9 @@
|
|
| 555 |
console.error("AJAX error:", status, error, xhr.responseText);
|
| 556 |
$('#api-error-message').text(errorMessage);
|
| 557 |
$('#api-error-alert').fadeIn();
|
| 558 |
-
$('#pdf-viewer').html('<p class="text-muted">Could not generate PDF preview due to a connection error.</p>'); // Update preview area on error
|
| 559 |
}
|
| 560 |
});
|
| 561 |
});
|
| 562 |
-
|
| 563 |
-
// Show the data volatility note on load
|
| 564 |
-
$('#data-volatility-note').show();
|
| 565 |
-
|
| 566 |
});
|
| 567 |
</script>
|
| 568 |
</body>
|
|
|
|
| 208 |
border: 1px solid var(--border-color);
|
| 209 |
border-radius: 0.35rem;
|
| 210 |
background-color: white;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
}
|
| 212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
.success-alert {
|
| 214 |
display: none;
|
| 215 |
margin-top: 1.5rem; /* Less margin */
|
|
|
|
| 245 |
color: #0f5132;
|
| 246 |
background-color: #d1e7dd;
|
| 247 |
border-color: #badbcc;
|
|
|
|
| 248 |
}
|
| 249 |
|
| 250 |
.alert-success strong {
|
|
|
|
| 254 |
color: #721c24;
|
| 255 |
background-color: #f8d7da;
|
| 256 |
border-color: #f5c6cb;
|
|
|
|
| 257 |
}
|
| 258 |
.alert-danger strong {
|
| 259 |
color: var(--danger-color);
|
|
|
|
| 367 |
|
| 368 |
<h5 class="mt-4">PDF Preview:</h5>
|
| 369 |
<div id="pdf-viewer" class="mt-2">
|
|
|
|
| 370 |
<!-- PDF will be embedded here -->
|
| 371 |
</div>
|
| 372 |
</div>
|
| 373 |
</div>
|
| 374 |
</div>
|
| 375 |
</div>
|
|
|
|
|
|
|
|
|
|
| 376 |
</div>
|
| 377 |
|
| 378 |
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
|
|
|
| 432 |
$('#whatsapp-alert').hide();
|
| 433 |
$('#api-error-alert').hide();
|
| 434 |
$('#pdf-viewer').empty(); // Clear previous PDF preview
|
|
|
|
| 435 |
|
| 436 |
// Create FormData object for file upload
|
| 437 |
const formData = new FormData(this);
|
|
|
|
| 488 |
if (response.pdf_data) {
|
| 489 |
const pdfData = `data:application/pdf;base64,${response.pdf_data}`;
|
| 490 |
// Use <object> or <iframe> for better compatibility than <embed>
|
|
|
|
| 491 |
$('#pdf-viewer').html(`<object data="${pdfData}" type="application/pdf" width="100%" height="500px">
|
| 492 |
+
<p>Your browser does not support PDFs. You can download the PDF instead.</p>
|
| 493 |
</object>`);
|
| 494 |
console.log("PDF preview embedded.");
|
| 495 |
} else {
|
|
|
|
| 510 |
console.error("Submission failed:", response.error);
|
| 511 |
$('#api-error-message').text(response.error || 'An unknown error occurred.');
|
| 512 |
$('#api-error-alert').fadeIn();
|
|
|
|
| 513 |
}
|
| 514 |
},
|
| 515 |
error: function(xhr, status, error) {
|
|
|
|
| 533 |
console.error("AJAX error:", status, error, xhr.responseText);
|
| 534 |
$('#api-error-message').text(errorMessage);
|
| 535 |
$('#api-error-alert').fadeIn();
|
|
|
|
| 536 |
}
|
| 537 |
});
|
| 538 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 539 |
});
|
| 540 |
</script>
|
| 541 |
</body>
|