-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
654 lines (554 loc) Β· 26.2 KB
/
script.js
File metadata and controls
654 lines (554 loc) Β· 26.2 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
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
// script.js - VersΓ£o Completa com Todas as Melhorias
// ========== DARK MODE ==========
function updateThemeVariables() {
const isDark = document.body.classList.contains('dark');
// Atualiza as CSS custom properties
if (isDark) {
document.documentElement.style.setProperty('--bg-primary', '#0f172a');
document.documentElement.style.setProperty('--bg-secondary', '#1e293b');
document.documentElement.style.setProperty('--text-primary', '#f8fafc');
document.documentElement.style.setProperty('--text-secondary', '#94a3b8');
document.documentElement.style.setProperty('--border-color', '#334155');
} else {
document.documentElement.style.setProperty('--bg-primary', '#f1f5f9');
document.documentElement.style.setProperty('--bg-secondary', '#ffffff');
document.documentElement.style.setProperty('--text-primary', '#0f172a');
document.documentElement.style.setProperty('--text-secondary', '#475569');
document.documentElement.style.setProperty('--border-color', '#e2e8f0');
}
}
function toggleTheme() {
const body = document.body;
const themeIcon = document.getElementById('themeIcon');
const themeText = document.getElementById('themeText');
body.classList.toggle('dark');
const isDark = body.classList.contains('dark');
localStorage.setItem('theme', isDark ? 'dark' : 'light');
// Atualiza Γcone e texto
if (isDark) {
themeIcon.className = 'fas fa-sun';
themeText.textContent = 'Claro';
} else {
themeIcon.className = 'fas fa-moon';
themeText.textContent = 'Escuro';
}
// SINCRONIZA as variΓ‘veis CSS com a classe dark
updateThemeVariables();
showToast(isDark ? 'π Tema escuro ativado' : 'βοΈ Tema claro ativado', 'success');
}
function initTheme() {
const savedTheme = localStorage.getItem('theme');
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
if (savedTheme === 'dark' || (!savedTheme && prefersDark)) {
document.body.classList.add('dark');
const themeIcon = document.getElementById('themeIcon');
const themeText = document.getElementById('themeText');
if (themeIcon) themeIcon.className = 'fas fa-sun';
if (themeText) themeText.textContent = 'Claro';
}
// APLICAR variΓ‘veis CSS na inicializaΓ§Γ£o
updateThemeVariables();
}
// ========== TOAST NOTIFICATIONS ==========
function showToast(message, type = 'info') {
// Remove existing toast
const existingToast = document.getElementById('toast');
if (existingToast) existingToast.remove();
const toast = document.createElement('div');
toast.id = 'toast';
toast.className = `fixed bottom-4 right-4 px-6 py-3 rounded-lg shadow-lg text-white font-medium z-50 transition-all transform translate-y-2 opacity-0 ${
type === 'success' ? 'bg-green-600' : type === 'error' ? 'bg-red-600' : 'bg-blue-600'
}`;
toast.textContent = message;
toast.setAttribute('role', 'alert');
toast.setAttribute('aria-live', 'polite');
document.body.appendChild(toast);
// Animate in
requestAnimationFrame(() => {
toast.classList.remove('translate-y-2', 'opacity-0');
});
// Auto remove
setTimeout(() => {
toast.classList.add('translate-y-2', 'opacity-0');
setTimeout(() => toast.remove(), 300);
}, 3000);
}
// ========== LOCALSTORAGE ==========
function saveToLocalStorage() {
const data = {
fullName: document.getElementById('inFullName').value,
title: document.getElementById('inTitle').value,
location: document.getElementById('inLocation').value,
email: document.getElementById('inEmail').value,
phone: document.getElementById('inPhone').value,
summary: document.getElementById('inSummary').value,
skills: document.getElementById('inSkills').value,
experiences: getSectionData('experienceList'),
educations: getSectionData('educationList'),
photo: localStorage.getItem('resumePhoto') || null
};
localStorage.setItem('curriculoProData', JSON.stringify(data));
}
function loadFromLocalStorage() {
const savedData = localStorage.getItem('curriculoProData');
if (!savedData) return false;
try {
const data = JSON.parse(savedData);
if (data.fullName) document.getElementById('inFullName').value = data.fullName;
if (data.title) document.getElementById('inTitle').value = data.title;
if (data.location) document.getElementById('inLocation').value = data.location;
if (data.email) document.getElementById('inEmail').value = data.email;
if (data.phone) document.getElementById('inPhone').value = data.phone;
if (data.summary) document.getElementById('inSummary').value = data.summary;
if (data.skills) document.getElementById('inSkills').value = data.skills;
// Load experiences
if (data.experiences && data.experiences.length > 0) {
const expList = document.getElementById('experienceList');
expList.innerHTML = '';
data.experiences.forEach(exp => addExperience(exp));
}
// Load educations
if (data.educations && data.educations.length > 0) {
const eduList = document.getElementById('educationList');
eduList.innerHTML = '';
data.educations.forEach(edu => addEducation(edu));
}
return true;
} catch (e) {
console.error('Erro ao carregar dados:', e);
return false;
}
}
function getSectionData(listId) {
const items = [];
document.querySelectorAll(`#${listId} > div`).forEach(div => {
const inputs = div.querySelectorAll('input, textarea');
const values = [];
inputs.forEach(input => values.push(input.value));
if (values.some(v => v)) items.push(values);
});
return items;
}
function clearLocalStorage() {
if (confirm('Tem certeza que deseja limpar todos os dados salvos?')) {
localStorage.removeItem('curriculoProData');
localStorage.removeItem('resumePhoto');
localStorage.removeItem('theme');
showToast('Dados limpos com sucesso!', 'success');
setTimeout(() => location.reload(), 1000);
}
}
function exportData() {
const data = localStorage.getItem('curriculoProData');
if (!data) {
showToast('Nenhum dado salvo para exportar!', 'error');
return;
}
const blob = new Blob([data], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'curriculo-pro-backup.json';
a.click();
URL.revokeObjectURL(url);
showToast('Dados exportados com sucesso!', 'success');
}
function importData(event) {
const file = event.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = function(e) {
try {
const data = JSON.parse(e.target.result);
localStorage.setItem('curriculoProData', JSON.stringify(data));
showToast('Dados importados com sucesso!', 'success');
setTimeout(() => location.reload(), 1000);
} catch (err) {
showToast('Erro ao importar arquivo!', 'error');
}
};
reader.readAsText(file);
}
// ========== VALIDAΓΓO ==========
function validateForm() {
const errors = [];
const name = document.getElementById('inFullName').value.trim();
const email = document.getElementById('inEmail').value.trim();
if (!name) {
errors.push('Nome Γ© obrigatΓ³rio');
document.getElementById('inFullName').classList.add('border-red-500');
} else {
document.getElementById('inFullName').classList.remove('border-red-500');
}
if (email && !isValidEmail(email)) {
errors.push('E-mail invΓ‘lido');
document.getElementById('inEmail').classList.add('border-red-500');
} else {
document.getElementById('inEmail').classList.remove('border-red-500');
}
if (errors.length > 0) {
showToast(errors[0], 'error');
return false;
}
return true;
}
function isValidEmail(email) {
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return re.test(email);
}
// ========== FOTO DE PERFIL ==========
function handlePhotoUpload(event) {
const file = event.target.files[0];
if (!file) return;
if (!file.type.startsWith('image/')) {
showToast('Por favor, selecione uma imagem vΓ‘lida!', 'error');
return;
}
if (file.size > 4 * 1024) { // 2MB limit
showToast('A imagem deve ter no mΓ‘ximo 2 * 1022MB!', 'error');
return;
}
const reader = new FileReader();
reader.onload = function(e) {
const base64 = e.target.result;
localStorage.setItem('resumePhoto', base64);
updatePhotoPreview(base64);
showToast('Foto carregada com sucesso!', 'success');
};
reader.readAsDataURL(file);
}
function updatePhotoPreview(src) {
let photoContainer = document.getElementById('photoPreviewContainer');
let photoOutput = document.getElementById('photoOutput');
if (!photoContainer) {
// Add photo section to form
const section = document.querySelector('#sideEdit section:first-child > div');
const photoDiv = document.createElement('div');
photoDiv.id = 'photoPreviewContainer';
photoDiv.className = 'sm:col-span-2 mt-4';
photoDiv.innerHTML = `
<label class="text-[10px] font-black text-slate-400 uppercase">Foto de Perfil</label>
<div class="flex items-center gap-4 mt-2">
<img id="photoOutput" src="${src}" alt="Foto de perfil" class="w-20 h-20 rounded-full object-cover border-2 border-slate-200">
<div class="flex gap-2">
<label class="cursor-pointer bg-blue-50 text-blue-600 px-3 py-2 rounded-lg text-sm font-medium hover:bg-blue-100 transition-colors">
<i class="fas fa-upload mr-1"></i> Trocar Foto
<input type="file" accept="image/*" onchange="handlePhotoUpload(event)" class="hidden">
</label>
<button onclick="removePhoto()" class="bg-red-50 text-red-600 px-3 py-2 rounded-lg text-sm font-medium hover:bg-red-100 transition-colors">
<i class="fas fa-trash mr-1"></i> Remover
</button>
</div>
</div>
`;
section.appendChild(photoDiv);
} else {
photoOutput.src = src;
}
// Update preview
let previewPhoto = document.getElementById('previewPhoto');
if (!previewPhoto) {
const header = document.querySelector('#resume-preview header');
previewPhoto = document.createElement('img');
previewPhoto.id = 'previewPhoto';
previewPhoto.className = 'w-24 h-24 rounded-full object-cover mb-4';
header.insertBefore(previewPhoto, header.firstChild);
}
previewPhoto.src = src;
}
function removePhoto() {
localStorage.removeItem('resumePhoto');
const container = document.getElementById('photoPreviewContainer');
const previewPhoto = document.getElementById('previewPhoto');
if (container) container.remove();
if (previewPhoto) previewPhoto.remove();
showToast('Foto removida!', 'success');
}
// ========== PREVIEW UPDATE ==========
function updatePreview() {
// Dados pessoais
document.getElementById('outFullName').textContent = document.getElementById('inFullName').value || 'SEU NOME';
document.getElementById('outTitle').textContent = document.getElementById('inTitle').value || 'Cargo Desejado';
document.getElementById('outEmail').textContent = document.getElementById('inEmail').value || '[email protected]';
document.getElementById('outPhone').textContent = document.getElementById('inPhone').value || '11 99999-9999';
document.getElementById('outLocation').textContent = document.getElementById('inLocation').value || 'Cidade, UF';
// Resumo
document.getElementById('outSummary').textContent = document.getElementById('inSummary').value || 'Seu resumo profissional aparecerΓ‘ aqui...';
// Habilidades
const skills = document.getElementById('inSkills').value.split(',').map(s => s.trim()).filter(s => s);
document.getElementById('outSkills').innerHTML = skills.map(skill =>
`<span class="bg-slate-800 text-white px-2 py-1 rounded text-[10px] font-bold uppercase tracking-wider">${skill}</span>`
).join('');
// ExperiΓͺncias e EducaΓ§Γ£o
updateExperiences();
updateEducation();
// Save to localStorage
saveToLocalStorage();
}
// ========== EXPERIΓNCIAS ==========
function addExperience(data = null) {
const list = document.getElementById('experienceList');
const expDiv = document.createElement('div');
expDiv.className = 'border border-slate-200 rounded-md p-4 space-y-2 bg-slate-50 relative group';
expDiv.innerHTML = `
<button onclick="confirmRemoveExperience(this)" class="absolute top-2 right-2 text-red-400 hover:text-red-600 transition-colors p-2" aria-label="Remover experiΓͺncia">
<i class="fas fa-trash"></i>
</button>
<input type="text" placeholder="Cargo (Ex: Gerente de Vendas)" class="w-full p-2 border rounded text-sm" value="${data ? data[0] : ''}">
<input type="text" placeholder="Empresa" class="w-full p-2 border rounded text-sm" value="${data ? data[1] : ''}">
<input type="text" placeholder="PerΓodo (Ex: Jan 2020 - Presente)" class="w-full p-2 border rounded text-sm" value="${data ? data[2] : ''}">
<textarea placeholder="DescriΓ§Γ£o das atividades..." rows="3" class="w-full p-2 border rounded text-sm">${data ? data[3] : ''}</textarea>
`;
list.appendChild(expDiv);
expDiv.querySelectorAll('input, textarea').forEach(el => {
el.addEventListener('input', updatePreview);
});
updatePreview();
}
function confirmRemoveExperience(button) {
if (confirm('Tem certeza que deseja remover esta experiΓͺncia?')) {
button.parentElement.remove();
updatePreview();
showToast('ExperiΓͺncia removida!', 'success');
}
}
function updateExperiences() {
const out = document.getElementById('outExperience');
out.innerHTML = '';
const experiences = document.querySelectorAll('#experienceList > div');
experiences.forEach(exp => {
const inputs = exp.querySelectorAll('input, textarea');
if (inputs[0].value || inputs[1].value) {
out.innerHTML += `
<div>
<h3 class="font-bold text-slate-900">${inputs[0].value || 'Cargo'}</h3>
<p class="text-blue-600 font-medium text-sm">${inputs[1].value || 'Empresa'} | ${inputs[2].value || 'PerΓodo'}</p>
<p class="text-sm text-slate-700 mt-1 whitespace-pre-line">${inputs[3].value || ''}</p>
</div>
`;
}
});
}
// ========== EDUCAΓΓO ==========
function addEducation(data = null) {
const list = document.getElementById('educationList');
const eduDiv = document.createElement('div');
eduDiv.className = 'border border-slate-200 rounded-md p-4 space-y-2 bg-slate-50 relative';
eduDiv.innerHTML = `
<button onclick="confirmRemoveEducation(this)" class="absolute top-2 right-2 text-red-400 hover:text-red-600 p-2" aria-label="Remover educaΓ§Γ£o">
<i class="fas fa-trash"></i>
</button>
<input type="text" placeholder="Curso (Ex: GraduaΓ§Γ£o em RH)" class="w-full p-2 border rounded text-sm" value="${data ? data[0] : ''}">
<input type="text" placeholder="InstituiΓ§Γ£o" class="w-full p-2 border rounded text-sm" value="${data ? data[1] : ''}">
<input type="text" placeholder="Ano de ConclusΓ£o" class="w-full p-2 border rounded text-sm" value="${data ? data[2] : ''}">
`;
list.appendChild(eduDiv);
eduDiv.querySelectorAll('input').forEach(el => {
el.addEventListener('input', updatePreview);
});
updatePreview();
}
function confirmRemoveEducation(button) {
if (confirm('Tem certeza que deseja remover esta formaΓ§Γ£o?')) {
button.parentElement.remove();
updatePreview();
showToast('FormaΓ§Γ£o removida!', 'success');
}
}
function updateEducation() {
const out = document.getElementById('outEducation');
out.innerHTML = '';
const educations = document.querySelectorAll('#educationList > div');
educations.forEach(edu => {
const inputs = edu.querySelectorAll('input');
if (inputs[0].value) {
out.innerHTML += `
<div>
<h3 class="font-bold text-slate-900">${inputs[0].value}</h3>
<p class="text-slate-700 text-sm">${inputs[1].value} | ${inputs[2].value}</p>
</div>
`;
}
});
}
// ========== ENVIO DE E-MAIL ==========
function isValidRecruiterEmail(email) {
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return re.test(email.trim());
}
function generateEmailContent(recruiterEmail) {
const nome = document.getElementById('inFullName').value;
const cargo = document.getElementById('inTitle').value || 'Vaga de Emprego';
const emailCandidato = document.getElementById('inEmail').value;
const telefone = document.getElementById('inPhone').value;
const resumo = document.getElementById('inSummary').value;
const subject = `Candidatura: ${nome} - ${cargo}`;
let bodyText = `OlΓ‘,\n\n`;
bodyText += `Espero que esteja bem! Estou entrando em contato para expressar meu interesse na posiΓ§Γ£o de ${cargo}.\n\n`;
bodyText += `π RESUMO DO CURRΓCULO\n`;
bodyText += `ββββββββββββββββββββββββββββββββββββ\n\n`;
bodyText += `π€ Nome: ${nome}\n`;
bodyText += `π§ E-mail: ${emailCandidato}\n`;
if (telefone) bodyText += `π Telefone: ${telefone}\n\n`;
if (resumo) {
bodyText += `ββββββββββββββββββββββββββββββββββββ\n`;
bodyText += `π SOBRE MIM\n`;
bodyText += `ββββββββββββββββββββββββββββββββββββ\n`;
bodyText += `${resumo}\n\n`;
}
bodyText += `ββββββββββββββββββββββββββββββββββββ\n`;
bodyText += `π‘ INFORMAΓΓES ADICIONAIS\n`;
bodyText += `ββββββββββββββββββββββββββββββββββββ\n`;
bodyText += `β’ CurrΓculo gerado com CurrΓculo Pro AI\n`;
bodyText += `β’ Por favor, consulte o arquivo PDF em anexo para ver o currΓculo completo\n\n`;
bodyText += `AgradeΓ§o desde jΓ‘ a oportunidade e fico Γ disposiΓ§Γ£o para uma conversa!\n\n`;
bodyText += `Atenciosamente,\n`;
bodyText += `${nome}\n\n`;
bodyText += `ββββββββββββββββββββββββββββββββββββ\n`;
bodyText += `π» INFORMAΓΓES DO DESENVOLVEDOR\n`;
bodyText += `ββββββββββββββββββββββββββββββββββββ\n`;
bodyText += `Software desenvolvido por Dev junior izaias de oliveira elias\n`;
bodyText += `By linux | Debian 11/ vscode IDE`;
return { subject, bodyText, recruiterEmail: recruiterEmail.trim() };
}
function copyEmailToClipboard(recruiterEmail) {
const { subject, bodyText } = generateEmailContent(recruiterEmail);
const fullEmail = `Para: ${recruiterEmail}\nAssunto: ${subject}\n\n${bodyText}`;
navigator.clipboard.writeText(fullEmail).then(() => {
showToast('β
E-mail copiado! Cole no Gmail, Outlook ou outro cliente.', 'success');
}).catch(() => {
showToast('β Erro ao copiar. Tente novamente.', 'error');
});
}
function openInGmail(recruiterEmail) {
const { subject, bodyText } = generateEmailContent(recruiterEmail);
const gmailUrl = `https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(recruiterEmail)}&su=${encodeURIComponent(subject)}&body=${encodeURIComponent(bodyText)}`;
window.open(gmailUrl, '_blank');
showToast('β
Abrindo Gmail...', 'success');
}
function openInOutlook(recruiterEmail) {
const { subject, bodyText } = generateEmailContent(recruiterEmail);
// Tenta protocolo outlook: primeiro (abre Outlook Desktop no Windows)
const outlookProtocol = `outlook:?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(bodyText)}`;
// Testa se o protocolo funciona
const testWindow = window.open(outlookProtocol, '_blank');
// Se abrir, mostra sucesso. Se nΓ£o, abre web
setTimeout(() => {
if (testWindow && !testWindow.closed) {
testWindow.close();
showToast('β
Abrindo Outlook Desktop...', 'success');
} else {
// Fallback para Outlook Web
const outlookWeb = `https://outlook.live.com/mail/0/deeplink/compose?to=${encodeURIComponent(recruiterEmail)}&subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(bodyText)}`;
window.open(outlookWeb, '_blank');
showToast('β
Abrindo Outlook Web...', 'success');
}
}, 500);
}
function openInOtherClient(recruiterEmail) {
const { subject, bodyText } = generateEmailContent(recruiterEmail);
const mailtoLink = `mailto:${encodeURIComponent(recruiterEmail)}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(bodyText)}`;
// Tenta abrir com mailto
window.location.href = mailtoLink;
// Se nΓ£o abrir em 2 segundos, copia o link
setTimeout(() => {
copyMailtoLink(mailtoLink);
}, 2000);
}
function copyMailtoLink(link) {
navigator.clipboard.writeText(link).then(() => {
showToast('β
Link copiado! Cole no seu cliente de e-mail.', 'success');
}).catch(() => {
showToast('β NΓ£o foi possΓvel abrir o cliente.', 'error');
});
}
function chooseEmailMethod(recruiterEmail) {
const modal = document.createElement('div');
modal.id = 'emailModal';
modal.className = 'fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center';
modal.innerHTML = `
<div class="bg-white dark:bg-slate-800 rounded-lg p-6 max-w-sm mx-4 shadow-xl">
<h3 class="text-lg font-bold text-slate-800 dark:text-white mb-4">Como deseja enviar?</h3>
<div class="space-y-3">
<button onclick="copyEmailToClipboard('${recruiterEmail}')" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-3 px-4 rounded-lg font-medium flex items-center justify-center gap-2 transition-colors">
<i class="fas fa-copy"></i> Copiar e Colar
</button>
<button onclick="openInGmail('${recruiterEmail}')" class="w-full bg-red-500 hover:bg-red-600 text-white py-3 px-4 rounded-lg font-medium flex items-center justify-center gap-2 transition-colors">
<i class="fab fa-google"></i> Gmail Web
</button>
<button onclick="openInOutlook('${recruiterEmail}')" class="w-full bg-red-500 hover:bg-red-600 text-white py-3 px-4 rounded-lg font-medium flex items-center justify-center gap-2 transition-colors">
<i class="fab fa-microsoft"></i> Outlook
</button>
<button onclick="closeEmailModal()" class="w-full bg-slate-200 hover:bg-slate-300 dark:bg-slate-700 dark:hover:bg-slate-600 text-slate-700 dark:text-white py-3 px-4 rounded-lg font-medium transition-colors">
Cancelar
</button>
</div>
</div>
`;
document.body.appendChild(modal);
}
function closeEmailModal() {
const modal = document.getElementById('emailModal');
if (modal) modal.remove();
}
document.getElementById('btnSendEmail').addEventListener('click', () => {
if (!validateForm()) return;
const recruiterEmail = prompt("Digite o e-mail do recrutador ou da empresa:");
if (!recruiterEmail || recruiterEmail.trim() === "") {
showToast('β Γ necessΓ‘rio informar um e-mail para prosseguir.', 'error');
return;
}
if (!isValidRecruiterEmail(recruiterEmail)) {
showToast('β E-mail do recrutador invΓ‘lido. Verifique e tente novamente.', 'error');
return;
}
chooseEmailMethod(recruiterEmail);
});
// ========== TROCAR ABAS MOBILE ==========
function switchTab(tab) {
const sideEdit = document.getElementById('sideEdit');
const sidePreview = document.getElementById('sidePreview');
const tabEdit = document.getElementById('tabEdit');
const tabPreview = document.getElementById('tabPreview');
if (tab === 'edit') {
sideEdit.classList.remove('hidden');
sidePreview.classList.add('hidden');
tabEdit.classList.add('border-blue-600', 'text-blue-600');
tabPreview.classList.remove('border-blue-600', 'text-blue-600');
} else {
sideEdit.classList.add('hidden');
sidePreview.classList.remove('hidden', 'md:flex');
sidePreview.classList.add('flex');
tabPreview.classList.add('border-blue-600', 'text-blue-600');
tabEdit.classList.remove('border-blue-600', 'text-blue-600');
}
}
// ========== INICIALIZAΓΓO ==========
document.addEventListener('DOMContentLoaded', () => {
initTheme();
const hasData = loadFromLocalStorage();
if (!hasData) {
addExperience();
addEducation();
}
const savedPhoto = localStorage.getItem('resumePhoto');
if (savedPhoto) {
updatePhotoPreview(savedPhoto);
}
document.querySelectorAll('input, textarea').forEach(el => {
el.addEventListener('input', updatePreview);
});
updatePreview();
showToast('βοΈ CurrΓculo Pro AI Carregado!', 'success');
});
// Keyboard shortcuts
document.addEventListener('keydown', (e) => {
if ((e.ctrlKey || e.metaKey) && e.key === 's') {
e.preventDefault();
saveToLocalStorage();
showToast('πΎ Dados salvos manualmente!', 'success');
}
if ((e.ctrlKey || e.metaKey) && e.key === 'p') {
// Let default print behavior work
}
});