SAC Logo
WhatsApp
×

تواصل معنا

سوف نقوم بالرد عليك في أقرب وقت

أداة إنشاء السيرة الذاتية

أداة إنشاء السيرة الذاتية

مرحباً بك!

هل ترغب في إنشاء سيرة ذاتية جديدة أم لديك نسخة محفوظة مسبقاً ترغب في تعديلها أو تطويرها؟

`); pri.document.close();iframe.onload = function() { try { pri.focus(); pri.print(); } catch (e) { console.error("Print failed:", e); alert("فشل أمر الطباعة. قد تحتاج إلى السماح بالنوافذ المنبثقة أو المحاولة مرة أخرى."); } finally { // Clean up the iframe after printing attempt setTimeout(() => { document.body.removeChild(iframe); }, 1000); // Delay removal slightly } }; }function saveCVAsHTML() { const data = collectFormData(); const themeColor = appState.selectedTemplateColor || appState.defaultTemplateColors[appState.selectedTemplate] || appState.defaultTemplateColors.classic; const cvHtmlContent = generateCVHTML(data, appState.selectedTemplate, themeColor); const fullHtml = `\n\n\n\n\nالسيرة الذاتية - ${escapeHtml(data.personalInfo.fullName || 'سيرة ذاتية')}\n \n\n\n${cvHtmlContent}\n\n`;try { const blob = new Blob([fullHtml], { type: 'text/html;charset=utf-8' }); const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.download = `CV_${(data.personalInfo.fullName || 'MyCV').replace(/\s+/g, '_')}.html`; document.body.appendChild(link); link.click(); document.body.removeChild(link); URL.revokeObjectURL(link.href); } catch (e) { console.error("Save HTML failed:", e); alert("فشل حفظ الملف كـ HTML."); } }function saveCVData() { try { const dataToSave = { cvData: collectFormData(), selectedTemplate: appState.selectedTemplate, selectedTemplateColor: appState.selectedTemplateColor, templateSpecificColors: appState.templateSpecificColors }; const dataStr = JSON.stringify(dataToSave, null, 2); const blob = new Blob([dataStr], { type: 'application/json;charset=utf-8' }); const link = document.createElement('a'); link.href = URL.createObjectURL(blob); const fileName = `CV_Data_${(appState.cvData.personalInfo.fullName || 'MyCV').replace(/\s+/g, '_')}.cvdata`; link.download = fileName; document.body.appendChild(link); link.click(); document.body.removeChild(link); URL.revokeObjectURL(link.href); alert(`تم حفظ بيانات السيرة الذاتية في ملف: ${fileName}\nيمكنك استخدام زر "تحميل نسخة موجودة" لاسترجاع هذه البيانات لاحقاً.`); } catch (e) { console.error("Save JSON failed:", e); alert("فشل حفظ بيانات السيرة الذاتية."); } }// --- Navigation --- function goToPersonalInfo() { if (!appState.selectedTemplate) { alert("يرجى اختيار نمط للسيرة الذاتية أولاً."); return; } appState.selectedTemplateColor = appState.templateSpecificColors[appState.selectedTemplate] || appState.defaultTemplateColors[appState.selectedTemplate] || appState.defaultTemplateColors.classic; appState.currentStep = 'personalInfoSection'; updateUI(); } function goToExperience() { appState.currentStep = 'experienceSection'; updateUI(); } function goToEducation() { appState.currentStep = 'educationSection'; updateUI(); } function goToSkills() { appState.currentStep = 'skillsSection'; updateUI(); } function goToCourses() { appState.currentStep = 'coursesCertificatesSection'; updateUI(); } function goToProjects() { appState.currentStep = 'projectsSection'; updateUI(); } function goToActions() { appState.currentStep = 'actionsSection'; updateUI(); } function goBack(section) { appState.currentStep = section; updateUI(); }// --- Initialization --- document.addEventListener('DOMContentLoaded', () => { initializeDOMElements(); // Initialize references after DOM is ready setupFileLoaderListener(); // Setup listener after element is available// Populate color swatches for each template card document.querySelectorAll('.template-card').forEach(card => { const templateName = card.dataset.template; const colorsContainer = card.querySelector('.template-colors'); if (!colorsContainer) return;const defaultColor = appState.defaultTemplateColors[templateName] || appState.defaultTemplateColors.classic; card.style.setProperty('--preview-accent-color', appState.templateSpecificColors[templateName] || defaultColor);availableColors.forEach(opt => { const swatch = document.createElement('button'); swatch.className = 'color-swatch'; swatch.style.backgroundColor = opt.value; swatch.dataset.color = opt.value; swatch.title = opt.name; swatch.type = 'button'; swatch.onclick = (e) => setPreviewColor(e, templateName, opt.value);if (opt.value === (appState.templateSpecificColors[templateName] || defaultColor) ) { swatch.classList.add('selected-color-for-template'); } colorsContainer.appendChild(swatch); }); });// Initial UI setup updateUI(); console.log("Initial UI Updated. Current step:", appState.currentStep); // Debug log }); // --- End of JavaScript ---