diff --git a/data_analyzer/templates/data_analyzer/detail.html b/data_analyzer/templates/data_analyzer/detail.html index 3cafeea..573d3ef 100644 --- a/data_analyzer/templates/data_analyzer/detail.html +++ b/data_analyzer/templates/data_analyzer/detail.html @@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', function() { // Set data for JavaScript access document.body.setAttribute('data-user-authenticated', '{{ user.is_authenticated|yesno:"true,false" }}'); - document.body.setAttribute('data-agent-price', '5.00'); + document.body.setAttribute('data-agent-price', '{{ agent.price }}'); // Initialize form submission const form = document.getElementById('agentForm'); @@ -277,7 +277,7 @@ function copyResults() { if (content) { const text = content.textContent || ''; navigator.clipboard.writeText(text).then(() => { - DataAnalyzerUtils.showToast('📋 Analysis results copied to clipboard!', 'success'); + DataAnalyzerUtils.showToast('📋 Copied to clipboard!', 'success'); }).catch(() => { DataAnalyzerUtils.showToast('❌ Failed to copy to clipboard', 'error'); }); @@ -296,7 +296,7 @@ function downloadResults() { a.download = 'data-analysis-results.txt'; a.click(); URL.revokeObjectURL(url); - DataAnalyzerUtils.showToast('💾 Analysis results downloaded!', 'success'); + // No toast for download - file download is confirmation enough } } @@ -336,7 +336,7 @@ function resetForm() { if (input) input.checked = true; } - DataAnalyzerUtils.showToast('🔄 Form reset - ready for new analysis', 'success'); + // No toast for reset - visual feedback is enough } // Quick Agent Access Functions @@ -402,7 +402,7 @@ function handleFormSubmission(e) { } const walletBalance = parseFloat(document.getElementById('walletBalance')?.textContent) || 0; - if (walletBalance < 5.00) { + if (walletBalance < {{ agent.price }}) { DataAnalyzerUtils.showToast('Insufficient wallet balance', 'error'); setTimeout(() => { window.location.href = "{% url 'wallet:wallet' %}"; @@ -547,13 +547,13 @@ document.addEventListener('keydown', function(e) {
{% if user.is_authenticated %} - {% if user.wallet_balance >= 5.00 %} + {% if user.wallet_balance >= agent.price %} {% else %}
- Insufficient balance! You need 5.00 AED. + Insufficient balance! You need {{ agent.price }} AED.
💰 Top Up Wallet diff --git a/email_writer/templates/email_writer/detail.html b/email_writer/templates/email_writer/detail.html index 7afcab3..6e46b52 100644 --- a/email_writer/templates/email_writer/detail.html +++ b/email_writer/templates/email_writer/detail.html @@ -777,7 +777,7 @@ const EmailWriterModule = (function() { const currentBalance = walletBalanceElement ? parseFloat(walletBalanceElement.textContent) : 0; - if (currentBalance < 3.00) { + if (currentBalance < {{ agent.price }}) { this.showToast('Insufficient wallet balance. Please top up your wallet.', 'error'); return false; } @@ -907,13 +907,13 @@ const AgentUtils = EmailWriterModule.EmailWriterUtils;
{% if user.is_authenticated %} - {% if user.wallet_balance >= 3.00 %} + {% if user.wallet_balance >= agent.price %} {% else %}
- Insufficient balance! You need 3.00 AED. + Insufficient balance! You need {{ agent.price }} AED.
💰 Top Up Wallet @@ -1026,14 +1026,25 @@ const AgentUtils = EmailWriterModule.EmailWriterUtils; function copyResults() { const emailContent = document.getElementById('resultsContent'); const text = emailContent ? (emailContent.innerText || emailContent.textContent || '') : ''; - AgentUtils.copyToClipboard(text, 'Email copied to clipboard!'); + navigator.clipboard.writeText(text).then(() => { + AgentUtils.showToast('📋 Copied to clipboard!', 'success'); + }).catch(() => { + AgentUtils.showToast('❌ Failed to copy to clipboard', 'error'); + }); } // Download email as text file function downloadResults() { const emailContent = document.getElementById('resultsContent'); const text = emailContent ? (emailContent.innerText || emailContent.textContent || '') : ''; - AgentUtils.downloadAsFile(text, `email-${Date.now()}.txt`, 'Email downloaded!'); + const blob = new Blob([text], { type: 'text/plain' }); + const url = URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = `email-${Date.now()}.txt`; + a.click(); + URL.revokeObjectURL(url); + // No toast for download - file download is confirmation enough } // Reset form @@ -1054,9 +1065,9 @@ const AgentUtils = EmailWriterModule.EmailWriterUtils; const processButton = document.getElementById('processButton'); processButton.disabled = false; processButton.classList.remove('btn-loading'); - processButton.innerHTML = '📧 Generate Email (3.00 AED)'; + processButton.innerHTML = '📧 Generate Email ({{ agent.price }} AED)'; - AgentUtils.showToast('Form reset! Ready for another email.', 'success'); + // No toast for reset - visual feedback is enough } // Display email results @@ -1104,8 +1115,7 @@ const AgentUtils = EmailWriterModule.EmailWriterUtils; resultsContainer.scrollIntoView({ behavior: 'smooth' }); // Show success message - const successMessage = result.success ? '✅ Email created and payment processed!' : '✅ Email generated!'; - AgentUtils.showToast(successMessage, 'success'); + AgentUtils.showToast('✅ Email completed successfully!', 'success'); } // Poll for results @@ -1138,7 +1148,7 @@ const AgentUtils = EmailWriterModule.EmailWriterUtils; const processButton = document.getElementById('processButton'); processButton.disabled = false; processButton.classList.remove('btn-loading'); - processButton.innerHTML = '📧 Generate Email (3.00 AED)'; + processButton.innerHTML = '📧 Generate Email ({{ agent.price }} AED)'; // Display results only once if (!EmailWriterModule.getResultsDisplayed()) { @@ -1153,7 +1163,7 @@ const AgentUtils = EmailWriterModule.EmailWriterUtils; const processButton = document.getElementById('processButton'); processButton.disabled = false; processButton.classList.remove('btn-loading'); - processButton.innerHTML = '📧 Generate Email (3.00 AED)'; + processButton.innerHTML = '📧 Generate Email ({{ agent.price }} AED)'; AgentUtils.showToast('❌ Processing timeout - please try again', 'error'); } @@ -1167,7 +1177,7 @@ const AgentUtils = EmailWriterModule.EmailWriterUtils; const processButton = document.getElementById('processButton'); processButton.disabled = false; processButton.classList.remove('btn-loading'); - processButton.innerHTML = '📧 Generate Email (3.00 AED)'; + processButton.innerHTML = '📧 Generate Email ({{ agent.price }} AED)'; AgentUtils.showToast('❌ Network error during processing - please try again', 'error'); }); @@ -1258,7 +1268,7 @@ const AgentUtils = EmailWriterModule.EmailWriterUtils; document.getElementById('processingStatus').style.display = 'none'; processButton.disabled = false; processButton.classList.remove('btn-loading'); - processButton.innerHTML = '📧 Generate Email (3.00 AED)'; + processButton.innerHTML = '📧 Generate Email ({{ agent.price }} AED)'; if (result.error) { AgentUtils.showToast(`❌ ${result.error}`, 'error'); @@ -1273,7 +1283,7 @@ const AgentUtils = EmailWriterModule.EmailWriterUtils; document.getElementById('processingStatus').style.display = 'none'; processButton.disabled = false; processButton.classList.remove('btn-loading'); - processButton.innerHTML = '📧 Generate Email (3.00 AED)'; + processButton.innerHTML = '📧 Generate Email ({{ agent.price }} AED)'; AgentUtils.showToast('❌ Network error - please try again', 'error'); }); }); diff --git a/five_whys_analyzer/templates/five_whys_analyzer/detail.html b/five_whys_analyzer/templates/five_whys_analyzer/detail.html index 56e8da2..77de989 100644 --- a/five_whys_analyzer/templates/five_whys_analyzer/detail.html +++ b/five_whys_analyzer/templates/five_whys_analyzer/detail.html @@ -98,9 +98,9 @@ // Copy to Clipboard Utility function copyToClipboard(text, successMessage = 'Copied to clipboard!') { navigator.clipboard.writeText(text).then(() => { - showToast(`📋 ${successMessage}`, 'success'); + showToast('📋 Copied to clipboard!', 'success'); }).catch(() => { - showToast('Failed to copy to clipboard', 'error'); + showToast('❌ Failed to copy to clipboard', 'error'); }); } @@ -113,7 +113,7 @@ a.download = filename || `content-${Date.now()}.txt`; a.click(); URL.revokeObjectURL(url); - showToast(`💾 ${successMessage}`, 'success'); + // No toast for download - file download is confirmation enough } // Close panel on Escape key @@ -129,7 +129,7 @@ const content = document.getElementById('reportContent'); if (content) { const text = content.textContent || content.innerText || ''; - copyToClipboard(text, '5 Whys report copied to clipboard!'); + copyToClipboard(text); } }, @@ -137,7 +137,7 @@ const content = document.getElementById('reportContent'); if (content) { const text = content.textContent || content.innerText || ''; - downloadAsFile(text, `5-whys-report-${Date.now()}.txt`, '5 Whys report downloaded!'); + downloadAsFile(text, `5-whys-report-${Date.now()}.txt`); } } }; @@ -697,7 +697,7 @@ updateWalletBalance(data.wallet_balance); } - showToast('✅ Report generated and payment processed!', 'success'); + showToast('✅ 5 Whys analysis completed successfully!', 'success'); } else { showToast(data.error || 'Failed to generate report', 'error'); } @@ -756,12 +756,23 @@ function copyReport() { const reportText = generateTextForExport('reportContent'); - copyToClipboard(reportText, '📋 Report copied to clipboard!'); + navigator.clipboard.writeText(reportText).then(() => { + showToast('📋 Copied to clipboard!', 'success'); + }).catch(() => { + showToast('❌ Failed to copy to clipboard', 'error'); + }); } function downloadReport() { const reportText = generateTextForExport('reportContent'); - downloadAsFile(reportText, `five-whys-analysis-${Date.now()}.txt`, '💾 Report downloaded!'); + const blob = new Blob([reportText], { type: 'text/plain' }); + const url = URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = `five-whys-analysis-${Date.now()}.txt`; + a.click(); + URL.revokeObjectURL(url); + // No toast for download - file download is confirmation enough } function generateTextForExport(elementId) { diff --git a/job_posting_generator/templates/job_posting_generator/detail.html b/job_posting_generator/templates/job_posting_generator/detail.html index c32803c..b17bcdb 100644 --- a/job_posting_generator/templates/job_posting_generator/detail.html +++ b/job_posting_generator/templates/job_posting_generator/detail.html @@ -574,7 +574,7 @@ } const currentBalance = parseFloat(document.getElementById('walletBalance').textContent) || 0; - const requiredBalance = window.AGENT_PRICE || 3.00; + const requiredBalance = window.AGENT_PRICE || {{ agent.price }}; if (currentBalance < requiredBalance) { showToast(`Insufficient balance! You need ${requiredBalance} AED.`, 'error'); setTimeout(() => window.location.href = document.body.getAttribute('data-wallet-url'), 2000); diff --git a/social_ads_generator/templates/social_ads_generator/detail.html b/social_ads_generator/templates/social_ads_generator/detail.html index 8663cf9..48b2aee 100644 --- a/social_ads_generator/templates/social_ads_generator/detail.html +++ b/social_ads_generator/templates/social_ads_generator/detail.html @@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', function() { // Set data for JavaScript access document.body.setAttribute('data-user-authenticated', '{{ user.is_authenticated|yesno:"true,false" }}'); - document.body.setAttribute('data-agent-price', '4.00'); + document.body.setAttribute('data-agent-price', '{{ agent.price }}'); // Initialize form submission const form = document.getElementById('agentForm'); @@ -109,7 +109,7 @@ const SocialAdsUtils = { const submitBtn = document.getElementById('generateBtn'); if (submitBtn) { submitBtn.disabled = false; - submitBtn.textContent = '📢 Generate Social Ads (4.00 AED)'; + submitBtn.textContent = '📢 Generate Social Ads ({{ agent.price }} AED)'; } }, @@ -152,7 +152,7 @@ const SocialAdsUtils = { } // Show success notification only for final result - this.showToast('✅ Social ads created successfully!', 'success'); + this.showToast('✅ Social ads completed successfully!', 'success'); } else if (result.error) { this.hideProcessing(); this.showToast(`❌ Error: ${result.error}`, 'error'); @@ -353,7 +353,7 @@ function copyResults() { navigator.clipboard.writeText(text).then(() => { SocialAdsUtils.showToast('📋 Copied to clipboard!', 'success'); }).catch(() => { - SocialAdsUtils.showToast('❌ Copy failed', 'error'); + SocialAdsUtils.showToast('❌ Failed to copy to clipboard', 'error'); }); } } @@ -464,7 +464,7 @@ function handleFormSubmission(e) { } const walletBalance = parseFloat(document.getElementById('walletBalance')?.textContent) || 0; - if (walletBalance < 4.00) { + if (walletBalance < {{ agent.price }}) { SocialAdsUtils.showToast('Insufficient wallet balance', 'error'); setTimeout(() => { window.location.href = "{% url 'wallet:wallet' %}"; @@ -629,13 +629,13 @@ document.addEventListener('keydown', function(e) {
{% if user.is_authenticated %} - {% if user.wallet_balance >= 4.00 %} + {% if user.wallet_balance >= agent.price %} {% else %}
- Insufficient balance! You need 4.00 AED. + Insufficient balance! You need {{ agent.price }} AED.
💰 Top Up Wallet diff --git a/weather_reporter/templates/weather_reporter/detail.html b/weather_reporter/templates/weather_reporter/detail.html index 6529dd0..83f8b97 100644 --- a/weather_reporter/templates/weather_reporter/detail.html +++ b/weather_reporter/templates/weather_reporter/detail.html @@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', function() { // Set data for JavaScript access document.body.setAttribute('data-user-authenticated', '{{ user.is_authenticated|yesno:"true,false" }}'); - document.body.setAttribute('data-agent-price', '2.00'); + document.body.setAttribute('data-agent-price', '{{ agent.price }}'); // Initialize form submission const form = document.getElementById('weatherForm'); @@ -107,7 +107,7 @@ const WeatherUtils = { this.updateWalletBalance(result.wallet_balance); } - this.showToast('✅ Weather report generated successfully!', 'success'); + this.showToast('✅ Weather report completed successfully!', 'success'); } else if (result.error) { if (processingStatus) processingStatus.style.display = 'none'; this.showToast(`❌ Error: ${result.error}`, 'error'); @@ -172,7 +172,7 @@ function copyResults() { if (content) { const text = content.innerText || content.textContent || ''; navigator.clipboard.writeText(text).then(() => { - WeatherUtils.showToast('📋 Weather report copied to clipboard!', 'success'); + WeatherUtils.showToast('📋 Copied to clipboard!', 'success'); }).catch(() => { WeatherUtils.showToast('❌ Failed to copy to clipboard', 'error'); }); @@ -191,7 +191,7 @@ function downloadResults() { a.download = 'weather-report.txt'; a.click(); URL.revokeObjectURL(url); - WeatherUtils.showToast('💾 Weather report downloaded!', 'success'); + // No toast for download - file download is confirmation enough } } @@ -221,7 +221,7 @@ function resetForm() { if (input) input.checked = true; } - WeatherUtils.showToast('🔄 Form reset - ready for new request', 'success'); + // No toast for reset - visual feedback is enough } // Quick Agent Access Functions @@ -288,7 +288,7 @@ function handleFormSubmission(e) { } const walletBalance = parseFloat(document.getElementById('walletBalance')?.textContent) || 0; - if (walletBalance < 2.00) { + if (walletBalance < {{ agent.price }}) { WeatherUtils.showToast('Insufficient wallet balance', 'error'); setTimeout(() => { window.location.href = "{% url 'wallet:wallet' %}"; @@ -388,13 +388,13 @@ function handleFormSubmission(e) {
{% if user.is_authenticated %} - {% if user.wallet_balance >= 2.00 %} + {% if user.wallet_balance >= agent.price %} {% else %}
- Insufficient balance! You need 2.00 AED. + Insufficient balance! You need {{ agent.price }} AED.
💰 Top Up Wallet