-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstaff-portal.html
More file actions
439 lines (422 loc) · 22.4 KB
/
Copy pathstaff-portal.html
File metadata and controls
439 lines (422 loc) · 22.4 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Staff Portal | EnRICH</title>
<style>
:root {
--enrich-purple: #8B2A7D;
--enrich-purple-dark: #6B1F5F;
--enrich-purple-light: #A84D99;
--enrich-blue: #2D7BC4;
--enrich-blue-dark: #1E5A94;
--enrich-blue-light: #4A9AE8;
--enrich-navy: #1E3A5F;
--enrich-teal: #2A6575;
--white: #FFFFFF;
--off-white: #F8F9FA;
--light-gray: #E9ECEF;
--text-gray: #495057;
--light-purple: #F5EBF4;
--light-blue: #E8EEF4;
--bgs-green: #006747;
--shadow: 0 4px 20px rgba(30, 58, 95, 0.15);
--shadow-hover: 0 8px 30px rgba(30, 58, 95, 0.25);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Calibri', 'Gill Sans', 'Segoe UI', Helvetica, Arial, sans-serif;
background: var(--off-white);
color: var(--enrich-navy);
line-height: 1.6;
min-height: 100vh;
}
header {
background: linear-gradient(135deg, var(--enrich-purple) 0%, var(--enrich-purple-dark) 100%);
color: var(--white);
position: sticky;
top: 0;
z-index: 1000;
box-shadow: var(--shadow);
}
.header-content {
max-width: 1200px;
margin: 0 auto;
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
}
.logo-section {
display: flex;
align-items: center;
gap: 1rem;
text-decoration: none;
color: var(--white);
}
.logo-section img {
height: 120px;
width: auto;
background: white;
border-radius: 10px;
padding: 6px;
}
.logo-text h1 {
font-family: 'Calibri', 'Gill Sans', 'Segoe UI', Helvetica, Arial, sans-serif;
font-size: 1.8rem;
font-weight: 700;
letter-spacing: 0.5px;
}
.logo-text p {
font-size: 0.9rem;
opacity: 0.9;
font-weight: 300;
}
nav {
display: flex;
gap: 0.4rem;
flex-wrap: wrap;
}
nav a {
background: rgba(255,255,255,0.15);
border: 1px solid rgba(255,255,255,0.3);
color: var(--white);
padding: 0.55rem 1rem;
border-radius: 6px;
font-family: inherit;
font-size: 0.85rem;
font-weight: 600;
transition: all 0.3s ease;
text-decoration: none;
}
nav a:hover, nav a.active {
background: var(--white);
color: var(--enrich-purple);
}
nav a.pin-link { border-color: rgba(255,255,255,0.5); }
.nhs-banner {
background: var(--enrich-blue);
color: var(--white);
padding: 0.5rem 1rem;
font-size: 0.85rem;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.nhs-banner .banner-text { text-align: center; flex: 1; }
.logoff-btn {
position: absolute;
right: 1rem;
background: rgba(255,255,255,0.2);
border: 1px solid rgba(255,255,255,0.5);
color: white;
padding: 0.25rem 0.75rem;
font-size: 0.75rem;
font-weight: 600;
border-radius: 4px;
cursor: pointer;
font-family: inherit;
transition: all 0.2s ease;
display: none;
}
.logoff-btn:hover { background: rgba(255,255,255,0.35); }
main {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
}
footer {
background: var(--enrich-navy);
color: var(--white);
padding: 2rem;
margin-top: 3rem;
}
.footer-content {
max-width: 1200px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
}
.footer-content p { opacity: 0.9; font-size: 0.9rem; }
.footer-content a { color: var(--enrich-blue-light); }
@media (max-width: 768px) {
.header-content { flex-direction: column; text-align: center; padding: 1rem; }
.logo-section { flex-direction: column; gap: 0.5rem; }
.logo-section img { height: 100px; }
.logo-text h1 { font-size: 1.5rem; }
nav { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; justify-content: flex-start; padding-bottom: 5px; }
nav::-webkit-scrollbar { display: none; }
nav a { flex-shrink: 0; padding: 0.55rem 0.8rem; font-size: 0.8rem; min-height: 44px; display: flex; align-items: center; }
.nhs-banner { font-size: 0.75rem; padding: 0.6rem 1rem; }
main { padding: 1rem; }
.footer-content { flex-direction: column; text-align: center; }
}
.pin-section { max-width: 500px; margin: 0 auto; text-align: center; }
.pin-box { background: var(--white); border-radius: 16px; padding: 3rem 2rem; box-shadow: var(--shadow); margin-top: 2rem; }
.pin-box h2 { font-family: 'Calibri', 'Gill Sans', 'Segoe UI', Helvetica, Arial, sans-serif; color: var(--enrich-purple); margin-bottom: 1rem; }
.pin-box p { color: var(--text-gray); margin-bottom: 1.5rem; }
.pin-input-container { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: 1.5rem; }
.pin-digit { width: 55px; height: 65px; font-size: 1.8rem; text-align: center; border: 2px solid var(--light-gray); border-radius: 10px; font-family: inherit; font-weight: 600; color: var(--enrich-navy); transition: all 0.2s ease; }
.pin-digit:focus { border-color: var(--enrich-purple); outline: none; box-shadow: 0 0 0 3px rgba(139, 42, 125, 0.2); }
.btn { background: linear-gradient(135deg, var(--enrich-purple) 0%, var(--enrich-purple-dark) 100%); color: var(--white); border: none; padding: 1rem 2.5rem; font-size: 1rem; font-weight: 600; border-radius: 8px; cursor: pointer; transition: all 0.3s ease; font-family: inherit; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(139, 42, 125, 0.4); }
.btn.blue { background: linear-gradient(135deg, var(--enrich-blue) 0%, var(--enrich-blue-dark) 100%); }
.btn.blue:hover { box-shadow: 0 6px 20px rgba(45, 123, 196, 0.4); }
.error-message { color: #dc3545; margin-top: 1rem; font-weight: 600; display: none; }
@media (max-width: 768px) {
.pin-box { padding: 1.5rem 1rem; }
.pin-input-container { gap: 8px; }
.pin-digit { width: 48px; height: 58px; font-size: 1.5rem; }
}
@media (max-width: 380px) { .pin-digit { width: 42px; height: 52px; font-size: 1.3rem; } }
.portal-content { display: none; }
.portal-header { background: linear-gradient(135deg, var(--enrich-navy) 0%, var(--enrich-teal) 100%); color: var(--white); border-radius: 16px; padding: 2rem; margin-bottom: 2rem; text-align: center; }
.portal-header h2 { font-family: 'Calibri', 'Gill Sans', 'Segoe UI', Helvetica, Arial, sans-serif; font-size: 1.8rem; margin-bottom: 0.5rem; border: none; padding: 0; color: var(--white); display: block; }
.portal-header p { opacity: 0.9; }
.portal-header .auth-badge { display: inline-block; background: rgba(255,255,255,0.2); padding: 0.4rem 1rem; border-radius: 20px; font-size: 0.85rem; margin-top: 0.75rem; }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin: 2rem 0; }
.portal-card { background: var(--white); border-radius: 12px; padding: 2rem; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: all 0.3s ease; border-left: 4px solid var(--enrich-purple); display: block; }
.portal-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.portal-card.blue { border-left-color: var(--enrich-blue); }
.portal-card.teal { border-left-color: var(--enrich-teal); }
.portal-card-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.portal-card h3 { font-family: 'Calibri', 'Gill Sans', 'Segoe UI', Helvetica, Arial, sans-serif; color: var(--enrich-purple); margin-bottom: 0.5rem; font-size: 1.15rem; }
.portal-card.blue h3 { color: var(--enrich-blue); }
.portal-card.teal h3 { color: var(--enrich-teal); }
.portal-card p { color: var(--text-gray); font-size: 0.9rem; margin-bottom: 0.75rem; }
.portal-card ul { color: var(--text-gray); font-size: 0.85rem; margin-left: 1.2rem; }
.portal-card li { margin-bottom: 0.3rem; }
.portal-card .arrow { display: block; margin-top: 1rem; color: var(--enrich-purple); font-weight: 600; font-size: 0.9rem; }
.portal-card.blue .arrow { color: var(--enrich-blue); }
.portal-card.teal .arrow { color: var(--enrich-teal); }
.quick-links { background: var(--white); border-radius: 12px; padding: 1.5rem; box-shadow: var(--shadow); margin-top: 2rem; }
.quick-links h3 { font-family: 'Calibri', 'Gill Sans', 'Segoe UI', Helvetica, Arial, sans-serif; color: var(--enrich-navy); margin-bottom: 1rem; font-size: 1.1rem; }
.quick-links-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.quick-link { display: inline-block; background: linear-gradient(135deg, rgba(139,42,125,0.08) 0%, rgba(45,123,196,0.08) 100%); padding: 0.6rem 1.2rem; border-radius: 8px; text-decoration: none; color: var(--enrich-navy); font-weight: 600; font-size: 0.9rem; transition: all 0.2s ease; }
.quick-link:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(30, 58, 95, 0.15); }
@media (max-width: 768px) { .portal-grid { grid-template-columns: 1fr; } }
</style>
</head>
<body>
<header>
<div class="header-content">
<a href="index.html" class="logo-section">
<img src="EnRICH_Logo_solid.png" alt="EnRICH Logo">
<div class="logo-text"><h1>EnRICH</h1><p>Enhanced Reviews in Care Homes</p></div>
</a>
<nav>
<a href="index.html">Home</a>
<a href="about.html">About EnRICH</a>
<a href="services.html">Our Services</a>
<a href="resources.html">Resources</a>
<a href="care-homes.html">Our Care Homes</a>
<a href="team.html" class="pin-link">🔒 Meet the Team</a>
<a href="referral.html" class="pin-link">🔒 Make a Referral</a>
<a href="staff-portal.html" class="active pin-link">🔒 Staff Portal</a>
</nav>
</div>
</header>
<div class="nhs-banner"><span class="banner-text">A service provided by <strong>Cambridge University Hospitals NHS Foundation Trust</strong> & <strong>Cambridgeshire & Peterborough NHS Foundation Trust</strong></span><button class="logoff-btn" id="logoff-btn" onclick="logoff()">Log Off</button></div>
<main>
<div class="pin-section" id="pin-entry">
<div class="pin-box">
<h2>🔒 Staff Portal</h2>
<p>Enter your 5-digit EnRICH PIN code to access staff resources, policies, timetables, and contact information.</p>
<div class="pin-input-container">
<input type="text" class="pin-digit" maxlength="1" data-index="0" inputmode="numeric" pattern="[0-9]*" aria-label="PIN digit 1">
<input type="text" class="pin-digit" maxlength="1" data-index="1" inputmode="numeric" pattern="[0-9]*" aria-label="PIN digit 2">
<input type="text" class="pin-digit" maxlength="1" data-index="2" inputmode="numeric" pattern="[0-9]*" aria-label="PIN digit 3">
<input type="text" class="pin-digit" maxlength="1" data-index="3" inputmode="numeric" pattern="[0-9]*" aria-label="PIN digit 4">
<input type="text" class="pin-digit" maxlength="1" data-index="4" inputmode="numeric" pattern="[0-9]*" aria-label="PIN digit 5">
</div>
<button class="btn" id="validate-btn">Access Staff Portal</button>
<p class="error-message" id="pin-error">Invalid PIN code. Please check and try again.</p>
</div>
</div>
<div class="portal-content" id="portal-content">
<div class="portal-header">
<h2>EnRICH Staff Portal</h2>
<p>Resources for care home staff and healthcare professionals</p>
<div class="auth-badge">✅ Authenticated — <span id="care-home-name"></span></div>
</div>
<div class="portal-grid">
<a href="portal-policies.html" class="portal-card">
<div class="portal-card-icon">📋</div>
<h3>Policies & Guidelines</h3>
<p>Clinical policies, care pathways, and evidence-based guidelines for care home staff.</p>
<ul><li>EnRICH clinical protocols</li><li>Escalation pathways</li><li>Medication management guidelines</li><li>Falls prevention policies</li></ul>
<span class="arrow">View policies →</span>
</a>
<a href="portal-timetables.html" class="portal-card blue">
<div class="portal-card-icon">📅</div>
<h3>Timetables & Schedules</h3>
<p>Visit schedules, MDT meeting times, and service availability.</p>
<ul><li>Care home visit schedule</li><li>MDT meeting timetable</li><li>On-call availability</li><li>Education session dates</li></ul>
<span class="arrow">View timetables →</span>
</a>
<a href="portal-gp-contacts.html" class="portal-card teal">
<div class="portal-card-icon">📞</div>
<h3>GP Practice Contacts</h3>
<p>Contact numbers and details for GP practices serving enrolled care homes.</p>
<ul><li>Practice phone numbers</li><li>Named GP contacts</li><li>Out-of-hours arrangements</li><li>Community team contacts</li></ul>
<span class="arrow">View contacts →</span>
</a>
<a href="referral.html" class="portal-card">
<div class="portal-card-icon">📨</div>
<h3>Make a Referral</h3>
<p>Submit a new referral to the EnRICH service for a care home resident.</p>
<span class="arrow">Go to referral form →</span>
</a>
<a href="team.html" class="portal-card blue">
<div class="portal-card-icon">👥</div>
<h3>Meet the Team</h3>
<p>View the EnRICH team members and their contact details.</p>
<span class="arrow">View team →</span>
</a>
<a href="https://mjb302.github.io/enrich-map/" target="_blank" class="portal-card teal">
<div class="portal-card-icon">🗺️</div>
<h3>Care Home Map</h3>
<p>View enrolled care homes on our interactive map of Cambridgeshire.</p>
<span class="arrow">Open map →</span>
</a>
</div>
<div class="quick-links">
<h3>⚡ Quick Links</h3>
<div class="quick-links-grid">
<a href="cga.html" class="quick-link">CGA Information</a>
<a href="acp.html" class="quick-link">Advance Care Planning</a>
<a href="medications-conditions.html" class="quick-link">Medication Reviews</a>
<a href="acute-deterioration.html" class="quick-link">Acute Deterioration</a>
<a href="staff-education.html" class="quick-link">Staff Education</a>
<a href="mdt-collaboration.html" class="quick-link">MDT Collaboration</a>
<a href="resources.html" class="quick-link">External Resources</a>
</div>
</div>
</div>
</main>
<footer>
<div class="footer-content">
<p>© 2026 EnRICH - Enhanced Reviews in Care Homes<br>Cambridge University Hospitals NHS Foundation Trust</p>
<p>
<a href="resources.html">Resources</a> |
<a href="care-homes.html">Our Care Homes</a> |
<a href="https://mjb302.github.io/enrich-map/" target="_blank">Care Home Map</a>
</p>
</div>
</footer>
<script>
var careHomePINs = {
// --- Care Homes (31) ---
'fe24aa89e33d228cb577bbb4e711915b06afe4ad2a490963e5df25c9842c20e2': 'Alex Wood House',
'3bee6539d1067e8f68bed995929d064d7305b5d270ceff2f8e9d35a899acd37d': 'Bramley Court',
'f9b612674f3f0acfd4a3d81dcfc2e5d5b7060f8a21be33de7536d1af33b71830': 'Brook House Care Home',
'aee73965b29b99f53a3db9504ea2b208c0c018c217fdf15e553e955855953900': 'Cambridge Grove Care Home',
'8f2034cfc80faa1621c4d416654243d15498b7eafa3cf8147675e36665313579': 'Cambridge Manor Care Home',
'2d3f2d14c058e044a774908508ed37b9f1b47ffbd519e1e4b1717c489910a096': 'Cleves Place',
'47a3ed983a9127f210c339e591f65506b9cfc127ce1d2cf5f3a26927369e7ddf': 'Cottenham Court Care Home',
'af8b17e81b1a3801e5e770de0a1a1f43e770030f98fe67221453fdbdd6b1affe': 'Etheldred House Care Home',
'7edd1a06302c6e71fefb576021cf632d694775c1343b6222bce9cafa08ebbb13': 'Fitzwilliam House Care Home',
'da5c2f49fad2615edf210b93a0408cbb762cc42880e98452fa8a2b5b6ae631f3': 'Hatley Court',
'41751ff4c81c502af385eee954b2612b13936e393186543deb80b320407993c8': 'Heathlands House',
'd0dca67d8153e8e39f456e5f0441f84b41936cd5149d213ee733b3067e6f82f7': 'Highfield Care Home',
'80b3383fc7df188f00b97aa5b0625054b193c9cd3a8d261e654bc4e38149c760': 'Hilton Park - Oaklands',
'cd3d20333ca6d04a1f234e9807cc74a028350a671b49c0cc9a026cb5a1d9b00d': 'Home Close',
'9de02e2a1338c710c7f09d1aeee4142a2b1f9e0c554d29ab9a7be6cbb7008aa9': 'Home Meadow',
'd75ce5017561e791495b3e007ead8697b27e277cd9882b2262e0de66d6d1f12e': 'Langdon House',
'7599b6dd1963f67bc1335b85bbf0b7ad38d81034cc3fc5b69d2327e8b3d3a067': 'Lily House',
'f0eed60c335b758b7dbf29308262a8ff638e46de5ee38b79d77994fab5231c05': 'Maycroft Care Home',
'18555c2d2c9e8c63d085dc91c61044bfa9f13696209a8110a744feda7645079e': 'Melbourn Springs Care Home',
'c9ab187dc9a3366dd148631ef1b508d55f37f98e15d33801d65fcedc76ff865b': 'Melwood Grange',
'f67445e4610f525afd0a733e5cc4993c329546a1f97392cf8943ee8c49a5f339': 'Midfield Lodge',
'1b6b1543dc6c1d432ae5735f9be6b64ac122672114330ac29226d65acc581bd2': 'Orchard House Residential Care Home',
'8a661929534d66b23ab23c9d7899587221c5eccab66ed61ba17a5163d91ea5f8': 'Primrose Croft Care Home',
'6c0865de8b4a8183318369d4f04b06cbf422a29daf4f7a7a45f776c20e6d523d': 'Queens Court',
'3197b1d4f9cb468f58533c516079011b3a6ac205e600d118ee823a31d3808c25': 'Southwell Court',
'77450960dfed2bba6594e0f4c712e28cd19fb93ae61a383015354edc22a3ff8a': 'Symonds House',
'87874556d2abe6ee84d5aa4a69124d6f05afcf8c1b50e18eddc57ba367f30bdd': 'The Cambridgeshire Care Home',
'ed36a326dbeded94e927c06fa922d4207cee5cad1f650d7f30ca4553f348a0e8': 'Townsend Manor',
'7a16fd6a5ae1529960527e825cd32ec769aa118e3273cb562e5f316539aff3ae': 'Vera James House',
'2fa697315db830fcf1136c0d0dfa87e5fa039f5e611a6aa07947d4769ce252e2': 'Waterbeach Lodge',
'81c73f02bbe4878ec04ac472e5e70718db0948303f697749685897d4b86db5d7': 'Woodlands Care Centre',
// --- Staff (4) ---
'dbf52795a1ef579df9e6a4edea7ba43e52cec7b781455745a5be1352b319713a': 'Alex Rose',
'9aad43a4660010666a1517ce2fb3ca90b441bb8562b5f65b8dc0d08fb0d1ca3e': 'Catriona Love',
'cffaf21eb3efbcc63067ec3b07a1a79165b5213e430c1e17142f994244604f4c': 'Ed Riddell',
'7604f82270c4fdb3b99db9550468a26fe02a35073e1e12eb784f2dc8fc745199': 'Matt Butler',
};
async function hashPIN(pin) {
var encoder = new TextEncoder();
var data = encoder.encode(pin);
var hashBuffer = await crypto.subtle.digest('SHA-256', data);
var hashArray = Array.from(new Uint8Array(hashBuffer));
return hashArray.map(function(b) { return b.toString(16).padStart(2, '0'); }).join('');
}
var pinInputs = document.querySelectorAll('.pin-digit');
pinInputs.forEach(function(input, index) {
input.addEventListener('input', function(e) {
var value = e.target.value;
if (!/^\d*$/.test(value)) { e.target.value = ''; return; }
if (value && index < pinInputs.length - 1) { pinInputs[index + 1].focus(); }
if (index === pinInputs.length - 1 && value) { validatePIN(); }
});
input.addEventListener('keydown', function(e) {
if (e.key === 'Backspace' && !e.target.value && index > 0) { pinInputs[index - 1].focus(); }
if (e.key === 'Enter') { validatePIN(); }
});
input.addEventListener('paste', function(e) {
e.preventDefault();
var pastedData = e.clipboardData.getData('text').replace(/\D/g, '').slice(0, 5);
pastedData.split('').forEach(function(digit, i) { if (pinInputs[i]) { pinInputs[i].value = digit; } });
if (pastedData.length === 5) { pinInputs[4].focus(); validatePIN(); }
});
});
</script>
<script>
document.getElementById('validate-btn').addEventListener('click', validatePIN);
function logoff() {
try { sessionStorage.removeItem('enrich_auth'); sessionStorage.removeItem('enrich_home'); } catch(e) {}
document.getElementById('pin-entry').style.display = 'block';
document.getElementById('portal-content').style.display = 'none';
document.getElementById('logoff-btn').style.display = 'none';
pinInputs.forEach(function(input) { input.value = ''; });
pinInputs[0].focus();
}
async function validatePIN() {
var pin = Array.from(pinInputs).map(function(input) { return input.value; }).join('');
var errorMsg = document.getElementById('pin-error');
if (pin.length !== 5) { errorMsg.style.display = 'block'; errorMsg.textContent = 'Please enter all 5 digits.'; return; }
var hash = await hashPIN(pin);
if (careHomePINs[hash]) {
var homeName = careHomePINs[hash];
try { sessionStorage.setItem('enrich_auth', 'true'); sessionStorage.setItem('enrich_home', homeName); } catch(e) {}
showPortal(homeName);
errorMsg.style.display = 'none';
} else {
errorMsg.style.display = 'block';
errorMsg.textContent = 'Invalid EnRICH PIN code. Please check and try again.';
}
}
function showPortal(homeName) {
document.getElementById('pin-entry').style.display = 'none';
document.getElementById('portal-content').style.display = 'block';
document.getElementById('care-home-name').textContent = homeName;
document.getElementById('logoff-btn').style.display = 'inline-block';
}
(function() {
try {
if (sessionStorage.getItem('enrich_auth') === 'true') {
var homeName = sessionStorage.getItem('enrich_home') || 'Authenticated';
showPortal(homeName);
}
} catch(e) {}
})();
</script>
</body>
</html>