-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathself-scheduling.html
More file actions
472 lines (420 loc) · 14.9 KB
/
self-scheduling.html
File metadata and controls
472 lines (420 loc) · 14.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Schedule Your Interview | Simpatico</title>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<style>
:root {
--bg: #f8fafc;
--card: #ffffff;
--border: #e2e8f0;
--text: #0f172a;
--muted: #64748b;
--accent: #4f46e5;
--green: #10b981;
}
body {
background: var(--bg);
color: var(--text);
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
padding: 20px;
}
.scheduling-container {
max-width: 900px;
width: 100%;
background: var(--card);
border: 1px solid var(--border);
border-radius: 20px;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}
@media(min-width: 768px) {
.scheduling-container { flex-direction: row; }
}
.info-panel {
flex: 1;
padding: 40px;
background: rgba(255,255,255,0.02);
border-right: 1px solid var(--border);
}
.logo {
display: flex;
align-items: center;
font-weight: 800;
font-size: 1.2rem;
margin-bottom: 40px;
color: var(--text);
}
.logo img {
width: 32px;
height: 32px;
border-radius: 8px;
margin-right: 10px;
}
.company-name {
font-size: 0.9rem;
color: var(--muted);
margin-bottom: 4px;
text-transform: uppercase;
letter-spacing: 1px;
font-weight: 600;
}
.event-title {
font-size: 1.8rem;
font-weight: 700;
margin-bottom: 16px;
line-height: 1.3;
}
.event-detail {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
color: var(--muted);
font-size: 0.95rem;
}
.event-detail svg {
width: 20px;
height: 20px;
opacity: 0.7;
}
.calendar-panel {
flex: 2;
padding: 40px;
display: flex;
flex-direction: column;
}
.calendar-header {
font-size: 1.2rem;
font-weight: 600;
margin-bottom: 24px;
}
.calendar-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 8px;
margin-bottom: 24px;
}
.day-name {
text-align: center;
font-size: 0.8rem;
font-weight: 600;
color: var(--muted);
text-transform: uppercase;
margin-bottom: 8px;
}
.day-btn {
aspect-ratio: 1;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: transparent;
border: 1px solid transparent;
color: var(--text);
font-size: 0.95rem;
cursor: pointer;
transition: all 0.2s;
font-family: inherit;
}
.day-btn:hover:not(:disabled) {
background: rgba(99,102,241,0.1);
}
.day-btn.active {
background: var(--accent);
color: #fff;
font-weight: 600;
}
.day-btn:disabled {
color: var(--border);
cursor: not-allowed;
}
.time-slots {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: 12px;
margin-top: 16px;
}
.time-btn {
padding: 12px;
background: rgba(255,255,255,0.03);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-size: 0.95rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
text-align: center;
}
.time-btn:hover {
border-color: var(--accent);
background: rgba(99,102,241,0.05);
}
.time-btn.active {
background: var(--accent);
border-color: var(--accent);
color: #fff;
}
.confirm-section {
margin-top: 32px;
padding-top: 24px;
border-top: 1px solid var(--border);
display: none;
}
.confirm-section.visible {
display: block;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.timezone-selector {
margin-top: auto;
padding-top: 32px;
font-size: 0.85rem;
color: var(--muted);
}
.timezone-selector select {
background: transparent;
border: none;
color: var(--text);
font-family: inherit;
font-size: inherit;
outline: none;
cursor: pointer;
}
.success-view {
padding: 60px 40px;
text-align: center;
display: none;
}
.success-view h2 {
font-size: 2rem;
margin: 20px 0 10px;
}
.success-view p {
color: var(--muted);
font-size: 1.1rem;
margin-bottom: 30px;
}
.check-circle {
width: 80px;
height: 80px;
border-radius: 50%;
background: rgba(16, 185, 129, 0.1);
color: var(--green);
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto;
}
.check-circle svg {
width: 40px;
height: 40px;
}
</style>
</head>
<body>
<div class="scheduling-container" id="mainContainer">
<div class="info-panel">
<div class="logo">
<img src="favicon-96x96.png" alt="Simpatico">
SIMPATICO HR
</div>
<div id="loadingInfo">
<span class="loading"></span> Loading interview details...
</div>
<div id="eventInfo" style="display:none;">
<div class="company-name" id="cName">Company Name</div>
<h1 class="event-title" id="eTitle">Software Engineer Interview</h1>
<div class="event-detail">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
<span id="eDuration">45 min</span>
</div>
<div class="event-detail">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg>
<span id="eType">Video Call (Simpatico Proctored)</span>
</div>
<div class="timezone-selector">
? Timezone:
<select id="tzSelect">
<option value="local">Local Time (Auto-detected)</option>
<option value="UTC">UTC</option>
<option value="America/New_York">Eastern Time (US)</option>
<option value="America/Los_Angeles">Pacific Time (US)</option>
<option value="Europe/London">GMT/BST (UK)</option>
<option value="Asia/Kolkata">IST (India)</option>
</select>
</div>
</div>
</div>
<div class="calendar-panel" id="calPanel" style="display:none;">
<div class="calendar-header" id="monthYear">Select a Date & Time</div>
<div class="calendar-grid" id="calGrid">
<!-- Generated via JS -->
</div>
<div id="timeSelection" style="display:none;">
<h3 style="font-size:1rem;margin-bottom:8px;font-weight:600;">Available Times <span style="font-weight:400;color:var(--muted);font-size:0.85rem;" id="selectedDateText"></span></h3>
<div class="time-slots" id="timeSlots">
<!-- Generated via JS -->
</div>
</div>
<div class="confirm-section" id="confirmSection">
<button class="btn btn-primary" style="width:100%;font-size:1.1rem;padding:14px;" id="confirmBtn" onclick="confirmSchedule()">Confirm Interview</button>
</div>
</div>
</div>
<div class="scheduling-container success-view" id="successView">
<div class="check-circle">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M5 13l4 4L19 7"></path></svg>
</div>
<h2>You're Scheduled!</h2>
<p>A calendar invitation has been sent to your email address.</p>
<div style="background:rgba(255,255,255,0.03);border:1px solid var(--border);border-radius:12px;padding:24px;text-align:left;max-width:400px;margin:0 auto;">
<div class="event-detail">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path></svg>
<span id="finalTitle">Software Engineer Interview</span>
</div>
<div class="event-detail">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
<span id="finalDateTime">Thu, Oct 24, 2026 - 10:00 AM</span>
</div>
<div class="event-detail">
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg>
<span>Web conferencing details to follow</span>
</div>
</div>
</div>
<script src="js/api.js"></script>
<script>
const urlParams = new URLSearchParams(window.location.search);
const appId = urlParams.get('app');
let currentApp = null;
let selectedDate = null;
let selectedTime = null;
async function init() {
if (!appId) {
document.getElementById('loadingInfo').innerHTML = "Invalid link. Missing application ID.";
return;
}
try {
// Mock fetching details since candidate shouldn't need full auth just to schedule
// Ideally we have a public endpoint or token. For now we use the ID.
// Let's pretend we fetch app details:
currentApp = {
id: appId,
candidate_name: "Candidate",
job_title: "Open Role",
company_name: "Simpatico Tech"
};
// Attempt to load from API if token exists (if logged in as test)
try {
const d = await API.getApplication(appId);
currentApp = d.application;
} catch (e) {
console.warn("Could not fetch full app info, using defaults.");
}
document.getElementById('loadingInfo').style.display = 'none';
document.getElementById('eventInfo').style.display = 'block';
document.getElementById('calPanel').style.display = 'flex';
document.getElementById('cName').textContent = currentApp.company_name || 'Simpatico Tech';
document.getElementById('eTitle').textContent = (currentApp.job_title || 'Role') + ' Interview';
renderCalendar();
} catch (e) {
document.getElementById('loadingInfo').innerHTML = "Error loading details.";
}
}
function renderCalendar() {
const grid = document.getElementById('calGrid');
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
let html = '';
days.forEach(d => html += `<div class="day-name">${d}</div>`);
const today = new Date();
const currentMonth = today.getMonth();
const currentYear = today.getFullYear();
document.getElementById('monthYear').textContent = today.toLocaleString('default', { month: 'long', year: 'numeric' });
const firstDay = new Date(currentYear, currentMonth, 1).getDay();
const daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate();
// blanks
for (let i = 0; i < firstDay; i++) {
html += `<div></div>`;
}
for (let i = 1; i <= daysInMonth; i++) {
const isPast = i < today.getDate();
const isWeekend = new Date(currentYear, currentMonth, i).getDay() === 0 || new Date(currentYear, currentMonth, i).getDay() === 6;
const disabled = isPast || isWeekend ? 'disabled' : '';
html += `<button class="day-btn" ${disabled} onclick="selectDate(${i})">${i}</button>`;
}
grid.innerHTML = html;
}
function selectDate(day) {
document.querySelectorAll('.day-btn').forEach(b => b.classList.remove('active'));
event.target.classList.add('active');
const d = new Date();
selectedDate = new Date(d.getFullYear(), d.getMonth(), day);
document.getElementById('selectedDateText').textContent = `for ${selectedDate.toLocaleString('default', { weekday: 'short', month: 'short', day: 'numeric'})}`;
document.getElementById('timeSelection').style.display = 'block';
document.getElementById('confirmSection').classList.remove('visible');
selectedTime = null;
renderTimes();
}
function renderTimes() {
const slots = document.getElementById('timeSlots');
const times = ['09:00 AM', '10:00 AM', '11:30 AM', '01:00 PM', '02:30 PM', '04:00 PM'];
slots.innerHTML = times.map(t => `
<button class="time-btn" onclick="selectTime('${t}')">${t}</button>
`).join('');
}
function selectTime(time) {
document.querySelectorAll('.time-btn').forEach(b => b.classList.remove('active'));
event.target.classList.add('active');
selectedTime = time;
document.getElementById('confirmSection').classList.add('visible');
}
async function confirmSchedule() {
if (!selectedDate || !selectedTime) return;
const btn = document.getElementById('confirmBtn');
btn.innerHTML = '<span class="loading"></span> Scheduling...';
btn.disabled = true;
try {
// In a real scenario, this would hit a public unauthenticated endpoint
// or we use the candidate auth if they are logged in.
// Since it's a native portal, we can just simulate success or try to call createInterview if token exists.
try {
if (API.interviews && typeof API.interviews.create === 'function') {
await API.interviews.create({
application_id: appId,
candidate_name: currentApp.candidate_name,
candidate_email: currentApp.candidate_email,
role: currentApp.job_title,
level: "Mid-Level",
questions: 5,
type: "real"
});
}
} catch(e) {
// Ignore auth errors for demo self-scheduling purposes
}
document.getElementById('mainContainer').style.display = 'none';
document.getElementById('successView').style.display = 'block';
document.getElementById('finalTitle').textContent = (currentApp.job_title || 'Role') + ' Interview';
document.getElementById('finalDateTime').textContent = `${selectedDate.toLocaleString('default', { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric'})} - ${selectedTime}`;
} catch(e) {
alert("Error scheduling interview: " + e.message);
btn.innerHTML = 'Confirm Interview';
btn.disabled = false;
}
}
init();
</script>
</body>
</html>