-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.html
More file actions
209 lines (193 loc) · 9.41 KB
/
Copy pathdashboard.html
File metadata and controls
209 lines (193 loc) · 9.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Dashboard — SovereignTrust</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;1,400&family=DM+Sans:wght@300;400;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/css/main.css">
<script src="/js/auth.js"></script>
<script src="/js/trust-api.js"></script>
<script>requireAuth();</script>
</head>
<body>
<nav>
<a class="nav-logo" href="/">
<div class="nav-logo-mark">S</div>
<div class="nav-logo-text">Sovereign Trust</div>
</a>
<div class="nav-links" id="navLinks">
<a class="nav-link" href="/education.html">Education</a>
<a class="nav-link" href="/dashboard.html">Dashboard</a>
<a class="nav-link" href="/settings.html">Settings</a>
<a class="nav-link" href="/login.html">Sign in</a>
<a class="nav-cta" href="/register.html">Create Account</a>
</div>
<button class="nav-hamburger" onclick="toggleMobileMenu()" aria-label="Open menu">
<span></span><span></span><span></span>
</button>
</nav>
<div class="dashboard-wrap">
<div class="dashboard-header">
<div>
<h1>My Dashboard</h1>
<p id="dashGreet">Welcome back. Manage your trust profiles and documents.</p>
</div>
<a class="btn-navy" href="/builder.html">+ New Trust</a>
</div>
<div style="margin-bottom:12px; font-size:12px; letter-spacing:0.1em; text-transform:uppercase; color:var(--text-muted); font-weight:500;">Your Trust Profiles</div>
<div id="trustsLoading" style="display:flex; align-items:center; gap:12px; padding:28px 0; color:var(--text-muted); font-size:14px; font-weight:300;">
Loading your trust profiles…
<div class="spinner"></div>
</div>
<div id="trustsList"></div>
<div id="trustsEmpty" style="display:none; padding:32px; text-align:center; color:var(--text-muted); font-weight:300;">You haven't created any trust profiles yet.</div>
<!-- LOCKED MODULES -->
<div class="locked-modules">
<h2>Additional Document Modules</h2>
<p>More document types are coming soon. Each module will be available as an add-on to your existing trust profile.</p>
<div class="locked-grid">
<div class="locked-card"><h3>Asset Assignment</h3><p>Transfer assets formally into your trust</p><div class="coming-tag">Coming Soon</div></div>
<div class="locked-card"><h3>Trustee Minutes</h3><p>Record formal trustee decisions</p><div class="coming-tag">Coming Soon</div></div>
<div class="locked-card"><h3>Trustee Appointment</h3><p>Appoint a new trustee formally</p><div class="coming-tag">Coming Soon</div></div>
<div class="locked-card"><h3>Trustee Removal</h3><p>Remove a trustee in accordance with the deed</p><div class="coming-tag">Coming Soon</div></div>
<div class="locked-card"><h3>Bank Resolution</h3><p>Formal resolution for bank account opening</p><div class="coming-tag">Coming Soon</div></div>
<div class="locked-card"><h3>Memorandum of Wishes</h3><p>Document your intentions for trustees</p><div class="coming-tag">Coming Soon</div></div>
<div class="locked-card"><h3>Deed of Variation</h3><p>Formally amend the terms of your existing trust deed</p><div class="coming-tag">Coming Soon</div></div>
<div class="locked-card"><h3>Beneficiary Notification</h3><p>Issue formal notice of trust to named beneficiaries</p><div class="coming-tag">Coming Soon</div></div>
</div>
</div>
</div>
<!-- LEELA -->
<div class="lumina-float" id="leela">
<div class="lumina-panel" id="leelaPanel">
<div class="lumina-header">
<div class="lumina-avatar">✨</div>
<div>
<div class="lumina-name">Leela</div>
<div class="lumina-sub">Trust Document Assistant</div>
</div>
<a class="lumina-settings" href="/settings.html" title="AI settings">⚙</a>
<button class="lumina-close" onclick="toggleLeela()">×</button>
</div>
<div class="leela-messages" id="leelaMessages"
data-greeting="Welcome back! I'm Leela, your trust document assistant. I can help you understand trust concepts, guide you through the builder, or answer any questions about your trust. What would you like to know?"
data-suggestions='["How do I add assets to my trust?","Can I change my trustees after signing?","What is the difference between a trustee and a beneficiary?"]'>
</div>
<div class="leela-disclaimer">I explain concepts and assist with document preparation only — not legal, tax or financial advice.</div>
<div class="leela-input-row">
<input class="leela-input" id="leelaInput" type="text" placeholder="Ask Leela anything…" />
<button class="leela-send" id="leelaSend" aria-label="Send">→</button>
</div>
</div>
<button class="lumina-btn" onclick="toggleLeela()"><span>✨</span></button>
</div>
<script src="/js/app.js"></script>
<script src="/js/leela.js"></script>
<script>
// Personalise the greeting from session
(function () {
const session = getSession();
if (!session) return;
const name = session.firstName || session.email?.split('@')[0] || 'there';
const el = document.getElementById('dashGreet');
if (el) el.textContent = `Welcome back, ${name}. Manage your trust profiles and documents.`;
})();
function trustCompleteness(data) {
if (!data) return 0;
const checks = [
!!data.overview?.name,
!!data.overview?.jurisdiction,
!!data.overview?.initialProperty,
!!data.settlor?.name,
(data.trustees || []).some(t => t.name),
(data.beneficiaries || []).some(b => b.name),
!!data.signing?.place
];
return Math.round((checks.filter(Boolean).length / checks.length) * 100);
}
function renderTrustCard(trust) {
const card = document.createElement('div');
card.className = 'trust-card';
const left = document.createElement('div');
const nameEl = document.createElement('div');
nameEl.className = 'trust-name';
nameEl.textContent = trust.name || 'Untitled Trust';
left.appendChild(nameEl);
const meta = document.createElement('div');
meta.className = 'trust-meta';
const dateStr = trust.updatedAt ? new Date(trust.updatedAt).toLocaleDateString(undefined, { day: 'numeric', month: 'short', year: 'numeric' }) : '';
const jurisdiction = trust.data?.overview?.jurisdiction || '';
const initialProperty = trust.data?.overview?.initialProperty || '';
meta.textContent = [dateStr && `Last edited ${dateStr}`, jurisdiction, initialProperty].filter(Boolean).join(' · ');
left.appendChild(meta);
const isGenerated = trust.status === 'Generated';
const badgeWrap = document.createElement('div');
badgeWrap.style.marginTop = '12px';
const badge = document.createElement('span');
badge.className = 'status-badge ' + (isGenerated ? 'status-generated' : 'status-draft');
badge.textContent = isGenerated ? '● Generated' : `● Draft — ${trustCompleteness(trust.data)}% complete`;
badgeWrap.appendChild(badge);
left.appendChild(badgeWrap);
const actions = document.createElement('div');
actions.className = 'trust-actions';
if (isGenerated) {
const downloads = document.createElement('a');
downloads.className = 'btn-sm btn-navy';
downloads.href = '/downloads.html?id=' + encodeURIComponent(trust.id);
downloads.textContent = 'Downloads';
const preview = document.createElement('a');
preview.className = 'btn-sm btn-outline';
preview.href = '/preview.html?id=' + encodeURIComponent(trust.id);
preview.textContent = 'Preview';
const edit = document.createElement('a');
edit.className = 'btn-sm btn-outline';
edit.href = '/builder.html?id=' + encodeURIComponent(trust.id);
edit.textContent = 'Edit';
actions.append(downloads, preview, edit);
} else {
const cont = document.createElement('a');
cont.className = 'btn-sm btn-navy';
cont.href = '/builder.html?id=' + encodeURIComponent(trust.id);
cont.textContent = 'Continue →';
actions.appendChild(cont);
}
left.appendChild(actions);
card.appendChild(left);
if (!isGenerated) {
const right = document.createElement('div');
right.style.textAlign = 'right';
const label = document.createElement('div');
label.style.cssText = 'font-size:13px; color:var(--text-muted); font-weight:300; margin-bottom:8px;';
label.textContent = 'Completion';
const pct = document.createElement('div');
pct.style.cssText = 'font-size:18px; color:var(--gold); font-weight:500;';
pct.textContent = trustCompleteness(trust.data) + '%';
right.append(label, pct);
card.appendChild(right);
}
return card;
}
(async function loadTrusts() {
const listEl = document.getElementById('trustsList');
const emptyEl = document.getElementById('trustsEmpty');
const loadingEl = document.getElementById('trustsLoading');
try {
const trusts = await listTrusts();
loadingEl.style.display = 'none';
if (!trusts.length) {
emptyEl.style.display = 'block';
return;
}
trusts.forEach(trust => listEl.appendChild(renderTrustCard(trust)));
} catch (err) {
console.error('[dashboard]', err);
loadingEl.style.display = 'none';
emptyEl.textContent = 'Could not load your trust profiles. Please refresh to try again.';
emptyEl.style.display = 'block';
}
})();
</script>
</body>
</html>