Add files via upload

This commit is contained in:
jasonMPM
2026-03-03 16:23:30 -06:00
committed by GitHub
parent c1b3e01b74
commit e53b0c4bb2
9 changed files with 178 additions and 235 deletions

View File

@@ -15,7 +15,7 @@
.layout { display: flex; gap: 20px; flex-wrap: wrap; }
.panel { flex: 1; min-width: 300px; }
.panel h2 { font-size: 14px; color: #C9A84C; margin-bottom: 10px; }
textarea { width: 100%; height: 360px; background: #222; color: #eee; border: 1px solid #444; border-radius: 6px; padding: 12px; font-family: monospace; font-size: 12px; resize: vertical; }
textarea { width: 100%; height: 380px; background: #222; color: #eee; border: 1px solid #444; border-radius: 6px; padding: 12px; font-family: monospace; font-size: 12px; resize: vertical; }
.preview-box { background: #fff; border-radius: 6px; padding: 20px; min-height: 120px; border: 1px solid #444; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
button { background: #C9A84C; color: #111; border: none; padding: 10px 20px; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 14px; }
@@ -27,6 +27,9 @@
#status-msg.err { background: #4a1a1a; color: #f44336; display: block; }
.test-fields { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.test-fields input { background: #2a2a2a; border: 1px solid #444; color: #eee; padding: 6px 10px; border-radius: 4px; font-size: 12px; width: calc(50% - 4px); }
.logo-row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.logo-row input { flex: 1; background: #2a2a2a; border: 1px solid #444; color: #eee; padding: 6px 10px; border-radius: 4px; font-size: 12px; }
.logo-row label { font-size: 12px; color: #aaa; white-space: nowrap; }
</style>
</head>
<body>
@@ -50,11 +53,15 @@
<div class="panel">
<h2>Live Preview</h2>
<div class="test-fields">
<input id="p-name" placeholder="Full Name" value="Jason Stedwell" oninput="updatePreview()"/>
<input id="p-title" placeholder="Job Title" value="Director of Technical Services" oninput="updatePreview()"/>
<input id="p-email" placeholder="Email" value="jstedwell@messagepointmedia.com" oninput="updatePreview()"/>
<input id="p-phone" placeholder="Office Phone" value="334-707-2550" oninput="updatePreview()"/>
<input id="p-cell" placeholder="Cell (optional)" value="" oninput="updatePreview()"/>
<input id="p-name" placeholder="Full Name" value="Jason Stedwell" oninput="updatePreview()"/>
<input id="p-title" placeholder="Job Title" value="Director of Technical Services" oninput="updatePreview()"/>
<input id="p-email" placeholder="Email" value="jason@messagepoint.tv" oninput="updatePreview()"/>
<input id="p-phone" placeholder="Office Phone" value="205-719-5000" oninput="updatePreview()"/>
<input id="p-cell" placeholder="Cell (optional)" value="334-707-2550" oninput="updatePreview()"/>
</div>
<div class="logo-row">
<label>Logo URL:</label>
<input id="p-logo" value="https://alwisp.com/uploads/logo.png" oninput="updatePreview()"/>
</div>
<div class="preview-box" id="preview-frame">Loading preview...</div>
<div class="actions">
@@ -79,19 +86,20 @@
async function updatePreview() {
const templateHtml = document.getElementById('template-editor').value;
const userData = {
fullName: document.getElementById('p-name').value,
title: document.getElementById('p-title').value,
email: document.getElementById('p-email').value,
phone: document.getElementById('p-phone').value,
cellPhone: document.getElementById('p-cell').value
fullName: document.getElementById('p-name').value,
title: document.getElementById('p-title').value,
email: document.getElementById('p-email').value,
phone: document.getElementById('p-phone').value,
cellPhone: document.getElementById('p-cell').value,
logoUrl: document.getElementById('p-logo').value
};
const res = await fetch('/api/admin/preview',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({templateHtml,userData})}).then(r=>r.json()).catch(()=>({error:'Preview failed'}));
document.getElementById('preview-frame').innerHTML = res.html || `<span style="color:red">${res.error}</span>`;
}
function showStatus(msg, ok) {
const el = document.getElementById('status-msg');
el.textContent = msg; el.className = ok ? 'ok' : 'err';
setTimeout(()=>{ el.className=''; el.textContent=''; }, 5000);
el.textContent = msg; el.className = ok ? 'ok' : 'err'; el.style.display = 'block';
setTimeout(()=>{ el.style.display='none'; }, 5000);
}
loadTemplate();
</script>