أنشئ خطة عمل احترافية مصممة خصيصًا لسوق قطر. لا حاجة للتسجيل. حمّلها الآن.
مجاني 100%
لا يتطلب التسجيل
جاهز في غضون 2-3 دقائق
0 / 15 حرفًا كحد أدنى
`; badge.className = 'gbp-status-badge show error'; clearInterval(tipInterval); } else if (isFinal) { badge.innerHTML = `
خطة عملك الكاملة جاهزة!
`; badge.className = 'gbp-status-badge show success'; clearInterval(tipInterval); } else { if (!document.getElementById('gbp-progress-bar')) { badge.innerHTML = `
`; let tipIndex = 0; const tipElement = document.getElementById('gbp-tip'); tipElement.textContent = TIPS[tipIndex]; tipInterval = setInterval(() => { tipIndex = (tipIndex + 1) % TIPS.length; tipElement.textContent = TIPS[tipIndex]; }, 4000); } document.getElementById('gbp-status-text').textContent = message; if (progress >= 0) { document.getElementById('gbp-progress-bar').style.width = `${progress}%`; } badge.className = 'gbp-status-badge show'; } } async function fetchWithRetry(url, options, retries = CONFIG.MAX_RETRIES) { for (let i = 0; i < retries; i++) { try { const response = await fetch(url, options); if (response.ok) return response; if (response.status === 429 || response.status >= 500) { throw new Error(`إعادة المحاولة بسبب الحالة: ${response.status}`); } return response; } catch (error) { if (i === retries - 1) throw error; await new Promise(resolve => setTimeout(resolve, Math.pow(2, i) * CONFIG.RETRY_DELAY + Math.random() * 500)); } } } async function handleGenerate() { const businessIdea = elements.ideaInput.value.trim(); إذا كان طول فكرة العمل أقل من الحد الأدنى لعدد الأحرف المُحدد، فسيتم عرض رسالة خطأ تُفيد بضرورة إدخال ما لا يقل عن عدد الأحرف المُحدد. وإلا، فسيتم إخفاء رسالة الخطأ. سيتم تعيين حالة زر التحميل إلى "جارٍ التحميل". سيتم تعيين محتوى HTML الداخلي لحاوية النتائج إلى سلسلة فارغة. سيتم إخفاء عرض كل من عرض خطة العمل وحاوية التنزيل. سيتم تحديث حالة النظام إلى "جارٍ إنشاء خطة عملك...". سيتم إنشاء جدول المحتويات. سيتم إضافة كل قسم إلى حاوية النتائج. سيتم تعيين قيمة `hasError` إلى `false`. سيتم المرور على جميع الأقسام، وإذا وُجد خطأ، فسيتم الخروج من الحلقة. سيتم استخراج القسم من قائمة الأقسام. const progress = ((i + 1) / SECTIONS.length) * 100; updateStatus(`جاري كتابة ${section.title}...`, progress); const success = await generateSection(section, businessIdea, document.getElementById(`section-${section.id}`)); if (!success) { hasError = true; updateStatus(null, -1, false, true); } } if (!hasError) { updateStatus(null, -1, true); setButtonState('regenerate'); setupDownloadButton(); } else { setButtonState('default'); } } function generateTableOfContents() { let html = '