thors1 commited on
Commit
ea75851
·
verified ·
1 Parent(s): 2d023b4

Initial DeepSite commit

Browse files
Files changed (3) hide show
  1. README.md +9 -6
  2. index.html +706 -19
  3. script.js +514 -0
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Deepsite Project U02ge
3
- emoji: 🐨
4
- colorFrom: indigo
5
- colorTo: red
6
  sdk: static
7
- pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
1
  ---
2
+ title: DeepSite Project
3
+ colorFrom: yellow
4
+ colorTo: blue
 
5
  sdk: static
6
+ emoji: 📱
7
+ tags:
8
+ - deepsite-v4
9
  ---
10
 
11
+ # DeepSite Project
12
+
13
+ This project has been created with [DeepSite](https://deepsite.hf.co) AI Vibe Coding.
index.html CHANGED
@@ -1,19 +1,706 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Verify MC - Patient Intake</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://unpkg.com/lucide@latest"></script>
9
+ <script>
10
+ tailwind.config = {
11
+ theme: {
12
+ extend: {
13
+ colors: {
14
+ verify: {
15
+ bg: '#F8FAFC',
16
+ card: '#FFFFFF',
17
+ border: '#E5E7EB',
18
+ text: '#0F172A',
19
+ muted: '#64748B',
20
+ teal: '#0C8F8B',
21
+ 'teal-hover': '#0A7F7B',
22
+ success: '#10B981',
23
+ error: '#EF4444'
24
+ }
25
+ },
26
+ boxShadow: {
27
+ 'soft': '0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02)',
28
+ 'card': '0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03)'
29
+ }
30
+ }
31
+ }
32
+ }
33
+ </script>
34
+ <style>
35
+ * {
36
+ -webkit-font-smoothing: antialiased;
37
+ -moz-osx-font-smoothing: grayscale;
38
+ }
39
+
40
+ body {
41
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
42
+ }
43
+
44
+ .input-field {
45
+ transition: all 0.15s ease;
46
+ }
47
+
48
+ .input-field:focus {
49
+ outline: none;
50
+ border-color: #0C8F8B;
51
+ box-shadow: 0 0 0 3px rgba(12, 143, 139, 0.08);
52
+ }
53
+
54
+ .input-field.error {
55
+ border-color: #EF4444;
56
+ box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
57
+ }
58
+
59
+ .section-enter {
60
+ animation: sectionEnter 0.3s ease-out;
61
+ }
62
+
63
+ @keyframes sectionEnter {
64
+ from {
65
+ opacity: 0;
66
+ transform: translateY(8px);
67
+ }
68
+ to {
69
+ opacity: 1;
70
+ transform: translateY(0);
71
+ }
72
+ }
73
+
74
+ .ai-pulse {
75
+ animation: aiPulse 2s ease-in-out infinite;
76
+ }
77
+
78
+ @keyframes aiPulse {
79
+ 0%, 100% { opacity: 0.6; }
80
+ 50% { opacity: 1; }
81
+ }
82
+
83
+ .progress-bar {
84
+ transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
85
+ }
86
+
87
+ .btn-primary {
88
+ transition: all 0.15s ease;
89
+ }
90
+
91
+ .btn-primary:hover {
92
+ transform: translateY(-1px);
93
+ }
94
+
95
+ .btn-primary:active {
96
+ transform: translateY(0);
97
+ }
98
+
99
+ .sticky-cta {
100
+ position: sticky;
101
+ bottom: 0;
102
+ background: linear-gradient(to top, #FFFFFF 90%, transparent);
103
+ padding-top: 16px;
104
+ margin-top: -16px;
105
+ }
106
+
107
+ @media (min-width: 640px) {
108
+ .sticky-cta {
109
+ position: static;
110
+ background: transparent;
111
+ padding-top: 0;
112
+ margin-top: 0;
113
+ }
114
+ }
115
+
116
+ .checkbox-custom {
117
+ appearance: none;
118
+ width: 20px;
119
+ height: 20px;
120
+ border: 2px solid #E5E7EB;
121
+ border-radius: 6px;
122
+ cursor: pointer;
123
+ transition: all 0.15s ease;
124
+ position: relative;
125
+ }
126
+
127
+ .checkbox-custom:checked {
128
+ background: #0C8F8B;
129
+ border-color: #0C8F8B;
130
+ }
131
+
132
+ .checkbox-custom:checked::after {
133
+ content: '';
134
+ position: absolute;
135
+ left: 5px;
136
+ top: 2px;
137
+ width: 6px;
138
+ height: 10px;
139
+ border: solid white;
140
+ border-width: 0 2px 2px 0;
141
+ transform: rotate(45deg);
142
+ }
143
+
144
+ .radio-custom {
145
+ appearance: none;
146
+ width: 20px;
147
+ height: 20px;
148
+ border: 2px solid #E5E7EB;
149
+ border-radius: 50%;
150
+ cursor: pointer;
151
+ transition: all 0.15s ease;
152
+ position: relative;
153
+ }
154
+
155
+ .radio-custom:checked {
156
+ border-color: #0C8F8B;
157
+ }
158
+
159
+ .radio-custom:checked::after {
160
+ content: '';
161
+ position: absolute;
162
+ top: 3px;
163
+ left: 3px;
164
+ width: 10px;
165
+ height: 10px;
166
+ background: #0C8F8B;
167
+ border-radius: 50%;
168
+ }
169
+
170
+ .ai-input-expand {
171
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
172
+ }
173
+
174
+ .ai-suggestion {
175
+ animation: suggestionAppear 0.2s ease-out;
176
+ }
177
+
178
+ @keyframes suggestionAppear {
179
+ from {
180
+ opacity: 0;
181
+ transform: scale(0.98);
182
+ }
183
+ to {
184
+ opacity: 1;
185
+ transform: scale(1);
186
+ }
187
+ }
188
+
189
+ .field-hint {
190
+ opacity: 0;
191
+ transform: translateY(-4px);
192
+ transition: all 0.2s ease;
193
+ }
194
+
195
+ .input-field:focus ~ .field-hint,
196
+ .input-field:not(:placeholder-shown) ~ .field-hint {
197
+ opacity: 1;
198
+ transform: translateY(0);
199
+ }
200
+
201
+ .completion-badge {
202
+ animation: badgePop 0.3s ease-out;
203
+ }
204
+
205
+ @keyframes badgePop {
206
+ 0% { transform: scale(0.8); opacity: 0; }
207
+ 50% { transform: scale(1.1); }
208
+ 100% { transform: scale(1); opacity: 1; }
209
+ }
210
+ </style>
211
+ </head>
212
+ <body class="bg-verify-bg min-h-screen">
213
+ <!-- Header -->
214
+ <header class="py-6 px-4 sm:px-6">
215
+ <div class="max-w-[720px] mx-auto flex items-center justify-between">
216
+ <div class="flex items-center gap-3">
217
+ <div class="w-10 h-10 bg-verify-teal rounded-xl flex items-center justify-center">
218
+ <i data-lucide="shield-check" class="w-5 h-5 text-white"></i>
219
+ </div>
220
+ <div>
221
+ <h1 class="text-verify-text font-semibold text-lg leading-tight">Verify MC</h1>
222
+ <p class="text-verify-muted text-sm">Patient Intake Portal</p>
223
+ </div>
224
+ </div>
225
+ <div class="text-verify-muted text-sm hidden sm:block">
226
+ Need help? <a href="#" class="text-verify-teal hover:underline">Contact support</a>
227
+ </div>
228
+ </div>
229
+ </header>
230
+
231
+ <!-- Main Content -->
232
+ <main class="px-4 sm:px-5 pb-8">
233
+ <div class="max-w-[720px] mx-auto">
234
+
235
+ <!-- Form Card -->
236
+ <div class="bg-verify-card rounded-[20px] border border-verify-border shadow-card overflow-hidden">
237
+
238
+ <!-- Progress Bar -->
239
+ <div class="h-1 bg-gray-100">
240
+ <div id="progressBar" class="progress-bar h-full bg-verify-teal w-0"></div>
241
+ </div>
242
+
243
+ <div class="p-6 sm:p-8">
244
+
245
+ <!-- Title Section -->
246
+ <div class="mb-8">
247
+ <h2 class="text-verify-text text-2xl font-semibold mb-2">Patient Intake Form</h2>
248
+ <p class="text-verify-muted">Please provide your information below. You can skip anything and complete later.</p>
249
+ </div>
250
+
251
+ <!-- AI Assist Section -->
252
+ <div id="aiSection" class="mb-8 ai-input-expand">
253
+ <div class="bg-gradient-to-r from-teal-50/50 to-emerald-50/30 rounded-2xl border border-teal-100/50 p-4 sm:p-5">
254
+ <div class="flex items-start gap-3 mb-3">
255
+ <div class="w-8 h-8 bg-verify-teal/10 rounded-lg flex items-center justify-center flex-shrink-0">
256
+ <i data-lucide="sparkles" class="w-4 h-4 text-verify-teal ai-pulse"></i>
257
+ </div>
258
+ <div>
259
+ <h3 class="text-verify-text font-medium text-sm">Speed this up with AI</h3>
260
+ <p class="text-verify-muted text-sm">Describe your info in one sentence and we'll fill the form for you</p>
261
+ </div>
262
+ </div>
263
+
264
+ <div class="flex gap-2">
265
+ <input
266
+ type="text"
267
+ id="aiInput"
268
+ placeholder="e.g., John Smith, born March 15 1985, allergic to penicillin..."
269
+ class="flex-1 px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400 focus:outline-none focus:border-verify-teal focus:ring-2 focus:ring-verify-teal/10"
270
+ >
271
+ <button
272
+ id="aiTryBtn"
273
+ onclick="processAIInput()"
274
+ class="btn-primary px-5 py-3 bg-verify-teal hover:bg-verify-teal-hover text-white font-medium text-sm rounded-xl flex items-center gap-2 flex-shrink-0"
275
+ >
276
+ <i data-lucide="wand-2" class="w-4 h-4"></i>
277
+ <span class="hidden sm:inline">Try it</span>
278
+ </button>
279
+ </div>
280
+
281
+ <!-- AI Suggestions Display -->
282
+ <div id="aiSuggestions" class="hidden mt-4 space-y-2"></div>
283
+ </div>
284
+ </div>
285
+
286
+ <!-- Form Sections -->
287
+ <form id="intakeForm" class="space-y-8">
288
+
289
+ <!-- Personal Information -->
290
+ <section class="section-enter">
291
+ <div class="flex items-center gap-2 mb-4">
292
+ <div class="w-6 h-6 bg-verify-teal/10 rounded-lg flex items-center justify-center">
293
+ <i data-lucide="user" class="w-3.5 h-3.5 text-verify-teal"></i>
294
+ </div>
295
+ <h3 class="text-verify-text font-semibold">Personal Information</h3>
296
+ <span class="text-verify-muted text-xs ml-auto" id="personalProgress">0/5</span>
297
+ </div>
298
+
299
+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
300
+ <div class="sm:col-span-2">
301
+ <label class="block text-verify-text text-sm font-medium mb-2">Full Legal Name <span class="text-verify-teal">*</span></label>
302
+ <input
303
+ type="text"
304
+ name="fullName"
305
+ data-section="personal"
306
+ required
307
+ placeholder="First and last name"
308
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400"
309
+ >
310
+ </div>
311
+
312
+ <div>
313
+ <label class="block text-verify-text text-sm font-medium mb-2">Date of Birth <span class="text-verify-teal">*</span></label>
314
+ <input
315
+ type="date"
316
+ name="dateOfBirth"
317
+ data-section="personal"
318
+ required
319
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm"
320
+ >
321
+ </div>
322
+
323
+ <div>
324
+ <label class="block text-verify-text text-sm font-medium mb-2">Phone Number <span class="text-verify-teal">*</span></label>
325
+ <input
326
+ type="tel"
327
+ name="phone"
328
+ data-section="personal"
329
+ required
330
+ placeholder="(555) 123-4567"
331
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400"
332
+ >
333
+ </div>
334
+
335
+ <div class="sm:col-span-2">
336
+ <label class="block text-verify-text text-sm font-medium mb-2">Email Address</label>
337
+ <input
338
+ type="email"
339
+ name="email"
340
+ data-section="personal"
341
+ placeholder="you@example.com"
342
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400"
343
+ >
344
+ </div>
345
+
346
+ <div class="sm:col-span-2">
347
+ <label class="block text-verify-text text-sm font-medium mb-2">Home Address</label>
348
+ <textarea
349
+ name="address"
350
+ data-section="personal"
351
+ rows="2"
352
+ placeholder="Street address, city, state, zip"
353
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400 resize-none"
354
+ ></textarea>
355
+ </div>
356
+ </div>
357
+ </section>
358
+
359
+ <!-- Emergency Contact -->
360
+ <section class="section-enter">
361
+ <div class="flex items-center gap-2 mb-4">
362
+ <div class="w-6 h-6 bg-verify-teal/10 rounded-lg flex items-center justify-center">
363
+ <i data-lucide="phone-call" class="w-3.5 h-3.5 text-verify-teal"></i>
364
+ </div>
365
+ <h3 class="text-verify-text font-semibold">Emergency Contact</h3>
366
+ <span class="text-verify-muted text-xs ml-auto" id="emergencyProgress">0/3</span>
367
+ </div>
368
+
369
+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
370
+ <div>
371
+ <label class="block text-verify-text text-sm font-medium mb-2">Contact Name</label>
372
+ <input
373
+ type="text"
374
+ name="emergencyName"
375
+ data-section="emergency"
376
+ placeholder="Full name"
377
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400"
378
+ >
379
+ </div>
380
+
381
+ <div>
382
+ <label class="block text-verify-text text-sm font-medium mb-2">Relationship</label>
383
+ <select
384
+ name="emergencyRelationship"
385
+ data-section="emergency"
386
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm"
387
+ >
388
+ <option value="">Select relationship</option>
389
+ <option value="spouse">Spouse/Partner</option>
390
+ <option value="parent">Parent</option>
391
+ <option value="child">Child</option>
392
+ <option value="sibling">Sibling</option>
393
+ <option value="friend">Friend</option>
394
+ <option value="other">Other</option>
395
+ </select>
396
+ </div>
397
+
398
+ <div class="sm:col-span-2">
399
+ <label class="block text-verify-text text-sm font-medium mb-2">Phone Number</label>
400
+ <input
401
+ type="tel"
402
+ name="emergencyPhone"
403
+ data-section="emergency"
404
+ placeholder="(555) 123-4567"
405
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400"
406
+ >
407
+ </div>
408
+ </div>
409
+ </section>
410
+
411
+ <!-- Insurance Information -->
412
+ <section class="section-enter">
413
+ <div class="flex items-center gap-2 mb-4">
414
+ <div class="w-6 h-6 bg-verify-teal/10 rounded-lg flex items-center justify-center">
415
+ <i data-lucide="credit-card" class="w-3.5 h-3.5 text-verify-teal"></i>
416
+ </div>
417
+ <h3 class="text-verify-text font-semibold">Insurance Information</h3>
418
+ <span class="text-verify-muted text-xs ml-auto" id="insuranceProgress">0/4</span>
419
+ </div>
420
+
421
+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
422
+ <div class="sm:col-span-2">
423
+ <label class="block text-verify-text text-sm font-medium mb-2">Insurance Provider</label>
424
+ <select
425
+ name="insuranceProvider"
426
+ data-section="insurance"
427
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm"
428
+ >
429
+ <option value="">Select provider</option>
430
+ <option value="aetna">Aetna</option>
431
+ <option value="anthem">Anthem</option>
432
+ <option value="bcbs">Blue Cross Blue Shield</option>
433
+ <option value="cigna">Cigna</option>
434
+ <option value="kaiser">Kaiser Permanente</option>
435
+ <option value="medicare">Medicare</option>
436
+ <option value="medicaid">Medicaid</option>
437
+ <option value="united">UnitedHealthcare</option>
438
+ <option value="self">Self-pay / No insurance</option>
439
+ <option value="other">Other</option>
440
+ </select>
441
+ </div>
442
+
443
+ <div>
444
+ <label class="block text-verify-text text-sm font-medium mb-2">Policy Number</label>
445
+ <input
446
+ type="text"
447
+ name="policyNumber"
448
+ data-section="insurance"
449
+ placeholder="XXX-XXX-XXX"
450
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400"
451
+ >
452
+ </div>
453
+
454
+ <div>
455
+ <label class="block text-verify-text text-sm font-medium mb-2">Group Number</label>
456
+ <input
457
+ type="text"
458
+ name="groupNumber"
459
+ data-section="insurance"
460
+ placeholder="Optional"
461
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400"
462
+ >
463
+ </div>
464
+
465
+ <div class="sm:col-span-2">
466
+ <label class="block text-verify-text text-sm font-medium mb-2">Policyholder Name (if not you)</label>
467
+ <input
468
+ type="text"
469
+ name="policyholderName"
470
+ data-section="insurance"
471
+ placeholder="Leave blank if same as patient"
472
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400"
473
+ >
474
+ </div>
475
+ </div>
476
+ </section>
477
+
478
+ <!-- Medical History -->
479
+ <section class="section-enter">
480
+ <div class="flex items-center gap-2 mb-4">
481
+ <div class="w-6 h-6 bg-verify-teal/10 rounded-lg flex items-center justify-center">
482
+ <i data-lucide="heart-pulse" class="w-3.5 h-3.5 text-verify-teal"></i>
483
+ </div>
484
+ <h3 class="text-verify-text font-semibold">Medical History</h3>
485
+ <span class="text-verify-muted text-xs ml-auto" id="medicalProgress">0/4</span>
486
+ </div>
487
+
488
+ <div class="space-y-4">
489
+ <div>
490
+ <label class="block text-verify-text text-sm font-medium mb-3">Current Medications</label>
491
+ <textarea
492
+ name="medications"
493
+ data-section="medical"
494
+ rows="2"
495
+ placeholder="List any medications you currently take (or type 'none')"
496
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400 resize-none"
497
+ ></textarea>
498
+ </div>
499
+
500
+ <div>
501
+ <label class="block text-verify-text text-sm font-medium mb-3">Allergies</label>
502
+ <div class="flex flex-wrap gap-2 mb-3">
503
+ <button type="button" onclick="toggleAllergy(this, 'Penicillin')" class="allergy-tag px-3 py-1.5 bg-gray-100 text-verify-muted text-sm rounded-lg border border-transparent hover:border-verify-teal/30 transition-all">Penicillin</button>
504
+ <button type="button" onclick="toggleAllergy(this, 'Sulfa drugs')" class="allergy-tag px-3 py-1.5 bg-gray-100 text-verify-muted text-sm rounded-lg border border-transparent hover:border-verify-teal/30 transition-all">Sulfa drugs</button>
505
+ <button type="button" onclick="toggleAllergy(this, 'Latex')" class="allergy-tag px-3 py-1.5 bg-gray-100 text-verify-muted text-sm rounded-lg border border-transparent hover:border-verify-teal/30 transition-all">Latex</button>
506
+ <button type="button" onclick="toggleAllergy(this, 'None')" class="allergy-tag px-3 py-1.5 bg-gray-100 text-verify-muted text-sm rounded-lg border border-transparent hover:border-verify-teal/30 transition-all">None</button>
507
+ </div>
508
+ <input
509
+ type="text"
510
+ name="allergies"
511
+ data-section="medical"
512
+ id="allergiesInput"
513
+ placeholder="Or type other allergies here"
514
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400"
515
+ >
516
+ </div>
517
+
518
+ <div>
519
+ <label class="block text-verify-text text-sm font-medium mb-3">Chronic Conditions</label>
520
+ <div class="grid grid-cols-2 sm:grid-cols-3 gap-2">
521
+ <label class="flex items-center gap-2 p-3 border border-verify-border rounded-xl cursor-pointer hover:border-verify-teal/30 transition-all">
522
+ <input type="checkbox" name="conditions" value="diabetes" data-section="medical" class="checkbox-custom">
523
+ <span class="text-verify-text text-sm">Diabetes</span>
524
+ </label>
525
+ <label class="flex items-center gap-2 p-3 border border-verify-border rounded-xl cursor-pointer hover:border-verify-teal/30 transition-all">
526
+ <input type="checkbox" name="conditions" value="hypertension" data-section="medical" class="checkbox-custom">
527
+ <span class="text-verify-text text-sm">Hypertension</span>
528
+ </label>
529
+ <label class="flex items-center gap-2 p-3 border border-verify-border rounded-xl cursor-pointer hover:border-verify-teal/30 transition-all">
530
+ <input type="checkbox" name="conditions" value="asthma" data-section="medical" class="checkbox-custom">
531
+ <span class="text-verify-text text-sm">Asthma</span>
532
+ </label>
533
+ <label class="flex items-center gap-2 p-3 border border-verify-border rounded-xl cursor-pointer hover:border-verify-teal/30 transition-all">
534
+ <input type="checkbox" name="conditions" value="heart-disease" data-section="medical" class="checkbox-custom">
535
+ <span class="text-verify-text text-sm">Heart Disease</span>
536
+ </label>
537
+ <label class="flex items-center gap-2 p-3 border border-verify-border rounded-xl cursor-pointer hover:border-verify-teal/30 transition-all">
538
+ <input type="checkbox" name="conditions" value="none" data-section="medical" class="checkbox-custom">
539
+ <span class="text-verify-text text-sm">None</span>
540
+ </label>
541
+ </div>
542
+ </div>
543
+
544
+ <div>
545
+ <label class="block text-verify-text text-sm font-medium mb-3">Previous Surgeries or Hospitalizations</label>
546
+ <textarea
547
+ name="surgeries"
548
+ data-section="medical"
549
+ rows="2"
550
+ placeholder="Briefly describe any major surgeries or hospital stays (or type 'none')"
551
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400 resize-none"
552
+ ></textarea>
553
+ </div>
554
+ </div>
555
+ </section>
556
+
557
+ <!-- Reason for Visit -->
558
+ <section class="section-enter">
559
+ <div class="flex items-center gap-2 mb-4">
560
+ <div class="w-6 h-6 bg-verify-teal/10 rounded-lg flex items-center justify-center">
561
+ <i data-lucide="clipboard-list" class="w-3.5 h-3.5 text-verify-teal"></i>
562
+ </div>
563
+ <h3 class="text-verify-text font-semibold">Reason for Visit</h3>
564
+ <span class="text-verify-muted text-xs ml-auto" id="visitProgress">0/2</span>
565
+ </div>
566
+
567
+ <div class="space-y-4">
568
+ <div>
569
+ <label class="block text-verify-text text-sm font-medium mb-3">Primary Reason <span class="text-verify-teal">*</span></label>
570
+ <select
571
+ name="visitReason"
572
+ data-section="visit"
573
+ required
574
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm"
575
+ >
576
+ <option value="">Select reason for visit</option>
577
+ <option value="annual">Annual physical/check-up</option>
578
+ <option value="new-patient">New patient consultation</option>
579
+ <option value="follow-up">Follow-up visit</option>
580
+ <option value="sick-visit">Sick visit / Urgent care</option>
581
+ <option value="specialist">Specialist referral</option>
582
+ <option value="procedure">Scheduled procedure</option>
583
+ <option value="other">Other</option>
584
+ </select>
585
+ </div>
586
+
587
+ <div>
588
+ <label class="block text-verify-text text-sm font-medium mb-2">Symptoms or Concerns (optional)</label>
589
+ <textarea
590
+ name="symptoms"
591
+ data-section="visit"
592
+ rows="3"
593
+ placeholder="Describe any symptoms, concerns, or questions you have for your provider..."
594
+ class="input-field w-full px-4 py-3 bg-white border border-verify-border rounded-xl text-verify-text text-sm placeholder:text-gray-400 resize-none"
595
+ ></textarea>
596
+ </div>
597
+ </div>
598
+ </section>
599
+
600
+ <!-- Consent -->
601
+ <section class="section-enter">
602
+ <div class="flex items-center gap-2 mb-4">
603
+ <div class="w-6 h-6 bg-verify-teal/10 rounded-lg flex items-center justify-center">
604
+ <i data-lucide="shield" class="w-3.5 h-3.5 text-verify-teal"></i>
605
+ </div>
606
+ <h3 class="text-verify-text font-semibold">Consent & Privacy</h3>
607
+ </div>
608
+
609
+ <div class="space-y-3">
610
+ <label class="flex items-start gap-3 p-4 border border-verify-border rounded-xl cursor-pointer hover:border-verify-teal/30 transition-all">
611
+ <input type="checkbox" name="consentTreatment" required class="checkbox-custom mt-0.5">
612
+ <div>
613
+ <span class="text-verify-text text-sm font-medium">Treatment Consent</span>
614
+ <p class="text-verify-muted text-xs mt-1">I consent to receive medical treatment and understand the risks and benefits.</p>
615
+ </div>
616
+ </label>
617
+
618
+ <label class="flex items-start gap-3 p-4 border border-verify-border rounded-xl cursor-pointer hover:border-verify-teal/30 transition-all">
619
+ <input type="checkbox" name="consentPrivacy" required class="checkbox-custom mt-0.5">
620
+ <div>
621
+ <span class="text-verify-text text-sm font-medium">Privacy Acknowledgment</span>
622
+ <p class="text-verify-muted text-xs mt-1">I understand my health information will be handled according to HIPAA regulations.</p>
623
+ </div>
624
+ </label>
625
+
626
+ <label class="flex items-start gap-3 p-4 border border-verify-border rounded-xl cursor-pointer hover:border-verify-teal/30 transition-all">
627
+ <input type="checkbox" name="consentCommunication" class="checkbox-custom mt-0.5">
628
+ <div>
629
+ <span class="text-verify-text text-sm font-medium">Communication Consent (optional)</span>
630
+ <p class="text-verify-muted text-xs mt-1">I consent to receive appointment reminders and health information via text/email.</p>
631
+ </div>
632
+ </label>
633
+ </div>
634
+ </section>
635
+
636
+ </form>
637
+ </div>
638
+
639
+ <!-- Sticky CTA -->
640
+ <div class="sticky-cta px-6 sm:px-8 pb-6 sm:pb-8">
641
+ <div class="flex items-center justify-between gap-4">
642
+ <div class="hidden sm:block">
643
+ <p class="text-verify-muted text-sm" id="completionText">0% complete</p>
644
+ <div class="w-32 h-1.5 bg-gray-200 rounded-full mt-1">
645
+ <div id="bottomProgress" class="progress-bar h-full bg-verify-teal rounded-full w-0"></div>
646
+ </div>
647
+ </div>
648
+ <div class="flex gap-3 flex-1 sm:flex-none">
649
+ <button
650
+ type="button"
651
+ onclick="saveDraft()"
652
+ class="btn-primary flex-1 sm:flex-none px-6 py-3.5 border border-verify-border text-verify-text font-medium text-sm rounded-xl hover:bg-gray-50"
653
+ >
654
+ Save for Later
655
+ </button>
656
+ <button
657
+ type="submit"
658
+ onclick="submitForm()"
659
+ class="btn-primary flex-1 sm:flex-none px-8 py-3.5 bg-verify-teal hover:bg-verify-teal-hover text-white font-semibold text-sm rounded-xl flex items-center justify-center gap-2"
660
+ >
661
+ <span>Submit Intake</span>
662
+ <i data-lucide="arrow-right" class="w-4 h-4"></i>
663
+ </button>
664
+ </div>
665
+ </div>
666
+ </div>
667
+
668
+ </div>
669
+
670
+ <!-- Footer -->
671
+ <footer class="mt-8 text-center">
672
+ <p class="text-verify-muted text-sm">
673
+ Secured by Verify MC • <a href="#" class="text-verify-teal hover:underline">Privacy Policy</a> • <a href="#" class="text-verify-teal hover:underline">Terms</a>
674
+ </p>
675
+ </footer>
676
+
677
+ </div>
678
+ </main>
679
+
680
+ <!-- Success Modal -->
681
+ <div id="successModal" class="fixed inset-0 bg-black/50 backdrop-blur-sm hidden items-center justify-center z-50 p-4">
682
+ <div class="bg-white rounded-2xl p-8 max-w-md w-full text-center section-enter">
683
+ <div class="w-16 h-16 bg-verify-teal/10 rounded-2xl flex items-center justify-center mx-auto mb-4">
684
+ <i data-lucide="check-circle" class="w-8 h-8 text-verify-teal"></i>
685
+ </div>
686
+ <h3 class="text-verify-text text-xl font-semibold mb-2">Intake Submitted!</h3>
687
+ <p class="text-verify-muted mb-6">Your information has been securely sent to your healthcare provider. You should receive a confirmation shortly.</p>
688
+ <button onclick="closeModal()" class="btn-primary w-full py-3.5 bg-verify-teal hover:bg-verify-teal-hover text-white font-semibold text-sm rounded-xl">
689
+ Done
690
+ </button>
691
+ </div>
692
+ </div>
693
+
694
+ <!-- Draft Saved Toast -->
695
+ <div id="toast" class="fixed bottom-4 left-1/2 -translate-x-1/2 bg-verify-text text-white px-6 py-3 rounded-xl shadow-lg hidden items-center gap-2 z-50">
696
+ <i data-lucide="check" class="w-4 h-4 text-verify-teal"></i>
697
+ <span class="text-sm" id="toastMessage">Draft saved</span>
698
+ </div>
699
+
700
+ <script src="script.js"></script>
701
+ <script>
702
+ lucide.createIcons();
703
+ </script>
704
+ <script src="https://deepsite.hf.co/deepsite-badge.js"></script>
705
+ </body>
706
+ </html>
script.js ADDED
@@ -0,0 +1,514 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Verify MC Patient Intake Widget
2
+ // Production-grade, conversion-optimized form with AI assistance
3
+
4
+ (function() {
5
+ 'use strict';
6
+
7
+ // State management
8
+ const state = {
9
+ formData: {},
10
+ aiProcessing: false,
11
+ sections: {
12
+ personal: { fields: 5, filled: 0 },
13
+ emergency: { fields: 3, filled: 0 },
14
+ insurance: { fields: 4, filled: 0 },
15
+ medical: { fields: 4, filled: 0 },
16
+ visit: { fields: 2, filled: 0 }
17
+ },
18
+ totalFields: 18,
19
+ filledFields: 0
20
+ };
21
+
22
+ // Initialize
23
+ document.addEventListener('DOMContentLoaded', init);
24
+
25
+ function init() {
26
+ loadSavedData();
27
+ attachEventListeners();
28
+ updateProgress();
29
+ initializePhoneFormatting();
30
+ }
31
+
32
+ // Event Listeners
33
+ function attachEventListeners() {
34
+ const form = document.getElementById('intakeForm');
35
+ const inputs = form.querySelectorAll('input, select, textarea');
36
+
37
+ inputs.forEach(input => {
38
+ // Real-time validation and progress
39
+ input.addEventListener('blur', () => validateField(input));
40
+ input.addEventListener('input', () => {
41
+ updateFieldStatus(input);
42
+ debouncedProgressUpdate();
43
+ });
44
+
45
+ // AI suggestion on focus for certain fields
46
+ if (input.name === 'symptoms' || input.name === 'medications') {
47
+ input.addEventListener('focus', () => showAIHint(input));
48
+ }
49
+ });
50
+
51
+ // Enter key in AI input
52
+ document.getElementById('aiInput').addEventListener('keypress', (e) => {
53
+ if (e.key === 'Enter') processAIInput();
54
+ });
55
+
56
+ // Form submission prevention
57
+ form.addEventListener('submit', (e) => {
58
+ e.preventDefault();
59
+ submitForm();
60
+ });
61
+ }
62
+
63
+ // Phone number formatting
64
+ function initializePhoneFormatting() {
65
+ const phoneInputs = document.querySelectorAll('input[type="tel"]');
66
+ phoneInputs.forEach(input => {
67
+ input.addEventListener('input', (e) => {
68
+ let value = e.target.value.replace(/\D/g, '');
69
+ if (value.length >= 6) {
70
+ value = `(${value.slice(0, 3)}) ${value.slice(3, 6)}-${value.slice(6, 10)}`;
71
+ } else if (value.length >= 3) {
72
+ value = `(${value.slice(0, 3)}) ${value.slice(3)}`;
73
+ }
74
+ e.target.value = value;
75
+ });
76
+ });
77
+ }
78
+
79
+ // Field validation
80
+ function validateField(input) {
81
+ const isRequired = input.hasAttribute('required');
82
+ const isEmpty = !input.value.trim();
83
+
84
+ if (isRequired && isEmpty) {
85
+ input.classList.add('error');
86
+ showFieldError(input, 'This field is required');
87
+ } else if (input.type === 'email' && input.value && !isValidEmail(input.value)) {
88
+ input.classList.add('error');
89
+ showFieldError(input, 'Please enter a valid email');
90
+ } else {
91
+ input.classList.remove('error');
92
+ clearFieldError(input);
93
+ }
94
+ }
95
+
96
+ function isValidEmail(email) {
97
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
98
+ }
99
+
100
+ function showFieldError(input, message) {
101
+ clearFieldError(input);
102
+ const error = document.createElement('p');
103
+ error.className = 'field-error text-verify-error text-xs mt-1.5 flex items-center gap-1';
104
+ error.innerHTML = `<i data-lucide="alert-circle" class="w-3 h-3"></i>${message}`;
105
+ input.parentNode.appendChild(error);
106
+ lucide.createIcons();
107
+ }
108
+
109
+ function clearFieldError(input) {
110
+ const existing = input.parentNode.querySelector('.field-error');
111
+ if (existing) existing.remove();
112
+ }
113
+
114
+ // Progress tracking
115
+ function updateFieldStatus(input) {
116
+ const section = input.dataset.section;
117
+ if (!section) return;
118
+
119
+ const isFilled = input.type === 'checkbox'
120
+ ? input.checked
121
+ : input.value.trim().length > 0;
122
+
123
+ state.formData[input.name] = isFilled ? input.value : null;
124
+
125
+ // Auto-save to localStorage
126
+ debouncedSave();
127
+ }
128
+
129
+ let progressDebounceTimer;
130
+ function debouncedProgressUpdate() {
131
+ clearTimeout(progressDebounceTimer);
132
+ progressDebounceTimer = setTimeout(updateProgress, 100);
133
+ }
134
+
135
+ function updateProgress() {
136
+ const sections = ['personal', 'emergency', 'insurance', 'medical', 'visit'];
137
+ let totalFilled = 0;
138
+ let totalCount = 0;
139
+
140
+ sections.forEach(sectionKey => {
141
+ const sectionEl = document.querySelector(`[data-section="${sectionKey}"]`)?.closest('section');
142
+ if (!sectionEl) return;
143
+
144
+ const fields = sectionEl.querySelectorAll('input, select, textarea');
145
+ let filled = 0;
146
+ let count = 0;
147
+
148
+ fields.forEach(field => {
149
+ // Skip checkboxes for simple counting, focus on text inputs
150
+ if (field.type === 'checkbox') return;
151
+
152
+ count++;
153
+ totalCount++;
154
+
155
+ const isFilled = field.value.trim().length > 0;
156
+ if (isFilled) {
157
+ filled++;
158
+ totalFilled++;
159
+ }
160
+ });
161
+
162
+ // Update section progress indicator
163
+ const progressEl = document.getElementById(`${sectionKey}Progress`);
164
+ if (progressEl) {
165
+ progressEl.textContent = `${filled}/${count}`;
166
+ if (filled === count) {
167
+ progressEl.className = 'text-verify-teal text-xs ml-auto font-medium';
168
+ } else {
169
+ progressEl.className = 'text-verify-muted text-xs ml-auto';
170
+ }
171
+ }
172
+ });
173
+
174
+ // Update main progress bars
175
+ const percentage = Math.round((totalFilled / totalCount) * 100) || 0;
176
+
177
+ document.getElementById('progressBar').style.width = `${percentage}%`;
178
+ document.getElementById('bottomProgress').style.width = `${percentage}%`;
179
+ document.getElementById('completionText').textContent = `${percentage}% complete`;
180
+
181
+ // Visual feedback on completion milestones
182
+ if (percentage === 100 && !state.completedShown) {
183
+ state.completedShown = true;
184
+ showToast('All fields completed! Ready to submit.');
185
+ }
186
+ }
187
+
188
+ // AI Processing
189
+ window.processAIInput = async function() {
190
+ const input = document.getElementById('aiInput');
191
+ const btn = document.getElementById('aiTryBtn');
192
+ const suggestions = document.getElementById('aiSuggestions');
193
+
194
+ const text = input.value.trim();
195
+ if (!text) return;
196
+
197
+ // Show processing state
198
+ state.aiProcessing = true;
199
+ btn.disabled = true;
200
+ btn.innerHTML = `<i data-lucide="loader-2" class="w-4 h-4 animate-spin"></i><span>Processing...</span>`;
201
+ lucide.createIcons();
202
+
203
+ // Simulate AI processing (in production, this would call an API)
204
+ await new Promise(r => setTimeout(r, 1500));
205
+
206
+ // Parse and extract information
207
+ const extracted = extractInfoFromText(text);
208
+
209
+ // Display suggestions
210
+ displayAISuggestions(extracted, suggestions);
211
+
212
+ // Reset button
213
+ btn.disabled = false;
214
+ btn.innerHTML = `<i data-lucide="wand-2" class="w-4 h-4"></i><span class="hidden sm:inline">Try it</span>`;
215
+ lucide.createIcons();
216
+ state.aiProcessing = false;
217
+ };
218
+
219
+ function extractInfoFromText(text) {
220
+ const info = {};
221
+ const lower = text.toLowerCase();
222
+
223
+ // Name extraction
224
+ const nameMatch = text.match(/(?:name is|i am|my name is)\s+([A-Z][a-z]+(?:\s+[A-Z][a-z]+)+)/i) ||
225
+ text.match(/^([A-Z][a-z]+(?:\s+[A-Z][a-z]+)+)/);
226
+ if (nameMatch) info.fullName = nameMatch[1];
227
+
228
+ // Date extraction (various formats)
229
+ const dateMatch = text.match(/(?:born|birth|dob|birthday)[\s,]*([A-Za-z]+\s+\d{1,2}[,.]?\s*\d{4}|\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4})/i);
230
+ if (dateMatch) {
231
+ info.dateOfBirth = parseDate(dateMatch[1]);
232
+ }
233
+
234
+ // Phone extraction
235
+ const phoneMatch = text.match(/(\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4})/);
236
+ if (phoneMatch) info.phone = phoneMatch[1];
237
+
238
+ // Email extraction
239
+ const emailMatch = text.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/);
240
+ if (emailMatch) info.email = emailMatch[1];
241
+
242
+ // Allergies
243
+ if (lower.includes('allergic to') || lower.includes('allergy')) {
244
+ const allergyMatch = text.match(/allergic to\s+([^,.]+)/i);
245
+ if (allergyMatch) info.allergies = allergyMatch[1];
246
+ }
247
+
248
+ // Medications
249
+ if (lower.includes('take') || lower.includes('medication')) {
250
+ const medMatch = text.match(/(?:take|taking|on)\s+([^,.]+(?:mg|daily|twice|once)[^,.]*)/i);
251
+ if (medMatch) info.medications = medMatch[1];
252
+ }
253
+
254
+ // Insurance
255
+ const insuranceKeywords = {
256
+ 'aetna': 'aetna',
257
+ 'anthem': 'anthem',
258
+ 'blue cross': 'bcbs',
259
+ 'bluecross': 'bcbs',
260
+ 'cigna': 'cigna',
261
+ 'kaiser': 'kaiser',
262
+ 'medicare': 'medicare',
263
+ 'medicaid': 'medicaid',
264
+ 'united': 'united'
265
+ };
266
+
267
+ for (const [keyword, value] of Object.entries(insuranceKeywords)) {
268
+ if (lower.includes(keyword)) {
269
+ info.insuranceProvider = value;
270
+ break;
271
+ }
272
+ }
273
+
274
+ // Conditions
275
+ const conditions = [];
276
+ if (lower.includes('diabetes')) conditions.push('diabetes');
277
+ if (lower.includes('hypertension') || lower.includes('high blood pressure')) conditions.push('hypertension');
278
+ if (lower.includes('asthma')) conditions.push('asthma');
279
+ if (lower.includes('heart')) conditions.push('heart-disease');
280
+ if (conditions.length) info.conditions = conditions;
281
+
282
+ return info;
283
+ }
284
+
285
+ function parseDate(dateStr) {
286
+ // Try to parse various date formats and return YYYY-MM-DD
287
+ const tryParse = new Date(dateStr);
288
+ if (!isNaN(tryParse)) {
289
+ return tryParse.toISOString().split('T')[0];
290
+ }
291
+ return null;
292
+ }
293
+
294
+ function displayAISuggestions(extracted, container) {
295
+ container.innerHTML = '';
296
+ container.classList.remove('hidden');
297
+
298
+ const suggestions = Object.entries(extracted).filter(([key, value]) => value);
299
+
300
+ if (suggestions.length === 0) {
301
+ container.innerHTML = `
302
+ <div class="ai-suggestion p-3 bg-amber-50 border border-amber-200 rounded-xl flex items-center gap-2">
303
+ <i data-lucide="alert-circle" class="w-4 h-4 text-amber-600"></i>
304
+ <span class="text-amber-800 text-sm">We couldn't extract specific information. Try being more specific with names, dates, and numbers.</span>
305
+ </div>
306
+ `;
307
+ lucide.createIcons();
308
+ return;
309
+ }
310
+
311
+ suggestions.forEach(([field, value]) => {
312
+ const div = document.createElement('div');
313
+ div.className = 'ai-suggestion p-3 bg-white border border-verify-teal/30 rounded-xl flex items-center justify-between gap-3';
314
+
315
+ const displayField = field.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase());
316
+ const displayValue = Array.isArray(value) ? value.join(', ') : value;
317
+
318
+ div.innerHTML = `
319
+ <div class="flex items-center gap-2 flex-1">
320
+ <i data-lucide="check-circle-2" class="w-4 h-4 text-verify-teal flex-shrink-0"></i>
321
+ <div class="min-w-0">
322
+ <span class="text-verify-muted text-xs">${displayField}</span>
323
+ <p class="text-verify-text text-sm font-medium truncate">${displayValue}</p>
324
+ </div>
325
+ </div>
326
+ <button onclick="applyAIValue('${field}', '${Array.isArray(value) ? value.join(',') : value}')"
327
+ class="px-3 py-1.5 bg-verify-teal text-white text-xs font-medium rounded-lg hover:bg-verify-teal-hover transition-colors flex-shrink-0">
328
+ Apply
329
+ </button>
330
+ `;
331
+ container.appendChild(div);
332
+ });
333
+
334
+ lucide.createIcons();
335
+ }
336
+
337
+ window.applyAIValue = function(field, value) {
338
+ const input = document.querySelector(`[name="${field}"]`);
339
+ if (!input) return;
340
+
341
+ if (field === 'conditions') {
342
+ const conditions = value.split(',');
343
+ conditions.forEach(c => {
344
+ const checkbox = document.querySelector(`[name="conditions"][value="${c}"]`);
345
+ if (checkbox) checkbox.checked = true;
346
+ });
347
+ } else {
348
+ input.value = value;
349
+ }
350
+
351
+ updateFieldStatus(input);
352
+ updateProgress();
353
+
354
+ // Remove applied suggestion
355
+ const suggestions = document.getElementById('aiSuggestions');
356
+ const applied = suggestions.querySelector(`button[onclick*="${field}"]`)?.closest('.ai-suggestion');
357
+ if (applied) {
358
+ applied.style.opacity = '0.5';
359
+ applied.querySelector('button').textContent = 'Applied';
360
+ applied.querySelector('button').disabled = true;
361
+ }
362
+
363
+ showToast(`${field.replace(/([A-Z])/g, ' $1')} applied`);
364
+ };
365
+
366
+ // Allergy tag toggle
367
+ window.toggleAllergy = function(btn, allergy) {
368
+ const input = document.getElementById('allergiesInput');
369
+ const current = input.value.split(',').map(s => s.trim()).filter(s => s);
370
+
371
+ if (btn.classList.contains('bg-verify-teal')) {
372
+ // Remove
373
+ btn.classList.remove('bg-verify-teal', 'text-white');
374
+ btn.classList.add('bg-gray-100', 'text-verify-muted');
375
+ const idx = current.indexOf(allergy);
376
+ if (idx > -1) current.splice(idx, 1);
377
+ } else {
378
+ // Add
379
+ btn.classList.remove('bg-gray-100', 'text-verify-muted');
380
+ btn.classList.add('bg-verify-teal', 'text-white');
381
+ if (!current.includes(allergy)) current.push(allergy);
382
+ }
383
+
384
+ input.value = current.join(', ');
385
+ updateFieldStatus(input);
386
+ };
387
+
388
+ // Form submission
389
+ window.submitForm = async function() {
390
+ const form = document.getElementById('intakeForm');
391
+ const required = form.querySelectorAll('[required]');
392
+ let valid = true;
393
+
394
+ required.forEach(field => {
395
+ validateField(field);
396
+ if (!field.value.trim()) valid = false;
397
+ });
398
+
399
+ if (!valid) {
400
+ showToast('Please fill in all required fields');
401
+ // Scroll to first error
402
+ const firstError = form.querySelector('.error');
403
+ if (firstError) {
404
+ firstError.scrollIntoView({ behavior: 'smooth', block: 'center' });
405
+ firstError.focus();
406
+ }
407
+ return;
408
+ }
409
+
410
+ // Simulate submission
411
+ const submitBtn = document.querySelector('button[type="submit"]');
412
+ const originalText = submitBtn.innerHTML;
413
+ submitBtn.disabled = true;
414
+ submitBtn.innerHTML = `<i data-lucide="loader-2" class="w-4 h-4 animate-spin"></i><span>Submitting...</span>`;
415
+ lucide.createIcons();
416
+
417
+ await new Promise(r => setTimeout(r, 2000));
418
+
419
+ // Clear saved data
420
+ localStorage.removeItem('verifyMC_intakeDraft');
421
+
422
+ // Show success
423
+ document.getElementById('successModal').classList.remove('hidden');
424
+ document.getElementById('successModal').classList.add('flex');
425
+ };
426
+
427
+ window.closeModal = function() {
428
+ document.getElementById('successModal').classList.add('hidden');
429
+ document.getElementById('successModal').classList.remove('flex');
430
+ // Reset form
431
+ document.getElementById('intakeForm').reset();
432
+ updateProgress();
433
+ };
434
+
435
+ // Draft saving
436
+ window.saveDraft = function() {
437
+ const form = document.getElementById('intakeForm');
438
+ const data = new FormData(form);
439
+ const saved = {};
440
+
441
+ for (const [key, value] of data.entries()) {
442
+ if (saved[key]) {
443
+ if (!Array.isArray(saved[key])) saved[key] = [saved[key]];
444
+ saved[key].push(value);
445
+ } else {
446
+ saved[key] = value;
447
+ }
448
+ }
449
+
450
+ localStorage.setItem('verifyMC_intakeDraft', JSON.stringify(saved));
451
+ showToast('Draft saved — you can return anytime');
452
+ };
453
+
454
+ function loadSavedData() {
455
+ const saved = localStorage.getItem('verifyMC_intakeDraft');
456
+ if (!saved) return;
457
+
458
+ try {
459
+ const data = JSON.parse(saved);
460
+ Object.entries(data).forEach(([key, value]) => {
461
+ const field = document.querySelector(`[name="${key}"]`);
462
+ if (!field) return;
463
+
464
+ if (field.type === 'checkbox') {
465
+ field.checked = true;
466
+ } else if (Array.isArray(value)) {
467
+ // Handle multi-select checkboxes
468
+ value.forEach(v => {
469
+ const cb = document.querySelector(`[name="${key}"][value="${v}"]`);
470
+ if (cb) cb.checked = true;
471
+ });
472
+ } else {
473
+ field.value = value;
474
+ }
475
+ });
476
+ } catch (e) {
477
+ console.error('Failed to load saved data:', e);
478
+ }
479
+ }
480
+
481
+ let saveDebounceTimer;
482
+ function debouncedSave() {
483
+ clearTimeout(saveDebounceTimer);
484
+ saveDebounceTimer = setTimeout(() => {
485
+ const form = document.getElementById('intakeForm');
486
+ const data = new FormData(form);
487
+ const saved = {};
488
+ for (const [key, value] of data.entries()) {
489
+ saved[key] = value;
490
+ }
491
+ localStorage.setItem('verifyMC_intakeDraft', JSON.stringify(saved));
492
+ }, 2000);
493
+ }
494
+
495
+ // Toast notifications
496
+ function showToast(message) {
497
+ const toast = document.getElementById('toast');
498
+ document.getElementById('toastMessage').textContent = message;
499
+ toast.classList.remove('hidden');
500
+ toast.classList.add('flex');
501
+
502
+ setTimeout(() => {
503
+ toast.classList.add('hidden');
504
+ toast.classList.remove('flex');
505
+ }, 3000);
506
+ }
507
+
508
+ // AI hints for specific fields
509
+ function showAIHint(input) {
510
+ // Could show contextual AI suggestions based on field type
511
+ // Currently minimal to avoid intrusion
512
+ }
513
+
514
+ })();