896 lines
35 KiB
HTML
896 lines
35 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>EIB Processor — Undo Designs</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--navy: #0C1A3A;
|
|
--navy-2: #12244C;
|
|
--navy-3: #1a2f5e;
|
|
--navy-4: #0a1428;
|
|
--cyan: #00D4FF;
|
|
--cyan-dim: rgba(0,212,255,.12);
|
|
--cyan-glow: rgba(0,212,255,.06);
|
|
--blue: #1B8EF8;
|
|
--blue-dim: rgba(27,142,248,.12);
|
|
--green: #10D98A;
|
|
--green-dim: rgba(16,217,138,.12);
|
|
--red: #F04438;
|
|
--red-dim: rgba(240,68,56,.12);
|
|
--amber: #F79009;
|
|
--w1: rgba(255,255,255,.95);
|
|
--w2: rgba(255,255,255,.65);
|
|
--w3: rgba(255,255,255,.35);
|
|
--w4: rgba(255,255,255,.10);
|
|
--w5: rgba(255,255,255,.05);
|
|
--border: rgba(255,255,255,.07);
|
|
--border-c: rgba(0,212,255,.18);
|
|
--mono: 'JetBrains Mono', monospace;
|
|
--disp: 'Space Grotesk', sans-serif;
|
|
--body: 'Inter', sans-serif;
|
|
--radius: 10px;
|
|
}
|
|
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
body {
|
|
font-family: var(--body);
|
|
background: var(--navy-4);
|
|
color: var(--w1);
|
|
min-height: 100vh;
|
|
-webkit-font-smoothing: antialiased;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
body::before {
|
|
content: '';
|
|
position: fixed; inset: 0; pointer-events: none; z-index: 0;
|
|
background-image: radial-gradient(circle, rgba(0,212,255,.07) 1px, transparent 1px);
|
|
background-size: 28px 28px;
|
|
}
|
|
|
|
header {
|
|
position: sticky; top: 0; z-index: 100;
|
|
background: rgba(12,26,58,.85);
|
|
backdrop-filter: blur(12px);
|
|
border-bottom: 1px solid var(--border);
|
|
padding: 0 32px;
|
|
height: 60px;
|
|
display: flex; align-items: center; justify-content: space-between;
|
|
}
|
|
|
|
.logo {
|
|
display: flex; align-items: center; gap: 10px;
|
|
font-family: var(--disp); font-size: 15px; font-weight: 600;
|
|
color: var(--w1); text-decoration: none;
|
|
}
|
|
.logo-icon {
|
|
width: 30px; height: 30px;
|
|
background: linear-gradient(135deg, var(--navy-3), var(--navy-2));
|
|
border: 1px solid var(--border-c);
|
|
border-radius: 7px;
|
|
display: flex; align-items: center; justify-content: center;
|
|
}
|
|
.logo-icon svg { width: 16px; height: 16px; }
|
|
.logo span { color: var(--cyan); }
|
|
|
|
.header-right { display: flex; align-items: center; gap: 14px; }
|
|
|
|
.docling-badge {
|
|
display: flex; align-items: center; gap: 6px;
|
|
font-family: var(--mono); font-size: 10px; color: var(--w3);
|
|
background: var(--w5); border: 1px solid var(--border);
|
|
padding: 4px 10px; border-radius: 20px;
|
|
}
|
|
.docling-dot {
|
|
width: 6px; height: 6px; border-radius: 50%;
|
|
background: var(--w3); transition: background .3s;
|
|
}
|
|
.docling-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }
|
|
|
|
main {
|
|
position: relative; z-index: 1;
|
|
flex: 1;
|
|
max-width: 860px;
|
|
width: 100%;
|
|
margin: 0 auto;
|
|
padding: 48px 24px 80px;
|
|
}
|
|
|
|
.page-title { margin-bottom: 40px; }
|
|
.eyebrow {
|
|
font-family: var(--mono); font-size: 10px;
|
|
letter-spacing: .16em; text-transform: uppercase;
|
|
color: var(--cyan); margin-bottom: 10px;
|
|
}
|
|
.page-title h1 {
|
|
font-family: var(--disp); font-size: 28px; font-weight: 700;
|
|
color: var(--w1); line-height: 1.2; margin-bottom: 8px;
|
|
}
|
|
.page-title p { font-size: 14px; color: var(--w2); line-height: 1.6; max-width: 520px; }
|
|
|
|
.step-card {
|
|
background: var(--navy-2);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
padding: 24px;
|
|
margin-bottom: 16px;
|
|
transition: border-color .2s;
|
|
}
|
|
.step-card.active { border-color: var(--border-c); }
|
|
.step-card.complete { border-color: rgba(16,217,138,.2); }
|
|
.step-card.disabled { opacity: .45; pointer-events: none; }
|
|
|
|
.step-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
|
|
.step-num {
|
|
width: 26px; height: 26px; border-radius: 50%;
|
|
background: var(--w5); border: 1px solid var(--border);
|
|
font-family: var(--mono); font-size: 11px; font-weight: 500;
|
|
color: var(--w3);
|
|
display: flex; align-items: center; justify-content: center;
|
|
flex-shrink: 0; transition: all .2s;
|
|
}
|
|
.step-card.active .step-num { background: var(--cyan-dim); border-color: var(--border-c); color: var(--cyan); }
|
|
.step-card.complete .step-num { background: var(--green-dim); border-color: rgba(16,217,138,.3); color: var(--green); }
|
|
.step-title { font-family: var(--disp); font-size: 14px; font-weight: 600; color: var(--w1); }
|
|
.step-desc { font-size: 12px; color: var(--w3); margin-top: 1px; }
|
|
|
|
.file-zone {
|
|
border: 1.5px dashed var(--border);
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all .2s;
|
|
position: relative;
|
|
}
|
|
.file-zone:hover, .file-zone.drag-over { border-color: var(--cyan); background: var(--cyan-glow); }
|
|
.file-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
|
|
.file-zone-icon {
|
|
width: 36px; height: 36px; margin: 0 auto 10px;
|
|
background: var(--w5); border-radius: 8px;
|
|
display: flex; align-items: center; justify-content: center;
|
|
}
|
|
.file-zone-icon svg { width: 18px; height: 18px; color: var(--w3); }
|
|
.file-zone-label { font-size: 13px; color: var(--w2); }
|
|
.file-zone-label strong { color: var(--cyan); }
|
|
.file-zone-sub { font-size: 11px; color: var(--w3); margin-top: 4px; }
|
|
.file-chosen { font-family: var(--mono); font-size: 11px; color: var(--green); margin-top: 8px; }
|
|
|
|
.audit-toggle { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; cursor: pointer; }
|
|
.toggle-switch {
|
|
width: 36px; height: 20px; border-radius: 10px;
|
|
background: var(--w4); border: 1px solid var(--border);
|
|
position: relative; transition: background .2s;
|
|
flex-shrink: 0;
|
|
}
|
|
.toggle-switch.on { background: var(--cyan-dim); border-color: var(--border-c); }
|
|
.toggle-knob {
|
|
width: 14px; height: 14px; border-radius: 50%;
|
|
background: var(--w3); position: absolute; top: 2px; left: 2px;
|
|
transition: all .2s;
|
|
}
|
|
.toggle-switch.on .toggle-knob { left: 18px; background: var(--cyan); }
|
|
.toggle-label { font-size: 13px; color: var(--w2); }
|
|
|
|
.audit-options { display: none; }
|
|
.audit-options.visible { display: block; }
|
|
|
|
.radio-group { display: flex; gap: 10px; margin-bottom: 14px; }
|
|
.radio-opt {
|
|
flex: 1;
|
|
border: 1px solid var(--border); border-radius: 8px; padding: 12px;
|
|
cursor: pointer; transition: all .2s; text-align: center;
|
|
}
|
|
.radio-opt.selected { border-color: var(--border-c); background: var(--cyan-dim); }
|
|
.radio-opt input { display: none; }
|
|
.radio-opt-label { font-size: 12px; font-weight: 500; color: var(--w2); }
|
|
.radio-opt.selected .radio-opt-label { color: var(--cyan); }
|
|
.radio-opt-desc { font-size: 11px; color: var(--w3); margin-top: 3px; }
|
|
|
|
.pdf-file-list { list-style: none; margin-top: 10px; }
|
|
.pdf-file-list li {
|
|
display: flex; align-items: center; justify-content: space-between;
|
|
padding: 8px 12px; border: 1px solid var(--border);
|
|
border-radius: 6px; margin-bottom: 6px;
|
|
font-family: var(--mono); font-size: 11px; color: var(--w2);
|
|
background: var(--w5);
|
|
}
|
|
.pdf-file-list li span { color: var(--cyan); margin-right: 8px; }
|
|
.pdf-remove { background: none; border: none; cursor: pointer; color: var(--w3); font-size: 14px; padding: 0 4px; transition: color .15s; }
|
|
.pdf-remove:hover { color: var(--red); }
|
|
|
|
.btn {
|
|
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
|
|
padding: 11px 22px; border-radius: 8px; border: none;
|
|
font-family: var(--disp); font-size: 13px; font-weight: 600;
|
|
cursor: pointer; transition: all .2s; text-decoration: none;
|
|
}
|
|
.btn-primary { background: linear-gradient(135deg, var(--cyan), var(--blue)); color: var(--navy); }
|
|
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
|
|
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; filter: none; }
|
|
.btn-ghost { background: var(--w5); border: 1px solid var(--border); color: var(--w2); }
|
|
.btn-ghost:hover { border-color: var(--border-c); color: var(--w1); background: var(--cyan-dim); }
|
|
.btn-full { width: 100%; }
|
|
|
|
/* ── PROGRESS ── */
|
|
.progress-wrap { display: none; margin-top: 16px; }
|
|
.progress-wrap.visible { display: block; }
|
|
.progress-bar-track { height: 3px; background: var(--w5); border-radius: 2px; overflow: hidden; }
|
|
.progress-bar-fill {
|
|
height: 100%;
|
|
background: linear-gradient(90deg, var(--cyan), var(--blue));
|
|
border-radius: 2px;
|
|
width: 0%; transition: width .4s ease;
|
|
animation: shimmer 1.5s infinite;
|
|
}
|
|
@keyframes shimmer { 0% { filter: brightness(1); } 50% { filter: brightness(1.3); } 100% { filter: brightness(1); } }
|
|
.progress-label-row {
|
|
display: flex; align-items: center; justify-content: space-between;
|
|
margin-top: 8px;
|
|
}
|
|
.progress-label { font-family: var(--mono); font-size: 10px; color: var(--w3); }
|
|
|
|
.details-toggle {
|
|
display: flex; align-items: center; gap: 5px;
|
|
font-family: var(--mono); font-size: 10px; color: var(--cyan);
|
|
cursor: pointer; user-select: none; background: none; border: none;
|
|
padding: 2px 4px;
|
|
}
|
|
.details-toggle svg { width: 10px; height: 10px; transition: transform .2s; }
|
|
.details-toggle.open svg { transform: rotate(90deg); }
|
|
|
|
.progress-details {
|
|
display: none;
|
|
margin-top: 10px;
|
|
max-height: 200px;
|
|
overflow-y: auto;
|
|
background: var(--navy-4);
|
|
border: 1px solid var(--border);
|
|
border-radius: 6px;
|
|
padding: 10px 12px;
|
|
}
|
|
.progress-details.visible { display: block; }
|
|
.progress-details::-webkit-scrollbar { width: 6px; }
|
|
.progress-details::-webkit-scrollbar-thumb { background: var(--w4); border-radius: 3px; }
|
|
.progress-detail-line {
|
|
font-family: var(--mono); font-size: 10.5px; color: var(--w2);
|
|
padding: 3px 0; border-bottom: 1px solid var(--w5);
|
|
line-height: 1.5;
|
|
}
|
|
.progress-detail-line:last-child { border-bottom: none; }
|
|
.progress-detail-line.ok { color: var(--green); }
|
|
.progress-detail-line.fail { color: var(--red); }
|
|
|
|
/* ── RESULT PANEL ── */
|
|
.result-panel { display: none; }
|
|
.result-panel.visible { display: block; }
|
|
|
|
.result-card { background: var(--navy-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
|
|
.result-card.success { border-color: rgba(16,217,138,.25); }
|
|
.result-card.error { border-color: rgba(240,68,56,.25); }
|
|
|
|
.result-header { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
|
|
.result-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
|
|
.result-icon.ok { background: var(--green-dim); }
|
|
.result-icon.err { background: var(--red-dim); }
|
|
.result-icon svg { width: 16px; height: 16px; }
|
|
.result-title { font-family: var(--disp); font-size: 15px; font-weight: 600; color: var(--w1); }
|
|
.result-sub { font-size: 12px; color: var(--w3); margin-top: 2px; }
|
|
|
|
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
|
|
.stat-box { background: var(--w5); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
|
|
.stat-value { font-family: var(--mono); font-size: 18px; font-weight: 500; color: var(--cyan); line-height: 1; }
|
|
.stat-label { font-size: 10px; color: var(--w3); margin-top: 4px; text-transform: uppercase; letter-spacing: .08em; }
|
|
|
|
.audit-table-wrap { margin-bottom: 20px; }
|
|
.section-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--w3); margin-bottom: 10px; }
|
|
table.audit-table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
|
.audit-table th {
|
|
text-align: left; padding: 8px 12px;
|
|
font-family: var(--mono); font-size: 9px; letter-spacing: .1em;
|
|
text-transform: uppercase; color: var(--w3);
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
.audit-table td { padding: 10px 12px; border-bottom: 1px solid var(--w5); color: var(--w2); }
|
|
.audit-table tr:last-child td { border-bottom: none; }
|
|
.audit-table tr:nth-child(even) td { background: var(--w5); }
|
|
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-family: var(--mono); font-size: 10px; font-weight: 500; }
|
|
.status-matched { background: var(--green-dim); color: var(--green); border: 1px solid rgba(16,217,138,.2); }
|
|
.status-review { background: var(--red-dim); color: var(--red); border: 1px solid rgba(240,68,56,.2); }
|
|
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
|
|
|
|
.unmapped-panel {
|
|
background: rgba(247,144,9,.06); border: 1px solid rgba(247,144,9,.2);
|
|
border-radius: var(--radius); padding: 20px; display: none;
|
|
}
|
|
.unmapped-panel.visible { display: block; }
|
|
.unmapped-title { font-family: var(--disp); font-size: 13px; font-weight: 600; color: var(--amber); margin-bottom: 10px; }
|
|
.unmapped-list { list-style: none; margin-bottom: 16px; }
|
|
.unmapped-list li {
|
|
display: flex; align-items: center; gap: 10px;
|
|
padding: 8px 0; border-bottom: 1px solid var(--w5);
|
|
}
|
|
.unmapped-list li:last-child { border-bottom: none; }
|
|
.unmapped-raw {
|
|
flex: 0 0 42%; min-width: 0;
|
|
font-family: var(--mono); font-size: 10.5px; color: var(--w2);
|
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
}
|
|
.unmapped-input {
|
|
flex: 1; min-width: 0;
|
|
background: var(--navy-4); border: 1px solid var(--border); border-radius: 6px;
|
|
padding: 7px 10px; font-family: var(--mono); font-size: 11px; color: var(--w1);
|
|
outline: none; transition: border-color .2s;
|
|
}
|
|
.unmapped-input:focus { border-color: var(--cyan); }
|
|
|
|
footer { position: relative; z-index: 1; text-align: center; padding: 20px; font-size: 11px; color: var(--w3); border-top: 1px solid var(--border); }
|
|
footer a { color: var(--cyan); text-decoration: none; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<header>
|
|
<a class="logo" href="/">
|
|
<div class="logo-icon">
|
|
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
<path d="M2 4h12M2 8h8M2 12h5" stroke="#00D4FF" stroke-width="1.5" stroke-linecap="round"/>
|
|
</svg>
|
|
</div>
|
|
EIB <span>Processor</span>
|
|
</a>
|
|
<div class="header-right">
|
|
<div class="docling-badge">
|
|
<div class="docling-dot" id="doclingDot"></div>
|
|
<span id="doclingLabel">Docling</span>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main>
|
|
<div class="page-title">
|
|
<div class="eyebrow">Planeterra International Foundation</div>
|
|
<h1>Equals Money → Workday EIB</h1>
|
|
<p>Upload a raw Equals Money export to generate a clean EIB file. Optionally upload a card statement to run a per-person audit.</p>
|
|
</div>
|
|
|
|
<!-- Step 1: Raw file -->
|
|
<div class="step-card active" id="step1">
|
|
<div class="step-header">
|
|
<div class="step-num">1</div>
|
|
<div>
|
|
<div class="step-title">Upload Equals Money Export</div>
|
|
<div class="step-desc">The raw Excel export from the Equals Money platform</div>
|
|
</div>
|
|
</div>
|
|
<div class="file-zone" id="rawZone">
|
|
<input type="file" id="rawFile" accept=".xlsx,.xls">
|
|
<div class="file-zone-icon">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
|
<polyline points="14,2 14,8 20,8"/>
|
|
</svg>
|
|
</div>
|
|
<div class="file-zone-label"><strong>Click to browse</strong> or drag & drop</div>
|
|
<div class="file-zone-sub">Excel file (.xlsx)</div>
|
|
<div class="file-chosen" id="rawChosen"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Step 2: Audit -->
|
|
<div class="step-card disabled" id="step2">
|
|
<div class="step-header">
|
|
<div class="step-num">2</div>
|
|
<div>
|
|
<div class="step-title">Statement Audit</div>
|
|
<div class="step-desc">Optional — verify the output against card statements</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="audit-toggle" id="auditToggle">
|
|
<div class="toggle-switch" id="auditSwitch">
|
|
<div class="toggle-knob"></div>
|
|
</div>
|
|
<div class="toggle-label">Include statement audit</div>
|
|
</div>
|
|
|
|
<div class="audit-options" id="auditOptions">
|
|
<div class="radio-group">
|
|
<label class="radio-opt selected" id="optCsv">
|
|
<input type="radio" name="stmtType" value="csv" checked>
|
|
<div class="radio-opt-label">CSV Statement</div>
|
|
<div class="radio-opt-desc">Equals CSV export per person</div>
|
|
</label>
|
|
<label class="radio-opt" id="optPdf">
|
|
<input type="radio" name="stmtType" value="pdf">
|
|
<div class="radio-opt-label">PDF Statement</div>
|
|
<div class="radio-opt-desc">Requires Docling container</div>
|
|
</label>
|
|
</div>
|
|
|
|
<div id="csvUpload">
|
|
<div class="file-zone" id="stmtZone">
|
|
<input type="file" id="stmtFile" accept=".csv">
|
|
<div class="file-zone-icon">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
|
<polyline points="14,2 14,8 20,8"/>
|
|
</svg>
|
|
</div>
|
|
<div class="file-zone-label"><strong>Click to browse</strong> or drag & drop</div>
|
|
<div class="file-zone-sub">Combined CSV statement (all cardholders)</div>
|
|
<div class="file-chosen" id="stmtChosen"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="pdfUpload" style="display:none">
|
|
<div class="file-zone" id="pdfZone" style="cursor:default">
|
|
<input type="file" id="pdfFileInput" accept=".pdf" multiple style="display:none">
|
|
<div class="file-zone-icon">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
|
<polyline points="14,2 14,8 20,8"/>
|
|
</svg>
|
|
</div>
|
|
<div class="file-zone-label" id="pdfDropLabel"><strong>Drop PDF files here</strong> or <span style="color:var(--cyan);cursor:pointer" id="pdfBrowseBtn">browse</span></div>
|
|
<div class="file-zone-sub">One PDF per cardholder — Docling must be running</div>
|
|
</div>
|
|
<ul class="pdf-file-list" id="pdfFileList"></ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Step 3: Process -->
|
|
<div class="step-card disabled" id="step3">
|
|
<div class="step-header">
|
|
<div class="step-num">3</div>
|
|
<div>
|
|
<div class="step-title">Process & Download</div>
|
|
<div class="step-desc">Generate the EIB output file</div>
|
|
</div>
|
|
</div>
|
|
<button class="btn btn-primary btn-full" id="processBtn" disabled>
|
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
|
<polyline points="13,2 3,14 12,14 11,22 21,10 12,10"/>
|
|
</svg>
|
|
Process
|
|
</button>
|
|
|
|
<div class="progress-wrap" id="progressWrap">
|
|
<div class="progress-bar-track">
|
|
<div class="progress-bar-fill" id="progressFill"></div>
|
|
</div>
|
|
<div class="progress-label-row">
|
|
<div class="progress-label" id="progressLabel">Processing transactions…</div>
|
|
<button class="details-toggle" id="detailsToggle">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3">
|
|
<polyline points="9,6 15,12 9,18"/>
|
|
</svg>
|
|
Details
|
|
</button>
|
|
</div>
|
|
<div class="progress-details" id="progressDetails"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Unmapped merchants -->
|
|
<div class="unmapped-panel" id="unmappedPanel">
|
|
<div class="unmapped-title">⚠ Unmapped Merchants</div>
|
|
<p style="font-size:12px;color:var(--w3);margin-bottom:12px">Give each one a clean name, then continue — no code changes needed.</p>
|
|
<ul class="unmapped-list" id="unmappedList"></ul>
|
|
<button class="btn btn-primary btn-full" id="saveMappingsBtn">Save & Continue Processing</button>
|
|
<div id="mappingSaveNote" style="display:none;font-size:11px;color:var(--red);margin-top:8px"></div>
|
|
</div>
|
|
|
|
<!-- Result -->
|
|
<div class="result-panel" id="resultPanel">
|
|
<div class="result-card success" id="resultCard">
|
|
<div class="result-header">
|
|
<div class="result-icon ok">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="#10D98A" stroke-width="2.5">
|
|
<polyline points="20,6 9,17 4,12"/>
|
|
</svg>
|
|
</div>
|
|
<div>
|
|
<div class="result-title" id="resultTitle">Processing complete</div>
|
|
<div class="result-sub" id="resultSub"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="stats-grid">
|
|
<div class="stat-box">
|
|
<div class="stat-value" id="statRows">—</div>
|
|
<div class="stat-label">EIB Rows</div>
|
|
</div>
|
|
<div class="stat-box">
|
|
<div class="stat-value" id="statUsd">—</div>
|
|
<div class="stat-label">USD Total</div>
|
|
</div>
|
|
<div class="stat-box">
|
|
<div class="stat-value" id="statPeople">—</div>
|
|
<div class="stat-label">Cardholders</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="audit-table-wrap" id="auditTableWrap" style="display:none">
|
|
<div class="section-label">Audit Results</div>
|
|
<table class="audit-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Cardholder</th>
|
|
<th>Details</th>
|
|
<th>Status</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="auditTableBody"></tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<button class="btn btn-primary btn-full" id="downloadBtn">
|
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
<polyline points="7,10 12,15 17,10"/>
|
|
<line x1="12" y1="15" x2="12" y2="3"/>
|
|
</svg>
|
|
Download EIB File
|
|
</button>
|
|
|
|
<button class="btn btn-ghost btn-full" id="generateUploadBtn" style="margin-top:10px">
|
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
|
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
|
<polyline points="17,8 12,3 7,8"/>
|
|
<line x1="12" y1="3" x2="12" y2="15"/>
|
|
</svg>
|
|
Generate EIB File (for Upload)
|
|
</button>
|
|
<div id="uploadGenNote" style="display:none;font-size:11px;color:var(--w3);margin-top:8px;line-height:1.5"></div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<footer>
|
|
Built by <a href="https://undodesigns.com" target="_blank">Undo Designs</a> · EIB Processor v3
|
|
</footer>
|
|
|
|
<script>
|
|
const $ = id => document.getElementById(id);
|
|
|
|
// ── Docling status ────────────────────────────────────────────────────────────
|
|
async function checkDocling() {
|
|
try {
|
|
const r = await fetch('/eib/api/docling/status');
|
|
const d = await r.json();
|
|
$('doclingDot').className = 'docling-dot' + (d.available ? ' online' : '');
|
|
$('doclingLabel').textContent = d.available ? 'Docling · online' : 'Docling · offline';
|
|
} catch { $('doclingLabel').textContent = 'Docling · offline'; }
|
|
}
|
|
checkDocling();
|
|
setInterval(checkDocling, 30000);
|
|
|
|
// ── File upload handling ──────────────────────────────────────────────────────
|
|
function setupFileZone(zoneId, inputId, chosenId) {
|
|
const zone = $(zoneId), input = $(inputId), chosen = $(chosenId);
|
|
zone.addEventListener('dragover', e => { e.preventDefault(); zone.classList.add('drag-over'); });
|
|
zone.addEventListener('dragleave', () => zone.classList.remove('drag-over'));
|
|
zone.addEventListener('drop', e => {
|
|
e.preventDefault(); zone.classList.remove('drag-over');
|
|
if (e.dataTransfer.files[0]) {
|
|
input.files = e.dataTransfer.files;
|
|
chosen.textContent = e.dataTransfer.files[0].name;
|
|
onFileChange();
|
|
}
|
|
});
|
|
input.addEventListener('change', () => {
|
|
if (input.files[0]) chosen.textContent = input.files[0].name;
|
|
onFileChange();
|
|
});
|
|
}
|
|
|
|
setupFileZone('rawZone', 'rawFile', 'rawChosen');
|
|
setupFileZone('stmtZone', 'stmtFile', 'stmtChosen');
|
|
|
|
// ── Multi-PDF upload ──────────────────────────────────────────────────────────
|
|
const pdfFiles = [];
|
|
|
|
function renderPdfList() {
|
|
const list = $('pdfFileList');
|
|
list.innerHTML = '';
|
|
pdfFiles.forEach((file, idx) => {
|
|
const li = document.createElement('li');
|
|
li.innerHTML = `<span>PDF ${idx + 1}</span>${file.name}
|
|
<button class="pdf-remove" data-idx="${idx}" title="Remove">✕</button>`;
|
|
list.appendChild(li);
|
|
});
|
|
list.querySelectorAll('.pdf-remove').forEach(btn => {
|
|
btn.addEventListener('click', () => {
|
|
pdfFiles.splice(+btn.dataset.idx, 1);
|
|
renderPdfList();
|
|
});
|
|
});
|
|
$('pdfDropLabel').innerHTML = pdfFiles.length
|
|
? `<strong>${pdfFiles.length} PDF${pdfFiles.length > 1 ? 's' : ''} selected</strong> — <span style="color:var(--cyan);cursor:pointer" id="pdfBrowseBtn">add more</span>`
|
|
: `<strong>Drop PDF files here</strong> or <span style="color:var(--cyan);cursor:pointer" id="pdfBrowseBtn">browse</span>`;
|
|
document.getElementById('pdfBrowseBtn')?.addEventListener('click', () => $('pdfFileInput').click());
|
|
}
|
|
|
|
$('pdfBrowseBtn').addEventListener('click', () => $('pdfFileInput').click());
|
|
$('pdfFileInput').addEventListener('change', () => {
|
|
Array.from($('pdfFileInput').files).forEach(f => {
|
|
if (!pdfFiles.find(x => x.name === f.name)) pdfFiles.push(f);
|
|
});
|
|
$('pdfFileInput').value = '';
|
|
renderPdfList();
|
|
});
|
|
|
|
const pdfZone = $('pdfZone');
|
|
pdfZone.addEventListener('dragover', e => { e.preventDefault(); pdfZone.classList.add('drag-over'); });
|
|
pdfZone.addEventListener('dragleave', () => pdfZone.classList.remove('drag-over'));
|
|
pdfZone.addEventListener('drop', e => {
|
|
e.preventDefault(); pdfZone.classList.remove('drag-over');
|
|
Array.from(e.dataTransfer.files)
|
|
.filter(f => f.name.endsWith('.pdf'))
|
|
.forEach(f => { if (!pdfFiles.find(x => x.name === f.name)) pdfFiles.push(f); });
|
|
renderPdfList();
|
|
});
|
|
|
|
function onFileChange() {
|
|
const hasRaw = !!$('rawFile').files[0];
|
|
$('step2').classList.toggle('disabled', !hasRaw);
|
|
$('step3').classList.toggle('disabled', !hasRaw);
|
|
$('processBtn').disabled = !hasRaw;
|
|
if (hasRaw) {
|
|
$('step1').classList.add('complete');
|
|
$('step2').classList.add('active');
|
|
$('step3').classList.add('active');
|
|
}
|
|
}
|
|
|
|
// ── Audit toggle ──────────────────────────────────────────────────────────────
|
|
let auditOn = false;
|
|
$('auditToggle').addEventListener('click', () => {
|
|
auditOn = !auditOn;
|
|
$('auditSwitch').classList.toggle('on', auditOn);
|
|
$('auditOptions').classList.toggle('visible', auditOn);
|
|
});
|
|
|
|
// ── Statement type radio ──────────────────────────────────────────────────────
|
|
let stmtType = 'csv';
|
|
$('optCsv').addEventListener('click', () => {
|
|
stmtType = 'csv';
|
|
$('optCsv').classList.add('selected');
|
|
$('optPdf').classList.remove('selected');
|
|
$('csvUpload').style.display = '';
|
|
$('pdfUpload').style.display = 'none';
|
|
});
|
|
$('optPdf').addEventListener('click', () => {
|
|
stmtType = 'pdf';
|
|
$('optPdf').classList.add('selected');
|
|
$('optCsv').classList.remove('selected');
|
|
$('pdfUpload').style.display = '';
|
|
$('csvUpload').style.display = 'none';
|
|
});
|
|
|
|
// ── Collapsible details toggle ────────────────────────────────────────────────
|
|
let detailsOpen = false;
|
|
$('detailsToggle').addEventListener('click', () => {
|
|
detailsOpen = !detailsOpen;
|
|
$('detailsToggle').classList.toggle('open', detailsOpen);
|
|
$('progressDetails').classList.toggle('visible', detailsOpen);
|
|
});
|
|
|
|
// ── Progress + live status polling ────────────────────────────────────────────
|
|
let progressInterval, statusPollInterval;
|
|
let renderedLogCount = 0;
|
|
|
|
function startProgress() {
|
|
$('progressWrap').classList.add('visible');
|
|
$('progressDetails').innerHTML = '';
|
|
renderedLogCount = 0;
|
|
|
|
let pct = 0;
|
|
$('progressFill').style.width = '2%';
|
|
$('progressLabel').textContent = 'Starting…';
|
|
|
|
progressInterval = setInterval(() => {
|
|
if (pct < 92) {
|
|
pct += 0.4;
|
|
$('progressFill').style.width = pct + '%';
|
|
}
|
|
}, 150);
|
|
|
|
statusPollInterval = setInterval(async () => {
|
|
try {
|
|
const r = await fetch('/eib/api/process/status');
|
|
const d = await r.json();
|
|
if (d.current) $('progressLabel').textContent = d.current;
|
|
if (d.log && d.log.length > renderedLogCount) {
|
|
for (let i = renderedLogCount; i < d.log.length; i++) {
|
|
const line = document.createElement('div');
|
|
const text = d.log[i];
|
|
line.className = 'progress-detail-line' +
|
|
(text.startsWith('✓') ? ' ok' : text.startsWith('✕') ? ' fail' : '');
|
|
line.textContent = text;
|
|
$('progressDetails').appendChild(line);
|
|
}
|
|
renderedLogCount = d.log.length;
|
|
$('progressDetails').scrollTop = $('progressDetails').scrollHeight;
|
|
}
|
|
} catch { /* ignore transient poll errors */ }
|
|
}, 600);
|
|
}
|
|
|
|
function finishProgress() {
|
|
clearInterval(progressInterval);
|
|
clearInterval(statusPollInterval);
|
|
$('progressFill').style.width = '100%';
|
|
$('progressLabel').textContent = 'Done.';
|
|
setTimeout(() => $('progressWrap').classList.remove('visible'), 800);
|
|
}
|
|
|
|
// ── Process ───────────────────────────────────────────────────────────────────
|
|
let lastFilename = '';
|
|
let unmappedRawNames = [];
|
|
|
|
function escapeHtml(s) {
|
|
return String(s).replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
|
}
|
|
|
|
async function runProcess() {
|
|
const raw = $('rawFile').files[0];
|
|
if (!raw) return;
|
|
|
|
$('processBtn').disabled = true;
|
|
$('resultPanel').classList.remove('visible');
|
|
$('unmappedPanel').classList.remove('visible');
|
|
$('uploadGenNote').style.display = 'none';
|
|
$('generateUploadBtn').disabled = false;
|
|
startProgress();
|
|
|
|
const fd = new FormData();
|
|
fd.append('raw_file', raw);
|
|
|
|
if (auditOn) {
|
|
if (stmtType === 'csv' && $('stmtFile').files[0]) {
|
|
fd.append('stmt_file', $('stmtFile').files[0]);
|
|
} else if (stmtType === 'pdf' && pdfFiles.length > 0) {
|
|
pdfFiles.forEach((f, i) => fd.append(`pdf_file_${i}`, f));
|
|
}
|
|
}
|
|
|
|
try {
|
|
const r = await fetch('/eib/api/process', { method: 'POST', body: fd });
|
|
const d = await r.json();
|
|
finishProgress();
|
|
|
|
if (d.status === 'unmapped') {
|
|
unmappedRawNames = d.unmapped;
|
|
$('unmappedList').innerHTML = unmappedRawNames.map((m, i) => `
|
|
<li>
|
|
<span class="unmapped-raw" title="${escapeHtml(m)}">${escapeHtml(m)}</span>
|
|
<input type="text" class="unmapped-input" id="unmappedInput${i}" value="${escapeHtml(m)}">
|
|
</li>`).join('');
|
|
$('mappingSaveNote').style.display = 'none';
|
|
$('unmappedPanel').classList.add('visible');
|
|
$('processBtn').disabled = false;
|
|
return;
|
|
}
|
|
|
|
if (d.status === 'pdf_parse_failed') {
|
|
alert(d.message);
|
|
$('processBtn').disabled = false;
|
|
return;
|
|
}
|
|
|
|
if (d.status === 'ok') {
|
|
lastFilename = d.filename;
|
|
$('statRows').textContent = d.rows;
|
|
$('statUsd').textContent = '$' + d.totals_usd.toLocaleString('en-US', {minimumFractionDigits:2});
|
|
$('statPeople').textContent = d.people.length;
|
|
$('resultSub').textContent = d.people.join(' · ');
|
|
|
|
if (d.audit) {
|
|
$('auditTableWrap').style.display = '';
|
|
$('auditTableBody').innerHTML = d.audit.map(a => `
|
|
<tr>
|
|
<td>${a['Cardholder']}</td>
|
|
<td style="font-family:var(--mono);font-size:10.5px">${a['Currency Checks'] || ''}</td>
|
|
<td><span class="status-badge ${a['Audit Status']==='MATCHED'?'status-matched':'status-review'}">
|
|
<span class="status-dot"></span>${a['Audit Status']}
|
|
</span></td>
|
|
</tr>`).join('');
|
|
} else {
|
|
$('auditTableWrap').style.display = 'none';
|
|
}
|
|
|
|
$('resultPanel').classList.add('visible');
|
|
$('step3').classList.add('complete');
|
|
} else {
|
|
alert(d.message || d.error || 'Unexpected error');
|
|
}
|
|
} catch (e) {
|
|
finishProgress();
|
|
alert('Network error: ' + e.message);
|
|
}
|
|
$('processBtn').disabled = false;
|
|
}
|
|
|
|
$('processBtn').addEventListener('click', runProcess);
|
|
|
|
// ── Unmapped merchants: save mappings, then reprocess automatically ───────────
|
|
$('saveMappingsBtn').addEventListener('click', async () => {
|
|
const note = $('mappingSaveNote');
|
|
note.style.display = 'none';
|
|
|
|
const mappings = {};
|
|
for (let i = 0; i < unmappedRawNames.length; i++) {
|
|
const val = $('unmappedInput' + i).value.trim();
|
|
if (!val) {
|
|
note.textContent = 'Every merchant needs a clean name.';
|
|
note.style.display = 'block';
|
|
return;
|
|
}
|
|
mappings[unmappedRawNames[i]] = val;
|
|
}
|
|
|
|
$('saveMappingsBtn').disabled = true;
|
|
try {
|
|
const r = await fetch('/eib/api/merchant-mappings', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ mappings }),
|
|
});
|
|
const d = await r.json();
|
|
if (d.status === 'ok') {
|
|
$('unmappedPanel').classList.remove('visible');
|
|
runProcess();
|
|
} else {
|
|
note.textContent = d.error || 'Could not save mappings';
|
|
note.style.display = 'block';
|
|
}
|
|
} catch (e) {
|
|
note.textContent = 'Network error: ' + e.message;
|
|
note.style.display = 'block';
|
|
}
|
|
$('saveMappingsBtn').disabled = false;
|
|
});
|
|
|
|
// ── Download ──────────────────────────────────────────────────────────────────
|
|
$('downloadBtn').addEventListener('click', () => {
|
|
if (lastFilename) window.location.href = '/eib/api/download/' + encodeURIComponent(lastFilename);
|
|
});
|
|
|
|
// ── Generate EIB file for upload (separate Workday-ready template) ────────────
|
|
$('generateUploadBtn').addEventListener('click', async () => {
|
|
const btn = $('generateUploadBtn');
|
|
const note = $('uploadGenNote');
|
|
btn.disabled = true;
|
|
note.style.display = 'none';
|
|
|
|
try {
|
|
const r = await fetch('/eib/api/generate-upload', { method: 'POST' });
|
|
const d = await r.json();
|
|
|
|
if (d.status === 'ok') {
|
|
note.textContent = d.unmatched_cardholders && d.unmatched_cardholders.length
|
|
? `⚠ No card-ID match for: ${d.unmatched_cardholders.join(', ')} — those rows were left blank.`
|
|
: 'Generated. Starting download…';
|
|
note.style.display = 'block';
|
|
window.location.href = '/eib/api/download/' + encodeURIComponent(d.filename);
|
|
} else {
|
|
note.textContent = d.error || 'Unexpected error';
|
|
note.style.display = 'block';
|
|
}
|
|
} catch (e) {
|
|
note.textContent = 'Network error: ' + e.message;
|
|
note.style.display = 'block';
|
|
}
|
|
btn.disabled = false;
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |