okay bidirectional saving done

This commit is contained in:
2025-07-06 22:50:07 -06:00
parent 236636a5dc
commit 5aae6b32bd
3 changed files with 227 additions and 103 deletions

View File

@@ -489,14 +489,19 @@ function generateWalkSheetPreview() {
<div class="ws-form-row">
<div class="ws-form-group">
<label class="ws-form-label">Support Level (1-4)</label>
<div class="ws-form-field"></div>
<label class="ws-form-label">Support Level</label>
<div class="ws-form-field circles">
<span class="ws-circle-option"><span class="ws-circle">1</span></span>
<span class="ws-circle-option"><span class="ws-circle">2</span></span>
<span class="ws-circle-option"><span class="ws-circle">3</span></span>
<span class="ws-circle-option"><span class="ws-circle">4</span></span>
</div>
</div>
<div class="ws-form-group">
<label class="ws-form-label">Sign Request</label>
<div class="ws-form-field" style="display: flex; gap: 20px;">
<span> Yes</span>
<span> No</span>
<div class="ws-form-field circles">
<span class="ws-circle-option"><span class="ws-circle">Y</span> Yes</span>
<span class="ws-circle-option"><span class="ws-circle">N</span> No</span>
</div>
</div>
</div>
@@ -504,7 +509,11 @@ function generateWalkSheetPreview() {
<div class="ws-form-row">
<div class="ws-form-group">
<label class="ws-form-label">Sign Size</label>
<div class="ws-form-field"></div>
<div class="ws-form-field circles">
<span class="ws-circle-option"><span class="ws-circle">S</span></span>
<span class="ws-circle-option"><span class="ws-circle">M</span></span>
<span class="ws-circle-option"><span class="ws-circle">L</span></span>
</div>
</div>
<div class="ws-form-group">
<label class="ws-form-label">Visited Date</label>
@@ -542,7 +551,7 @@ function generateWalkSheetPreview() {
}
}
// Generate QR codes for preview
// Update the generatePreviewQRCodes function to use smaller size
async function generatePreviewQRCodes() {
for (let i = 1; i <= 3; i++) {
const urlInput = document.getElementById(`qr-code-${i}-url`);
@@ -551,12 +560,12 @@ async function generatePreviewQRCodes() {
if (url && qrContainer) {
try {
// Use our local QR code generation endpoint
const qrImageUrl = `/api/qr?text=${encodeURIComponent(url)}&size=100`;
qrContainer.innerHTML = `<img src="${qrImageUrl}" alt="QR Code ${i}" style="width: 100px; height: 100px;">`;
// Use our local QR code generation endpoint with size matching display
const qrImageUrl = `/api/qr?text=${encodeURIComponent(url)}&size=200`; // Generate at higher res
qrContainer.innerHTML = `<img src="${qrImageUrl}" alt="QR Code ${i}" style="width: 120px; height: 120px;">`; // Display smaller
} catch (error) {
console.error(`Failed to display QR code ${i}:`, error);
qrContainer.innerHTML = '<div style="width: 100px; height: 100px; border: 1px dashed #ccc; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #999;">QR Error</div>';
qrContainer.innerHTML = '<div style="width: 120px; height: 120px; border: 2px dashed #ccc; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #999;">QR Error</div>';
}
} else if (qrContainer) {
// Clear empty QR containers
@@ -565,6 +574,7 @@ async function generatePreviewQRCodes() {
}
}
// Print walk sheet
function printWalkSheet() {
// First generate fresh preview to ensure QR codes are generated