-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.html
More file actions
597 lines (547 loc) · 23.6 KB
/
admin.html
File metadata and controls
597 lines (547 loc) · 23.6 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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>[RE]Print Studios - Admin Portal</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="admin.css">
<link rel="stylesheet" href="components/admin/FormBuilder.css">
<link rel="stylesheet" href="styles/admin-modules.css">
<script type="module">
import { AdminPortal } from './components/admin/AdminPortal.js';
document.addEventListener('DOMContentLoaded', async () => {
console.log('🚀 Initializing Admin Portal...');
try {
window.adminDashboard = new AdminPortal();
window.admin = window.adminDashboard; // Backward compatibility
window.adminPortal = window.adminDashboard; // Backward compatibility
await window.adminDashboard.init();
console.log('✅ Admin Portal initialized successfully');
// Global function mappings for backward compatibility
window.showNewClientForm = () => window.admin.modules.clients?.showClientModal();
window.showNewProjectForm = () => window.admin.modules.clients?.showProjectModal();
window.showNewInvoiceForm = () => window.admin.modules.clients?.showInvoiceModal();
window.uploadFiles = () => window.admin.modules.clients?.showFileUploadModal();
} catch (error) {
console.error('❌ Failed to initialize Admin Portal:', error);
}
});
</script>
</head>
<body>
<!-- Login Section (shown by default) -->
<div id="login-section" class="login-container">
<div class="login-card">
<h1>[Admin Access]</h1>
<p class="subtitle">Secure portal for system management</p>
<form id="admin-login-form">
<div class="form-group">
<label for="email">Email</label>
<input
type="email"
id="email"
name="email"
required
placeholder="admin@kendrickforrest.com"
autocomplete="email"
>
</div>
<div class="form-group">
<label for="password">Password</label>
<input
type="password"
id="password"
name="password"
required
placeholder="••••••••"
autocomplete="current-password"
>
</div>
<div class="form-group remember-me">
<label>
<input type="checkbox" name="remember" id="remember">
<span>Remember me for 30 days</span>
</label>
</div>
<div id="admin-login-error" class="login-error" style="display: none;"></div>
<button type="submit" class="btn-primary">
<span id="button-text">Access Admin Portal</span>
</button>
</form>
<div class="login-footer">
<a href="/" class="back-link">← Back to main site</a>
</div>
</div>
</div>
<!-- Admin Dashboard (hidden by default) -->
<div id="admin-dashboard" class="admin-dashboard hidden">
<!-- Header -->
<header class="admin-header">
<div class="header-content">
<h1>[Admin Dashboard]</h1>
<nav class="admin-nav">
<a href="#overview" class="nav-link active">Overview</a>
<a href="#clients" class="nav-link">Clients</a>
<a href="#projects" class="nav-link">Projects</a>
<a href="#invoices" class="nav-link">Invoices</a>
<a href="#files" class="nav-link">Files</a>
<a href="#messages" class="nav-link">Messages</a>
<a href="#inquiries" class="nav-link">Inquiries</a>
<a href="#phases" class="nav-link">Phase Management</a>
<a href="#settings" class="nav-link">Settings</a>
</nav>
<button id="logout-btn" class="btn-secondary">Logout</button>
</div>
</header>
<!-- Main Content -->
<main class="admin-content">
<!-- Overview Section -->
<section id="overview" class="admin-section active">
<h2>[System Overview]</h2>
<div class="stats-grid">
<div class="stat-card">
<h3>12</h3>
<p>Active Clients</p>
</div>
<div class="stat-card">
<h3>8</h3>
<p>Active Projects</p>
</div>
<div class="stat-card">
<h3>$45,250</h3>
<p>Revenue This Month</p>
</div>
<div class="stat-card">
<h3>3</h3>
<p>Pending Invoices</p>
</div>
</div>
<div class="recent-activity">
<h3>[Recent Activity]</h3>
<div class="activity-list">
<div class="activity-item">
<span class="activity-time">2 hours ago</span>
<span class="activity-text">New client registered: Tech Startup Inc.</span>
</div>
<div class="activity-item">
<span class="activity-time">5 hours ago</span>
<span class="activity-text">Invoice #1024 paid by Creative Agency</span>
</div>
<div class="activity-item">
<span class="activity-time">1 day ago</span>
<span class="activity-text">Project "Brand Redesign" updated to 75% complete</span>
</div>
</div>
</div>
</section>
<!-- Clients Section -->
<section id="clients" class="admin-section">
<div class="section-header">
<h2>[Client Management]</h2>
<div class="section-controls">
<input type="text" class="search-input" data-section="clients" placeholder="Search clients...">
<select class="status-filter" data-section="clients">
<option value="active">Active</option>
<option value="inactive">Inactive</option>
<option value="all">All</option>
</select>
<button class="btn-primary" onclick="showNewClientForm()">+ New Client</button>
</div>
</div>
<div class="clients-table">
<table>
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Projects</th>
<th>Total Spent</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="clients-list">
<!-- Clients will be loaded here -->
</tbody>
</table>
</div>
<div id="clients-pagination"></div>
</section>
<!-- Projects Section -->
<section id="projects" class="admin-section">
<div class="section-header">
<h2>[Project Management]</h2>
<div class="section-controls">
<input type="text" class="search-input" data-section="projects" placeholder="Search projects...">
<select class="status-filter" data-section="projects">
<option value="all">All Status</option>
<option value="planning">Planning</option>
<option value="in_progress">In Progress</option>
<option value="review">Review</option>
<option value="completed">Completed</option>
<option value="on_hold">On Hold</option>
</select>
<button class="btn-primary" onclick="showNewProjectForm()">+ New Project</button>
</div>
</div>
<div class="projects-grid" id="projects-list">
<!-- Projects will be loaded here -->
</div>
<div id="projects-pagination"></div>
</section>
<!-- Invoices Section -->
<section id="invoices" class="admin-section">
<div class="section-header">
<h2>[Invoice Management]</h2>
<div class="section-controls">
<select class="status-filter" data-section="invoices">
<option value="all">All Status</option>
<option value="draft">Draft</option>
<option value="sent">Sent</option>
<option value="paid">Paid</option>
<option value="overdue">Overdue</option>
<option value="cancelled">Cancelled</option>
</select>
<button class="btn-primary" onclick="showNewInvoiceForm()">+ Create Invoice</button>
</div>
</div>
<div class="invoices-table">
<table>
<thead>
<tr>
<th>Invoice #</th>
<th>Client</th>
<th>Amount</th>
<th>Date</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="invoices-list">
<!-- Invoices will be loaded here -->
</tbody>
</table>
</div>
<div id="invoices-pagination"></div>
</section>
<!-- Files Section -->
<section id="files" class="admin-section">
<div class="section-header">
<h2>[File Management]</h2>
<button class="btn-primary" onclick="uploadFiles()">+ Upload Files</button>
</div>
<div class="files-grid" id="files-list">
<!-- Files will be loaded here -->
</div>
<div id="files-pagination"></div>
</section>
<!-- Messages Section -->
<section id="messages" class="admin-section">
<div class="section-header">
<h2>[Message System]</h2>
<button class="btn-primary" onclick="window.adminPortal.showComposeMessageModal()">+ New Message</button>
</div>
<div class="messages-container" id="messages-list">
<!-- Messages will be loaded here -->
</div>
<div id="messages-pagination"></div>
</section>
<!-- Inquiries Section -->
<section id="inquiries" class="admin-section">
<div class="section-header">
<h2>[Client Inquiries]</h2>
<div class="section-filters">
<select class="status-filter" data-section="inquiries">
<option value="all">All Status</option>
<option value="new">New</option>
<option value="in-progress">In Progress</option>
<option value="contacted">Contacted</option>
<option value="converted">Converted</option>
<option value="closed">Closed</option>
</select>
</div>
</div>
<div class="inquiries-table">
<table>
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Company</th>
<th>Project Type</th>
<th>Budget</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody id="inquiries-list">
<!-- Inquiries will be loaded here -->
</tbody>
</table>
</div>
<div id="inquiries-pagination"></div>
</section>
<!-- Phase Management Section -->
<section id="phases" class="admin-section">
<div class="section-header">
<h2>[Phase Management]</h2>
<div class="section-controls">
<select class="status-filter" data-section="phases" id="phase-filter">
<option value="all">All Phases</option>
<option value="onboarding">Onboarding</option>
<option value="ideation">Ideation</option>
<option value="design">Design</option>
<option value="review">Review & Feedback</option>
<option value="production">Production/Print</option>
<option value="payment">Payment</option>
<option value="signoff">Sign-off & Docs</option>
<option value="delivery">Delivery</option>
</select>
<button class="btn-primary" onclick="window.adminPortal.showBulkPhaseUpdateModal()">Bulk Update</button>
<button class="btn-secondary" onclick="window.adminPortal.exportPhaseReport()">Export Report</button>
</div>
</div>
<!-- Phase Analytics Overview -->
<div class="phase-analytics-overview">
<div class="analytics-grid">
<div class="analytic-card">
<div class="metric-value" id="stuck-projects-count">-</div>
<div class="metric-label">Stuck Projects</div>
<div class="metric-subtitle">Over 7 days in phase</div>
</div>
<div class="analytic-card">
<div class="metric-value" id="avg-phase-time">-</div>
<div class="metric-label">Avg Phase Time</div>
<div class="metric-subtitle">Days per phase</div>
</div>
<div class="analytic-card">
<div class="metric-value" id="bottleneck-phase">-</div>
<div class="metric-label">Bottleneck Phase</div>
<div class="metric-subtitle">Most delayed phase</div>
</div>
<div class="analytic-card">
<div class="metric-value" id="completion-rate">-</div>
<div class="metric-label">Completion Rate</div>
<div class="metric-subtitle">Projects completed on time</div>
</div>
</div>
</div>
<!-- Phase Distribution Chart -->
<div class="phase-distribution">
<h3>[Projects by Phase]</h3>
<div class="phase-chart" id="phase-distribution-chart">
<!-- Chart will be populated by JavaScript -->
</div>
</div>
<!-- Projects by Phase List -->
<div class="phase-projects-container">
<div class="phase-projects-grid" id="phase-projects-list">
<!-- Projects grouped by phase will be loaded here -->
</div>
</div>
<!-- Phase Automation Rules -->
<div class="phase-automation-section">
<div class="section-sub-header">
<h3>[Automation Rules]</h3>
<button class="btn-secondary" onclick="window.adminPortal.showPhaseRuleModal()">+ Add Rule</button>
</div>
<div class="automation-rules-list" id="automation-rules-list">
<!-- Automation rules will be loaded here -->
</div>
</div>
</section>
<!-- Settings Section -->
<section id="settings" class="admin-section">
<h2>[System Settings]</h2>
<div class="settings-grid">
<div class="setting-card">
<h3>Profile Settings</h3>
<p>Update admin profile and credentials</p>
<button class="btn-secondary">Edit Profile</button>
</div>
<div class="setting-card">
<h3>Email Templates</h3>
<p>Customize automated email messages</p>
<button class="btn-secondary" onclick="window.adminPortal.showEmailTemplates()">Manage Templates</button>
</div>
<div class="setting-card">
<h3>Service Types & Forms</h3>
<p>Manage services, phases, and dynamic forms</p>
<button class="btn-secondary" onclick="window.adminPortal.showServiceManager()">Manage Services</button>
</div>
<div class="setting-card">
<h3>Payment Settings</h3>
<p>Configure Stripe and payment options</p>
<button class="btn-secondary">Payment Config</button>
</div>
<div class="setting-card">
<h3>Backup & Export</h3>
<p>Backup data and export reports</p>
<button class="btn-secondary">Backup Now</button>
</div>
</div>
</section>
<!-- Email Templates Section -->
<section id="email-templates" class="admin-section" style="display: none;">
<h2>[Email Templates Manager]</h2>
<div class="template-manager-container">
<div class="template-sidebar">
<h3>Available Templates</h3>
<div id="template-list" class="template-list">
<!-- Template list will be populated here -->
</div>
</div>
<div class="template-editor">
<div class="editor-header">
<h3 id="template-name">Select a template</h3>
<div class="editor-actions">
<button class="btn-secondary" onclick="window.adminPortal.previewEmailTemplate()" disabled id="preview-btn">Preview</button>
<button class="btn-primary" onclick="window.adminPortal.saveEmailTemplate()" disabled id="save-template-btn">Save Template</button>
</div>
</div>
<div class="editor-content">
<div class="template-info" id="template-info" style="display: none;">
<div class="form-group">
<label>Subject Line</label>
<input type="text" id="template-subject" class="form-control" readonly>
</div>
<div class="form-group">
<label>Available Variables</label>
<div id="template-variables" class="variable-list"></div>
</div>
</div>
<div class="form-group">
<label>Template HTML</label>
<div class="editor-toolbar">
<button type="button" class="toolbar-btn" onclick="window.adminPortal.insertEmailElement('heading')" title="Insert Heading">
<strong>H</strong>
</button>
<button type="button" class="toolbar-btn" onclick="window.adminPortal.insertEmailElement('paragraph')" title="Insert Paragraph">
¶
</button>
<button type="button" class="toolbar-btn" onclick="window.adminPortal.insertEmailElement('button')" title="Insert Button">
[Button]
</button>
<button type="button" class="toolbar-btn" onclick="window.adminPortal.insertEmailElement('divider')" title="Insert Divider">
—
</button>
<span class="toolbar-separator"></span>
<button type="button" class="toolbar-btn" onclick="window.adminPortal.insertEmailElement('loop')" title="Insert Loop">
{{#each}}
</button>
<button type="button" class="toolbar-btn" onclick="window.adminPortal.insertEmailElement('condition')" title="Insert Condition">
{{#if}}
</button>
<button type="button" class="toolbar-btn" onclick="window.adminPortal.insertEmailElement('date')" title="Format Date">
📅
</button>
<button type="button" class="toolbar-btn" onclick="window.adminPortal.insertEmailElement('currency')" title="Format Currency">
$
</button>
</div>
<textarea id="template-editor" class="code-editor" rows="20" placeholder="Select a template to edit"></textarea>
</div>
</div>
</div>
<div class="template-preview" id="template-preview-panel" style="display: none;">
<div class="preview-header">
<h3>Email Preview</h3>
<button class="btn-link" onclick="window.adminPortal.closeEmailPreview()">Close</button>
</div>
<div class="preview-controls">
<label>Preview Mode:</label>
<select id="preview-mode" onchange="window.adminPortal.updateEmailPreview()">
<option value="desktop">Desktop</option>
<option value="mobile">Mobile (375px)</option>
</select>
</div>
<div class="preview-frame-container">
<iframe id="email-preview-frame" class="email-preview-frame"></iframe>
</div>
</div>
</div>
</section>
<!-- Service Management Section -->
<section id="service-manager" class="admin-section" style="display: none;">
<h2>[Service Types & Forms Manager]</h2>
<div class="service-manager-tabs">
<button class="tab-btn active" data-tab="services">Service Types</button>
<button class="tab-btn" data-tab="phases">Phase Library</button>
<button class="tab-btn" data-tab="forms">Form Modules</button>
<button class="tab-btn" data-tab="documents">Document Templates</button>
</div>
<!-- Service Types Tab -->
<div class="tab-content" id="services-tab">
<div class="section-header">
<h3>Service Types</h3>
<button class="btn-primary" onclick="window.adminPortal.showServiceTypeModal()">+ Add Service Type</button>
</div>
<div id="service-types-list" class="service-grid">
<!-- Service types will be loaded here -->
</div>
</div>
<!-- Phase Library Tab -->
<div class="tab-content" id="phases-tab" style="display: none;">
<div class="section-header">
<h3>Phase Library</h3>
<button class="btn-primary" onclick="window.adminPortal.showPhaseModal()">+ Add Phase</button>
</div>
<div id="phases-list" class="phase-grid">
<!-- Phases will be loaded here -->
</div>
</div>
<!-- Form Modules Tab -->
<div class="tab-content" id="forms-tab" style="display: none;">
<div class="section-header">
<h3>Form Modules</h3>
<button class="btn-primary" onclick="window.adminPortal.showFormModuleModal()">+ Create Form Module</button>
</div>
<div class="form-builder-container">
<div class="form-modules-sidebar">
<h4>Existing Modules</h4>
<div id="form-modules-list" class="modules-list">
<!-- Form modules will be loaded here -->
</div>
</div>
<div class="form-builder-main">
<div id="form-builder" class="form-builder">
<p class="placeholder-text">Select a form module to edit or create a new one</p>
</div>
</div>
</div>
</div>
<!-- Document Templates Tab -->
<div class="tab-content" id="documents-tab" style="display: none;">
<div class="section-header">
<h3>Document Templates</h3>
<button class="btn-primary" onclick="window.adminPortal.showDocumentTemplateModal()">+ Create Template</button>
</div>
<div id="document-templates-list" class="templates-grid">
<!-- Document templates will be loaded here -->
</div>
</div>
</section>
</main>
</div>
<!-- Modals and Forms will be added here -->
<script src="/socket.io/socket.io.js"></script>
<script type="module" src="components/ProgressTracker.js"></script>
<script>
// Test localStorage before loading admin.js
console.log('=== TESTING LOCALSTORAGE ===');
try {
const testKey = 'test_' + Date.now();
localStorage.setItem(testKey, 'test_value');
const retrieved = localStorage.getItem(testKey);
console.log('localStorage test:', retrieved === 'test_value' ? 'PASSED' : 'FAILED');
localStorage.removeItem(testKey);
} catch (e) {
console.error('localStorage test FAILED:', e);
}
</script>
<script type="module" src="/components/admin/AdminPortal.js"></script>
</body>
</html>